找回密码
 立即注册
搜索
查看: 85|回复: 0

作废已修正的盘点单号

[复制链接]

251

主题

134

回帖

1404

积分

版主

积分
1404

活跃会员宣传达人突出贡献优秀版主

发表于 2024-8-29 10:35:58 | 显示全部楼层 |阅读模式
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
可以作废已经修正的盘点单号(售后做的时候是门店总部都重复一遍)

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表