| | |
| | | x.ChangeType = changeType.ObjToInt(); |
| | | beforeQuantity += x.ChangeQuantity; |
| | | x.TaskNum = taskNum; |
| | | index++; |
| | | }); |
| | | BaseDal.AddData(stockQuantityChangeRecords); |
| | | } |
| | |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public void AddStockChangeRecord(Dt_StockInfo stockInfo, List<Dt_StockInfoDetail> updateDetails, List<Dt_StockInfoDetail> deleteDetails, StockChangeTypeEnum changeType, int? taskNum = null) |
| | | { |
| | | try |
| | | { |
| | | List<Dt_StockQuantityChangeRecord> stockQuantityChangeRecords = new List<Dt_StockQuantityChangeRecord>(); |
| | | |
| | | int index1 = 0; |
| | | List<Dt_StockQuantityChangeRecord> records1 = _mapper.Map<List<Dt_StockQuantityChangeRecord>>(updateDetails); |
| | | records1.ForEach(x => |
| | | { |
| | | x.PalleCode = stockInfo.PalletCode; |
| | | x.BeforeQuantity = deleteDetails[index1].StockQuantity + deleteDetails[index1].OutboundQuantity; |
| | | x.ChangeQuantity = -deleteDetails[index1].OutboundQuantity; |
| | | x.AfterQuantity = deleteDetails[index1].StockQuantity; |
| | | index1++; |
| | | }); |
| | | stockQuantityChangeRecords.AddRange(records1); |
| | | int index2 = 0; |
| | | List<Dt_StockQuantityChangeRecord> records2 = _mapper.Map<List<Dt_StockQuantityChangeRecord>>(deleteDetails); |
| | | records2.ForEach(x => |
| | | { |
| | | x.PalleCode = stockInfo.PalletCode; |
| | | x.BeforeQuantity = deleteDetails[index2].StockQuantity; |
| | | x.ChangeQuantity = -deleteDetails[index2].StockQuantity; |
| | | x.AfterQuantity = 0; |
| | | index2++; |
| | | }); |
| | | stockQuantityChangeRecords.AddRange(records2); |
| | | |
| | | BaseDal.AddData(stockQuantityChangeRecords); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |