From f54b7815d8451f362554e3d2d09b4991ce13d4ff Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期三, 12 十一月 2025 09:01:16 +0800
Subject: [PATCH] 前端优化,PDA更新,分配库存优化

---
 项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs |  226 +++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 156 insertions(+), 70 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 23c0dea..8a462a4 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"
@@ -47,7 +47,7 @@
                     return content.Error($"鏈壘鍒板簱瀛�");
                 }
                 //鑾峰彇搴撳瓨璐т綅
-                List<Dt_LocationInfo> locationInfos = _basicRepository.LocationInfoRepository.QueryData(x =>x.WarehouseId == WarehouseEnum.LLDYL.ObjToInt() && stockInfos.Select(x=>x.LocationCode).Contains(x.LocationCode) && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()));
+                List<Dt_LocationInfo> locationInfos = _basicRepository.LocationInfoRepository.QueryData(x =>x.WarehouseId == WarehouseEnum.LLDYL.ObjToInt() && stockInfos.Select(x=>x.LocationCode).Contains(x.LocationCode) && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt());
                 if (locationInfos == null || locationInfos.Count != stockInfos.Count)
                 {
                     return content.Error($"璐т綅鍑哄簱鏉′欢涓嶆弧瓒�");
@@ -100,7 +100,7 @@
                 {
                     return WebResponseContent.Instance.OK(data: task.TargetAddress);
                 }
-                Dt_AGVStationInfo? aGVStationInfo = _basicRepository.AGVStationInfoRepository.QueryData(x => x.StationArea == nameof(AGVStationAreaEnum.涓�妤兼湀鍙扮爜澶�) && x.IsOccupied == WhetherEnum.False.ObjToInt()).OrderByDescending(x => x.Depth).FirstOrDefault();
+                Dt_AGVStationInfo? aGVStationInfo = _basicRepository.AGVStationInfoRepository.QueryData(x => x.StationArea == nameof(StationAreaEnum.涓�妤兼湀鍙扮爜澶�) && x.IsOccupied == WhetherEnum.False.ObjToInt()).OrderByDescending(x => x.Depth).FirstOrDefault();
                 if (aGVStationInfo==null)
                 {
                     return content.Error("鏈壘鍒板彲鍒嗛厤鐨勫嚭搴撶珯鐐�");
@@ -120,6 +120,7 @@
         /// </summary>
         public WebResponseContent OutboundTaskCompleted(Dt_Task task)
         {
+            WebResponseContent content = new WebResponseContent();
             try
             {
                 Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == task.WarehouseId);
@@ -128,7 +129,7 @@
                     Dt_LocationInfo locationInfoStart = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress);
                     if (locationInfoStart == null)
                     {
-                        return WebResponseContent.Instance.Error($"鏈壘鍒板搴旂殑璧风偣璐т綅淇℃伅");
+                        return content.Error($"鏈壘鍒板搴旂殑璧风偣璐т綅淇℃伅");
                     }
                     Dt_ProStockInfo proStockInfo = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo>().Where(x => x.PalletCode == task.PalletCode).Includes(x=>x.proStockInfoDetails).First();
                     if (proStockInfo != null && proStockInfo.StockStatus==StockStatusEmun.鍑哄簱閿佸畾.ObjToInt())
@@ -147,7 +148,7 @@
                     }
                     else
                     {
-                        return WebResponseContent.Instance.Error($"鏈壘鍒板搴斿簱瀛樹俊鎭�");
+                        return content.Error($"鏈壘鍒板搴斿簱瀛樹俊鎭�");
                     }
                 }
                 else//鍘熸枡搴撳畬鎴�
@@ -155,12 +156,18 @@
                     Dt_LocationInfo locationInfoStart = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress);
                     if (locationInfoStart == null)
                     {
-                        return WebResponseContent.Instance.Error($"鏈壘鍒板搴旂殑璧风偣璐т綅淇℃伅");
+                        return content.Error($"鏈壘鍒板搴旂殑璧风偣璐т綅淇℃伅");
+                    }
+                    if (locationInfoStart.LocationStatus!=LocationStatusEnum.Lock.ObjToInt())
+                    {
+                        return content.Error($"璐т綅鐘舵�佷笉姝g‘");
                     }
                     Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == task.PalletCode);
                     if (stockInfo != null && stockInfo.StockStatus == StockStatusEmun.鍑哄簱閿佸畾.ObjToInt())
                     {
                         task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
+                        //鑾峰彇鎵�鏈夊嚭搴撹鎯呮暟鎹�
+                        List<Dt_OutStockLockInfo>? outStockLockInfos = _outboundRepository.OutStockLockInfoRepository.QueryData(x=>x.TaskNum==task.TaskNum);
                         _unitOfWorkManage.BeginTran();
                         //澶勭悊搴撳瓨鏁版嵁
                         if (task.TaskType == TaskTypeEnum.OldYLOutbound.ObjToInt())
@@ -175,21 +182,29 @@
                             stockInfo.StockStatus = StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt();
                             _stockRepository.StockInfoRepository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId > 0 ? WIDESEA_Core.Enums.OperateTypeEnum.浜哄伐瀹屾垚 : WIDESEA_Core.Enums.OperateTypeEnum.鑷姩瀹屾垚);
                         }
+                        if (outStockLockInfos!=null && outStockLockInfos.Count>0)
+                        {
+                            outStockLockInfos.ForEach(x =>
+                            {
+                                x.Status=OutLockStockStatusEnum.鍑哄簱瀹屾垚.ObjToInt();
+                            });
+                            _outboundRepository.OutStockLockInfoRepository.UpdateData(outStockLockInfos);
+                        }
                         _basicService.LocationInfoService.UpdateLocationStatus(locationInfoStart, stockInfo.PalletType, LocationStatusEnum.Free, stockInfo.WarehouseId);
                         BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? WIDESEA_Core.Enums.OperateTypeEnum.浜哄伐瀹屾垚 : WIDESEA_Core.Enums.OperateTypeEnum.鑷姩瀹屾垚);
                         _unitOfWorkManage.CommitTran();
                     }
                     else
                     {
-                        return WebResponseContent.Instance.Error($"鏈壘鍒板搴斿簱瀛樹俊鎭�");
+                        return content.Error($"鏈壘鍒板搴斿簱瀛樹俊鎭�");
                     }
                 }
-                return WebResponseContent.Instance.OK();
+                return content.OK();
             }
             catch (Exception ex)
             {
                 _unitOfWorkManage.RollbackTran();
-                return WebResponseContent.Instance.Error(ex.Message);
+                return content.Error(ex.Message);
             }
         }
         /// <summary>
@@ -228,6 +243,59 @@
                             Quantity = stockInfo.StockLength,
                         };
                         if (stockInfo.MaterielWide>0)
+                        {
+                            task.TaskLength = (int)stockInfo.MaterielWide;
+                        }
+                        tasks.Add(task);
+                    }
+                }
+            }
+            return tasks;
+        }
+        /// <summary>
+        /// 搴撳瓨鏁版嵁杞嚭搴撲换鍔�(MES宸ュ崟)
+        /// </summary>
+        /// <param name="stockInfos"></param>
+        /// <returns></returns>
+        public List<Dt_Task> GetTasks(List<Dt_StockInfo> stockInfos,List<Dt_OutStockLockInfo> outStockLockInfos, TaskTypeEnum taskType)
+        {
+            List<Dt_Task> tasks = new List<Dt_Task>();
+            for (int i = 0; i < stockInfos.Count; i++)
+            {
+                Dt_StockInfo stockInfo = stockInfos[i];
+
+                if (stockInfo != null)
+                {
+                    Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode);
+                    if (!tasks.Exists(x => x.PalletCode == stockInfo.PalletCode))
+                    {
+                        Dt_OutStockLockInfo outStockLockInfo = outStockLockInfos.FirstOrDefault(x => x.PalletCode == stockInfo.PalletCode);
+                        taskType = outStockLockInfo.MachineName.ObjToInt() switch
+                        {
+                            (int)StationAreaEnum.浜屾ゼ绾歌 => TaskTypeEnum.PaperYLOutZDGL,
+                            (int)StationAreaEnum.涓�妤煎嵃鍒� => TaskTypeEnum.PrintYLOutbound,
+                            _ => throw new Exception($"鏈壘鍒板姞宸ヤ腑蹇冧换鍔$被鍨嬪垎閰�")
+                        };
+                        Dt_Task task = new()
+                        {
+                            CurrentAddress = stockInfo.LocationCode,
+                            Grade = 0,
+                            PalletCode = stockInfo.PalletCode,
+                            NextAddress = "",
+                            Roadway = locationInfo.RoadwayNo,
+                            SourceAddress = stockInfo.LocationCode,
+                            TargetAddress = "",
+                            TaskStatus = TaskStatusEnum.CallPending.ObjToInt(),
+                            TaskType = taskType.ObjToInt(),
+                            TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+                            PalletType = stockInfo.PalletType,
+                            WarehouseId = stockInfo.WarehouseId,
+                            MaterielCode = stockInfo.MaterielCode,
+                            RfidCode = stockInfo.RfidCode,
+                            Quantity = stockInfo.StockLength,
+                            OrderNo= outStockLockInfo.OrderNo
+                        };
+                        if (stockInfo.MaterielWide > 0)
                         {
                             task.TaskLength = (int)stockInfo.MaterielWide;
                         }
@@ -286,11 +354,11 @@
             {
                 List<Dt_AGVStationInfo> aGVStationInfos = _basicRepository.AGVStationInfoRepository.QueryData(x=>x.StationArea == targetId && x.IsOccupied==WhetherEnum.False.ObjToInt());
                 int useCount=aGVStationInfos.Count;
-                if (targetId == nameof(AGVStationAreaEnum.涓�妤兼湀鍙扮爜澶�))
+                if (targetId == nameof(StationAreaEnum.涓�妤兼湀鍙扮爜澶�))
                 {
 
                     //鑾峰彇鎵�鏈夋湀鍙板嚭搴撲换鍔�
-                    List<Dt_Task> _TasksOut = BaseDal.QueryData(x => x.TaskType == TaskTypeEnum.OutProduct.ObjToInt() && x.TargetAddress == nameof(AGVStationAreaEnum.涓�妤兼湀鍙扮爜澶�));
+                    List<Dt_Task> _TasksOut = BaseDal.QueryData(x => x.TaskType == TaskTypeEnum.OutProduct.ObjToInt() && x.TargetAddress == nameof(StationAreaEnum.涓�妤兼湀鍙扮爜澶�));
                     if (_TasksOut.Count>0)
                     {
                         useCount -= _TasksOut.Count;
@@ -301,7 +369,7 @@
                     return content.Error($"鍙敤缂撳瓨鏁颁笉瓒�");
                 }
                 //鑾峰彇璐т綅
-                List<Dt_LocationInfo> locationInfos = _basicRepository.LocationInfoRepository.QueryData(x => x.WarehouseId == WarehouseEnum.LLDCP.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt());
+                List<Dt_LocationInfo> locationInfos = _basicRepository.LocationInfoRepository.QueryData(x => x.WarehouseId == WarehouseEnum.LLDCP.ObjToInt() && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt());
                 List<Dt_ProStockInfo> stockInfos = new List<Dt_ProStockInfo>();
                 if (materialCode=="1")
                 {
@@ -332,16 +400,16 @@
                 }
                 TaskTypeEnum typeEnum = targetId switch
                 {
-                    nameof(AGVStationAreaEnum.涓�妤兼湀鍙扮爜澶�) => TaskTypeEnum.OutProduct,
-                    nameof(AGVStationAreaEnum.涓�妤兼棤绾虹粐甯�) => TaskTypeEnum.OutWFB,
-                    nameof(AGVStationAreaEnum.涓�妤兼棤绾烘穻鑶�) => TaskTypeEnum.OutWFBLM,
-                    nameof(AGVStationAreaEnum.涓�妤肩焊寮犳穻鑶�) => TaskTypeEnum.OutPaperLM,
-                    nameof(AGVStationAreaEnum.涓�妤煎垎鍒�) => TaskTypeEnum.OutFenQie,
-                    nameof(AGVStationAreaEnum.涓�妤兼ā鍒�) => TaskTypeEnum.OutMoQie,
-                    nameof(AGVStationAreaEnum.涓�妤煎啿鍒�) => TaskTypeEnum.OutChongQie,
-                    nameof(AGVStationAreaEnum.浜屾ゼ绾歌) or 
-                    nameof(AGVStationAreaEnum.浜屾ゼ鏃犵汉甯冭) or 
-                    nameof(AGVStationAreaEnum.浜屾ゼ绾告澂) => TaskTypeEnum.OutCarton,
+                    nameof(StationAreaEnum.涓�妤兼湀鍙扮爜澶�) => TaskTypeEnum.OutProduct,
+                    nameof(StationAreaEnum.涓�妤兼棤绾虹粐甯�) => TaskTypeEnum.OutWFB,
+                    nameof(StationAreaEnum.涓�妤兼棤绾烘穻鑶�) => TaskTypeEnum.OutWFBLM,
+                    nameof(StationAreaEnum.涓�妤肩焊寮犳穻鑶�) => TaskTypeEnum.OutPaperLM,
+                    nameof(StationAreaEnum.涓�妤煎垎鍒�) => TaskTypeEnum.OutFenQie,
+                    nameof(StationAreaEnum.涓�妤兼ā鍒�) => TaskTypeEnum.OutMoQie,
+                    nameof(StationAreaEnum.涓�妤煎啿鍒�) => TaskTypeEnum.OutChongQie,
+                    nameof(StationAreaEnum.浜屾ゼ绾歌) or 
+                    nameof(StationAreaEnum.浜屾ゼ鏃犵汉甯冭) or 
+                    nameof(StationAreaEnum.浜屾ゼ绾告澂) => TaskTypeEnum.OutCarton,
                     _ => throw new Exception("鏈壘鍒板搴斾换鍔�")
                 };
                 if (materialCode == "1" && typeEnum!= TaskTypeEnum.OutCarton)
@@ -354,7 +422,7 @@
                     return content.Error($"鐢熸垚浠诲姟澶辫触");
                 }
                 //鏈堝彴浠诲姟涓嶇洿鎺ュ垎閰嶇粓鐐�
-                if (targetId != nameof(AGVStationAreaEnum.涓�妤兼湀鍙扮爜澶�))
+                if (targetId != nameof(StationAreaEnum.涓�妤兼湀鍙扮爜澶�))
                 {
                     for (int i = 0; i < tasks.Count; i++)
                     {
@@ -366,7 +434,7 @@
                 {
                     for (int i = 0; i < tasks.Count; i++)
                     {
-                        tasks[i].TargetAddress = nameof(AGVStationAreaEnum.涓�妤兼湀鍙扮爜澶�);
+                        tasks[i].TargetAddress = nameof(StationAreaEnum.涓�妤兼湀鍙扮爜澶�);
                     }
                 }
                 //鍒ゆ柇鏄惁鏈夊嚭搴撳崟淇℃伅
@@ -408,9 +476,9 @@
                     return content.Error("璇峰~鍏ュ嚭搴撲俊鎭�");
                 }
                 //鑾峰彇璐т綅
-                List<Dt_LocationInfo> locationInfos = _basicRepository.LocationInfoRepository.QueryData(x => x.WarehouseId == WarehouseEnum.LLDYL.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt());
+                List<Dt_LocationInfo> locationInfos = _basicRepository.LocationInfoRepository.QueryData(x => x.WarehouseId == WarehouseEnum.LLDYL.ObjToInt() && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt());
                 //鑾峰彇瀵瑰簲搴撳瓨
-                List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.QueryData(x => locationInfos.Select(x => x.LocationCode).Contains(x.LocationCode) && x.MaterielCode == yLWMSTaskOutDTO.MaterialCode && x.MaterielWide == yLWMSTaskOutDTO.Wide && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() && x.MaterielInvOrgId == MaterielInvOrgEnum.鏂板巶.ObjToInt()).OrderBy(x => x.CreateDate).Take(yLWMSTaskOutDTO.Count).ToList();
+                List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.QueryData(x => locationInfos.Select(x => x.LocationCode).Contains(x.LocationCode) && x.MaterielCode == yLWMSTaskOutDTO.MaterialCode && x.MaterielWide == yLWMSTaskOutDTO.Wide && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() && x.MaterielInvOrgId == MaterielInvOrgEnum.鏂板巶.ObjToInt()).OrderByDescending(x => x.CreateDate).Take(yLWMSTaskOutDTO.Count).ToList();
                 if (stockInfos.Count< yLWMSTaskOutDTO.Count)
                 {
                     return content.Error($"搴撳瓨{yLWMSTaskOutDTO.MaterialCode}鏁伴噺涓嶈冻");
@@ -432,10 +500,21 @@
                 }
                 if (!string.IsNullOrEmpty(yLWMSTaskOutDTO.Address))
                 {
-                    tasks.ForEach(x =>
+                    if (yLWMSTaskOutDTO.Address=="1")
                     {
-                        x.TargetAddress= yLWMSTaskOutDTO.Address;
-                    });
+                        tasks.ForEach(x =>
+                        {
+                            x.TargetAddress = "PNT_1_363";
+                        });
+                    }
+                    else
+                    {
+                        tasks.ForEach(x =>
+                        {
+                            x.TargetAddress = yLWMSTaskOutDTO.Address;
+                        });
+                    }
+                    
                 }
                 else
                 {
@@ -630,7 +709,8 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
-
+                //鑾峰彇鎵�鏈夊緟棰嗘枡鐨勫嚭搴撹鎯�
+                List<Dt_OutStockLockInfo> outStockLockInfos = _outboundRepository.OutStockLockInfoRepository.QueryData(x=>x.OrderType==OutOrderTypeEnum.OutSGPick.ObjToInt());
             }
             catch (Exception ex)
             {
@@ -698,6 +778,8 @@
                 foreach (var item in AddoutMESOrders)
                 {
                     Dt_MaterielInfo materielInfo = materielInfos.FirstOrDefault(x => x.MaterielCode == item.MaterialCode);
+                    Dt_MakeCenterInfo makeCenterInfo=makeCenterInfos.FirstOrDefault(x => x.MakeCode == item.MakeCode);
+                    item.MakeArea = makeCenterInfo.MakeArea;
                     item.WarehouseId = materielInfo.WarehouseId;
                 }
 
@@ -705,50 +787,54 @@
                 _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_StockInfo>? stockInfos = null;
+                List<Dt_OutMESOrder>? Orders = null;
+                List<Dt_OutStockLockInfo>? outStockLockInfos = null;
+                List<Dt_LocationInfo>? locationInfos = null;
+                {
+                    //鍒嗛厤搴撳瓨
+                    (List<Dt_StockInfo>, List<Dt_OutMESOrder>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutMESOrderService.AssignStockOutbound(mESOrders);
+                    if (result.Item1 != null && result.Item1.Count > 0)
+                    {
+                        //鍒涘缓浠诲姟
+                        tasks = GetTasks(result.Item1, result.Item3, TaskTypeEnum.PrintYLOutbound);
+                        result.Item2.ForEach(x =>
+                        {
+                            OutOrderStatusEnum.鍑哄簱涓�.ObjToInt();
+                        });
+                        result.Item3.ForEach(x =>
+                        {
+                            x.Status = OutLockStockStatusEnum.鍑哄簱涓�.ObjToInt();
+                        });
 
-                //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;
-                //{
-                //    //鍒嗛厤搴撳瓨
-                //    (List<Dt_StockInfo>, List<Dt_OutMESOrder>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutMESOrderService.AssignStockOutbound(AddoutMESOrders);
-                //    if (result.Item1 != null && result.Item1.Count > 0)
-                //    {
-                //        //鍒涘缓浠诲姟
-                //        tasks = GetTasks(result.Item1, TaskTypeEnum.PrintYLOutbound);
-                //        result.Item2.ForEach(x =>
-                //        {
-                //            OutOrderStatusEnum.鍑哄簱涓�.ObjToInt();
-                //        });
-                //        result.Item3.ForEach(x =>
-                //        {
-                //            x.Status = OutLockStockStatusEnum.鍑哄簱涓�.ObjToInt();
-                //        });
+                        stockInfos = result.Item1;
+                        Orders = result.Item2;
+                        outStockLockInfos = result.Item3;
+                        locationInfos = result.Item4;
+                    }
+                    else
+                    {
+                        throw new Exception("鏃犲簱瀛�");
+                    }
+                }
+                int id = BaseDal.AddData(tasks);
 
-                //        stockInfos = result.Item1;
-                //        Orders = result.Item2;
-                //        outStockLockInfos = result.Item3;
-                //        locationInfos = result.Item4;
-                //    }
-                //    else
-                //    {
-                //        throw new Exception("鏃犲簱瀛�");
-                //    }
-                //}
-                //int id = BaseDal.AddData(tasks);
+                if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0)
+                {
+                    stockInfos.ForEach(x =>
+                    {
+                        x.StockStatus=StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
+                    });
+                    WebResponseContent contentResponse = _outboundService.OutMESOrderService.LockOutboundStockDataUpdate(stockInfos, Orders, outStockLockInfos, locationInfos, tasks: tasks);
 
-                //if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0)
-                //{
-                //    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);
+                    }
+                }
 
                 _unitOfWorkManage.CommitTran();
                 

--
Gitblit v1.9.3