业务背景:固定资产减值修改本期减值金额后,保存、审核报错,报错信息如下:
错误信息:TooManyRecord:FaDecValue period.id = 'fUwAAACx5muCOIxM' AND company.id = 'fUwAAAAAF6zM567U'
排查思路:
步骤1、首先在查询分析器查询资产减值表,检查是否有重复数据
---如果执行结果大于1条,则表示有重复数据
--- select fid from T_FA_FADECVALUE where Fcompanyid = (select fid from t_org_company where fnumber ='组织编码') and fperiodid = (select fid from t_bd_period where fnumber =会计期间编码)
步骤2、如果步骤1有两条记录,则表示有重复的减值数据,需要先备份数据,再删除一条数据。一般情况下,应该都是未审核的减值记录。
--备份资产减值表头
select * into T_FA_FADECVALUE0418(备份表) from T_FA_FADECVALUE where Fcompanyid = (select fid from t_org_company where fnumber =’组织编码’)
and fperiodid = (select fid from t_bd_period where fnumber =’会计期间编码’)
--备份资产减值分录
SELECT * into T_FA_FADECVALUEENTRY0418(备份表) FROM T_FA_FADECVALUEENTRY where FHEADID in (select FID from T_FA_FADECVALUE where Fcompanyid = (select fid from t_org_company where fnumber ='组织编码')
and fperiodid = (select fid from t_bd_period where fnumber ='会计期间'))
--删除其中一条减值单数据的分录
--Delete from T_FA_FADECVALUEENTRY where FHEADID =’步骤1查到的fid中的第一条’
--删除其中一条减值单数据的表头
--Delete from T_FA_FADECVALUE where fID =’步骤1查到的fid中的第一条’
步骤3、检查资产减值表是否还存在重复数据。如无重复数据,正常处理减值业务即可。
---如果执行结果只有1条,说明重复数据已删除
select fid from T_FA_FADECVALUE where Fcompanyid = (select fid from t_org_company where fnumber ='组织编码') and fperiodid = (select fid from t_bd_period where fnumber =会计期间编码)
推荐阅读