fix: 送气胀轴加个锁

This commit is contained in:
2024-07-21 20:31:48 +08:00
parent 1923c5303a
commit 0719a5b90f

View File

@@ -395,15 +395,27 @@ public class SlitterServiceImpl implements SlitterService {
throw new BadRequestException("未找到可存放气涨轴规格「" + qzzSize + "」的空暂存位");
}
BstIvtShafttubeivt shafttubeivt = shafttubeivts.get(0);
// 创建任务
param.put("point_code1", deviceCode);
param.put("point_code2", shafttubeivt.getPoint_code());
// hint: 当前分切计划的气涨轴尺寸
param.put("qzz_size", qzzSize);
param.put("task_type", SlitterEnum.TASK_TYPE.code("穿拔轴位<>气胀轴缓存位"));
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
param.put("is_bushing", "0");
trussCallShaftCacheTask.createTask(param);
RLock lockPoint = redissonClient.getLock(shafttubeivt.getPoint_code());
boolean tryLockPoint = lockPoint.tryLock(0, TimeUnit.SECONDS);
try {
if (tryLockPoint) {
// 创建任务
param.put("point_code1", deviceCode);
param.put("point_code2", shafttubeivt.getPoint_code());
// hint: 当前分切计划的气涨轴尺寸
param.put("qzz_size", qzzSize);
param.put("task_type", SlitterEnum.TASK_TYPE.code("穿拔轴位<>气胀轴缓存位"));
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
param.put("is_bushing", "0");
trussCallShaftCacheTask.createTask(param);
} else {
throw new BadRequestException("系统繁忙,稍后在试!");
}
} finally {
if (tryLockPoint) {
lockPoint.unlock();
}
}
res.put("status", HttpStatus.HTTP_OK);
res.put("message", "请求成功");
return res;