From 75e3bca44b111c167b9389e4e51b2ce577a9f9e0 Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期日, 10 八月 2025 10:35:50 +0800
Subject: [PATCH] 优化更新
---
WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs
index a39efd8..0647c35 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs
@@ -137,7 +137,7 @@
decimal needQuantity = originalNeedQuantity;
- List<Dt_StockInfo> outStocks = _stockService.StockInfoService.Repository.GetStockInfosByPalletCode(stockSelectViews.Select(x => x.BatchNo).ToList());
+ List<Dt_StockInfo> outStocks = _stockService.StockInfoService.Repository.GetStockInfosByPalletCode(stockSelectViews.Select(x => x.PalletCode).ToList());
//List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(outboundOrder.MaterialCode, "", outboundOrder.WarehouseId);
if (!outStocks.Any())
@@ -165,7 +165,7 @@
if (outboundOrderDetail.OrderQuantity > outboundOrderDetail.LockQuantity)
{
List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(outboundOrderDetail.MaterielCode);
- stockInfos = stockInfos.Where(x => !stockSelectViews.Select(v => v.BatchNo).Contains(x.BatchNo)).ToList();
+ stockInfos = stockInfos.Where(x => !stockSelectViews.Select(v => v.PalletCode).Contains(x.PalletCode)).ToList();
List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, outboundOrderDetail.MaterielCode, needQuantity, out decimal residueQuantity);
outboundOrderDetail.LockQuantity += needQuantity - residueQuantity;
outStocks.AddRange(autoAssignStocks);
@@ -273,6 +273,14 @@
List<Dt_OutStockLockInfo> addOutStockLockInfos = outStockLockInfos.Where(x => x.Id == 0).ToList();
if (addOutStockLockInfos != null && addOutStockLockInfos.Any())
{
+ if (tasks != null)
+ {
+ addOutStockLockInfos.ForEach(x =>
+ {
+ x.TaskNum = tasks.FirstOrDefault(v => v.PalletCode == x.PalletCode)?.TaskNum;
+ });
+ }
+
_outStockLockInfoService.Repository.AddData(addOutStockLockInfos);
}
List<Dt_OutStockLockInfo> updateOutStockLockInfos = outStockLockInfos.Where(x => x.Id > 0).ToList();
@@ -311,7 +319,7 @@
Dt_OutboundOrder outboundOrder = _outboundRepository.OutboundOrderRepository.QueryFirst(x => x.Id == outboundOrderDetails.FirstOrDefault().OrderId);
List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>();
List<Dt_OutboundOrderDetail> groupDetails = outboundOrderDetails.GroupBy(x => new { x.MaterielCode, x.BatchNo }).Select(x => new Dt_OutboundOrderDetail { OrderQuantity = x.Sum(v => v.OrderQuantity) - x.Sum(v => v.LockQuantity), MaterielCode = x.Key.MaterielCode, BatchNo = x.Key.BatchNo }).ToList();
- Dt_Warehouse warehouse = _basicService.WarehouseService.Repository.QueryFirst(x => x.WarehouseCode == outboundOrder.OutWareHouse);
+ List<Dt_Warehouse> warehouse = _basicService.WarehouseService.Repository.QueryData(x => x.WarehouseDes == outboundOrder.OutWareHouse);
List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>();
List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>();
foreach (var item in groupDetails)
@@ -320,7 +328,7 @@
decimal needQuantity = originalNeedQuantity;
- List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(item.MaterielCode, item.BatchNo, warehouse.WarehouseId);
+ List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(item.MaterielCode, item.BatchNo, warehouse);
if (!stockInfos.Any())
{
throw new Exception($"鏈壘鍒板彲鍒嗛厤搴撳瓨");
--
Gitblit v1.9.3