| | |
| | | SELECT |
| | | T1.*, |
| | | CASE |
| | | WHEN t2.qualitity > T1.quantity THEN 1 |
| | | WHEN sum(t2.qualitity) > T1.quantity THEN 1 |
| | | ELSE 0 |
| | | END as has_sufficient_stock |
| | | FROM |
| | |
| | | AND T1.type = #{salesLedgerProduct.type} |
| | | </if> |
| | | </where> |
| | | group by T1.id |
| | | ORDER BY T1.register_date DESC |
| | | </select> |
| | | <select id="selectSalesLedgerProductByMainId" resultType="com.ruoyi.sales.pojo.SalesLedgerProduct"> |
| | |
| | | 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.product_model_id = slp.id |
| | | left join sales_ledger_product slp on po.sale_ledger_product_id = slp.id |
| | | where qi.product_main_id = #{productMainId} |
| | | |
| | | |
| | |
| | | AND slp.product_category like concat('%',#{req.productCategory},'%') |
| | | </if> |
| | | <if test="req.status != null and req.status "> |
| | | AND slp.pending_invoice_total > 0 |
| | | AND slp.pending_tickets_total > 0 |
| | | </if> |
| | | </where> |
| | | order by slp.register_date desc |