| | |
| | | //} |
| | | List<Barcodes> barcodesList = new List<Barcodes>(); |
| | | List<Dt_StockInfoDetail> stockInfoDetails = stockInfo.Details.Where((x => x.StockQuantity > x.OutboundQuantity)).ToList(); |
| | | |
| | | decimal itemQuantity = item.LockQuantity - item.OverOutQuantity; |
| | | |
| | | foreach (var stockDetail in stockInfoDetails) |
| | | { |
| | | if (item.LockQuantity - item.OverOutQuantity >= stockDetail.StockQuantity - stockInfoDetail.OutboundQuantity) |
| | | if (itemQuantity >= stockDetail.StockQuantity - stockDetail.OutboundQuantity) |
| | | { |
| | | Barcodes barcodes = new Barcodes |
| | | { |
| | | Barcode = stockDetail.Barcode, |
| | | Qty = stockDetail.StockQuantity - stockInfoDetail.OutboundQuantity, |
| | | Qty = stockDetail.StockQuantity - stockDetail.OutboundQuantity, |
| | | SupplyCode = stockDetail?.SupplyCode ?? "", |
| | | BatchNo = stockDetail?.BatchNo ?? "", |
| | | Unit = stockDetail?.Unit ?? "" |
| | | }; |
| | | |
| | | stockDetail.OutboundQuantity = stockInfoDetail.StockQuantity; |
| | | itemQuantity -= (stockDetail.StockQuantity - stockDetail.OutboundQuantity); |
| | | stockDetail.OutboundQuantity = stockDetail.StockQuantity; |
| | | barcodesList.Add(barcodes); |
| | | |
| | | if (itemQuantity <= 0) break; |
| | | } |
| | | else |
| | | { |
| | | Barcodes barcodes = new Barcodes |
| | | { |
| | | Barcode = stockDetail.Barcode, |
| | | Qty = item.LockQuantity - item.OverOutQuantity, |
| | | Qty = itemQuantity, |
| | | SupplyCode = stockDetail?.SupplyCode ?? "", |
| | | BatchNo = stockDetail?.BatchNo ?? "", |
| | | Unit = stockDetail?.Unit ?? "" |
| | | }; |
| | | stockInfoDetail.OutboundQuantity += item.LockQuantity - item.OverOutQuantity; |
| | | stockDetail.OutboundQuantity += itemQuantity; |
| | | barcodesList.Add(barcodes); |
| | | break; |
| | | } |
| | | } |
| | | |