From 4b43452bbdcae2dadc4543d0a4c836c2b89440fd Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com> Date: 星期日, 20 七月 2025 22:33:58 +0800 Subject: [PATCH] 增强日志记录和简化代码实现 --- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs index 22294eb..cc0a1e0 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs @@ -1,5 +1,6 @@ 锘縰sing Mapster; using Masuit.Tools; +using SixLabors.Fonts.Tables.AdvancedTypographic; using SqlSugar; using WIDESEA_Common.CustomModels; using WIDESEA_Core.Const; @@ -1076,6 +1077,7 @@ WebResponseContent content = new WebResponseContent(); try { + LogFactory.GetLog($"鍖呰璇锋眰鍑哄簱浠诲姟").Info(true, $"銆愯姹傚弬鏁般�戯細銆恵JsonConvert.SerializeObject(json)}銆憑Environment.NewLine}{Environment.NewLine}"); Dt_StationManager station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == json.Position && x.stationType == 12 && x.stationArea == "Call"); if (station == null) { throw new Exception($"鏈壘鍒板寘瑁呯珯鍙颁俊鎭紝璇锋鏌ヤ紶鍏ュ弬鏁皗json.Position}"); } @@ -1148,12 +1150,11 @@ SourceAddress = stockInfo.LocationCode, TaskState = (int)TaskOutStatusEnum.OutNew, TaskType = (int)TaskOutboundTypeEnum.Outbound, - TaskNum = await BaseDal.GetTaskNo(), + TaskNum = BaseDal.GetTaskNo().Result, Creater = "System", ProductionLine = stockInfo.ProductionLine, ProcessCode = stockInfo.ProcessCode, }; - WMSTaskDTO taskDTO = CreateTaskDTO(task); int lastStatus = locationInfo.LocationStatus; @@ -1166,11 +1167,15 @@ _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(stockInfo.LocationInfo, lastStatus, (int)StatusChangeTypeEnum.AutomaticDelivery, task.TaskNum); + LogFactory.GetLog($"鍖呰璇锋眰鍑哄簱浠诲姟").Info(true, $"銆愯繑鍥炲弬鏁般�戯細銆恵JsonConvert.SerializeObject(taskDTO)}銆憑Environment.NewLine}{Environment.NewLine}"); return content.OK(data: taskDTO); } catch (Exception ex) { Console.WriteLine($"CW3鑷冲寘瑁呭嚭搴撳紓甯�:{ex.ToString()}"); + + LogFactory.GetLog($"鍖呰璇锋眰鍑哄簱浠诲姟").Info(true, $"銆愬紓甯搞�戯細銆恵ex.Message}銆憑Environment.NewLine}銆恵ex.StackTrace}銆憑Environment.NewLine}{Environment.NewLine}"); + return content.Error($"澶辫触锛歿ex.Message}"); } } -- Gitblit v1.9.3