用友U8+自动审核自动生成的其他出入库单据
用友U8+中 调拨单、组装拆卸单、盘点单审核后,自动审核对应的其他出入库单。
1.打库存管理补丁(ST)
select * from AccInformation where cSysID='ST' and cCaption like '%自动审核%'
查询后,将“是否自动审核库存生成的单据”的cValue自动改为“true”,即执行修改语句:
update AccInformation set cValue=true where cSysID='ST' and cCaption like '%自动审核%'
PS:
1、弃审的时候,还是需要先将对应的其他出入库单据进行弃审后,再弃审原单据。
2、如果其他出入库单启用审批流,则不支持自动审核。
第二种方法:改触发器
1.其他入库单主表RdRecord08的触发器
USE [UFDATA_801_2022]
GO
/****** Object: Trigger [dbo].[tri_RdRecord08_DbCheck_zrq] Script Date: 2023-04-17 13:05:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[tri_RdRecord08_DbCheck_zrq] ON [dbo].[RdRecord08]
FOR UPDATE
as
IF UPDATE(cCode)
BEGIN
IF (SELECT count(1) FROM deleted WHERE CAST(ID AS NVARCHAR(30))=cCode AND ( csource='调拨' or csource='盘点' or csource='形态转换') )>0
BEGIN
DECLARE @ID INT,@iswfcontrolled INT,@csource NVARCHAR(50),@cHandler NVARCHAR(20),@SPID NVARCHAR(20)
SELECT @ID=ID,@iswfcontrolled=iswfcontrolled,@cHandler=cMaker FROM inserted
IF @iswfcontrolled=1
BEGIN
UPDATE RdRecord08 SET iswfcontrolled=0 WHERE ID=@ID
END
UPDATE RdRecord08 WITH (UPDLOCK) Set cHandler=@cHandler, dVeriDate=dDate,dNVerifyTime=getdate() WHERE Id=@ID
UPDATE mainbatch set chandler=@cHandler where cvouchtype=N'08' and rdmid=@ID
IF (SELECT count(1) FROM AccInformation WHERE cName='bOtherInCheck' AND cvalue='True')>0
BEGIN
EXEC ST_VerForStock N'08',@ID,0,1,1
SELECT @SPID='spid_'+CAST(@@SPID AS NVARCHAR(10))
insert into SCM_Item(cInvCode,cfree1,cfree2,cfree3,cfree4,cfree5,cfree6,cfree7,cfree8,cfree9,cfree10)
select distinct cInvCode,cfree1,cfree2,cfree3,cfree4,cfree5,cfree6,cfree7,cfree8,cfree9,cfree10 from SCM_EntryLedgerBuffer a with (nolock)
where a.transactionid=@SPID and not exists (select 1 from SCM_Item Item where Item.cInvCode=a.cInvCode and Item.cfree1=a.cfree1
and Item.cfree2=a.cfree2 and Item.cfree3=a.cfree3 and Item.cfree4=a.cfree4 and Item.cfree5=a.cfree5
and Item.cfree6=a.cfree6 and Item.cfree7=a.cfree7 and Item.cfree8=a.cfree8 and Item.cfree9=a.cfree9 and Item.cfree10=a.cfree10 )
EXEC Usp_SCM_CommitGeneralLedgerWithCheck N'ST',1,2,1,1,0,0,2,1,1,0,0,0,0 ,1,@SPID
END
END
END
2.
1.其他出库单主表RdRecord09的触发器
USE [UFDATA_801_2022]
GO
/****** Object: Trigger [dbo].[tri_RdRecord09_DbCheck_zrq] Script Date: 2023-04-17 13:06:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[tri_RdRecord09_DbCheck_zrq] ON [dbo].[RdRecord09]
FOR UPDATE
as
IF UPDATE(cCode)
BEGIN
IF (SELECT count(1) FROM deleted WHERE CAST(ID AS NVARCHAR(30))=cCode AND ( csource='调拨' or csource='盘点' or csource='形态转换') )>0
BEGIN
DECLARE @ID INT,@iswfcontrolled INT,@csource NVARCHAR(50),@cHandler NVARCHAR(20),@SPID NVARCHAR(20)
SELECT @ID=ID,@iswfcontrolled=iswfcontrolled,@cHandler=cMaker FROM inserted
IF @iswfcontrolled=1
BEGIN
UPDATE RdRecord09 SET iswfcontrolled=0 WHERE ID=@ID
END
UPDATE Rdrecord09 WITH (UPDLOCK) Set cHandler=@cHandler, dVeriDate=dDate,dNVerifyTime=getdate() WHERE Id=@ID
UPDATE mainbatch set chandler=@cHandler where cvouchtype=N'09' and rdmid=@ID
IF (SELECT count(1) FROM AccInformation WHERE cName='bOtherInCheck' AND cvalue='True')>0
BEGIN
EXEC ST_VerForStock N'09',@ID,0,1,1
SELECT @SPID='spid_'+CAST(@@SPID AS NVARCHAR(10))
insert into SCM_Item(cInvCode,cfree1,cfree2,cfree3,cfree4,cfree5,cfree6,cfree7,cfree8,cfree9,cfree10)
select distinct cInvCode,cfree1,cfree2,cfree3,cfree4,cfree5,cfree6,cfree7,cfree8,cfree9,cfree10 from SCM_EntryLedgerBuffer a with (nolock)
where a.transactionid=@SPID and not exists (select 1 from SCM_Item Item where Item.cInvCode=a.cInvCode and Item.cfree1=a.cfree1
and Item.cfree2=a.cfree2 and Item.cfree3=a.cfree3 and Item.cfree4=a.cfree4 and Item.cfree5=a.cfree5
and Item.cfree6=a.cfree6 and Item.cfree7=a.cfree7 and Item.cfree8=a.cfree8 and Item.cfree9=a.cfree9 and Item.cfree10=a.cfree10 )
EXEC Usp_SCM_CommitGeneralLedgerWithCheck N'ST',1,2,1,1,0,0,2,1,1,0,0,0,0 ,1,@SPID
END
END
END
玉环人力网(又名玉环人才网)是玉环人才吧旗下一流的玉环人力资源招聘行业服务品牌,汇集海量玉环人才,开放玉环人才简历和玉环岗位,提供玉环招聘网,玉环人才市场动态行情,玉环劳务派遣,玉环培训等,是玉环最大的人才网站。