| | |
| | | * @param recordType |
| | | * @param recordId |
| | | */ |
| | | public void substractStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId,String batchNo) { |
| | | public void substractStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId,String batchNo,Long stockId) { |
| | | StockInventoryDto stockInventoryDto = new StockInventoryDto(); |
| | | stockInventoryDto.setRecordId(recordId); |
| | | stockInventoryDto.setRecordType(String.valueOf(recordType)); |
| | |
| | | if (batchNo !=null && !batchNo.isEmpty()) { |
| | | stockInventoryDto.setBatchNo(batchNo); |
| | | } |
| | | stockInventoryDto.setStockId(stockId); |
| | | stockInventoryService.subtractStockInventory(stockInventoryDto); |
| | | } |
| | | |
| | |
| | | stockOutRecordService.batchDelete(idList); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 仅按recordId删除出库记录(用于recordType为动态值的场景) |
| | | */ |
| | | public void deleteStockOutRecordByRecordId(Long recordId) { |
| | | List<StockOutRecord> one = stockOutRecordService.list(new QueryWrapper<StockOutRecord>() |
| | | .lambda().eq(StockOutRecord::getRecordId, recordId)); |
| | | if (ObjectUtils.isNotEmpty(one)) { |
| | | List<Long> idList = one.stream() |
| | | .map(StockOutRecord::getId) |
| | | .collect(Collectors.toList()); |
| | | stockOutRecordService.batchDelete(idList); |
| | | } |
| | | } |
| | | } |