用友T3 年结常见脚本

[全站通告] 想快速节省您的时间并可接受付费的朋友,可扫右边二维码加博主微信-非诚勿扰!

请注意:执行脚本前务必备份好可用的账套数据!!!

一、建立年度账报错:

1、新建立年度帐提示”.“附近语法错误

90b7bb0b27caf38f7d49d43c27e0a954_AY2cIQaZ8zCsAAAAAElFTkSuQmCC.png

通用脚本:

对上年的数据库执行

alter table code DROP COLUMN timestam

alter table Vendor DROP COLUMN timestam

alter table Person DROP COLUMN timestam

alter table Department DROP COLUMN timestam

alter table Gl_accvouch DROP COLUMN timestam

alter table Customer DROP COLUMN timestam

2、建立年度账,提示:字符串”之前有未闭合的引号

5d37e8d1e7d233a81c9d8a4667faaf20_8TaiAAciWBQCAQCAQCgUAgEDz8P9HGdB6MZZstAAAAAElFTkSuQmCC.png

通用脚本:

对上一年数据库执行

update customer set uniqueid = newid()

3、建立年度长报错,提示:列名 cf_name 无效

e68e21825a8d0d2e451194750830c6f0_wW8v8BEhCSXSITI6oAAAAASUVORK5CYII=.png

通用脚本:

alter table GL_bfreq drop column cf_name

alter table GL_blreq drop column cf_name

4、建立年度账提示:列名:ilnvNTaxCost 无效

d35303134c7a31d33edd028dcb75c431_n9y7+MQAAAABJRU5ErkJggg==.png

通用脚本:

在旧年度库中执行以下 sql 语句:

select iInvNTaxCost from inventory

— 查 询 表 inventory中是否有iInvNTaxCost 字段

如果有该字段,继续执行:

alter table inventory drop column iInvNTaxCost

如果没有该字段,继续执行:

alter table inventory add iInvNTaxCost float NULL

5、新建年度提示列名 bAssistant1 无效

20fe40afef43f73a038e99252c8255a0_A8Xbn+sGBeynAAAAAElFTkSuQmCC.png

常用脚本:

A、找到 code 表对应的约束去删除

549b89556aa82b000df04291e17df903_y+TwXpco8ePXr06NGjR48ePXr06PELgv8L6dILhtMauNsAAAAASUVORK5CYII=.png

B、或执行语句:(将所有数据库名和约束名替换成要删除的)

USE [数据库名]

GO

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[约束名]’) AND type

= ‘D’)

BEGIN

ALTER TABLE [dbo].[code] DROP CONSTRAINT [约束名]

END

GO

C、对上年执行:

alter table code drop column bAssistant1

alter table code drop column bAssistant2

alter table code drop column bAssistant3

alter table code drop column bAssistant4

alter table code drop column bAssistant5

alter table code drop column bAssistant6

alter table code drop column bAssistant7

6、其他的情况建立年度账报错,需要降级再升级。(二进制截断、列名无效)

通用脚本:对上年执行

update accinformation set cvalue=’8.216′,cdefault=’8.216′ wherecname=’versionflag’

drop tablerpt_flddef,rpt_fltdef,rpt_glbdef,rpt_grpdef,rpt_reldef,rpt_folder,rpt_itmdef

select * into rpt_flddef from UFDATA_999_2011..rpt_flddef

select * into rpt_fltdef from UFDATA_999_2011..rpt_fltdef

select * into rpt_glbdef from UFDATA_999_2011..rpt_glbdef

select * into rpt_grpdef from UFDATA_999_2011..rpt_grpdef4

select * into rpt_reldef from UFDATA_999_2011..rpt_reldef

select * into rpt_folder from UFDATA_999_2011..rpt_folder

select * into rpt_itmdef from UFDATA_999_2011..rpt_itmdef

二、结转报错

1、结转供应链时 提示 存货系统结转失败。

常用脚本:

对上年执行

update IA_Subsidiary set ioutCost=d.iUnitPrice,iAoutPrice=d.iSum from

(select c.autoid,b.iUnitPrice,b.iSum from SaleBillVouch a inner join SaleBillVouchs b on a.SBVID=b.SBVID

inner join IA_Subsidiary c on a.SBVID=c.iPZID and b.AutoID=c.ID where iAOutPrice>1000000000) d

where IA_Subsidiary.AutoID=d.autoid and IA_Subsidiary.iAOutPrice>1000000000

update RdRecords set iUnitCost=0,iPrice=0 where AutoID in( select id from IA_Subsidiary where iAInPrice>1000000000 )

update IA_Subsidiary set iInCost=0,iAInPrice=0 where iAInPrice>1000000000

2、结转固定资产报错:列名或所提供值的数目与表定义不匹配

4c2b9c1694e8f3afbf72297e23489609_Avop0zcWXq3mAAAAAElFTkSuQmCC.png

通用脚本:

对上下两个年度执行

update accinformation set cvalue=’8.216′ where csysid=’AA’ and cid=’99’

drop

table

rpt_flddef,rpt_fltdef,rpt_glbdef,rpt_grpdef,rpt_reldef,rpt_folder,rpt_itmdef

select * into rpt_flddef from UFDATA_999_2011..rpt_flddef

select * into rpt_fltdef from UFDATA_999_2011..rpt_fltdef

select * into rpt_glbdef from UFDATA_999_2011..rpt_glbdef5

select * into rpt_grpdef from UFDATA_999_2011..rpt_grpdef

select * into rpt_reldef from UFDATA_999_2011..rpt_reldef

select * into rpt_folder from UFDATA_999_2011..rpt_folder

select * into rpt_itmdef from UFDATA_999_2011..rpt_itmdef

alter table RPT_FldDEF drop column CurGroupCol,CurSubTotalCol

3、年度结转应手应付结转报错错误为 0。

通用脚本

对上年执行

delete From ap_detail where ccovouchid not in (

select cvouchid from ap_vouch where cvouchtype=’R0′) and cCoVouchType = ‘R0’

delete from Ap_Detail where cFlag = ‘AR’ and cCoVouchType = ‘R0’ and ccoVouchID =

’01’

delete From Ap_Detail where cFlag = ‘AR’ and cCoVouchType = ‘R0′ and (ccoVouchID>=’01’

and ccoVouchID<=’04’ )

三、反年结

1、固定资产反年结(工具无法选择 20 年以后的年度)

通用脚本:

update ufsystem..ua_account_sub set bClosing=0 where cacc_id=’ 账 套 号 ‘ and

csub_id=’FA’ and iyear = 反年结的年度

其中 账套号改成实际的账套号、反年结年度改成对应需要反年结的年度

2、上度账启用了某模块,但年度结转后想反启用

通用脚本:

模块反启用需要在数据为中执行,执行语句前修改 cacc_id 为账套编号,UFdata_001_2022

为用户需要反启用的账套库,执行前请备份所有账套数据,以免执行到其他账套中:

——库存

Update ufdata_001_2022..accinformation set cvalue=’cdefault’ where csysid=’st’and ctype=’ddate’

Delete ufsystem..ua_account_sub where cacc_id=’001′ and csub_id=’st’and iyear=’2022′

Delete ufsystem..ua_account_sub where cacc_id=’001′ and csub_id=’st’and iyear=’9999′

~~~~~~~~~~~~~~~~~~~~~~~其他模块反启用语句~~~~~~~~~~~~~~~~~~~~~~~~~

——应收

Update ufdata_001_2022..accinformation set cvalue=’cdefault’ where csysid=’ar’and ctype=’ddate’

Delete ufsystem..ua_account_sub where cacc_id=’001′ and csub_id=’ar’ and iyear=’2022′

Delete ufsystem..ua_account_sub where cacc_id=’001′ and csub_id=’ar’ and iyear=’9999’6

——应付

update ufdata_001_2022..accinformation set cvalue=’cdefault’wherecsysid=’ap’and ctype=’ddate’

delete ufsystem..ua_account_sub where cacc_id=’001′ and csub_id=’ap’ and iyear=’2022′

delete ufsystem..ua_account_sub where cacc_id=’001′ and csub_id=’ap’ and iyear=’9999′

——采购

update ufdata_001_2022..accinformation setcvalue=’cdefault’wherecsysid=’pu’and ctype=’ddate’

delete ufsystem..ua_account_sub where cacc_id=’001’andcsub_id=’pu’andiyear=’2022′

delete ufsystem..ua_account_sub where cacc_id=’001’andcsub_id=’pu’andiyear=’9999′

——销售

update ufdata_001_2022..accinformation set cvalue=’cdefault’wherecsysid=’sa’and ctype=’ddate’

delete ufsystem..ua_account_sub where cacc_id=’001’and csub_id=’sa’and iyear=’2022′

delete ufsystem..ua_account_sub where cacc_id=’001’and csub_id=’sa’and iyear=’9999′

——核算

update ufdata_001_2022..accinformation set cvalue=’cdefault’where csysid=’ia’and ctype=’ddate’

delete ufsystem..ua_account_sub where cacc_id=’001’and csub_id=’ia’and iyear=’2022′

delete ufsystem..ua_account_sub where cacc_id=’001’and csub_id=’ia’and iyear=’9999′

——固定资产

update ufdata_001_2022..accinformation set cvalue=’cdefault’where csysid=’fa’and ctype=’ddate’

delete ufsystem..ua_account_sub where cacc_id=’001’and csub_id=’fa’and iyear=’2022′

delete ufsystem..ua_account_sub where cacc_id=’001’and csub_id=’fa’and iyear=’9999′

3、核算模块取消期初年结过来的数据

通用脚本:

对新年执行(记得备份)

delete from IA_Subsidiary where iMonth = 0

delete from IA_Summary where iMonth = 0

4、工资模块上年需要反年结

通用脚本:

对上年执行

Update wa_account set ilastmonth=11 where cgzgradenum=’工资类别编号’

Update gl_mend set bflag_wa=0 where iperiod=12

其中工资类别编号改成对应的编号

对系统库执行

update UFSystem..ua_account_sub set bClosing=’0′ where cacc_id=’账套号’ and iYear=’

年度’

其中【账套号】改成实际账套号,【年度】那里改成反年结的那个年度

四、其他

1、清除异常互斥

通用脚本:

对账套对应年度执行

delete from UFSystem..UA_task

delete from UFSystem..UA_TaskLog

delete from UFSystem..UA_Log

delete from GL_mccontrol

delete from GL_mvcontrol

delete from GL_mvocontrol

delete from LockVouch

delete from fa_Control

2、年结日志提示正确 0,错误 0

通用脚本:

对上年执行

update gl_accvouch set csettle=null where csettle=’ ‘

3、年结后进入固定资产模块提示,请在启用日期后登陆账套。

通用脚本:

update AccInformation set cValue =’ 年 度 -01-01′ where cSysID =’FA’ And cName =’dStartDate’

其中【年度】改成实际的年度

4、查询年结前后,上个年度存在,而下个年度不存在的客户编码

通用脚本:

对上个年度执行

select ccuscode as 客户编码 from

customer Where ccuscode not in (select ccuscode

from ufdata_账套号_下个年度..customer) group by ccuscode

其中【账套号】、【下个年度】按照实际去修改

5、年结结转后,进入账套销售模块提示:在对应所需名称或序数的集合中,未找到项目–cShipAddress。

354419c2cfe66ee86e98ec3c6f787a0c_vZBKXEdZM9IAAAAASUVORK5CYII=.png

通用脚本:

alter table rdrecord add csccode varchar(2),cshipaddress varchar(200)

6、年结后,特殊行业性质无法结转损益(工具 20 年以后无法使用)

通用脚本:

UPDATE GL_CodeClass SET bcheck=1 WHERE cclass IN (‘收入’,’支出’,’收入费用’) AND

itrade IN (SELECT itrade_id FROM GL_BTrade WHERE ctrade_name=’行业性质’)

7、系统管理升级 SQL 提示:视图 MatchVouchM、KcMatchlist 无效

通用脚本:

create view MatchVouchM as select * from MatchVouch

Go

create view KcMatchlist as select * from MatchVouch

Go

8、系统管理里升级 SQL 提示:不能将 Null 值插入 Order 列

a70c73b04b8a83e47b11f1e1a667d4f2_D+zi5xOvafoNAAAAAElFTkSuQmCC.png

通用脚本:

alter table ufsystem..ua_userflow alter column iorder tinyint null

发表回复

加入本站SVIP会员,海量资源免费查看下载

目前为止共有159位优秀的SVIP会员加入! 立即加入!