declare @checkno varchar(30),@busno varchar(10)
declare @begintime datetime
set @checkno=’1907270000002′ –盘点单号 (单号) select @busno=busno,@begintime =begintime from u_check_reg where checkno=@checkno delete a from u_inout_list a
where busno=@busno and billcode=’che’ and execdate>=@begintime
and exists (select * from u_check_diff b where a.wareid=b.wareid and a.busno=b.busno and b.checkno=@checkno ) update u_store_c
set wareqty = b.wareqty – a.plqty
from u_check_diff a,u_store_c b
where a.wareid = b.wareid and a.batchno = b.batchno and
a.idno = b.idno and a.stallno = b.stallno and
a.busno = b.busno and a.busno = @busno and a.checkno = @checkno
create table #disable_u_check_reg (id int) update u_check_reg
set status=4(作废或者别的数字是生效之类的)
where checkno=@checkno delete from u_store_i where batchno=’chk’+@checkno 可以作废已经修正的盘点单号(售后做的时候是门店总部都重复一遍) 正确的操作
declare @checkno varchar(30),@busno varchar(10)
declare @begintime datetime
set @checkno=’2111230000014′ –盘点单号 select @busno=busno,@begintime =begintime from u_check_reg where checkno=@checkno delete a from u_inout_list a
where busno=@busno and billcode=’che’ and execdate>=@begintime
and exists (select * from u_check_diff b where a.wareid=b.wareid and a.busno=b.busno and b.checkno=@checkno ) update u_store_c
set wareqty = b.wareqty – a.plqty
from u_check_diff a,u_store_c b
where a.wareid = b.wareid and a.batchno = b.batchno and
a.idno = b.idno and a.stallno = b.stallno and
a.busno = b.busno and a.busno = @busno and a.checkno = @checkno
create table #disable_u_check_reg (id int) update u_check_reg
set status=4
where checkno=@checkno delete from u_store_i where batchno=’chk’+@checkno drop table #disable_u_check_reg declare @checkno varchar(30),@busno varchar(10)
declare @begintime datetime
set @checkno=’1907270000002′ –盘点单号 (单号) select @busno=busno,@begintime =begintime from u_check_reg where checkno=@checkno delete a from u_inout_list a
where busno=@busno and billcode=’che’ and execdate>=@begintime
and exists (select * from u_check_diff b where a.wareid=b.wareid and a.busno=b.busno and b.checkno=@checkno ) update u_store_c
set wareqty = b.wareqty – a.plqty
from u_check_diff a,u_store_c b
where a.wareid = b.wareid and a.batchno = b.batchno and
a.idno = b.idno and a.stallno = b.stallno and
a.busno = b.busno and a.busno = @busno and a.checkno = @checkno
create table #disable_u_check_reg (id int) update u_check_reg
set status=4(作废或者别的数字是生效之类的)
where checkno=@checkno delete from u_store_i where batchno=’chk’+@checkno 可以作废已经修正的盘点单号(售后做的时候是门店总部都重复一遍)
|