From b0ed419ede8bd1829e670891ffe878630ba517e2 Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期一, 03 十一月 2025 17:57:32 +0800
Subject: [PATCH] 优化
---
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs | 44 ++++++++++++++++++++++++--------------------
1 files changed, 24 insertions(+), 20 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 9679eb4..7a2e10e 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"
@@ -44,14 +44,21 @@
{
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 = "20",
- 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()
{
@@ -66,7 +73,7 @@
Reservoirarea = items.Key
};
deliveryOrder.Details.Add(deliveryOrderDetail);
- deliveryOrders.Add(deliveryOrder);
+ if (isNull) deliveryOrders.Add(deliveryOrder);
#region 鍒涘缓鐩樼偣浠诲姟
foreach (var inventory in items)
{
@@ -250,7 +257,7 @@
{
inventoryInfo = _inventoryInfoService.Repository.QueryFirst(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no && x.WarehouseCode == supplyTask.WarehouseCode);
}
- inventoryInfo.SupplyQuantity = supplyTask.SupplyQuantity;
+ inventoryInfo.SupplyQuantity = supplyTask.SupplyQuantity - inventoryInfo.StockQuantity;
#endregion
#region 鍒ゆ柇褰撳墠鐗╂枡鎵规鐨勭洏鐐逛换鍔℃槸鍚﹀叏閮ㄥ畬鎴�
@@ -262,27 +269,27 @@
{
#region 鏌ユ壘搴撳瓨
inventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no && x.Id != inventoryInfo.Id);
- var SupplyQuantitys = inventoryInfos.Sum(x => x.SupplyQuantity) + supplyTask.SupplyQuantity;
+ var SupplyQuantitys = inventoryInfos.Sum(x => x.SupplyQuantity) + inventoryInfo.SupplyQuantity;//璁$畻鐩樼偣鎬绘暟
#endregion
#region 搴撳瓨鎵规
inventory_Batch = _inventory_BatchServices.Repository.QueryFirst(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no);
- //濡傛灉鐩樼偣鏁板拰鎵规鎬绘暟瀵逛笂浜嗭紝鐩樼偣鏁拌祴鍊间负0锛岃祴鍊煎氨娣诲姞鐩樼偣鏁�
- if (SupplyQuantitys == inventory_Batch.StockQuantity)
+
+ if (SupplyQuantitys == 0)
{
foreach (var item in inventoryInfos)
{
- item.StockQuantity = item.SupplyQuantity;
+ item.StockQuantity += item.SupplyQuantity;
item.SupplyQuantity = 0;
item.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
}
- inventoryInfo.StockQuantity = supplyTask.SupplyQuantity;
+ inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity;
inventoryInfo.SupplyQuantity = 0;
inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
}
else
{
- inventory_Batch.SupplyQuantity = SupplyQuantitys;
+ inventory_Batch.SupplyQuantity += SupplyQuantitys;
}
#endregion
}
@@ -310,11 +317,8 @@
#endregion
_inventoryInfoService.UpdateData(inventoryInfo);
_supplyTaskService.Repository.DeleteAndMoveIntoHty(supplyTask, OperateTypeEnum.鑷姩瀹屾垚);
- if (inventoryInfos.Count >= 1)
- {
- _inventoryInfoService.UpdateData(inventoryInfos);
- _inventory_BatchServices.UpdateData(inventory_Batch);
- }
+ _inventoryInfoService.UpdateData(inventoryInfos);
+ _inventory_BatchServices.UpdateData(inventory_Batch);
_unitOfWorkManage.CommitTran();
#endregion
content.OK();
--
Gitblit v1.9.3