gongchunyi
4 小时以前 3481d209ec847542b73fa16616ffe0e13c949e80
src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
@@ -58,13 +58,15 @@
    @Transactional(rollbackFor = Exception.class)
    public Boolean addstockInventory(StockInventoryDto stockInventoryDto) {
        //新增入库记录再添加库存
        //  更新产品入库状态
        SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(stockInventoryDto.getSalesLedgerProductId());
        if (salesLedgerProduct == null) {
            throw new ServiceException("入库失败,销售产品不存在");
        //  更新订单产品入库状态(仅当传入了产品行ID时)
        if (stockInventoryDto.getSalesLedgerProductId() != null) {
            SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(stockInventoryDto.getSalesLedgerProductId());
            if (salesLedgerProduct == null) {
                throw new ServiceException("入库失败,销售产品不存在");
            }
            salesLedgerProduct.setProductStockStatus(1);
            salesLedgerProductMapper.updateById(salesLedgerProduct);
        }
        salesLedgerProduct.setProductStockStatus(1);
        salesLedgerProductMapper.updateById(salesLedgerProduct);
        StockInRecordDto stockInRecordDto = new StockInRecordDto();
        stockInRecordDto.setRecordId(stockInventoryDto.getRecordId());