金蝶专业版12.3的帐套升级到旗舰版的时候出现错误
金蝶云社区-159xxxx1385
159xxxx1385
0人赞赏了该文章 1,166次浏览 未经作者许可,禁止转载编辑于2015年12月22日 15:19:07


详细错误如下
不能将值 NULL 插入列 'FDate',表 'KISTOAIS20151222145858.dbo.t_RP_Plan_Ap';列不允许有空值。INSERT 失败。
--为发票生成排列序号
DECLARE @MaxID INT
DECLARE @FRowID INT
SET @FRowID=1
UPDATE KIS_ICSale SET @FRowID=FRowID=@FRowID+1
UPDATE KIS_ICPurchase SET @FRowID=FRowID=@FRowID+1
--处理销售发票信息
--写入往来表
SELECT @MaxID=isnull(max(FID),0)+1 FROM t_rp_Contact
INSERT INTO t_rp_contact(FID,FYear,FPeriod,FRP,FType,
FDate,FFincDate,FNumber,FCustomer,FDepartment,FEmployee,FCurrencyID,FExchangeRate,
FAmount,FAmountFor,FRemainAmount,FRemainAmountFor,
FContractNo,FInvoiceID,FRPBillID,FBillID,FBegID,
FExpenseID,FBussinessDiscount,FCashDiscount,FRPDate,
FDue,FIsBad,FBadReason,FVoucherID,FGroupID,FAccountID,FIsInit,FStatus,
FPost,FToBal,FPre,FK3Import,FInterestRate,
FCheckType,FBillType,FInvoiceType,FItemClassID,FExplanation,FSmInvID,FPreparer)
SELECT @MaxID+t1.FRowID as FID,FYear,FPeriod,1 as FRP,3 as FType,
FDate,FDate,t1.FBillNO,FCustID,isnull(FDeptID,0),isnull(FEmpID,0),FCurrencyID,FExchangeRate,
case when t1.FClassTypeID=1000000 then t2.FStdAmount else t2.FStdAmountIncludeTax end as FAmount,
case when t1.FClassTypeID=1000000 then t2.FAmount else t2.FAmountIncludeTax end as FAmountFor,
case when t1.FClassTypeID=1000000 then t2.FStdAmount else t2.FStdAmountIncludeTax end as FRemainAmount,
case when t1.FClassTypeID=1000000 then t2.FAmount else t2.FAmountIncludeTax end as FRemainAmountFor,
'',t1.FInterID,0,0,0,
0,0,0,FDate,
0,0,null,ISNULL(FVchInterID,0),0,0,0,FStatus,
0,0,0 FPre,0,0,
0,0,case when t1.FSaleStyle=100 then 3 else 1 end as FInvoiceType,1,FExplanation,0,FBillerID
FROM KIS_ICSale t1
join (SELECT FInterID,sum(FStdAmount) as FStdAmount,sum(FStdAmountIncludeTax) as FStdAmountIncludeTax,
sum(FAmount) as FAmount,sum(FAmountIncludeTax) as FAmountIncludeTax
FROM KIS_ICSaleEntry
GROUP BY FInterID) t2 on t1.FInterID=t2.FInterID
WHERE t1.FCancellation=0
UPDATE KIS_ICSale SET FK3ContactID=@MaxID+FRowID
--收款计划
INSERT INTO t_rp_Plan_AR(FOrgID,FDate,
FAmount,FAmountFor,FRemainAmount,FRemainAmountFor,
FInterID,FRP,FIsinit)
SELECT @MaxID+t1.FRowID as FID,FPayDate,
case when t1.FClassTypeID=1000000 then t2.FStdAmount else t2.FStdAmountIncludeTax end as FAmount,
case when t1.FClassTypeID=1000000 then t2.FAmount else t2.FAmountIncludeTax end as FAmountFor,
case when t1.FClassTypeID=1000000 then t2.FStdAmount else t2.FStdAmountIncludeTax end as FRemainAmount,
case when t1.FClassTypeID=1000000 then t2.FAmount else t2.FAmountIncludeTax end as FRemainAmountFor,
t1.FInterID,0,0
FROM KIS_ICSale t1
join (SELECT FInterID,sum(FStdAmount) as FStdAmount,sum(FStdAmountIncludeTax) as FStdAmountIncludeTax,
sum(FAmount) as FAmount,sum(FAmountIncludeTax) as FAmountIncludeTax
FROM KIS_ICSaleEntry
GROUP BY FInterID) t2 on t1.FInterID=t2.FInterID
WHERE t1.FCancellation=0
insert t_K3_ContactRelationInfo(FTableName,FInterID,FClassTypeID,FContactID,FTableDescription)
select 'icsale',FInterID,FTranType,FK3ContactID,'销售发票' from KIS_ICSale
--处理采购发票信息
--写入往来表
SELECT @MaxID=isnull(max(FID),0)+1 FROM t_rp_Contact
INSERT INTO t_rp_contact(FID,FYear,FPeriod,FRP,FType,
FDate,FFincDate,FNumber,FCustomer,FDepartment,FEmployee,FCurrencyID,FExchangeRate,
FAmount,FAmountFor,FRemainAmount,FRemainAmountFor,
FContractNo,FInvoiceID,FRPBillID,FBillID,FBegID,
FExpenseID,FBussinessDiscount,FCashDiscount,FRPDate,
FDue,FIsBad,FBadReason,FVoucherID,FGroupID,FAccountID,FIsInit,FStatus,
FPost,FToBal,FPre,FK3Import,FInterestRate,
FCheckType,FBillType,FInvoiceType,FItemClassID,FExplanation,FSmInvID,FPreparer)
SELECT @MaxID+t1.FRowID as FID,FYear,FPeriod,0 as FRP,4 as FType,
FDate,FDate,t1.FBillNO,t1.FSupplyID,isnull(FDeptID,0),isnull(FEmpID,0),FCurrencyID,FExchangeRate,
case when t1.FClassTypeID=1000003 then t2.FStdAmount else t2.FStdAmountIncludeTax end as FAmount,
case when t1.FClassTypeID=1000003 then t2.FAmount else t2.FAmountIncludeTax end as FAmountFor,
case when t1.FClassTypeID=1000003 then t2.FStdAmount else t2.FStdAmountIncludeTax end as FRemainAmount,
case when t1.FClassTypeID=1000003 then t2.FAmount else t2.FAmountIncludeTax end as FRemainAmountFor,
'',t1.FInterID,0,0,0,
0,0,0,FDate,
0,0,null,ISNULL(FVchInterID,0),0,0,0,FStatus,
0,0,0 FPre,0,0,
0,0,case when t1.FPOStyle=251 then 4 else 2 end as FInvoiceType,8,FExplanation,0,FBillerID
FROM KIS_ICPurchase t1
join (SELECT FInterID,sum(FStdAmount) as FStdAmount,sum(FStdAmountIncludeTax) as FStdAmountIncludeTax,
sum(FAmount) as FAmount,sum(FAmountIncludeTax) as FAmountIncludeTax
FROM KIS_ICPurchaseEntry
GROUP BY FInterID) t2 on t1.FInterID=t2.FInterID
WHERE t1.FCancellation=0
UPDATE KIS_ICPurchase SET FK3ContactID=@MaxID+FRowID
--付款计划
INSERT INTO t_rp_Plan_AP(FOrgID,FDate,
FAmount,FAmountFor,FRemainAmount,FRemainAmountFor,
FInterID,FRP,FIsinit)
SELECT @MaxID+t1.FRowID as FID,FPayDate,
case when t1.FClassTypeID=1000003 then t2.FStdAmount else t2.FStdAmountIncludeTax end as FAmount,
case when t1.FClassTypeID=1000003 then t2.FAmount else t2.FAmountIncludeTax end as FAmountFor,
case when t1.FClassTypeID=1000003 then t2.FStdAmount else t2.FStdAmountIncludeTax end as FRemainAmount,
case when t1.FClassTypeID=1000003 then t2.FAmount else t2.FAmountIncludeTax end as FRemainAmountFor,
t1.FInterID,0,0
FROM KIS_ICPurchase t1
join (SELECT FInterID,sum(FStdAmount) as FStdAmount,sum(FStdAmountIncludeTax) as FStdAmountIncludeTax,
sum(FAmount) as FAmount,sum(FAmountIncludeTax) as FAmountIncludeTax
FROM KIS_ICPurchaseEntry
GROUP BY FInterID) t2 on t1.FInterID=t2.FInterID
WHERE t1.FCancellation=0
insert t_K3_ContactRelationInfo(FTableName,FInterID,FClassTypeID,FContactID,FTableDescription)
select 'icpurchase',FInterID,FTranType,FK3ContactID,'采购发票' from KIS_ICPurchase