From 8ae1a147aefadbb255edde088e7c12535c5f02d4 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期三, 08 十月 2025 20:35:51 +0800
Subject: [PATCH] 完善输送线和堆垛机任务处理逻辑在CommonConveyorLine_NewCW.cs`中添加版本注释和设备属性定义,增强设备连接状态检查与命令发送逻辑。 修改 CommonConveyorLine_GWJob.cs`的任务查询逻辑,确保在特定条件下不下发新任务。在CommonConveyorLine_NewCWJob.cs中实现请求入库和出库的处理逻辑,确保任务状态更新。在 RequestInbound.cs中添加出库任务和新任务的处理逻辑,增强异常处理。 在CommonStackerCrane_NewCWJob.cs中实现堆垛机任务完成事件的处理,确保状态更新和前端通知。新增设备型号修改相关常量和 DTO 类,更新服务接口和实现逻辑,确保设备型号修改请求的正确处理。修改 Dt_TaskService.cs中的任务处理逻辑,确保出库任务的库存判断和状态更新。

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs |   84 +++++++++++++++++++++++-------------------
 1 files changed, 46 insertions(+), 38 deletions(-)

diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
index 55978af..7662b61 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -86,30 +86,30 @@
         {
             if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
             {
-                if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
+                //if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
+                //{
+                if (!task.Roadway.Contains("FR") && stock.ProcessCode != "OCVB")
                 {
-                    if (!task.Roadway.Contains("FR") && stock.ProcessCode != "OCVB")
+                    var agingOutputDto = MapToAgingOutputDto(stock);
+                    content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto);
+
+                    if (content.Status)
                     {
-                        var agingOutputDto = MapToAgingOutputDto(stock);
-                        content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto);
+                        var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString());
 
-                        if (content.Status)
+                        if (!result.Success && result.MessageCode == "E10001")
                         {
-                            var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString());
-
-                            if (!result.Success && result.MessageCode == "E10001")
-                            {
-                                await HandleOutBoundError(stock, task);
-                            }
-                        }
-                        else
-                        {
-                            task.Remark = "NG";
-                            ConsoleHelper.WriteErrorLine("MOM閫氭姤鐐硅姱NG");
-                            return content.Error("MOM閫氭姤鐐硅姱NG");
+                            await HandleOutBoundError(stock, task);
                         }
                     }
+                    else
+                    {
+                        task.Remark = "NG";
+                        ConsoleHelper.WriteErrorLine("MOM閫氭姤鐐硅姱NG");
+                        return content.Error("MOM閫氭姤鐐硅姱NG");
+                    }
                 }
+                //}
             }
 
             if (task.Remark == "NG")
@@ -429,8 +429,8 @@
             Console.WriteLine(err.Message.ToString());
             LogFactory.GetLog("浠诲姟瀹屾垚").Error(true, err);
             content.Error(err.Message);
-            task.ErrorMessage= err.Message;
-            task.TaskState=(int)TaskInStatusEnum.SC_InExecuting;
+            task.ErrorMessage = err.Message;
+            task.TaskState = (int)TaskInStatusEnum.SC_InExecuting;
             await BaseDal.Update(task);
         }
         return content;
@@ -617,13 +617,13 @@
         }
         LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "楠岃瘉浠诲姟鏄惁瀛樺湪", JsonConvert.SerializeObject(task));
 
-        if (task.TaskType == (int)TaskOutboundTypeEnum.InToOut)
-        {
-            return await CompleteInToOutTaskAsync(task);
-        }
+
         // 楠岃瘉搴撳瓨鏄惁瀛樺湪
         var stock = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == task.PalletCode);
-
+        if (task.TaskType == (int)TaskOutboundTypeEnum.InToOut)
+        {
+            return await CompleteInToOutTaskAsync(task, stock);
+        }
         // 鏍规嵁浠诲姟绫诲瀷璋冪敤鐩稿簲鐨勫畬鎴愪换鍔℃柟娉�
         switch (task.TaskType)
         {
@@ -637,7 +637,7 @@
             case (int)TaskOutboundTypeEnum.OutTray:
             case (int)TaskOutboundTypeEnum.Outbound:
             case (int)TaskOutboundTypeEnum.OutNG:
-            
+
                 LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍑哄簱浠诲姟", "");
                 return await CompleteStackTaskAsync(task, stock);
 
@@ -648,7 +648,6 @@
 
             case (int)TaskRelocationTypeEnum.Relocation:
                 return await CompleteTransferTaskAsync(task, stock);
-
             default:
                 return content.Error("浠诲姟绫诲瀷涓嶅瓨鍦�");
         }
@@ -675,6 +674,11 @@
             var stock = await QueryStockInfo(input.PalletCode);
             if (stock != null)
             {
+                List<string> strings = new List<string>() { "GW", "CW", "FR" };
+                if (stock.AreaCode.Contains(strings))
+                {
+                    return content.Error($"鎵樼洏銆恵stock.PalletCode}銆戝瓨鍦ㄥ簱瀛樹笉鍏佽鍏ュ簱");
+                }
                 Dt_Task taskNew = new Dt_Task
                 {
                     Grade = 1,
@@ -765,6 +769,7 @@
                 //    return await HandleErrorCells(input, area, serialNosError);
                 //}
                 #endregion
+
                 var boxing = CreateBoxingInfo(result, input.PalletCode);
                 if (boxing == null) return content.Error("缁勭洏澶辫触");
 
@@ -861,8 +866,8 @@
                 var configOne = _configService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStacker, SysConfigConst.CHInboundEmptyProductLineOne);
                 var configTwo = _configService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStacker, SysConfigConst.CHInboundEmptyProductLineTwo);
 
-                List<string>  productLineconfigOne = configOne.ConfigValue.Split(',').ToList();
-                List<string>  productLineconfigTwo = configTwo.ConfigValue.Split(',').ToList();
+                List<string> productLineconfigOne = configOne.ConfigValue.Split(',').ToList();
+                List<string> productLineconfigTwo = configTwo.ConfigValue.Split(',').ToList();
 
                 if (productLineconfigOne.Count == 0 && productLineconfigTwo.Count() == 0)
                 {
@@ -881,13 +886,13 @@
                 {
                     ConsoleHelper.WriteErrorLine($"鏈壘鍒皗result.ProductionLine}瀵瑰簲閰嶇疆宸烽亾");
                     return content.Error($"鏈壘鍒皗result.ProductionLine}瀵瑰簲閰嶇疆宸烽亾");
-                }   
+                }
             }
             else
             {
                 strings = stationManagers.Roadway.Split(',').ToList();
             }
-             
+
 
             return await CreateNewTask(input, result.ProductionLine, result.ProcessCode, strings, 1);
         }
@@ -906,8 +911,8 @@
 
     // 鑾峰彇缁勭洏淇℃伅
     private DtBoxingInfo CreateBoxingInfo(ResultTrayCellsStatus result, string palletCode)
-    {  
-         var boxing=_boxingInfoRepository.QueryFirst(x=>x.PalletCode == palletCode);
+    {
+        var boxing = _boxingInfoRepository.QueryFirst(x => x.PalletCode == palletCode);
         if (boxing == null)
         {
             return new DtBoxingInfo
@@ -926,8 +931,11 @@
                 }).ToList()
             };
         }
-        else { 
-            _boxingInfoRepository.DeleteData(boxing);
+        else
+        {
+            _boxingInfoRepository.Db.DeleteNav<DtBoxingInfo>(x => x.Id == boxing.Id)
+                                            .Include(x => x.BoxingInfoDetails)
+                                            .ExecuteCommandAsync();
             return new DtBoxingInfo
             {
                 PalletCode = palletCode,
@@ -944,7 +952,7 @@
                 }).ToList()
             };
         }
-       
+
     }
 
     // 鑾峰彇宸ヨ壓鐢宠
@@ -1310,7 +1318,7 @@
             if (stockInfo.AreaCode.Contains("CH"))
             {
                 // 鍒涘缓骞舵坊鍔犱换鍔″埌鏁版嵁搴�
-                if(stockInfo.LocationInfo.RoadwayNo=="CHSC1"|| stockInfo.LocationInfo.RoadwayNo == "CHSC2"|| stockInfo.LocationInfo.RoadwayNo == "CHSC3")
+                if (stockInfo.LocationInfo.RoadwayNo == "CHSC1" || stockInfo.LocationInfo.RoadwayNo == "CHSC2" || stockInfo.LocationInfo.RoadwayNo == "CHSC3")
                 {
                     task = CreateTask(stockInfo, "1020-1", taskType);
                 }
@@ -1318,7 +1326,7 @@
                 {
                     task = CreateTask(stockInfo, "1049-8", taskType);
                 }
-                
+
             }
             else
             {
@@ -2145,7 +2153,7 @@
             ToAddress = await GetRoadWayAsync(process);
         else
             ToAddress = process[0];
-        if(string.IsNullOrEmpty(ToAddress))
+        if (string.IsNullOrEmpty(ToAddress))
         {
             return content.Error("鏃犳硶鑾峰彇鐩爣鍦板潃");
         }

--
Gitblit v1.9.3