K3 Cloud关账时报物料内码不一致原创
4人赞赏了该文章
762次浏览
编辑于2021年09月13日 16:07:17
因为有跨组织的自定义流程,月底财务关账报“xxx单的物料xxx内码xxx与xxx公司下的内码xxx的不一致!”
如下图:
/*以下部分由金蝶提供*/
UPDATE e SET e.FMATERIALID = t.FMATERIALID FROM T_STK_OEMINSTOCK a JOIN T_STK_OEMINSTOCKENTRY 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
/*以下部分根据上面语句进行针对具体业务单据进行改写
------受托加工材料入库单
*/
UPDATE e SET e.FMATERIALID = t.FMATERIALID FROM T_STK_OEMINSTOCK a JOIN T_STK_OEMINSTOCKENTRY 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
/*受托加工材料退料单*/
UPDATE e SET e.FMATERIALID = t.FMATERIALID FROM T_STK_OEMINSTOCKRTN a JOIN T_STK_OEMINSTOCKRTNENTRY 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 AND A.FBILLNO = 'STCLTL000012'
-----------结束-----------
推荐阅读