no message
parent
0b1817d4c9
commit
46c185eaa6
|
|
@ -20,6 +20,8 @@ public enum PickTypeEnum {
|
|||
|
||||
JY(7, "检验出库"),
|
||||
|
||||
|
||||
//模具库
|
||||
SC(1, "生产出库"),
|
||||
|
||||
BF(2, "报废出库"),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.cpte.modules.quartz.job;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.cpte.modules.agvTask.entity.AgvTask;
|
||||
import org.cpte.modules.agvTask.mapper.AgvTaskMapper;
|
||||
import org.cpte.modules.constant.GeneralConstant;
|
||||
|
|
@ -8,6 +9,7 @@ import org.cpte.modules.constant.enums.AgvStatusEnum;
|
|||
import org.cpte.modules.constant.enums.AgvVendorEnum;
|
||||
import org.cpte.modules.shipping.service.ITaskService;
|
||||
import org.cpte.modules.tesAgv.service.ITesAgvService;
|
||||
import org.cpte.modules.utils.RedisDistributedLockUtil;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
|
@ -27,6 +29,11 @@ public class TesAgvJob implements Job {
|
|||
@Autowired
|
||||
private ITesAgvService tesAgvService;
|
||||
|
||||
@Autowired
|
||||
private RedisDistributedLockUtil redissonLock;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
|
|
@ -38,10 +45,26 @@ public class TesAgvJob implements Job {
|
|||
|
||||
|
||||
//2.生成TES任务
|
||||
String lockKey = "lock:generateAgvTask";
|
||||
String lockValue = null;
|
||||
try {
|
||||
lockValue = redissonLock.tryLock(lockKey, 10);
|
||||
if (StringUtils.isEmpty(lockValue)) {
|
||||
throw new RuntimeException("生成AGV任务中,请稍后重试");
|
||||
}
|
||||
long startTime2 = System.currentTimeMillis();
|
||||
iTaskService.generateAgvTask();
|
||||
long endTime2 = System.currentTimeMillis();
|
||||
log.info("生成AGV出库任务耗时:{}ms", endTime2 - startTime2);
|
||||
} catch (Exception e) {
|
||||
log.error("生成AGV任务异常", e);
|
||||
throw e;
|
||||
} finally {
|
||||
if (StringUtils.isNotEmpty(lockValue)) {
|
||||
redissonLock.unlock(lockKey, lockValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 3.下发任务TES
|
||||
List<AgvTask> agvTaskList = agvTaskMapper.queryAgvTaskList(AgvStatusEnum.CREATED.getValue(), AgvVendorEnum.TES.getValue());
|
||||
|
|
|
|||
Loading…
Reference in New Issue