From 68dbe298a5c67d8755cb4379e5106de7c54608c6 Mon Sep 17 00:00:00 2001
From: 肖洋 <cathay_xy@163.com>
Date: 星期三, 11 十二月 2024 14:39:03 +0800
Subject: [PATCH] 添加childDeviceCode至多个任务类,优化代码逻辑

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs |   32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs
index 0791aca..49d4563 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs
@@ -11,9 +11,9 @@
 using WIDESEAWCS_Model.Models;
 using WIDESEAWCS_QuartzJob;
 using WIDESEAWCS_Tasks.ConveyorLineJob;
-using HslCommunication;
 using WIDESEAWCS_DTO.WMS;
 using WIDESEAWCS_Common;
+using Masuit.Tools;
 
 namespace WIDESEAWCS_Tasks
 {
@@ -72,6 +72,7 @@
                     }
                     break;
                 case 1:
+                case 6:
                 case 10:
                     ExecuteStationAction(stationManager, conveyorLine, command, childDeviceCode);
                     break;
@@ -155,15 +156,18 @@
                 case 12:
                     ConveyorLineOutFinish(conveyorLine, command, childDeviceCode);
                     break;
+                case 6:
+                    CreateAndSendEmptyTrayTask(conveyorLine, command, childDeviceCode);
+                    break;
                 case 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;
-                        }
-                    }
+                    //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;
+                    //    }
+                    //}
                     RequestWmsTask(conveyorLine, command, childDeviceCode);
                     break;
             }
@@ -277,9 +281,10 @@
         /// </summary>
         private async void RequestWmsTask(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
         {
-            var taskGW = _taskRepository.QueryFirst(x => x.TargetAddress == childDeviceCode && x.TaskState == (int)TaskOutStatusEnum.OutFinish);
-            if (taskGW != null)
-                _taskRepository.DeleteData(taskGW);
+            //var taskGW = _taskRepository.QueryFirst(x => x.TargetAddress == childDeviceCode && (x.TaskState == (int)TaskOutStatusEnum.OutFinish || x.TaskState == (int)TaskOutStatusEnum.OutPending));
+            //if (taskGW != null)
+            //    _taskRepository.DeleteData(taskGW);
+            if (command.ConveyorLineBarcode.IsNullOrEmpty()) return;
             var content = await _taskService.RequestWMSTask(command.ConveyorLineBarcode, childDeviceCode);
             if (content.Status)
             {
@@ -299,7 +304,8 @@
             else
             {
                 WriteInfo(conveyorLine.DeviceName, content.Message);
-                _taskRepository.AddData(taskGW);
+                ConsoleHelper.WriteErrorLine($"銆恵conveyorLine.DeviceName}銆戞墭鐩樺彿锛氥�恵command.ConveyorLineBarcode}銆戣姹傜偣浣嶏細銆恵childDeviceCode}銆戝紓甯镐俊鎭�恵content.Message}銆�");
+                //_taskRepository.AddData(taskGW);
             }
         }
     }

--
Gitblit v1.9.3