------其他解决方案-------------------- /*盘点*/ SELECT '盘点+' affirm_type, order_date affirm_date, order_id, sell_id_fk, pro_no_fk, pro_num_fk, storage_finance num
FROM inventory_m m, inventory_s s
WHERE order_id = order_id_fk AND states_id_fk = '3'
UNION ALL
/*调出*/ SELECT '调库-', head_date, order_id, from_id_fk, pro_no_fk, pro_num_fk, (- 1) * num
FROM storage_m m, storage_s s
WHERE order_id = order_id_fk AND states_id_fk = '21'
UNION ALL
/*调入*/ SELECT '调库+', head_date, order_id, to_id_fk, pro_no_fk, pro_num_fk, num
FROM storage_m m, storage_s s
WHERE order_id = order_id_fk AND states_id_fk = '21'
UNION ALL
/*订单-*/ SELECT '订单-', fill_date, order_id, fill_id_fk, pro_no_fk, pro_num_fk, (- 1) * fill_num