From 1842a682f843465dd488f6c8b9cc7635d0ad3b17 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期一, 18 八月 2025 08:33:08 +0800
Subject: [PATCH] 优化异常处理和日志记录功能

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CommonConveyorLine_CWJob.cs |   28 ++++++++--------------------
 1 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CommonConveyorLine_CWJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CommonConveyorLine_CWJob.cs
index ecb95db..6ee670c 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CommonConveyorLine_CWJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CommonConveyorLine_CWJob.cs
@@ -116,20 +116,11 @@
                     #endregion 绔欏彴鏂瑰紡
 
                     #region 璺敱鏂瑰紡
-
                     List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
-                    DateTime dateTime = DateTime.Now;
-                    Console.WriteLine($"寰幆寮�濮嬫椂闂磠dateTime}");
+                    
                     foreach (string childDeviceCode in childDeviceCodes)
                     {
-                        //Thread.Sleep(1000);
-                        //if (childCodeList.Contains(childDeviceCode))
-                        //{
-                        //    Console.WriteLine($"褰撳墠{childDeviceCode}鎵ц涓紝宸茶烦杩�");
-                        //    continue;
-                        //}
-                        //childCodeList.Add(childDeviceCode);
-                        //Console.WriteLine(childDeviceCode);
+                        
                         ConveyorLineTaskCommand_After command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand_After>(childDeviceCode);
 
                         if (command == null) continue;
@@ -164,7 +155,6 @@
                             }
                         }
 
-                        //childCodeList.Remove(childDeviceCode);
 
                         #region 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
 
@@ -187,20 +177,16 @@
                         #endregion 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
 
                     }
-                    DateTime ENDdateTime = DateTime.Now;
-                    Console.WriteLine($"寰幆缁撴潫鏃堕棿{ENDdateTime}");
 
                     #endregion 璺敱鏂瑰紡
                 }
             }
             catch (Exception ex)
             {
-                Console.Out.WriteLine(nameof(CommonConveyorLine_CWJob) + ":" + DateTime.Now + ":" + ex.ToString());
+                Console.Out.WriteLine(nameof(CommonConveyorLine_CWJob) + ":" + DateTime.Now + ":" + ex.ToString(),ex.StackTrace);
             }
             finally
             {
-                //WriteDebug("CommonConveyorLineJob", "test");
-                //Console.Out.WriteLine(DateTime.Now);
             }
             return Task.CompletedTask;
         }
@@ -556,12 +542,14 @@
                 }
                 var wmsIpAddress = wmsBase + requestTrayOutTask;
 
-                //var device = _deviceInfoRepository.QueryData(x => x.DeviceStatus == "1" && x.DeviceRemark == platform.Id.ToString());
-                //var deviceCode = device.Select(x => x.DeviceCode).ToList();
+                
                 List<string> strings = platform.Location.Split(',').ToList();
 
+                WriteInfo("璋冨害鎵ц鏃堕棿璁板綍", "銆愯皟鍙朩MS鍑哄簱鎺ュ彛寮�濮嬫椂闂达細銆�" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
+
                 var result = await HttpHelper.PostAsync(wmsIpAddress, new { Position = childDeviceCode, Tag = (int)taskType, AreaCdoe = platform.Stacker, AreaCdoes = strings, platform.ProductionLine }.Serialize());
-                //var result = await HttpHelper.PostAsync("http://localhost:5000/api/Task/RequestTrayOutTaskAsync", dynamic.ToJsonString());
+
+                WriteInfo("璋冨害鎵ц鏃堕棿璁板綍", "銆愯皟鍙朩MS鍑哄簱鎺ュ彛缁撴潫鏃堕棿锛氥��" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
 
                 WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
 

--
Gitblit v1.9.3