用友u8多出现未记账凭证 以及无法通过总账工具导入凭证,未出现错误提示

前不久遇到一个客户,出现了如下问题:

1.经常无端出现未记账凭证,并且后台删除后又会出现,而且不是人为原因导致

2.通过总账工具导入凭证出现错误,并且弹出对话框未显示错误或错误信息不全

U8版本:10.1

错误账套:101  201

模块:总账  固定资产

ISD:已过期

百度未查到相关解决方法

 

对于问题1的解决:

解决方法:在101  和201 的gl_accvouch表中插入触发器。

USE [UFDATA_101_2012]
GO
/****** Object:  Trigger [dbo].[gl_accvouch_insert_trigger]    Script Date: 06/29/2018 16:56:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create trigger  [dbo].[gl_accvouch_insert_trigger]  on  [dbo].[GL_accvouch] for insert
as
 
   begin
     set nocount on;
     DECLARE  @iyear smallint;
     declare  @iperiod tinyint;
     DECLARE @I_ID  VARCHAR(20);
    --delete from  [UFDATA_101_2012].[dbo].[gl_accvouch] where ibook in (select  ibook from  inserted where  ibook=0)
    /* delete from  [UFDATA_101_2012].[dbo].[gl_accvouch]  where i_id  in (select i_id from inserted where  ino_id in (select  ino_id
     from  [UFDATA_101_2012].[dbo].[gl_accvouch]  where iyear=inserted.iyear and iperiod=inserted.iperiod  group by  ino_id  having count(ino_id)>1 and  count(inid)>1
     ))*/
 select @iyear=iyear from inserted;
 select @iperiod=iperiod from inserted;

/* DELETE  FROM   [UFDATA_101_2012].[dbo].[gl_accvouch]  where  i_id  IN(
   select  A.i_id FROM inserted
   A inner join   ( select  * from  [UFDATA_101_2012].[dbo].[gl_accvouch] C  where  c.iyear=@iyear and C.iperiod=@iperiod) D
  
  on A.ino_id=D.ino_id AND A.inid=D.inid) AND ino_id IN(SELECT ino_id FROM [UFDATA_101_2012].[dbo].[gl_accvouch] where iyear=@IYEAR and iperiod=@IPERIOD  GROUP BY  ino_id   having count(ino_id)>1 and  count(inid)>1 )*/
 

    
    
    
      delete   from  [UFDATA_101_2012].[dbo].[gl_accvouch]    where
       i_id in (select  i_id from (( select  A.i_id FROM  (select  * from  [UFDATA_101_2012].[dbo].[gl_accvouch]  B  WHERE b.iyear=@iyear and B.iperiod=@iperiod)
   A inner join   ( select  * from  [UFDATA_101_2012].[dbo].[gl_accvouch] C  where  c.iyear=@iyear and C.iperiod=@iperiod) D
  
  on A.ino_id=D.ino_id AND A.inid=D.inid   group by  A.i_id   having  COUNT(A.i_id)>1)) G  WHERE g.i_id in(select  i_id from inserted))
     END

 

 

USE [UFDATA_201_2012]
GO
/****** Object:  Trigger [dbo].[gl_accvouch_insert_trigger]    Script Date: 06/29/2018 16:56:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create trigger  [dbo].[gl_accvouch_insert_trigger]  on  [dbo].[GL_accvouch] for insert
as
 
   begin
     set nocount on;
     DECLARE  @iyear smallint;
     declare  @iperiod tinyint;
     DECLARE @I_ID  VARCHAR(20);
    --delete from  [UFDATA_101_2012].[dbo].[gl_accvouch] where ibook in (select  ibook from  inserted where  ibook=0)
    /* delete from  [UFDATA_101_2012].[dbo].[gl_accvouch]  where i_id  in (select i_id from inserted where  ino_id in (select  ino_id
     from  [UFDATA_101_2012].[dbo].[gl_accvouch]  where iyear=inserted.iyear and iperiod=inserted.iperiod  group by  ino_id  having count(ino_id)>1 and  count(inid)>1
     ))*/
 select @iyear=iyear from inserted;
 select @iperiod=iperiod from inserted;

/* DELETE  FROM   [UFDATA_101_2012].[dbo].[gl_accvouch]  where  i_id  IN(
   select  A.i_id FROM inserted
   A inner join   ( select  * from  [UFDATA_101_2012].[dbo].[gl_accvouch] C  where  c.iyear=@iyear and C.iperiod=@iperiod) D
  
  on A.ino_id=D.ino_id AND A.inid=D.inid) AND ino_id IN(SELECT ino_id FROM [UFDATA_101_2012].[dbo].[gl_accvouch] where iyear=@IYEAR and iperiod=@IPERIOD  GROUP BY  ino_id   having count(ino_id)>1 and  count(inid)>1 )*/
 

    
    
    
      delete   from  [UFDATA_201_2012].[dbo].[gl_accvouch]    where
       i_id in (select  i_id from (( select  A.i_id FROM  (select  * from  [UFDATA_201_2012].[dbo].[gl_accvouch]  B  WHERE b.iyear=@iyear and B.iperiod=@iperiod)
   A inner join   ( select  * from  [UFDATA_201_2012].[dbo].[gl_accvouch] C  where  c.iyear=@iyear and C.iperiod=@iperiod) D
  
  on A.ino_id=D.ino_id AND A.inid=D.inid   group by  A.i_id   having  COUNT(A.i_id)>1)) G  WHERE g.i_id in(select  i_id from inserted))
     END

 

对于问题2的解决:

解决方法:经多次观察发现gl_accvouch的 iperiod值出现大于12的值,为20 和21,导致插入错误,因为iperiod的值范围为

[0,12]取整。所以只需要后台删掉101 201账套iperiod大于12的数据行即可

 

你可能感兴趣的:(sqlserver,U8)