---—撤销工作流
DECLARE @docno nvarchar(100)
DECLARE @doctype nvarchar(100)
set @docno =‘CDJ20220321002’
--单据类型 发货单 01
--单据类型 采购请购单 27
--单据类型 采购订单 88
--单据类型 付款申请单 AP40
--单据类型 委外订单 OM01
SET @doctype =‘om01’
delete from wf_flowstate where piid in (select piid from wf_activeflow where vouchercode = @docno and VoucherType =@doctype)
DELETE from table_task where extendfield3 = @docno and cvouchertype =@doctype
DELETE FROM WFAudit WHERE VoucherCode =@docno and VoucherType =@doctype
DELETE FROM WF_ActiveFlow WHERE VoucherCode =@docno and VoucherType =@doctype
--删除审批流的消息推送
DELETE FROM Table_Task WHERE ExtendField3 IN ( ‘CD20220525006’ ) AND cTK_State=0
--弃审委外订单
--弃审委外订单
UPDATE dbo.OM_MOMain set cCurrentAuditor=NULL,cChangeVerifier=NULL,dVerifyTime=NULL,iVerifyStateNew=0,dVerifyDate=NULL,dAlterTime=NULL,
cModifier=NULL,dChangeVerifyTime=NULL,dChangeVerifyDate=NULL,cVerifier=NULL,cChanger=NULL,cState=0 WHERE ccode=@docno
--审核委外订单
UPDATE dbo.OM_MOMain SET cState=2,cChangeVerifier=‘李翠’,dChangeVerifyDate=GETDATE(),dChangeVerifyTime=GETDATE() WHERE cCode=‘CD20220421003’
--供应商存货调价单
UPDATE PU_PriceJustMain SET iverifystate=0 WHERE ccode=‘0000033865’
--弃审采购订单
Update PO_Pomain set cAuditTime=NULL,iverifystateex=0,cAuditDate=NULL,cVerifier =NULL,cState=0,cChangAuditDate=null,cChanger =NULL,cChangVerifier=null,cChangAuditTime=null,cLocker=NULL
from PO_Pomain where cPOID IN (‘PD2022032500429’,‘PD2022040200030’,‘PD2022032500429’);
---弃审请购单
Update PU_AppVouch set cAuditTime=NULL,iverifystateex=0,cAuditDate=NULL,cVerifier =NULL,cCurrentAuditor=NULL
where cCode=‘PR20220110008’
--弃审销售订单
UPDATE dbo.SO_SOMain SET iverifystate=0,dverifysystime=NULL,dverifydate=NULL,iStatus=0,cVerifier=NULL WHERE cSOCode=‘1234567’
SELECT cVoucherType,ExtendField3,* FROM Table_Task WHERE ExtendField3 IN(‘CD20220322008’)
select VoucherType,FlagCode,PDID,VoucherCode, * from WF_ActiveFlow where VoucherCode IN(‘CD20220322008’)
select VoucherType,OperatorName,VoucherType,VoucherCode, * from WFAudit where VoucherCode IN(‘CD20220322008’)
SELECT * FROM wf_flowstate where piid in (select piid from wf_activeflow where vouchercode = ‘CDJ20220701001’ )
--AND VoucherType =@doctype)
--select * into PO_Pomain20180927 from PO_Pomain
delete from table_task where ExtendField3 IN(‘PDJ202301040058’,‘PDJ202301290017’)
--select * into table_task20180927 from table_task
delete from WF_ActiveFlow where VoucherCode IN(‘PDJ202301040058’,‘PDJ202301290017’)
--select * into WF_ActiveFlow20180927 from WF_ActiveFlow
delete from WFAudit where VoucherCode IN(‘PDJ202301040058’,‘PDJ202301290017’)
DELETE FROM wf_flowstate where piid in (select piid from wf_activeflow where vouchercode = ‘CDJ20220701001’ )
--select * into WFAudit20180927 from WFAudit
--SELECT * FROM AP_ApplyPayVouch WHERE cVouchID IN(‘PAJ20220628002’,‘PAJ20220623013’)
--弃审付款申请单
UPDATE AP_ApplyPayVouch SET iState=0,iverifystate=0,dverifydate=NULL,dverifysystime=NULL,cCheckMan=NULL WHERE cVouchID IN(‘PAJ20220628002’,‘PAJ20220623013’)
--弃审采购订单
Update PO_Pomain set cReviser=NULL,cModifyDate =NULL,cModifyTime =NULL,cAuditTime=NULL,iverifystateex=0,cAuditDate=NULL,cVerifier =NULL,cState=0,cChangAuditDate=null,cChanger =NULL,cChangVerifier=null,cChangAuditTime=null,cLocker=NULL
from PO_Pomain where cPOID IN(‘PDJ202301040058’,‘PDJ202301290017’)
---弃审请购单
Update PU_AppVouch set cAuditTime=NULL,iverifystateex=0,cAuditDate=NULL,cVerifier =NULL,cCurrentAuditor=NULL
where cCode=‘PR20220704006’
–弃审调价单
UPDATE PU_PriceJustMain SET iverifystate=0,cverifier=NULL,dverifydate=NULL WHERE ccode IN ( ‘0000038751’)
--弃审销售订单
UPDATE dbo.SO_SOMain SET iverifystate=0,dverifysystime=NULL,dverifydate=NULL,iStatus=0,cVerifier=NULL WHERE cSOCode=‘CL20220627001’
--弃审委外订单
UPDATE dbo.OM_MOMain set cCurrentAuditor=NULL,cChangeVerifier=NULL,dVerifyTime=NULL,iVerifyStateNew=0,dVerifyDate=NULL,dAlterTime=NULL,
cModifier=NULL,dChangeVerifyTime=NULL,dChangeVerifyDate=NULL,cVerifier=NULL,cChanger=NULL,cState=0 WHERE ccode IN(‘CD20230128004’)
SELECT * FROM dbo.RecordState WHERE VoucherCode IN(‘CD20220322008’)
DELETE FROM dbo.RecordState WHERE VoucherCode IN(‘CD20220322008’)
SELECT * FROM dbo.PO_Pomain WHERE cPOID IN(‘PDJ202202280096’,‘PDJ202202280094’)
UPDATE dbo.PO_Pomain SET cDepCode=‘GY0104’ WHERE cPOID IN(‘PDJ202202280096’,‘PDJ202202280094’)
--委外订单变更后状态异常
UPDATE dbo.OM_MOMain SET cChangeVerifier=NULL,dChangeVerifyDate=NULL,dChangeVerifyTime=NULL WHERE cCode IN(‘CD20220322008’)
————————————————
版权声明:本文为CSDN博主「haichao118」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/haichao118/article/details/123681782