| | |
| | | stockOutRecordDto.setType("0"); |
| | | stockOutRecordService.add(stockOutRecordDto); |
| | | StockInventory oldStockInventory = stockInventoryMapper.selectOne(new QueryWrapper<StockInventory>().lambda().eq(StockInventory::getProductModelId, stockInventoryDto.getProductModelId())); |
| | | if (ObjectUtils.isEmpty(oldStockInventory)) { |
| | | throw new RuntimeException("产品库存不存在"); |
| | | } |
| | | BigDecimal lockedQty = oldStockInventory.getLockedQuantity(); |
| | | if (lockedQty == null) { |
| | | lockedQty = BigDecimal.ZERO; |
| | |
| | | throw new RuntimeException("库存不足无法出库"); |
| | | } |
| | | |
| | | if (ObjectUtils.isEmpty(oldStockInventory)) { |
| | | throw new RuntimeException("产品库存不存在"); |
| | | } else { |
| | | stockInventoryMapper.updateSubtractStockInventory(stockInventoryDto); |
| | | } |
| | | stockInventoryMapper.updateSubtractStockInventory(stockInventoryDto); |
| | | return true; |
| | | } |
| | | |
| | |
| | | stockInventory.setLockedQuantity(stockInventory.getLockedQuantity().subtract(stockInventoryDto.getLockedQuantity())); |
| | | return this.updateById(stockInventory); |
| | | } |
| | | |
| | | @Override |
| | | public StockInventoryDto getStcokById(Long id) { |
| | | return stockInventoryMapper.getStcokById( id); |
| | | } |
| | | } |