发生时间: 2015-07-02 05:40:13
错误编号: BOS_ExecuteNonQuery
错误信息: 不能在具有唯一索引 'IDX_STK_INVENTORY_CLUST' 的对象 'dbo.T_STK_INVENTORY' 中插入重复键的行。
语句已终止。
Sql语句:
MERGE INTO T_STK_INVENTORY IT
USING (SELECT MIN(FINVENTORYID) AS FINVENTORYID, SUM(FBASEQTY) AS FBASEQTY,SUM(FSECQTY) AS FSECQTY,
FSTOCKORGID,FKEEPERTYPEID,FKEEPERID,FOWNERTYPEID,FOWNERID,FSTOCKID,FSTOCKLOCID,FAUXPROPID,FSTOCKSTATUSID,
FLOT,FBOMID,FMTONO,FPROJECTNO,FPRODUCEDATE,FEXPIRYDATE,FBASEUNITID,FSTOCKUNITID,FMATERIALID,FSECUNITID
FROM #TM_STK_UpdateStockToTemp
GROUP BY FMATERIALID,FSTOCKORGID,FKEEPERTYPEID,FKEEPERID,FOWNERTYPEID,FOWNERID,FSTOCKID,FSTOCKLOCID,FAUXPROPID,FSTOCKSTATUSID,
FLOT,FBOMID,FMTONO,FPROJECTNO,FPRODUCEDATE,FEXPIRYDATE,FBASEUNITID,FSTOCKUNITID,FSECUNITID ) IT2
ON (IT.FID = IT2.FINVENTORYID)
WHEN MATCHED THEN
UPDATE SET IT.FBASEQTY = IT.FBASEQTY + IT2.FBASEQTY,IT.FSECQTY = IT.FSECQTY + IT2.FSECQTY
WHEN NOT MATCHED THEN
INSERT (FID,FSTOCKORGID,FKEEPERTYPEID,FKEEPERID,FOWNERTYPEID,FOWNERID,FSTOCKID,
FSTOCKLOCID,FAUXPROPID,FSTOCKSTATUSID,FLOT,FBOMID,FMTONO,FPROJECTNO,FPRODUCEDATE,
FEXPIRYDATE,FBASEUNITID,FBASEQTY,FBASELOCKQTY,FSECQTY,FSECLOCKQTY,FSTOCKUNITID,FMATERIALID,FQTY,FLOCKQTY,FSECUNITID,
FOBJECTTYPEID,FBASEAVBQTY,FAVBQTY,FSECAVBQTY)
VALUES(IT2.FINVENTORYID,IT2.FSTOCKORGID,IT2.FKEEPERTYPEID,IT2.FKEEPERID,IT2.FOWNERTYPEID,IT2.FOWNERID,IT2.FSTOCKID,
IT2.FSTOCKLOCID,IT2.FAUXPROPID,IT2.FSTOCKSTATUSID,IT2.FLOT,IT2.FBOMID,IT2.FMTONO,IT2.FPROJECTNO,IT2.FPRODUCEDATE,
IT2.FEXPIRYDATE,IT2.FBASEUNITID,IT2.FBASEQTY,0,IT2.FSECQTY,0,IT2.FSTOCKUNITID,IT2.FMATERIALID,0,0,IT2.FSECUNITID,
'STK_Inventory',0,0,0) ;
===================================================
调用堆栈:
Server stack trace:
在 Kingdee.K3.SCM.App.Core.AppBusinessService.UpdateStockService.DoActionBatch(AppBusinessServiceArgs e)
在 Kingdee.BOS.App.Core.AbstractOprerationService.ExecuteFormBusinessService(IAppFormBusinessService iBusiness, ExtendedDataEntity[] dataEntities, FormBusinessService service)
在 Kingdee.BOS.App.Core.AbstractOprerationService.InvokeFormBusiness(DynamicObject[] objs, Int32 iActionPoint)
在 Kingdee.BOS.App.Core.AbstractOprerationService.CallOperation(DynamicObject[]& objs)
在 Kingdee.BOS.App.Core.AbstractOprerationService.CallOperatinTransaction(DynamicObject[] objs)
在 Kingdee.BOS.App.Core.AbstractOprerationService.DoExcete()
在 Kingdee.BOS.App.Core.AbstractOprerationService.Excute(Object[] ids)
在 Kingdee.BOS.App.Core.SetStatusService.SetBillStatus(Context ctx, BusinessInfo businessInfo, List`1 pkEntryIds, List`1 paras, String operationNumber, OperateOption option)
Exception rethrown at [0]:
在 Kingdee.BOS.ServiceHelper.BusinessDataServiceHelper.SetBillStatus(Context ctx, BusinessInfo businessInfo, List`1 pkEntryIds, List`1 paras, String operationNumber, OperateOption option)
在 Kingdee.BOS.Business.Bill.Operation.AbstractStatusConvert.ExecuteBillOperation(List`1 paras, OperateOption option)
在 Kingdee.BOS.Business.Bill.Operation.AbstractStatusConvert.ExecuteStatusConvert(List`1 paras)
在 Kingdee.BOS.Business.Bill.Operation.Audit.AuditIdeaPrompt()
在 Kingdee.BOS.Core.DynamicForm.AbstractDynamicFormOperation.Operation(CallBackWfAfterOperation callbackwf, IOperationResult result)
推荐阅读