From 02a4fdd78cef9c7d2a26bfb9aa187179cf0baac3 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期三, 25 二月 2026 17:44:26 +0800
Subject: [PATCH] 1

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CWTask/RequestInbound.cs |  142 +++++++++++++----------------------------------
 1 files changed, 40 insertions(+), 102 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CWTask/RequestInbound.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CWTask/RequestInbound.cs
index b15cf35..2d4d0fc 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CWTask/RequestInbound.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CWTask/RequestInbound.cs
@@ -47,94 +47,46 @@
         /// </summary>
         private void HandleNewTask(CommonConveyorLine_CW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
         {
-            Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationPLC == conveyorLine.DeviceCode && x.stationChildCode == childDeviceCode);
-
-            if (stationManager == null)
+            try
             {
-                // Handle the case where stationManager is not found, if necessary
-                Console.WriteLine($"鏈壘鍒皗childDeviceCode}绔欏彴");
-                return;
-            }
 
-            // 鏍规嵁绔欑被鍨嬫墽琛岀浉搴旂殑鏂规硶
-            switch (stationManager.stationType)
-            {
-                case 8:
-                case 9:
-                case 11:
-                case 12:
-                    var task = _taskService.QueryExecutingTaskByBarcode(command.ConveyorLineBarcode, childDeviceCode);
-                    if (task != null)
-                    {
+                Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationPLC == conveyorLine.DeviceCode && x.stationChildCode == childDeviceCode);
+
+                if (stationManager == null)
+                {
+                    // Handle the case where stationManager is not found, if necessary
+                    Console.WriteLine($"鏈壘鍒皗childDeviceCode}绔欏彴");
+                    return;
+                }
+
+                // 鏍规嵁绔欑被鍨嬫墽琛岀浉搴旂殑鏂规硶
+                switch (stationManager.stationType)
+                {
+                    case 8:
+                    case 9:
+                    case 11:
+                    case 12:
+                        var task = _taskService.QueryExecutingTaskByBarcode(command.ConveyorLineBarcode, childDeviceCode);
+                        if (task != null)
+                        {
+                            ExecuteStationAction(stationManager, conveyorLine, command, childDeviceCode);
+                        }
+                        break;
+                    case 1:
+                    case 6:
+                    case 10:
                         ExecuteStationAction(stationManager, conveyorLine, command, childDeviceCode);
-                    }
-                    break;
-                case 1:
-                case 6:
-                case 10:
-                    ExecuteStationAction(stationManager, conveyorLine, command, childDeviceCode);
-                    break;
-                    //case 16:
-                    //    ExecuteStationAction(stationManager, conveyorLine, command, childDeviceCode);
-                    //    break;
+                        break;
+                        //case 16:
+                        //    ExecuteStationAction(stationManager, conveyorLine, command, childDeviceCode);
+                        //    break;
+                }
+
             }
-
-            #region
-            //Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationPLC == conveyorLine.DeviceCode && x.stationChildCode == childDeviceCode);
-
-            //if (stationManager.stationType == 8)
-            //{
-            //    var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
-            //    if (task != null)
-            //    {
-            //        RequestInNextAddress(conveyorLine, command, childDeviceCode);
-            //    }
-            //}
-            //else if (stationManager.stationType == 9)
-            //{
-            //    var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
-            //    if (task != null)
-            //    {
-            //        ConveyorLineInFinish(conveyorLine, command, childDeviceCode);
-            //    }
-            //}
-            //else if (stationManager.stationType == 1)
-            //{
-            //    if (stationManager.stationArea.Contains("GW"))
-            //    {
-            //        var taskGW = _taskRepository.QueryFirst(x => x.TargetAddress == childDeviceCode && x.TaskState == (int)TaskOutStatusEnum.OutFinish);
-            //        if (taskGW != null)
-            //        {
-            //            command.ConveyorLineBarcode = taskGW.PalletCode;
-            //        }
-            //    }
-            //    RequestWmsTask(conveyorLine, command, childDeviceCode);
-            //}
-            //else if (stationManager.stationType == 10)
-            //{
-            //    var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
-            //    if (task != null)
-            //    {
-            //        RequestOutbound(conveyorLine, command, childDeviceCode);
-            //    }
-            //}
-            //else if (stationManager.stationType == 11)
-            //{
-            //    var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
-            //    if (task != null)
-            //    {
-            //        RequestOutNextAddress(conveyorLine, command, childDeviceCode);
-            //    }
-            //}
-            //else if (stationManager.stationType == 12)
-            //{
-            //    var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
-            //    if (task != null)
-            //    {
-            //        ConveyorLineOutFinish(conveyorLine, command, childDeviceCode);
-            //    }
-            //}
-            #endregion
+            catch (Exception ex)
+            {
+                WriteInfo("HandleNewTask", $"銆恵ex.Message}銆�");
+            }
         }
 
         private void ExecuteStationAction(Dt_StationManager stationManager, CommonConveyorLine_CW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
@@ -168,23 +120,6 @@
                     AbNormalStationBZTask(conveyorLine, command, childDeviceCode);
                     break;
                 case 1:
-
-                    //if (stationManager.stationArea.Contains("GW"))
-                    //{
-                    //var taskGW = _taskRepository.QueryFirst(x => x.TargetAddress == childDeviceCode && (x.TaskState == (int)TaskOutStatusEnum.OutFinish || x.TaskState == (int)TaskOutStatusEnum.OutPending));
-                    //if (taskGW != null)
-                    //{
-                    //    command.ConveyorLineBarcode = taskGW.PalletCode;
-                    //}
-                    //}
-                    //濡傞珮娓╁嚭搴撳悗浠诲姟鏍囪NG寮傚父鍒欏皢浠诲姟鏇存柊涓哄紓甯告帓鍑轰换鍔�   --鍐犲畤鍙栨秷瓒呮椂妫�娴嬪悗  鎵樼洏瓒呮椂涓嶅湪鍑哄簱鑷冲紓甯稿彛
-                    //Dt_Task NGtask = _taskRepository.QueryFirst(x => x.Remark == "NG" && x.Roadway == stationManager.Roadway && x.Roadway.Contains("GW"));
-                    //if (NGtask != null)
-                    //{
-                    //    CreateAbNormalOutbound(conveyorLine, command, childDeviceCode, NGtask);
-                    //    break;
-                    //}
-
                     RequestWmsTask(conveyorLine, command, childDeviceCode, stationManager);
                     break;
             }
@@ -296,7 +231,9 @@
                 throw new InvalidOperationException("WMS IP 鏈厤缃�");
             }
             var wmsIpAddrss = wmsBase + requestTrayInTask;
+
             var result = HttpHelper.PostAsync(wmsIpAddrss, request.ToJsonString()).Result;
+
             if (result == null)
                 return new WMSTaskDTO();
 
@@ -315,7 +252,9 @@
             try
             {
                 if (command.ConveyorLineBarcode.IsNullOrEmpty()) return;
+
                 var content = await _taskService.RequestWMSTask(command.ConveyorLineBarcode, childDeviceCode);
+
                 if (content.Status)
                 {
                     var task = _taskService.QueryBarCodeConveyorLineTask(command.ConveyorLineBarcode, childDeviceCode);
@@ -332,7 +271,6 @@
                         }
 
                         ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
-                        //conveyorLine.SendCommand(taskCommand, childDeviceCode);
 
                         bool sendFlag = SendCommand(taskCommand, conveyorLine, childDeviceCode);
                         if (sendFlag)

--
Gitblit v1.9.3