liding
14 小时以前 9f1c36a2ba4e13f9592bbf2e49afd95fd77cadfb
fix:1.仓储物流区分原材料/成品
2.生产订单/报工领料优化
已修改8个文件
87 ■■■■■ 文件已修改
src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sales/InvoiceLedgerMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sales/SalesLedgerProductMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/stock/StockInventoryMapper.xml 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java
@@ -277,7 +277,7 @@
        }
        // 如果有数据先加库存
        ProductOrder productOrder = productOrderMapper.selectById(productOrderDto.getId());
        if (productOrder != null) {
        if (productOrder.getDrawMaterials() != null) {
            List<DrawMaterialDto> materialDtoList = JSON.parseArray(productOrder.getDrawMaterials(), DrawMaterialDto.class);
            for (DrawMaterialDto drawMaterialDto : materialDtoList) {
                stockUtils.addStock(drawMaterialDto.getProductModelId(), drawMaterialDto.getRequisitionQty(), null, productOrderDto.getId(),
src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
@@ -246,7 +246,6 @@
                    throw new RuntimeException("生产订单不存在");
                }
                Product product = productMapper.selectById(productModel.getProductId());
                QualityInspect qualityInspect = new QualityInspect();
                qualityInspect.setProductId(product.getId());
src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
@@ -68,7 +68,7 @@
        if(!"已发货".equals(byId.getStatus())){
            SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(byId.getSalesLedgerProductId());
            stockUtils.substractStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(),
                    StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId(),null,null
                    StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId(),salesLedgerProduct.getBatchNo(),salesLedgerProduct.getCustomer()
            );
        }
        byId.setExpressNumber(req.getExpressNumber());
src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java
@@ -45,4 +45,5 @@
    private Long productId;      // 产品ID
    private Long parentId;  // 父级产品ID
    private Long productModelId;   // 产品型号ID
    private String productScope;  //产品类型
}
src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml
@@ -206,7 +206,7 @@
        T1.supplier_name,
        SUM(contract_amount) AS invoiceAmount,
        IFNULL( SUM(T2.current_payment_amount) , 0 ) AS paymentAmount,
        IFNULL((IFNULL(SUM(contract_amount),0)  - IFNULL(SUM(T2.current_payment_amount),0)),0) AS payableAmount,
        IFNULL((IFNULL(SUM(contract_amount),0) - IFNULL(SUM(T2.current_payment_amount),0)),0) AS payableAmount,
        T1.purchase_contract_number,
        T2.payment_date
        FROM purchase_ledger T1
@@ -217,7 +217,11 @@
                T1.supplier_name LIKE CONCAT ('%',#{req.supplierName},'%')
            </if>
        </where>
        GROUP BY  T1.purchase_contract_number,T2.payment_date
        GROUP BY
        T1.supplier_id,
        T1.supplier_name,
        T1.purchase_contract_number,
        T2.payment_date
    </select>
</mapper>
src/main/resources/mapper/sales/InvoiceLedgerMapper.xml
@@ -115,7 +115,7 @@
            T1.customer_name,
            SUM(contract_amount) AS invoice_total,
            IFNULL( SUM(T2.receipt_payment_amount) , 0 ) AS receipt_payment_amount,
            IFNULL((IFNULL(SUM(contract_amount),0)  - IFNULL(SUM(T2.receipt_payment_amount),0)),0) AS unReceipt_payment_amount
            IFNULL((IFNULL(SUM(contract_amount),0) - IFNULL(SUM(T2.receipt_payment_amount),0)),0) AS unReceipt_payment_amount
        FROM sales_ledger T1
        LEFT JOIN receipt_payment T2 ON T1.id = T2.sales_ledger_id
        <where>
@@ -123,7 +123,7 @@
                T1.customer_name LIKE CONCAT ('%',#{invoiceLedgerDto.searchText},'%')
            </if>
        </where>
        GROUP BY T1.customer_name
        GROUP BY T1.customer_id, T1.customer_name
    </select>
    <select id="invoiceLedgerProductInfo" resultType="com.ruoyi.sales.dto.InvoiceRegistrationProductDto">
src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -127,8 +127,10 @@
        <if test="req.productCategory != null and req.productCategory != ''">
            AND slp.product_category = #{req.productCategory}
        </if>
        <!-- 按产品大类分组聚合 -->
        GROUP BY slp.product_category
        GROUP BY
        slp.product_category,
        slp.specification_model,
        sl.supplier_name
        <!-- 按产品大类排序 -->
        ORDER BY slp.product_category
    </select>
src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -52,29 +52,52 @@
        where product_model_id = #{ew.productModelId} and qualitity >= #{ew.qualitity}
    </update>
    <select id="pagestockInventory" resultType="com.ruoyi.stock.dto.StockInventoryDto">
        select si.id,
        SELECT
        si.id,
        si.qualitity,
        COALESCE(si.locked_quantity, 0) as locked_quantity,
        COALESCE(si.locked_quantity, 0) AS locked_quantity,
        si.product_model_id,
        si.create_time,
        si.update_time,
        COALESCE(si.warn_num, 0) as warn_num,
        COALESCE(si.warn_num, 0) AS warn_num,
        si.version,
        (si.qualitity - COALESCE(si.locked_quantity, 0)) as un_locked_quantity,
        (si.qualitity - COALESCE(si.locked_quantity, 0)) AS un_locked_quantity,
        pm.model,
        si.remark,
        pm.unit,
        pm.uid_no as uidNo,
        pm.uid_no AS uidNo,
        p.product_name,
        si.batch_no,
        si.customer
        from stock_inventory si
        left join product_model pm on si.product_model_id = pm.id
        left join product p on pm.product_id = p.id
        where 1 = 1
        <if test="ew.productName != null and ew.productName !=''">
            and p.product_name like concat('%',#{ew.productName},'%')
        </if>
        FROM
        stock_inventory si
        LEFT JOIN product_model pm ON si.product_model_id = pm.id
        LEFT JOIN product p ON pm.product_id = p.id
        LEFT JOIN product p1 ON p.parent_id = p1.id
        <where>
            <if test="ew.productName != null and ew.productName != ''">
                AND p.product_name LIKE CONCAT('%', #{ew.productName}, '%')
            </if>
            <if test="ew.model != null and ew.model != ''">
                AND pm.model LIKE CONCAT('%', #{ew.model}, '%')
            </if>
            <if test="ew.uidNo != null and ew.uidNo != ''">
                AND pm.uid_no LIKE CONCAT('%', #{ew.uidNo}, '%')
            </if>
            <if test="ew.batchNo != null and ew.batchNo != ''">
                AND si.batch_no LIKE CONCAT('%', #{ew.batchNo}, '%')
            </if>
            <if test="ew.productScope != null and ew.productScope != ''">
                <choose>
                    <when test="ew.productScope == '成品'">
                        AND p1.product_name = #{ew.productScope}
                    </when>
                    <otherwise>
                        AND p1.product_name != '成品'
                    </otherwise>
                </choose>
            </if>
        </where>
    </select>
    <select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockInventoryExportData">
        select si.qualitity,
@@ -283,14 +306,14 @@
        LEFT JOIN product_model pm ON si.product_model_id = pm.id
        LEFT JOIN product p ON pm.product_id = p.id
        LEFT JOIN product p1 ON p1.id = p.parent_id
        WHERE
            p1.product_name = '原材料';
        <if test="ew.batchNo != null and ew.batchNo !=''">
            and si.batch_no like concat('%',#{ew.batchNo},'%')
        </if>
        <if test="ew.customer != null and ew.customer !=''">
            and si.customer like concat('%',#{ew.customer},'%')
        </if>
        <where>
            <if test="ew.batchNo != null and ew.batchNo !=''">
                and si.batch_no like concat('%',#{ew.batchNo},'%')
            </if>
            <if test="ew.customer != null and ew.customer !=''">
                and si.customer like concat('%',#{ew.customer},'%')
            </if>
        </where>
    </select>
    <select id="getStockInventoryAll" resultType="com.ruoyi.stock.dto.StockInventoryDto">