src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
@@ -55,13 +55,15 @@
    @Transactional(rollbackFor = Exception.class)
    public Boolean addstockInventory(StockInventoryDto stockInventoryDto) {
        //新增入库记录再添加库存
        StockInRecordDto stockInRecordDto = new StockInRecordDto();
        stockInRecordDto.setRecordId(stockInventoryDto.getRecordId());
        stockInRecordDto.setRecordType(stockInventoryDto.getRecordType());
        stockInRecordDto.setStockInNum(stockInventoryDto.getQualitity());
        stockInRecordDto.setProductModelId(stockInventoryDto.getProductModelId());
        stockInRecordDto.setType("0");
        stockInRecordService.add(stockInRecordDto);
        if (stockInventoryDto.getRecordType() != null) {
            StockInRecordDto stockInRecordDto = new StockInRecordDto();
            stockInRecordDto.setRecordId(stockInventoryDto.getRecordId());
            stockInRecordDto.setRecordType(stockInventoryDto.getRecordType());
            stockInRecordDto.setStockInNum(stockInventoryDto.getQualitity());
            stockInRecordDto.setProductModelId(stockInventoryDto.getProductModelId());
            stockInRecordDto.setType("0");
            stockInRecordService.add(stockInRecordDto);
        }
        //再进行新增库存数量库存
        //先查询库存表中的产品是否存在,不存在新增,存在更新
        StockInventory oldStockInventory = stockInventoryMapper.selectOne(new QueryWrapper<StockInventory>().lambda().eq(StockInventory::getProductModelId, stockInventoryDto.getProductModelId()));
@@ -206,4 +208,9 @@
        stockInventory.setLockedQuantity(stockInventory.getLockedQuantity().subtract(stockInventoryDto.getLockedQuantity()));
        return this.updateById(stockInventory);
    }
    @Override
    public List<StockInventoryDto> getMaterials() {
        return stockInventoryMapper.getMaterials();
    }
}