| | |
| | | <select id="selectSalesLedgerProductList" resultType="com.ruoyi.sales.pojo.SalesLedgerProduct"> |
| | | SELECT |
| | | T1.*, |
| | | T3.material_code, |
| | | CASE |
| | | WHEN (IFNULL(t2.qualitity, 0) - IFNULL(t2.locked_quantity, 0)) >= IFNULL(T1.quantity, 0) THEN 1 |
| | | ELSE 0 |
| | |
| | | FROM |
| | | sales_ledger_product T1 |
| | | LEFT JOIN stock_inventory t2 ON T1.product_model_id = t2.product_model_id |
| | | LEFT JOIN product_model T3 ON T1.product_model_id = T3.id |
| | | <where> |
| | | <if test="salesLedgerProduct.salesLedgerId != null"> |
| | | AND T1.sales_ledger_id = #{salesLedgerProduct.salesLedgerId} |
| | |
| | | slp.product_category AS productCategory, |
| | | slp.specification_model AS specificationModel, |
| | | sl.supplier_name AS supplierName, |
| | | pm.material_code AS materialCode, |
| | | SUM(slp.quantity) AS purchaseNum, |
| | | SUM(slp.tax_inclusive_total_price) AS purchaseAmount, |
| | | COUNT(DISTINCT slp.sales_ledger_id) AS purchaseTimes, |
| | |
| | | FROM sales_ledger_product slp |
| | | <!-- 关联台账主表:获取录入日期entry_date --> |
| | | LEFT JOIN purchase_ledger sl ON slp.sales_ledger_id = sl.id |
| | | <!-- 关联产品型号表:获取料号material_code --> |
| | | LEFT JOIN product_model pm ON pm.id = slp.product_model_id |
| | | <!-- 采购日期筛选:可选条件 --> |
| | | WHERE slp.type = 2 <!-- 固定筛选:采购台账(type=2) --> |
| | | <!-- 采购日期筛选:可选条件 --> |
| | | <if test="req.entryDateStart != null and req.entryDateEnd != null"> |