From edc7293bf81729ebaa2d7cdd9a1f3aeaf567f538 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期三, 31 十二月 2025 17:32:08 +0800
Subject: [PATCH] 更新

---
 项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
index 7e82669..2fad111 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
@@ -136,12 +136,32 @@
                     if (proStockInfo != null && proStockInfo.StockStatus==StockStatusEmun.鍑哄簱閿佸畾.ObjToInt())
                     {
                         task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
+                        //鑾峰彇鎵�鏈夊嚭搴撹鎯呮暟鎹�
+                        List<Dt_OutStockLockInfo>? outStockLockInfos = _outboundRepository.OutStockLockInfoRepository.QueryData(x => x.TaskNum == task.TaskNum);
                         _unitOfWorkManage.BeginTran();
                         proStockInfo.StockStatus = StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt();
                         _stockRepository.ProStockInfoRepository.DeleteAndMoveIntoHty(proStockInfo,App.User.UserId > 0 ? OperateTypeEnum.浜哄伐瀹屾垚 : OperateTypeEnum.鑷姩瀹屾垚);
                         if (proStockInfo.proStockInfoDetails!=null && proStockInfo.proStockInfoDetails.Count>0)
                         {
                             _stockRepository.ProStockInfoDetailRepository.DeleteAndMoveIntoHty(proStockInfo.proStockInfoDetails, App.User.UserId > 0 ? OperateTypeEnum.浜哄伐瀹屾垚 : OperateTypeEnum.鑷姩瀹屾垚);
+                        }
+                        if (outStockLockInfos != null && outStockLockInfos.Count > 0)
+                        {
+                            outStockLockInfos.ForEach(x =>
+                            {
+                                x.Status = OutLockStockStatusEnum.鍑哄簱瀹屾垚.ObjToInt();
+                            });
+                            List<Dt_OutStockLockInfo> outStockLockInfosMES = outStockLockInfos.Where(x => x.OrderType == OutOrderTypeEnum.OutMESPick.ObjToInt()).ToList();
+                            if (outStockLockInfosMES != null && outStockLockInfosMES.Count() > 0)
+                            {
+                                Dt_AGVStationInfo aGVStationInfo = _basicRepository.AGVStationInfoRepository.QueryFirst(x => x.AGVStationCode == task.TargetAddress);
+                                MESDeliveryModel mESDeliveryModel = MESDeliveryUp(outStockLockInfosMES, aGVStationInfo.MESPointCode);
+                                MESResponse response = _invokeMESService.MESDelivery(mESDeliveryModel).DeserializeObject<MESResponse>() ?? throw new Exception("鏈幏鍙栧埌杩斿洖淇℃伅");
+                                if (!response.Result)
+                                {
+                                    throw new Exception($"MES閰嶉�佸嚭鍙戞帴鍙h皟鐢ㄦ姤閿�,MES杩斿洖淇℃伅{DecodeUnicode(response.Msg)}");
+                                }
+                            }
                         }
                         _basicService.LocationInfoService.UpdateLocationStatus(locationInfoStart, proStockInfo.PalletType, LocationStatusEnum.Free, proStockInfo.WarehouseId);
                         BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.浜哄伐瀹屾垚 : OperateTypeEnum.鑷姩瀹屾垚);
@@ -1049,6 +1069,7 @@
             }
             catch (Exception ex)
             {
+                _unitOfWorkManage.RollbackTran();
                 content.Error(ex.Message);
             }
             return content;

--
Gitblit v1.9.3