fix:修改同时生成任务问题

This commit is contained in:
songxiaopeng
2024-03-15 17:44:36 +08:00
parent 42478bc209
commit b94e1aa86e
2 changed files with 4 additions and 4 deletions

View File

@@ -186,11 +186,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
// 找到当前的设备 // 找到当前的设备
String deviceCode = param.getString("device_code"); String deviceCode = param.getString("device_code");
String requestNo = param.getString("requestNo"); String requestNo = param.getString("requestNo");
RLock lock = redissonClient.getLock(deviceCode); SchBasePoint basePoint = pointService.getById(deviceCode);
String configCode = basePoint.getRegion_code() + "QLTask";
RLock lock = redissonClient.getLock(configCode);
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS); boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
try { try {
if (tryLock) { if (tryLock) {
SchBasePoint basePoint = pointService.getById(deviceCode);
if (ObjectUtil.isEmpty(basePoint)) { if (ObjectUtil.isEmpty(basePoint)) {
throw new BadRequestException("点位错误!"); throw new BadRequestException("点位错误!");
} }
@@ -231,7 +232,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return response; return response;
} }
} }
String configCode = basePoint.getRegion_code() + "QLTask";
// 组织参数 // 组织参数
param.put("config_code", configCode); param.put("config_code", configCode);
taskService.apply(param); taskService.apply(param);

View File

@@ -63,7 +63,7 @@ public class FJQLTask extends AbstractTask {
@Autowired @Autowired
private IPdmBdProductionProcessTrackingService processTrackingService; private IPdmBdProductionProcessTrackingService processTrackingService;
@Override @Override
protected synchronized void create() throws BadRequestException { protected void create() throws BadRequestException {
// 获取任务 // 获取任务
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
// 配置信息 // 配置信息