From c2461f320a6b36390d8dd26d4ce11a62baa0e215 Mon Sep 17 00:00:00 2001
From: xxyy <cathay_xy@163.com>
Date: 星期五, 28 二月 2025 10:42:35 +0800
Subject: [PATCH] 更新 .gitignore 和优化任务处理逻辑

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs |   31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 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 a001e83..d185ef3 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
@@ -194,6 +194,7 @@
             (var loc, var tas) = UpdateStockAndTaskStatus(stock, task);
             var taskHty = task.Adapt<Dt_Task_Hty>();
             taskHty.FinishTime = DateTime.Now;
+            taskHty.OperateType = (int)OperateTypeEnum.鑷姩瀹屾垚;
 
             DtStockInfo_Hty stockInfo_Hty = stock.Adapt<DtStockInfo_Hty>();
             stockInfo_Hty.ModifyDate = DateTime.Now;
@@ -761,7 +762,7 @@
                 {
                     NGStation = efg.Select(x => x.stationNGChildCode).ToList();
                 }
-                content = await CreateNewTask(input, result.ProductionLine, NGStation, 2);
+                content = await CreateNewTask(input, result.ProductionLine, result.ProcessCode, NGStation, 2);
                 return content.Error("瀛樺湪寮傚父鐢佃姱");
             }
 
@@ -798,7 +799,7 @@
                 {
                     // TODO 閫佽嚦鍖呰
                     List<string> strings = stationManagers.Where(x => x.stationType == 0).Select(x => x.Roadway).ToList();
-                    content = await CreateNewTask(input, result.ProductionLine, strings, 3);
+                    content = await CreateNewTask(input, result.ProductionLine, result.ProcessCode, strings, 3);
                     return content;
                 }
                 else
@@ -806,7 +807,7 @@
                     var config = _configService.GetByConfigKey("SYS_InStacker", "CW3InStacker");
                     var strings = config.ConfigValue.Split(',').ToList();
                     // TODO 鍏ュ簱
-                    content = await CreateNewTask(input, result.ProductionLine, strings);
+                    content = await CreateNewTask(input, result.ProductionLine, result.ProcessCode, strings);
                     if (content.Status)
                         await _boxingInfoRepository.AddDataNavAsync(boxing);
                 }
@@ -895,7 +896,7 @@
                 List<string> strings = stationManagers.Roadway.Split(',').ToList();
                 Console.WriteLine(strings.ToJsonString() + "b-----------------------");
                 //// 璋冪敤CreateNewTask鏂规硶锛屽垱寤烘柊浠诲姟
-                content = await CreateNewTask(input, result.ProductionLine, strings);
+                content = await CreateNewTask(input, result.ProductionLine, result.ProcessCode, strings);
                 if (content.Status)
                 {
                     var isBox = await _boxingInfoRepository.AddDataNavAsync(boxing);
@@ -952,6 +953,7 @@
                     CreateDate = DateTime.Now,
                     TaskId = 0,
                     ProductionLine = stock.ProductionLine,
+                    ProcessCode = stock.ProcessCode,
                 };
 
                 var taskDTO = CreateTaskDTO(taskNew);
@@ -1025,6 +1027,7 @@
                 var boxing = CreateBoxingInfo(result, input.PalletCode);
                 if (boxing == null) return content.Error("缁勭洏澶辫触");
 
+                input.ProductionLine = result.ProductionLine;
                 return await ProcessBasedOnProcessCode(boxing, area, input, result);
             }
         }
@@ -1125,7 +1128,7 @@
             }
             List<string> strings = stationManagers.Roadway.Split(',').ToList();
 
-            return await CreateNewTask(input, result.ProductionLine, strings, 1);
+            return await CreateNewTask(input, result.ProductionLine, result.ProcessCode, strings, 1);
         }
         catch (Exception)
         {
@@ -1279,7 +1282,7 @@
 
         var devices = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>()
             .Where(x => x.DeviceStatus == "1")
-            .Where(x => x.DeviceRemark == "1")
+            .Where(x => x.DeviceCode.Contains("CWSC"))
             .ToList();
         var deviceCode = devices.Select(x => x.DeviceCode).ToList();
 
@@ -1360,6 +1363,7 @@
             CreateDate = DateTime.Now,
             TaskId = 0,
             ProductionLine = stockInfo.ProductionLine,
+            ProcessCode = stockInfo.ProcessCode,
         };
     }
 
@@ -1729,7 +1733,8 @@
                         TaskType = (int)TaskInboundTypeEnum.Inbound,
                         TaskNum = await BaseDal.GetTaskNo(),
                         Creater = "Systeam",
-                        ProductionLine = result.ProductionLine
+                        ProductionLine = result.ProductionLine,
+                        ProcessCode = result.ProcessCode,
                     };
 
                     // 鍒涘缓WMS浠诲姟
@@ -1766,7 +1771,8 @@
                         TaskType = (int)TaskInboundTypeEnum.InTray,
                         TaskNum = await BaseDal.GetTaskNo(),
                         Creater = "Systeam",
-                        ProductionLine = result.ProductionLine
+                        ProductionLine = result.ProductionLine,
+                        ProcessCode = result.ProcessCode,
                     };
                     // 鍒涘缓WMS浠诲姟
                     WMSTaskDTO taskDTO = CreateWMSTaskDTO(task);
@@ -2028,7 +2034,7 @@
     private Dt_Task_Hty CreateHistoricalTask(Dt_Task task, bool isHand = false)
     {
         // 鏇存柊浠诲姟鐘舵��
-        task.TaskState = TaskOutStatusEnum.OutFinish.ObjToInt();
+        task.TaskState = task.TaskType > 199 ? (int)TaskInStatusEnum.InFinish : (int)TaskOutStatusEnum.OutFinish;
         task.CurrentAddress = task.NextAddress;
 
         // 鍒涘缓鍘嗗彶浠诲姟
@@ -2041,7 +2047,7 @@
         {
             taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System";
         }
-        taskHty.TaskState = TaskOutStatusEnum.OutFinish.ObjToInt();
+        taskHty.TaskState = task.TaskType > 199 ? (int)TaskInStatusEnum.InFinish : (int)TaskOutStatusEnum.OutFinish;
         return taskHty;
     }
 
@@ -2275,7 +2281,7 @@
     /// <param name="process">宸烽亾</param>
     /// <param name="flag">鏍囪瘑锛�0-鍏ュ簱锛�1-绌烘墭鐩樺叆搴擄紝2-NG鍏ュ簱锛�3-鍑哄簱锛�</param>
     /// <returns></returns>
-    private async Task<WebResponseContent> CreateNewTask(RequestTaskDto input, string productionLine, List<string> process = null, int flag = 0)
+    private async Task<WebResponseContent> CreateNewTask(RequestTaskDto input, string productionLine, string processCode, List<string> process = null, int flag = 0)
     {
         WebResponseContent content = new WebResponseContent();
 
@@ -2304,7 +2310,8 @@
             TaskType = flag == 0 ? (int)TaskInboundTypeEnum.Inbound : flag == 1 ? (int)TaskInboundTypeEnum.InTray : flag == 2 ? (int)TaskInboundTypeEnum.InNG : (int)TaskOutboundTypeEnum.Outbound,
             TaskNum = await BaseDal.GetTaskNo(),
             Creater = "Systeam",
-            ProductionLine = productionLine
+            ProductionLine = productionLine,
+            ProcessCode = processCode
         };
 
         // 灏濊瘯娣诲姞鏂颁换鍔�

--
Gitblit v1.9.3