From a0fdff7103fc0f394ed4c459c35eed3bc842ea07 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期三, 11 六月 2025 15:18:34 +0800
Subject: [PATCH] 更新 appsettings.json 配置项

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs |   40 +++++++++++++++++++++++++++++++---------
 1 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
index 099a9bb..22efbda 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -23,6 +23,7 @@
 using WIDESEAWCS_QuartzJob;
 using WIDESEAWCS_QuartzJob.DeviceBase;
 using WIDESEAWCS_QuartzJob.DTO;
+using WIDESEAWCS_QuartzJob.Models;
 using WIDESEAWCS_QuartzJob.Repository;
 using WIDESEAWCS_QuartzJob.Service;
 using WIDESEAWCS_SignalR;
@@ -77,7 +78,7 @@
                 CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams");
                 if (conveyorLine != null)
                 {
-                    ConsoleHelper.WriteColorLine("寮�濮嬶細" + DateTime.Now, ConsoleColor.Cyan);
+                    //ConsoleHelper.WriteColorLine("寮�濮嬶細" + DateTime.Now, ConsoleColor.Cyan);
                     // 鏌ヨ鎵�鏈夊瓙璁惧鐨勪綅缃�
                     List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
                     // 鑾峰彇鎵�鏈夌珯鐐圭鐞嗗櫒
@@ -185,7 +186,7 @@
 
                     await Task.WhenAll(tasks);
 
-                    ConsoleHelper.WriteColorLine("缁撴潫锛�" + DateTime.Now, ConsoleColor.Cyan);
+                    //ConsoleHelper.WriteColorLine("缁撴潫锛�" + DateTime.Now, ConsoleColor.Cyan);
                 }
             }
             catch (Exception ex)
@@ -257,7 +258,7 @@
                     }
 
                     // 鏌ヨ骞冲彴淇℃伅
-                    Platform platform = _platFormRepository.QueryFirst(x => x.PLCCode == conveyorLine.DeviceCode && x.PlatCode == childDeviceCode && x.Status == "Active");
+                    Platform platform = _platFormRepository.QueryFirst(x => x.DeviceCode == conveyorLine.DeviceCode && x.PlatCode == childDeviceCode && x.Status == "Active");
                     if (platform != null && !string.IsNullOrEmpty(platform.Location))
                     {
                         var strings = platform.Location.Split(',').ToList();
@@ -381,7 +382,8 @@
             _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
             WriteInfo(conveyorLine.DeviceName, log);
 
-            Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+            //Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+            Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode, command.Barcode);
             if (task != null)
             {
                 if (command.Barcode == task.PalletCode)
@@ -402,6 +404,7 @@
                         WriteInfo(conveyorLine.DeviceName, logs);
 
                         conveyorLine.SendCommand(taskCommand, childDeviceCode);
+                        _taskService.UpdateData(newTask);
                     }
                 }
             }
@@ -426,7 +429,8 @@
                 _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
                 WriteInfo(conveyorLine.DeviceName, log);
 
-                var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+                //var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+                var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode, command.Barcode);
                 if (task != null && task.TaskState != (int)TaskInStatusEnum.Line_InFinish)
                 {
                     if (command.Barcode == task.PalletCode && childDeviceCode == task.NextAddress)
@@ -548,7 +552,8 @@
             WriteInfo(conveyorLine.DeviceName, log);
 
             // 鏌ヨ姝e湪鎵ц鐨勮緭閫佺嚎浠诲姟锛屾牴鎹换鍔″彿鍜屽瓙璁惧浠g爜鑾峰彇浠诲姟淇℃伅
-            Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+            //Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+            Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode, command.Barcode);
 
             // 濡傛灉浠诲姟瀛樺湪
             if (task != null)
@@ -583,6 +588,8 @@
 
                         // 鏍囪杈撻�佺嚎鍙戦�佷换鍔″畬鎴�
                         ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+
+                        _taskService.UpdateData(newTask);
                     }
                 }
             }
@@ -606,7 +613,8 @@
                 WriteInfo(conveyorLine.DeviceName, logs);
 
                 // 鏌ヨ姝e湪鎵ц鐨勮緭閫佺嚎浠诲姟
-                var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+                //var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+                var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode, command.Barcode);
 
                 // 濡傛灉浠诲姟瀛樺湪
                 if (task != null)
@@ -768,13 +776,26 @@
                 }
                 var wmsIpAddress = wmsBase + requestTrayOutTask;
 
-                var device = _deviceInfoRepository.QueryData(x => x.DeviceStatus == "1" && x.DeviceRemark == platform.Id.ToString());
+                
+                List<Dt_DeviceInfo> device;
+                if (platform.Roadway != null)
+                {
+                    List<string> strings = platform.Roadway.Split(',').ToList();
+                    device = _deviceInfoRepository.QueryData(x => x.DeviceStatus == "1" && strings.Contains(x.DeviceCode));
+                }
+                else
+                {
+                    device = _deviceInfoRepository.QueryData(x => x.DeviceStatus == "1");
+                }
                 var deviceCode = device.Select(x => x.DeviceCode).ToList();
 
                 // 鍙戦�丠TTP POST璇锋眰鑾峰彇浠诲姟鏁版嵁
                 var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = platform.Stacker, AreaCdoes = deviceCode, platform.ProductionLine }.ToJsonString());
                 // 瑙f瀽杩斿洖鐨凧SON鏁版嵁
                 WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
+
+
+                Console.WriteLine($"{JsonConvert.SerializeObject(content)}鍛煎彨鎴愬姛");
 
                 // 妫�鏌ヨ繑鍥炵姸鎬侊紝濡傛灉澶辫触鍒欒繑鍥�
                 if (!content.Status)
@@ -784,6 +805,7 @@
                 taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
 
                 #endregion 璋冪敤WMS鑾峰彇鍑哄簱浠诲姟
+
 
                 // 鍒涘缓骞跺彂閫佷换鍔�
                 CreateAndSendTask(taskDTO);
@@ -798,7 +820,7 @@
             var content = _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
             if (content.Status)
             {
-                Console.WriteLine($"{taskDTO.TaskType}鍛煎彨鎴愬姛");
+                Console.WriteLine($"{taskDTO.TargetAddress}鍛煎彨鎴愬姛");
             }
             return content;
         }

--
Gitblit v1.9.3