KIS专业版9.1SP1版本的账套想升级到KIS专业版14.0报错!!!!
金蝶云社区-云社区用户i4081234
云社区用户i4081234
0人赞赏了该文章 1,609次浏览 未经作者许可,禁止转载编辑于2015年07月22日 23:40:40

KIS专业版9.1SP1版本的账套想升级到KIS专业版14.0,提示一大堆报错该如何处理?是哪里出问题了?该如何解决,请解答!!

------------------------错误信息内容如下!!
数据库升级失败!SQL文件不全或SQL语句有误!
错误描述:对象名 'UpdateReceiveAmount' 无效。
Sql文件名:C:\Program Files\Kingdee\KIS\Profession\Common\SqlSrv\SP_KISV10_ArApData.sql
Sql内容:/*rickey --增加应收源单视图 --2008.10.14 ----END*/
/*rickey ---修改触发器 --2008.10.14 ----BEGIN*/
ALTER TRIGGER [UpdateReceiveAmount] ON [dbo].[t_RP_RBillEntry]
FOR INSERT, UPDATE,Delete
AS
Declare @blnSucc1 as tinyint
Declare @blnSucc2 as tinyint
Declare @blnSucc3 as tinyint
Declare @blnSucc4 as tinyint
set @blnSucc1=0
set @blnSucc2=0
set @blnSucc3=0
set @blnSucc4=0
--删除操作
if not exists (Select 1 From Inserted)
begin
--销售发票
Update ICSale Set FReceiveAmountFor=Isnull(FReceiveAmountFor,0) - Deleted.FBillSettleAmountFor
, FUnReceiveAmountFor=Isnull(FUnReceiveAmountFor,0) + Deleted.FBillSettleAmountFor
,FCheckStatus=(case When Isnull(FReceiveAmountFor,0) - Deleted.FBillSettleAmountFor=0 then 0 else 1 end)
From IcSale inner Join Deleted on IcSale.FInterId=Deleted.FInterId
Where Deleted.FClassId_SRC in (1000000,1000002)
--期初
Update t_rp_Initial Set FCheckAmountFor=Isnull(FCheckAmountFor,0) - Deleted.FBillSettleAmountFor
, FUnCheckAmountFor=Isnull(FUnCheckAmountFor,0) + Deleted.FBillSettleAmountFor
,FCheckStatus=(case When Isnull(FCheckAmountFor,0) - Deleted.FBillSettleAmountFor=0 then 0 else 1 end)
From t_rp_Initial inner Join Deleted on t_rp_Initial.FInterId=Deleted.FInterId
Where Deleted.FClassId_SRC=1000005
--其他应收
Update t_RP_ROtherBill Set FCheckAmountFor=Isnull(FCheckAmountFor,0) - Deleted.FBillSettleAmountFor
From t_RP_ROtherBill inner Join Deleted on t_RP_ROtherBill.FbillID=Deleted.FInterId
Where Deleted.FClassId_SRC=1000205
--收款单退款
Update e Set e.FBackAmountFor=Isnull(e.FBackAmountFor,0) - d.FBillSettleAmountFor
From t_RP_RBillEntry e inner Join Deleted d on e.FbillID=d.FInterId
and e.FEntryID=d.FEntryID_SRC
Where d.FClassId_SRC=1000201
--Update t_rp_Initial Set FCheckAmount=FCheckAmountFor,FUnCheckAmount=FUnCheckAmountFor
end
else
begin
--插入操作
if not Exists(Select 1 from Deleted)
begin
--发票收款判断
if exists( Select 1 from IcSale inner Join Inserted on IcSale.FInterId=Inserted.FInterId
Where abs(Isnull(IcSale.FUnReceiveAmountFor,0)) - abs(Inserted.FBillSettleAmountFor) <0 And Inserted.FClassId_SRC in(1000000,1000002))
begin
ROLLBACK TRAN
RAISERROR('收款单中包含核销金额大于未核销金额的销售发票,不允许保存!',18,18)
RETURN
end
else
set @blnSucc1=1
--期初应收 收款判断
if exists( Select 1 from t_rp_Initial inner Join Inserted on t_rp_Initial.FInterId=Inserted.FInterId
Where Isnull(t_rp_Initial.FUnCheckAmountFor,0) - Inserted.FBillSettleAmountFor <0 And Inserted.FClassId_SRC =1000005)
begin
ROLLBACK TRAN
RAISERROR('收款单中包含核销金额大于未核销金额的期初应收单据,不允许保存!',18,18)
RETURN
end
else
set @blnSucc2=1
--其他应收 判断
if exists( Select 1 from t_RP_ROtherBill inner Join Inserted on t_RP_ROtherBill.FbillID=Inserted.FInterId
Where abs(Isnull(t_RP_ROtherBill.FAmountFor,0)) - abs(Isnull(t_RP_ROtherBill.FCheckAmountFor,0)) - abs(Inserted.FBillSettleAmountFor) <0
And Inserted.FClassId_SRC =1000205)
begin
ROLLBACK TRAN
RAISERROR('收款单中包含核销金额大于未核销金额的其他收款单据,不允许保存!',18,18)
RETURN
end
else
set @blnSucc3=1
--收款单退款
if exists( Select 1 from t_RP_RBillEntry inner Join Inserted on t_RP_RBillEntry.FbillID=Inserted.FInterId
and t_RP_RBillEntry.FEntryID=Inserted.FEntryID_SRC
Where abs(Isnull(t_RP_RBillEntry.FBillSettleAmountFor,0)) - abs(Isnull(t_RP_RBillEntry.FBackAmountFor,0)) - abs(Inserted.FBillSettleAmountFor) <0
And Inserted.FClassId_SRC =1000201)
begin
ROLLBACK TRAN
RAISERROR('收款单中包含核销金额大于未核销金额的收款单单据,不允许保存!',18,18)
RETURN
end
else
set @blnSucc4=1
if @blnSucc1=1 and @blnSucc2=1 and @blnSucc3=1 and @blnSucc4=1
begin
--更新销售发票
Update ICSale Set FReceiveAmountFor=Isnull(FReceiveAmountFor,0) + Inserted.FBillSettleAmountFor
, FUnReceiveAmountFor=Isnull(FUnReceiveAmountFor,0) - Inserted.FBillSettleAmountFor
,FCheckStatus=(case when (Isnull(FUnReceiveAmountFor,0) - Inserted.FBillSettleAmountFor)=0 then 2 else 1 end)
From IcSale inner Join Inserted on IcSale.FInterId=Inserted.FInterId
Where Inserted.FClassId_SRC in(1000000,1000002)
--更新期初
Update t_rp_Initial Set FCheckAmountFor=Isnull(FCheckAmountFor,0) + Inserted.FBillSettleAmountFor
, FUnCheckAmountFor=Isnull(FUnCheckAmountFor,0) - Inserted.FBillSettleAmountFor
,FCheckStatus=(case when (Isnull(FUnCheckAmountFor,0) - Inserted.FBillSettleAmountFor)=0 then 2 else 1 end)
From t_rp_Initial inner Join Inserted on t_rp_Initial.FInterId=Inserted.FInterId
Where Inserted.FClassId_SRC =1000005
--更新其他应收
Update t_RP_ROtherBill Set FCheckAmountFor=Isnull(FCheckAmountFor,0) + Inserted.FBillSettleAmountFor
From t_RP_ROtherBill inner Join Inserted on t_RP_ROtherBill.FBillID=Inserted.FInterId
Where Inserted.FClassId_SRC =1000205
--更新收款单退款金额
Update e Set e.FBackAmountFor=Isnull(e.FBackAmountFor,0) + i.FBillSettleAmountFor
From t_RP_RBillEntry e inner Join Inserted i on e.FBillID=i.FInterId
and e.FEntryID=i.FEntryID_SRC
Where i.FClassId_SRC =1000201
--Update t_rp_Initial Set FCheckAmount=FCheckAmountFor,FUnCheckAmount=FUnCheckAmountFor
end
--GWL--20070329--Beg(如果出现不符合条件的收款,则回滚
else
Begin
ROLLBACK TRAN
RAISERROR('保存失败!收款单保存过程出现错误,请检查单据确认无误后重新保存!',18,18)
RETURN
end
--GWL--20070329--End(如果出现不符合条件的收款,则回滚
end
--更新操作
else
begin
--发票收款判断
if exists( Select 1 From IcSale inner Join Inserted on IcSale.FInterId=Inserted.FInterId
inner join Deleted on IcSale.FInterId=Deleted.FInterId
Where Inserted.FClassId_SRC in (1000000,1000002) and (abs(IcSale.FUnReceiveAmountFor) - abs(Inserted.FBillSettleAmountFor)+abs(Deleted.FBillSettleAmountFor) <0))
begin
ROLLBACK TRAN
RAISERROR('收款单中包含核销金额大于未核销金额的销售发票,不允许保存!',18,18)
RETURN
end
else
set @blnSucc1=1
--期初应收 收款判断
if exists( Select 1 From t_rp_Initial
inner Join Inserted on t_rp_Initial.FInterId=Inserted.FInterId
inner join Deleted on t_rp_Initial.FInterId=Deleted.FInterId
Where Inserted.FClassId_SRC =1000005 and (t_rp_Initial.FUnCheckAmountFor - Inserted.FBillSettleAmountFor+Deleted.FBillSettleAmountFor <0))
begin
ROLLBACK TRAN
RAISERROR('收款单中包含核销金额大于未核销金额的期初应收单据,不允许保存!',18,18)
RETURN
end
else
set @blnSucc2=1
--其他应收 收款判断
if exists( Select 1 From t_RP_ROtherBill
inner Join Inserted on t_RP_ROtherBill.FBillID=Inserted.FInterId
inner join Deleted on t_RP_ROtherBill.FBillID=Deleted.FInterId
Where Inserted.FClassId_SRC =1000205
and (abs(t_RP_ROtherBill.FAmountFor)-abs(t_RP_ROtherBill.FCheckAmountFor) - abs(Inserted.FBillSettleAmountFor)+abs(Deleted.FBillSettleAmountFor) <0))
begin
ROLLBACK TRAN
RAISERROR('收款单中包含核销金额大于未核销金额的其他收款单据,不允许保存!',18,18)
RETURN
end
else
set @blnSucc3=1
--收款单判断
if exists( Select 1 From t_RP_RBillEntry
inner Join Inserted on t_RP_RBillEntry.FBillID=Inserted.FInterId
and t_RP_RBillEntry.FEntryID=Inserted.FEntryID_SRC
inner join Deleted on t_RP_RBillEntry.FBillID=Deleted.FInterId
and t_RP_RBillEntry.FEntryID=Deleted.FEntryID_SRC
Where Inserted.FClassId_SRC =1000201
and (abs(t_RP_RBillEntry.FBillSettleAmountFor)-abs(t_RP_RBillEntry.FBackAmountFor) - abs(Inserted.FBillSettleAmountFor)+abs(Deleted.FBillSettleAmountFor) <0))
begin
ROLLBACK TRAN
RAISERROR('收款单中包含核销金额大于未核销金额的收款单源单单据,不允许保存!',18,18)
RETURN
end
else
set @blnSucc4=1
if @blnSucc1=1 and @blnSucc2=1 and @blnSucc3=1 and @blnSucc4=1
begin
--销售发票
Update ICSale Set FReceiveAmountFor=Isnull(FReceiveAmountFor,0) + Inserted.FBillSettleAmountFor
-Deleted.FBillSettleAmountFor, FUnReceiveAmountFor=FUnReceiveAmountFor - Inserted.FBillSettleAmountFor
+Deleted.FBillSettleAmountFor
,FCheckStatus=(case when (FUnReceiveAmountFor - Inserted.FBillSettleAmountFor+Deleted.FBillSettleAmountFor)=0 then 2
when (Isnull(FReceiveAmountFor,0) + Inserted.FBillSettleAmountFor-Deleted.FBillSettleAmountFor)=0 then 0 else 1 end)
From IcSale
inner Join Inserted on IcSale.FInterId=Inserted.FInterId inner join Deleted on IcSale.FInterId=Deleted.FInterId
Where Inserted.FClassId_SRC in (1000000,1000002)
--期初
Update t_rp_Initial Set FCheckAmountFor=Isnull(FCheckAmountFor,0) + Inserted.FBillSettleAmountFor
-Deleted.FBillSettleAmountFor, FUnCheckAmountFor=FUnCheckAmountFor - Inserted.FBillSettleAmountFor
+Deleted.FBillSettleAmountFor
,FCheckStatus=(case when (FUnCheckAmountFor - Inserted.FBillSettleAmountFor+Deleted.FBillSettleAmountFor)=0 then 2
when (Isnull(FCheckAmountFor,0) + Inserted.FBillSettleAmountFor-Deleted.FBillSettleAmountFor)=0 then 0 else 1 end)
From t_rp_Initial inner Join Inserted on t_rp_Initial.FInterId=Inserted.FInterId
inner join Deleted on t_rp_Initial.FInterId=Deleted.FInterId
Where Inserted.FClassId_SRC =1000005
--其他应收
Update t_RP_ROtherBill Set FCheckAmountFor=Isnull(FCheckAmountFor,0) + Inserted.FBillSettleAmountFor-Deleted.FBillSettleAmountFor
From t_RP_ROtherBill inner Join Inserted on t_RP_ROtherBill.FBillID=Inserted.FInterId
inner join Deleted on t_RP_ROtherBill.FBillID=Deleted.FInterId
Where Inserted.FClassId_SRC =1000205
--收款单退款
Update e Set e.FBackAmountFor=Isnull(e.FBackAmountFor,0) + i.FBillSettleAmountFor-d.FBillSettleAmountFor
From t_RP_RBillEntry e inner Join Inserted i on e.FBillID=i.FInterId
and e.FEntryID=i.FEntryID_SRC
inner join Deleted d on e.FBillID=d.FInterId
and e.FEntryID=d.FEntryID_SRC
Where i.FClassId_SRC =1000201
--Update t_rp_Initial Set FCheckAmount=FCheckAmountFor,FUnCheckAmount=FUnCheckAmountFor
end
--GWL--20070329--Beg(如果出现不符合条件的收款,则回滚
else
begin
ROLLBACK TRAN
RAISERROR('保存失败!收款单保存过程检查到错误数据,请检查单据确认无误后再保存!',18,18)
RETURN
end
--GWL--20070329--End(如果出现不符合条件的收款,则回滚
end
end