huminmin
2026-06-01 d8e9abd9f92538d6baa44415ec7e096db5fea9b9
src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
@@ -14,6 +14,7 @@
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.project.system.service.ISysDictDataService;
import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
import com.ruoyi.stock.dto.StockInRecordDto;
@@ -60,6 +61,7 @@
    private final StockUninventoryService stockUninventoryService;
    private final SalesLedgerProductMapper salesLedgerProductMapper;
    private final ProductModelMapper productModelMapper;
    private final ISysDictDataService sysDictDataService;
    @Override
    public IPage<StockInventoryDto> pagestockInventory(Page page, StockInventoryDto stockInventoryDto) {
@@ -171,6 +173,7 @@
        stockInRecordDto.setRemark(stockInventoryDto.getRemark());
        stockInRecordDto.setWarnNum(stockInventoryDto.getWarnNum());
        stockInRecordDto.setCreateTime(stockInventoryDto.getCreateTime());
        stockInRecordDto.setWarehouse(stockInventoryDto.getWarehouse());
        stockInRecordService.add(stockInRecordDto);
        return true;
    }
@@ -315,6 +318,14 @@
            int successCount = 0;
            for (StockInventoryExportData dto : list) {
                // 验证仓库是否存在于字典中
                if (StringUtils.isNotEmpty(dto.getWarehouse())) {
                    String warehouseLabel = sysDictDataService.selectDictLabel("warehouse", dto.getWarehouse());
                    if (StringUtils.isEmpty(warehouseLabel)) {
                        throw new RuntimeException("仓库值 " + dto.getWarehouse() + " 不存在于字典中");
                    }
                }
                // 构建查找键
                String key = dto.getProductName() + "|" + dto.getModel();
                SalesLedgerProduct matchedProduct = productMap.get(key);
@@ -328,6 +339,7 @@
                        stockInventoryDto.setQualitity(dto.getQualifiedQuantity());
                        stockInventoryDto.setRemark(dto.getRemark());
                        stockInventoryDto.setWarnNum(dto.getWarnNum());
                        stockInventoryDto.setWarehouse(dto.getWarehouse());
                        // 验证合格冻结数量
                        if (ObjectUtils.isNotEmpty(dto.getQualifiedLockedQuantity())) {
@@ -351,6 +363,7 @@
                        stockUninventoryDto.setRecordType(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode());
                        stockUninventoryDto.setQualitity(dto.getUnQualifiedQuantity());
                        stockUninventoryDto.setRemark(dto.getRemark());
                        stockUninventoryDto.setWarehouse(dto.getWarehouse());
                        // 验证不合格冻结数量
                        if (ObjectUtils.isNotEmpty(dto.getUnQualifiedLockedQuantity())) {