| | |
| | | sir.stock_in_num |
| | | FROM stock_in_record sir |
| | | INNER JOIN quality_inspect qi |
| | | ON TRIM(sir.record_type) = '10' |
| | | ON TRIM(sir.record_type) IN ('6', '10') |
| | | AND sir.record_id = qi.id |
| | | INNER JOIN sales_ledger_product slp |
| | | ON slp.type = 2 |
| | | AND slp.sales_ledger_id = qi.purchase_ledger_id |
| | | AND slp.product_model_id = qi.product_model_id |
| | | WHERE sir.approval_status = 1 |
| | | WHERE qi.inspect_state = 1 |
| | | ) rel |
| | | GROUP BY rel.sales_ledger_product_id |
| | | ) approved_qty ON approved_qty.sales_ledger_product_id = slp.id |
| | |
| | | <if test="c.supplierId != null"> |
| | | AND pl.supplier_id = #{c.supplierId} |
| | | </if> |
| | | <if test="c.ids != null and c.ids.size() > 0"> |
| | | AND pl.id IN |
| | | <foreach collection="c.ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | <if test="c.approvalStatus != null"> |
| | | AND pl.approval_status = #{c.approvalStatus} |
| | | </if> |