描述:
金蝶 K3 wise 13.0
要求:在新建了三个辅助物料,从销售合同一致带入到销售发票。
解决方式:
其实这是金蝶软件的一个bug,在官方应该是有相关补丁的,但是对于没有购买售后的,单次处理需要收费3000元。
下面是相应的解决办法。
第一使用数据跟踪,查看这里执行了那些sql。
就是这句执行完毕之后,提交 xxx 对象无效。
SELECT DISTINCT GetDate() AS FAdviceConsignDate,u1.FAmountFor AS FAmountFor3,u1.FAmountIncludeTaxFor,
u1.FPriceFor AS FAuxPrice,u1.FFactPriceFor AS FAuxPriceDiscount,t4.FUnitGroupID as FItemUnitGroupID,sign(t4.FAuxClassID)-sign(u1.fauxpropid) AS FAuxPropCls,
u1.FAuxPropID,t105.FName AS FAuxPropName,t105.FNumber AS FAuxPropNum,(CASE WHEN u1.FQuantity<u1.FOrderQty_Relative THEN 0 ELSE (u1.FQuantity-u1.FOrderQty_Relative) END) AS FAuxQty,
u1.FTaxPriceFor AS FAuxTaxPrice,t_3003_3003.FName AS FBase1Name,t_3003_3003.FNumber AS FBase1Number,
t_3004_3004.FName AS FBase2Name,t_3004_3004.FNumber AS FBase2Number,t_3002_3002.FName AS FBaseName,
t_3002_3002.FNumber AS FBaseNumber,t10.FName AS FBaseUnitName,v1.FContractNO AS FBillNO,
Case When t4.FErpClsID=1 And t4.FIsCharsourceItem=0 Then 0 When t4.FErpClsID=7 And t4.FIsCharsourceItem=0 Then 36821 Else 36820 END AS FBOMCategory,
(Select Fname FROM t_SubMessage WHERE FInterid=Case When t4.FErpClsID=1 And t4.FIsCharsourceItem=0 Then 0 When t4.FErpClsID=7 And t4.FIsCharsourceItem=0 Then 36821 Else 36820 END ) AS FBOMCategoryName,
(Select FID FROM t_SubMessage WHERE FInterid=Case When t4.FErpClsID=1 And t4.FIsCharsourceItem=0 Then 0 When t4.FErpClsID=7 And t4.FIsCharsourceItem=0 Then 36821 Else 36820 END ) AS FBOMCategoryNumber,
t1.FCarryingAOS,t_10011_10011.FName AS FCclxName,t_10011_10011.FID AS FCclxNumber,
u1.FTaxRate AS FCess,v1.FCheckDate,v1.FContractNo AS FContractBillNo,u1.FEntryID AS FContractEntryID,
u1.FContractID AS FContractInterID,v1.FCurrencyID,t9.FName AS FCurrencyName,t9.FNumber AS FCurrencyNumber,
v1.FCustomer AS FCustID,t1.FName AS FCustName,t1.FNumber AS FCustNumber,v1.FDepartment,
t14.FName AS FDeptIDName,t14.FNumber AS FDeptIDNumber,u1.FBusinessDiscountRate AS FDiscountRate,
t15.FName AS FEmpIDName,t15.FNumber AS FEmpIDNumber,v1.FEmployee,u1.FEntryID,u1.FCclx AS FEntrySelfS0168,
v1.FCurrencyID AS FExchangeRate0,(CASE t9.FOperator WHEN '*' THEN v1.FExchangeRate ELSE Round(Cast(1/v1.FExchangeRate As Decimal(28,10)),12) END) AS FExchangeRate1,
v1.FExchangeRate AS FExchangeRate2,v1.FExchangeRateType,tExRateType.FName AS FExchangeRateTypename,
tExRateType.FNumber AS FExchangeRateTypenumber,v1.FBase1 AS FHeadSelfS0154,v1.FBase AS FHeadSelfS0155,
v1.FBase2 AS FHeadSelfS0156,v1.Fsqgcs AS FHeadSelfS0185,v1.FContractID AS FInterID,
u1.FProductID AS FItemID,Case When (Select Fvalue From t_SystemProfile Where FCategory='IC' AND FKey='ApplyMapInSale')='1' Then IsNull(FMapName,'') Else '' End AS FMapName,
Case When (Select Fvalue From t_SystemProfile Where FCategory='IC' AND FKey='ApplyMapInSale')='1' Then IsNull(FMapNumber,'') Else '' End AS FMapNumber,
t4.FName AS FMatName,t4.FNumber as FMatNumber ,t4.Fmodel,u1.FExplanation AS FNote,
(SELECT FID FROM t_SubMessage WHERE FInterID=14036) AS FPlanMode,v1.FContractID AS FPlanModeName,
v1.FContractID AS FPlanModeNumber,t4.FPriceDecimal,(CASE WHEN u1.FQuantity_Base<u1.FOrderQty_Relative_Base THEN 0 ELSE (u1.FQuantity_Base-u1.FOrderQty_Relative_Base) END) AS FQty,
t4.FQtyDecimal,(CASE WHEN u1.FSecQty>u1.FSecOrderCommitQty THEN (u1.FQuantity_Base-u1.FOrderQty_Relative_Base)/(u1.FSecQty-u1.FSecOrderCommitQty) ELSE 0 END ) AS FSecCoefficient,
(CASE WHEN u1.FSecQty>u1.FSecOrderCommitQty THEN u1.FSecQty-u1.FSecOrderCommitQty ELSE 0 END ) AS FSecQty,
t501.FName AS FSecUnitName,v1.FClassTypeID AS FSelTranTypeID,(SELECT FName FROM v_ICTransType WHERE FID=v1.FClassTypeID) AS FSelTranTypeName,
(SELECT FName FROM v_ICTransType WHERE FID=v1.FClassTypeID) AS FSelTranTypeNumber,
t8.FName AS FSettleIDName,v1.FSettlementMethod,t8.FNumber AS FSettleNumber,v1.FContractNo AS FSourceBillNo,
u1.FContractID AS FSourceInterID,v1.FClassTypeID AS FSourceTranType,t_39.FName AS FsqgcsName,
t_39.FNumber AS FsqgcsNumber,t4.FTrack,u1.FUnitID,t7.FName AS FUnitName,t7.FNumber AS FUnitNumber
FROM t_RPContract v1
INNER JOIN t_RPContractEntry u1 ON v1.FContractID=u1.FContractID
LEFT OUTER JOIN t_Organization t1 ON v1.FCustomer=t1.FItemID
LEFT OUTER JOIN t_Currency t9 ON v1.FCurrencyID=t9.FCurrencyID
LEFT OUTER JOIN t_Department t14 ON v1.FDepartment=t14.FItemID
LEFT OUTER JOIN t_Emp t15 ON v1.FEmployee=t15.FItemID
LEFT OUTER JOIN ICItemMapping m1 ON v1.FCustomer=m1.FCompanyID And u1.FProductID=m1.FItemID And m1.FPropertyID=1
LEFT OUTER JOIN v_base_exratetype texratetype ON v1.FExchangeRateType=texratetype.FID
LEFT OUTER JOIN t_Settle t8 ON v1.FSettlementMethod=t8.FItemID
LEFT OUTER JOIN t_Item t_3003 ON v1.FBase1=t_3003.FItemID
LEFT OUTER JOIN t_Item t_3002 ON v1.FBase=t_3002.FItemID
LEFT OUTER JOIN t_Item t_3004 ON v1.FBase2=t_3004.FItemID
LEFT OUTER JOIN t_Item t_3003_3003 ON v1.FBase1=t_3003_3003.FItemID
LEFT OUTER JOIN t_Item t_3002_3002 ON v1.FBase=t_3002_3002.FItemID
LEFT OUTER JOIN t_Item t_3004_3004 ON v1.FBase2=t_3004_3004.FItemID
LEFT OUTER JOIN t_Emp t_39 ON v1.Fsqgcs=t_39.FItemID
LEFT OUTER JOIN t_10017 ON v1.FkhlxI=t_10017.FInterID
LEFT OUTER JOIN t_10018 ON v1.FkhlxII=t_10018.FInterID
LEFT OUTER JOIN t_10019 ON v1.Fghfs=t_10019.FInterID
LEFT OUTER JOIN t_10020 ON v1.Fkhsf=t_10020.FInterID
LEFT OUTER JOIN t_10017_10017 ON v1.FkhlxI=t_10017_10017.FInterID
LEFT OUTER JOIN t_10018_10018 ON v1.FkhlxII=t_10018_10018.FInterID
LEFT OUTER JOIN t_10019_10019 ON v1.Fghfs=t_10019_10019.FInterID
LEFT OUTER JOIN t_10020_10020 ON v1.Fkhsf=t_10020_10020.FInterID
INNER JOIN t_ICItem t4 ON u1.FProductID=t4.FItemID
LEFT OUTER JOIN t_MeasureUnit t7 ON u1.FUnitID=t7.FItemID
LEFT JOIN t_AuxItem t105 ON u1.FAuxPropID=t105.FItemID
LEFT OUTER JOIN t_SubMessage t_10011 ON u1.FCclx=t_10011.FInterID
LEFT OUTER JOIN t_SubMessage t_10011_10011 ON u1.FCclx=t_10011_10011.FInterID
LEFT OUTER JOIN t_MeasureUnit t10 ON t4.FUnitID=t10.FItemID
LEFT OUTER JOIN t_MeasureUnit t501 ON t4.FSecUnitID=t501.FItemID
WHERE ((v1.FContractID=15020 AND u1.FEntryID=31420))
ORDER BY v1.FContractID, u1.FEntryID
select * from t_SubMessage
select * from t_SubMesType
清除相关的约束。
select FkhlxI,FkhlxII,Fghfs,Fkhsf from t_RPContract
alter table t_RPContract drop DF__t_RPContr__Fkhlx__100BAC25
alter table t_RPContract drop column FkhlxI
alter table t_RPContract drop DF__t_RPContr__Fkhlx__11F3F497
alter table t_RPContract drop column FkhlxII
alter table t_RPContract drop DF__t_RPContr__Fghfs__12E818D0
alter table t_RPContract drop column Fghfs
alter table t_RPContract drop DF__t_RPContr__Fkhsf__15C4857B
alter table t_RPContract drop column Fkhsf
CREATE VIEW t_10017
AS
select * from t_SubMessage WHERE FParentID='10017'
CREATE VIEW t_10018
AS
select * from t_SubMessage WHERE FParentID='10018'
CREATE VIEW t_10019
AS
select * from t_SubMessage WHERE FParentID='10019'
CREATE VIEW t_10020
AS
select * from t_SubMessage WHERE FParentID='10020'
CREATE VIEW t_10017_10017
AS
select * from t_SubMessage WHERE FParentID='10017'
CREATE VIEW t_10018_10018
AS
select * from t_SubMessage WHERE FParentID='10018'
CREATE VIEW t_10019_10019
AS
select * from t_SubMessage WHERE FParentID='10019'
CREATE VIEW t_10020_10020
AS
select * from t_SubMessage WHERE FParentID='10020'