From bfc11f87e2b64420c9917c0b9881b3e327d6f796 Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期二, 04 十一月 2025 22:19:59 +0800
Subject: [PATCH] 优化调拨出入库

---
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs |  274 +++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 196 insertions(+), 78 deletions(-)

diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs"
index 1f3fb09..ee73c0a 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs"
@@ -3,8 +3,11 @@
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using WIDESEA_Common;
 using WIDESEA_Common.OrderEnum;
+using WIDESEA_Common.StockEnum;
 using WIDESEA_Common.TaskEnum;
+using WIDESEA_Common.WareHouseEnum;
 using WIDESEA_Core;
 using WIDESEA_Core.Enums;
 using WIDESEA_Core.Helper;
@@ -27,23 +30,37 @@
             try
             {
                 List<Dt_DeliveryOrder> deliveryOrders = new List<Dt_DeliveryOrder>();
-                List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
+                //List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
+                List<Dt_SupplyTask> supplyTasks1 = new List<Dt_SupplyTask>();
+                List<Dt_InventoryInfo> _InventoryInfos = new List<Dt_InventoryInfo>();
                 List<Dt_Inventory_Batch> inventory_Batches = _inventory_BatchServices.Repository.QueryData(x => keys.Contains(x.Id));
                 foreach (var item in inventory_Batches)
                 {
+                    var supplyTasks = _supplyTaskService.Repository.QueryData(x => x.MaterielCode == item.MaterielCode && x.BatchNo == item.BatchNo && x.TaskStatus == SupplyStatusEnum.NewCheck.ObjToInt()).ToList();
+                    if (item.SupplyQuantity != 0) throw new Exception($"鐗╂枡缂栧彿銆恵item.MaterielCode}銆戞壒娆″彿銆恵item.BatchNo}銆戝凡瀛樺湪鐩樼偣宸紓!");
+                    if (supplyTasks.Count > 0) throw new Exception($"鐗╂枡缂栧彿銆恵item.MaterielCode}銆戞壒娆″彿銆恵item.BatchNo}銆戝凡瀛樺湪鐩樼偣浠诲姟锛岃鍏堝畬鎴愬綋鍓嶇洏鐐逛换鍔�");
+                    supplyTasks = _supplyTaskService.Repository.QueryData(x => x.MaterielCode == item.MaterielCode && x.BatchNo == item.BatchNo && x.TaskStatus == SupplyStatusEnum.NewOut.ObjToInt()).ToList();
+                    if (supplyTasks.Count > 0) throw new Exception($"鐗╂枡缂栧彿銆恵item.MaterielCode}銆戞壒娆″彿銆恵item.BatchNo}銆戝凡瀛樺湪鍑哄簱浠诲姟锛岃鍏堝畬鎴愬綋鍓嶅嚭搴撲换鍔�");
                     List<Dt_InventoryInfo> inventoryInfos = _inventoryInfoService.Repository.QueryData(x => item.MaterielCode == x.MaterielCode && x.BatchNo == item.BatchNo);
                     if (inventoryInfos.Count > 0)
                     {
                         foreach (var items in inventoryInfos.GroupBy(x => x.WarehouseCode))
                         {
-                            Dt_DeliveryOrder deliveryOrder = new Dt_DeliveryOrder()
+                            Dt_DeliveryOrder? deliveryOrder = deliveryOrders.Where(x => x.Warehouse_no == items.Key).FirstOrDefault();
+                            bool isNull = false;
+                            if (deliveryOrder == null)
                             {
-                                Out_no = item.MaterielCode + "_" + item.BatchNo,
-                                Out_type = "3",
-                                OutStatus = "鏂板缓",
-                                Warehouse_no = items.Key,
-                                Details = new List<Dt_DeliveryOrderDetail>()
-                            };
+                                isNull = true;
+                                deliveryOrder = new Dt_DeliveryOrder()
+                                {
+                                    //Out_no = item.MaterielCode + "_" + item.BatchNo,
+                                    Out_no = $"PD{items.Key}{DateTime.Now.ToString("yyMMddHHmmss")}",
+                                    Out_type = "20",
+                                    OutStatus = "鏂板缓",
+                                    Warehouse_no = items.Key,
+                                    Details = new List<Dt_DeliveryOrderDetail>()
+                                };
+                            }
                             var Status = items.Key == "001" ? 0 : 2;//鍒ゆ柇鏄惁涓虹珛搴撳尯鍩�
                             Dt_DeliveryOrderDetail deliveryOrderDetail = new Dt_DeliveryOrderDetail()
                             {
@@ -58,38 +75,42 @@
                                 Reservoirarea = items.Key
                             };
                             deliveryOrder.Details.Add(deliveryOrderDetail);
-                            deliveryOrders.Add(deliveryOrder);
+                            if (isNull) deliveryOrders.Add(deliveryOrder);
                             #region 鍒涘缓鐩樼偣浠诲姟
-                            if (items.Key != "001")
+                            foreach (var inventory in items)
                             {
-                                foreach (var inventory in items)
+                                Dt_SupplyTask supplyTask = new Dt_SupplyTask()
                                 {
-                                    Dt_SupplyTask supplyTask = new Dt_SupplyTask()
-                                    {
-                                        WarehouseCode = inventory.WarehouseCode,
-                                        TaskStatus = SupplyStatusEnum.NewCheck.ObjToInt(),
-                                        BatchNo = inventory.BatchNo,
-                                        MaterielName = inventory.MaterielName,
-                                        MaterielCode = inventory.MaterielCode,
-                                        MaterielSpec = inventory.MaterielSpec,
-                                        TaskType = TaskTypeEnum.OutInventory.ObjToInt(),
-                                        CreateDate = DateTime.Now,
-                                        Creater = App.User.UserName,
-                                        LocationCode = inventory.LocationCode,
-                                        OrderNo = deliveryOrder.Out_no,
-                                        StockQuantity = inventory.StockQuantity,
-                                        SupplyQuantity = 0,
-                                        Remark = "鐩樼偣"
-                                    };
-                                    supplyTasks.Add(supplyTask);
-                                }
+                                    WarehouseCode = inventory.WarehouseCode,
+                                    TaskStatus = SupplyStatusEnum.NewCheck.ObjToInt(),
+                                    BatchNo = inventory.BatchNo,
+                                    MaterielName = inventory.MaterielName,
+                                    MaterielCode = inventory.MaterielCode,
+                                    MaterielSpec = inventory.MaterielSpec,
+                                    TaskType = TaskTypeEnum.OutInventory.ObjToInt(),
+                                    CreateDate = DateTime.Now,
+                                    Creater = App.User.UserName,
+                                    LocationCode = inventory.LocationCode,
+                                    OrderNo = deliveryOrder.Out_no,
+                                    StockQuantity = inventory.StockQuantity,
+                                    SupplyQuantity = 0,
+                                    Remark = "鐩樼偣"
+                                };
+                                supplyTasks1.Add(supplyTask);
+                                _InventoryInfos.Add(inventory);
                             }
+                            //}
                             #endregion
                         }
                     }
                 }
+                _InventoryInfos.ForEach(x =>
+                {
+                    x.StockStatus = StockStatusEmun.鐩樼偣閿佸畾.ObjToInt();
+                });
                 _unitOfWorkManage.BeginTran();
-                _supplyTaskService.AddData(supplyTasks);
+                _inventoryInfoService.UpdateData(_InventoryInfos);
+                _supplyTaskService.AddData(supplyTasks1);
                 BaseDal.Db.InsertNav(deliveryOrders)
                         .Include(x => x.Details)
                         .ExecuteCommand();
@@ -104,9 +125,6 @@
             return content;
         }
         #endregion
-
-
-
 
         #region 鏌ヨ鐩樼偣鍗曚俊鎭�
         /// <summary>
@@ -125,11 +143,11 @@
                 List<Dt_DeliveryOrder> dt_ReceiveOrders = new List<Dt_DeliveryOrder>();
                 if (string.IsNullOrEmpty(orderNo))
                 {
-                    dt_ReceiveOrders = Db.Queryable<Dt_DeliveryOrder>().Where(x => (x.OutStatus == "鏂板缓" || x.OutStatus == "寮�濮�") && x.Warehouse_no == warehouseCode && x.Out_type == "3").Includes(x => x.Details).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 5);
+                    dt_ReceiveOrders = Db.Queryable<Dt_DeliveryOrder>().Where(x => (x.OutStatus == "鏂板缓" || x.OutStatus == "寮�濮�") && x.Warehouse_no == warehouseCode && x.Out_type == "20").Includes(x => x.Details).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 5);
                 }
                 else
                 {
-                    dt_ReceiveOrders = Db.Queryable<Dt_DeliveryOrder>().Where(x => (x.Out_no.Contains(orderNo) || x.Client_no.Contains(orderNo)) && (x.OutStatus == "鏂板缓" || x.OutStatus == "寮�濮�") && x.Out_type == "3" && x.Warehouse_no == warehouseCode).OrderByDescending(x => x.CreateDate).Includes(x => x.Details).ToPageList(pageNo, 5);
+                    dt_ReceiveOrders = Db.Queryable<Dt_DeliveryOrder>().Where(x => (x.Out_no.Contains(orderNo) || x.Client_no.Contains(orderNo)) && (x.OutStatus == "鏂板缓" || x.OutStatus == "寮�濮�") && x.Out_type == "20" && x.Warehouse_no == warehouseCode).OrderByDescending(x => x.CreateDate).Includes(x => x.Details).ToPageList(pageNo, 5);
                 }
 
                 content.OK(data: dt_ReceiveOrders);
@@ -142,6 +160,7 @@
             return content;
         }
         #endregion
+
         #region 鏌ユ壘鐩樼偣/鍑哄簱浠诲姟
         /// <summary>
         /// 鏌ユ壘鐩樼偣/鍑哄簱浠诲姟
@@ -163,11 +182,11 @@
                 if (string.IsNullOrEmpty(LocationCode))
                 {
                     supplyTasks = Db.Queryable<Dt_SupplyTask>().Where(x => x.TaskStatus == TaskStatus && x.OrderNo == orderNo && x.WarehouseCode == warehouseCode).ToPageList(pageNo, 5);
-                 }
+                }
                 else
                 {
                     supplyTasks = Db.Queryable<Dt_SupplyTask>().Where(x => x.TaskStatus == TaskStatus && x.OrderNo == orderNo && x.WarehouseCode == warehouseCode && x.LocationCode.Contains(LocationCode)).ToPageList(pageNo, 5);
-                    }
+                }
                 content.OK(data: supplyTasks);
             }
             catch (Exception ex)
@@ -178,6 +197,7 @@
         }
 
         #endregion
+
         #region 瀹屾垚鐩樼偣浠诲姟
         public WebResponseContent CheckFinish(SaveModel saveModel)
         {
@@ -191,63 +211,161 @@
                 if (supplyTask == null) throw new Exception("褰撳墠鐩樼偣浠诲姟宸插畬鎴�");
                 if (supplyTask.LocationCode != LocationCode) throw new Exception($"褰撳墠鐩樼偣璐т綅銆恵LocationCode}銆戜笌浠诲姟鍒嗛厤璐т綅涓嶅尮閰�");
                 supplyTask.SupplyQuantity = qty;
+                content = CheckTaskFinish(supplyTask, LocationCode);
+            }
+            catch (Exception ex)
+            {
+                content.Error(ex.Message);
+            }
+            return content;
+        }
+        #endregion
+
+        #region 鐩樼偣浠诲姟瀹屾垚,骞冲簱鍜岀珛搴�
+        public WebResponseContent CheckTaskFinish(Dt_SupplyTask supplyTask, string LocationCode = null)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
                 supplyTask.TaskStatus = SupplyStatusEnum.CheckFinish.ObjToInt();
-                Dt_DeliveryOrder cabinOrder = BaseDal.Db.Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == supplyTask.OrderNo && x.Warehouse_no == supplyTask.WarehouseCode && x.Out_type == "3").Includes(x => x.Details).First();
+                Dt_DeliveryOrder cabinOrder = BaseDal.Db.Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == supplyTask.OrderNo && x.Warehouse_no == supplyTask.WarehouseCode && x.Out_type == "20").Includes(x => x.Details).First();
                 if (cabinOrder == null) return WebResponseContent.Instance.Error($"鐩樼偣鍗曞凡瀹屾垚");
                 Dt_DeliveryOrderDetail cabinOrderDetail = cabinOrder.Details.Where(x => x.Batch_num == supplyTask.BatchNo && x.Reservoirarea == supplyTask.WarehouseCode && x.Goods_no == supplyTask.MaterielCode).First();
                 if (cabinOrderDetail == null) return WebResponseContent.Instance.Error($"鐩樼偣鍗曟槑缁嗗凡瀹屾垚");
-                Dt_MaterielInfo materielInfo = _basicService.MaterielInfoService.Repository.QueryFirst(x => x.MaterielCode == cabinOrderDetail.Goods_no);
+                Dt_MaterielInfo materielInfo = _materielInfoService.Repository.QueryFirst(x => x.MaterielCode == cabinOrderDetail.Goods_no);
                 if (materielInfo == null) return WebResponseContent.Instance.Error($"璇风淮鎶ょ墿鏂欑紪鍙枫�恵cabinOrderDetail.Goods_no}銆戠殑鐗╂枡淇℃伅");
                 cabinOrderDetail.Order_Outqty += supplyTask.SupplyQuantity;
-                if (cabinOrderDetail.Order_Outqty > cabinOrderDetail.Order_qty)
-                    return WebResponseContent.Instance.Error($"瀹炵洏鏁伴噺涓嶅彲瓒呭嚭璐﹂潰鏁伴噺");
+                #region 骞冲簱鐩樼偣鍙兘鍑虹幇鏁寸宸紓
+                if (supplyTask.WarehouseCode == WarehouseEnum.澶т欢搴�.ObjToInt().ToString("000") && materielInfo.MaterielSourceType != MaterielSourceTypeEnum.PurchasePart)
+                {
+                    var Qty = supplyTask.SupplyQuantity % materielInfo.BoxQty;
+                    if (Qty != 0) return WebResponseContent.Instance.Error($"澶т欢搴撳簱瀛樹负鏁寸锛佺洏鐐规暟閲忎笉鑳藉瓨鍦ㄦ暎浠�");
+                }
+                #endregion
 
-                #region 澶勭悊鍑哄簱鍗曪紝璐т綅锛屽簱瀛橈紝搴撳瓨鎵规淇℃伅
-                _unitOfWorkManage.BeginTran();
-
-                #region 鍑哄簱鍗�
+                #region 淇敼鐩樼偣鍗�
                 cabinOrder.OutStatus = "寮�濮�";
                 cabinOrderDetail.OotDetailStatus = "寮�濮�";
-                if (cabinOrderDetail.Order_Outqty == cabinOrderDetail.Order_qty)
-                {
-                    cabinOrderDetail.OotDetailStatus = "宸插畬鎴�";
-                    _deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(cabinOrderDetail, OperateTypeEnum.鑷姩瀹屾垚);
-                }
-                else
-                {
-                    _deliveryOrderDetailServices.Repository.UpdateData(cabinOrderDetail);
-                }
-                var cabinOrder1 = BaseDal.Db.Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == cabinOrder.Out_no && x.Out_type == "3").Includes(x => x.Details).First();
-                if (cabinOrder1.Details == null || cabinOrder1.Details.Count < 1) cabinOrder.OutStatus = "宸插畬鎴�";
-                if (cabinOrder.OutStatus == "宸插畬鎴�")
-                    Repository.DeleteAndMoveIntoHty(cabinOrder, OperateTypeEnum.鑷姩瀹屾垚);
-                else
-                    Repository.UpdateData(cabinOrder);
                 #endregion
 
                 #region 搴撳瓨
-                Dt_InventoryInfo inventoryInfo = _inventoryInfoService.Repository.QueryFirst(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no && x.LocationCode == LocationCode);
-                if (inventoryInfo == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌揣浣嶃�恵LocationCode}銆戠殑搴撳瓨淇℃伅");
-                inventoryInfo.StockQuantity = supplyTask.SupplyQuantity;
-                _inventoryInfoService.UpdateData(inventoryInfo);
-                #endregion
-
-                #region 浠诲姟璁板綍
-                _supplyTaskService.UpdateData(supplyTask);
-                #endregion
-
-                #region 搴撳瓨鎵规
-                Dt_Inventory_Batch inventory_Batch = _inventory_BatchServices.Repository.QueryFirst(x => x.BatchNo == inventoryInfo.BatchNo && x.MaterielCode == inventoryInfo.MaterielCode);
-                if (inventory_Batch != null)
+                List<Dt_Inventory_Batch> inventory_Batchs = _inventory_BatchServices.Repository.QueryData(x => cabinOrder.Details.Select(x => x.Goods_no).Contains(x.MaterielCode));
+                List<Dt_InventoryInfo> inventoryInfos = _inventoryInfoService.Repository.QueryData(x => cabinOrder.Details.Select(x => x.Goods_no).Contains(x.MaterielCode) && x.WarehouseCode == supplyTask.WarehouseCode && x.StockStatus == StockStatusEmun.鐩樼偣閿佸畾.ObjToInt());
+                Dt_InventoryInfo? inventoryInfo = new();
+                List<Dt_InventoryInfo> inventoryInfosDel = new List<Dt_InventoryInfo>();
+                if (supplyTask.WarehouseCode != WarehouseEnum.绔嬪簱.ObjToInt().ToString("000"))
                 {
-                    inventory_Batch.SupplyQuantity += supplyTask.SupplyQuantity;
-                    _inventory_BatchServices.UpdateData(inventory_Batch);
+                    inventoryInfo = inventoryInfos.FirstOrDefault(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no && x.LocationCode == supplyTask.LocationCode);
+                    if (inventoryInfo == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌揣浣嶃�恵LocationCode}銆戠殑搴撳瓨淇℃伅");
+                }
+                else
+                {
+                    inventoryInfo = inventoryInfos.FirstOrDefault(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no);
+                }
+                if (inventoryInfo == null) return WebResponseContent.Instance.Error($"鏈壘鍒扮珛搴撶殑搴撳瓨淇℃伅");
+                inventoryInfo.SupplyQuantity = supplyTask.SupplyQuantity - inventoryInfo.StockQuantity;
+                #endregion
+
+                List<Dt_SupplyTask> supplyTasks = _supplyTaskService.Repository.QueryData(x => x.OrderNo == supplyTask.OrderNo && x.TaskStatus == SupplyStatusEnum.NewCheck.ObjToInt() && x.TaskId != supplyTask.TaskId).ToList();//鏌ユ壘褰撳墠鐩樼偣鍗曠殑鐩樼偣浠诲姟
+                if (!supplyTasks.Where(x => cabinOrderDetail.Goods_no == x.MaterielCode && x.BatchNo == cabinOrderDetail.Batch_num).Any())
+                    cabinOrderDetail.OotDetailStatus = "宸插畬鎴�";
+                #region 鍒ゆ柇褰撳墠鐩樼偣鍗曚换鍔℃槸鍚﹀叏閮ㄥ畬鎴�
+                if (supplyTasks.Count < 1)
+                {
+                    #region 澶勭悊褰撳墠鐗╂枡鎵规鐨勫簱瀛樺拰鎵规淇℃伅
+                    Dt_Inventory_Batch inventory_Batch = inventory_Batchs.First(x => x.BatchNo == inventoryInfo.BatchNo && x.MaterielCode == inventoryInfo.MaterielCode);
+                    var SupplyQuantitys = inventoryInfos.Where(x => x.BatchNo == inventoryInfo.BatchNo && x.MaterielCode == inventoryInfo.MaterielCode).Sum(x => x.SupplyQuantity);
+                    if (SupplyQuantitys == 0)
+                    {
+                        foreach (var item in inventoryInfos.Where(x => x.BatchNo == inventoryInfo.BatchNo && x.MaterielCode == inventoryInfo.MaterielCode))
+                        {
+                            item.StockQuantity += item.SupplyQuantity;
+                            if (item.StockQuantity <= 0)
+                            {
+                                inventoryInfosDel.Add(item);
+                                continue;
+                            }
+                            item.AvailableQuantity = item.StockQuantity;
+                            item.SupplyQuantity = 0;
+                            item.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+                        }
+                        //inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity;
+                        //if (inventoryInfo.StockQuantity <= 0)
+                        //{
+                        //    inventoryInfosDel.Add(inventoryInfo);
+                        //    inventoryInfo = null;
+                        //}
+                        //else
+                        //{
+                        //    inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity;
+                        //    inventoryInfo.SupplyQuantity = 0;
+                        //    inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+                        //}
+                    }
+                    else
+                    {
+                        inventory_Batch.SupplyQuantity += SupplyQuantitys;
+                    }
+                    #endregion
+
+                    #region 澶勭悊鍏朵粬搴撳瓨鎵规鍜屽簱瀛�
+                    foreach (var detail in cabinOrder.Details.Where(x => x.Id != cabinOrderDetail.Id))
+                    {
+                        SupplyQuantitys = inventoryInfos.Where(x => x.BatchNo == detail.Batch_num && x.MaterielCode == detail.Goods_no).Sum(x => x.SupplyQuantity);//璁$畻鐩樼偣鎬绘暟
+                        inventory_Batch = inventory_Batchs.First(x => x.BatchNo == detail.Batch_num && x.MaterielCode == detail.Goods_no);
+                        #region 搴撳瓨鎵规
+                        if (SupplyQuantitys == 0)
+                        {
+                            foreach (var item in inventoryInfos.Where(x => x.BatchNo == detail.Batch_num && x.MaterielCode == detail.Goods_no))
+                            {
+                                item.StockQuantity += item.SupplyQuantity;
+                                if (item.StockQuantity <= 0)
+                                {
+                                    inventoryInfosDel.Add(item);
+                                    continue;
+                                }
+                                item.AvailableQuantity = item.StockQuantity;
+                                item.SupplyQuantity = 0;
+                                item.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+                            }
+                        }
+                        else
+                        {
+                            inventory_Batch.SupplyQuantity += SupplyQuantitys;
+                        }
+                        #endregion
+                    }
+                    #endregion
                 }
                 #endregion
+                _unitOfWorkManage.BeginTran();
+                #region 澶勭悊鐩樼偣鍗�
+                if (supplyTasks.Count < 1)
+                {
+                    #region 瀹屾垚鐩樼偣鍗�
+                    cabinOrder.OutStatus = "宸插畬鎴�";
+                    cabinOrder.Details.ForEach(x =>
+                    {
+                        x.OotDetailStatus = "宸插畬鎴�";
+                    });
+                    _deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(cabinOrder.Details, OperateTypeEnum.鑷姩瀹屾垚);
+                    cabinOrder.Details = null;
+                    BaseDal.DeleteAndMoveIntoHty(cabinOrder, OperateTypeEnum.鑷姩瀹屾垚);
 
-                _unitOfWorkManage.CommitTran();
+                    #endregion
+                }
+                else
+                {
+                    BaseDal.UpdateData(cabinOrder);
+                    _deliveryOrderDetailServices.Repository.UpdateData(cabinOrderDetail);
+                }
                 #endregion
-
+                //_inventoryInfoService.UpdateData(inventoryInfo);
+                _supplyTaskService.Repository.DeleteAndMoveIntoHty(supplyTask, OperateTypeEnum.鑷姩瀹屾垚);
+                _inventoryInfoService.UpdateData(inventoryInfos);
+                if (inventoryInfosDel.Count > 0) _inventoryInfoService.DeleteData(inventoryInfosDel);
+                _inventory_BatchServices.UpdateData(inventory_Batchs);
+                _unitOfWorkManage.CommitTran();
                 content.OK();
             }
             catch (Exception ex)

--
Gitblit v1.9.3