触发器:处理偶发性销售订单变更单FOBJECTTYPEID异常
因一些特殊场景或未知场景的导致的偶发性销售订单新变更单T_SAL_XORDER.FOBJECTTYPEID异常(正确值为SAL_XORDER,异常值为SAL_SaleOrder),除直接修复数据外,可使用以下触发器杜绝
IF EXISTS (SELECT 1 FROM SYS.triggers WHERE NAME = 'TR_REPAIR_XORDER_OBJ') DROP TRIGGER TR_REPAIR_XORDER_OBJ;
GO
IF NOT EXISTS (SELECT 1 FROM SYS.all_objects WHERE NAME = 'TR_REPAIR_XORDER_OBJ_LOG' AND TYPE ='U') CREATE TABLE TR_REPAIR_XORDER_OBJ_LOG (FID INT,UP_DATE DATETIME);
GO
CREATE TRIGGER TR_REPAIR_XORDER_OBJ ON T_SAL_XORDER
FOR INSERT,UPDATE
AS
IF UPDATE(FOBJECTTYPEID)
BEGIN
DECLARE @CON INT;
SELECT @CON = COUNT(1) FROM inserted WHERE FOBJECTTYPEID <> 'SAL_XORDER';
IF @CON > 0
BEGIN
INSERT INTO TR_REPAIR_XORDER_OBJ_LOG SELECT INS.FID,GETDATE() FROM inserted INS WHERE INS.FOBJECTTYPEID <> 'SAL_XORDER';
UPDATE T_SAL_XORDER SET FOBJECTTYPEID = 'SAL_XORDER' WHERE FID IN (SELECT INS.FID FROM inserted INS WHERE INS.FOBJECTTYPEID <> 'SAL_XORDER');
END;
END;
触发器:处理偶发性销售订单变更单FOBJECTTYPEID异常
因一些特殊场景或未知场景的导致的偶发性销售订单新变更单T_SAL_XORDER.FOBJECTTYPEID异常(正确值为SAL_XORDER,异常值为SAL_SaleOrder)...
点击下载文档
本文2024-09-23 02:46:45发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-154645.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章