库存关账提示物料内码错误(问题处理记录)原创
65人赞赏了该文章
375次浏览
编辑于2023年12月11日 15:46:34
问题现象:系统配置了从发货通知单生成其他出库单 ,在库存关账时系统提示 库存关账提示物料内码错误
----以下是其他出库单,以下代码按单据类型进行执行
----A.修复已有的错误数据---
--1.select a.fbillno,e.fseq,m.fnumber,e.FMATERIALID,t.fmaterialid ,m.fuseorgid,t.fuseorgid,a.fstockorgid --2.select e.* into T_STK_MISDELIVERYentryBak330 --3. update e set e.FMATERIALID =t.FMATERIALID from T_STK_MISDELIVERY a join T_STK_MISDELIVERYentry e on a.fid=e.fid join t_bd_material m on m.FMATERIALID =e.FMATERIALID join t_bd_material t on( t.FMASTERID=m.FMASTERID and t.fuseorgid=a.fstockorgid) where m.FUSEORGID<> a.FSTOCKORGID
----B.彻底修复后续新增的数据---
create trigger trg_MISDELIVERY_icup on T_STK_MISDELIVERY --01 for update as if (update (FDOCUMENTSTATUS) and exists(select 1 from inserted where FDOCUMENTSTATUS='B')) begin if exists (select 1 from T_STK_MISDELIVERYentry e join inserted a on a.FID=e.FID join T_BD_MATERIAL m --02 on e.FMATERIALID =m.FMATERIALID join T_BD_MATERIAL t on t.FMASTERID= m.FMASTERID and t.FUSEORGID =a.FSTOCKORGID where e.FMATERIALID <>t.FMATERIALID ) update e set e.FMATERIALID =t.fmaterialid from T_STK_MISDELIVERYentry e join inserted a on a.FID=e.FID join T_BD_MATERIAL m --03 on e.FMATERIALID =m.FMATERIALID join T_BD_MATERIAL t on t.FMASTERID= m.FMASTERID and t.FUSEORGID =a.FSTOCKORGID where e.FMATERIALID <>t.FMATERIALID End
赞 65
65人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!
推荐阅读