林豪 左 1 year ago
parent
commit
2cc7b1a9d6

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

@@ -200,6 +200,8 @@ namespace WCS.WorkEngineering.Extensions
             };
             var billBomsetinfos = db.Queryable<BillBomsetinfo>().Where(x => x.BomSetHdrId == billBomsetgrp.Id).ToList();
 
+            var addTime = DateTime.Now;
+
             //开始构造垛形信息
             var palletizing = new WCS_Palletizing()
             {
@@ -210,7 +212,8 @@ namespace WCS.WorkEngineering.Extensions
                 LayerCountQty = 2,
                 StampType = billBomsetgrp.StampType,
                 Finish = false,
-                AddTime = DateTime.Now,
+                AddTime = addTime,
+                EditTime = addTime,
                 TaskId = task.ID,
                 WarehouseCode = task.WarehouseCode,
                 DeviceCode = task.Device
@@ -242,7 +245,9 @@ namespace WCS.WorkEngineering.Extensions
                         RowNo = item.Key,
                         PalletizingLayerId = palletizingLayer.Id,
                         PalletizingId = palletizing.Id,
-                        WarehouseCode = palletizingLayer.WarehouseCode
+                        WarehouseCode = palletizingLayer.WarehouseCode,
+                        AddTime = addTime,
+                        EditTime = addTime,
                     };
                     palletizingRow = db.InsertableRowLock(palletizingRow).ExecuteReturnEntity();
                 }
@@ -270,6 +275,7 @@ namespace WCS.WorkEngineering.Extensions
                             TaskId = task.ID,
                             PalletizingRowId = palletizingRow.Id,
                             Finish = false,
+                            PalletizingId = palletizing.Id,
                             WarehouseCode = palletizingRow.WarehouseCode
                         };
                         db.InsertableRowLock(palletizingLoc).ExecuteReturnEntity();

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

@@ -43,8 +43,11 @@ namespace WCS.WorkEngineering.Systems
             {
                 return;
             }
+
+            var isEnd = false; //每个周期只处理一个任务
             foreach (var item in taskInfos)
             {
+                if (isEnd) return;
                 try
                 {
                     SqlSugarHelper.Do(db =>
@@ -59,6 +62,7 @@ namespace WCS.WorkEngineering.Systems
                                     task.Status = TaskStatus.WaitingToExecute;
                                     db.Default.UpdateableRowLock(task).ExecuteCommand();
                                     task.AddWCS_TASK_DTL(db.Default, task.Device, $"初始化入库任务信息");
+                                    isEnd = true;
                                 }
                                 break;
 
@@ -94,6 +98,7 @@ namespace WCS.WorkEngineering.Systems
 
                                 db.Default.UpdateableRowLock(task).ExecuteCommand();
                                 task.AddWCS_TASK_DTL(db.Default, task.Device, $"初始化入库任务信息");
+                                isEnd = true;
                                 break;
 
                             case TaskType.OutDepot:
@@ -114,6 +119,7 @@ namespace WCS.WorkEngineering.Systems
                                         task.Depth = pos[3].ToShort();
                                         db.Default.UpdateableRowLock(task).ExecuteCommand();
                                         task.AddWCS_TASK_DTL(db.Default, task.Device, $"初始化出库任务信息,放货站台:{task.SrmStation}");
+                                        isEnd = true;
                                     }
                                     else
                                     {
@@ -201,6 +207,7 @@ namespace WCS.WorkEngineering.Systems
                                         task.Status = Entity.TaskStatus.WaitingToExecute;
                                         db.Default.UpdateableRowLock(task).ExecuteCommand();
                                         task.AddWCS_TASK_DTL(db.Default, task.Device, $"初始化出库任务信息,放货站台:{task.SrmStation}");
+                                        isEnd = true;
                                     }
                                     break;
                                 }

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

@@ -89,6 +89,7 @@ namespace WCS.WorkEngineering.Systems
         /// <returns></returns>
         public bool Allot(SqlSugarScopeProvider db, WCS_TaskInfo taskInfo, Device<IStation520, IStation521, IStation523> obj)
         {
+            var nowTime = DateTime.Now;
             taskInfo.Device = obj.Entity.Code switch
             {
                 "455" => "Truss1",
@@ -128,14 +129,14 @@ namespace WCS.WorkEngineering.Systems
                 cacheLoc = db.Queryable<WCS_CacheLineLoc>().Single(x => x.Id == cacheLoc.Id);
                 cacheLoc.InStock = true;
                 cacheLoc.TaskId = taskInfo.ID;
-                cacheLoc.EditTime = DateTime.Now;
+                cacheLoc.EditTime = nowTime;
                 db.UpdateableRowLock(cacheLoc).ExecuteCommand();
 
                 //WCS任务相关信息
                 taskInfo.Status = TaskStatus.FinishOfShunt;
                 taskInfo.AddrNext = cacheLine.LocationNo.ToString();
                 taskInfo.EditWho = "WCS";
-                taskInfo.EditTime = DateTime.Now;
+                taskInfo.EditTime = nowTime;
                 db.UpdateableRowLock(taskInfo).ExecuteCommand();
                 taskInfo.AddWCS_TASK_DTL(db, obj.Entity.Code, taskInfo.AddrNext, $"完成分库计算,目标地址:{cacheLine.LocationNo}");
 
@@ -207,7 +208,8 @@ namespace WCS.WorkEngineering.Systems
                 cacheLine = new WCS.Entity.WCS_CacheLine()
                 {
                     LocationNo = devCode,
-                    AddTime = DateTime.Now,
+                    AddTime = nowTime,
+                    EditTime = nowTime,
                     PalletizingRowId = palletizingRow.Id,
                     InStock = false,
                     Put = false,
@@ -259,7 +261,7 @@ namespace WCS.WorkEngineering.Systems
                         World.Log($"有正目标地址是{JsonConvert.SerializeObject(twoDevs)}的未结束二次码垛任务,无可用的二次码垛工位");
                         continue;
                     }
-                    palletizing.EditTime = DateTime.Now;
+                    palletizing.EditTime = nowTime;
                     palletizing.Finish = false;
                     palletizing.PalletizingStation = twoDevs.FirstOrDefault();
                     palletizing.TaskAddNext ??= devCode.ToString();
@@ -275,7 +277,7 @@ namespace WCS.WorkEngineering.Systems
                 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;
+                palletizingRow.EditTime = nowTime;
 
                 var createCacheLoc = palletizingRow.Locs.Select((t, i) => new WCS_CacheLineLoc()
                 {
@@ -285,13 +287,14 @@ namespace WCS.WorkEngineering.Systems
                     MatCode = t.MatCode,
                     TaskId = i == 0 ? taskInfo.ID : 0,
                     CacheLineId = res.Id,
-                    AddTime = DateTime.Now
+                    AddTime = nowTime,
+                    EditTime = nowTime
                 }).ToList();
 
                 taskInfo.Status = TaskStatus.FinishOfShunt;
                 taskInfo.AddrNext = devCode.ToString();
                 taskInfo.EditWho = "WCS";
-                taskInfo.EditTime = DateTime.Now;
+                taskInfo.EditTime = nowTime;
                 db.UpdateableRowLock(taskInfo).ExecuteCommand();
                 taskInfo.AddWCS_TASK_DTL(db, obj.Entity.Code, taskInfo.AddrNext, $"完成分库计算,目标地址:{cacheLine.LocationNo}");
                 db.UpdateableRowLock(palletizingRow).ExecuteCommand();

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

@@ -59,7 +59,8 @@ namespace WCS.WorkEngineering.Systems
                     foreach (var row in palletizingRow)
                     {
                         var cacheLine = db.Queryable<WCS.Entity.WCS_CacheLine>().Includes(x => x.Locations).Single(x => x.Id == row.CacheLine.Id);
-                        if (cacheLine.AddTime < DateTime.Now.AddHours(-6))
+                        //时间超六小时,且缓存线数量与码垛信息行数量不相等时强制结盘
+                        if (cacheLine.AddTime < DateTime.Now.AddHours(-6) && cacheLine.Locations.Count(x => x.InStock) != row.QtyMaxCount)
                         {
                             isEnd = true;
                         }