| | |
| | | from stock_uninventory su |
| | | left join product_model pm on su.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join manufacturer m on su.manufacturer_id = m.id |
| | | </sql> |
| | | |
| | | <sql id="WastePageColumns"> |
| | |
| | | (su.qualitity - COALESCE(su.locked_quantity, 0)) as un_locked_quantity, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name |
| | | p.product_name, |
| | | m.name as manufacturer_name, |
| | | su.source |
| | | </sql> |
| | | |
| | | <update id="updateSubtractStockUnInventory"> |
| | |
| | | su.*, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name |
| | | p.product_name, |
| | | m.name as manufacturer_name |
| | | <include refid="BaseWasteFromClause" /> |
| | | <where> |
| | | <if test="ew.type != null and ew.type != ''"> |
| | |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name, |
| | | m.name as manufacturer_name, |
| | | (su.qualitity - COALESCE(su.locked_quantity, 0)) as un_locked_quantity |
| | | <include refid="BaseWasteFromClause" /> |
| | | <where> |
| | |
| | | order by su.update_time desc, su.id desc |
| | | </select> |
| | | |
| | | <select id="getWasteBatchNoQty" resultType="com.ruoyi.stock.dto.StockUninventoryDto"> |
| | | select |
| | | su.id, |
| | | p.product_name, |
| | | pm.model, |
| | | m.name as manufacturer_name, |
| | | su.source, |
| | | pm.unit, |
| | | su.batch_no, |
| | | su.qualitity, |
| | | COALESCE(su.locked_quantity, 0) as locked_quantity, |
| | | (su.qualitity - COALESCE(su.locked_quantity, 0)) as un_locked_quantity, |
| | | su.remark, |
| | | su.update_time, |
| | | su.product_model_id |
| | | from stock_uninventory su |
| | | left join product_model pm on su.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join manufacturer m on su.manufacturer_id = m.id |
| | | <where> |
| | | and su.type = 'waste' |
| | | <if test="ew.productModelId != null and ew.productModelId > 0"> |
| | | and su.product_model_id = #{ew.productModelId} |
| | | </if> |
| | | <if test="ew.productId != null and ew.productId > 0"> |
| | | and p.id = #{ew.productId} |
| | | </if> |
| | | </where> |
| | | order by su.batch_no |
| | | </select> |
| | | |
| | | <select id="selectPendingOutQuantity" resultType="java.math.BigDecimal"> |
| | | SELECT IFNULL(SUM(sor.stock_out_num), 0) |
| | | FROM stock_out_record sor |