| | |
| | | List<Dt_StockInfo> notStocks = new List<Dt_StockInfo>(); ; |
| | | foreach (var dt_OutboundOrderDetail in dt_OutboundOrderDetails) |
| | | { |
| | | notStocks = stockInfos.Where(x => x.Details.Any(x => x.BatchNo == dt_OutboundOrderDetail.BatchNo && x.MaterielCode == dt_OutboundOrderDetail.MaterielCode)).OrderBy(x => x.Id).ToList(); |
| | | notStocks = stockInfos.Where(x => x.Details.Any(x =>x.MaterielCode == dt_OutboundOrderDetail.MaterielCode)).OrderBy(x => x.Id).ToList(); |
| | | if (notStocks.Count > 0) |
| | | { |
| | | decimal stockTotalQuantity = stockInfos.SelectMany(x => x.Details).Where(d => d.BatchNo == dt_OutboundOrderDetail.BatchNo).Sum(v => v.StockQuantity - v.OutboundQuantity); |
| | | decimal stockTotalQuantity = stockInfos.SelectMany(x => x.Details).Where(d => d.MaterielCode == dt_OutboundOrderDetail.MaterielCode).Sum(v => v.StockQuantity - v.OutboundQuantity); |
| | | decimal needQuantity = dt_OutboundOrderDetail.OrderQuantity - dt_OutboundOrderDetail.LockQuantity; |
| | | if (stockTotalQuantity >= needQuantity)//库存够 |
| | | { |
| | |
| | | Dt_StockInfoDetail dt_StockInfoDetail = new Dt_StockInfoDetail(); |
| | | foreach (var detail in stockInfo.Details) |
| | | { |
| | | if (detail.BatchNo == dt_OutboundOrderDetail.BatchNo && detail.MaterielCode == dt_OutboundOrderDetail.MaterielCode) |
| | | if (detail.MaterielCode == dt_OutboundOrderDetail.MaterielCode) |
| | | { |
| | | dt_StockInfoDetail = detail; |
| | | } |
| | |
| | | { |
| | | stockInfo.Details.ForEach(x => |
| | | { |
| | | if (x.MaterielCode == dt_OutboundOrderDetail.MaterielCode && x.BatchNo == dt_OutboundOrderDetail.BatchNo) |
| | | if (x.MaterielCode == dt_OutboundOrderDetail.MaterielCode) |
| | | { |
| | | x.OutboundQuantity = x.StockQuantity; |
| | | } |
| | |
| | | |
| | | stockInfo.Details.ForEach(x => |
| | | { |
| | | if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == dt_OutboundOrderDetail.MaterielCode && x.BatchNo == dt_OutboundOrderDetail.BatchNo) |
| | | if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == dt_OutboundOrderDetail.MaterielCode) |
| | | { |
| | | if (x.StockQuantity - x.OutboundQuantity >= needQuantity) |
| | | { |
| | |
| | | decimal useableStockQuantity = 0; |
| | | foreach (var detail in stockInfo.Details) |
| | | { |
| | | if (detail.MaterielCode == dt_OutboundOrderDetail.MaterielCode && detail.BatchNo == dt_OutboundOrderDetail.BatchNo) |
| | | if (detail.MaterielCode == dt_OutboundOrderDetail.MaterielCode) |
| | | { |
| | | useableStockQuantity = detail.StockQuantity - detail.OutboundQuantity; |
| | | } |
| | |
| | | if (useableStockQuantity < needQuantity) |
| | | { |
| | | stockInfo.Details.ForEach(x => { |
| | | if (x.MaterielCode == dt_OutboundOrderDetail.MaterielCode && x.BatchNo == dt_OutboundOrderDetail.BatchNo) |
| | | if (x.MaterielCode == dt_OutboundOrderDetail.MaterielCode) |
| | | { |
| | | x.OutboundQuantity = x.StockQuantity; |
| | | } |
| | |
| | | { |
| | | stockInfo.Details.ForEach(x => |
| | | { |
| | | if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == dt_OutboundOrderDetail.MaterielCode && x.BatchNo == dt_OutboundOrderDetail.BatchNo) |
| | | if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == dt_OutboundOrderDetail.MaterielCode) |
| | | { |
| | | if (x.StockQuantity - x.OutboundQuantity >= needQuantity) |
| | | { |