背景:该物料修改过基本单位,然后重新录入期初库存就报错。已经在社区看了相关文档https://vip.kingdee.com/article/20522 ,对数据库不熟,看不懂,只对BOS熟点
请问下能否有不通过数据库的操作方式解决该问题,BOS也行,谢谢,最好带下截图,将不胜感激
发生时间: 2018-08-21 01:12:19
错误编号: BOS_ExecuteNonQuery
错误信息: 不能在具有唯一索引 'IDX_STK_INVENTORY_CLUST' 的对象 'dbo.T_STK_INVENTORY' 中插入重复键的行。
语句已终止。
Sql语句: INSERT INTO T_STK_INVENTORY (FID, FSTOCKORGID, FKEEPERTYPEID, FKEEPERID, FOWNERTYPEID, FOWNERID, FSTOCKID, FSTOCKLOCID, FAUXPROPID, FSTOCKSTATUSID, FLOT, FBOMID, FMTONO, FPROJECTNO, FPRODUCEDATE, FEXPIRYDATE, FBASEUNITID, FSTOCKUNITID, FMATERIALID, FSECUNITID, FOBJECTTYPEID, FISEFFECTIVED) SELECT IT.FINVENTORYID, IT.FSTOCKORGID, IT.FKEEPERTYPEID, IT.FKEEPERID, IT.FOWNERTYPEID, IT.FOWNERID, IT.FSTOCKID, IT.FSTOCKLOCID, IT.FAUXPROPID, IT.FSTOCKSTATUSID, IT.FLOT, IT.FBOMID, IT.FMTONO, IT.FPROJECTNO, IT.FPRODUCEDATE, IT.FEXPIRYDATE, IT.FBASEUNITID, IT.FSTOCKUNITID, IT.FMATERIALID, IT.FSECUNITID, 'STK_Inventory', '0' FROM (SELECT MIN(FINVENTORYID) finventoryid, FSTOCKORGID, FKEEPERTYPEID, FKEEPERID, FOWNERTYPEID, FOWNERID, FSTOCKID, FSTOCKLOCID, FAUXPROPID, FSTOCKSTATUSID, FLOT, FBOMID, FMTONO, FPROJECTNO, FPRODUCEDATE, FEXPIRYDATE, FBASEUNITID, FSTOCKUNITID, FMATERIALID, FSECUNITID, FCOMBINEID FROM T_STK_PREINVDIMENSION GROUP BY FMATERIALID, FSTOCKORGID, FKEEPERTYPEID, FKEEPERID, FOWNERTYPEID, FOWNERID, FSTOCKID, FSTOCKLOCID, FAUXPROPID, FSTOCKSTATUSID, FLOT, FBOMID, FMTONO, FPROJECTNO, FPRODUCEDATE, FEXPIRYDATE, FBASEUNITID, FSTOCKUNITID, FSECUNITID, FCOMBINEID) it INNER JOIN (SELECT DISTINCT FCOMBINEID, FMTONO, FPROJECTNO, FPRODUCEDATE, FEXPIRYDATE FROM T_STK_PREINVDIMENSION WHERE FTRANID = @TranId) it2 ON ((((IT.FCOMBINEID = IT2.FCOMBINEID AND IT.FMTONO = IT2.FMTONO) AND IT.FPROJECTNO = IT2.FPROJECTNO) AND ISNULL(IT.FPRODUCEDATE, @NullDefDate1) = ISNULL(IT2.FPRODUCEDATE, @NullDefDate2)) AND ISNULL(IT.FEXPIRYDATE, @NullDefDate3) = ISNULL(IT2.FEXPIRYDATE, @NullDefDate4)) WHERE NOT EXISTS (SELECT 1 FROM T_STK_INVENTORY IT3 WHERE (((((((IT.FCOMBINEID = IT3.FCOMBINEID AND IT.FMTONO = IT3.FMTONO) AND IT.FPROJECTNO = IT3.FPROJECTNO) AND ISNULL(IT.FPRODUCEDATE, @NullDefDate5) = ISNULL(IT3.FPRODUCEDATE, @NullDefDate6)) AND ISNULL(IT.FEXPIRYDATE, @NullDefDate7) = ISNULL(IT3.FEXPIRYDATE, @NullDefDate8)) AND IT.FBASEUNITID = IT3.FBASEUNITID) AND IT.FSTOCKUNITID = IT3.FSTOCKUNITID) AND IT.FSECUNITID = IT3.FSECUNITID))
===================================================
调用堆栈:
Server stack trace:
at Kingdee.BOS.App.Data.AbstractDatabase.ExecuteNonQuery(DbCommand command, IEnumerable`1 listParam)
at Kingdee.BOS.App.Data.DBUtils.ExecuteBatch(Context ctx, List`1 lstSqlObj)
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(DynamicObject[] dataEntities)
at Kingdee.BOS.App.Core.SaveService.Save(Context ctx, BusinessInfo info, DynamicObject[] dataEntities, OperateOption option, String operationNumber)
Exception rethrown at [0]:
at Kingdee.BOS.ServiceHelper.BusinessDataServiceHelper.Save(Context ctx, BusinessInfo businessInfo, DynamicObject dataObject, OperateOption option, String operationNumber)
at Kingdee.BOS.Model.Bill.BillModel.Save(OperateOption option)
at Kingdee.BOS.Business.Bill.Operation.Save.ExecuteBillOperation(OperateOption option)
at Kingdee.BOS.Core.DynamicForm.AbstractDynamicFormOperation.Operation(CallBackWfAfterOperation callbackwf, IOperationResult result)
1.png(109.48KB)