林豪 左 1 rok temu
rodzic
commit
7a3d206103

+ 1 - 1
ServiceCenter/ServiceCenter.csproj

@@ -20,12 +20,12 @@
     <PackageReference Include="PlcSiemens" Version="1.0.1" />
     <PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.5.0" />
     <PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.5.0" />
-    <PackageReference Include="WCS.Entity" Version="1.0.2" />
   </ItemGroup>
   
   <ItemGroup>
     <ProjectReference Include="..\WCS.Core\WCS.Core.csproj" />
     <ProjectReference Include="..\WCS.Entity.Protocol\WCS.Entity.Protocol.csproj" />
+    <ProjectReference Include="..\WCS.Entity\WCS.Entity.csproj" />
   </ItemGroup>
 
 </Project>

+ 4 - 5
WCS.WorkEngineering/Systems/一楼扫码入库.cs

@@ -37,12 +37,11 @@ namespace WCS.WorkEngineering.Systems
             {
                 SqlSugarHelper.Do(_db =>
                 {
-                    var db = _db.Default;
                     //获取托盘条码
                     var barcode = obj.Data5.GetBCRCode();
-
+                    task = _db.Default.Queryable<WCS_TaskInfo>().First(v => v.BarCode == barcode);
                     //验证是否有对应的任务
-                    if (!db.Queryable<WCS_TaskInfo>().Any(v => v.BarCode == barcode))
+                    if (!_db.Default.Queryable<WCS_TaskInfo>().Any(v => v.BarCode == barcode))
                     {
                         WmsApi.OneFloorWorkerBuildEmptyPalletsStock(new OneFloorWorkerBuildEmptyPalletsStockRequest()
                         {
@@ -51,7 +50,7 @@ namespace WCS.WorkEngineering.Systems
                         });
                     }
                     //找到对应的任务
-                    task = db.Queryable<WCS_TaskInfo>().First(v => v.BarCode == barcode);
+                    task = _db.Default.Queryable<WCS_TaskInfo>().First(v => v.BarCode == barcode);
                     if (task.Status == Entity.TaskStatus.NewBuild)
                     {
                         //开始对任务进行处理
@@ -59,7 +58,7 @@ namespace WCS.WorkEngineering.Systems
                         task.StartTime = DateTime.Now;
                         task.SrmStation = task.AddrFrom;
                         task.AddWCS_TASK_DTL(_db, obj.Entity.Code, "开始执行入库任务");
-                        db.Updateable(task).ExecuteCommand();
+                        _db.Default.Updateable(task).ExecuteCommand();
                         task.updateRedisHash();
                     }
                     else return;

+ 36 - 13
WCS.WorkEngineering/WorkStart.cs

@@ -34,24 +34,47 @@ namespace WCS.WorkEngineering
 
             #region 托盘线输送线
 
-            List<StationSegmentInfo> segmentInfo = new List<StationSegmentInfo>
+            //List<StationSegmentInfo> segmentInfo = new List<StationSegmentInfo>
+            //{
+            //    new StationSegmentInfo(2701, 2734, "10.30.37.89"),
+            //    new StationSegmentInfo(2501, 2534, "10.30.37.89"),
+            //    new StationSegmentInfo(1611, 1616, "10.30.37.89"),
+            //    new StationSegmentInfo(1601, 1606, "10.30.37.89"),
+            //};
+
+            List<Tuple<string, List<Tuple<int, int>>>> tuples = new List<Tuple<string, List<Tuple<int, int>>>>()
             {
-                new StationSegmentInfo(2701, 2734, "10.30.37.89"),
-                new StationSegmentInfo(2501, 2534, "10.30.37.89"),
-                new StationSegmentInfo(1611, 1616, "10.30.37.89"),
-                new StationSegmentInfo(1601, 1606, "10.30.37.89"),
+                new Tuple<string, List<Tuple<int, int>>>("10.30.37.89",new List<Tuple<int, int>>()
+                {
+                    new Tuple<int, int>(1601, 1620),
+                    new Tuple<int, int>(2501, 2540),
+                    new Tuple<int, int>(2701, 2740),
+                })
             };
 
-            foreach (var item in segmentInfo)
+            foreach (var item in tuples)
             {
-                for (int i = item.Start; i <= item.End; i++)
+                var db520 = 0;
+                var db521 = 0;
+                var db523 = 0;
+                foreach (var item1 in item.Item2)
                 {
-                    var conv = new Device(i.ToString());
-                    conv.AddFlag(DeviceFlags.输送机);
-
-                    conv.AddProtocol<IStation520>((i - item.Start) * 14, 520, item.IP);
-                    conv.AddProtocol<IStation521>((i - item.Start) * 16, 521, item.IP);
-                    conv.AddProtocol<IStation523>((i - item.Start) * 12, 523, item.IP);
+                    for (int i = item1.Item1; i <= item1.Item2; i++)
+                    {
+                        var conv = new Device(i.ToString());
+                        conv.AddFlag(DeviceFlags.输送机);
+
+                        conv.AddProtocol<IStation520>(db520, 520, item.Item1);
+                        conv.AddProtocol<IStation521>(db521, 521, item.Item1);
+                        conv.AddProtocol<IStation523>(db523, 523, item.Item1);
+                        if (i == 2532)
+                        {
+                            var a = 0;
+                        }
+                        db520 = db520 + 14;
+                        db521 = db521 + 16;
+                        db523 = db523 + 12;
+                    }
                 }
             }