fix: 送气胀轴加个锁

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

View File

@@ -395,6 +395,10 @@ public class SlitterServiceImpl implements SlitterService {
throw new BadRequestException("未找到可存放气涨轴规格「" + qzzSize + "」的空暂存位"); throw new BadRequestException("未找到可存放气涨轴规格「" + qzzSize + "」的空暂存位");
} }
BstIvtShafttubeivt shafttubeivt = shafttubeivts.get(0); BstIvtShafttubeivt shafttubeivt = shafttubeivts.get(0);
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_code1", deviceCode);
param.put("point_code2", shafttubeivt.getPoint_code()); param.put("point_code2", shafttubeivt.getPoint_code());
@@ -404,6 +408,14 @@ public class SlitterServiceImpl implements SlitterService {
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA); param.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
param.put("is_bushing", "0"); param.put("is_bushing", "0");
trussCallShaftCacheTask.createTask(param); trussCallShaftCacheTask.createTask(param);
} else {
throw new BadRequestException("系统繁忙,稍后在试!");
}
} finally {
if (tryLockPoint) {
lockPoint.unlock();
}
}
res.put("status", HttpStatus.HTTP_OK); res.put("status", HttpStatus.HTTP_OK);
res.put("message", "请求成功"); res.put("message", "请求成功");
return res; return res;