| | |
| | | <result column="warn_num" property="warnNum"/> |
| | | </resultMap> |
| | | <update id="updateAddConsumablesInventory"> |
| | | update Consumables_inventory |
| | | update consumables_inventory |
| | | <set> |
| | | <if test="ew.productId != null"> |
| | | product_id = #{ew.productId}, |
| | | </if> |
| | | <if test="ew.qualitity != null"> |
| | | qualitity = qualitity + #{ew.qualitity}, |
| | | </if> |
| | |
| | | where product_model_id = #{ew.productModelId} |
| | | </update> |
| | | <update id="updateSubtractConsumablesInventory"> |
| | | update Consumables_inventory |
| | | update consumables_inventory |
| | | <set> |
| | | <if test="ew.netWeight != null"> |
| | | qualitity = qualitity - #{ew.netWeight}, |
| | |
| | | pm.unit, |
| | | p.product_name, |
| | | p1.product_name as parent_name, |
| | | p1.id as parent_id |
| | | |
| | | from Consumables_inventory si |
| | | p1.id as parent_id, |
| | | si.product_id as productId |
| | | from consumables_inventory si |
| | | left join product_model pm on si.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join product p1 on p.parent_id = p1.id |
| | |
| | | |
| | | <select id="listConsumablesInventoryExportData" resultType="com.ruoyi.consumables.execl.ConsumablesInventoryExportData"> |
| | | select si.qualitity, |
| | | -- 当前净重 = 入库净重 - 出库净重 |
| | | (COALESCE(sir.total_net_weight,0) - COALESCE(sor.total_net_weight,0)) as net_weight, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name, |
| | |
| | | coalesce(si.locked_quantity, 0) as locked_quantity, |
| | | si.remark, |
| | | si.update_time |
| | | from Consumables_inventory si |
| | | from consumables_inventory si |
| | | left join product_model pm on si.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join ( |
| | | select |
| | | product_model_id, |
| | | sum(net_weight) as total_net_weight |
| | | from Consumables_in_record |
| | | group by product_model_id |
| | | ) sir on si.product_model_id = sir.product_model_id |
| | | -- 出库净重 |
| | | left join ( |
| | | select |
| | | product_model_id, |
| | | sum(net_weight) as total_net_weight |
| | | from Consumables_out_record |
| | | group by product_model_id |
| | | ) sor on si.product_model_id = sor.product_model_id |
| | | where 1 = 1 |
| | | <if test="ew.productName != null and ew.productName !=''"> |
| | | and p.product_name like concat('%',#{ew.productName},'%') |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="ConsumablesInventoryPage" resultType="com.ruoyi.consumables.dto.ConsumablesInRecordDto"> |
| | | <select id="consumablesInventoryPage" resultType="com.ruoyi.consumables.dto.ConsumablesInRecordDto"> |
| | | select |
| | | sir.*, |
| | | si.qualitity as current_Consumables, |
| | | si.qualitity as current_consumables, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name, |
| | |
| | | |
| | | from Consumables_in_record sir |
| | | |
| | | left join Consumables_inventory si |
| | | left join consumables_inventory si |
| | | on sir.product_model_id = si.product_model_id |
| | | |
| | | left join product_model pm |
| | |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="ConsumablesInAndOutRecord" resultType="com.ruoyi.consumables.dto.ConsumablesInventoryDto"> |
| | | <select id="consumablesInAndOutRecord" resultType="com.ruoyi.consumables.dto.ConsumablesInventoryDto"> |
| | | SELECT |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name, |
| | | MAX(current_inventory) as current_Consumables, |
| | | MAX(current_inventory) as current_consumables, |
| | | SUM(CASE WHEN record_type = 'in' THEN amount ELSE 0 END) as total_Consumables_in, |
| | | SUM(CASE WHEN record_type = 'out' THEN amount ELSE 0 END) as total_Consumables_out |
| | | FROM ( |
| | |
| | | SUM(qualitity) as current_inventory, |
| | | 0 as amount, |
| | | '' as record_type |
| | | FROM Consumables_inventory |
| | | FROM consumables_inventory |
| | | GROUP BY product_model_id |
| | | |
| | | UNION ALL |