From 168d772586da42971557cf0f286b9f50e11119a1 Mon Sep 17 00:00:00 2001 From: bonus <1203338439@qq.com> Date: Sat, 31 Jan 2026 12:32:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E8=AF=95=E5=85=A5=E5=BA=93=E9=94=81?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/RepairInputDetailsServiceImpl.java | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairInputDetailsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairInputDetailsServiceImpl.java index d9c0f71a..7fc6b9c4 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairInputDetailsServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairInputDetailsServiceImpl.java @@ -35,6 +35,7 @@ import com.bonus.material.task.domain.TmTask; import com.bonus.material.task.domain.TmTaskAgreement; import com.bonus.material.task.mapper.TmTaskAgreementMapper; import com.bonus.material.task.mapper.TmTaskMapper; +import org.springframework.dao.DataAccessException; import org.springframework.stereotype.Service; import com.bonus.material.repair.mapper.RepairInputDetailsMapper; import com.bonus.common.biz.domain.repair.RepairInputDetails; @@ -1052,16 +1053,30 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService */ private int updateStorageNum(RepairInputDetails inputApplyDetails) { int result = 0; - Type type = new Type(); - type.setModelTitle("修试入库"); - type.setCode(inputApplyDetails.getInputCode()); - type.setTypeId(inputApplyDetails.getTypeId()); - type.setStyle("2"); - type.setInputNum(BigDecimal.valueOf(1)); - type.setMaId(inputApplyDetails.getMaId()); - result = typeService.updateNumAddOrSubtract(type); - result = machineMapper.updateStatus(inputApplyDetails.getMaId(), 1); + + + try { + Type type = new Type(); + type.setModelTitle("修试入库"); + type.setCode(inputApplyDetails.getInputCode()); + type.setTypeId(inputApplyDetails.getTypeId()); + type.setStyle("2"); + type.setInputNum(BigDecimal.valueOf(1)); + type.setMaId(inputApplyDetails.getMaId()); + result = machineMapper.updateStatus(inputApplyDetails.getMaId(), 1); + result = typeService.updateNumAddOrSubtract(type); + + + } catch (DataAccessException e) { + // 捕获数据库异常,特别是死锁 + + throw new ServiceException("更新出入库次数失败,请重试,设备id是:"+inputApplyDetails.getMaId()); + } + return result; + + + } private int updateInputNum(RepairInputDetails inputApplyDetails) {