| | |
| | | </select> |
| | | |
| | | <select id="selectBatchNoListByProductModelId" resultType="java.lang.String"> |
| | | select distinct si.batch_no |
| | | select si.batch_no |
| | | from stock_inventory si |
| | | left join ( |
| | | select sir.batch_no, min(sir.create_time) as first_in_time |
| | | from stock_in_record sir |
| | | where sir.product_model_id = #{productModelId} |
| | | and sir.batch_no is not null |
| | | and sir.batch_no != '' |
| | | group by sir.batch_no |
| | | ) first_in on first_in.batch_no = si.batch_no |
| | | where si.product_model_id = #{productModelId} |
| | | and si.batch_no is not null |
| | | and si.batch_no != '' |
| | | order by si.batch_no |
| | | and si.qualitity - IFNULL(si.locked_quantity, 0) > 0 |
| | | group by si.batch_no |
| | | order by MIN(first_in.first_in_time) is null, |
| | | MIN(first_in.first_in_time), |
| | | MIN(si.create_time), |
| | | MIN(si.batch_no) |
| | | </select> |
| | | <select id="selectLatestRecord" resultType="com.ruoyi.basic.pojo.ProductModel"> |
| | | SELECT * FROM product_model |