huminmin
10 小时以前 ba4f2ca4b3ae845d2bd1e92338b948a8f95ffaaa
修改废品入库类型
已修改3个文件
20 ■■■■■ 文件已修改
src/main/java/com/ruoyi/stock/pojo/StockInRecord.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/stock/service/impl/StockUninventoryServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/stock/pojo/StockInRecord.java
@@ -46,7 +46,7 @@
    @Schema(description = "预警数量")
    private BigDecimal warnNum;
    @Schema(description = "类型  0合格入库 1不合格入库")
    @Schema(description = "类型  0合格入库 1不合格入库 2废品入库")
    private String type;
    @Schema(description = "创建时间")
src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java
@@ -104,8 +104,8 @@
                    stockInRecordDto.setQualitity(stockInRecord.getStockInNum());
                    stockInventoryMapper.updateSubtractStockInventory(stockInRecordDto);
                }
            }else if (stockInRecord.getType().equals("1")) {
                String uninventoryType = resolveUninventoryTypeByInRecordType(stockInRecord.getRecordType());
            }else if (stockInRecord.getType().equals("1") || stockInRecord.getType().equals("2")) {
                String uninventoryType = resolveUninventoryTypeByInRecordType(stockInRecord.getType());
                LambdaQueryWrapper<StockUninventory> eq = new LambdaQueryWrapper<StockUninventory>()
                        .eq(StockUninventory::getProductModelId, stockInRecord.getProductModelId())
                        .eq(StockUninventory::getType, uninventoryType);
@@ -278,9 +278,9 @@
                    } else {
                        stockInventoryMapper.updateAddStockInventory(stockInventoryDto);
                    }
                } else if ("1".equals(stockInRecord.getType())) {
                } else if ("1".equals(stockInRecord.getType()) || "2".equals(stockInRecord.getType())) {
                    // 不合格入库 -> 先查库存,存在则更新,不存在则新增
                    String uninventoryType = resolveUninventoryTypeByInRecordType(stockInRecord.getRecordType());
                    String uninventoryType = resolveUninventoryTypeByInRecordType(stockInRecord.getType());
                    StockUninventory stockUninventory = getStockUninventory(stockInRecord.getProductModelId(), stockInRecord.getBatchNo(), uninventoryType);
                    StockUninventoryDto stockUninventoryDto = new StockUninventoryDto();
                    stockUninventoryDto.setProductModelId(stockInRecord.getProductModelId());
@@ -310,8 +310,8 @@
        return items.size();
    }
    private String resolveUninventoryTypeByInRecordType(String recordType) {
        if (StockInQualifiedRecordTypeEnum.PRODUCTION_SCRAP.getCode().equals(recordType)) {
    private String resolveUninventoryTypeByInRecordType(String stockInType) {
        if ("2".equals(stockInType)) {
            return WASTE_TYPE;
        }
        return UNQUALIFIED_TYPE;
src/main/java/com/ruoyi/stock/service/impl/StockUninventoryServiceImpl.java
@@ -86,7 +86,11 @@
        stockInRecordDto.setStockInNum(stockUninventoryDto.getQualitity());
        stockInRecordDto.setBatchNo(stockUninventoryDto.getBatchNo());
        stockInRecordDto.setProductModelId(stockUninventoryDto.getProductModelId());
        stockInRecordDto.setType("1");
        if (UNQUALIFIED_TYPE.equals(inventoryType)) {
            stockInRecordDto.setType("1");
        } else {
            stockInRecordDto.setType("2");
        }
        stockInRecordDto.setManufacturerId(stockUninventoryDto.getManufacturerId());
        stockInRecordDto.setSource(stockUninventoryDto.getSource());
        stockInRecordService.add(stockInRecordDto);