From e59d1777a111b6573b93afc58cca18c8c026ed9b Mon Sep 17 00:00:00 2001
From: 肖洋 <cathay_xy@163.com>
Date: 星期六, 04 一月 2025 09:57:43 +0800
Subject: [PATCH] 更新输送线目标地址和日志记录逻辑

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs                           |   17 ++++++++++++-----
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/HttpClient/HttpsClient.cs                                            |    2 ++
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/AgingInOrOutInput/AgingInOrOutInputService.cs |    4 ++--
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs                                  |   24 ++++++++++++++++++------
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs                           |    2 +-
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs                             |    2 +-
 6 files changed, 36 insertions(+), 15 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 433a120..674fe14 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -369,7 +369,7 @@
                 {
                     if (command.Barcode == task.PalletCode && childDeviceCode == task.NextAddress)
                     {
-                        //conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, "1000", childDeviceCode);
+                        conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, "1000", childDeviceCode);
 
                         ConsoleHelper.WriteWarningLine($"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎鍏ュ簱瀹屾垚,涓嬩竴鐩爣鍦板潃銆愮瓑寰呭垎閰嶈揣浣�,骞跺啓鍏�1000銆�");
 
@@ -572,7 +572,7 @@
                         // 鎵撳嵃鎴愬姛淇℃伅锛岃〃绀烘墭鐩樺凡鍒拌揪鎸囧畾杈撻�佺嚎骞跺畬鎴愬嚭搴擄紝涓嬩竴鐩爣鍦板潃宸茬‘瀹�
                         ConsoleHelper.WriteSuccessLine($"銆恵conveyorLine.DeviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎鍑哄簱瀹屾垚,涓嬩竴鐩爣鍦板潃銆恵NGAddress}銆�");
                         // 璁剧疆杈撻�佺嚎鐨勭洰鏍囧湴鍧�涓篘G鍦板潃
-                        conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, NGAddress, childDeviceCode);
+                        conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, NGAddress, childDeviceCode);
                         // 瀹屾垚杈撻�佺嚎鍙戦��
                         ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
                         // 鏇存柊浠诲姟鐘舵�佸埌涓嬩竴涓姸鎬�
@@ -742,22 +742,29 @@
 
             if (result1.Success)
             {
-                var serialNosError = result1.SerialNos.Where(x => x.SerialNoStatus != 1).ToList();
+                ConsoleHelper.WriteWarningLine("1");
+                var serialNosError = result1.SerialNos.Where(x => x.SerialNoStatus != 1 && x.SerialNoStatus != 4).ToList();
                 if (serialNosError.Count > 0)
                 {
+                    conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, 100, stationManager.stationChildCode);
+                    ConveyorLineSendFinish(conveyorLine, stationManager.stationChildCode, ProtocalDetailValue, true);
                     return;
                 }
 
                 if (result1.SerialNos.Count <= 0)
                 {
 
-                    conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, stationManager.stationLocation, stationManager.stationChildCode);
+                    ConsoleHelper.WriteWarningLine("2");
+                    ConsoleHelper.WriteWarningLine(stationManager.stationLocation);
+                    conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, stationManager.stationLocation, stationManager.stationChildCode);
 
                     ConveyorLineSendFinish(conveyorLine, stationManager.stationChildCode, ProtocalDetailValue, true);
                 }
                 else
                 {
-                    conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, 1000, stationManager.stationChildCode);
+                    ConsoleHelper.WriteWarningLine("1000");
+                    conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTaskNum, 5, stationManager.stationChildCode);
+                    conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, 1000, stationManager.stationChildCode);
 
                     ConveyorLineSendFinish(conveyorLine, stationManager.stationChildCode, ProtocalDetailValue, true);
                 }
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs
index c8cfb1b..67de370 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs
@@ -210,7 +210,7 @@
                 {
                     if (task.SourceAddress == "1059-4")
                     {
-                        //conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, "1000", childDeviceCode);
+                        conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, "1000", childDeviceCode);
 
                         ConsoleHelper.WriteWarningLine($"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵task.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵task.PalletCode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣姹傛壂鐮佸叆搴�(瀹炵洏),涓嬩竴鐩爣鍦板潃銆恵1000}銆�");
                         ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
index abafd03..5d8df1c 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -83,7 +83,7 @@
                                     var taskNum = commonStackerCrane.GetValue<StackerCraneDBName, int>(StackerCraneDBName.TaskNum);
                                     var taskBarCode = commonStackerCrane.GetValue<StackerCraneDBName, string>(StackerCraneDBName.Barcode);
                                     ConsoleHelper.WriteColorLine($"銆恵commonStackerCrane.DeviceName}銆戝爢鍨涙満浠诲姟鍙凤細銆恵taskNum}銆�,鍫嗗灈鏈烘墭鐩樺彿锛氥�恵taskBarCode}銆�,浠诲姟浠诲姟鍙凤細銆恵task.TaskNum}銆戜换鍔℃墭鐩樺彿锛氥�恵task.PalletCode}銆�", ConsoleColor.DarkBlue);
-                                    if (taskNum == 0 && taskBarCode != task.PalletCode)
+                                    if (taskNum == 0 /*&& taskBarCode != task.PalletCode*/)
                                     {
                                         ConsoleHelper.WriteColorLine($"銆恵commonStackerCrane.DeviceName}銆戜换鍔″彿涓恒�恵0}銆�,鎵樼洏鍙蜂笉涓�鑷村彲浠ヤ笅鍙戜换鍔�", ConsoleColor.DarkBlue);
                                         bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/HttpClient/HttpsClient.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/HttpClient/HttpsClient.cs
index 692d693..3a0a4af 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/HttpClient/HttpsClient.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/HttpClient/HttpsClient.cs
@@ -54,6 +54,8 @@
             // 灏嗗弬鏁拌浆鎹负FormUrlEncodedContent
             string content = JsonConvert.SerializeObject(parameters);
 
+            //client.Timeout = TimeSpan.from;
+
             var request = new HttpRequestMessage(HttpMethod.Post, url);
 
             request.Content = new StringContent(content, Encoding.UTF8, "application/json");
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/AgingInOrOutInput/AgingInOrOutInputService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/AgingInOrOutInput/AgingInOrOutInputService.cs
index 5b55915..9eb4f70 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/AgingInOrOutInput/AgingInOrOutInputService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/AgingInOrOutInput/AgingInOrOutInputService.cs
@@ -92,8 +92,8 @@
         catch (Exception err)
         {
             Console.WriteLine(err.Message.ToString());
-            LogFactory.GetLog("闈欑疆/闄堝寲鍑哄簱锛堟暣鎵樼洏锛�").Error(true, $"\r\r--------------------------------------");
-            LogFactory.GetLog("闈欑疆/闄堝寲鍑哄簱锛堟暣鎵樼洏)").Error(true, err.StackTrace);
+            LogFactory.GetLog("闈欑疆闄堝寲鍑哄簱锛堟暣鎵樼洏锛�").Error(true, $"\r\r--------------------------------------");
+            LogFactory.GetLog("闈欑疆闄堝寲鍑哄簱锛堟暣鎵樼洏锛�").Error(true, err.StackTrace);
             content.Error(err.Message);
         }
         return content;
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
index 6fe56dc..b8ee868 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -169,12 +169,19 @@
                         var agingOutputDto = MapToAgingOutputDto(stock);
                         content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto);
 
-                        var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString());
-                        task.Remark = result.Success ? null : "NG";
-
-                        if (!result.Success && result.MessageCode == "E10001")
+                        if (content.Status)
                         {
-                            await HandleOutBoundError(stock, task);
+                            var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString());
+                            task.Remark = result.Success ? null : "NG";
+
+                            if (!result.Success && result.MessageCode == "E10001")
+                            {
+                                await HandleOutBoundError(stock, task);
+                            }
+                        }
+                        else
+                        {
+                            task.Remark = "NG";
                         }
                     }
                 }
@@ -959,12 +966,17 @@
             // 鍒涘缓骞惰幏鍙栨暣鐩樼數鑺姸鎬�
             TrayCellsStatusDto trayCells = CreateTrayCellsStatusDto(area, input.PalletCode);
             content = await GetTrayCellStatusAsync(trayCells);
-            if (!content.Status) return content;
+            if (!content.Status)
+            {
+                ConsoleHelper.WriteErrorLine($"鑾峰彇鐢佃姱鐘舵�佸け璐�:{content.Message}");
+                return content;
+            }
 
             var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString());
 
             if (!result.Success)
             {
+                ConsoleHelper.WriteErrorLine($"鑾峰彇鐢佃姱鐘舵�佸け璐�:{result.MOMMessage}");
                 if (result.SerialNos.Count <= 0)
                 {
                     // 绌烘墭鐩樺叆搴撻�昏緫

--
Gitblit v1.9.3