16 小时以前 7782a7e1191a0e98ffb20bca8b59248e98c556a8
src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java
@@ -80,17 +80,22 @@
        for (Long id : ids) {
            StockInRecord stockInRecord = stockInRecordMapper.selectById(id);
            if (stockInRecord.getType().equals("0")) {
                StockInventory stockInventory = stockInventoryMapper.selectOne(new LambdaQueryWrapper<StockInventory>().eq(StockInventory::getProductModelId, stockInRecord.getProductModelId()));
                StockInventory stockInventory = stockInventoryMapper.selectOne(new LambdaQueryWrapper<StockInventory>()
                        .eq(StockInventory::getProductModelId, stockInRecord.getProductModelId())
                        .eq(StockInventory::getStockLocation, stockInRecord.getStockLocation()));
                if (stockInventory == null) {
                    throw new BaseException("库存记录中没有对应的产品,无法删除!!!");
                }else {
                    StockInventoryDto stockInRecordDto = new StockInventoryDto();
                    stockInRecordDto.setProductModelId(stockInventory.getProductModelId());
                    stockInRecordDto.setQualitity(stockInRecord.getStockInNum());
                    stockInRecordDto.setStockLocation(stockInRecord.getStockLocation());
                    stockInventoryMapper.updateSubtractStockInventory(stockInRecordDto);
                }
            }else if (stockInRecord.getType().equals("1")) {
                StockUninventory stockUninventory = stockUninventoryMapper.selectOne(new LambdaQueryWrapper<StockUninventory>().eq(StockUninventory::getProductModelId, stockInRecord.getProductModelId()));
                StockUninventory stockUninventory = stockUninventoryMapper.selectOne(new LambdaQueryWrapper<StockUninventory>()
                        .eq(StockUninventory::getProductModelId, stockInRecord.getProductModelId())
                        .eq(StockUninventory::getStockLocation, stockInRecord.getStockLocation()));
                if (stockUninventory == null) {
                    throw new BaseException("库存记录中没有对应的产品,无法删除!!!");
                }else {
@@ -136,9 +141,12 @@
        if (ObjectUtils.isEmpty(oldStockInventory)) {
            stockInventoryMapper.insert(newStockInventory);
        }else {
            StockInventoryDto oldStockInventoryDto = new StockInventoryDto();
            BeanUtils.copyProperties(oldStockInventory, oldStockInventoryDto);
            stockInventoryMapper.updateAddStockInventory(oldStockInventoryDto);
            StockInventoryDto stockInventoryDto = new StockInventoryDto();
            stockInventoryDto.setProductModelId(stockInRecordDto.getProductModelId());
            stockInventoryDto.setQualitity(stockInRecordDto.getActualStockInNum() == null ? stockInRecordDto.getWaitAuditNum() : stockInRecordDto.getActualStockInNum());
            stockInventoryDto.setRemark(stockInRecordDto.getRemark());
            stockInventoryDto.setStockLocation(stockInRecordDto.getStockLocation());
            stockInventoryMapper.updateAddStockInventory(stockInventoryDto);
        }
        stockInRecordDto.setStatus(2);
        stockInRecordDto.setStockInNum(stockInRecordDto.getActualStockInNum() == null ? stockInRecordDto.getWaitAuditNum() : stockInRecordDto.getActualStockInNum());