no message

main
HUOJIN\92525 2026-01-27 16:35:20 +08:00
parent 0b1817d4c9
commit 46c185eaa6
2 changed files with 29 additions and 4 deletions

View File

@ -20,6 +20,8 @@ public enum PickTypeEnum {
JY(7, "检验出库"), JY(7, "检验出库"),
//模具库
SC(1, "生产出库"), SC(1, "生产出库"),
BF(2, "报废出库"), BF(2, "报废出库"),

View File

@ -1,6 +1,7 @@
package org.cpte.modules.quartz.job; package org.cpte.modules.quartz.job;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.cpte.modules.agvTask.entity.AgvTask; import org.cpte.modules.agvTask.entity.AgvTask;
import org.cpte.modules.agvTask.mapper.AgvTaskMapper; import org.cpte.modules.agvTask.mapper.AgvTaskMapper;
import org.cpte.modules.constant.GeneralConstant; 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.constant.enums.AgvVendorEnum;
import org.cpte.modules.shipping.service.ITaskService; import org.cpte.modules.shipping.service.ITaskService;
import org.cpte.modules.tesAgv.service.ITesAgvService; import org.cpte.modules.tesAgv.service.ITesAgvService;
import org.cpte.modules.utils.RedisDistributedLockUtil;
import org.quartz.Job; import org.quartz.Job;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException; import org.quartz.JobExecutionException;
@ -27,6 +29,11 @@ public class TesAgvJob implements Job {
@Autowired @Autowired
private ITesAgvService tesAgvService; private ITesAgvService tesAgvService;
@Autowired
private RedisDistributedLockUtil redissonLock;
@Override @Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
@ -38,10 +45,26 @@ public class TesAgvJob implements Job {
//2.生成TES任务 //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(); long startTime2 = System.currentTimeMillis();
iTaskService.generateAgvTask(); iTaskService.generateAgvTask();
long endTime2 = System.currentTimeMillis(); long endTime2 = System.currentTimeMillis();
log.info("生成AGV出库任务耗时{}ms", endTime2 - startTime2); 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 // 3.下发任务TES
List<AgvTask> agvTaskList = agvTaskMapper.queryAgvTaskList(AgvStatusEnum.CREATED.getValue(), AgvVendorEnum.TES.getValue()); List<AgvTask> agvTaskList = agvTaskMapper.queryAgvTaskList(AgvStatusEnum.CREATED.getValue(), AgvVendorEnum.TES.getValue());