select sum(remain_quantity) from tn_grms_stock_record_item where batch_no = 'R202302150002'
select sum(quantity) from tn_grms_stock_record_item where batch_no = 'C202302150002'
-- 撤销记录
-- 入库撤销 展示sum(remain_quantity)
-- 出库撤销 展示sum(quantity)
SELECT
CASE
t1.type
WHEN 1 THEN
sum(t2.remain_quantity)
WHEN 0 THEN
sum(t2.quantity)
END AS sum
FROM
tn_grms_stock_record t1,
tn_grms_stock_record_item t2
WHERE
t1.batch_no = 'C202302150002'
and t2.batch_no = 'C202302150002'