| | |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public void NEWAddStockChangeRecord(Dt_StockInfo stockInfo, List<Dt_StockInfoDetail> stockInfoDetails, decimal beforeQuantity, decimal totalQuantity, StockChangeType changeType, int? taskNum = null) |
| | | { |
| | | try |
| | | { |
| | | List<Dt_StockQuantityChangeRecord> stockQuantityChangeRecords = new List<Dt_StockQuantityChangeRecord>(); |
| | | stockQuantityChangeRecords = _mapper.Map<List<Dt_StockQuantityChangeRecord>>(stockInfoDetails); |
| | | int index = 0; |
| | | decimal currentQuantity = 0; |
| | | stockQuantityChangeRecords.ForEach(x => |
| | | { |
| | | x.PalleCode = stockInfo.PalletCode; |
| | | x.BeforeQuantity = beforeQuantity; |
| | | if (totalQuantity <= beforeQuantity) |
| | | { |
| | | x.ChangeQuantity = stockInfoDetails[index].OutboundQuantity; |
| | | currentQuantity += stockInfoDetails[index].OutboundQuantity; |
| | | x.AfterQuantity = beforeQuantity - stockInfoDetails[index].OutboundQuantity ; |
| | | } |
| | | x.ChangeType = changeType.ObjToInt(); |
| | | beforeQuantity -= x.ChangeQuantity; |
| | | x.TaskNum = taskNum; |
| | | index++; |
| | | }); |
| | | BaseDal.AddData(stockQuantityChangeRecords); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |