From 8d341db9d2d5699d527c88c935f0c4ce255a57a4 Mon Sep 17 00:00:00 2001 From: hutongqing <hutongqing@hnkhzn.com> Date: 星期二, 10 十二月 2024 16:38:12 +0800 Subject: [PATCH] 代码提交 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs | 52 +++++----------------------------------------------- 1 files changed, 5 insertions(+), 47 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs" index 0fa3887..9203ffa 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs" @@ -23,53 +23,11 @@ { public partial class StockInfoService : ServiceBase<Dt_StockInfo, IStockInfoRepository>, IStockInfoService { - /// <summary> - /// 鏍规嵁鎵樼洏鍙锋煡璇㈠簱瀛� - /// </summary> - /// <param name="palletCode"></param> - /// <returns></returns> - public Dt_StockInfo? GetStockByPalletCode(string palletCode) - { - Dt_StockInfo stockInfo = BaseDal.QueryFirst(x => x.PalletCode == palletCode); - if (stockInfo != null) - { - stockInfo.Details = _stockRepository.StockInfoDetailRepository.QueryData(x => x.StockId == stockInfo.Id); - } - return stockInfo; - } - - public void AddMaterielGroup(Dt_StockInfo stockInfo) - { - decimal beforeQuantity = 0; - List<Dt_StockInfoDetail> details = new List<Dt_StockInfoDetail>(); - if (stockInfo.Id == 0) - { - BaseDal.Db.InsertNav(stockInfo).Include(x => x.Details).ExecuteCommand(); - details = stockInfo.Details; - } - else - { - beforeQuantity = stockInfo.Details.Where(x => x.Id != 0).Sum(x => x.StockQuantity); - - for (int i = 0; i < stockInfo.Details.Count; i++) - { - if (stockInfo.Details[i].Id == 0) - { - details.Add(_stockRepository.StockInfoDetailRepository.Db.Insertable(stockInfo.Details[i]).ExecuteReturnEntity()); - } - - } - - } - stockInfo.Details = details; - _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) + beforeQuantity, StockChangeTypeEnum.MaterielGroup,0); - } - - - public List<Dt_StockInfo> GetOutboundStocks(List<Dt_StockInfo> stockInfos, string materielCode, decimal needQuantity, out decimal residueQuantity) + + public List<Dt_StockInfo> GetOutboundStocks(List<Dt_StockInfo> stockInfos, string materielCode, float needQuantity, out float residueQuantity) { List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>(); - decimal stockTotalQuantity = stockInfos.Select(x => x.Details.Sum(v => v.StockQuantity - v.OutboundQuantity)).Sum(x => x); + float stockTotalQuantity = stockInfos.Select(x => x.Details.Sum(v => v.StockQuantity - v.OutboundQuantity)).Sum(x => x); stockInfos = stockInfos.OrderBy(x => x.Id).ToList(); if (stockTotalQuantity >= needQuantity)//搴撳瓨澶� { @@ -78,7 +36,7 @@ { Dt_StockInfo stockInfo = stockInfos[index]; - decimal useableStockQuantity = stockInfo.Details.Where(x => x.MaterielCode == materielCode).Sum(x => x.StockQuantity - x.OutboundQuantity); + float useableStockQuantity = stockInfo.Details.Where(x => x.MaterielCode == materielCode).Sum(x => x.StockQuantity - x.OutboundQuantity); if (useableStockQuantity < needQuantity) { stockInfo.Details.ForEach(x => x.OutboundQuantity = x.StockQuantity); @@ -112,7 +70,7 @@ for (int i = 0; i < stockInfos.Count; i++) { Dt_StockInfo stockInfo = stockInfos[i]; - decimal useableStockQuantity = stockInfo.Details.Where(x => x.MaterielCode == materielCode).Sum(x => x.StockQuantity - x.OutboundQuantity); + float useableStockQuantity = stockInfo.Details.Where(x => x.MaterielCode == materielCode).Sum(x => x.StockQuantity - x.OutboundQuantity); if (useableStockQuantity < needQuantity) { stockInfo.Details.ForEach(x => x.OutboundQuantity = x.StockQuantity); -- Gitblit v1.9.3