From 04dc32710b622641d4e17ec903c698c65269e12c Mon Sep 17 00:00:00 2001 From: hutongqing <hutongqing@hnkhzn.com> Date: 星期二, 24 十二月 2024 08:58:13 +0800 Subject: [PATCH] 出库详情记录修改 --- /dev/null | 0 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs | 74 ++++++++++++++++-------- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService.cs | 24 ++++++++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs | 2 代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/b0fe0eb0-0200-46f6-a7cd-e7eceefa6c9f.vsidx | 0 代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/fc937dfc-f65e-4bef-aaa4-717ebb3be43e.vsidx | 0 代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/d1c62139-7bae-4df6-b13e-daefe3114894.vsidx | 0 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService_Pick.cs | 48 ++++++++++++++++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutStockLockInfoService.cs | 2 9 files changed, 123 insertions(+), 27 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/6fda0a96-bb99-45b9-93e3-b00b1e75fd10.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/6fda0a96-bb99-45b9-93e3-b00b1e75fd10.vsidx" deleted file mode 100644 index 5dc038e..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/6fda0a96-bb99-45b9-93e3-b00b1e75fd10.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/b0fe0eb0-0200-46f6-a7cd-e7eceefa6c9f.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/b0fe0eb0-0200-46f6-a7cd-e7eceefa6c9f.vsidx" new file mode 100644 index 0000000..ef77587 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/b0fe0eb0-0200-46f6-a7cd-e7eceefa6c9f.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/c54164b4-f861-4597-b950-670c51ba34ca.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/c54164b4-f861-4597-b950-670c51ba34ca.vsidx" deleted file mode 100644 index 56535a0..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/c54164b4-f861-4597-b950-670c51ba34ca.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/d1c62139-7bae-4df6-b13e-daefe3114894.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/d1c62139-7bae-4df6-b13e-daefe3114894.vsidx" new file mode 100644 index 0000000..70aef67 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/d1c62139-7bae-4df6-b13e-daefe3114894.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/fc937dfc-f65e-4bef-aaa4-717ebb3be43e.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/fc937dfc-f65e-4bef-aaa4-717ebb3be43e.vsidx" new file mode 100644 index 0000000..73a307b --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/fc937dfc-f65e-4bef-aaa4-717ebb3be43e.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutStockLockInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutStockLockInfoService.cs" index f8d11f6..3c29f2e 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutStockLockInfoService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutStockLockInfoService.cs" @@ -17,6 +17,8 @@ List<Dt_OutStockLockInfo> GetOutStockLockInfos(Dt_OutboundOrder outboundOrder, Dt_OutboundOrderDetail outboundOrderDetail, List<Dt_StockInfo> outStocks, int? taskNum = null); + Dt_OutStockLockInfo GetOutStockLockInfo(Dt_OutboundOrder outboundOrder, Dt_OutboundOrderDetail outboundOrderDetail, Dt_StockInfo outStock, float assignQuantity, int? taskNum = null); + List<Dt_OutStockLockInfo> GetByOrderDetailId(int orderDetailId, OutLockStockStatusEnum outStockStatus); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService.cs" index 4c9edb1..b3d0c99 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService.cs" @@ -48,6 +48,30 @@ return outStockLockInfos; } + public Dt_OutStockLockInfo GetOutStockLockInfo(Dt_OutboundOrder outboundOrder, Dt_OutboundOrderDetail outboundOrderDetail, Dt_StockInfo outStock, float assignQuantity, int? taskNum = null) + { + + Dt_OutStockLockInfo outStockLockInfo = new Dt_OutStockLockInfo() + { + PalletCode = outStock.PalletCode, + AssignQuantity = assignQuantity, + MaterielCode = outboundOrderDetail.MaterielCode, + BatchNo = outboundOrderDetail.BatchNo, + LocationCode = outStock.LocationCode, + MaterielName = outboundOrderDetail.MaterielName, + OrderDetailId = outboundOrderDetail.Id, + OrderNo = outboundOrder.OrderNo, + OrderType = outboundOrder.OrderType, + OriginalQuantity = outStock.Details.Where(x => x.MaterielCode == outboundOrderDetail.MaterielCode).Sum(x => x.StockQuantity), + Status = taskNum == null ? OutLockStockStatusEnum.宸插垎閰�.ObjToInt() : OutLockStockStatusEnum.鍑哄簱涓�.ObjToInt(), + StockId = outStock.Id, + TaskNum = taskNum, + OrderQuantity = outboundOrderDetail.OrderQuantity + }; + + return outStockLockInfo; + } + public List<Dt_OutStockLockInfo> GetByOrderDetailId(int orderDetailId, OutLockStockStatusEnum outStockStatus) { return BaseDal.QueryData(x => x.OrderDetailId == orderDetailId && x.Status == outStockStatus.ObjToInt()); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService_Pick.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService_Pick.cs" new file mode 100644 index 0000000..d682cdc --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService_Pick.cs" @@ -0,0 +1,48 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using WIDESEA_Common.StockEnum; +using WIDESEA_Core; +using WIDESEA_Core.BaseServices; +using WIDESEA_Core.Enums; +using WIDESEA_Core.Helper; +using WIDESEA_IOutboundRepository; +using WIDESEA_IStockService; +using WIDESEA_Model.Models; + +namespace WIDESEA_IOutboundService +{ + public partial class OutStockLockInfoService : ServiceBase<Dt_OutStockLockInfo, IOutStockLockInfoRepository>, IOutStockLockInfoService + { + IStockService _stockService; + + public WebResponseContent MaterialPick(string palletCode) + { + try + { + Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(palletCode); + if (stockInfo == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒拌鎵樼洏搴撳瓨淇℃伅"); + } + List<Dt_OutStockLockInfo> outStockLockInfos = Repository.QueryData(x => x.PalletCode == palletCode); + for (int i = 0; i < outStockLockInfos.Count; i++) + { + float assignQuantity = outStockLockInfos[i].AssignQuantity; + List<Dt_StockInfoDetail> stockInfoDetails = stockInfo.Details.Where(x => x.MaterielCode == outStockLockInfos[i].MaterielCode).ToList(); + for (int j = 0; j < stockInfoDetails.Count; j++) + { + // if(assignQuantity > stockInfoDetails[j]) + } + } + return WebResponseContent.Instance.OK(); + } + catch (Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" index f44093e..1c3fe6f 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" @@ -234,38 +234,52 @@ float needQuantity = originalNeedQuantity; List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(item.MaterielCode, item.BatchNo, outboundOrder.WarehouseId); + if (!stockInfos.Any()) + { + throw new Exception($"鏈壘鍒板彲鍒嗛厤搴撳瓨"); + } List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, item.MaterielCode, needQuantity, out float residueQuantity); item.LockQuantity += needQuantity - residueQuantity; outStocks.AddRange(autoAssignStocks); float assignQuantity = needQuantity - residueQuantity; - //for (int i = 0; i < outboundOrderDetails.Count; i++) - //{ - // for (int j = 0; j < outStocks.Count; j++) - // { - // if(assignQuantity > 0) - // { - // if (outboundOrderDetails[i].OrderQuantity - outboundOrderDetails[i].LockQuantity >= outStocks[j].) - // { - // } - // } - // } + List<Dt_OutboundOrderDetail> details = outboundOrderDetails.Where(x => !string.IsNullOrEmpty(x.BatchNo) ? x.BatchNo == item.BatchNo : true && x.MaterielCode == item.MaterielCode).ToList(); - // if (assignQuantity > 0 && outboundOrderDetails[i].LockQuantity < outboundOrderDetails[i].OrderQuantity) - // { - // outStockLockInfos.AddRange(_outStockLockInfoService.GetOutStockLockInfos(outboundOrder, outboundOrderDetails[i], outStocks)); - // if (outboundOrderDetails[i].OrderQuantity - outboundOrderDetails[i].LockQuantity >= assignQuantity) - // { - // outboundOrderDetails[i].LockQuantity += assignQuantity; - // break; - // } - // else - // { - // assignQuantity -= (outboundOrderDetails[i].OrderQuantity - outboundOrderDetails[i].LockQuantity); - // outboundOrderDetails[i].LockQuantity = outboundOrderDetails[i].OrderQuantity; - // } - // } - //} + for (int i = 0; i < details.Count; i++) + { + float orderQuantity = details[i].OrderQuantity; + for (int j = 0; j < autoAssignStocks.Count; j++) + { + float detailAssignQuantity = outStockLockInfos.Where(x => !string.IsNullOrEmpty(x.BatchNo) ? x.BatchNo == item.BatchNo : true && x.MaterielCode == item.MaterielCode && x.OrderDetailId == details[i].Id).Sum(x => x.AssignQuantity);//鍑哄簱璁㈠崟鏄庣粏宸插垎閰嶆暟閲� + + float palletAssignQuantity = outStockLockInfos.Where(x => x.BatchNo == item.BatchNo && x.MaterielCode == item.MaterielCode && x.PalletCode == autoAssignStocks[j].PalletCode).Sum(x => x.AssignQuantity);//鍑哄簱璇︽儏宸插垎閰嶆暟閲� + if (string.IsNullOrEmpty(item.BatchNo)) + { + palletAssignQuantity = outStockLockInfos.Where(x => x.MaterielCode == item.MaterielCode && x.PalletCode == autoAssignStocks[j].PalletCode).Sum(x => x.AssignQuantity);//鍑哄簱璇︽儏宸插垎閰嶆暟閲� + } + float palletOutboundQuantity = autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity); + if (palletAssignQuantity < palletOutboundQuantity)//濡傛灉鍑哄簱璇︽儏宸插垎閰嶆暟閲忓皬浜庢墭鐩樺凡鍒嗛厤鏁伴噺锛屽垯鍙互缁х画娣诲姞璇ユ墭鐩樺嚭搴撲俊鎭� + { + float orderDetailNeedQuantity = details[i].OrderQuantity - detailAssignQuantity; + if (orderDetailNeedQuantity > autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity) - palletAssignQuantity) + { + details[i].LockQuantity += autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity) - palletAssignQuantity; + Dt_OutStockLockInfo outStockLockInfo = _outStockLockInfoService.GetOutStockLockInfo(outboundOrder, details[i], autoAssignStocks[j], autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity) - palletAssignQuantity); + outStockLockInfos.Add(outStockLockInfo); + } + else + { + Dt_OutStockLockInfo outStockLockInfo = _outStockLockInfoService.GetOutStockLockInfo(outboundOrder, details[i], autoAssignStocks[j], details[i].OrderQuantity - details[i].LockQuantity); + outStockLockInfos.Add(outStockLockInfo); + details[i].LockQuantity = details[i].OrderQuantity; + break; + } + + } + } + } + + locationInfos.AddRange(_basicService.LocationInfoService.Repository.GetLocationInfos(outStocks.Select(x => x.LocationCode).ToList())); } @@ -385,6 +399,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(); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs" index 671db48..2a23123 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs" @@ -43,7 +43,7 @@ builder.Services.AddWebSocketSetup(); builder.Services.AddSqlsugarSetup();//SqlSugar 启动服务 builder.Services.AddDbSetup();//Db 启动服务 -builder.Services.AddInitializationHostServiceSetup();//应用初始化服务注入 +//builder.Services.AddInitializationHostServiceSetup();//应用初始化服务注入 builder.Services.AddHostedService<PermissionDataHostService>();//应用初始化服务注入 builder.Services.AddAutoMapperSetup(); -- Gitblit v1.9.3