From a2f948006c6c7e918ba4f2e66d477cc2d5017a75 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期三, 10 十二月 2025 21:49:58 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhongRui/ALDbanyunxiangmu

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs |   58 ++++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 42 insertions(+), 16 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index 80aec45..03574dc 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -297,10 +297,17 @@
             {
                 await Db.Deleteable(task).ExecuteCommandAsync();
             }
-            _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
-
-            _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) + beforeQuantity, WIDESEA_Common.StockEnum.StockChangeType.MaterielGroup);
             try
+            {
+                _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
+
+                _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) + beforeQuantity, WIDESEA_Common.StockEnum.StockChangeType.MaterielGroup);
+            }
+            catch(Exception ex)
+            {
+                _logger.LogInformation($"InboundTaskCompleted AddLocationStatusChangeRecord : {ex.Message} " );
+            }
+                try
             {
                 foreach (var inboundOrder in inboundOrders)
                 {
@@ -568,8 +575,14 @@
                 {
                     await Db.Deleteable(task).ExecuteCommandAsync();
                 }
-                _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforelocationStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
-
+                try
+                {
+                    _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforelocationStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
+                }
+                catch(Exception ex)
+                {
+                    _logger.LogInformation($"InEmptyTaskCompleted AddLocationStatusChangeRecord : {ex.Message} ");
+                }
 
                 if (outboundOrder != null)
                 {
@@ -683,16 +696,23 @@
                 {
                     await Db.Deleteable(task).ExecuteCommandAsync();
                 }
-                // 璁板綍璐т綅鐘舵�佸彉鏇�
-                _locationStatusChangeRecordService.AddLocationStatusChangeRecord(
-                    locationInfo,
-                    beforelocationStatus,
-                    StockChangeType.Inbound.ObjToInt(),
-                    "",
-                    task.TaskNum
-                );
+             
                 await RecalculateOrderStatus(task.OrderNo);
-
+                try
+                {
+                    // 璁板綍璐т綅鐘舵�佸彉鏇�
+                    _locationStatusChangeRecordService.AddLocationStatusChangeRecord(
+                        locationInfo,
+                        beforelocationStatus,
+                        StockChangeType.Inbound.ObjToInt(),
+                        "",
+                        task.TaskNum
+                    );
+                }
+                catch (Exception ex)
+                {
+                    _logger.LogInformation($"InPickTaskCompleted AddLocationStatusChangeRecord : {ex.Message} ");
+                }
 
                 _logger.LogInformation($"鎵樼洏鍥炲簱瀹屾垚澶勭悊鎴愬姛 - 浠诲姟鍙�: {task.TaskNum}, 鎵樼洏: {task.PalletCode}, 璁㈠崟: {task.OrderNo}");
                 _ = Task.Run(async () =>
@@ -1284,8 +1304,14 @@
                     _stockRepository.Db.Deleteable(stockInfo).ExecuteCommand();
                 }
                 _stockService.StockInfoService.DeleteData(stockInfo);
-                _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum);
-
+                try
+                {
+                    _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo?.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum);
+                }
+                catch (Exception ex)
+                {
+                    _logger.LogError($"TaskService OutEmptyTaskCompleted AddLocationStatusChangeRecord:  {ex.Message} ");
+                }
                 return await Task.FromResult(WebResponseContent.Instance.OK());
 
             }

--
Gitblit v1.9.3