| | |
| | | select |
| | | si.id, |
| | | -- 当前净重 = 入库净重 - 出库净重 |
| | | (COALESCE(sir.total_net_weight,0) - COALESCE(sor.total_net_weight,0)) as net_weight, |
| | | si.qualitity, |
| | | (COALESCE(sir.total_net_weight,0) - COALESCE(sor.total_net_weight,0)) as qualitity, |
| | | si.purchaser, |
| | | COALESCE(si.locked_quantity, 0) as locked_quantity, |
| | | si.product_model_id, |
| | |
| | | left join ( |
| | | select |
| | | product_model_id, |
| | | sum(net_weight) as total_net_weight |
| | | sum(stock_in_num) 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 |
| | | sum(stock_out_num) as total_net_weight |
| | | from consumables_out_record |
| | | group by product_model_id |
| | | ) sor on si.product_model_id = sor.product_model_id |