From b55d324f4b7465f9a7dc50e999346697f5cc35a2 Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期五, 07 三月 2025 15:17:19 +0800
Subject: [PATCH] 1

---
 WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs |  909 +------------------------------------------------------
 1 files changed, 31 insertions(+), 878 deletions(-)

diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs
index df24b9a..7e52a74 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs
@@ -21,6 +21,8 @@
 using WIDESEA_Common;
 using WIDESEA_DTO.Outbound;
 using WIDESEA_Core.Utilities;
+using System.Transactions;
+using Microsoft.Data.SqlClient;
 
 namespace WIDESEA_TaskInfoService
 {
@@ -63,7 +65,7 @@
                             Grade = 0,
                             Creater = "WMS",
                             PalletCode = stockInfo.PalletCode,
-                            NextAddress = "0",
+                            NextAddress = "",
                             Roadway = locationInfo.RoadwayNo,
                             SourceAddress = stockInfo.LocationCode,
                             TargetAddress = roadwayInfo.OutStationCode,
@@ -146,7 +148,7 @@
             return (tasks, stockInfos, orderDetail == null ? null : new List<Dt_OutboundOrderDetail> { orderDetail }, outStockLockInfos, locationInfos);
         }
         /// <summary>
-        /// 鍑哄簱鍗曟嵁锛屽嚭搴撲换鍔′笅鍙�
+        /// 绔嬪簱鍑哄簱鎸囦护涓婁紶锛屽嚭搴撲换鍔′笅鍙�
         /// </summary>
         /// <param name="orderAddDTO"></param>
         /// <returns></returns>
@@ -163,7 +165,6 @@
                 orderAddDTO1.InoutType = orderAddDTO.OrderType;
                 orderAddDTO1.OrderType = orderAddDTO.InoutType.ObjToInt();
                 IEnumerable<int> inOrderTypes = Enum.GetValues<OrderTypeEmun>().Cast<int>();
-
                 //orderAddDTO1.OrderType = orderAddDTO.OrderType.ObjToInt();
                 orderAddDTO1.Details = orderAddDTO.DetailList.DicToIEnumerable<OutboundOrderDetailAddDTO>();
                 #region 楠岃瘉鏁版嵁
@@ -175,7 +176,8 @@
                 inboundOrder.OrderStatus = InboundStatusEnum.鏈紑濮�.ObjToInt();
                 inboundOrder.Creater = "WMS";
                 inboundOrder.CreateDate = DateTime.Now;
-                bool a = BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand();
+
+
                 Dt_OutboundOrder oldOutboundOrder = BaseDal.Db.Queryable<Dt_OutboundOrder>().Where(x => x.UpperOrderNo == orderAddDTO1.OrderNo).Includes(x => x.Details).First();
                 Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.OrderId == oldOutboundOrder.Id);
                 List<StockSelectViewDTO> stockSelectViews = new List<StockSelectViewDTO>();
@@ -189,26 +191,22 @@
                     LinId = outboundOrderDetail.LinId,
                     PalletCode = outboundOrderDetail.LPNNo,
                 };
+                _unitOfWorkManage.BeginTran();
+                bool a = BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand();
                 stockSelectViews.Add(stockSelectViewDTO);
-
-                //stockSelectViewDTO.PalletCode = orderAddDTO1;
-                //stockSelectViewDTO.LocationCode = orderAddDTO1;
-
                 GenerateOutboundTasks(oldOutboundOrder.Id, stockSelectViews);
+                _unitOfWorkManage.CommitTran();
                 content = WebResponseContent.Instance.OK();
             }
             catch (Exception ex)
             {
+                _unitOfWorkManage.RollbackTran();
                 content = WebResponseContent.Instance.Error(ex.Message);
-            }
-            finally
-            {
-
             }
             return content;
         }
         /// <summary>
-        /// 鐩樼偣鍑哄簱
+        /// 鐩樼偣浠诲姟涓婁紶绔嬪簱
         /// </summary>
         /// <returns></returns>
         public WebResponseContent InventoryOut(HouseCancelOut houseInventoryOut)
@@ -218,6 +216,7 @@
             {
                 OutboundOrderAddDTO orderAddDTO1 = new OutboundOrderAddDTO();
                 orderAddDTO1.OrderNo = houseInventoryOut.No;
+                orderAddDTO1.UpperOrderNo = houseInventoryOut.No;
                 orderAddDTO1.Details = houseInventoryOut.DetailList.DicToIEnumerable<OutboundOrderDetailAddDTO>();
                 #region 楠岃瘉鏁版嵁
                 (bool, string, object?) result = CheckOutboundOrderAddData(orderAddDTO1);
@@ -229,7 +228,7 @@
                 inboundOrder.OrderType = OutOrderTypeEnum.OutInventory.ObjToInt();
                 inboundOrder.Creater = "WMS";
                 inboundOrder.CreateDate = DateTime.Now;
-                bool a = BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand();
+
                 Dt_OutboundOrder oldOutboundOrder = BaseDal.Db.Queryable<Dt_OutboundOrder>().Where(x => x.OrderNo == orderAddDTO1.OrderNo).Includes(x => x.Details).First();
                 Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.OrderId == oldOutboundOrder.Id);
                 List<StockSelectViewDTO> stockSelectViews = new List<StockSelectViewDTO>();
@@ -242,15 +241,16 @@
                     BatchNo = outboundOrderDetail.BatchNo,
                     LinId = outboundOrderDetail.LinId,
                 };
+                _unitOfWorkManage.BeginTran();
+                bool a = BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand();
                 stockSelectViews.Add(stockSelectViewDTO);
-
-                //stockSelectViewDTO.PalletCode = orderAddDTO1;
-                //stockSelectViewDTO.LocationCode = orderAddDTO1;
                 GenerateOutboundTasks(oldOutboundOrder.Id, stockSelectViews);
+                _unitOfWorkManage.CommitTran();
                 content = WebResponseContent.Instance.OK();
             }
             catch (Exception ex)
             {
+                _unitOfWorkManage.RollbackTran();
                 content = WebResponseContent.Instance.Error(ex.Message);
             }
             finally
@@ -261,11 +261,11 @@
         }
         private (bool, string, object?) CheckOutboundOrderAddData(OutboundOrderAddDTO outboundOrderAddDTO)
         {
-            //(bool, string, object?) result1 = ModelValidate.ValidateModelData(outboundOrderAddDTO);
-            //if (!result1.Item1) return result1;
+            (bool, string, object?) result1 = ModelValidate.ValidateModelData(outboundOrderAddDTO);
+            if (!result1.Item1) return result1;
 
-            //(bool, string, object?) result2 = ModelValidate.ValidateModelData(outboundOrderAddDTO.Details);
-            //if (!result2.Item1) return result2;
+            (bool, string, object?) result2 = ModelValidate.ValidateModelData(outboundOrderAddDTO.Details);
+            if (!result2.Item1) return result2;
 
             IEnumerable<int> inOrderTypes = Enum.GetValues<OutOrderTypeEnum>().Cast<int>();
             if (!inOrderTypes.Contains(outboundOrderAddDTO.OrderType))
@@ -383,168 +383,6 @@
             }
 
         }
-        public WebResponseContent RelocationTasks(List<Dt_Task> task)
-        {
-            WebResponseContent content = new WebResponseContent();
-            try
-            {
-                _unitOfWorkManage.BeginTran();
-                for (int i = 0; i < task.Count; i++)
-                {
-                    Dt_LocationInfo location = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task[i].SourceAddress && x.RoadwayNo == task[i].Roadway);
-                    if (location != null)
-                    {
-                        //(Dt_LocationInfo?, int?) result = _basicService.LocationInfoService.isDepth(location);
-                        (Dt_LocationInfo?, int?) result = isDepth(location);
-                        if (result.Item1 != null && result.Item2 != LocationStatusEnum.Lock.ObjToInt() && result.Item2 != LocationStatusEnum.PalletLock.ObjToInt() && result.Item2 != LocationStatusEnum.Free.ObjToInt())
-                        {
-                            int sum = 0;
-                            for (int j = 0; j < task.Count; j++)
-                            {
-                                if (result.Item1.LocationCode == task[j].SourceAddress)
-                                {
-                                    sum++;
-                                }
-                            }
-                            if (sum == 0)
-                            {
-                                return content = RelocationTask(task[i]);
-                            }
-                            else
-                            {
-                                BaseDal.AddData(task[i]);
-                                _basicService.LocationInfoService.UpdateLocationLock(location, task[i].TaskNum, StockChangeType.Outbound.ObjToInt(), true);
-                            }
-                        }
-                        else if (result.Item1 == null && result.Item2 == LocationStatusEnum.Free.ObjToInt())
-                        {
-                            BaseDal.AddData(task[i]);
-                            location.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
-                            _basicService.LocationInfoService.UpdateData(location);
-                            content = WebResponseContent.Instance.OK();
-                        }
-                        else if (result.Item1 != null && result.Item2 == LocationStatusEnum.Free.ObjToInt())
-                        {
-                            BaseDal.AddData(task[i]);
-                            location.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
-                            _basicService.LocationInfoService.UpdateData(location);
-                            _basicService.LocationInfoService.UpdateLocationLock(location, task[i].TaskNum, StockChangeType.Outbound.ObjToInt(), false);
-                            content = WebResponseContent.Instance.OK();
-                        }
-                        else if (result.Item1 != null && (result.Item2 == LocationStatusEnum.Lock.ObjToInt() || result.Item2 == LocationStatusEnum.PalletLock.ObjToInt()))
-                        {
-                            Dt_Task TaskInfo = BaseDal.QueryFirst(x => x.SourceAddress == result.Item1.LocationCode);
-                            if (TaskInfo == null)
-                            {
-                                return content = WebResponseContent.Instance.Error("璐т綅琚攣瀹氫笉鍙嚭搴�");
-                            }
-                            else
-                            {
-                                BaseDal.AddData(task[i]);
-                                location.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
-                                _basicService.LocationInfoService.UpdateData(location);
-                                content = WebResponseContent.Instance.OK();
-                            }
-                        }
-                    }
-                    else
-                    {
-                        return content = WebResponseContent.Instance.OK("浠诲姟寮傚父");
-                    }
-                }
-                _unitOfWorkManage.CommitTran();
-                return content;
-            }
-            catch (Exception ex)
-            {
-                _unitOfWorkManage.RollbackTran();
-                return content = WebResponseContent.Instance.Error(ex.Message);
-            }
-        }
-        /// <summary>
-        /// 绉诲簱浠诲姟
-        /// </summary>
-        /// <param name="task"></param>
-        /// <returns></returns>
-        public WebResponseContent RelocationTask(Dt_Task task)
-        {
-            WebResponseContent content = new WebResponseContent();
-            try
-            {
-                Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress && x.RoadwayNo == task.Roadway);
-                if (locationInfo != null)
-                {
-                    int beforeStatus = locationInfo.LocationStatus;
-                    //(Dt_LocationInfo?,int?) Result = _basicService.LocationInfoService.isDepth(locationInfo);
-                    (Dt_LocationInfo?, int?) Result = isDepth(locationInfo);
-                    if (Result.Item1 != null && Result.Item2 == LocationStatusEnum.InStock.ObjToInt())
-                    {
-                        Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.LocationCode == Result.Item1.LocationCode);
-                        Dt_StockInfoDetail stockInfoDetail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == stockInfo.Id);
-                        if (stockInfo != null && stockInfoDetail != null)
-                        {
-                            (Dt_Task?, Dt_LocationInfo?) result = AddRelocationTask(Result.Item1, stockInfo, task);
-                            if (result.Item1 != null && result.Item2 != null)
-                            {
-                                _basicService.LocationInfoService.RelocationLock(Result.Item1, result.Item2, result.Item1.TaskNum);
-                                locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
-                                _basicService.LocationInfoService.UpdateData(locationInfo);
-                                _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Relocation.ObjToInt(), "", task.TaskNum);
-                                return content = WebResponseContent.Instance.OK();
-                            }
-                            else
-                            {
-                                return content = WebResponseContent.Instance.Error("绉诲簱浠诲姟鐢熸垚澶辫触");
-                            }
-                        }
-                        else
-                        {
-                            return content = WebResponseContent.Instance.Error("鏈壘鍒板簱瀛樹俊鎭�");
-                        }
-                    }
-                    else if (Result.Item1 != null && Result.Item2 == LocationStatusEnum.Pallet.ObjToInt())
-                    {
-                        Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.LocationCode == Result.Item1.LocationCode);
-                        if (stockInfo != null)
-                        {
-                            (Dt_Task?, Dt_LocationInfo?) result = AddRelocationTask(Result.Item1, stockInfo, task);
-                            if (result.Item1 != null && result.Item2 != null)
-                            {
-                                _basicService.LocationInfoService.RelocationLock(Result.Item1, result.Item2, result.Item1.TaskNum);
-                                locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
-                                _basicService.LocationInfoService.UpdateData(locationInfo);
-                                _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Relocation.ObjToInt(), "", task.TaskNum);
-                                return content = WebResponseContent.Instance.OK();
-                            }
-                            else
-                            {
-                                return content = WebResponseContent.Instance.Error("绉诲簱浠诲姟鐢熸垚澶辫触");
-                            }
-                        }
-                        else
-                        {
-                            return content = WebResponseContent.Instance.Error("鏈壘鍒板簱瀛樹俊鎭�");
-                        }
-                    }
-                    else
-                    {
-                        return content = WebResponseContent.Instance.Error("寮傚父");
-                    }
-                }
-                else
-                {
-                    return content = WebResponseContent.Instance.Error("浠诲姟淇℃伅寮傚父");
-                }
-            }
-            catch (Exception ex)
-            {
-                return content = WebResponseContent.Instance.Error(ex.Message);
-            }
-            finally
-            {
-
-            }
-        }
 
         /// <summary>
         /// 鍒ゆ柇宸烽亾鍐呯Щ搴�
@@ -613,19 +451,19 @@
                                 {
                                     Locationtype = 10;
                                 }
-                                //newLocation = _basicService.LocationInfoService.GetLocation(locationInfos.RoadwayNo,Locationtype); //鎷垮埌浜嗙Щ搴撳悗鐨勮揣浣�
+                                newLocation = _basicService.LocationInfoService.GetLocation(locationInfos.RoadwayNo, Locationtype); //鎷垮埌浜嗙Щ搴撳悗鐨勮揣浣�
                                 if (dt_StockInfo.MaterialType == (int)InventoryMaterialType.鎴愬搧)
                                 {
                                     string[] targetCodesst = dt_StockInfo.PalletCode.Split("*");
-                                    Dt_InboundOrder dt_Inbound = _inboundService.InbounOrderService.Repository.QueryFirst(x => x.OrderName == targetCodesst[0]);
-                                    if (dt_Inbound.Startingcolumn != 0 || dt_Inbound.Terminationcolumn != 0)
-                                    {
-                                        newLocation = _basicService.LocationInfoService.GetLocation2(locationInfos.RoadwayNo, Locationtype, dt_Inbound.Startingcolumn, dt_Inbound.Terminationcolumn);
-                                    }
-                                    else
-                                    {
-                                        newLocation = _basicService.LocationInfoService.GetLocation(locationInfos.RoadwayNo, Locationtype);
-                                    }
+                                    //Dt_InboundOrder dt_Inbound = _inboundService.InbounOrderService.Repository.QueryFirst(x => x.OrderName == targetCodesst[0]);
+                                    //if (dt_Inbound.Startingcolumn != 0 || dt_Inbound.Terminationcolumn != 0)
+                                    //{
+                                    //    newLocation = _basicService.LocationInfoService.GetLocation2(locationInfos.RoadwayNo, Locationtype, dt_Inbound.Startingcolumn, dt_Inbound.Terminationcolumn);
+                                    //}
+                                    //else
+                                    //{
+                                    //    newLocation = _basicService.LocationInfoService.GetLocation(locationInfos.RoadwayNo, Locationtype);
+                                    //}
 
                                 }
                                 else
@@ -690,518 +528,6 @@
 
         public string ReceiveWMSTask = WIDESEA_Core.Helper.AppSettings.Configuration["ReceiveWMSTask"];
 
-
-        ///// <summary>
-        ///// 鎺ユ敹璧风偣闇�瑕佺殑绌烘墭鐩樿繘琛屽嚭搴�
-        ///// </summary>
-        ///// <param name="SourceAddress"></param>
-        ///// <returns></returns>
-        //public WebResponseContent Empty_outbound(GenerateInv generate)
-        //{
-        //    WebResponseContent content = new WebResponseContent();
-        //    try
-        //    {
-        //        Dt_Task task = BaseDal.QueryFirst(x => x.TargetAddress == generate.SourceAddress);
-        //        if (task == null)
-        //        {
-        //            string RoadwayNo = "1";
-        //            if (generate.SourceAddress != "R01-002-041-001-01")
-        //            {
-        //                RoadwayNo = "2";
-        //            }
-        //            Dt_LocationInfo locationInfos = _basicService.LocationInfoService.Repository.QueryFirst(x => x.RoadwayNo == RoadwayNo && x.EnableStatus != (int)EnableStatusEnum.Disable && x.Depth==1 && x.LocationStatus == LocationStatusEnum.Pallet.ObjToInt());
-        //            if(locationInfos == null)
-        //            {
-        //                locationInfos = _basicService.LocationInfoService.Repository.QueryFirst(x => x.RoadwayNo == RoadwayNo && x.Depth == 2 && x.EnableStatus != (int)EnableStatusEnum.Disable && x.LocationStatus == LocationStatusEnum.Pallet.ObjToInt());
-        //            }
-
-        //            if (locationInfos != null)
-        //            {
-        //                Dt_StockInfo dt_StockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.LocationCode == locationInfos.LocationCode);
-        //                if (dt_StockInfo != null && dt_StockInfo.MaterialType == (int)InventoryMaterialType.绌烘墭)
-        //                {
-
-
-        //                    Dt_LocationInfo newSourceAddress;
-        //                    newSourceAddress = _basicService.LocationInfoService.GetLocationplatform(generate.SourceAddress);
-        //                    if (newSourceAddress != null)
-        //                    {
-        //                        Dt_Task dt_Task = new()
-        //                        {
-        //                            PalletCode = dt_StockInfo.PalletCode,
-        //                            TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
-        //                            Roadway = locationInfos.RoadwayNo,
-        //                            TaskType = TaskTypeEnum.PalletOutbound.ObjToInt(),
-        //                            TaskStatus = InTaskStatusEnum.InNew.ObjToInt(),
-        //                            SourceAddress = locationInfos.LocationCode,
-        //                            TargetAddress = newSourceAddress.LocationCode,
-        //                            CurrentAddress = locationInfos.LocationCode,
-        //                            NextAddress = newSourceAddress.LocationCode,
-        //                            Grade = 1,
-        //                            Creater = "WMS",
-        //                            Depth = locationInfos.Depth,
-        //                            CreateDate = DateTime.Now,
-        //                            PalletCodequantity = (int)dt_StockInfo.Materialweight,
-        //                            MaterialType = dt_StockInfo.MaterialType
-        //                        };
-
-        //                        _unitOfWorkManage.BeginTran();
-        //                        dt_StockInfo.StockStatus = (int)StockStatusEmun.鍑哄簱閿佸畾;
-        //                        dt_StockInfo.Remark = "绛夊緟鍫嗗灈鏈哄畬鎴愬嚭搴撲换鍔�";
-        //                        if (locationInfos.LocationStatus == LocationStatusEnum.Pallet.ObjToInt())
-        //                        {
-        //                            locationInfos.LocationStatus = LocationStatusEnum.PalletLock.ObjToInt();
-        //                        }
-        //                        BaseDal.AddData(dt_Task);
-        //                        _basicService.LocationInfoService.UpdateData(locationInfos);
-        //                        _stockService.StockInfoService.Repository.UpdateData(dt_StockInfo);
-        //                        _unitOfWorkManage.CommitTran();
-
-        //                        return content = WebResponseContent.Instance.OK(data: dt_Task);
-        //                    }
-        //                    else
-        //                    {
-        //                        return content = WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙扮紪鍙凤紝缂栧彿锛歿generate.SourceAddress}");
-        //                    }
-        //                }
-        //                else
-        //                {
-        //                    return content = WebResponseContent.Instance.Error($"鏃犺搴撲綅绌烘墭涓哄簱瀛樹俊鎭紝搴撲綅缂栧彿锛歿locationInfos.LocationCode}");
-        //                }
-
-        //            }
-        //            else
-        //            {
-        //                return content = WebResponseContent.Instance.Error($"璇ュ贩閬撳凡鏃犵┖鎵樼洏锛屽贩閬撳彿:{RoadwayNo}宸烽亾");
-        //            }
-        //        }
-        //        else
-        //        {
-        //            return content = WebResponseContent.Instance.Error($"宸叉湁璇ョ珯鍙扮殑绌烘墭鍑哄簱浠诲姟锛岀珯鍙扮紪鍙穥generate.SourceAddress}");
-        //        }
-        //    }
-        //    catch (Exception ex)
-        //    {
-        //        _unitOfWorkManage.RollbackTran();
-        //        return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屾姤閿欎俊鎭細{ex.Message}");
-        //        throw;
-        //    }
-        //}
-
-
-        ///// <summary>
-        ///// 鎺ユ敹璧风偣闇�瑕佺殑绌烘墭鐩樿繘琛屽嚭搴�
-        ///// </summary>
-        ///// <param name="SourceAddress"></param>
-        ///// <returns></returns>
-        //public WebResponseContent Rawmaterialout(GenerateInv3 generate)
-        //{
-        //    WebResponseContent content = new WebResponseContent();
-        //    List<Dt_StockInfo> dt_StockInfo = _stockService.StockInfoService.Repository.QueryData(x => x.PalletCode.Contains(generate.PalletCode) && x.MaterialType== (int)InventoryMaterialType.鍘熸潗鏂�).OrderBy(x=>x.CreateDate).Take(generate.outCount).ToList();
-
-        //    if(dt_StockInfo.Count > 0)
-        //    {
-        //        for (int i = 0; i < dt_StockInfo.Count; i++)
-        //        {
-        //            Dt_LocationInfo locationinfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == dt_StockInfo[i].LocationCode);   //纭璐т綅淇℃伅鏄惁瀵逛笂
-        //            if (locationinfo != null)
-        //            {
-        //                Dt_Task dt_Task = new()
-        //                {
-        //                    PalletCode = dt_StockInfo[i].PalletCode,
-        //                    TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
-        //                    Roadway = locationinfo.RoadwayNo,
-        //                    TaskType = TaskTypeEnum.Outbound.ObjToInt(),
-        //                    TaskStatus = InTaskStatusEnum.InNew.ObjToInt(),
-        //                    SourceAddress = locationinfo.LocationCode,
-        //                    TargetAddress = locationinfo.RoadwayNo == "1" ? "R01-002-041-011-01" : "R02-002-027-011-01",
-        //                    CurrentAddress = locationinfo.LocationCode,
-        //                    NextAddress = locationinfo.RoadwayNo == "1" ? "R01-002-041-011-01" : "R02-002-027-011-01",
-        //                    Grade = 1,
-        //                    Creater = "WMS",
-        //                    Depth = locationinfo.Depth,
-        //                    CreateDate = DateTime.Now,
-        //                    PalletCodequantity = (int)dt_StockInfo[i].Materialweight,
-        //                    PLCTo = generate.TargetAddress == "R01-002-041-011-01" ? 1 : 2,
-        //                    MaterialType = dt_StockInfo[i].MaterialType
-        //                };
-
-        //                _unitOfWorkManage.BeginTran();
-        //                dt_StockInfo[i].StockStatus = (int)StockStatusEmun.鍑哄簱閿佸畾;
-        //                dt_StockInfo[i].Remark = "绛夊緟鍫嗗灈鏈哄畬鎴愬嚭搴撲换鍔�";
-        //                if (locationinfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt())
-        //                {
-        //                    locationinfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
-        //                }
-        //                BaseDal.AddData(dt_Task);
-        //                _basicService.LocationInfoService.UpdateData(locationinfo);
-        //                _stockService.StockInfoService.Repository.UpdateData(dt_StockInfo);
-        //                _unitOfWorkManage.CommitTran();
-
-        //                 content = WebResponseContent.Instance.OK(data: dt_Task);
-        //            }
-        //            else
-        //            {
-        //                 content = WebResponseContent.Instance.Error($"鐗╂枡淇℃伅涓庤揣浣嶄俊鎭笉瀵癸紝鎵樼洏鍙凤細{dt_StockInfo[i].PalletCode}");
-        //            }
-        //        }
-        //        return content;
-        //    }
-        //    else
-        //    {
-        //        return content = WebResponseContent.Instance.Error($"鏈壘鍒板嚭搴撶殑搴撳瓨淇℃伅");
-        //    }
-        //}
-
-        /// <summary>
-        /// 鎵嬪姩鐢熸垚鍑哄簱浠诲姟
-        /// </summary>
-        /// <param name="PalletCode"></param>
-        /// <returns></returns>
-        public WebResponseContent ManualOutbound(SaveModel saveModel)
-        {
-            WebResponseContent content = new WebResponseContent();
-            try
-            {
-                List<Dt_StockInfo> dtstockt = new List<Dt_StockInfo>();
-                List<Dt_LocationInfo> locations = new List<Dt_LocationInfo>();
-                List<Dt_Task> taskdt = new List<Dt_Task>();
-                List<Dt_StockInfoDetail> dtstocktdetail = new List<Dt_StockInfoDetail>();
-                for (int i = 0; i < saveModel.DelKeys.Count; i++)
-                {
-                    Dt_StockInfo stockt = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == saveModel.DelKeys[i].ToString());
-                    if (stockt.StockStatus == (int)StockStatusEmun.宸插叆搴� && (stockt.Wlstatus == (int)InventoryMaterialStatus.鍚堟牸 || stockt.Wlstatus == (int)InventoryMaterialStatus.杩斿伐))
-                    {
-                        if (stockt.MaterialType != (int)InventoryMaterialType.鍘熸潗鏂�)
-                        {
-                            Dt_StockInfoDetail stocktdetail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == stockt.Id);
-                            stockt.StockStatus = (int)StockStatusEmun.鍑哄簱閿佸畾;
-                            if (stockt.MaterialType != (int)InventoryMaterialType.绌烘墭)
-                            {
-                                stocktdetail.Status = (int)StockStatusEmun.鍑哄簱閿佸畾;
-                            }
-                            Dt_LocationInfo locationinfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockt.LocationCode);
-                            if (locationinfo.RoadwayNo == "1")
-                            {
-                                if (locationinfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt())
-                                {
-                                    locationinfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
-                                }
-                                else if (locationinfo.LocationStatus == LocationStatusEnum.Pallet.ObjToInt())
-                                {
-                                    locationinfo.LocationStatus = LocationStatusEnum.PalletLock.ObjToInt();
-                                }
-                                string LocationName = "R01-002-044-001-01";
-                                if (stockt.MaterialType == (int)InventoryMaterialType.绌烘墭)
-                                {
-                                    LocationName = "R01-002-043-001-01";
-                                }
-                                Dt_LocationInfo newTargetAddress;
-                                newTargetAddress = _basicService.LocationInfoService.GetLocationplatform(LocationName);
-                                Dt_Task dt_Task = new()
-                                {
-                                    PalletCode = stockt.PalletCode,
-                                    TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
-                                    Roadway = newTargetAddress.RoadwayNo,
-                                    TaskType = TaskTypeEnum.Outbound.ObjToInt(),
-                                    TaskStatus = InTaskStatusEnum.InNew.ObjToInt(),
-                                    SourceAddress = locationinfo.LocationCode,
-                                    TargetAddress = newTargetAddress.LocationCode,
-                                    CurrentAddress = locationinfo.LocationCode,
-                                    NextAddress = newTargetAddress.LocationCode,
-                                    Grade = 1,
-                                    Creater = "WMS",
-                                    Depth = locationinfo.Depth,
-                                    CreateDate = DateTime.Now,
-                                    MaterialType = stockt.MaterialType
-                                };
-                                dtstockt.Add(stockt);
-                                locations.Add(locationinfo);
-                                taskdt.Add(dt_Task);
-                                if (stockt.MaterialType != (int)InventoryMaterialType.绌烘墭)
-                                {
-                                    dtstocktdetail.Add(stocktdetail);
-                                }
-                            }
-                            else
-                            {
-                                return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屽彧鍙嚭搴�1宸烽亾鐨勬墭鐩樺拰鎴愬搧锛屽嚭搴撴潯鐮侊細{saveModel.DelKeys[i].ToString()}");
-                            }
-                        }
-                        else
-                        {
-                            return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛岃涓嶈閫夋嫨鍘熸潗鏂欏嚭搴擄紝鍑哄簱鏉$爜锛歿saveModel.DelKeys[i].ToString()}");
-                        }
-                    }
-                    else
-                    {
-                        return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛岃閫夋嫨宸插叆搴撲笖鍚堟牸鐨勭墿鏂欏嚭搴擄紒锛侊紒锛屽嚭搴撴潯鐮侊細{saveModel.DelKeys[i].ToString()}");
-                    }
-
-                }
-                var responses = HttpHelper.Post<WebResponseContent>(ReceiveWMSTask, taskdt, "涓嬪彂浠诲姟鍏ュ簱");
-                _unitOfWorkManage.BeginTran();
-                if (dtstockt.Count > 0)
-                {
-                    _stockService.StockInfoService.Repository.UpdateData(dtstockt);
-                    _stockService.StockInfoDetailService.Repository.UpdateData(dtstocktdetail);
-                    _basicService.LocationInfoService.Repository.UpdateData(locations);
-                    BaseDal.AddData(taskdt);
-                }
-                _unitOfWorkManage.CommitTran();
-                content = WebResponseContent.Instance.OK();
-                return content;
-            }
-            catch (Exception ex)
-            {
-                _unitOfWorkManage.RollbackTran();
-                return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屾姤閿欎俊鎭細{ex.Message}");
-                throw;
-            }
-        }
-
-
-        public WebResponseContent ManualOutbound2(SaveModel saveModel)
-        {
-            WebResponseContent content = new WebResponseContent();
-            try
-            {
-                List<Dt_StockInfo> dtstockt = new List<Dt_StockInfo>();
-                List<Dt_LocationInfo> locations = new List<Dt_LocationInfo>();
-                List<Dt_Task> taskdt = new List<Dt_Task>();
-                List<Dt_StockInfoDetail> dtstocktdetail = new List<Dt_StockInfoDetail>();
-
-
-                List<Dt_StockInfo> stocktData = _stockService.StockInfoService.Repository.QueryData(x => x.StockStatus == (int)StockStatusEmun.宸插叆搴� && x.MaterialType == (int)InventoryMaterialType.鍘熸潗鏂�);
-                List<Dt_LocationInfo> locationinfoData = _basicService.LocationInfoService.Repository.QueryData(x => x.LocationStatus == LocationStatusEnum.InStock.ObjToInt());
-                List<Dt_StockInfoDetail> StockInfoDetailData = _stockService.StockInfoDetailService.Repository.QueryData(x => x.Status == (int)StockStatusEmun.宸插叆搴�);
-
-
-                string json = saveModel.DelKeys[0].ToString();
-                List<string> palletCodes = JsonConvert.DeserializeObject<List<string>>(json);
-
-                foreach (var palletCode in palletCodes)
-                {
-                    Dt_StockInfo stockt = stocktData.FirstOrDefault(x => x.PalletCode == palletCode);
-                    if (stockt != null)
-                    {
-                        if (stockt.StockStatus == (int)StockStatusEmun.宸插叆搴� && (stockt.Wlstatus == (int)InventoryMaterialStatus.鍚堟牸 || stockt.Wlstatus == (int)InventoryMaterialStatus.閫�璐� || stockt.Wlstatus == (int)InventoryMaterialStatus.鐗归噰))
-                        {
-                            Dt_StockInfoDetail stocktdetail = StockInfoDetailData.FirstOrDefault(x => x.StockId == stockt.Id);
-                            if (stocktdetail != null)
-                            {
-                                Dt_LocationInfo locationinfo = locationinfoData.FirstOrDefault(x => x.LocationCode == stockt.LocationCode);
-                                if (locationinfo != null)
-                                {
-                                    stockt.StockStatus = (int)StockStatusEmun.鍑哄簱閿佸畾;
-                                    if (locationinfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt())
-                                    {
-                                        locationinfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
-                                    }
-
-                                    string TargetAdd = "";
-                                    if (saveModel.DelKeys[1].ToString() == "20")
-                                    {
-                                        TargetAdd = "R02-001-021-001-02";
-                                    }
-                                    else if (saveModel.DelKeys[1].ToString() == "30")
-                                    {
-                                        TargetAdd = "R02-001-022-001-02";
-                                    }
-                                    else if (saveModel.DelKeys[1].ToString() == "40")
-                                    {
-                                        TargetAdd = "R01-002-044-001-01";
-                                    }
-                                    else
-                                    {
-                                        TargetAdd = locationinfo.RoadwayNo == "2" ? "R02-002-027-011-01" : "R01-002-041-011-01";
-                                    }
-
-
-                                    Dt_Task dt_Task = new()
-                                    {
-                                        PalletCode = stockt.PalletCode,
-                                        TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
-                                        Roadway = locationinfo.RoadwayNo,
-                                        TaskType = TaskTypeEnum.Outbound.ObjToInt(),
-                                        TaskStatus = InTaskStatusEnum.InNew.ObjToInt(),
-                                        SourceAddress = locationinfo.LocationCode,
-                                        TargetAddress = TargetAdd,
-                                        CurrentAddress = locationinfo.LocationCode,
-                                        NextAddress = TargetAdd,
-                                        Grade = 1,
-                                        Creater = "WMS",
-                                        Depth = locationinfo.Depth,
-                                        CreateDate = DateTime.Now,
-                                        PLCTo = int.Parse(saveModel.DelKeys[1].ToString()),
-                                        MaterialType = stockt.MaterialType
-                                    };
-                                    dtstockt.Add(stockt);
-                                    locations.Add(locationinfo);
-                                    taskdt.Add(dt_Task);
-                                    dtstocktdetail.Add(stocktdetail);
-                                }
-                                else
-                                {
-                                    return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屾湭鎵惧埌瀵瑰簲鐨勫簱浣嶄俊鎭紝璇锋牳瀵癸紒锛侊紒锛屽嚭搴撴潯鐮侊細{palletCode}");
-                                }
-                            }
-                            else
-                            {
-                                return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屾湭鎵惧埌瀵瑰簲鐨勫簱瀛樿鎯呬俊鎭紝璇锋牳瀵癸紒锛侊紒锛屽嚭搴撴潯鐮侊細{palletCode}");
-                            }
-                        }
-                        else
-                        {
-                            return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛岃閫夋嫨宸插叆搴撲笖锛堝悎鏍硷紝鐗归噰锛岄��璐э級鐨勭墿鏂欏嚭搴擄紒锛侊紒锛屽嚭搴撴潯鐮侊細{palletCode}");
-                        }
-                    }
-                    else
-                    {
-                        return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屾湭鎵惧埌瀵瑰簲鏉$爜鐨勫簱瀛樹俊鎭紝鍑哄簱鏉$爜锛歿palletCode}");
-
-                    }
-                }
-                var responses = HttpHelper.Post<WebResponseContent>(ReceiveWMSTask, taskdt, "涓嬪彂浠诲姟鍏ュ簱");
-                _unitOfWorkManage.BeginTran();
-                if (dtstockt.Count > 0)
-                {
-                    _stockService.StockInfoService.Repository.UpdateData(dtstockt);
-                    _stockService.StockInfoDetailService.Repository.UpdateData(dtstocktdetail);
-                    _basicService.LocationInfoService.Repository.UpdateData(locations);
-                    BaseDal.AddData(taskdt);
-                }
-                _unitOfWorkManage.CommitTran();
-                content = WebResponseContent.Instance.OK($"鍑哄簱鎴愬姛锛屽嚭搴撴�绘暟锛歿palletCodes.Count}锛屾垚鍔熸暟閲忥細{dtstockt.Count}");
-                return content;
-            }
-            catch (Exception ex)
-            {
-                _unitOfWorkManage.RollbackTran();
-                return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛屾姤閿欎俊鎭細{ex.Message}");
-                throw;
-            }
-        }
-
-        public WebResponseContent ManualOutbound3(SaveModel saveModel)
-        {
-            WebResponseContent content = new WebResponseContent();
-            try
-            {
-                List<Dt_StockInfo> dtstockt = new List<Dt_StockInfo>();
-
-
-                List<Dt_StockInfo> stocktData = _stockService.StockInfoService.Repository.QueryData(x => x.StockStatus == (int)StockStatusEmun.宸插叆搴�);
-                string json = saveModel.DelKeys[0].ToString();
-                List<int> palletCodes = JsonConvert.DeserializeObject<List<int>>(json);
-
-                foreach (int pallid in palletCodes)
-                {
-                    Dt_StockInfo stockt = stocktData.FirstOrDefault(x => x.Id == pallid);
-                    if (stockt != null)
-                    {
-
-                        stockt.Wlstatus = int.Parse(saveModel.DelKeys[1].ToString());
-                        dtstockt.Add(stockt);
-                    }
-                    else
-                    {
-                        return content = WebResponseContent.Instance.Error($"淇敼澶辫触锛屾湭鎵惧埌瀵瑰簲鐨勫簱瀛樹俊鎭紝搴撳瓨缂栧彿锛歿pallid}");
-
-                    }
-                }
-                _unitOfWorkManage.BeginTran();
-                if (dtstockt.Count > 0)
-                {
-                    _stockService.StockInfoService.Repository.UpdateData(dtstockt);
-                }
-                _unitOfWorkManage.CommitTran();
-                content = WebResponseContent.Instance.OK($"淇敼鎴愬姛");
-                return content;
-            }
-            catch (Exception ex)
-            {
-                _unitOfWorkManage.RollbackTran();
-                return content = WebResponseContent.Instance.Error($"淇敼澶辫触锛屾姤閿欎俊鎭細{ex.Message}");
-                throw;
-            }
-        }
-
-        public WebResponseContent ManualOutbound4(SaveModel saveModel)
-        {
-            WebResponseContent content = new WebResponseContent();
-            try
-            {
-                List<Dt_StockInfo> dtstockt = new List<Dt_StockInfo>();
-
-
-                List<Dt_StockInfo> stocktData = _stockService.StockInfoService.Repository.QueryData(x => x.StockStatus == (int)StockStatusEmun.宸插叆搴�);
-                string json = saveModel.DelKeys[0].ToString();
-                List<int> palletCodes = JsonConvert.DeserializeObject<List<int>>(json);
-
-                foreach (int pallid in palletCodes)
-                {
-                    Dt_StockInfo stockt = stocktData.FirstOrDefault(x => x.Id == pallid);
-                    if (stockt != null)
-                    {
-
-                        stockt.Mgeneratetime = DateTime.Parse(saveModel.DelKeys[1].ToString());
-                        dtstockt.Add(stockt);
-                    }
-                    else
-                    {
-                        return content = WebResponseContent.Instance.Error($"淇敼澶辫触锛屾湭鎵惧埌瀵瑰簲鐨勫簱瀛樹俊鎭紝搴撳瓨缂栧彿锛歿pallid}");
-
-                    }
-                }
-                _unitOfWorkManage.BeginTran();
-                if (dtstockt.Count > 0)
-                {
-                    _stockService.StockInfoService.Repository.UpdateData(dtstockt);
-                }
-                _unitOfWorkManage.CommitTran();
-                content = WebResponseContent.Instance.OK($"淇敼鎴愬姛");
-                return content;
-            }
-            catch (Exception ex)
-            {
-                _unitOfWorkManage.RollbackTran();
-                return content = WebResponseContent.Instance.Error($"淇敼澶辫触锛屾姤閿欎俊鎭細{ex.Message}");
-                throw;
-            }
-        }
-
-        public class PalletCodeList
-        {
-            public string PalletCode { get; set; }
-        }
-
-
-        public (Dt_Task?, Dt_LocationInfo?) AddRelocationTask(Dt_LocationInfo location, Dt_StockInfo stockInfo, Dt_Task task)
-        {
-            Dt_LocationInfo? locationInfos = _basicService.LocationInfoService.AssignLocation(location.RoadwayNo);
-            if (locationInfos != null)
-            {
-                Dt_Task tasks = new()
-                {
-                    CurrentAddress = location.LocationCode,
-                    Grade = 0,
-                    PalletCode = stockInfo.PalletCode,
-                    NextAddress = locationInfos.LocationCode,
-                    Roadway = location.RoadwayNo,
-                    SourceAddress = location.LocationCode,
-                    TargetAddress = locationInfos.LocationCode,
-                    TaskStatus = InTaskStatusEnum.RelocationNew.ObjToInt(),
-                    TaskType = TaskTypeEnum.Relocation.ObjToInt(),
-                    TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum))
-                };
-                BaseDal.AddData(tasks);
-                BaseDal.AddData(task);
-                stockInfo.StockStatus = StockStatusEmun.绉诲簱閿佸畾.ObjToInt();
-                _stockService.StockInfoService.UpdateData(stockInfo);
-            }
-            return (task, locationInfos);
-        }
         /// <summary>
         /// 鐢熸垚鍑哄簱浠诲姟
         /// </summary>
@@ -1252,179 +578,6 @@
             {
                 _unitOfWorkManage.RollbackTran();
                 return WebResponseContent.Instance.Error(ex.Message);
-            }
-        }
-
-        /// <summary>
-        /// 绌烘墭鐩樺嚭搴撲换鍔�
-        /// </summary>
-        /// <param name="inTask"></param>
-        /// <returns></returns>
-        public WebResponseContent PalletOutboundTask(string roadwayNo, string endStation)
-        {
-            try
-            {
-                Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetPalletStockInfo(roadwayNo);
-                if (stockInfo == null)
-                {
-                    return WebResponseContent.Instance.Error("鏈壘鍒扮┖鎵樼洏搴撳瓨");
-                }
-                Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode && x.RoadwayNo == roadwayNo);
-                if (locationInfo == null)
-                {
-                    return WebResponseContent.Instance.Error("鏈壘鍒扮┖鎵樼洏搴撳瓨瀵瑰簲鐨勮揣浣嶄俊鎭�");
-                }
-                Dt_RoadwayInfo roadwayInfo = _basicService.RoadwayInfoService.Repository.QueryFirst(x => x.InStationCode == endStation && x.RoadwayNo == roadwayNo);
-                if (roadwayInfo == null)
-                {
-                    return WebResponseContent.Instance.Error("鏈壘鍒扮粓鐐瑰贩閬撲俊鎭�");
-                }
-                Dt_Task task = new Dt_Task()
-                {
-                    CurrentAddress = stockInfo.LocationCode,
-                    Grade = 0,
-                    NextAddress = endStation,
-                    PalletCode = stockInfo.PalletCode,
-                    Roadway = roadwayNo,
-                    SourceAddress = stockInfo.LocationCode,
-                    TargetAddress = endStation,
-                    TaskStatus = OutTaskStatusEnum.OutNew.ObjToInt(),
-                    TaskType = TaskTypeEnum.PalletOutbound.ObjToInt(),
-                    Depth = locationInfo.Depth,
-                    TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum))
-
-                };
-                int beforeStatus = locationInfo.LocationStatus;
-                _unitOfWorkManage.BeginTran();
-                stockInfo.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
-                locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
-                BaseDal.AddData(task);
-                _stockService.StockInfoService.UpdateData(stockInfo);
-
-                _basicService.LocationInfoService.UpdateData(locationInfo);
-
-                _basicService.LocationInfoService.UpdateLocationLock(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false);
-                _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), "", task.TaskNum);
-
-                _unitOfWorkManage.CommitTran();
-                return WebResponseContent.Instance.OK();
-            }
-            catch (Exception ex)
-            {
-                return WebResponseContent.Instance.Error(ex.Message);
-            }
-        }
-
-        public (Dt_LocationInfo?, int?) isDepth(Dt_LocationInfo locationInfo)
-        {
-            if (locationInfo.Depth == 2)
-            {
-                if (locationInfo.Row == 1 || locationInfo.Row == 5)
-                {
-                    Dt_LocationInfo dt_LocationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.Row == locationInfo.Row + 1 && x.Layer == locationInfo.Layer && x.Column == locationInfo.Column && x.RoadwayNo == locationInfo.RoadwayNo);
-
-                    if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt())
-                    {
-                        return (dt_LocationInfo, LocationStatusEnum.InStock.ObjToInt());
-                    }
-                    if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.Free.ObjToInt())
-                    {
-                        return (dt_LocationInfo, LocationStatusEnum.Free.ObjToInt());
-                    }
-                    if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.Lock.ObjToInt())
-                    {
-                        return (dt_LocationInfo, LocationStatusEnum.Lock.ObjToInt());
-                    }
-                    if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.PalletLock.ObjToInt())
-                    {
-                        return (dt_LocationInfo, LocationStatusEnum.PalletLock.ObjToInt());
-                    }
-                    if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.Pallet.ObjToInt())
-                    {
-                        return (dt_LocationInfo, LocationStatusEnum.Pallet.ObjToInt());
-                    }
-                }
-                else if (locationInfo.Row == 4 || locationInfo.Row == 8)
-                {
-                    Dt_LocationInfo dt_LocationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.Row == locationInfo.Row + 1 && x.Layer == locationInfo.Layer && x.Column == locationInfo.Column && x.RoadwayNo == locationInfo.RoadwayNo);
-
-                    if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt())
-                    {
-                        return (dt_LocationInfo, LocationStatusEnum.InStock.ObjToInt());
-                    }
-                    if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.Free.ObjToInt())
-                    {
-                        return (dt_LocationInfo, LocationStatusEnum.Free.ObjToInt());
-                    }
-                    if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.Lock.ObjToInt())
-                    {
-                        return (dt_LocationInfo, LocationStatusEnum.Lock.ObjToInt());
-                    }
-                    if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.PalletLock.ObjToInt())
-                    {
-                        return (dt_LocationInfo, LocationStatusEnum.PalletLock.ObjToInt());
-                    }
-                    if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.Pallet.ObjToInt())
-                    {
-                        return (dt_LocationInfo, LocationStatusEnum.Pallet.ObjToInt());
-                    }
-                }
-            }
-            return (null, LocationStatusEnum.Free.ObjToInt());
-        }
-
-        /// <summary>
-        /// 浜哄伐鎵嬪姩鍑哄簱锛堝垹闄ゅ簱瀛橈級
-        /// </summary>
-        /// <param name="saveModel"></param>
-        /// <returns></returns>
-        public WebResponseContent ManualOutboundDeleteinventory(SaveModel saveModel)
-        {
-            WebResponseContent content = new WebResponseContent();
-            try
-            {
-                List<Dt_StockInfo> dtstockt = new List<Dt_StockInfo>();
-                List<Dt_LocationInfo> locations = new List<Dt_LocationInfo>();
-                List<Dt_StockInfoDetail> dtstocktdetail = new List<Dt_StockInfoDetail>();
-
-                for (int i = 0; i < saveModel.DelKeys.Count; i++)
-                {
-                    Dt_StockInfo stockt = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == saveModel.DelKeys[i].ToString());
-                    if (stockt.StockStatus == (int)StockStatusEmun.宸插叆搴�)
-                    {
-                        Dt_StockInfoDetail stocktdetail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == stockt.Id);
-                        Dt_LocationInfo locationinfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockt.LocationCode);
-                        locationinfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
-                        dtstockt.Add(stockt);
-                        locations.Add(locationinfo);
-                        if (stockt.MaterialType == (int)InventoryMaterialType.绌烘墭)
-                        {
-                            dtstocktdetail.Add(stocktdetail);
-                        }
-                        WriteLog.GetLog("浜哄伐鎵嬪姩鍒犻櫎搴撳瓨淇℃伅").Write($"鎵樼洏鏉$爜锛歿stockt.PalletCode},搴撲綅缂栧彿锛歿stockt.LocationCode}", $"浜哄伐鍑哄簱搴撳瓨");
-                    }
-                    else
-                    {
-                        return content = WebResponseContent.Instance.Error($"鍑哄簱澶辫触锛岃搴撳瓨淇℃伅涓嶅彲杩涜鍑哄簱");
-                    }
-
-                }
-                _unitOfWorkManage.BeginTran();
-                _stockService.StockInfoService.Repository.DeleteData(dtstockt);
-                if (dtstocktdetail.Count == 0)
-                {
-                    _stockService.StockInfoDetailService.Repository.DeleteData(dtstocktdetail);
-                }
-                _basicService.LocationInfoService.Repository.UpdateData(locations);
-                _unitOfWorkManage.CommitTran();
-                content = WebResponseContent.Instance.OK();
-                return content;
-            }
-            catch (Exception ex)
-            {
-                _unitOfWorkManage.RollbackTran();
-                return content = WebResponseContent.Instance.Error($"鎵嬪姩鍑哄簱淇℃伅澶辫触锛屾姤閿欎俊鎭細{ex.Message}");
-                throw;
             }
         }
 

--
Gitblit v1.9.3