NC 锁定存货总账独占锁失败 问题处理

摘要:日志输出:a35e1bf3-199b-46a4-9c1c-04dc2f23faed nc.vo.pubapp.pattern.exception.TLockFailedException: 正在执行相关操作,请稍候执行(锁定存货总账独占锁失败)

抓取到的报错信息

28 采购入库 ncMem04/0ef7af04-ba6d-482c-a047-fb4a83536c10 后台任务 2019-11-28 12:04:15 2019-11-28 12:06:20 0天0时2分5秒 N ncMem04/ncserver a35e1bf3-199b-46a4-9c1c-04dc2f23faed nc.vo.pubapp.pattern.exception.TLockFailedException: 正在执行相关操作,请稍候执行(锁定存货总账独占锁失败)
at nc.impl.pubapp.pattern.pub.LockOperator.lock(LockOperator.java:72)
at nc.bs.ia.pub.ConcurrentUtil.lockGeneralNabAccount(ConcurrentUtil.java:251)
at nc.bs.ia.audit.pub.AuditTool.queryGLNABVOMap(AuditTool.java:815)
at nc.bs.ia.audit.pub.AuditTool.initGlobalSession(AuditTool.java:533)
at nc.bs.ia.audit.core.AuditCoreAlgoBP.process(AuditCoreAlgoBP.java:62)
at nc.bs.ia.audit.core.AuditCoreEntryBP.calculate(AuditCoreEntryBP.java:199)
at nc.bs.ia.audit.core.AuditCoreEntryBP.auditRetNoInfo(AuditCoreEntryBP.java:92)
at nc.pubimpl.ia.audit.AuditForBillsImpl.calculate(AuditForBillsImpl.java:119)
at nc.pubimpl.ia.audit.AuditForBillsImpl.costBill(AuditForBillsImpl.java:125)
at nc.pubimpl.ia.audit.AuditForBillsImpl.costBill(AuditForBillsImpl.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
at sun.refl

相关报错

2 智云-采购入库 ncMem04/0ef7af04-ba6d-482c-a047-fb4a83536c10 后台任务 2019-11-28 12:20:00 2019-11-28 12:21:34 0天0时1分34秒 N ncMem04/ncserver a35e1bf3-199b-46a4-9c1c-04dc2f23faed nc.vo.pub.BusinessRuntimeException: 并发操作异常,请稍后重试...
at nc.bs.arap.tally.SynchBalanceBO.getSynchBalanceSql(SynchBalanceBO.java:202)
at nc.bs.arap.tally.SynchBalanceBO.synchBanance(SynchBalanceBO.java:82)
at nc.bs.arap.tally.SynchBalanceBO.balanceTally(SynchBalanceBO.java:67)
at nc.bs.arap.tally.TallyServiceBO.synch2Balance(TallyServiceBO.java:646)
at nc.bs.arap.tally.TallyServiceBO.registerTally(TallyServiceBO.java:115)
at nc.impl.arap.tally.TallyServiceImpl.registerTally(TallyServiceImpl.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:613)
at nc.bs.framework.aop.rt.MethodProceedingJoinpoint$3.invoke(MethodProceedingJoinpoint.java:74)
at nc.bs.framework.aop.rt.MethodProceedingJoinpoint.proceed(MethodProceedingJoinpoint.java:184)
at nc.bs.framework.a


分析报错原因及处理

NC部署定定时任务,抓取外部服务的收货单保存到NC的采购入库单,每次执行有多条收货单数据。

报错原因:

抓取数据后先进行数据处理,统一提交保存到采购入库单。

由于有多个单据,没有单据下有个物料数据,可能会有不同单据下有相同物料的信息。NC保存单据时会进行锁库存占用,由于是批量执行前面锁了库存后面还要操作入库所以报错。

处理方法:

目前只能尽量保证不出现上述问题中的数据,在同一时间不需要有多个单据中含有相同的物料。