huminmin
2026-06-01 d8e9abd9f92538d6baa44415ec7e096db5fea9b9
库存增加仓库
已添加1个文件
已修改8个文件
59 ■■■■■ 文件已修改
docs/大罗素.sql 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/stock/pojo/StockInRecord.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/stock/pojo/StockInventory.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/stock/pojo/StockUninventory.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/stock/StockInventoryMapper.xml 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/stock/StockUninventoryMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/´óÂÞËØ.sql
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
alter table stock_inventory
    add warehouse varchar(255)  null comment '仓库';
alter table stock_uninventory
    add warehouse varchar(255)  null comment '仓库';
alter table stock_in_record
    add warehouse varchar(255)  null comment '仓库';
src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java
@@ -22,6 +22,8 @@
    @Excel(name = "批号")
    private String batchNo;
    @Excel(name = "仓库")
    private String warehouse;
    @Excel(name = "合格库存数量")
    private BigDecimal qualifiedQuantity;
src/main/java/com/ruoyi/stock/pojo/StockInRecord.java
@@ -73,4 +73,7 @@
    @TableField(fill = FieldFill.INSERT)
    private Long deptId;
    @Schema(description = "仓库")
    private String warehouse;
}
src/main/java/com/ruoyi/stock/pojo/StockInventory.java
@@ -72,4 +72,7 @@
    @TableField(fill = FieldFill.INSERT)
    private Long deptId;
    @Schema(description = "仓库")
    private String warehouse;
}
src/main/java/com/ruoyi/stock/pojo/StockUninventory.java
@@ -68,4 +68,7 @@
    @TableField(fill = FieldFill.INSERT)
    private Long deptId;
    @Schema(description = "仓库")
    private String warehouse;
}
src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java
@@ -247,6 +247,7 @@
                            setBatchNo(stockInRecord.getBatchNo());
                            setRemark(stockInRecord.getRemark());
                            setWarnNum(stockInRecord.getWarnNum());
                            setWarehouse(stockInRecord.getWarehouse());
                            setVersion(1);
                        }});
                    } else {
@@ -266,6 +267,7 @@
                            setQualitity(stockInRecord.getStockInNum());
                            setBatchNo(stockInRecord.getBatchNo());
                            setRemark(stockInRecord.getRemark());
                            setWarehouse(stockInRecord.getWarehouse());
                            setVersion(1);
                        }});
                    } else {
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())) {
src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -31,6 +31,9 @@
            <if test="ew.lockedQuantity != null and ew.lockedQuantity !=''">
                locked_quantity = locked_quantity + #{ew.lockedQuantity},
            </if>
            <if test="ew.warehouse != null and ew.warehouse !=''">
                warehouse = #{ew.warehouse},
            </if>
            update_time = now()
        </set>
        where product_model_id = #{ew.productModelId}
@@ -65,6 +68,7 @@
    </update>
    <select id="pagestockInventory" resultType="com.ruoyi.stock.dto.StockInventoryDto">
        select si.id,
        si.warehouse,
        si.qualitity,
        COALESCE(si.locked_quantity, 0) as locked_quantity,
        si.product_model_id,
@@ -120,6 +124,7 @@
        unit,
        product_name,
        product_id,
        MAX(warehouse) as warehouse,
        'combined' as stockType
        from (
        select
@@ -142,6 +147,7 @@
        pm.unit,
        p.product_name,
        p.id as product_id,
        si.warehouse,
        (
        select IFNULL(SUM(sor.stock_out_num), 0)
        from stock_out_record sor
@@ -180,6 +186,7 @@
        pm.unit,
        p.product_name,
        p.id as product_id,
        su.warehouse,
        0 as qualifiedPendingOut,
        (
        select IFNULL(SUM(sor.stock_out_num), 0)
@@ -221,8 +228,9 @@
        model,
        unit,
        product_name,
        product_id
        order by combined.create_time desc
        product_id,
        warehouse
        order by create_time desc
    </select>
    <select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockInventoryExportData">
@@ -259,6 +267,7 @@
            unit,
            product_name,
            product_id,
            MAX(warehouse) as warehouse,
            'combined' as stockType
        from (
            select
@@ -281,6 +290,7 @@
            pm.unit,
            p.product_name,
            p.id as product_id,
            si.warehouse,
            (
                select IFNULL(SUM(sor.stock_out_num), 0)
                from stock_out_record sor
@@ -316,6 +326,7 @@
            pm.unit,
            p.product_name,
            p.id as product_id,
            su.warehouse,
            0 as qualifiedPendingOut,
            (
                select IFNULL(SUM(sor.stock_out_num), 0)
@@ -342,7 +353,7 @@
                and combined.product_id in (select id from product_tree)
            </if>
        </where>
        group by batch_no, product_model_id, model, unit, product_name, product_id
        group by batch_no, product_model_id, model, unit, product_name, product_id, warehouse
    </select>
    <select id="stockInventoryPage" resultType="com.ruoyi.stock.dto.StockInRecordDto">
        select sir.*,si.qualitity as current_stock,
@@ -562,6 +573,7 @@
        unit,
        product_name,
        product_id,
        MAX(warehouse) as warehouse,
        MAX(create_time) as create_time,
        MAX(update_time) as update_time,
@@ -593,6 +605,7 @@
        COALESCE(si.warn_num, 0) as warn_num,
        si.version,
        si.remark,
        si.warehouse,
        (
        select IFNULL(SUM(sor.stock_out_num), 0)
@@ -635,6 +648,7 @@
        0 as warn_num,
        su.version,
        su.remark,
        su.warehouse,
        0 as qualifiedPendingOut,
@@ -668,7 +682,8 @@
        model,
        unit,
        product_name,
        product_id
        product_id,
        warehouse
        order by
        batch_no
    </select>
src/main/resources/mapper/stock/StockUninventoryMapper.xml
@@ -50,6 +50,9 @@
            <if test="ew.remark != null and ew.remark !=''">
                remark = #{ew.remark},
            </if>
            <if test="ew.warehouse != null and ew.warehouse !=''">
                warehouse = #{ew.warehouse},
            </if>
            update_time = now()
        </set>
        where product_model_id = #{ew.productModelId}