From 011ca316e6ec2ed93e31c45a9ebd9d3c66664871 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期五, 17 四月 2026 11:47:03 +0800
Subject: [PATCH] 代码更新

---
 项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs |  286 ++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 190 insertions(+), 96 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 adae872..353bdab 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"
@@ -1,4 +1,4 @@
-锘�
+
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -59,6 +59,10 @@
                 {
                     return content.Error($"鐢熸垚浠诲姟澶辫触");
                 }
+                tasks.ForEach(x =>
+                {
+                    x.Grade = 1;
+                });
                 stockInfos.ForEach(x =>
                 {
                     x.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
@@ -219,7 +223,7 @@
                             }
                             if (outStockLockInfosMES != null && outStockLockInfosMES.Count() > 0)
                             {
-                                Dt_AGVStationInfo aGVStationInfo = _basicRepository.AGVStationInfoRepository.QueryFirst(x=>x.AGVStationCode==task.TargetAddress);
+                                Dt_AGVStationInfo aGVStationInfo = _basicRepository.AGVStationInfoRepository.QueryFirst(x=>x.AGVStationCode==task.TargetAddress || x.MESPointCode == task.TargetAddress);
                                 MESDeliveryModel mESDeliveryModel = MESDeliveryUp(outStockLockInfosMES, aGVStationInfo.MESPointCode);
                                 MESResponse response = _invokeMESService.MESDelivery(mESDeliveryModel).DeserializeObject<MESResponse>() ?? throw new Exception("鏈幏鍙栧埌杩斿洖淇℃伅");
                                 if (!response.Result)
@@ -391,8 +395,11 @@
                         taskType = outStockLockInfo.MachineName.ObjToInt() switch
                         {
                             (int)StationAreaEnum.浜屾ゼ绾歌 => TaskTypeEnum.PaperYLOutZDGL,
+                            (int)StationAreaEnum.浜屾ゼ鏃犵汉甯冭 => TaskTypeEnum.OutWFBGL,
+                            (int)StationAreaEnum.涓�妤兼棤绾烘穻鑶� => TaskTypeEnum.OutWFBLM,
                             (int)StationAreaEnum.涓�妤煎嵃鍒� => TaskTypeEnum.PrintYLOutbound,
                             (int)StationAreaEnum.涓�妤煎垎鍒� => TaskTypeEnum.OutFenQie,
+                            (int)StationAreaEnum.涓�妤肩焊寮犳穻鑶� => TaskTypeEnum.OutPaperLM,
                             _ => throw new Exception($"鏈壘鍒板姞宸ヤ腑蹇冧换鍔$被鍨嬪垎閰�")
                         };
                         Dt_Task task = new()
@@ -679,7 +686,7 @@
                 List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>();
                 List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>();
                 //鐢熸垚浠诲姟銆佸簱瀛樼瓑淇℃伅
-                (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutSGTaskDataHandle(keys);
+                (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?,string) result = OutSGTaskDataHandle(keys);
                 if (result.Item2 != null && result.Item2.Count > 0)
                 {
                     stockInfos.AddRange(result.Item2);
@@ -700,8 +707,9 @@
                 {
                     tasks.AddRange(result.Item1);
                 }
+                content.Message = result.Item6;
                 //澶勭悊鍑哄簱鏁版嵁
-                return GenerateOutboundTaskDataUpdate(tasks, stockInfos, outSGOrderDetails, outStockLockInfos, locationInfos);
+                return GenerateOutboundTaskDataUpdate(tasks, stockInfos, outSGOrderDetails, outStockLockInfos, locationInfos, result.Item6);
             }
             catch (Exception ex)
             {
@@ -717,7 +725,7 @@
         /// <param name="stockSelectViews"></param>
         /// <returns></returns>
         /// <exception cref="Exception"></exception>
-        public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) OutSGTaskDataHandle(int[] keys)
+        public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?,string) OutSGTaskDataHandle(int[] keys)
         {
             List<Dt_Task> tasks = new List<Dt_Task>();
             List<Dt_OutSGOrderDetail> outSGOrderDetails = _outboundRepository.OutSGOrderDetailRepository.QueryData(x => keys.Contains(x.Id));
@@ -737,7 +745,15 @@
             List<Dt_LocationInfo>? locationInfos = null;
 
             //鍒嗛厤搴撳瓨
-            (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutSGOrderDetailService.AssignStockOutbound(outSGOrderDetails);
+            (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>,string) result = _outboundService.OutSGOrderDetailService.AssignStockOutbound(outSGOrderDetails);
+            
+            //淇濆瓨缂烘枡鐘舵�侊紝鏃犺鏄惁鐢熸垚浜嗕换鍔�
+            var shortageDetails = result.Item2.Where(x => x.OutSGOrderDetailStatus == OutOrderStatusEnum.缂烘枡.ObjToInt()).ToList();
+            if (shortageDetails.Any())
+            {
+                _outboundRepository.OutSGOrderDetailRepository.UpdateData(shortageDetails);
+            }
+            
             if (result.Item1 != null && result.Item1.Count > 0)
             {
                 //鑾峰彇浠诲姟
@@ -768,16 +784,17 @@
             }
             else
             {
-                throw new Exception("鏃犲簱瀛�");
+                //娌℃湁搴撳瓨锛屼絾宸茬粡鍦ˋssignStockOutbound鏂规硶涓爣璁颁簡缂烘枡鐘舵�侊紝骞朵笖宸茬粡淇濆瓨
+                orderDetails = result.Item2;
             }
 
-            return (tasks, stockInfos, orderDetails, outStockLockInfos, locationInfos);
+            return (tasks, stockInfos, orderDetails, outStockLockInfos, locationInfos, result.Item5);
         }
         /// <summary>
         /// 澶勭悊鍑哄簱鏁版嵁
         /// </summary>
         /// <returns></returns>
-        public WebResponseContent GenerateOutboundTaskDataUpdate(List<Dt_Task> tasks, List<Dt_StockInfo>? stockInfos = null, List<Dt_OutSGOrderDetail>? outboundOrderDetails = null, List<Dt_OutStockLockInfo>? outStockLockInfos = null, List<Dt_LocationInfo>? locationInfos = null)
+        public WebResponseContent GenerateOutboundTaskDataUpdate(List<Dt_Task> tasks, List<Dt_StockInfo>? stockInfos = null, List<Dt_OutSGOrderDetail>? outboundOrderDetails = null, List<Dt_OutStockLockInfo>? outStockLockInfos = null, List<Dt_LocationInfo>? locationInfos = null, string message = "")
         {
             try
             {
@@ -787,8 +804,12 @@
                 {
                     tasks.ForEach(x =>
                     {
-                        string orderNos = string.Join(",", outStockLockInfos.Where(t => t.PalletCode == x.PalletCode).Select(x => x.OrderNo).Distinct());
+                        List<Dt_OutStockLockInfo> outStockNos = outStockLockInfos.Where(t => t.PalletCode == x.PalletCode).ToList();
+                        List<int> outDetailIds = outStockNos.Select(t => t.OrderDetailId).ToList();
+                        int numberNo = outboundOrderDetails.Where(t => outDetailIds.Contains(t.Id)).OrderBy(x => x.Number).FirstOrDefault().Number;
+                        string orderNos = string.Join(",", outStockNos.Select(t => t.OrderNo).Distinct());
                         x.OrderNo = orderNos;
+                        x.Grade = numberNo;
                     });
                 }
                 BaseDal.AddData(tasks);
@@ -817,7 +838,7 @@
                 }
                 _unitOfWorkManage.CommitTran();
                 PushTasksToWCS(tasks);
-                return WebResponseContent.Instance.OK();
+                return WebResponseContent.Instance.OK(message);
             }
             catch (Exception ex)
             {
@@ -881,23 +902,25 @@
                 #region 棰嗘枡閫昏緫
                 foreach (var item in stockInfos)
                 {
-                    if (item.StockStatus==StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt())
+                    if (item.StockStatus==StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt() || item.StockStatus == StockStatusEmun.鑰佸巶閫�鏂欐殏瀛�.ObjToInt())
                     {
                         item.StockLength = 0;
                         item.MaterielWeight = 0;
                         item.MaterielThickness = 0;
-                        item.MaterielWide = 0;
                         item.StockOutLength = 0;
                         item.IsFull = WhetherEnum.True.ObjToInt();
                         item.IsPick = WhetherEnum.True.ObjToInt();
                     }
                 }
                 #endregion
+                List<Dt_OutLineView> outLineViewsDel = _outboundRepository.OutLineViewRepository.QueryData(x => stockInfos.Select(x=>x.PalletCode).Contains(x.PalletCode));
+                //鏁版嵁搴撴搷浣�
                 _unitOfWorkManage.BeginTran();
                 _stockRepository.StockInfoRepository.UpdateData(stockInfos);
                 _outboundRepository.OutStockLockInfoRepository.UpdateData(outStockLockInfos);
                 _outboundRepository.OutSGOrderRepository.UpdateData(outSGOrders);
                 _outboundRepository.OutSGOrderDetailRepository.UpdateData(orderDetails);
+                _outboundRepository.OutLineViewRepository.DeleteData(outLineViewsDel);
                 _unitOfWorkManage.CommitTran();
                 content.OK(ExistNoCodes.Count>0 ? string.Join(",", ExistNoCodes)+"鑰佸巶鍙墸搴撳瓨涓嶅瓨鍦�" : "");
             }
@@ -928,6 +951,76 @@
                     reseponse[i] = ints[i];
                 }
                 content = CreateSGOutboundTasks(reseponse);
+            }
+            catch (Exception ex)
+            {
+                _unitOfWorkManage.RollbackTran();
+                content.Error(ex.Message);
+            }
+            return content;
+        }
+        /// <summary>
+        /// 鍒涘缓閿�鍞嚭搴�
+        /// </summary>
+        /// <param name="ids"></param>
+        /// <returns></returns>
+        public WebResponseContent CreateProDeliveryTasks(List<int> ids)
+        {
+            WebResponseContent content=new WebResponseContent();
+            try
+            {
+                ////鑾峰彇閿�鍞嚭搴撳崟鎹�
+                //List<Dt_ProDeliveryOrder> deliveryOrders = BaseDal.Db.Queryable<Dt_ProDeliveryOrder>().Where(x=> ids.Contains(x.Id)).Includes(x=>x.Details).ToList();
+                //Dt_ProDeliveryOrder? proDeliveryOrder = deliveryOrders.FirstOrDefault(x => x.ProDeliveryStatus != OutOrderStatusEnum.鏈紑濮�.ObjToInt());
+                //if (proDeliveryOrder != null)
+                //{
+                //    return content.Error($"鍗曞彿{proDeliveryOrder.DeliveryCode},璁㈠崟鐘舵�亄(OutOrderStatusEnum)proDeliveryOrder.ProDeliveryStatus}");
+                //}
+                //List<Dt_ProDeliveryOrderDetail> proDeliveryOrderDetails = deliveryOrders.SelectMany(x=>x.Details).ToList();
+                //if (!proDeliveryOrderDetails.Any())
+                //{
+                //    throw new Exception($"鏈壘鍒伴渶鍑哄簱鐨勬槑缁嗕俊鎭�");
+                //}
+                //_unitOfWorkManage.BeginTran();
+                //List<Dt_Task> tasks = new List<Dt_Task>();
+                //List<Dt_ProStockInfo>? stockInfos = null;
+                //List<Dt_ProDeliveryOrder>? Orders = null;
+                //List<Dt_ProDeliveryOrderDetail>? OrderDetails = null;
+                //List<Dt_OutStockLockInfo>? outStockLockInfos = null;
+                //List<Dt_LocationInfo>? locationInfos = null;
+                //{
+                //    //鍒嗛厤搴撳瓨
+                //    (List<Dt_ProStockInfo>, List<Dt_ProDeliveryOrder>, List<Dt_ProDeliveryOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.ProDeliveryOrderService.AssignProStockOutbound(deliveryOrders, proDeliveryOrderDetails);
+                //    if (result.Item1 != null && result.Item1.Count > 0)
+                //    {
+                //        //鍒涘缓浠诲姟
+                //        tasks = GetTasks(result.Item1, result.Item3);
+                //        result.Item3.ForEach(x =>
+                //        {
+                //            x.Status = OutLockStockStatusEnum.鍑哄簱涓�.ObjToInt();
+                //        });
+                //        stockInfos = result.Item1;
+                //        Orders = result.Item2;
+                //        outStockLockInfos = result.Item3;
+                //        locationInfos = result.Item4;
+                //    }
+                //}
+                //if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0 && tasks.Count > 0)
+                //{
+                //    BaseDal.AddData(tasks);
+                //    stockInfos.ForEach(x =>
+                //    {
+                //        x.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
+                //    });
+                //    WebResponseContent contentResponse = _outboundService.OutMESOrderService.LockOutboundStockDataUpdate(stockInfos, Orders, outStockLockInfos, locationInfos, tasks: tasks);
+
+                //    if (!contentResponse.Status)
+                //    {
+                //        _unitOfWorkManage.RollbackTran();
+                //        return content.Error(contentResponse.Message);
+                //    }
+                //}
+                //_unitOfWorkManage.CommitTran();
             }
             catch (Exception ex)
             {
@@ -1012,90 +1105,90 @@
                 _unitOfWorkManage.BeginTran();
                 //鎿嶄綔鏁版嵁锛屽苟鍒嗛厤闇�姹傚簱瀛�
                 _outboundRepository.OutMESOrderRepository.AddData(AddoutMESOrders);
-                //List<Dt_OutMESOrder> mESOrders = _outboundRepository.OutMESOrderRepository.QueryData(x => AddoutMESOrders.Select(x => x.OutDetailId).Contains(x.OutDetailId));
-                //{
-                //    List<Dt_Task> tasks = new List<Dt_Task>();
-                //    List<Dt_ProStockInfo>? stockInfos = null;
-                //    List<Dt_OutMESOrder>? Orders = null;
-                //    List<Dt_OutStockLockInfo>? outStockLockInfos = null;
-                //    List<Dt_LocationInfo>? locationInfos = null;
-                //    {
-                //        if (mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDFL.ObjToInt()).ToList().Count>0)
-                //        {
-                //            //鍒嗛厤搴撳瓨
-                //            (List<Dt_ProStockInfo>, List<Dt_OutMESOrder>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutMESOrderService.AssignProStockOutbound(mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDFL.ObjToInt()).ToList());
-                //            if (result.Item1 != null && result.Item1.Count > 0)
-                //            {
-                //                //鍒涘缓浠诲姟
-                //                tasks = GetTasks(result.Item1, result.Item3);
-                //                result.Item3.ForEach(x =>
-                //                {
-                //                    x.Status = OutLockStockStatusEnum.鍑哄簱涓�.ObjToInt();
-                //                });
-                //                stockInfos = result.Item1;
-                //                Orders = result.Item2;
-                //                outStockLockInfos = result.Item3;
-                //                locationInfos = result.Item4;
-                //            }
-                //        }
-                //    }
-                //    if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0 && tasks.Count>0)
-                //    {
-                //        BaseDal.AddData(tasks);
-                //        stockInfos.ForEach(x =>
-                //        {
-                //            x.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
-                //        });
-                //        WebResponseContent contentResponse = _outboundService.OutMESOrderService.LockOutboundStockDataUpdate(stockInfos, Orders, outStockLockInfos, locationInfos, tasks: tasks);
+                List<Dt_OutMESOrder> mESOrders = _outboundRepository.OutMESOrderRepository.QueryData(x => AddoutMESOrders.Select(x => x.OutDetailId).Contains(x.OutDetailId));
+                {
+                    List<Dt_Task> tasks = new List<Dt_Task>();
+                    List<Dt_ProStockInfo>? stockInfos = null;
+                    List<Dt_OutMESOrder>? Orders = null;
+                    List<Dt_OutStockLockInfo>? outStockLockInfos = null;
+                    List<Dt_LocationInfo>? locationInfos = null;
+                    {
+                        if (mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDFL.ObjToInt()).ToList().Count > 0)
+                        {
+                            //鍒嗛厤搴撳瓨
+                            (List<Dt_ProStockInfo>, List<Dt_OutMESOrder>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutMESOrderService.AssignProStockOutbound(mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDFL.ObjToInt()).ToList());
+                            if (result.Item1 != null && result.Item1.Count > 0)
+                            {
+                                //鍒涘缓浠诲姟
+                                tasks = GetTasks(result.Item1, result.Item3);
+                                result.Item3.ForEach(x =>
+                                {
+                                    x.Status = OutLockStockStatusEnum.鍑哄簱涓�.ObjToInt();
+                                });
+                                stockInfos = result.Item1;
+                                Orders = result.Item2;
+                                outStockLockInfos = result.Item3;
+                                locationInfos = result.Item4;
+                            }
+                        }
+                    }
+                    if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0 && tasks.Count > 0)
+                    {
+                        BaseDal.AddData(tasks);
+                        stockInfos.ForEach(x =>
+                        {
+                            x.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
+                        });
+                        WebResponseContent contentResponse = _outboundService.OutMESOrderService.LockOutboundStockDataUpdate(stockInfos, Orders, outStockLockInfos, locationInfos, tasks: tasks);
 
-                //        if (!contentResponse.Status)
-                //        {
-                //            _unitOfWorkManage.RollbackTran();
-                //            return content.Error(contentResponse.Message);
-                //        }
-                //    }
-                //}
-                //{
-                //    List<Dt_Task> tasks = new List<Dt_Task>();
-                //    List<Dt_StockInfo>? stockInfos = null;
-                //    List<Dt_OutMESOrder>? Orders = null;
-                //    List<Dt_OutStockLockInfo>? outStockLockInfos = null;
-                //    List<Dt_LocationInfo>? locationInfos = null;
-                //    {
-                //        if (mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDYL.ObjToInt()).ToList().Count > 0)
-                //        {
-                //            //鍒嗛厤搴撳瓨
-                //            (List<Dt_StockInfo>, List<Dt_OutMESOrder>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutMESOrderService.AssignStockOutbound(mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDYL.ObjToInt()).ToList());
-                //            if (result.Item1 != null && result.Item1.Count > 0)
-                //            {
-                //                //鍒涘缓浠诲姟
-                //                tasks = GetTasks(result.Item1, result.Item3);
-                //                result.Item3.ForEach(x =>
-                //                {
-                //                    x.Status = OutLockStockStatusEnum.鍑哄簱涓�.ObjToInt();
-                //                });
-                //                stockInfos = result.Item1;
-                //                Orders = result.Item2;
-                //                outStockLockInfos = result.Item3;
-                //                locationInfos = result.Item4;
-                //            }
-                //        }
-                //    }
-                //    if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0 && tasks.Count>0)
-                //    {
-                //        BaseDal.AddData(tasks);
-                //        stockInfos.ForEach(x =>
-                //        {
-                //            x.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
-                //        });
-                //        WebResponseContent contentResponse = _outboundService.OutMESOrderService.LockOutboundStockDataUpdate(stockInfos, Orders, outStockLockInfos, locationInfos, tasks: tasks);
-                //        if (!contentResponse.Status)
-                //        {
-                //            _unitOfWorkManage.RollbackTran();
-                //            return content.Error(contentResponse.Message);
-                //        }
-                //    }
-                //}
+                        if (!contentResponse.Status)
+                        {
+                            _unitOfWorkManage.RollbackTran();
+                            return content.Error(contentResponse.Message);
+                        }
+                    }
+                }
+                {
+                    List<Dt_Task> tasks = new List<Dt_Task>();
+                    List<Dt_StockInfo>? stockInfos = null;
+                    List<Dt_OutMESOrder>? Orders = null;
+                    List<Dt_OutStockLockInfo>? outStockLockInfos = null;
+                    List<Dt_LocationInfo>? locationInfos = null;
+                    {
+                        if (mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDYL.ObjToInt()).ToList().Count > 0)
+                        {
+                            //鍒嗛厤搴撳瓨
+                            (List<Dt_StockInfo>, List<Dt_OutMESOrder>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutMESOrderService.AssignStockOutbound(mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDYL.ObjToInt()).ToList());
+                            if (result.Item1 != null && result.Item1.Count > 0)
+                            {
+                                //鍒涘缓浠诲姟
+                                tasks = GetTasks(result.Item1, result.Item3);
+                                result.Item3.ForEach(x =>
+                                {
+                                    x.Status = OutLockStockStatusEnum.鍑哄簱涓�.ObjToInt();
+                                });
+                                stockInfos = result.Item1;
+                                Orders = result.Item2;
+                                outStockLockInfos = result.Item3;
+                                locationInfos = result.Item4;
+                            }
+                        }
+                    }
+                    if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0 && tasks.Count > 0)
+                    {
+                        BaseDal.AddData(tasks);
+                        stockInfos.ForEach(x =>
+                        {
+                            x.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
+                        });
+                        WebResponseContent contentResponse = _outboundService.OutMESOrderService.LockOutboundStockDataUpdate(stockInfos, Orders, outStockLockInfos, locationInfos, tasks: tasks);
+                        if (!contentResponse.Status)
+                        {
+                            _unitOfWorkManage.RollbackTran();
+                            return content.Error(contentResponse.Message);
+                        }
+                    }
+                }
                 _unitOfWorkManage.CommitTran();
                 return content.OK(ErrorMsg.IsNullOrEmpty()? "鎺ユ敹鎴愬姛" : $"淇℃伅锛歿ErrorMsg}");
             }
@@ -1153,6 +1246,7 @@
             }
             catch (Exception ex)
             {
+                _unitOfWorkManage.RollbackTran();
                 content.Error(ex.Message);
             }
             return content;

--
Gitblit v1.9.3