From 8efaf9f620920921bbaa6440ea34063c89f53d7a Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期二, 04 十一月 2025 15:15:23 +0800
Subject: [PATCH] 优化代码

---
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
index d1f49e4..38c98dd 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
@@ -317,7 +317,7 @@
                     _supplyTaskService.AddData(supplyTasks);
                     _inventory_BatchServices.UpdateData(batchesUp);
                     _inventoryInfoService.UpdateData(inventoryInfosUp);
-                    BaseDal.Db.CopyNew().InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand();
+                    BaseDal.Db.InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand();
                     _unitOfWorkManage.CommitTran();
                     #endregion
                 }
@@ -610,9 +610,9 @@
                         _inventory_BatchServices.UpdateData(batchesUp);
                         _inventoryInfoService.UpdateData(inventoryInfosUp);
                         if (entityOrder.Details.Count > 0)
-                            BaseDal.Db.CopyNew().InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand();
+                            BaseDal.Db.InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand();
                         if (entityOrderLK.Details.Count > 0)
-                            BaseDal.Db.CopyNew().InsertNav(entityOrderLK).Include(x => x.Details).ExecuteCommand();
+                            BaseDal.Db.InsertNav(entityOrderLK).Include(x => x.Details).ExecuteCommand();
                         _unitOfWorkManage.CommitTran();
                     }
                     catch (Exception ex)
@@ -954,9 +954,7 @@
             try
             {
                 // 1锔忊儯 鏌ユ壘鎸囧畾鎵规涓庣墿鏂欑殑搴撳瓨淇℃伅
-                var batchInfo = BaseDal.Db.CopyNew().Queryable<Dt_Inventory_Batch>()
-                    .Where(x => x.BatchNo == batchNo && x.MaterielCode == goodsNo)
-                    .First();
+                var batchInfo = _inventory_BatchServices.Repository.QueryFirst(x => x.BatchNo == batchNo && x.MaterielCode == goodsNo);
 
                 if (batchInfo == null)
                     return response.Error($"鏈壘鍒拌鐗╂枡 [{goodsNo}] 鎵规 [{batchNo}] 鐨勫簱瀛樹俊鎭�");
@@ -1176,7 +1174,7 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
-                Dt_DeliveryOrder? cabinOrder = BaseDal.Db.CopyNew().Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == supplyTask.OrderNo && x.Warehouse_no == supplyTask.WarehouseCode).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).Includes(x => x.Details).First();
                 if (cabinOrder == null) return WebResponseContent.Instance.OK($"鍑哄簱鍗曞凡瀹屾垚");
 
                 Dt_DeliveryOrderDetail? cabinOrderDetail = cabinOrder.Details.Where(x => x.Batch_num == supplyTask.BatchNo && x.Reservoirarea == supplyTask.WarehouseCode && x.Goods_no == supplyTask.MaterielCode).FirstOrDefault();
@@ -1200,7 +1198,7 @@
                     //_deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(cabinOrderDetail, OperateTypeEnum.鑷姩瀹屾垚);
                 }
                 _deliveryOrderDetailServices.Repository.UpdateData(cabinOrderDetail);
-                var cabinOrder1 = BaseDal.Db.CopyNew().Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == cabinOrder.Out_no && x.Warehouse_no == supplyTask.WarehouseCode && x.Out_type != "20").Includes(x => x.Details).First();
+                var cabinOrder1 = BaseDal.Db.Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == cabinOrder.Out_no && x.Warehouse_no == supplyTask.WarehouseCode && x.Out_type != "20").Includes(x => x.Details).First();
                 if (!cabinOrder1.Details.Where(x => x.OotDetailStatus != "宸插畬鎴�").Any())
                     cabinOrder.OutStatus = "宸插畬鎴�";
                 Repository.UpdateData(cabinOrder);

--
Gitblit v1.9.3