采购订单做了采购订单新变更单,已审核生效,但采购订单的变更标志是变更中,但是变更状态为是,问题异常修复方案原创
3人赞赏了该文章
204次浏览
编辑于2024年03月28日 15:49:17
【报错场景】
采购订单做了采购订单新变更单,已审核生效,但采购订单的变更标志是变更中,但是变更状态为是;
根据指导将参数“自动修正采购订单变更单状态、标识”,一旦勾选再选中订单下推,点击下推就提示如图报错
【异常修复】
数据库中可直接执行以下脚本:
MERGE INTO T_PUR_POORDER T USING ( SELECT DISTINCT A.FID FROM T_PUR_POORDERENTRY B INNER JOIN T_PUR_POORDER A ON B.FID=A.FID AND A.FCHANGESTATUS='B' WHERE ( NOT EXISTS (SELECT 1 FROM T_PUR_XPOORDER C WHERE C.FPKIDX=A.FID AND C.FISACTIVE='A') AND EXISTS (SELECT 1 FROM T_PUR_XPOORDER C WHERE C.FPKIDX=A.FID ) ) AND ( NOT EXISTS(SELECT 1 FROM T_PUR_POChangeEntry D WHERE D.FOFID=A.FID) ) ) S ON S.FID=T.FID WHEN MATCHED THEN UPDATE SET T.FCHANGESTATUS='A'; MERGE INTO T_PUR_POORDERENTRY T USING( SELECT B.FENTRYID FROM T_PUR_POORDER A INNER JOIN T_PUR_POORDERENTRY B ON B.FID=A.FID AND B.FCHANGEFLAG='I' WHERE (NOT EXISTS (SELECT 1 FROM T_PUR_XPOORDER C WHERE C.FPKIDX=A.FID AND C.FISACTIVE='A') AND EXISTS (SELECT 1 FROM T_PUR_XPOORDER C WHERE C.FPKIDX=A.FID )) AND NOT EXISTS(SELECT 1 FROM T_PUR_POChangeEntry D WHERE D.FOFID=A.FID) ) S ON S.FENTRYID=T.FENTRYID WHEN MATCHED THEN UPDATE SET T.FCHANGEFLAG='C';
推荐阅读