From 1e12c140c041c0cb52306a0db9ff0ba18354d0d8 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期四, 03 四月 2025 18:01:52 +0800
Subject: [PATCH] 优化WMS前端首页,货位查询column数据库关键字处理
---
项目代码/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Base/OutboundOrderDetailService.cs | 71 +++++++++++++++++++++++++++++++++++
1 files changed, 70 insertions(+), 1 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Base/OutboundOrderDetailService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Base/OutboundOrderDetailService.cs"
index d7ef4d1..2226aea 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Base/OutboundOrderDetailService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Base/OutboundOrderDetailService.cs"
@@ -35,7 +35,7 @@
public IOutboundOrderDetailRepository Repository => BaseDal;
- public OutboundOrderDetailService(IOutboundOrderDetailRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockService stockService, IBasicService basicService, IRecordService recordService, IOutboundRepository outboundRepository, IOutStockLockInfoService outStockLockInfoService) : base(BaseDal)
+ public OutboundOrderDetailService(IOutboundOrderDetailRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockService stockService, IBasicService basicService, IRecordService recordService, IOutboundRepository outboundRepository, IOutStockLockInfoService outStockLockInfoService) : base(BaseDal)
{
_unitOfWorkManage = unitOfWorkManage;
_stockService = stockService;
@@ -44,5 +44,74 @@
_outboundRepository = outboundRepository;
_outStockLockInfoService = outStockLockInfoService;
}
+
+ public (List<Dt_StockInfo>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>, Dt_OutboundOrder) AssignStockOutbound(Dt_OutboundOrderDetail outboundOrderDetail)
+ {
+ Dt_OutboundOrder outboundOrder = _outboundRepository.OutboundOrderRepository.QueryFirst(x => x.Id == outboundOrderDetail.OrderId);
+ List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>();
+ List<string> LocationCodes = new List<string>();
+ List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>();
+ List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>();
+ return (outStocks, outStockLockInfos, locationInfos, outboundOrder);
+ }
+
+ public (List<Dt_StockInfo>, List<Dt_OutboundOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>, Dt_OutboundOrder) AssignStockOutbound(List<Dt_OutboundOrderDetail> outboundOrderDetails)
+ {
+ if (outboundOrderDetails.GroupBy(x => x.OrderId).Count() > 1)
+ {
+ throw new Exception($"璇峰嬁鍚屾椂鎿嶄綔澶氫釜鍗曟嵁鏄庣粏");
+ }
+ Dt_OutboundOrder outboundOrder = _outboundRepository.OutboundOrderRepository.QueryFirst(x => x.Id == outboundOrderDetails.FirstOrDefault().OrderId);
+ List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>();
+ List<string> LocationCodes = new List<string>();
+ List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>();
+ List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>();
+ foreach (var item in outboundOrderDetails)
+ {
+ var StockSelectViews = BaseDal.QueryTabs<Dt_StockInfo, Dt_StockInfoDetail, StockSelectViewDTO>((a, b) => a.Id == b.StockId, (a, b) => new StockSelectViewDTO
+ {
+ LocationCode = a.LocationCode,
+ MaterielCode = b.MaterielCode,
+ MaterielName = b.MaterielName,
+ PalletCode = a.PalletCode,
+ UseableQuantity = b.StockQuantity,
+ BatchNo = b.BatchNo,
+ InDate = a.InDate
+ }, a => a.StockStatus == StockStatusEmun.宸插叆搴�.ObjToInt(), b => b.Status == StockStatusEmun.宸插叆搴�.ObjToInt() && b.MaterielCode == item.MaterielCode, x => true).GroupBy(x => x.LocationCode).Select(x => new StockSelectViewDTO
+ {
+ LocationCode = x.FirstOrDefault()?.LocationCode ?? "",
+ MaterielCode = x.FirstOrDefault()?.MaterielCode ?? "",
+ MaterielName = x.FirstOrDefault()?.MaterielName ?? "",
+ //PalletCode = string.Join(",", x.Select(x => x.PalletCode).ToList()),
+ PalletCode = x.Select(x => x.PalletCode).ToList().Aggregate((i, j) => i + "," + j),
+ UseableQuantity = x.Sum(x => x.UseableQuantity),
+ BatchNo = x.FirstOrDefault()?.BatchNo ?? "",
+ InDate = x.FirstOrDefault()?.InDate
+ }).ToList();
+ if (StockSelectViews.Count < 1) throw new Exception($"鏈壘鍒板彲鍒嗛厤搴撳瓨");
+ StockSelectViewDTO? stockSelectView = StockSelectViews.Where(x => x.UseableQuantity == item.OrderQuantity)?.OrderBy(x => x.InDate).First();
+ if (stockSelectView == null)
+ {
+ throw new Exception($"鏈壘鍒板彲鍒嗛厤搴撳瓨");
+ }
+ item.LockQuantity = stockSelectView.UseableQuantity;
+ item.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt();
+ List<Dt_StockInfo> dt_StockInfos = _stockService.StockInfoService.Repository.QueryData(x => x.LocationCode == stockSelectView.LocationCode);
+ dt_StockInfos.ForEach(x =>
+ {
+ x.StockStatus = StockStatusEmun.鍑哄簱涓�.ObjToInt();
+ });
+ outboundOrder.OrderStatus = OutboundStatusEnum.鍑哄簱涓�.ObjToInt();
+ outStockLockInfos.AddRange(_outStockLockInfoService.GetOutStockLockInfo(outboundOrder, item, dt_StockInfos, BatchNo: stockSelectView.BatchNo));
+ outStocks.AddRange(dt_StockInfos);
+ LocationCodes.Add(stockSelectView.LocationCode);
+ }
+ locationInfos.AddRange(_basicService.LocationInfoService.Repository.GetLocationInfos(LocationCodes));
+ locationInfos.ForEach(x =>
+ {
+ x.LocationStatus = LocationStatusEnum.Outbounding.ObjToInt();
+ });
+ return (outStocks, outboundOrderDetails, outStockLockInfos, locationInfos, outboundOrder);
+ }
}
}
--
Gitblit v1.9.3