| | |
| | | group by batch_no, product_model_id, model, unit, product_name, product_id |
| | | </select> |
| | | <select id="stockInventoryPage" resultType="com.ruoyi.stock.dto.StockInRecordDto"> |
| | | select sir.*,si.qualitity as current_stock, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name, |
| | | su.nick_name as create_by |
| | | select sir.*, |
| | | ROUND(COALESCE(si.qualitity, 0), 6) as current_stock, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name, |
| | | su.nick_name as create_by |
| | | from |
| | | stock_in_record sir |
| | | left join stock_inventory si on sir.batch_no = si.batch_no |
| | |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name, |
| | | MAX(current_inventory) as current_stock, |
| | | SUM(CASE WHEN record_type = 'in' THEN amount ELSE 0 END) as total_stock_in, |
| | | SUM(CASE WHEN record_type = 'out' THEN amount ELSE 0 END) as total_stock_out |
| | | ROUND(MAX(current_inventory), 6) as current_stock, |
| | | ROUND(SUM(CASE WHEN record_type = 'in' THEN amount ELSE 0 END), 6) as total_stock_in, |
| | | ROUND(SUM(CASE WHEN record_type = 'out' THEN amount ELSE 0 END), 6) as total_stock_out |
| | | FROM ( |
| | | SELECT |
| | | product_model_id, |