liding
2026-04-15 1d2d3760bef94013f80cae555bdcbfb2268929a2
src/main/java/com/ruoyi/stock/service/impl/StockUninventoryServiceImpl.java
@@ -53,17 +53,24 @@
        stockInRecordDto.setRecordType(stockUninventoryDto.getRecordType());
        stockInRecordDto.setStockInNum(stockUninventoryDto.getQualitity());
        stockInRecordDto.setProductModelId(stockUninventoryDto.getProductModelId());
        stockInRecordDto.setBatchNo(stockUninventoryDto.getBatchNo());
        stockInRecordDto.setCustomer(stockUninventoryDto.getCustomer());
        stockInRecordDto.setType("1");
        stockInRecordService.add(stockInRecordDto);
        //再进行新增库存数量库存
        //先查询库存表中的产品是否存在,不存在新增,存在更新
        StockUninventory oldStockUnInventory = stockUninventoryMapper.selectOne(new QueryWrapper<StockUninventory>().lambda().eq(StockUninventory::getProductModelId, stockUninventoryDto.getProductModelId()));
        StockUninventory oldStockUnInventory = stockUninventoryMapper.selectOne(new QueryWrapper<StockUninventory>().lambda().eq(StockUninventory::getProductModelId, stockUninventoryDto.getProductModelId())
                .eq(StockUninventory::getBatchNo, stockUninventoryDto.getBatchNo())
                .eq(StockUninventory::getCustomer, stockUninventoryDto.getCustomer()));
        if (ObjectUtils.isEmpty(oldStockUnInventory)) {
            StockUninventory newStockUnInventory = new StockUninventory();
            newStockUnInventory.setProductModelId(stockUninventoryDto.getProductModelId());
            newStockUnInventory.setQualitity(stockUninventoryDto.getQualitity());
            newStockUnInventory.setVersion(1);
            newStockUnInventory.setRemark(stockUninventoryDto.getRemark());
            newStockUnInventory.setBatchNo(stockUninventoryDto.getBatchNo());
            newStockUnInventory.setCustomer(stockUninventoryDto.getCustomer());
            newStockUnInventory.setProductionDate(stockUninventoryDto.getProductionDate());
            stockUninventoryMapper.insert(newStockUnInventory);
        }else {
            stockUninventoryMapper.updateAddStockUnInventory(stockUninventoryDto);
@@ -81,9 +88,13 @@
        stockOutRecordDto.setRecordType(stockUninventoryDto.getRecordType());
        stockOutRecordDto.setStockOutNum(stockUninventoryDto.getQualitity());
        stockOutRecordDto.setProductModelId(stockUninventoryDto.getProductModelId());
        stockOutRecordDto.setBatchNo(stockUninventoryDto.getBatchNo());
        stockOutRecordDto.setCustomer(stockUninventoryDto.getCustomer());
        stockOutRecordDto.setType("1");
        stockOutRecordService.add(stockOutRecordDto);
        StockUninventory oldStockInventory = stockUninventoryMapper.selectOne(new QueryWrapper<StockUninventory>().lambda().eq(StockUninventory::getProductModelId, stockUninventoryDto.getProductModelId()));
        StockUninventory oldStockInventory = stockUninventoryMapper.selectOne(new QueryWrapper<StockUninventory>().lambda().eq(StockUninventory::getProductModelId, stockUninventoryDto.getProductModelId())
                .eq(StockUninventory::getBatchNo, stockUninventoryDto.getBatchNo())
                .eq(StockUninventory::getCustomer, stockUninventoryDto.getCustomer()));
        if (ObjectUtils.isEmpty(oldStockInventory)) {
            throw new RuntimeException("产品库存不存在");
        }else {