| | |
| | | update_time = now() |
| | | </set> |
| | | where product_model_id = #{ew.productModelId} |
| | | <if test="ew.batchNo == null"> |
| | | and batch_no is null |
| | | </if> |
| | | <if test="ew.batchNo != null"> |
| | | and batch_no = #{ew.batchNo} |
| | | </if> |
| | | </update> |
| | | <update id="updateSubtractStockInventory"> |
| | | update stock_inventory |
| | |
| | | update_time = now() |
| | | </set> |
| | | where product_model_id = #{ew.productModelId} and qualitity >= #{ew.qualitity} |
| | | <if test="ew.batchNo == null"> |
| | | and batch_no is null |
| | | </if> |
| | | <if test="ew.batchNo != null"> |
| | | and batch_no = #{ew.batchNo} |
| | | </if> |
| | | </update> |
| | | <select id="pagestockInventory" resultType="com.ruoyi.stock.dto.StockInventoryDto"> |
| | | select si.id, |
| | |
| | | INNER JOIN product_tree pt ON p.parent_id = pt.id |
| | | ) |
| | | select |
| | | batch_no, |
| | | MAX(qualifiedId) as qualifiedId, |
| | | MAX(unQualifiedId) as unQualifiedId, |
| | | SUM(qualifiedQuantity) as qualifiedQuantity, |
| | |
| | | 'combined' as stockType |
| | | from ( |
| | | select |
| | | si.batch_no, |
| | | si.id as qualifiedId, |
| | | null as unQualifiedId, |
| | | si.qualitity as qualifiedQuantity, |
| | |
| | | union all |
| | | |
| | | select |
| | | su.batch_no, |
| | | null as qualifiedId, |
| | | su.id as unQualifiedId, |
| | | 0 as qualifiedQuantity, |
| | |
| | | and combined.product_id in (select id from product_tree) |
| | | </if> |
| | | </where> |
| | | group by product_model_id, model, unit, product_name, product_id |
| | | group by batch_no, product_model_id, model, unit, product_name, product_id |
| | | </select> |
| | | |
| | | <select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockInventoryExportData"> |
| | |
| | | ORDER BY DATE(sor.create_time) ASC |
| | | </select> |
| | | |
| | | </mapper> |
| | | </mapper> |