修复Bug:45420,修复批量并发操作卡控问题

uat-temp-nht-2503100000-45420
jason 2 months ago
parent a5df54bc98
commit bf93405f1d

@ -206,13 +206,14 @@ public class MesNcProcessingService implements IMesNcProcessingService {
if(!Objects.isNull(model.getPart())){
model.setPart(mesPartService.getMesPartSapByPartNo(model.getPart().getPartNo(), org));
}
final String redisKey = MesPcnExtConstWords.SAP_TRANS_JOB_LOCK_TAG + model.getPartInspection().getId();
RLock rLock = (RLock) redisMesPcn.getLock(redisKey);
try {
if (model.getPartInspection().getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) {
Integer type = model.getType();
MesDefectType person = StringUtil.isEmpty(model.getPerson())?new MesDefectType():model.getPerson();
final String redisKey = MesPcnExtConstWords.SAP_TRANS_JOB_LOCK_TAG + model.getSn();
RLock rLock = (RLock) redisMesPcn.getLock(redisKey);
try {
//使用tryLock拿不到锁直接返回
//rlock的leaseTime为-1会每隔WatchdogTimeout秒去续约
if (!rLock.tryLock()){
@ -221,18 +222,17 @@ public class MesNcProcessingService implements IMesNcProcessingService {
//保存数据
saveDate(model, model.getPart(), type, person, org,model.getInventoryLocationCode(),isOrder);
} finally {
if (rLock.isHeldByCurrentThread()) {
rLock.unlock();
}
}
} else {
Integer type = model.getType();
MesDefectType person = StringUtil.isEmpty(model.getPerson())?new MesDefectType():model.getPerson();
//保存数据
saveDate(model, model.getPart(), type, person, org,model.getInventoryLocationCode(), isOrder);
}
} finally {
if (rLock.isHeldByCurrentThread()) {
rLock.unlock();
}
}
}
/**
@ -370,6 +370,9 @@ public class MesNcProcessingService implements IMesNcProcessingService {
String workCenterCode = null == model.getPartInspection() ? null : model.getPartInspection().getWorkCenterCode();
assert model.getPartInspection() != null;
model.getPartInspection().setQmsSync(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
if (!Objects.equals(model.getPartInspection().getNcStatus(), MesExtEnumUtil.PART_INSPECTION_NC_STATUS.CREATE.getValue())) {
throw new ImppBusiException(String.format("零件【%s】已进行过NC处理请勿重复操作", part.getPartNo()));
}
MesProduceSn sn = getProduceSn(model.getSn(), org);
//武汉 会输入客户条码 todo 更新工单对应qcStatus
boolean isWorkOrderQcStatus=false;

Loading…
Cancel
Save