|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册账号
×
【问题现象】
单据设置表头页签有空白行,无法切换至明细页签/单据设置的栏目设置里有空白行
【解决方案】
切记备份好账套数据,执行以下脚本修复ReportTablecol为空的情况:
-- 脚本执行BEGIN
declare @titleName nvarchar(50)='';
-- 处理单据模板公用自定义项
with voucherControls as
(
select evc.id,evc.FieldName,evc.OriginalTitle,evc.Title,eudi.OriginalTitle as udiOrgTitle,eudi.Title as udiTitle,edp.Title as propTitle
from eap_VoucherControls evc
left join eap_Voucher ev on evc.VoucherID=ev.ID
left join eap_DTO ed on ev.DtoName = ed.Name
left join eap_DTOProperty edp on ed.id = edp.idDTO and evc.FieldName = edp.FieldName
left join Eap_UserDefineItems eudi on edp.FieldName = eudi.FieldName
where (LEN(evc.title)=0 or evc.title is null or LEN(evc.OriginalTitle)=0 or evc.OriginalTitle is null) and
(
(evc.FieldName like 'pubuserdef%' and eudi.Type=1 and (CHARINDEX(concat(',',ev.ID,','),concat(',',eudi.VoucherIDs,','),0)>-1))
or
(evc.FieldName like 'priuserdef%')
)
)
update voucherControls set
OriginalTitle =(
case isnull(OriginalTitle,'')
when ''
then (
case isnull(udiOrgTitle,'')
when ''
then propTitle
else udiOrgTitle
end)
else OriginalTitle
end),
Title =(
case isnull(Title,'')
when ''
then (
case isnull(udiTitle,'')
when ''
then propTitle
else udiTitle
end)
else Title
end);
declare ns1 CURSOR LOCAL SCROLL for
select title from eap_voucher --where title in('销货单','销售订单','销售出库单');
open ns1
FETCH NEXT from ns1 INTO @titleName
WHILE @@FETCH_STATUS=0
BEGIN
declare @headName nvarchar(50)='';
declare @headDtoName nvarchar(50)='';
declare @detailName nvarchar(50)='';
declare @detailDtoName nvarchar(50)='';
declare @idDto nvarchar(50)='';
declare @idDetailDto nvarchar(50)='';
select @headDtoName=DtoName,@headName=Name from eap_Voucher where title=@titleName;
select @detailDtoName=DtoName,@detailName=Name from eap_VoucherTable where VoucherID = (select top 1 id from eap_Voucher where title=@titleName) and Title = '明细';
select @idDto=id from eap_DTO where name =@headDtoName;
select @idDetailDto=id from eap_DTO where name =@detailDtoName;
-- 更新originalTitle
with a as
(
select ert.OriginalTitle,ert.dtoprop,edp.Title from eap_reporttablecol ert
join eap_DTOProperty edp on
edp.Name = substring(ert.dtoprop,LEN(ert.dtoprop) - CHARINDEX('.',reverse(ert.dtoprop),0) + 2, LEN(ert.dtoprop))
and edp.idDTO in (@idDto,@idDetailDto)
where (OriginalTitle is null or LEN(OriginalTitle)=0)
and ert.canDisplay=1
)
update a set OriginalTitle = Title;
-- 更新title
with b as
(
select ert.title as targetTitle,ert.dtoprop,edp.Title from eap_reporttablecol ert
join eap_DTOProperty edp on
edp.Name = substring(ert.dtoprop,LEN(ert.dtoprop) - CHARINDEX('.',reverse(ert.dtoprop),0) + 2, LEN(ert.dtoprop))
and edp.idDTO in (@idDto,@idDetailDto)
where (ert.title is null or Len(ert.title) = 0)
and ert.canDisplay=1
)
update b set targetTitle = Title;
FETCH NEXT from ns1 INTO @titleName
END
Close ns1
deallocate ns1
|
|