|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册账号
×
U8 10.1升级U8 13.0 提示对象名 'vwNEfitemss' 无效。
D:\U8SOFT\Admin\SQLFILE11000\Main\Ufdata\Structure\data_prv_ne_u1100patch1_nl.sql
错误信息:
-2147217865
对象名 'vwNEfitemss' 无效。
执行如下语句时出错:
create view NE_ReceiptPayVouch_View
as
select distinct
ReceiptPayVouch.ID,
ReceiptPayVouch.Code,ReceiptPayVouch.Name,
ReceiptPayVouch.OperationTypeCode,NE_OperationType.Name as OperationTypeName,NE_OperationType.TypeID,
convert(nvarchar(20),ReceiptPayVouch.VoucherDate,23)as VoucherDate,
DeptID,department.cdepname as DeptName,PersonCode,personOperate.cpersonname as PersonName,
ReceiptPayVouch.Currency,ReceiptPayVouch.VoucherMoney,
ReceiptPayVouch.Used,ReceiptPayVouch.AgentID,
ReceiptPayVouch.MakerID,ReceiptPayVouch.PayState,ReceiptPayVouch.PayFinishDate,ReceiptPayVouch.IsNetPay,
case isnull(ReceiptPayVouch.AuditorID,N'') when N'' then cuser_id else ReceiptPayVouch.AuditorID end as Auditor,
case isnull(ReceiptPayVouch.AuditInfo,N'') when N''
then (N'(' + (case [action] when 1 then N'同意' when 2 then N'不同意' end) +N')'+ opinion )
else ReceiptPayVouch.AuditInfo
end as AuditInfo,
convert(nvarchar(20),
case isnull(OperationDate,N'') when N''
then ReceiptPayVouch.AuditDate
else
case [action] when 1 then OperationDate else ReceiptPayVouch.Auditdate
end
end,23)as AuditDate,
case when isnull(ReceiptPayVouch.MakerID,'')='' then 0 else 1 end as IsMakeVouch,
fitem.citem_name as ItemClassName,ItemClassID,ItemID,fitems.citemname as ItemName,
bg_v_ctrlitem.cItemName as BudgetItemName,ReceiptPayVouch.BudgetItemID,
ReceiptPayVouch.CusCode,ReceiptPayVouch.VenCode,cus.cCusName as CusName,ven.cVenName as VenName,
ReceiptPayVouch.Port1,ReceiptPayVouch.Port1Value,ReceiptPayVouch.Port2,ReceiptPayVouch.Port2Value,
ReceiptPayVouch.Port3,ReceiptPayVouch.Port3Value,ReceiptPayVouch.Port4,ReceiptPayVouch.Port4Value,
ReceiptPayVouch.Port5,ReceiptPayVouch.Port5Value,ReceiptPayVouch.Port6,ReceiptPayVouch.Port6Value,
ReceiptPayVouch.cDefine1,ReceiptPayVouch.cDefine2,ReceiptPayVouch.cDefine3,ReceiptPayVouch.cDefine4,ReceiptPayVouch.cDefine5,
ReceiptPayVouch.cDefine6,ReceiptPayVouch.cDefine7,
ReceiptPayVouch.cDefine8,ReceiptPayVouch.cDefine9,ReceiptPayVouch.cDefine10,ReceiptPayVouch.cDefine11,ReceiptPayVouch.cDefine12,
ReceiptPayVouch.cDefine13,ReceiptPayVouch.cDefine14,ReceiptPayVouch.cDefine15,ReceiptPayVouch.cDefine16,
Cast(ReceiptPayVouch.ts As bigint) as ts,ReceiptPayVouch.IsRedVouch
from
(
--借款单
select distinct
vouch.ID,vouch.Code,vouch.Name,
vouch.OperationTypeCode,vouch.LoanDate as VoucherDate,
vouch.DeptID,vouch.LoanPersonID as PersonCode,
vouch.Currency,vouch.LoanMoney as VoucherMoney,
vouch.MakerID,vouch.AgentID,vouch.Used,
vouch.AuditorID,vouch.AuditDate,vouch.AuditInfo,
vouch.IsFinalAudit as IsAudit,vouch.AuditState,
vouch.IsSettle,vouch.IsNetPay,vouch.PayState,vouch.PayFinishDate,
vouch.ItemClassID,vouch.ItemID,vouch.BudgetItemID,vouch.CusCode,vouch.VenCode,
vouch.Port1,vouch.Port1Value,vouch.Port2,vouch.Port2Value,
vouch.Port3,vouch.Port3Value,vouch.Port4,vouch.Port4Value,
vouch.Port5,vouch.Port5Value,vouch.Port6,vouch.Port6Value,
vouch.cDefine1,vouch.cDefine2,vouch.cDefine3,vouch.cDefine4,vouch.cDefine5,
vouch.cDefine6,vouch.cDefine7,
vouch.cDefine8,vouch.cDefine9,vouch.cDefine10,vouch.cDefine11,vouch.cDefine12,
vouch.cDefine13,vouch.cDefine14,vouch.cDefine15,vouch.cDefine16,vouch.ts,0 as IsRedVouch
from ne_loanvouch as vouch
inner join NE_LoanVouch_Sub as subVouch
on vouch.ID = subVouch.LoanVouchID
where isnull(vouch.AuditorID,'')<>''
--IsNull(vouch.IsBegin ,0)= 0 And isnull(vouch.AuditorID,'')<>''
union
---报销单 付款(冲借款且有退还或补领信息)
select distinct
vouch.ID,vouch.Code,vouch.Name,
vouch.OperationTypeCode,vouch.ExpenseDate as VoucherDate,
vouch.DeptID,vouch.ExpenserID as PersonCode,
vouch.Currency,vouch.ExpenseMoney as VoucherMoney,
vouch.MakerID,vouch.AgentID,vouch.Used,
vouch.AuditorID,vouch.AuditDate,vouch.AuditInfo,
vouch.IsFinalAudit as IsAudit,vouch.AuditState,
vouch.IsSettle,vouch.IsNetPay,vouch.PayState,vouch.PayFinishDate,
vouch.ItemClassID,vouch.ItemID,vouch.BudgetItemID,vouch.CusCode,vouch.VenCode,
vouch.Port1,vouch.Port1Value,vouch.Port2,vouch.Port2Value,
vouch.Port3,vouch.Port3Value,vouch.Port4,vouch.Port4Value,
vouch.Port5,vouch.Port5Value,vouch.Port6,vouch.Port6Value,
vouch.cDefine1,vouch.cDefine2,vouch.cDefine3,vouch.cDefine4,vouch.cDefine5,
vouch.cDefine6,vouch.cDefine7,
vouch.cDefine8,vouch.cDefine9,vouch.cDefine10,vouch.cDefine11,vouch.cDefine12,
vouch.cDefine13,vouch.cDefine14,vouch.cDefine15,vouch.cDefine16,
vouch.ts,vouch.IsRedVouch
from ne_expenvouch as vouch
inner join NE_ExpenseVouch_Sub as subVouch
on vouch.ID=subVouch.ExpenseVouchID
inner join NE_ExpenseLoanInfo as expenseLoan
on vouch.ID=expenseLoan.ExpenseVouchID and isnull(expenseLoan.IsUsed,0)=0
inner join (
select distinct expenseBalance.ExpenseVouchID from NE_ExpenseBalanceInfo as expenseBalance
inner join NE_BalanceInfo as balance
on expenseBalance.MainBalanceID=balance.ID and balance.IsVerify=1
) as expenseBalance
on vouch.ID=expenseBalance.ExpenseVouchID
where isnull(vouch.AuditorID,'')<>''
union all
select distinct
vouch.ID,vouch.Code,vouch.Name,
vouch.OperationTypeCode,vouch.ExpenseDate as VoucherDate,
vouch.DeptID,vouch.ExpenserID as PersonCode,
vouch.Currency,vouch.ExpenseMoney as VoucherMoney,
vouch.MakerID,vouch.AgentID,vouch.Used,
vouch.AuditorID,vouch.AuditDate,vouch.AuditInfo,
vouch.IsFinalAudit as IsAudit,vouch.AuditState,
vouch.IsSettle,vouch.IsNetPay,vouch.PayState,vouch.PayFinishDate,
vouch.ItemClassID,vouch.ItemID,vouch.BudgetItemID,vouch.CusCode,vouch.VenCode,
vouch.Port1,vouch.Port1Value,vouch.Port2,vouch.Port2Value,
vouch.Port3,vouch.Port3Value,vouch.Port4,vouch.Port4Value,
vouch.Port5,vouch.Port5Value,vouch.Port6,vouch.Port6Value,
vouch.cDefine1,vouch.cDefine2,vouch.cDefine3,vouch.cDefine4,vouch.cDefine5,
vouch.cDefine6,vouch.cDefine7,
vouch.cDefine8,vouch.cDefine9,vouch.cDefine10,vouch.cDefine11,vouch.cDefine12,
vouch.cDefine13,vouch.cDefine14,vouch.cDefine15,vouch.cDefine16,
vouch.ts,vouch.IsRedVouch
from ne_expenvouch as vouch
inner join NE_ExpenseVouch_Sub as subVouch
on vouch.ID=subVouch.ExpenseVouchID
where isnull(vouch.AuditorID,'')<>''
and vouch.ID not in(select distinct ExpenseVouchID from NE_ExpenseLoanInfo where isnull(IsUsed,0)=0)
) as ReceiptPayVouch
left join NE_OperationType
on ReceiptPayVouch.OperationTypeCode=NE_OperationType.Code
left join department
on ReceiptPayVouch.DeptID=department.cdepcode
left join person personOperate
on ReceiptPayVouch.PersonCode=personOperate.cpersoncode
left join bg_v_ctrlitem
on ReceiptPayVouch.BudgetItemID=bg_v_ctrlitem.cItemCode
left join fitem
on ReceiptPayVouch.ItemClassID=fitem.citem_class
left join vwNEfitemss as fitems
on fitem.citem_class=fitems.citem_class and ReceiptPayVouch.ItemID=fitems.citemcode
LEFT JOIN Customer cus
on cus.cCusCode = ReceiptPayVouch.CusCode
LEFT JOIN Vendor ven
on ven.cVenCode = ReceiptPayVouch.VenCode
--Left join WFAudit
-- on VoucherId = CONVERT(varchar(40), ReceiptPayVouch.ID)
-- and operationdate = (
-- select max(operationdate) from WFAudit with(nolock)
-- where VoucherId = CONVERT(varchar(40), ReceiptPayVouch.ID))
--***********************************************
--万伟星优化效率 提高三倍
Left join (
select a.VoucherID,a.operatorid,a.[action],a.opinion,a.OperationDate from WFAudit a with(nolock) inner join (
select VoucherID,max(operationdate) as operationdate from WFAudit with(nolock) where VoucherID in
(
--借款单
select
CONVERT(varchar(40), ID)
from ne_loanvouch with(nolock)
where IsNull(IsBegin ,0)= 0
And isnull(AuditorID,'')<>''
union
--报销单 付款
select
CONVERT(varchar(40), ID)
from ne_expenvouch with(nolock)
where isnull(AuditorID,'')<>''
) group by VoucherID ) b
on a.VoucherID=b.VoucherID and a.operationdate=b.operationdate
) WFAudit on VoucherId = CONVERT(varchar(40), ReceiptPayVouch.ID)
--***********************************************
left join UserHrPersonContro
on cPsn_num = operatorid
|
|