| | |
| | | CASE |
| | | WHEN (IFNULL(t2.qualitity, 0) - IFNULL(t2.locked_quantity, 0)) >= IFNULL(T1.quantity, 0) THEN 1 |
| | | ELSE 0 |
| | | END as has_sufficient_stock |
| | | END as has_sufficient_stock, |
| | | CASE |
| | | WHEN t2.id IS NOT NULL THEN 1 |
| | | ELSE 0 |
| | | END as has_stock_inventory |
| | | FROM |
| | | sales_ledger_product T1 |
| | | LEFT JOIN stock_inventory t2 ON T1.product_model_id = t2.product_model_id |
| | |
| | | left join production_product_main ppm on qi.product_main_id = ppm.id |
| | | left join product_work_order pwo on ppm.work_order_id = pwo.id |
| | | left join product_order po on pwo.product_order_id = po.id |
| | | left join sales_ledger_product slp on po.sale_ledger_product_id = slp.id |
| | | left join sales_ledger_product slp on po.sale_ledger_product_id = slp.id and slp.type = 1 |
| | | where qi.product_main_id = #{productMainId} |
| | | |
| | | |
| | |
| | | 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> |
| | |
| | | p.product_name, |
| | | ps.unit_quantity * slp.quantity AS single_quantity |
| | | FROM sales_ledger sl |
| | | LEFT JOIN sales_ledger_product slp ON slp.sales_ledger_id = sl.id |
| | | LEFT JOIN sales_ledger_product slp ON slp.sales_ledger_id = sl.id and slp.type = 1 |
| | | LEFT JOIN product_model pm ON pm.id = slp.product_model_id |
| | | LEFT JOIN product_bom pb ON pb.product_model_id = pm.id |
| | | LEFT JOIN product_structure ps ON pb.id = ps.bom_id |
| | |
| | | WHERE sl.id = #{salesLedegerId}) A |
| | | group by a.model, a.product_name, a.unit |
| | | </select> |
| | | <select id="selectProduct" resultType="com.ruoyi.sales.pojo.SalesLedgerProduct"> |
| | | <select id="selectProduct" resultType="com.ruoyi.sales.dto.SimpleProductDto"> |
| | | select |
| | | pm.id, |
| | | p.product_name as product_category, |
| | | pm.model as specification_model, |
| | | pm.id as product_model_id |
| | | pm.id as product_model_id, |
| | | pm.unit, |
| | | pm.sub_unit |
| | | from product_model pm |
| | | left join product p on pm.product_id = p.id |
| | | </select> |
| | |
| | | FROM product_tree); |
| | | |
| | | </select> |
| | | </mapper> |
| | | </mapper> |