林豪 左 1 سال پیش
والد
کامیت
1a03371511
20فایلهای تغییر یافته به همراه568 افزوده شده و 362 حذف شده
  1. 1 1
      ServiceCenter/ServiceCenter.csproj
  2. 6 0
      WCS.Entity/WCS_CacheLine.cs
  3. 12 0
      WCS.Entity/WCS_Palletizing.cs
  4. 6 0
      WCS.Entity/WCS_PalletizingLayer.cs
  5. 6 0
      WCS.Entity/WCS_PalletizingLoc.cs
  6. 6 0
      WCS.Entity/WCS_PalletizingRow.cs
  7. 1 1
      WCS.Service/appsettings.json
  8. 4 1
      业务工程/分拣库/WCS.WorkEngineering/Extensions/DeviceExtension.cs
  9. 10 5
      业务工程/分拣库/WCS.WorkEngineering/Extensions/TaskExtension.cs
  10. 15 13
      业务工程/分拣库/WCS.WorkEngineering/Systems/AgvSystems.cs
  11. 16 0
      业务工程/分拣库/WCS.WorkEngineering/Systems/NoInteractionSystems.cs
  12. 1 2
      业务工程/分拣库/WCS.WorkEngineering/Systems/UpLoadSystems.cs
  13. 2 2
      业务工程/分拣库/WCS.WorkEngineering/Systems/一楼叠盘机入库.cs
  14. 20 19
      业务工程/分拣库/WCS.WorkEngineering/Systems/分拣主线/满轮主线预写入目标地址.cs
  15. 176 3
      业务工程/分拣库/WCS.WorkEngineering/Systems/分拣支线/桁架分流点.cs
  16. 65 244
      业务工程/分拣库/WCS.WorkEngineering/Systems/分拣支线/环形库分流点.cs
  17. 58 56
      业务工程/分拣库/WCS.WorkEngineering/Systems/桁架码垛/桁架.cs
  18. 26 5
      业务工程/分拣库/WCS.WorkEngineering/Systems/桁架码垛/桁架码垛区补空托盘任务生成.cs
  19. 61 5
      业务工程/分拣库/WCS.WorkEngineering/Systems/桁架码垛/桁架缓存放行点.cs
  20. 76 5
      业务工程/分拣库/WCS.WorkEngineering/WorkStart.cs

+ 1 - 1
ServiceCenter/ServiceCenter.csproj

@@ -20,11 +20,11 @@
     <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.3.15" />
   </ItemGroup>
   
   <ItemGroup>
     <ProjectReference Include="..\WCS.Core\WCS.Core.csproj" />
+    <ProjectReference Include="..\WCS.Entity\WCS.Entity.csproj" />
   </ItemGroup>
 
 </Project>

+ 6 - 0
WCS.Entity/WCS_CacheLine.cs

@@ -76,6 +76,12 @@ namespace WCS.Entity
         [SugarColumn(IsNullable = false, ColumnDescription = "桁架是否开始取货")]
         public bool IsTruss { get; set; }
 
+        /// <summary>
+        ///  仓库编号
+        /// </summary>
+        [SugarColumn(ColumnDescription = "仓库编号", IsNullable = true)]
+        public string WarehouseCode { get; set; }
+
         /// <summary>
         ///  创建时间
         /// </summary>

+ 12 - 0
WCS.Entity/WCS_Palletizing.cs

@@ -106,6 +106,18 @@ namespace WCS.Entity
         [SugarColumn(IsNullable = true, ColumnDescription = "当前所有的物料号")]
         public string MatCodeList { get; set; }
 
+        /// <summary>
+        ///  仓库编号
+        /// </summary>
+        [SugarColumn(ColumnDescription = "仓库编号", IsNullable = true)]
+        public string WarehouseCode { get; set; }
+
+        /// <summary>
+        ///  执行设备编号,桁架/机械手/、、、
+        /// </summary>
+        [SugarColumn(ColumnDescription = "执行设备编号", IsNullable = true)]
+        public string DeviceCode { get; set; }
+
         /// <summary>
         ///  创建时间
         /// </summary>

+ 6 - 0
WCS.Entity/WCS_PalletizingLayer.cs

@@ -56,5 +56,11 @@ namespace WCS.Entity
         /// </summary>
         [SugarColumn(IsNullable = false, ColumnDescription = "是否结束")]
         public bool Finish { get; set; }
+
+        /// <summary>
+        ///  仓库编号
+        /// </summary>
+        [SugarColumn(ColumnDescription = "仓库编号", IsNullable = true)]
+        public string WarehouseCode { get; set; }
     }
 }

+ 6 - 0
WCS.Entity/WCS_PalletizingLoc.cs

@@ -79,5 +79,11 @@ namespace WCS.Entity
         /// </summary>
         [SugarColumn(IsNullable = false, ColumnDescription = "是否结束")]
         public bool Finish { get; set; }
+
+        /// <summary>
+        ///  仓库编号
+        /// </summary>
+        [SugarColumn(ColumnDescription = "仓库编号", IsNullable = true)]
+        public string WarehouseCode { get; set; }
     }
 }

+ 6 - 0
WCS.Entity/WCS_PalletizingRow.cs

@@ -93,5 +93,11 @@ namespace WCS.Entity
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDescription = "编辑时间")]
         public DateTime EditTime { get; set; }
+
+        /// <summary>
+        ///  仓库编号
+        /// </summary>
+        [SugarColumn(ColumnDescription = "仓库编号", IsNullable = true)]
+        public string WarehouseCode { get; set; }
     }
 }

+ 1 - 1
WCS.Service/appsettings.json

@@ -7,6 +7,6 @@
     }
   },
   "ConnectionStrings": {
-    "Redis": "127.0.0.1,database=0,prefix=Sorting:"
+    "Redis": "10.30.37.1,database=0,prefix=Sorting:"
   }
 }

+ 4 - 1
业务工程/分拣库/WCS.WorkEngineering/Extensions/DeviceExtension.cs

@@ -389,7 +389,10 @@ namespace WCS.WorkEngineering.Extensions
         拆盘机非09 = 1L << 36,
         桁架码垛位 = 1L << 37,
         环形库码垛工位 = 1L << 38,
-        Robot = 1L << 39
+        Robot = 1L << 39,
+        桁架09缓存放行点 = 1L << 40,
+        桁架18缓存放行点 = 1L << 41,
+        桁架09异常缓存放行点 = 1L << 42,
     }
 
     /// <summary>

+ 10 - 5
业务工程/分拣库/WCS.WorkEngineering/Extensions/TaskExtension.cs

@@ -207,7 +207,9 @@ namespace WCS.WorkEngineering.Extensions
                 StampType = billBomsetgrp.StampType,
                 Finish = false,
                 AddTime = DateTime.Now,
-                TaskId = task.ID
+                TaskId = task.ID,
+                WarehouseCode = task.WarehouseCode,
+                DeviceCode = task.Device
             };
             palletizing = db.Insertable(palletizing).ExecuteReturnEntity();
             foreach (var item in billBomsetinfos.GroupBy(x => x.Row).OrderBy(x => x.Key))
@@ -221,7 +223,8 @@ namespace WCS.WorkEngineering.Extensions
                     palletizingLayer = new WCS_PalletizingLayer()
                     {
                         LayerNo = layerNo,
-                        PalletizingId = palletizing.Id
+                        PalletizingId = palletizing.Id,
+                        WarehouseCode = palletizing.WarehouseCode,
                     };
                     palletizingLayer = db.Insertable(palletizingLayer).ExecuteReturnEntity();
                 }
@@ -234,7 +237,8 @@ namespace WCS.WorkEngineering.Extensions
                     palletizingRow = new WCS_PalletizingRow()
                     {
                         RowNo = item.Key,
-                        PalletizingLayerId = palletizingLayer.Id
+                        PalletizingLayerId = palletizingLayer.Id,
+                        WarehouseCode = palletizingLayer.WarehouseCode
                     };
                     palletizingRow = db.Insertable(palletizingRow).ExecuteReturnEntity();
                 }
@@ -261,9 +265,10 @@ namespace WCS.WorkEngineering.Extensions
                             SpoolType = loc.SpoolType,
                             TaskId = task.ID,
                             PalletizingRowId = palletizingRow.Id,
-                            Finish = false
+                            Finish = false,
+                            WarehouseCode = palletizingRow.WarehouseCode
                         };
-                        palletizingLoc = db.Insertable(palletizingLoc).ExecuteReturnEntity();
+                        db.Insertable(palletizingLoc).ExecuteReturnEntity();
                     }
 
                     //同步是否混合料行

+ 15 - 13
业务工程/分拣库/WCS.WorkEngineering/Systems/AgvSystems.cs

@@ -58,7 +58,7 @@ namespace WCS.WorkEngineering.Systems
                                         {
                                             var taskInfo = db.Default.Queryable<WCS_TaskInfo>().First(v => v.ID == agv.TaskId);
                                             agv.Status = AGVTaskStatus.RequestOrPermission2;
-                                            db.Default.Updateable(agv).SplitTable(x=>x.Take(2)).ExecuteCommand();
+                                            db.Default.Updateable(agv).SplitTable(x => x.Take(2)).ExecuteCommand();
                                             taskInfo.AddWCS_TASK_DTL(db.Default, "agv", $"允许AGV任务{agv.ID}在站台{agv.Station}取货");
                                             AgvApi.ContinueTask(agv.AgvID, agv.Station);
                                             break;
@@ -66,7 +66,7 @@ namespace WCS.WorkEngineering.Systems
                                     case AGVTaskStatus.PutRequestOrPermission when agv.Status != AGVTaskStatus.PutRequestOrPermission:
                                         {
                                             agv.Status = AGVTaskStatus.PutRequestOrPermission;
-                                            db.Default.Updateable(agv).SplitTable(x=>x.Take(2)).ExecuteCommand();
+                                            db.Default.Updateable(agv).SplitTable(x => x.Take(2)).ExecuteCommand();
                                             AgvApi.ContinueTask(agv.AgvID, agv.Station);
                                             break;
                                         }
@@ -74,7 +74,7 @@ namespace WCS.WorkEngineering.Systems
                                         var devinfo = new Device<IStation520>(Device.All.First(x => x.Code == agv.Station), World);
                                         devinfo.Data.CmdType = StationCmd.Res3;
                                         agv.Status = AGVTaskStatus.LeaveGet;
-                                        db.Default.Updateable(agv).SplitTable(x=>x.Take(2)).ExecuteCommand();
+                                        db.Default.Updateable(agv).SplitTable(x => x.Take(2)).ExecuteCommand();
                                         break;
                                     //完成任务
                                     case AGVTaskStatus.MissionCompleted when agv.Status != AGVTaskStatus.MissionCompleted:
@@ -85,7 +85,7 @@ namespace WCS.WorkEngineering.Systems
                                                 if (taskInfo == null) throw new Exception($"未找到AGV任务{agv.ID}对应WCS任务");
                                                 //更新AGV任务状态
                                                 agv.Status = AGVTaskStatus.MissionCompleted;
-                                                db.Default.Updateable(agv).SplitTable(x=>x.Take(2)).ExecuteCommand();
+                                                db.Default.Updateable(agv).SplitTable(x => x.Take(2)).ExecuteCommand();
                                                 //更新WCS任务状态
                                                 taskInfo.Status = Entity.TaskStatus.Finish;
                                                 taskInfo.EedTime = DateTime.Now;
@@ -96,7 +96,7 @@ namespace WCS.WorkEngineering.Systems
                                             else
                                             {
                                                 agv.Status = AGVTaskStatus.MissionCompleted;
-                                                db.Default.Updateable(agv).SplitTable(x=>x.Take(2)).ExecuteCommand();
+                                                db.Default.Updateable(agv).SplitTable(x => x.Take(2)).ExecuteCommand();
                                             }
 
                                             break;
@@ -146,42 +146,44 @@ namespace WCS.WorkEngineering.Systems
                                         agv.AgvID = agv.ID.ToString();
                                         agv.Status = AGVTaskStatus.Confirm;
                                         agv.AgvStatus = AGVTaskStatus.Confirm;
-                                        db.Default.Updateable(agv).SplitTable(x=>x.Take(2)).ExecuteCommand();
+                                        db.Default.Updateable(agv).SplitTable(x => x.Take(2)).ExecuteCommand();
                                         break;
                                     //巷道分配
                                     case AGVTaskStatus.RequestOrPermission1 when agv.Status != AGVTaskStatus.Complete1:
                                         {
                                             agv.Status = AGVTaskStatus.Complete1;
                                             agv.Position = "2501";
-                                            db.Default.Updateable(agv).SplitTable(x=>x.Take(2)).ExecuteCommand();
+                                            db.Default.Updateable(agv).SplitTable(x => x.Take(2)).ExecuteCommand();
 
                                             //task.Status = TaskStatus.Finish;
                                             //db.Default.Updateable(task).ExecuteCommand();
                                             //task.AddWCS_TASK_DTL(db.Default, "AGV搬运任务分配放货点", agv.Position, $"任务分配至:{agv.Position}");
                                             //调继续执行任务接口
-                                            AgvApi.ContinueTask(agv.AgvID, agv.Position);
+                                            AgvApi.ContinueTask(agv.AgvID, agv.Station);
                                             //}
                                             break;
                                         }
                                     //取货站点安全交互
                                     case AGVTaskStatus.RequestOrPermission2 when agv.Status != AGVTaskStatus.RequestOrPermission2:
                                         {
-                                            if (agv.Position.IsNullOrEmpty()) throw new Exception($"无有效放货地址");
-                                            var dev = Device.All.First(x => x.Code == agv.Position);
+                                            if (agv.Station.IsNullOrEmpty()) throw new Exception($"无有效放货地址");
+                                            var dev = Device.All.First(x => x.Code == agv.Station);
                                             //调继续执行任务接口
                                             AgvApi.ContinueTask(agv.AgvID, dev.Code);
                                             break;
                                         }
                                     case AGVTaskStatus.LeavePut when agv.Status != AGVTaskStatus.LeavePut:
-                                        var devinfo = new Device<IStation520, IStation521>(Device.All.First(x => x.Code == agv.Position), World);
-                                        devinfo.Data.CmdType = StationCmd.Res2;
+
+
                                         break;
                                     //完成任务
                                     case AGVTaskStatus.MissionCompleted when agv.Status != AGVTaskStatus.MissionCompleted:
                                         if (agv.TaskType == AGVTaskType.EnterDepot)
                                         {
                                             agv.Status = AGVTaskStatus.MissionCompleted;
-                                            db.Default.Updateable(agv).SplitTable(x=>x.Take(2)).ExecuteCommand();
+                                            db.Default.Updateable(agv).SplitTable(x => x.Take(2)).ExecuteCommand();
+                                            var devinfo = new Device<IStation520, IStation521>(Device.All.First(x => x.Code == agv.Station), World);
+                                            devinfo.Data.CmdType = StationCmd.Res2;
                                         }
                                         break;
                                 }

+ 16 - 0
业务工程/分拣库/WCS.WorkEngineering/Systems/NoInteractionSystems.cs

@@ -122,6 +122,22 @@ namespace WCS.WorkEngineering.Systems
                                                         srmStation[0] = "";
                                                         srmStation[1] = "";
                                                         break;
+                                                    case "SRM3":
+                                                        srmStation[0] = "";
+                                                        srmStation[1] = "";
+                                                        break;
+                                                    case "SRM4":
+                                                        srmStation[0] = "";
+                                                        srmStation[1] = "";
+                                                        break;
+                                                    case "SRM5":
+                                                        srmStation[0] = "";
+                                                        srmStation[1] = "";
+                                                        break;
+                                                    case "SRM6":
+                                                        srmStation[0] = "";
+                                                        srmStation[1] = "";
+                                                        break;
                                                 }
 
                                                 //TODO:暂时不考虑入库卡控

+ 1 - 2
业务工程/分拣库/WCS.WorkEngineering/Systems/UpLoadSystems.cs

@@ -13,7 +13,7 @@ using TaskStatus = WCS.Entity.TaskStatus;
 namespace WCS.WorkEngineering.Systems
 {
     /// <summary>
-    ///  无交互系统
+    ///  UpLoadSystems
     /// </summary>
     [BelongTo(typeof(UpLoadWorld))]
     [Description("UpLoadSystems")]
@@ -25,7 +25,6 @@ namespace WCS.WorkEngineering.Systems
 
         public override void Do(Device<IStation520> obj)
         {
-            World.Log($"测试");
             //更新机械臂出库完成状态
             SqlSugarHelper.Do(_db =>
             {

+ 2 - 2
业务工程/分拣库/WCS.WorkEngineering/Systems/一楼叠盘机入库.cs

@@ -44,7 +44,7 @@ namespace WCS.WorkEngineering.Systems
                     var db = _db.Default;
 
                     //验证是否有对应的任务
-                    if (!db.Queryable<WCS_TaskInfo>().Any(v => v.BarCode.Contains(barcode) && v.Type == TaskType.EnterDepot))
+                    if (!db.Queryable<WCS_TaskInfo>().Any(v => v.BarCode.Contains(barcode) && v.AddrFrom == obj.Entity.Code && v.Type == TaskType.EnterDepot))
                     {
                         var res = WmsApi.OneFloorWorkerBuildEmptyPalletsStock(new OneFloorWorkerBuildEmptyPalletsStockRequest()
                         {
@@ -56,7 +56,7 @@ namespace WCS.WorkEngineering.Systems
                         if (res.ResCode == WebApi.Models.WMS.Response.ResponseStatusCodeEnum.Sucess) return;
                     }
                     //找到对应的任务
-                    var taskInfo = db.Queryable<WCS_TaskInfo>().First(v => v.BarCode.Contains(barcode) && v.Type == TaskType.EnterDepot);
+                    var taskInfo = db.Queryable<WCS_TaskInfo>().First(v => v.BarCode.Contains(barcode) && v.AddrFrom == obj.Entity.Code && v.Type == TaskType.EnterDepot);
                     if (taskInfo.Status == Entity.TaskStatus.WaitingToExecute)
                     {
                         var tunnel = obj.Entity.Targets.FirstOrDefault(v => v.HasFlag(DeviceFlags.巷道));

+ 20 - 19
业务工程/分拣库/WCS.WorkEngineering/Systems/分拣主线/满轮主线预写入目标地址.cs

@@ -49,37 +49,38 @@ namespace WCS.WorkEngineering.Systems
                 var mainlineDiversion = JsonConvert.DeserializeObject<MainlineDiversion>(value);
                 var srmCode = mainlineDiversion.WarehouseCode.WarehouseToSrm();
                 var next = DevicePath.GetPath(obj.Entity.Code, srmCode).Points[1].Code;
-
-                //开始检查任务信息
-                var db = new SqlSugarHelper();
-                var task = db.Default.Queryable<WCS_TaskInfo>().Single(x => x.BarCode == bcrCode && x.ID == mainlineDiversion.TaskId && x.Status == TaskStatus.NewBuild);
-                if (task == null)
-                {
-                    World.Log($"{bcrCode}-{mainlineDiversion}:找不到匹配任务", LogLevelEnum.High);
-                    continue;
-                }
+                WCS_TaskInfo taskInfo = null;
 
                 try
                 {
-                    db.Connect.BeginTran();
-                    task.Status = TaskStatus.WaitingToExecute;
-                    task.EditWho = "WCS";
-                    task.StartTime = DateTime.Now;
-                    task.EditTime = DateTime.Now;
-                    db.Default.Updateable(task).ExecuteCommand();
-                    task.AddWCS_TASK_DTL(db.Default, obj.Entity.Code, next.ToString(), "任务完成预分流");
-                    db.Connect.CommitTran();
+                    SqlSugarHelper.Do(_db =>
+                    {
+                        var db = _db.Default;
+                        var task = db.Queryable<WCS_TaskInfo>().Single(x => x.BarCode == bcrCode && x.ID == mainlineDiversion.TaskId && x.Status == TaskStatus.NewBuild);
+                        if (task == null)
+                        {
+                            World.Log($"{bcrCode}-{mainlineDiversion}:找不到匹配任务", LogLevelEnum.High);
+                            return;
+                        }
+                        task.Status = TaskStatus.WaitingToExecute;
+                        task.EditWho = "WCS";
+                        task.StartTime = DateTime.Now;
+                        task.EditTime = DateTime.Now;
+                        db.Updateable(task).ExecuteCommand();
+                        task.AddWCS_TASK_DTL(db, obj.Entity.Code, next, "任务完成预分流");
+                        taskInfo = task;
+                    });
                 }
                 catch (Exception e)
                 {
-                    db.Connect.RollbackTran();
                     World.Log($"{bcrCode}-{mainlineDiversion}:----{e.Message}", LogLevelEnum.High);
                     continue;
                 }
 
+                if (taskInfo == null) continue;
                 //开始赋值
                 obj.Data3.GetType().GetProperty($"BcrCode{obj.Data3.NextIndex}").SetValue(obj.Data3, bcrCode);
-                obj.Data3.GetType().GetProperty($"TaskNumber{obj.Data3.NextIndex}").SetValue(obj.Data3, task.ID);
+                obj.Data3.GetType().GetProperty($"TaskNumber{obj.Data3.NextIndex}").SetValue(obj.Data3, taskInfo.ID);
                 obj.Data3.GetType().GetProperty($"GoodsEnd{obj.Data3.NextIndex}").SetValue(obj.Data3, next.ToShort());
                 if (obj.Data3.NextIndex >= 49)
                 {

+ 176 - 3
业务工程/分拣库/WCS.WorkEngineering/Systems/分拣支线/桁架分流点.cs

@@ -1,12 +1,15 @@
-using ServiceCenter.Extensions;
+using PlcSiemens.Core.Extension;
+using ServiceCenter.Extensions;
 using ServiceCenter.Logs;
 using ServiceCenter.SqlSugars;
+using SqlSugar;
 using System.ComponentModel;
 using WCS.Core;
 using WCS.Entity;
 using WCS.Entity.Protocol.Station;
 using WCS.WorkEngineering.Extensions;
 using WCS.WorkEngineering.Worlds;
+using DeviceFlags = WCS.WorkEngineering.Extensions.DeviceFlags;
 using TaskStatus = WCS.Entity.TaskStatus;
 
 namespace WCS.WorkEngineering.Systems
@@ -29,8 +32,15 @@ namespace WCS.WorkEngineering.Systems
             if (!obj.Data3.Status.HasFlag(StationStatus.OT_Status)) throw new KnownException("站台货物信息与实际占用不一致", LogLevelEnum.Low);
             if (obj.Data2.Request != 1) throw new KnownException("无请求", LogLevelEnum.Mid);
 
-            var db = new SqlSugarHelper();
-            var taskInfo = db.Default.Queryable<WCS_TaskInfo>().First(v => v.ID == obj.Data2.TaskNumber && v.Status == TaskStatus.FinishOfShunt) ?? throw new KnownException("未找到对应的WCS任务", LogLevelEnum.Mid);
+            WCS_TaskInfo taskInfo = null;
+            SqlSugarHelper.Do(_db =>
+            {
+                var db = _db.Default;
+                var task = db.Queryable<WCS_TaskInfo>().First(v => v.ID == obj.Data2.TaskNumber && v.Status == TaskStatus.WaitingToExecute) ?? throw new KnownException($"未找到对应的WCS任务{obj.Data2.TaskNumber}", LogLevelEnum.Mid);
+                if (Allot(db, task, obj)) taskInfo = task;
+            });
+
+            if (taskInfo == null) return;
 
             obj.Data.TaskNumber = obj.Data2.TaskNumber;
             obj.Data.GoodsStart = obj.Entity.Code.ToShort();
@@ -43,5 +53,168 @@ namespace WCS.WorkEngineering.Systems
         {
             return dev.HasFlag(Extensions.DeviceFlags.桁架分流点);
         }
+
+        /// <summary>
+        ///  计算去向
+        /// </summary>
+        /// <param name="db"></param>
+        /// <param name="taskInfo"></param>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public bool Allot(SqlSugarScopeProvider db, WCS_TaskInfo taskInfo, Device<IStation520, IStation521, IStation523> obj)
+        {
+            taskInfo.Device = obj.Entity.Code switch
+            {
+                "455" => "Truss1",
+                "655" => "Truss1",
+                "855" => "Truss2",
+                "1055" => "Truss2",
+                "1255" => "Truss3",
+                "1455" => "Truss3",
+                _ => "Error"
+            };
+            //获取当前货物类型可以到达的桁架缓存放行点信息
+            var cacheLineDevList = obj.Entity.Targets.Where(x => x.HasFlag(DeviceFlags.桁架缓存放行点)); //当前地址可以到达的所有桁架缓存放行点信息
+            switch (taskInfo.GoodsType)
+            {
+                case 9:
+                    //是异常工字轮
+                    cacheLineDevList = taskInfo.BarCode.Contains("Error") ? cacheLineDevList.Where(x => x.HasFlag(DeviceFlags.桁架09异常缓存放行点)) : cacheLineDevList.Where(x => x.HasFlag(DeviceFlags.桁架09缓存放行点));
+                    break;
+
+                case 18:
+                    cacheLineDevList = cacheLineDevList.Where(x => x.HasFlag(DeviceFlags.桁架18缓存放行点));
+                    break;
+            }
+            var cacheLineCodes = cacheLineDevList.Select(x => x.Code.ToShort());
+            var cacheLineList = db.Queryable<WCS_CacheLine>().Includes(x => x.Locations).ToList();
+
+            #region 跟据缓存信息寻找可以到达的缓存点
+
+            //找到当前任务可用的缓存线信息
+            var cacheLine = cacheLineList.Where(x => x.Locations.Any(l => l is { InStock: false, IsEmpty: false })).FirstOrDefault(x => cacheLineCodes.Contains(x.LocationNo) && x.MatCodeList.Contains(taskInfo.MatCode) && !x.InStock);
+
+            //这个任务可以直接去一条线体,不需要新建缓存信息
+            //找到这条线体中序号最小的一条位信息 非空置且无货
+            var cacheLoc = cacheLine?.Locations.Where(x => x is { InStock: false, IsEmpty: false }).MinBy(x => x.XYNo);
+            if (cacheLoc != null)
+            {
+                cacheLoc = db.Queryable<WCS_CacheLineLoc>().Single(x => x.Id == cacheLoc.Id);
+                cacheLoc.InStock = true;
+                cacheLoc.TaskId = taskInfo.ID;
+                cacheLoc.EditTime = DateTime.Now;
+                db.Updateable(cacheLoc).ExecuteCommand();
+
+                //WCS任务相关信息
+                taskInfo.Status = TaskStatus.FinishOfShunt;
+                taskInfo.AddrNext = cacheLine.LocationNo.ToString();
+                taskInfo.EditWho = "WCS";
+                taskInfo.EditTime = DateTime.Now;
+                db.Updateable(taskInfo).ExecuteCommand();
+                taskInfo.AddWCS_TASK_DTL(db, obj.Entity.Code, taskInfo.AddrNext, $"完成分库计算,目标地址:{cacheLine.LocationNo}");
+
+                return true;
+            }
+
+            #endregion 跟据缓存信息寻找可以到达的缓存点
+
+            #region 初始化一个信息的缓存信息
+
+            //找到一个可以进行缓存的线体号
+            var devCode = cacheLineDevList.Select(x => x.Code.ToShort()).FirstOrDefault(x => !cacheLineList.Select(s => s.LocationNo).Contains(x));
+            if (devCode == 0)
+            {
+                World.Log($"无可用线体:{taskInfo.ID}");
+                return false;
+            }
+            var result = false;
+
+            //未结束且包含当前物料编号的垛形,按时间排序,创建时间早的优先分配,当前任务的仓库号必须要等于码垛信息绑定的仓库号
+            var palletizingList = db.Queryable<WCS_Palletizing>()
+                .Includes(x => x.Layers, r => r.Rows, l => l.Locs)
+                .Where(x => !x.Finish && x.MatCodeList.Contains(taskInfo.MatCode) && x.WarehouseCode == taskInfo.WarehouseCode)
+                .OrderBy(x => x.AddTime)
+                .ToList();
+
+            foreach (var palletizing in palletizingList)
+            {
+                //当前任务已经分配结束,进入下一次迭代
+                if (result) continue;
+
+                //未结束且包含当前物料编号的层,按层号排序,层号小的优先分配
+                var layers = palletizing.Layers.Where(x => x is { IsEmpty: false, Finish: false })
+                    .Where(x => x.MatCodeList.Contains(taskInfo.MatCode))
+                    .OrderBy(x => x.LayerNo)
+                    .ToList();
+
+                //未找到可用层,进入下一次迭代
+                if (!layers.Any()) continue;
+                foreach (var layer in layers)
+                {
+                    //当前任务已经分配结束,进入下一次迭代
+                    if (result) continue;
+
+                    //未结束,未预分配缓存线信息且包含当前物料编号的行,行号小的优先分配
+                    var rows = layer.Rows.Where(x => x is { IsEmpty: false, Finish: false })
+                        .Where(x => x.CacheLineId == 0)
+                        .Where(x => x.MatCodeList.Contains(taskInfo.MatCode))
+                        .ToList();
+                    //未找到可用行,进入下一次迭代
+                    if (!rows.Any()) continue;
+                    var palletizingRow = rows.MinBy(x => x.RowNo);
+
+                    //开始初始化缓存位信息
+                    cacheLine = new WCS_CacheLine()
+                    {
+                        LocationNo = devCode,
+                        AddTime = DateTime.Now,
+                        PalletizingRowId = palletizingRow.Id,
+                        InStock = false,
+                        Put = false,
+                        IsTruss = false,
+                        MatCodeList = palletizingRow.MatCodeList,
+                        Quantity = palletizingRow.QtyMaxCount,
+                        WarehouseCode = taskInfo.WarehouseCode
+                    };
+
+                    var res = db.Insertable(cacheLine).ExecuteReturnEntity();
+                    palletizingRow = db.Queryable<WCS_PalletizingRow>().Includes(x => x.Locs).Single(x => x.Id == palletizingRow.Id);
+                    palletizingRow.Locs = palletizingRow.Locs.OrderBy(x => x.XYNo).ToList();
+                    palletizingRow.CacheLineId = res.Id;
+                    palletizingRow.EditTime = DateTime.Now;
+                    db.Updateable(palletizingRow).ExecuteCommand();
+
+                    for (var i = 0; i < palletizingRow.Locs.Count; i++)
+                    {
+                        var loc = new WCS_CacheLineLoc()
+                        {
+                            XYNo = palletizingRow.Locs[i].XYNo,
+                            InStock = i == 0,
+                            IsEmpty = palletizingRow.Locs[i].IsEmpty,
+                            MatCode = palletizingRow.Locs[i].MatCode,
+                            TaskId = i == 0 ? taskInfo.ID : 0,
+                            CacheLineId = res.Id
+                        };
+                        db.Insertable(loc).ExecuteCommand();
+                    }
+
+                    taskInfo.Status = TaskStatus.FinishOfShunt;
+                    taskInfo.AddrNext = devCode.ToString();
+                    taskInfo.EditWho = "WCS";
+                    taskInfo.EditTime = DateTime.Now;
+                    db.Updateable(taskInfo).ExecuteCommand();
+                    taskInfo.AddWCS_TASK_DTL(db, obj.Entity.Code, taskInfo.AddrNext, $"完成分库计算,目标地址:{cacheLine.LocationNo}");
+                    result = true;
+                }
+            }
+
+            if (!result)
+            {
+                taskInfo.InitStackStructure(db);
+            }
+            return result;
+
+            #endregion 初始化一个信息的缓存信息
+        }
     }
 }

+ 65 - 244
业务工程/分拣库/WCS.WorkEngineering/Systems/分拣支线/环形库分流点.cs

@@ -33,30 +33,19 @@ namespace WCS.WorkEngineering.Systems
             if (!obj.Data3.Status.HasFlag(StationStatus.OT_Status)) throw new KnownException("站台货物信息与实际占用不一致", LogLevelEnum.Low);
             if (obj.Data2.Request != 1) throw new KnownException("无请求", LogLevelEnum.Mid);
 
-            //处理异常任务
-            if (obj.Data2.TaskNumber == 1 && obj.Data4.Length.ToInt() == 9)
-            {
-                obj.Data.TaskNumber = 591;
-                obj.Data.GoodsStart = obj.Entity.Code.ToShort();
-                obj.Data.GoodsEnd = 591;
-                obj.Data.VoucherNo++;
-                World.Log($"执行记录:任务号[{obj.Data2.TaskNumber}]-[{obj.Data.VoucherNo}]`");
-                return;
-            }
-
             var isPut = false;
-            short nextAdd = 0;
+            var nextAdd = GetNext(obj);
             int taskId = 0;
             SqlSugarHelper.Do(_db =>
             {
                 var db = _db.Default;
                 var taskInfo = db.Queryable<WCS_TaskInfo>().First(v => v.ID == obj.Data2.TaskNumber && v.Status == TaskStatus.WaitingToExecute && !v.BarCode.Contains("Error"));
-                if (obj.Data2.TaskNumber == 1) //异常处理功能目前只在库二启用
+                if (obj.Data2.TaskNumber == 1)
                 {
                     var type = obj.Data4.Length.ToInt().ToString();
 
                     //找到一条起点是当前位置且状态小于2的任务
-                    taskInfo = db.Queryable<WCS_TaskInfo>().First(x => x.AddrFrom == obj.Entity.Code && x.Status == TaskStatus.WaitingToExecute && x.BarCode.Contains("Error"));
+                    taskInfo = db.Queryable<WCS_TaskInfo>().OrderBy(x => x.AddTime).First(x => x.AddrFrom == obj.Entity.Code && x.Status == TaskStatus.WaitingToExecute && x.BarCode.Contains("Error") && x.AddrNext == null);
                     if (taskInfo == null)
                     {
                         WmsApi.PalletizingCreateseErrorTasks(obj.Entity.Code, type);
@@ -67,80 +56,26 @@ namespace WCS.WorkEngineering.Systems
                 if (taskInfo == null) throw new KnownException($"未找到对应的WCS任务{obj.Data2.TaskNumber}", LogLevelEnum.Mid);
 
                 taskId = taskInfo.ID;
-                switch (obj.Data4.Length)
+                if (obj.Data4.Length.ToInt() != 9) //09工字轮在环形库分流点只分配下一个地址,不作任何变更
                 {
-                    case 9:
-                        isPut = Allot09(db, taskInfo, obj);
-                        nextAdd = 455;
-                        break;
-
-                    case 18:
-
-                        nextAdd = 442;
-                        switch (obj.Entity.Code)
-                        {
-                            case "418":
-                                nextAdd = 442;
-                                break;
-
-                            case "618":
-                                nextAdd = 642;
-                                break;
-
-                            case "818":
-                                nextAdd = 842;
-                                break;
-
-                            case "1018":
-                                nextAdd = 1042;
-                                break;
-
-                            case "1218":
-                                nextAdd = 1242;
-                                break;
-
-                            case "1418":
-                                nextAdd = 1442;
-                                break;
-                        }
-                        taskInfo.AddrNext = nextAdd.ToString();
-                        taskInfo.Status = TaskStatus.FinishOfShunt;
-                        taskInfo.EditTime = DateTime.Now;
-                        taskInfo.WarehouseCode = taskInfo.WarehouseCode.Contains("R") ? taskInfo.WarehouseCode : taskInfo.WarehouseCode + "R";
-                        taskInfo.AddrTo = "Robot";
-                        taskInfo.GoodsType = obj.Data4.Length.ToInt();
-                        db.Updateable(taskInfo).ExecuteCommand();
-                        taskInfo.AddWCS_TASK_DTL(db, obj.Entity.Code, nextAdd.ToString(), "环形库分流");
-                        isPut = true;
-                        //obj.Data.CmdType = StationCmd.Res6;
-                        break;
-
-                    case 50:
-                        nextAdd = 424;
-                        taskInfo.AddrNext = nextAdd.ToString();
-                        taskInfo.Status = TaskStatus.FinishOfShunt;
-                        taskInfo.EditTime = DateTime.Now;
-                        taskInfo.WarehouseCode = taskInfo.WarehouseCode.Contains("R") ? taskInfo.WarehouseCode : taskInfo.WarehouseCode + "R";
-                        taskInfo.AddrTo = "Robot";
-                        taskInfo.GoodsType = obj.Data4.Length.ToInt();
-                        db.Updateable(taskInfo).ExecuteCommand();
-                        taskInfo.AddWCS_TASK_DTL(db, obj.Entity.Code, nextAdd.ToString(), "环形库分流");
-                        isPut = true;
-                        break;
-
-                    case 34:
-                        nextAdd = 433;
-                        taskInfo.AddrNext = nextAdd.ToString();
-                        taskInfo.Status = TaskStatus.FinishOfShunt;
-                        taskInfo.EditTime = DateTime.Now;
-                        taskInfo.WarehouseCode = taskInfo.WarehouseCode.Contains("R") ? taskInfo.WarehouseCode : taskInfo.WarehouseCode + "R";
-                        taskInfo.AddrTo = "Robot";
-                        taskInfo.GoodsType = obj.Data4.Length.ToInt();
-                        db.Updateable(taskInfo).ExecuteCommand();
-                        taskInfo.AddWCS_TASK_DTL(db, obj.Entity.Code, nextAdd.ToString(), "环形库分流");
-                        isPut = true;
-                        break;
+                    taskInfo.AddrNext = nextAdd.ToString();
+                    taskInfo.Status = TaskStatus.FinishOfShunt;
+                    taskInfo.EditTime = DateTime.Now;
+                    taskInfo.WarehouseCode = taskInfo.WarehouseCode.Contains("R") ? taskInfo.WarehouseCode : taskInfo.WarehouseCode + "R";
+                    taskInfo.AddrTo = "Robot";
+                    taskInfo.GoodsType = obj.Data4.Length.ToInt();
+                    db.Updateable(taskInfo).ExecuteCommand();
+                    taskInfo.AddWCS_TASK_DTL(db, obj.Entity.Code, nextAdd.ToString(), "工字轮完成环形库分流");
+                }
+                else
+                {
+                    taskInfo.AddrNext = nextAdd.ToString();
+                    taskInfo.EditTime = DateTime.Now;
+                    taskInfo.GoodsType = obj.Data4.Length.ToInt();
+                    db.Updateable(taskInfo).ExecuteCommand();
+                    taskInfo.AddWCS_TASK_DTL(db, obj.Entity.Code, nextAdd.ToString(), "工字轮途径环形库分流点");
                 }
+                isPut = true;
             });
             if (!isPut) return;
             obj.Data.TaskNumber = taskId;
@@ -152,176 +87,62 @@ namespace WCS.WorkEngineering.Systems
 
         public override bool Select(Device dev)
         {
-            return dev.HasFlag(DeviceFlags.环形库分流点);
+            return dev.Code is "418" or "618" or "818" or "1018" or "1218" or "1418";
         }
 
         /// <summary>
         ///  计算非零九的去向
         /// </summary>
-        /// <param name="db"></param>
-        /// <param name="taskInfo"></param>
         /// <param name="obj"></param>
         /// <returns></returns>
-        public bool AllotNot09(SqlSugarScopeProvider db, WCS_TaskInfo taskInfo, Device<IStation520, IStation521, IStation523, IStation91> obj)
+        public short GetNext(Device<IStation520, IStation521, IStation523, IStation91> obj)
         {
-            return false;
-        }
-
-        /// <summary>
-        ///  计算09去向
-        /// </summary>
-        /// <param name="db"></param>
-        /// <param name="taskInfo"></param>
-        /// <param name="obj"></param>
-        /// <returns></returns>
-        public bool Allot09(SqlSugarScopeProvider db, WCS_TaskInfo taskInfo, Device<IStation520, IStation521, IStation523, IStation91> obj)
-        {
-            //TODO:暂时不来考虑动态计算可前往的目标
-            var nextAdd = taskInfo.WarehouseCode switch
-            {
-                "1N" => "455",
-                "1S" => "455",
-                "2N" => "455",
-                "2S" => "455",
-                "3N" => "455",
-                "3S" => "455",
-                _ => "0"
-            };
-            //获取这个地址的下一个地址集合
-            var cacheLineDevList = Device.All.First(x => x.Code == nextAdd).Targets.Where(x => x.HasFlag(DeviceFlags.桁架缓存放行点));
-            var cacheLineCodes = cacheLineDevList.Select(x => x.Code.ToShort());
-            var cacheLineList = db.Queryable<WCS_CacheLine>().Includes(x => x.Locations).ToList();
-
-            #region 跟据缓存信息寻找可以到达的缓存点
-
-            //找到当前任务可用的缓存线信息
-            var cacheLine = cacheLineList.Where(x => x.Locations.Any(l => l is { InStock: false, IsEmpty: false })).FirstOrDefault(x => cacheLineCodes.Contains(x.LocationNo) && x.MatCodeList.Contains(taskInfo.MatCode) && !x.InStock);
-
-            if (cacheLine != null)//这个任务可以直接去一条线体,不需要新建缓存信息
+            return obj.Data4.Length switch
             {
-                //找到这条线体中序号最小的一条位信息 非空置且无货
-                var cacheLoc = cacheLine.Locations.Where(x => x is { InStock: false, IsEmpty: false }).MinBy(x => x.XYNo);
-                if (cacheLoc != null)
+                9 => obj.Entity.Code switch
                 {
-                    cacheLoc = db.Queryable<WCS_CacheLineLoc>().Single(x => x.Id == cacheLoc.Id);
-                    cacheLoc.InStock = true;
-                    cacheLoc.TaskId = taskInfo.ID;
-                    cacheLoc.EditTime = DateTime.Now;
-                    db.Updateable(cacheLoc).ExecuteCommand();
-
-                    //WCS任务相关信息
-                    taskInfo.Status = TaskStatus.FinishOfShunt;
-                    taskInfo.AddrNext = cacheLine.LocationNo.ToString();
-                    taskInfo.EditWho = "WCS";
-                    taskInfo.EditTime = DateTime.Now;
-                    taskInfo.GoodsType = obj.Data4.Length.ToInt();
-                    db.Updateable(taskInfo).ExecuteCommand();
-                    taskInfo.AddWCS_TASK_DTL(db, obj.Entity.Code, taskInfo.AddrNext, $"完成分库计算,目标地址:{cacheLine.LocationNo}");
-
-                    return true;
-                }
-            }
-
-            #endregion 跟据缓存信息寻找可以到达的缓存点
-
-            #region 初始化一个信息的缓存信息
-
-            //TODO:暂时不处理就近分线的逻辑
-            var devCode = cacheLineDevList.Select(x => x.Code.ToShort()).FirstOrDefault(x => !cacheLineList.Select(s => s.LocationNo).Contains(x));
-            if (devCode == 0)
-            {
-                World.Log($"无可用线体:{taskInfo.ID}");
-                return false;
-            }
-            var result = false;
-
-            //未结束且包含当前物料编号的垛形,按时间排序,创建时间早的优先分配
-            var palletizingList = db.Queryable<WCS_Palletizing>()
-                .Includes(x => x.Layers, r => r.Rows, l => l.Locs)
-                .Where(x => !x.Finish)
-                .Where(x => x.MatCodeList.Contains(taskInfo.MatCode))
-                .OrderBy(x => x.AddTime)
-                .ToList();
-
-            foreach (var palletizing in palletizingList)
-            {
-                //当前任务已经分配结束,进入下一次迭代
-                if (result) continue;
-
-                //未结束且包含当前物料编号的层,按层号排序,层号小的优先分配
-                var layers = palletizing.Layers.Where(x => x is { IsEmpty: false, Finish: false })
-                    .Where(x => x.MatCodeList.Contains(taskInfo.MatCode))
-                    .OrderBy(x => x.LayerNo)
-                    .ToList();
-
-                //未找到可用层,进入下一次迭代
-                if (!layers.Any()) continue;
-                foreach (var layer in layers)
+                    "418" => 455,
+                    "618" => 655,
+                    "818" => 855,
+                    "1018" => 1055,
+                    "1218" => 1255,
+                    "1418" => 1455,
+                    _ => 9999
+                },
+                18 => obj.Entity.Code switch
                 {
-                    //当前任务已经分配结束,进入下一次迭代
-                    if (result) continue;
-
-                    //未结束,未预分配缓存线信息且包含当前物料编号的行,行号小的优先分配
-                    var rows = layer.Rows.Where(x => x is { IsEmpty: false, Finish: false })
-                        .Where(x => x.CacheLineId == 0)
-                        .Where(x => x.MatCodeList.Contains(taskInfo.MatCode))
-                        .ToList();
-                    //未找到可用行,进入下一次迭代
-                    if (!rows.Any()) continue;
-                    var palletizingRow = rows.MinBy(x => x.RowNo);
-
-                    //开始初始化缓存位信息
-                    cacheLine = new WCS_CacheLine()
-                    {
-                        LocationNo = devCode,
-                        AddTime = DateTime.Now,
-                        PalletizingRowId = palletizingRow.Id,
-                        InStock = false,
-                        Put = false,
-                        IsTruss = false,
-                        MatCodeList = palletizingRow.MatCodeList,
-                        Quantity = palletizingRow.QtyMaxCount
-                    };
-
-                    var res = db.Insertable(cacheLine).ExecuteReturnEntity();
-                    palletizingRow = db.Queryable<WCS_PalletizingRow>().Includes(x => x.Locs).Single(x => x.Id == palletizingRow.Id);
-                    palletizingRow.Locs = palletizingRow.Locs.OrderBy(x => x.XYNo).ToList();
-                    palletizingRow.CacheLineId = res.Id;
-                    palletizingRow.EditTime = DateTime.Now;
-                    db.Updateable(palletizingRow).ExecuteCommand();
-
-                    for (var i = 0; i < palletizingRow.Locs.Count; i++)
-                    {
-                        var loc = new WCS_CacheLineLoc()
-                        {
-                            XYNo = palletizingRow.Locs[i].XYNo,
-                            InStock = i == 0,
-                            IsEmpty = palletizingRow.Locs[i].IsEmpty,
-                            MatCode = palletizingRow.Locs[i].MatCode,
-                            TaskId = i == 0 ? taskInfo.ID : 0,
-                            CacheLineId = res.Id
-                        };
-                        db.Insertable(loc).ExecuteCommand();
-                    }
-
-                    taskInfo.Status = TaskStatus.FinishOfShunt;
-                    taskInfo.AddrNext = devCode.ToString();
-                    taskInfo.EditWho = "WCS";
-                    taskInfo.EditTime = DateTime.Now;
-                    taskInfo.GoodsType = obj.Data4.Length.ToInt();
-                    db.Updateable(taskInfo).ExecuteCommand();
-                    taskInfo.AddWCS_TASK_DTL(db, obj.Entity.Code, taskInfo.AddrNext, $"完成分库计算,目标地址:{cacheLine.LocationNo}");
-                    result = true;
-                }
-            }
+                    "418" => 442,
+                    "618" => 642,
+                    "818" => 842,
+                    "1018" => 1042,
+                    "1218" => 1242,
+                    "1418" => 1442,
+                    _ => 9999
+                },
+                50 => obj.Entity.Code switch
+                {
+                    "418" => 424,
+                    "618" => 624,
+                    "818" => 824,
+                    "1018" => 1024,
+                    "1218" => 1224,
+                    "1418" => 1424,
+                    _ => 9999
+                },
+                34 => obj.Entity.Code switch
+                {
+                    "418" => 433,
+                    "618" => 633,
+                    "818" => 833,
+                    "1018" => 1033,
+                    "1218" => 1233,
+                    "1418" => 1433,
+                    _ => 9999
+                },
+                _ => 9999
+            };
+        }
 
-            if (!result)
-            {
-                taskInfo.InitStackStructure(db);
-            }
-            return result;
 
-            #endregion 初始化一个信息的缓存信息
-        }
     }
 }

+ 58 - 56
业务工程/分拣库/WCS.WorkEngineering/Systems/桁架码垛/桁架.cs

@@ -124,9 +124,9 @@ namespace WCS.WorkEngineering.Systems
             SqlSugarHelper.Do(_db =>
             {
                 var db = _db.Default;
-                //找到有还有层没结束的码垛记录信息,有对应托盘
+                //找到当前桁架所属所有还有层没结束的码垛记录信息,有对应托盘
                 var palletizingLsit = db.Queryable<WCS_Palletizing>().Includes(x => x.Layers, r => r.Rows, l => l.Locs)
-                    .Where(x => !x.Finish)
+                    .Where(x => !x.Finish && x.DeviceCode == obj.Entity.Code)
                     .Where(x => x.Layers.Any(l => !l.Finish) && x.PalletizingStation != null).ToList();
                 //筛选出目标位置有光电的码垛记录信息
                 var devCode = palletizingLsit.Select(x => x.PalletizingStation);
@@ -149,7 +149,7 @@ namespace WCS.WorkEngineering.Systems
                     .SelectMany(w => w.Rows)
                     .Where(v => !v.Finish).Any(w =>
                     {
-                        return cacheLines.Any(a => a.MatCodeList == w.MatCodeList && a.Quantity == w.QtyMaxCount);
+                        return cacheLines.Any(a => a.MatCodeList == w.MatCodeList && a.Quantity == w.QtyMaxCount && a.WarehouseCode == w.WarehouseCode);
                     })).ToList();
                 if (!palletizingLsit.Any()) throw new KnownException($"没有可用取货点,码垛信息是否正常", LogLevelEnum.Mid);
 
@@ -164,7 +164,7 @@ namespace WCS.WorkEngineering.Systems
                         .MinBy(x => x.LayerNo) //取最下层
                         .Rows
                         .Where(x => x is { Finish: false, IsEmpty: false, LineCode: null }) //不空且未结束的行
-                        .Where(x => cacheLines.Any(a => a.MatCodeList == x.MatCodeList && a.Quantity == x.QtyMaxCount)); //获取可以取货的码垛信息行
+                        .Where(x => cacheLines.Any(a => a.MatCodeList == x.MatCodeList && a.Quantity == x.QtyMaxCount && a.WarehouseCode == x.WarehouseCode)); //获取可以取货的码垛信息行
 
                     //无可用行,进入下一次迭代
                     if (!palletizingRow.Any()) continue;
@@ -172,7 +172,7 @@ namespace WCS.WorkEngineering.Systems
                     //跟据缓存信息找到对应的可用取货行
                     var rowList = cacheLines.Select(x =>
                     {
-                        var b = palletizingRow.Where(w => !rowIds.Contains(w.Id) && x.MatCodeList == w.MatCodeList && x.Quantity == w.QtyMaxCount).OrderBy(o => o.RowNo).FirstOrDefault();
+                        var b = palletizingRow.Where(w => !rowIds.Contains(w.Id) && x.MatCodeList == w.MatCodeList && x.Quantity == w.QtyMaxCount && w.WarehouseCode == x.WarehouseCode).MinBy(o => o.RowNo);
                         if (b != null)
                         {
                             rowIds.Add(b.Id);
@@ -314,7 +314,7 @@ namespace WCS.WorkEngineering.Systems
 
         public override bool Select(Device dev)
         {
-            return dev.HasFlag(DeviceFlags.桁架);
+            return dev.Code is "Truss1" or "Truss2" or "Truss3";
         }
 
         public 桁架()
@@ -335,62 +335,64 @@ namespace WCS.WorkEngineering.Systems
                         _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "559"), World), Device.All.Where(x => x.Code is "559" or "560" or "561" or "562" or "563").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
                         _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "573"), World), Device.All.Where(x => x.Code is "573" or "574" or "575" or "576" or "577").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
                         _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "586"), World), Device.All.Where(x => x.Code is "586" or "587" or "588" or "589" or "590").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "661"), World), Device.All.Where(x => x.Code is "661" or "662" or "663" or "664" or "665").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "675"), World), Device.All.Where(x => x.Code is "675" or "676" or "677" or "678" or "679").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "689"), World), Device.All.Where(x => x.Code is "690" or "691" or "692" or "693" or "689").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "703"), World), Device.All.Where(x => x.Code is "703" or "704" or "705" or "706" or "707").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "717"), World), Device.All.Where(x => x.Code is "717" or "718" or "719" or "720" or "721").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "731"), World), Device.All.Where(x => x.Code is "732" or "733" or "734" or "735" or "731").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "745"), World), Device.All.Where(x => x.Code is "746" or "747" or "748" or "749" or "745").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "759"), World), Device.All.Where(x => x.Code is "759" or "760" or "761" or "762" or "763").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "773"), World), Device.All.Where(x => x.Code is "773" or "774" or "775" or "776" or "777").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "786"), World), Device.All.Where(x => x.Code is "786" or "787" or "788" or "789" or "790").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
                         break;
 
                     case "Truss2":
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "861"), World), Device.All.Where(x => x.Code is "861" or "862" or "863" or "864" or "865").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "875"), World), Device.All.Where(x => x.Code is "875" or "876" or "877" or "878" or "879").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "889"), World), Device.All.Where(x => x.Code is "890" or "891" or "892" or "893" or "889").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "903"), World), Device.All.Where(x => x.Code is "903" or "904" or "905" or "906" or "907").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "917"), World), Device.All.Where(x => x.Code is "917" or "918" or "919" or "920" or "921").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "931"), World), Device.All.Where(x => x.Code is "932" or "933" or "934" or "935" or "931").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "945"), World), Device.All.Where(x => x.Code is "946" or "947" or "948" or "949" or "945").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "959"), World), Device.All.Where(x => x.Code is "959" or "960" or "961" or "962" or "963").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "973"), World), Device.All.Where(x => x.Code is "973" or "974" or "975" or "976" or "977").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "986"), World), Device.All.Where(x => x.Code is "986" or "987" or "988" or "989" or "990").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1061"), World), Device.All.Where(x => x.Code is "1061" or "1062" or "1063" or "1064" or "1065").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1075"), World), Device.All.Where(x => x.Code is "1075" or "1076" or "1077" or "1078" or "1079").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1089"), World), Device.All.Where(x => x.Code is "1090" or "1091" or "1092" or "1093" or "1089").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1103"), World), Device.All.Where(x => x.Code is "1103" or "1104" or "1105" or "1106" or "1107").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1117"), World), Device.All.Where(x => x.Code is "1117" or "1118" or "1119" or "1120" or "1121").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1131"), World), Device.All.Where(x => x.Code is "1132" or "1133" or "1134" or "1135" or "1131").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1145"), World), Device.All.Where(x => x.Code is "1146" or "1147" or "1148" or "1149" or "1145").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1159"), World), Device.All.Where(x => x.Code is "1159" or "1160" or "1161" or "1162" or "1163").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1173"), World), Device.All.Where(x => x.Code is "1173" or "1174" or "1175" or "1176" or "1177").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1186"), World), Device.All.Where(x => x.Code is "1186" or "1187" or "1188" or "1189" or "1190").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
                         break;
 
                     case "Truss3":
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
-                        //_pickUpDevices.Add(Device.All.First(x => x.Code == ""), Device.All.Where(x => x.Code is "" or "" or "" or "" or "").Select(x => new Device<IStation524,  IStation523>(x, World)).ToList());
+                        //北
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1261"), World), Device.All.Where(x => x.Code is "1261" or "1262" or "1263" or "1264" or "1265").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1275"), World), Device.All.Where(x => x.Code is "1275" or "1276" or "1277" or "1278" or "1279").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1289"), World), Device.All.Where(x => x.Code is "1290" or "1291" or "1292" or "1293" or "1289").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1303"), World), Device.All.Where(x => x.Code is "1303" or "1304" or "1305" or "1306" or "1307").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1317"), World), Device.All.Where(x => x.Code is "1317" or "1318" or "1319" or "1320" or "1321").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1331"), World), Device.All.Where(x => x.Code is "1332" or "1333" or "1334" or "1335" or "1331").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1345"), World), Device.All.Where(x => x.Code is "1346" or "1347" or "1348" or "1349" or "1345").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1359"), World), Device.All.Where(x => x.Code is "1359" or "1360" or "1361" or "1362" or "1363").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1373"), World), Device.All.Where(x => x.Code is "1373" or "1374" or "1375" or "1376" or "1377").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1386"), World), Device.All.Where(x => x.Code is "1386" or "1387" or "1388" or "1389" or "1390").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        //南
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1461"), World), Device.All.Where(x => x.Code is "1461" or "1462" or "1463" or "1464" or "1465").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1475"), World), Device.All.Where(x => x.Code is "1475" or "1476" or "1477" or "1478" or "1479").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1489"), World), Device.All.Where(x => x.Code is "1490" or "1491" or "1492" or "1493" or "1489").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1503"), World), Device.All.Where(x => x.Code is "1503" or "1504" or "1505" or "1506" or "1507").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1517"), World), Device.All.Where(x => x.Code is "1517" or "1518" or "1519" or "1520" or "1521").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1531"), World), Device.All.Where(x => x.Code is "1532" or "1533" or "1534" or "1535" or "1531").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1545"), World), Device.All.Where(x => x.Code is "1546" or "1547" or "1548" or "1549" or "1545").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1559"), World), Device.All.Where(x => x.Code is "1559" or "1560" or "1561" or "1562" or "1563").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1573"), World), Device.All.Where(x => x.Code is "1573" or "1574" or "1575" or "1576" or "1577").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+                        _pickUpDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1586"), World), Device.All.Where(x => x.Code is "1586" or "1587" or "1588" or "1589" or "1590").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
                         break;
                 }
             }

+ 26 - 5
业务工程/分拣库/WCS.WorkEngineering/Systems/桁架码垛/桁架码垛区补空托盘任务生成.cs

@@ -28,7 +28,7 @@ namespace WCS.WorkEngineering.Systems
             {
                 var db = _db.Default;
                 //取一个时间最靠前的,没有绑定码垛工位的码垛记录
-                var palletizingInfo = db.Queryable<WCS_Palletizing>().First(x => x.PalletizingStation == null && !x.Finish);
+                var palletizingInfo = db.Queryable<WCS_Palletizing>().OrderBy(x => x.AddTime).First(x => x.PalletizingStation == null && !x.Finish);
                 if (palletizingInfo == null) throw new Exception($"没有可用码垛信息");
                 var palleTask = db.Queryable<WCS_TaskInfo>().First(x => x.ID == palletizingInfo.TaskId && (x.Status == TaskStatus.FinishOfShunt || x.Status == TaskStatus.ConveyorExecution));
                 if (palleTask == null) throw new Exception($"未找到任务{palleTask.ID}");
@@ -43,16 +43,37 @@ namespace WCS.WorkEngineering.Systems
                 //取一个可用用于码垛的地方
                 var dev = devs.Where(x => !palletizingStation.Contains(x.Entity.Code)).FirstOrDefault(x => !x.Data3.Status.HasFlag(StationStatus.PH_Status));
                 if (dev == null) throw new Exception($"没有可用码垛工位");
-                var endDev = Device.All.Where(x => x.Code == "1606").Select(x => new Device<IStation520>(x, World)).FirstOrDefault();
-                if (endDev.Data.TaskNumber != 0 || endDev.Data.GoodsEnd != 0) throw new Exception($"拆盘机任务未清除,请清除"); ;
+
+                var addrFromCode = palletizingInfo.WarehouseCode switch
+                {
+                    "1N" => "1606",
+                    "1S" => "1616",
+                    "2N" => "1626",
+                    "2S" => "1636",
+                    "3N" => "1646",
+                    "3S" => "1656",
+                    _ => "9999"
+                };
+
+                var endDev = Device.All.Where(x => x.Code == addrFromCode).Select(x => new Device<IStation520>(x, World)).FirstOrDefault();
+                if (endDev.Data.TaskNumber != 0 || endDev.Data.GoodsEnd != 0) throw new Exception($"{endDev.Entity.Code}有残留任务信息,请处理!");
 
                 palletizingInfo.PalletizingStation = dev.Entity.Code;
                 db.Updateable(palletizingInfo).ExecuteCommand();
                 palletizing = palletizingInfo;
             });
             if (palletizing == null) return;
-            //TODO:取货地址暂时写死,后续依靠任务进行计算
-            var dev = Device.All.Where(x => x.Code == "1606").Select(x => new Device<IStation520>(x, World)).FirstOrDefault();
+            var addrFromCode = palletizing.WarehouseCode switch
+            {
+                "1N" => "1606",
+                "1S" => "1616",
+                "2N" => "1626",
+                "2S" => "1636",
+                "3N" => "1646",
+                "3S" => "1656",
+                _ => "9999"
+            };
+            var dev = Device.All.Where(x => x.Code == addrFromCode).Select(x => new Device<IStation520>(x, World)).FirstOrDefault();
             dev.Data.TaskNumber = palletizing.Id;
             dev.Data.GoodsEnd = palletizing.PalletizingStation!.ToShort();
         }

+ 61 - 5
业务工程/分拣库/WCS.WorkEngineering/Systems/桁架码垛/桁架缓存放行点.cs

@@ -115,16 +115,72 @@ namespace WCS.WorkEngineering.Systems
 
         public 桁架缓存放行点()
         {
+            //库一北
             _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "466"), World), Device.All.Where(x => x.Code is "466" or "467" or "468" or "469" or "470").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
-            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "480"), World), Device.All.Where(x => x.Code is "481" or "482" or "483" or "484" or "480").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "480"), World), Device.All.Where(x => x.Code is "480" or "481" or "482" or "483" or "484").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
             _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "494"), World), Device.All.Where(x => x.Code is "494" or "495" or "496" or "497" or "498").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
             _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "508"), World), Device.All.Where(x => x.Code is "508" or "509" or "510" or "511" or "512").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
             _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "522"), World), Device.All.Where(x => x.Code is "522" or "523" or "524" or "525" or "526").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
             _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "536"), World), Device.All.Where(x => x.Code is "536" or "537" or "538" or "539" or "540").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
-            //_cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "545"), World), Device.All.Where(x => x.Code is "546" or "547" or "548" or "549" or "545").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
-            //_cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "559"), World), Device.All.Where(x => x.Code is "559" or "560" or "561" or "562" or "563").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
-            //_cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "573"), World), Device.All.Where(x => x.Code is "573" or "574" or "575" or "576" or "577").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
-            //_cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "586"), World), Device.All.Where(x => x.Code is "586" or "587" or "588" or "589" or "590").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "550"), World), Device.All.Where(x => x.Code is "550" or "551" or "552" or "553" or "554").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "564"), World), Device.All.Where(x => x.Code is "564" or "565" or "566" or "567" or "568").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "578"), World), Device.All.Where(x => x.Code is "578" or "579" or "580" or "581" or "582").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "591"), World), Device.All.Where(x => x.Code is "591" or "592" or "593" or "594" or "595").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            //库一南
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "666"), World), Device.All.Where(x => x.Code is "666" or "667" or "668" or "669" or "670").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "680"), World), Device.All.Where(x => x.Code is "680" or "681" or "682" or "683" or "684").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "694"), World), Device.All.Where(x => x.Code is "694" or "695" or "696" or "697" or "698").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "708"), World), Device.All.Where(x => x.Code is "708" or "709" or "710" or "711" or "712").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "722"), World), Device.All.Where(x => x.Code is "722" or "723" or "724" or "725" or "726").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "736"), World), Device.All.Where(x => x.Code is "736" or "737" or "738" or "739" or "740").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "750"), World), Device.All.Where(x => x.Code is "750" or "751" or "752" or "753" or "754").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "764"), World), Device.All.Where(x => x.Code is "764" or "765" or "766" or "767" or "768").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "778"), World), Device.All.Where(x => x.Code is "778" or "779" or "780" or "781" or "782").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "791"), World), Device.All.Where(x => x.Code is "791" or "792" or "793" or "794" or "795").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            //库二北
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "866"), World), Device.All.Where(x => x.Code is "866" or "867" or "868" or "869" or "870").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "880"), World), Device.All.Where(x => x.Code is "880" or "881" or "882" or "883" or "884").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "894"), World), Device.All.Where(x => x.Code is "894" or "895" or "896" or "897" or "898").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "908"), World), Device.All.Where(x => x.Code is "908" or "909" or "910" or "911" or "912").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "922"), World), Device.All.Where(x => x.Code is "922" or "923" or "924" or "925" or "926").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "936"), World), Device.All.Where(x => x.Code is "936" or "937" or "938" or "939" or "940").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "950"), World), Device.All.Where(x => x.Code is "950" or "951" or "952" or "953" or "954").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "964"), World), Device.All.Where(x => x.Code is "964" or "965" or "966" or "967" or "968").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "978"), World), Device.All.Where(x => x.Code is "978" or "979" or "980" or "981" or "982").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "991"), World), Device.All.Where(x => x.Code is "991" or "992" or "993" or "994" or "995").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            //库二南
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1066"), World), Device.All.Where(x => x.Code is "1066" or "1067" or "1068" or "1069" or "1070").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1080"), World), Device.All.Where(x => x.Code is "1080" or "1081" or "1082" or "1083" or "1084").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1094"), World), Device.All.Where(x => x.Code is "1094" or "1095" or "1096" or "1097" or "1098").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1108"), World), Device.All.Where(x => x.Code is "1108" or "1109" or "1110" or "1111" or "1112").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1122"), World), Device.All.Where(x => x.Code is "1122" or "1123" or "1124" or "1125" or "1126").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1136"), World), Device.All.Where(x => x.Code is "1136" or "1137" or "1138" or "1139" or "1140").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1150"), World), Device.All.Where(x => x.Code is "1150" or "1151" or "1152" or "1153" or "1154").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1164"), World), Device.All.Where(x => x.Code is "1164" or "1165" or "1166" or "1167" or "1168").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1178"), World), Device.All.Where(x => x.Code is "1178" or "1179" or "1180" or "1181" or "1182").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1191"), World), Device.All.Where(x => x.Code is "1191" or "1192" or "1193" or "1194" or "1195").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            //库三北
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1266"), World), Device.All.Where(x => x.Code is "1266" or "1267" or "1268" or "1269" or "1270").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1280"), World), Device.All.Where(x => x.Code is "1280" or "1281" or "1282" or "1283" or "1284").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1294"), World), Device.All.Where(x => x.Code is "1294" or "1295" or "1296" or "1297" or "1298").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1308"), World), Device.All.Where(x => x.Code is "1308" or "1309" or "1310" or "1311" or "1312").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1322"), World), Device.All.Where(x => x.Code is "1322" or "1323" or "1324" or "1325" or "1326").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1336"), World), Device.All.Where(x => x.Code is "1336" or "1337" or "1338" or "1339" or "1340").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1350"), World), Device.All.Where(x => x.Code is "1350" or "1351" or "1352" or "1353" or "1354").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1364"), World), Device.All.Where(x => x.Code is "1364" or "1365" or "1366" or "1367" or "1368").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1378"), World), Device.All.Where(x => x.Code is "1378" or "1379" or "1380" or "1381" or "1382").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1391"), World), Device.All.Where(x => x.Code is "1391" or "1392" or "1393" or "1394" or "1395").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            //库三南
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1466"), World), Device.All.Where(x => x.Code is "1466" or "1467" or "1468" or "1469" or "1470").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1480"), World), Device.All.Where(x => x.Code is "1480" or "1481" or "1482" or "1483" or "1484").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1494"), World), Device.All.Where(x => x.Code is "1494" or "1495" or "1496" or "1497" or "1498").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1508"), World), Device.All.Where(x => x.Code is "1508" or "1509" or "1510" or "1511" or "1512").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1522"), World), Device.All.Where(x => x.Code is "1522" or "1523" or "1524" or "1525" or "1526").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1536"), World), Device.All.Where(x => x.Code is "1536" or "1537" or "1538" or "1539" or "1540").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1550"), World), Device.All.Where(x => x.Code is "1550" or "1551" or "1552" or "1553" or "1554").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1564"), World), Device.All.Where(x => x.Code is "1564" or "1565" or "1566" or "1567" or "1568").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1578"), World), Device.All.Where(x => x.Code is "1578" or "1579" or "1580" or "1581" or "1582").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
+            _cacheDevices.Add(new Device<IStation524, IStation523>(Device.All.First(x => x.Code == "1591"), World), Device.All.Where(x => x.Code is "1591" or "1592" or "1593" or "1594" or "1595").Select(x => new Device<IStation524, IStation523>(x, World)).ToList());
         }
     }
 }

+ 76 - 5
业务工程/分拣库/WCS.WorkEngineering/WorkStart.cs

@@ -775,11 +775,79 @@ namespace WCS.WorkEngineering
 
                 #endregion 桁架取货点--桁架
 
-                //桁架--码垛工位
+                #region 桁架取货点--码垛工位
+
+                new("461", new[] { "1662","1663","1664","1665","1670","1671","1672","1673", "1674","1675" }),//分拣一北侧
+                new("475", new[] {  "1662","1663","1664","1665","1670","1671","1672","1673", "1674","1675"}),
+                new("489", new[] {  "1662","1663","1664","1665","1670","1671","1672","1673", "1674","1675"}),
+                new("503", new[] {  "1662","1663","1664","1665","1670","1671","1672","1673", "1674","1675"}),
+                new("517", new[] {  "1662","1663","1664","1665","1670","1671","1672","1673", "1674","1675"}),
+                new("531", new[] {  "1662","1663","1664","1665","1670","1671","1672","1673", "1674","1675"}),
+                new("545", new[] {  "1662","1663","1664","1665","1670","1671","1672","1673", "1674","1675"}),
+                new("559", new[] {  "1662","1663","1664","1665","1670","1671","1672","1673", "1674","1675"}),
+                new("573", new[] {  "1662","1663","1664","1665","1670","1671","1672","1673", "1674","1675"}),
+                new("586", new[] { "1677","1678","1679","1680", "1685","1686","1687","1688","1689","1690" }),//分拣一南侧
+                new("661", new[] { "1677","1678","1679","1680", "1685","1686","1687","1688","1689","1690" }),
+                new("675", new[] { "1677","1678","1679","1680", "1685","1686","1687","1688","1689","1690" }),
+                new("689", new[] { "1677","1678","1679","1680", "1685","1686","1687","1688","1689","1690" }),
+                new("703", new[] { "1677","1678","1679","1680", "1685","1686","1687","1688","1689","1690" }),
+                new("717", new[] { "1677","1678","1679","1680", "1685","1686","1687","1688","1689","1690" }),
+                new("731", new[] { "1677","1678","1679","1680", "1685","1686","1687","1688","1689","1690" }),
+                new("745", new[] { "1677","1678","1679","1680", "1685","1686","1687","1688","1689","1690" }),
+                new("759", new[] { "1677","1678","1679","1680", "1685","1686","1687","1688","1689","1690" }),
+                new("773", new[] { "1677","1678","1679","1680", "1685","1686","1687","1688","1689","1690" }),
+                new("786", new[] { "1677","1678","1679","1680", "1685","1686","1687","1688","1689","1690" }),
+                new("861", new[] { "1692","1693","1694","1695", "1700","1701","1702","1703","1704","1705" }), //分拣二北侧
+                new("875", new[] { "1692","1693","1694","1695", "1700","1701","1702","1703","1704","1705"  }),
+                new("889", new[] { "1692","1693","1694","1695", "1700","1701","1702","1703","1704","1705"  }),
+                new("903", new[] { "1692","1693","1694","1695", "1700","1701","1702","1703","1704","1705"  }),
+                new("917", new[] { "1692","1693","1694","1695", "1700","1701","1702","1703","1704","1705"  }),
+                new("931", new[] { "1692","1693","1694","1695", "1700","1701","1702","1703","1704","1705"  }),
+                new("945", new[] { "1692","1693","1694","1695", "1700","1701","1702","1703","1704","1705"  }),
+                new("959", new[] { "1692","1693","1694","1695", "1700","1701","1702","1703","1704","1705"  }),
+                new("973", new[] { "1692","1693","1694","1695", "1700","1701","1702","1703","1704","1705"  }),
+                new("986", new[] { "1692","1693","1694","1695", "1700","1701","1702","1703","1704","1705"  }),
+                new("1061", new[] { "1707","1708","1709","1710", "1715","1716","1717","1718","1719","1720" }),//分拣二南侧
+                new("1075", new[] { "1707","1708","1709","1710", "1715","1716","1717","1718","1719","1720" }),
+                new("1089", new[] { "1707","1708","1709","1710", "1715","1716","1717","1718","1719","1720" }),
+                new("1103", new[] { "1707","1708","1709","1710", "1715","1716","1717","1718","1719","1720" }),
+                new("1117", new[] { "1707","1708","1709","1710", "1715","1716","1717","1718","1719","1720" }),
+                new("1131", new[] { "1707","1708","1709","1710", "1715","1716","1717","1718","1719","1720" }),
+                new("1145", new[] { "1707","1708","1709","1710", "1715","1716","1717","1718","1719","1720" }),
+                new("1159", new[] { "1707","1708","1709","1710", "1715","1716","1717","1718","1719","1720" }),
+                new("1173", new[] { "1707","1708","1709","1710", "1715","1716","1717","1718","1719","1720" }),
+                new("1186", new[] { "1707","1708","1709","1710", "1715","1716","1717","1718","1719","1720" }),
+                new("1261", new[] { "1722","1723","1724","1725", "1730","1731","1732","1733","1734","1735" }), //分拣三北侧
+                new("1275", new[] {"1722","1723","1724","1725", "1730","1731","1732","1733","1734","1735"  }),
+                new("1289", new[] {"1722","1723","1724","1725", "1730","1731","1732","1733","1734","1735"  }),
+                new("1303", new[] {"1722","1723","1724","1725", "1730","1731","1732","1733","1734","1735"  }),
+                new("1317", new[] {"1722","1723","1724","1725", "1730","1731","1732","1733","1734","1735"  }),
+                new("1331", new[] {"1722","1723","1724","1725", "1730","1731","1732","1733","1734","1735"  }),
+                new("1345", new[] {"1722","1723","1724","1725", "1730","1731","1732","1733","1734","1735"  }),
+                new("1359", new[] {"1722","1723","1724","1725", "1730","1731","1732","1733","1734","1735"  }),
+                new("1373", new[] {"1722","1723","1724","1725", "1730","1731","1732","1733","1734","1735"  }),
+                new("1386", new[] {"1722","1723","1724","1725", "1730","1731","1732","1733","1734","1735"  }),
+                new("1461", new[] { "1737","1738","1739","1740", "1745","1746","1747","1748","1749","1750" }),//分拣三南侧
+                new("1475", new[] { "1737","1738","1739","1740", "1745","1746","1747","1748","1749","1750" }),
+                new("1489", new[] { "1737","1738","1739","1740", "1745","1746","1747","1748","1749","1750" }),
+                new("1503", new[] { "1737","1738","1739","1740", "1745","1746","1747","1748","1749","1750" }),
+                new("1517", new[] { "1737","1738","1739","1740", "1745","1746","1747","1748","1749","1750" }),
+                new("1531", new[] { "1737","1738","1739","1740", "1745","1746","1747","1748","1749","1750" }),
+                new("1545", new[] { "1737","1738","1739","1740", "1745","1746","1747","1748","1749","1750" }),
+                new("1559", new[] { "1737","1738","1739","1740", "1745","1746","1747","1748","1749","1750" }),
+                new("1573", new[] { "1737","1738","1739","1740", "1745","1746","1747","1748","1749","1750" }),
+                new("1586", new[] { "1737","1738","1739","1740", "1745","1746","1747","1748","1749","1750" }),
+
+                #endregion 桁架取货点--码垛工位
+
+                #region 桁架--码垛工位
+
                 new("Truss1", new[] { "1662","1663","1664","1665","1670","1671","1672","1673", "1674","1675","1677","1678","1679","1680", "1685","1686","1687","1688","1689","1690" }),
                 new("Truss2", new[] {  "1692","1693","1694","1695", "1700","1701","1702","1703","1704","1705","1707","1708","1709","1710", "1715","1716","1717","1718","1719","1720" }),
                 new("Truss3", new[] { "1722","1723","1724","1725", "1730","1731","1732","1733","1734","1735","1737","1738","1739","1740", "1745","1746","1747","1748","1749","1750"}),
 
+                #endregion 桁架--码垛工位
+
                 #region 码垛工位--RGV
 
                 //分拣库一北
@@ -999,12 +1067,15 @@ namespace WCS.WorkEngineering
                 { DeviceFlags.主线分流点,new List<string>() { "22","41","61"} },
                 { DeviceFlags.满轮主线第一次扫码,new List<string>() { "1"} },
                 { DeviceFlags.环形库分流点,new List<string>(){ "418", "618","818","1018","1218","1418" } },
-                { DeviceFlags.桁架分流点,new List<string>() { "455" } },
-                { DeviceFlags.桁架缓存放行点, new List<string>(){ "466", "480", "494", "508","522","536","666","680","694","708","736","750" } },
-                { DeviceFlags.桁架取货点, new List<string>(){ "461", "475", "489", "503","517","531", "661", "675", "689", "703", "717", "731" } },
+                { DeviceFlags.桁架分流点,new List<string>() { "455","655","855","1055","1255","1455" } },
+                { DeviceFlags.桁架缓存放行点, new List<string>(){ "466", "480", "494", "508", "522", "536", "550", "564", "578", "591", "666", "680", "694", "708", "722", "736", "750", "764", "778", "791" , "866", "880", "894", "908", "922", "936", "950", "964", "978", "991" , "1066", "1080", "1094", "1108", "1122", "1136", "1150", "1164", "1178", "1191" , "1266", "1280", "1294", "1308", "1322", "1336", "1350", "1364", "1378", "1391" , "1466", "1480", "1494", "1408", "1422", "1436", "1450", "1464", "1478", "1591" } },
+                { DeviceFlags.桁架09缓存放行点, new List<string>(){ "466", "480", "494", "508", "522", "536", "666", "680", "694", "708", "722", "736", "866", "880", "894", "908", "922", "936", "1066", "1080", "1094", "1108", "1122", "1136",  "1266", "1280", "1294", "1308", "1322", "1336",  "1466", "1480", "1494", "1408", "1422", "1436" } },
+                { DeviceFlags.桁架09异常缓存放行点, new List<string>(){  "591", "791" ,"991" , "1191" , "1391" , "1591" } },
+                { DeviceFlags.桁架18缓存放行点, new List<string>(){  "550", "564", "578", "750", "764", "778" , "950", "964", "978" , "1150", "1164", "1178" , "1350", "1364", "1378" , "1450", "1464", "1478" } },
+                { DeviceFlags.桁架取货点, new List<string>(){ "461", "475", "489", "503","517","531", "545", "559", "573", "586", "661", "675", "689", "703", "717", "731", "745", "759", "773", "786", "861", "875", "889", "903", "917", "931", "945", "959", "973", "986", "1061", "1075", "1089", "1103", "1117", "1131", "1145", "1159", "1173", "1186", "1261", "1275", "1289", "1303", "1317", "1331", "1345", "1359", "1373", "1386" , "1461", "1475", "1489", "1503", "1517", "1531", "1545", "1559", "1573", "1586" } },
                 { DeviceFlags.拆盘机09, new List<string>(){ "1606","1616","1626","1636","1646","1656" } },
                 { DeviceFlags.拆盘机非09, new List<string>(){ "1602","1612","1622","1632","1642","1652" } },
-                { DeviceFlags.桁架码垛位, new List<string>(){ "1670", "1671", "1672", "1673", "1674", "1675","1664","1662","1663","1665","1677","1678","1679","1680","1685","1686","1687","1688","1689","1690" } },
+                { DeviceFlags.桁架码垛位, new List<string>(){ "1670", "1671", "1672", "1673", "1674", "1675","1664","1662","1663","1665","1677","1678","1679","1680","1685","1686","1687","1688","1689","1690", "1692", "1693", "1694", "1695", "1700", "1701", "1702", "1703", "1704", "1705", "1707", "1708", "1709", "1710", "1715", "1716", "1717", "1718", "1719", "1720", "1722", "1723", "1724", "1725", "1730", "1731", "1732", "1733", "1734", "1735", "1737", "1738", "1739", "1740", "1745", "1746", "1747", "1748", "1749", "1750" } },
                 { DeviceFlags.环形库码垛工位, new List<string>(){ "1666", "1661","1676","1681", "1691", "1696", "1706", "1711", "1721", "1726", "1736", "1741" } },
                 { DeviceFlags.AGV取货站台口, new List<string>(){ "2533", "2534", "2734" } },
                 { DeviceFlags.Robot, new List<string>(){ "Robot1", "Robot2", "Robot3","Robot4" , "Robot5", "Robot6" } },