科目数据清理方案原创
金蝶云社区-睿栋卓成
睿栋卓成
5人赞赏了该文章 741次浏览 未经作者许可,禁止转载编辑于2020年06月22日 10:34:45

一、        方案场景

现场科目分配错误,需要反分配,但是提示科目被业务数据引用。

二、        前置条件

此科目的业务数据已经完全清理完毕包含但不限于以下内容:无凭证,无模式凭证,无自动转账模板、无初始化数据(科目余额初始化、现金流量初始化、往来账初始化)如有因未清理完数据,执行了脚本导致的数据问题需要现场修复。

清理前需要备份账套。

三、        清理脚本

1.     获取科目的FID

组织的FID:select fid from t_org_company where fnumber = 组织的编码

科目的FID:select fid from t_bd_accountview where fnumber = 科目编码 and fcompanyid = '组织的FID'

2.     清理余额记录

delete  from t_gl_accountbalance where faccountid = '科目的FID'     delete  from t_gl_assistbalance where faccountid = '科目的FID'

    delete  from t_gl_assistmeasurebalance where faccountid = '科目的FID'     

    delete  from t_gl_initaccountbalance where faccountid = '科目的FID'

    delete  from t_gl_initassistbalance where faccountid = '科目的FID' 

    delete from t_gl_flag where fkeyid = '科目的FID' 

3.     清理现金流量

--7.5以上版本才有

Delete from t_gl_cashflowrecord where faccountid =  '科目的FID'

--7.5以上版本才有

Delete from t_gl_cashflowrecord where foppaccountid =  '科目的FID'

--7.5以上版本才有

Delete from t_gl_cashflowsplitrecord where faccountid =  '科目的FID'

--7.5以上版本才有

Delete from t_gl_cashflowsplitrecord where foppaccountid =  '科目的FID'

4.     清理往来核销数据

Delete from t_gl_acctcussent where faccountid =  '科目的FID'

Delete from T_GL_AcctCussentHistory where faccountid =  '科目的FID'

5.     清理往来通知数据

Delete from T_CSL_RequisitionEntry where faccountid =  '科目的FID'

6.     清理科目自定义属性

delete from t_gl_assistcustomizedproperty where faccountid =  '科目的FID'

 

 

 

 

 

 

 

 

 


赞 5