From bc43fe34a67fa68bcfb3a51b79308fad0be11c08 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 31 十月 2025 09:18:11 +0800
Subject: [PATCH] 优化定时器时长
---
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 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 edbeaf3..9883488 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"
@@ -71,6 +71,7 @@
WebResponseContent webResponseContent = new WebResponseContent();
try
{
+ _unitOfWorkManage.BeginTran();
Dt_Tactics tactics = _tacticsService.Repository.QueryFirst(x => x.TacticeName == "鍑哄簱绛栫暐");
#region 鐗规畩搴撴埧鍑哄簱
string WareCodeMJ = WarehouseEnum.楹荤簿搴�.ObjToInt().ToString("000");
@@ -98,7 +99,7 @@
Status = 2, // pad骞冲簱锛屾棤闇�鍚屾
}).ToList()
};
- BaseDal.Db.InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand();
+ BaseDal.Db.CopyNew().InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand();
#endregion
#region 澶勭悊搴撳瓨銆佸簱瀛樻壒娆°�佹坊鍔犲嚭搴撲换鍔�
List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
@@ -448,15 +449,17 @@
}
}
if (entityOrder.Details.Count > 0)
- BaseDal.Db.InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand();
+ BaseDal.Db.CopyNew().InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand();
if (entityOrderLK.Details.Count > 0)
- BaseDal.Db.InsertNav(entityOrderLK).Include(x => x.Details).ExecuteCommand();
+ BaseDal.Db.CopyNew().InsertNav(entityOrderLK).Include(x => x.Details).ExecuteCommand();
#endregion
}
+ _unitOfWorkManage.CommitTran();
webResponseContent.OK();
}
catch (Exception ex)
{
+ _unitOfWorkManage.RollbackTran();
webResponseContent.Error(ex.Message);
}
return webResponseContent;
@@ -469,6 +472,7 @@
WebResponseContent content = new WebResponseContent();
try
{
+ _unitOfWorkManage.BeginTran();
string WareCodeMJ = WarehouseEnum.楹荤簿搴�.ObjToInt().ToString("000");
string WareCodeLD = WarehouseEnum.鍐峰喕搴�.ObjToInt().ToString("000");
#region 鐗规畩搴撴埧
@@ -725,12 +729,15 @@
//Repository.AddData(entityOrder);
#endregion
}
- return WebResponseContent.Instance.OK("鎴愬姛");
+ //return WebResponseContent.Instance.OK("鎴愬姛");
}
}
+ _unitOfWorkManage.CommitTran();
+ return WebResponseContent.Instance.OK("鎴愬姛");
}
catch (Exception ex)
{
+ _unitOfWorkManage.RollbackTran();
content.Error(ex.Message);
}
return content;
@@ -745,7 +752,7 @@
try
{
// 1锔忊儯 鏌ユ壘鎸囧畾鎵规涓庣墿鏂欑殑搴撳瓨淇℃伅
- var batchInfo = BaseDal.Db.Queryable<Dt_Inventory_Batch>()
+ var batchInfo = BaseDal.Db.CopyNew().Queryable<Dt_Inventory_Batch>()
.Where(x => x.BatchNo == batchNo && x.MaterielCode == goodsNo)
.First();
@@ -887,7 +894,7 @@
WebResponseContent content = new WebResponseContent();
try
{
- 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();
+ 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();
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).FirstOrDefault();
@@ -911,7 +918,7 @@
//_deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(cabinOrderDetail, OperateTypeEnum.鑷姩瀹屾垚);
}
_deliveryOrderDetailServices.Repository.UpdateData(cabinOrderDetail);
- 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();
+ 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();
if (!cabinOrder1.Details.Where(x => x.OotDetailStatus != "宸插畬鎴�").Any())
cabinOrder.OutStatus = "宸插畬鎴�";
Repository.UpdateData(cabinOrder);
--
Gitblit v1.9.3