From 2cc749ec598c39f9172f9b989979f6218ec256b1 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <1247017146@qq.com>
Date: 星期四, 27 三月 2025 11:06:24 +0800
Subject: [PATCH] 1

---
 CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
index f8e5d93..c753604 100644
--- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
+++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -281,7 +281,8 @@
                                     command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
                                     // 璋冪敤澶勭悊鏂规硶
                                     method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform });
-                                };
+                                }
+                                ;
                             }
                         }
                     }
@@ -296,6 +297,7 @@
             }
             return Task.CompletedTask;
         }
+
         #region 鍏ュ簱
 
         /// <summary>
@@ -371,7 +373,7 @@
             }
         }
 
-        public string RequestInboundPlatform(string childDeviceCode,string productLine,bool IsTrayBarcode)
+        public string RequestInboundPlatform(string childDeviceCode, string productLine, bool IsTrayBarcode)
         {
             try
             {
@@ -383,16 +385,18 @@
                     IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == platform.PLCCode);
                     if (device != null)
                     {
+                        int x = 3;
                         CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
                         foreach (var item in Location)
                         {
+                            x--;
                             ConveyorLineTaskCommand command1 = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(item);
                             if (command1.InteractiveSignal != 2)
                             {
                                 var tasks = _taskRepository.QueryData(x => (x.TaskType == (int)TaskInboundTypeEnum.InTray || x.TaskType == (int)TaskOutboundTypeEnum.OutTray) && x.TargetAddress == childDeviceCode);
 
                                 // 濡傛灉宸叉湁浠诲姟鏁伴噺灏忎簬鎸囧畾绱㈠紩
-                                if (tasks.Count < Location.Count)
+                                if (tasks.Count < Location.Count && tasks.Count < x)
                                 {
                                     return childDeviceCode;
                                 }
@@ -420,7 +424,7 @@
             {
                 ConsoleHelper.WriteErrorLine($"鏂规硶RequestInboundPlatform锛歿ex.Message}");
             }
-            
+
             return null;
         }
 
@@ -432,20 +436,19 @@
         /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
         /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
         /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
-        public void RequestInNextAddress(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode,int ProtocalDetailValue)
+        public void RequestInNextAddress(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue)
         {
             var log = $"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣姹傚叆搴撲笅涓�鍦板潃";
             ConsoleHelper.WriteWarningLine(log);
 
             _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
             WriteInfo(conveyorLine.DeviceName, log);
-            if (childDeviceCode == "1279")
-            {
-                var stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == childDeviceCode && x.stationPLC == conveyorLine.DeviceCode);
-                CreateAndSendEmptyTrayTask(conveyorLine, command, childDeviceCode, ProtocalDetailValue, stationManager);
-            }
+            //if (childDeviceCode == "1279")
+            //{
+            //    var stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == childDeviceCode && x.stationPLC == conveyorLine.DeviceCode);
+            //    CreateAndSendEmptyTrayTask(conveyorLine, command, childDeviceCode, ProtocalDetailValue, stationManager);
+            //}
 
-            
             Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
             if (task != null)
             {
@@ -744,8 +747,8 @@
 
         #endregion 鍑哄簱
 
-
         #region 杈撻�佺嚎浜や簰瀹屾垚
+
         /// <summary>
         /// 杈撻�佺嚎浜や簰瀹屾垚
         /// </summary>
@@ -776,8 +779,8 @@
                 conveyorLine.Communicator.Write(DeviceProAddress, value);
             }
         }
-        #endregion
 
+        #endregion
 
         #region 妫�娴嬬┖鐩樺疄鐩樹换鍔�
 
@@ -961,8 +964,8 @@
 
         #endregion 璁惧NG鍙e叆搴�
 
-
         #region 杈撳嚭鏃ュ織
+
         public async Task LogAndWarn(string deviceName, string log, string color = "red")
         {
             ConsoleHelper.WriteWarningLine(log);
@@ -972,13 +975,11 @@
 
         #endregion
 
-
         private (ConveyorLineTaskCommand, ConveyorLineTaskCommandWrite) ReadCommands(Dt_StationManager station, CommonConveyorLine conveyorLine)
         {
             ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(station.stationChildCode);
             ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(station.stationChildCode, "DeviceCommand");
             return (command, commandWrite);
         }
-
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3