select * into T_BD_SERIALMASTERORG_bak20210909 from T_BD_SERIALMASTERORG
update T_BD_SERIALMASTERORG
set
FSTOCKSTATUS=3
from T_BD_SERIALMASTER a inner join T_BD_SERIALMASTERORG b on a.FSERIALID=b.FSERIALID where
a.FSERIALID in (select FSERIALID from t_sal_outstock a inner join t_sal_outstockentry b on a.fid =b.fid
inner join t_sal_outstockserial c on b.fentryid=c.fentryid
where fbillno ='xsckd097611')
第二个主要是序列号查询的需要修复, 否则序列号和库存不一致
select * INTO T_BD_SERIALBILLTRACE_BAL20210909 FROM T_BD_SERIALBILLTRACE
UPDATE T_BD_SERIALBILLTRACE
set FINVID='000c2961-05ee-813c-11ec-009b819bf83e' ,FSTATE=3
from T_BD_SERIALBILLTRACE where FSERIALID in (select FSERIALID from t_sal_outstock a inner join t_sal_outstockentry b on a.fid =b.fid
inner join t_sal_outstockserial c on b.fentryid=c.fentryid
where fbillno ='xsckd097611') and fstate=2