cloud6.0+9月1号补丁;
求助:期初成本调整单提交成功后,点击审核时报错,如图;这是怎么回事???
QQ:2893337231
MERGE 语句试图多次更新或删除同一行。目标行与多个源行匹配时会出现这种情况。MERGE 语句无法多次更新/删除目标表的同一行。请简化 ON 子句,以确保目标行最多与一个源行匹配,也可以使用 GROUP BY 子句对源行分组。
发生时间: 2016-11-15 04:46:11
错误编号: ExecuteBatch
错误信息: MERGE 语句试图多次更新或删除同一行。目标行与多个源行匹配时会出现这种情况。MERGE 语句无法多次更新/删除目标表的同一行。请简化 ON 子句,以确保目标行最多与一个源行匹配,也可以使用 GROUP BY 子句对源行分组。
Sql语句: /*dialect*/ merge into T_CB_CostCalExpense T0 using (SELECT FMAINPID,FADJQTY,FADJAMOUNT
FROM #TM_CB_INITADJPRODUCT ) T on (T0.FID=T.FMAINPID) WHEN MATCHED THEN UPDATE SET T0.FAdjCurrInputQty=T.FADJQTY,T0.FAdjCurrInputAmount=T.FADJAMOUNT ;
/*dialect*/ merge into T_CB_CostCalExpenseDetail T0 using (SELECT T4.FDETAILID,sum(T2.FADJAMOUNT) as FADJAMOUNT
FROM #TM_CB_INITADJPRODUCTEXP T2 INNER JOIN T_CB_CostCalExpense T3 ON T3.FID=T2.FMAINPID INNER JOIN T_CB_CostCalExpenseDetail T4 ON T4.FENTRYID=T3.FENTRYID AND T4.FCOSTITEMID=T2.FCOSTITEMID AND T4.FEXPENSESITEMID=T2.FEXPENSESITEMID GROUP BY T4.FDETAILID ) T on (T0.FDETAILID = T.FDETAILID) WHEN MATCHED THEN UPDATE SET T0.FAdjCurrInputAmount=T.FADJAMOUNT ;
/*dialect*/ merge into T_CB_CostMatterial T0 using (SELECT FMAINSUBENTRYID,max(FADJQTY) AS FADJQTY,sum(FADJAMOUNT) AS FADJAMOUNT
FROM #TM_CB_INITADJMAT GROUP BY FMAINSUBENTRYID ) T on (T0.FENTRYID=T.FMAINSUBENTRYID) WHEN MATCHED THEN UPDATE SET T0.FAdjCurrInputQty=T.FADJQTY,T0.FAdjCurrInputAmount=T.FADJAMOUNT ;
/*dialect*/ merge into T_CB_CostMatterial T0 using (SELECT T1.FENTRYID,SUM(T2.FADJAMOUNT) AS FADJAMOUNT
FROM #TM_CB_INITADJPRODUCTEXP T2 INNER JOIN T_CB_CostMatterial T1 ON T1.FID=T2.FMAINPID and T2.FEXPTYPE=t1.FEXPTYPE INNER JOIN T_CB_CostMatterialDetail T3 ON T3.FENTRYID=T1.FENTRYID AND T3.FCOSTITEMID=T2.FCOSTITEMID AND T3.FEXPENSESITEMID=T2.FEXPENSESITEMID WHERE T2.FEXPTYPE='2' GROUP BY T1.FENTRYID ) T ON (T0.FENTRYID=T.FENTRYID) WHEN MATCHED THEN UPDATE SET T0.FAdjCurrInputAmount=T.FADJAMOUNT ;
/*dialect*/ merge into T_CB_CostMatterialDetail T0 using (SELECT T1.FMAINSUBENTRYID,T1.FADJAMOUNT
FROM #TM_CB_INITADJMATEXP T1 ) T on (T0.FDETAILID=T.FMAINSUBENTRYID) WHEN MATCHED THEN UPDATE SET T0.FAdjCurrInputAmount=T.FADJAMOUNT ;
/*dialect*/ merge into T_CB_CostMatterialDetail T0 using (SELECT T1.FENTRYID,T2.FCOSTITEMID,T2.FEXPENSESITEMID,T2.FADJAMOUNT
FROM #TM_CB_INITADJPRODUCTEXP T2 INNER JOIN T_CB_CostMatterial T1 ON T1.FID=T2.FMAINPID WHERE T1.FEXPTYPE=0 AND T1.FMATERIALID=0 AND NOT EXISTS (SELECT 1 FROM T_CB_CostMatterial WHERE FMATERIALID >0 AND FID=T1.FID) ) T ON (T0.FENTRYID=T.FENTRYID and T0.FCOSTITEMID=T.FCOSTITEMID and T0.FEXPENSESITEMID=T.FEXPENSESITEMID) WHEN MATCHED THEN UPDATE SET T0.FAdjCurrInputAmount=T.FADJAMOUNT ;
/*dialect*/ merge into T_CB_CostMatterialDetail T0 using (SELECT T3.FDETAILID,T2.FADJAMOUNT
FROM #TM_CB_INITADJPRODUCTEXP T2 INNER JOIN T_CB_CostMatterial T1 ON T1.FID=T2.FMAINPID and T1.FEXPTYPE='2' INNER JOIN T_CB_CostMatterialDetail T3 ON T3.FENTRYID=T1.FENTRYID AND T3.FCOSTITEMID=T2.FCOSTITEMID AND T3.FEXPENSESITEMID=T2.FEXPENSESITEMID ) T ON (T0.FDETAILID=T.FDETAILID) WHEN MATCHED THEN UPDATE SET T0.FAdjCurrInputAmount=T.FADJAMOUNT ;
===================================================
调用堆栈:
Server stack trace:
at Kingdee.BOS.App.Data.Sql.SqlDatabase.ExecuteBatch(List`1 sqlArray, Int32 batchSize, Int32 commandTimeout)
at Kingdee.BOS.App.Data.DBUtils.ExecuteBatchWithTime(Context ctx, List`1 sqlArray, Int32 batchSize, Int32 commandTimeout)
at Kingdee.K3.FIN.CB.App.Core.InitProduceCostAdjService.UpdateInitData(Context ctx, DynamicObject[] dataEntitys, Boolean audit)
at Kingdee.BOS.App.Core.PlugInProxy.OperationServicePlugInProxy.FireBeginOperationTransaction(BeginOperationTransactionArgs e)
at Kingdee.BOS.App.Core.AbstractOprerationService.CallOperation(DynamicObject[]& objs)
at Kingdee.BOS.App.Core.AbstractOprerationService.CallOperatinTransaction(DynamicObject[] objs)
at Kingdee.BOS.App.Core.AbstractOprerationService.DoExcete()
at Kingdee.BOS.App.Core.AbstractOprerationService.Excute(Object[] ids)
at Kingdee.BOS.App.Core.AbstractSetStatus.Excute(Object[] ids)
at Kingdee.BOS.App.Core.SetStatusService.SetBillStatus(Context ctx, BusinessInfo businessInfo, List`1 pkEntryIds, List`1 paras, String operationNumber, OperateOption option)
Exception rethrown at [0]:
at Kingdee.BOS.ServiceHelper.BusinessDataServiceHelper.SetBillStatus(Context ctx, BusinessInfo businessInfo, List`1 pkEntryIds, List`1 paras, String operationNumber, OperateOption option)
at Kingdee.BOS.Business.Bill.Operation.AbstractStatusConvert.ExecuteBillOperation(List`1 paras, OperateOption option)
at Kingdee.BOS.Business.Bill.Operation.AbstractStatusConvert.ExecuteStatusConvert(List`1 paras)
at Kingdee.BOS.Business.Bill.Operation.Audit.AuditIdeaPrompt()
at Kingdee.BOS.Core.DynamicForm.AbstractDynamicFormOperation.Operation(CallBackWfAfterOperation callbackwf, IOperationResult result)
期初在产品成本调整单审核报错.jpg(327.33KB)
推荐阅读