不能在具有唯一索引“IDX_STK_INVENTORY_CLUST”的对象“dbo.T_STK_INVENTORY”中插入重复键行。重复键值为 (568762, 186872, 134805, BD_KeeperOrg, 134805, BD_OwnerOrg, 134805, 0, 100062, 10000, 0, 0, , ,
语句已终止。
发生时间: 2016-02-15 10:03:33
错误编号: BOS_ExecuteNonQuery
错误信息: 不能在具有唯一索引“IDX_STK_INVENTORY_CLUST”的对象“dbo.T_STK_INVENTORY”中插入重复键行。重复键值为 (568762, 186872, 134805, BD_KeeperOrg, 134805, BD_OwnerOrg, 134805, 0, 100062, 10000, 0, 0, , ,
语句已终止。
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,FUPDATETIME = GETDATE()
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:
at Kingdee.K3.SCM.App.Core.AppBusinessService.UpdateStockService.DoActionBatch(AppBusinessServiceArgs e)
at Kingdee.BOS.App.Core.AbstractOprerationService.ExecuteFormBusinessService(IAppFormBusinessService iBusiness, ExtendedDataEntity[] dataEntities, FormBusinessService service)
at Kingdee.BOS.App.Core.AbstractOprerationService.InvokeFormBusiness(DynamicObject[] objs, Int32 iActionPoint)
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.DeleteService.Delete(Context ctx, BusinessInfo info, Object[] Ids, OperateOption option, String operationNumber)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Kingdee.BOS.Contracts.IDeleteService.Delete(Context ctx, BusinessInfo info, Object[] Ids, OperateOption option, String operationNumber)
at Kingdee.BOS.ServiceHelper.BusinessDataServiceHelper.Delete(Context ctx, BusinessInfo businessInfo, Object[] Ids, OperateOption option, String operationNumber)
at Kingdee.BOS.Business.Bill.Operation.Delete.BatDelete(Int32 loopTimes, Int32 iBat, String[] _idList, IOperationResult fullResult)
at Kingdee.BOS.Business.Bill.Operation.Delete.DoListDelete(IOperationResult fullResult)
at Kingdee.BOS.Business.Bill.Operation.Delete.ExecuteOperation()
at Kingdee.BOS.Core.DynamicForm.AbstractDynamicFormOperation.Operation(CallBackWfAfterOperation callbackwf, IOperationResult result)