From 843cc2ea1b104ecdf9da61318a4136a5d4096411 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期五, 24 四月 2026 11:07:21 +0800
Subject: [PATCH] 集成Quartz定时任务,支持NG出库自动化及WMS/WCS接口扩展

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs |   47 ++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs
index 33c3745..06c9db3 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs
@@ -252,7 +252,7 @@
 
                 // 鍙戣捣璇锋眰鑾峰彇鍏ュ簱浠诲姟
                 content = await RequestInTask(palletCode, stationManager);
-                ConsoleHelper.WriteErrorLine($"{stationManager.stationChildCode}绔欏彴璇锋眰鍝嶅簲淇℃伅:{content.ToJsonString()}");
+                //ConsoleHelper.WriteErrorLine($"{stationManager.stationChildCode}绔欏彴璇锋眰鍝嶅簲淇℃伅:{content.ToJsonString()}");
 
                 if (!content.Status)
                 {
@@ -260,7 +260,7 @@
                 }
 
                 var task = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
-                ConsoleHelper.WriteSuccessLine(content.Data.ToString());
+                //ConsoleHelper.WriteSuccessLine(content.Data.ToString());
                 return ReceiveByWMSTask(task);
             }
             catch (Exception ex)
@@ -415,8 +415,6 @@
                 var task = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
                 ConsoleHelper.WriteSuccessLine(content.Data.ToString());
 
-                QuartzLogger.WriteLogToFile($"鍖呰鍑哄簱", $"杩斿洖鍙傛暟銆恵JsonConvert.SerializeObject(task)}銆憑Environment.NewLine}{Environment.NewLine}");
-                //_taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO })鈥�
                 content = ReceiveWMSTask(new List<WMSTaskDTO> { task });
 
                 QuartzLogger.WriteLogToFile($"鍖呰鍑哄簱", $"杩斿洖鍙傛暟銆恵JsonConvert.SerializeObject(content)}銆憑Environment.NewLine}{Environment.NewLine}");
@@ -450,7 +448,7 @@
                 {
                     if (task.TaskType == (int)TaskOutboundTypeEnum.InToOut && taskDTO.RoadWay.Contains("CW"))
                     {
-                        var stationinfo = _stationManagerRepository.QueryFirst(x => x.stationPLC == "1017" && x.stationType == 10 && x.Roadway == taskDTO.RoadWay);
+                        var stationinfo = _stationManagerRepository.QueryFirst(x => (x.stationPLC == "1017" ||x.stationPLC=="1024")&& x.stationType == 10 && x.Roadway == taskDTO.RoadWay);
                         task.TaskState = (int)TaskOutStatusEnum.OutNew;
                         task.CurrentAddress = taskDTO.SourceAddress;
                         task.NextAddress = stationinfo.stationChildCode;
@@ -561,6 +559,7 @@
                     task.NextAddress = "002-000-002";
                     task.SourceAddress = taskDTO.SourceAddress;
                     task.TargetAddress = taskDTO.TargetAddress;
+
                 }
                 BaseDal.AddData(task);
 
@@ -575,6 +574,44 @@
             return content;
         }
 
+        public WebResponseContent ReceiveByWMSNGTask([NotNull] WMSTaskDTO taskDTO)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                var task = BaseDal.QueryFirst(x => x.TaskNum == taskDTO.TaskNum || x.PalletCode == taskDTO.PalletCode);
+                if (task != null)
+                {
+                    var taskHty = task.Adapt<Dt_Task_Hty>();
+                    _taskHtyRepository.AddData(taskHty);
+                    BaseDal.DeleteData(task);
+                }
+
+                Dt_Task taskNew = _mapper.Map<Dt_Task>(taskDTO);
+                taskNew.Creater = "WMS";
+
+                if (taskNew.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
+                {
+                    taskNew.TaskState = (int)TaskOutStatusEnum.OutNew;
+                    taskNew.CurrentAddress = taskDTO.SourceAddress;
+                    taskNew.NextAddress = taskDTO.NextAddress;
+                    taskNew.SourceAddress = taskDTO.SourceAddress;
+                    taskNew.TargetAddress = taskDTO.TargetAddress;
+
+                }
+                BaseDal.AddData(taskNew);
+
+                _taskExecuteDetailService.AddTaskExecuteDetail(taskNew.WMSId, "鎺ユ敹WMS浠诲姟");
+
+                content = WebResponseContent.Instance.OK("鎴愬姛");
+            }
+            catch (Exception ex)
+            {
+                content = WebResponseContent.Instance.Error($"浠诲姟鎺ユ敹閿欒,閿欒淇℃伅:{ex.Message}");
+            }
+            return content;
+        }
+
         /// <summary>
         /// 鎺ユ敹WMS浠诲姟淇℃伅
         /// </summary>

--
Gitblit v1.9.3