| | |
| | | p.product_name, |
| | | si.batch_no, |
| | | si.customer, |
| | | rp.product_name AS root_product_name, |
| | | rp.product_type AS productScope, |
| | | si.production_date |
| | | FROM |
| | | stock_inventory si |
| | |
| | | <if test="ew.productScope != null and ew.productScope != ''"> |
| | | <choose> |
| | | <when test="ew.productScope == '成品'"> |
| | | AND rp.product_name = '成品' |
| | | AND rp.product_type = '成品' |
| | | </when> |
| | | <otherwise> |
| | | AND rp.product_name != '成品' |
| | | </otherwise> |
| | | <when test="ew.productScope == '半成品'"> |
| | | AND rp.product_type = '半成品' |
| | | </when> |
| | | <when test="ew.productScope == '原材料'"> |
| | | AND (rp.product_type IS NULL |
| | | OR (rp.product_type != '成品' AND rp.product_type != '半成品')) |
| | | </when> |
| | | </choose> |
| | | </if> |
| | | </where> |