liding
5 小时以前 4d1bd63eada739fdef9a05839c90a7b564fa2dab
feat:发货和销售数量查询
已修改5个文件
66 ■■■■ 文件已修改
src/main/java/com/ruoyi/sales/dto/InvoiceLedgerDto.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/mapper/ReceiptPaymentMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sales/InvoiceLedgerMapper.xml 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sales/ReceiptPaymentMapper.xml 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/dto/InvoiceLedgerDto.java
@@ -61,8 +61,11 @@
    private String specificationModel;
    @ApiModelProperty(value = "已发货")
    private String shippedQuantity;
    private BigDecimal shippedQuantity;
    @ApiModelProperty(value = "未发货")
    private String unshippedQuantity;
    private BigDecimal unshippedQuantity;
    @ApiModelProperty(value = "总数量")
    private BigDecimal totalQuantity;
}
src/main/java/com/ruoyi/sales/mapper/ReceiptPaymentMapper.java
@@ -21,6 +21,7 @@
    /**
     * 查询已经绑定发票的开票台账
     *
     * @param page
     * @param receiptPaymentDto
     * @return
@@ -29,6 +30,7 @@
    /**
     * 开票台账详情
     *
     * @param id
     * @return
     */
@@ -36,6 +38,7 @@
    /**
     * 计算前多少条数据回款金额综合
     *
     * @param customerId
     * @param total
     * @return
@@ -50,17 +53,19 @@
    /**
     * 查询回款记录分页
     */
    IPage<ReceiptPaymentDto> receiptPaymentHistoryListPage(Page page,@Param("params") ReceiptPaymentDto receiptPaymentDto);
    IPage<ReceiptPaymentDto> receiptPaymentHistoryListPage(Page page, @Param("params") ReceiptPaymentDto receiptPaymentDto);
    /**
     * 客户往来记录查询
     *
     * @param receiptPaymentDto
     * @return
     */
    List<CustomerInteractionDto> customerInteractions (ReceiptPaymentDto receiptPaymentDto);
    List<CustomerInteractionDto> customerInteractions(ReceiptPaymentDto receiptPaymentDto);
    /**
     * 客户回款记录查询
     *
     * @param invoiceLedgerDto
     * @return
     */
@@ -69,10 +74,11 @@
    /**
     * 查询回款记录不分页
     */
    List<ReceiptPaymentDto> receiptPaymentHistoryListNoPage( @Param("params") ReceiptPaymentDto receiptPaymentDto);
    List<ReceiptPaymentDto> receiptPaymentHistoryListNoPage(@Param("params") ReceiptPaymentDto receiptPaymentDto);
    /**
     * 通过开票登记产品id查询是否已经有回款记录
     *
     * @param invoiceRegistrationProductId
     * @return
     */
@@ -80,8 +86,8 @@
    List<ReceiptPaymentDto> bindInvoiceNoRegListAll();
    List<ReceiptPaymentExeclDto> bindInvoiceNoRegListByIds(List<Long> ids,Long tenantId);
    List<ReceiptPaymentExeclDto> bindInvoiceNoRegListByIds(List<Long> ids, Long tenantId);
    List<InvoiceLedgerDto> customerSalesInteractions(InvoiceLedgerDto receiptPaymentDto);
    List<InvoiceLedgerDto> customerSalesInteractions(@Param("ew") InvoiceLedgerDto receiptPaymentDto);
}
src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java
@@ -11,10 +11,7 @@
import com.ruoyi.sales.dto.InvoiceLedgerDto;
import com.ruoyi.sales.dto.ReceiptPaymentDto;
import com.ruoyi.sales.dto.ReceiptPaymentExeclDto;
import com.ruoyi.sales.mapper.InvoiceLedgerMapper;
import com.ruoyi.sales.mapper.ReceiptPaymentMapper;
import com.ruoyi.sales.mapper.SalesLedgerMapper;
import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
import com.ruoyi.sales.mapper.*;
import com.ruoyi.sales.pojo.ReceiptPayment;
import com.ruoyi.sales.pojo.SalesLedger;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
@@ -357,7 +354,6 @@
    @Override
    public List<InvoiceLedgerDto> customerSalesInteractions(InvoiceLedgerDto receiptPaymentDto) {
        receiptPaymentDto.getCustomerId();
        return receiptPaymentMapper.customerSalesInteractions(receiptPaymentDto);
    }
}
src/main/resources/mapper/sales/InvoiceLedgerMapper.xml
@@ -111,19 +111,20 @@
    <select id="invoiceLedgerSalesAccount" resultType="com.ruoyi.sales.dto.InvoiceLedgerDto">
        SELECT
        T1.customer_id AS id,
        T1.customer_name,
        SUM(contract_amount) AS invoice_total,
        c.id AS id,
        c.customer_name,
        IFNULL(SUM(T1.contract_amount), 0) AS invoice_total,
        IFNULL(SUM(T2.receipt_payment_amount), 0) AS receipt_payment_amount,
        IFNULL(SUM(contract_amount), 0) - IFNULL(SUM(T2.receipt_payment_amount), 0) AS unReceipt_payment_amount
        FROM sales_ledger T1
        IFNULL(SUM(T1.contract_amount), 0) - IFNULL(SUM(T2.receipt_payment_amount), 0) AS unReceipt_payment_amount
        FROM customer c
        LEFT JOIN sales_ledger T1 ON c.id = T1.customer_id
        LEFT JOIN receipt_payment T2 ON T1.id = T2.sales_ledger_id
        <where>
            <if test="invoiceLedgerDto.searchText != null and invoiceLedgerDto.searchText != '' ">
                T1.customer_name LIKE CONCAT ('%',#{invoiceLedgerDto.searchText},'%')
                c.customer_name LIKE CONCAT ('%',#{invoiceLedgerDto.searchText},'%')
            </if>
        </where>
        GROUP BY T1.customer_id, T1.customer_name
        GROUP BY c.id, c.customer_name
    </select>
    <select id="invoiceLedgerProductInfo" resultType="com.ruoyi.sales.dto.InvoiceRegistrationProductDto">
src/main/resources/mapper/sales/ReceiptPaymentMapper.xml
@@ -451,4 +451,26 @@
        GROUP BY T1.id, T1.sales_contract_no, T1.contract_amount, T2.receipt_payment_date
    </select>
    <select id="customerSalesInteractions" resultType="com.ruoyi.sales.dto.InvoiceLedgerDto">
        SELECT
            wr.receive_unit,
            wr.goods_name,
            wr.specification,
            wr.shippedQuantity,
            SUM(slp.quantity) AS totalQuantity,
            SUM(IFNULL(slp.quantity, 0)) - wr.shippedQuantity AS unshippedQuantity
        FROM
            (SELECT receive_unit, goods_name, specification, SUM(net_weight) AS shippedQuantity FROM weighing_record GROUP BY receive_unit, goods_name, specification) wr
                LEFT JOIN sales_ledger sl ON sl.customer_name = wr.receive_unit
                LEFT JOIN sales_ledger_product slp ON slp.sales_ledger_id = sl.id
                AND slp.product_category = wr.goods_name
                AND slp.specification_model = wr.specification
        WHERE
            sl.customer_id = #{ew.customerId}
        GROUP BY
            wr.receive_unit,
            wr.goods_name,
            wr.specification,
            wr.shippedQuantity
    </select>
</mapper>