zy-acs-manager/src/main/java/com/zy/acs/manager/core/HandlerController.java
@@ -19,6 +19,7 @@ import com.zy.acs.manager.manager.enums.*; import com.zy.acs.manager.manager.service.*; import com.zy.acs.manager.system.controller.BaseController; import com.zy.acs.manager.system.service.ConfigService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; @@ -78,6 +79,8 @@ private StaReserveService staReserveService; @Autowired private AgvAreaDispatcher agvAreaDispatcher; @Autowired private ConfigService configService; @PreAuthorize("hasAuthority('manager:agv:update')") @OperationLog("Locate All Agv") @@ -141,6 +144,7 @@ return R.error(); } Boolean maintainLocSts = configService.getVal("maintainLocSts", Boolean.class); Date now = new Date(); Agv agv = agvService.selectByUuid(param.getAgvNo()); AgvDetail agvDetail = agvDetailService.selectByAgvId(agv.getId()); @@ -233,13 +237,15 @@ // throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + oriLoc.getCode$()); throw new BusinessException("AGV【" + agv.getUuid() + "】无法到达起始库位【" + oriLoc.getLocNo() + "】"); } if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { throw new BusinessException("oriLoc:" + oriLoc.getLocNo() + " 不是在库状态"); } oriLoc.setLocSts(LocStsType.PAKOUT.val()); oriLoc.setUpdateTime(now); if (!locService.updateById(oriLoc)) { throw new BusinessException("oriLoc:" + oriLoc.getLocNo() + " 修改库位状态失败"); if (maintainLocSts) { if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { throw new BusinessException("oriLoc:" + oriLoc.getLocNo() + " 不是在库状态"); } oriLoc.setLocSts(LocStsType.PAKOUT.val()); oriLoc.setUpdateTime(now); if (!locService.updateById(oriLoc)) { throw new BusinessException("oriLoc:" + oriLoc.getLocNo() + " 修改库位状态失败"); } } // destLoc @@ -256,13 +262,15 @@ // throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + destLoc.getCode$()); throw new BusinessException("AGV【" + agv.getUuid() + "】无法到达目标库位【" + destLoc.getLocNo() + "】"); } if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { throw new BusinessException("destLoc:" + destLoc.getLocNo() + " 不是空闲状态"); } destLoc.setLocSts(LocStsType.PAKIN.val()); destLoc.setUpdateTime(now); if (!locService.updateById(destLoc)) { throw new BusinessException("destLoc:" + destLoc.getLocNo() + " 修改库位状态失败"); if (maintainLocSts) { if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { throw new BusinessException("destLoc:" + destLoc.getLocNo() + " 不是空闲状态"); } destLoc.setLocSts(LocStsType.PAKIN.val()); destLoc.setUpdateTime(now); if (!locService.updateById(destLoc)) { throw new BusinessException("destLoc:" + destLoc.getLocNo() + " 修改库位状态失败"); } } // task @@ -286,13 +294,15 @@ // throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + oriLoc.getCode$()); throw new BusinessException("AGV【" + agv.getUuid() + "】无法到达起始库位【" + oriLoc.getLocNo() + "】"); } if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { throw new BusinessException("oriLoc:" + oriLoc.getLocNo() + " 不是在库状态"); } oriLoc.setLocSts(LocStsType.PAKOUT.val()); oriLoc.setUpdateTime(now); if (!locService.updateById(oriLoc)) { throw new BusinessException("oriLoc:" + oriLoc.getLocNo() + " 修改库位状态失败"); if (maintainLocSts) { if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { throw new BusinessException("oriLoc:" + oriLoc.getLocNo() + " 不是在库状态"); } oriLoc.setLocSts(LocStsType.PAKOUT.val()); oriLoc.setUpdateTime(now); if (!locService.updateById(oriLoc)) { throw new BusinessException("oriLoc:" + oriLoc.getLocNo() + " 修改库位状态失败"); } } // destSta @@ -353,13 +363,15 @@ // throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + destLoc.getCode$()); throw new BusinessException("AGV【" + agv.getUuid() + "】无法到达目标库位【" + destLoc.getLocNo() + "】"); } if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { throw new BusinessException("destLoc:" + destLoc.getLocNo() + " 不是空闲状态"); } destLoc.setLocSts(LocStsType.PAKIN.val()); destLoc.setUpdateTime(now); if (!locService.updateById(destLoc)) { throw new BusinessException("destLoc:" + destLoc.getLocNo() + " 修改库位状态失败"); if (maintainLocSts) { if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { throw new BusinessException("destLoc:" + destLoc.getLocNo() + " 不是空闲状态"); } destLoc.setLocSts(LocStsType.PAKIN.val()); destLoc.setUpdateTime(now); if (!locService.updateById(destLoc)) { throw new BusinessException("destLoc:" + destLoc.getLocNo() + " 修改库位状态失败"); } } // task zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/MaintainScheduler.java
@@ -158,6 +158,7 @@ List<Task> taskList = taskService.list(new LambdaQueryWrapper<Task>() .in(Task::getUplinkSts, TaskUplinkStateType.PENDING.toString(), TaskUplinkStateType.FAILED.toString()) .eq(Task::getTaskSts, TaskStsType.COMPLETE.val()) .isNotNull(Task::getBusId) ); if (Cools.isEmpty(taskList)) { return; } for (Task task : taskList) { zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/AutoRunRebootScheduler.java
@@ -61,6 +61,12 @@ // @Scheduled(cron = "0/1 * * * * ? ") private void execute() { if (!configService.getVal("TaskAssignRebootMode", Boolean.class)) { return; } Boolean maintainLocSts = configService.getVal("maintainLocSts", Boolean.class); if (!maintainLocSts) { log.error("failed to run auto agv task, the maintainLocSts is false"); return; } AgvModel agvModel = agvModelService.getOne(new LambdaQueryWrapper<AgvModel>().eq(AgvModel::getType, DEFAULT_AGV_MODEL.toString())); if (null == agvModel) { return; } zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/AutoRunScheduler.java
@@ -54,6 +54,11 @@ // @Scheduled(cron = "0/1 * * * * ? ") private void execute() { if (!configService.getVal("TaskAssignMode", Boolean.class)) { return; } Boolean maintainLocSts = configService.getVal("maintainLocSts", Boolean.class); if (!maintainLocSts) { log.error("failed to run auto agv task, the maintainLocSts is false"); return; } AgvModel agvModel = agvModelService.getOne(new LambdaQueryWrapper<AgvModel>().eq(AgvModel::getType, DEFAULT_AGV_MODEL.toString())); if (null == agvModel) { return; } zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/AutoTestDeviationScheduler.java
File was deleted zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/ConveyorAutoRunScheduler.java
@@ -25,7 +25,7 @@ import java.util.*; @Slf4j @Component //@Component public class ConveyorAutoRunScheduler { private static final AgvModelType DEFAULT_AGV_MODEL = AgvModelType.CTU_BOX_TRANSPORT_AGV; zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
@@ -104,6 +104,7 @@ @Transactional public Bus generateBusAndTask(OpenBusSubmitParam busSubmitParam, String memo) { String errorMsg = busService.checkoutValid(busSubmitParam); Boolean maintainLocSts = configService.getVal("maintainLocSts", Boolean.class); if (!Cools.isEmpty(errorMsg)) { throw new BusinessException(errorMsg); } @@ -147,35 +148,39 @@ Sta destSta = null; switch (TaskTypeType.get(task.getTaskTypeEl())) { case LOC_TO_LOC: oriLoc = locService.getById(task.getOriLoc()); if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { throw new BusinessException("oriLoc:" + task.getOriLoc$() + " is not in STOCK status"); } oriLoc.setLocSts(LocStsType.PAKOUT.val()); oriLoc.setUpdateTime(now); if (!locService.updateById(oriLoc)) { throw new BusinessException("oriLoc:" + task.getOriLoc$() + " failed to update"); } if (maintainLocSts) { oriLoc = locService.getById(task.getOriLoc()); if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { throw new BusinessException("oriLoc:" + task.getOriLoc$() + " is not in STOCK status"); } oriLoc.setLocSts(LocStsType.PAKOUT.val()); oriLoc.setUpdateTime(now); if (!locService.updateById(oriLoc)) { throw new BusinessException("oriLoc:" + task.getOriLoc$() + " failed to update"); } destLoc = locService.getById(task.getDestLoc()); if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { throw new BusinessException("destLoc:" + task.getDestLoc$() + " is not in IDLE status"); } destLoc.setLocSts(LocStsType.PAKIN.val()); destLoc.setUpdateTime(now); if (!locService.updateById(destLoc)) { throw new BusinessException("destLoc:" + task.getDestLoc$() + " failed to update"); destLoc = locService.getById(task.getDestLoc()); if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { throw new BusinessException("destLoc:" + task.getDestLoc$() + " is not in IDLE status"); } destLoc.setLocSts(LocStsType.PAKIN.val()); destLoc.setUpdateTime(now); if (!locService.updateById(destLoc)) { throw new BusinessException("destLoc:" + task.getDestLoc$() + " failed to update"); } } break; case LOC_TO_STA: oriLoc = locService.getById(task.getOriLoc()); if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { throw new BusinessException("oriLoc:" + task.getOriLoc$() + " is not in STOCK status"); } oriLoc.setLocSts(LocStsType.PAKOUT.val()); oriLoc.setUpdateTime(now); if (!locService.updateById(oriLoc)) { throw new BusinessException("oriLoc:" + task.getOriLoc$() + " failed to update"); if (maintainLocSts) { oriLoc = locService.getById(task.getOriLoc()); if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { throw new BusinessException("oriLoc:" + task.getOriLoc$() + " is not in STOCK status"); } oriLoc.setLocSts(LocStsType.PAKOUT.val()); oriLoc.setUpdateTime(now); if (!locService.updateById(oriLoc)) { throw new BusinessException("oriLoc:" + task.getOriLoc$() + " failed to update"); } } destSta = staService.getById(task.getDestSta()); @@ -189,14 +194,16 @@ throw new BusinessException("oriSta:" + task.getOriSta$() + " failed to reserve"); } destLoc = locService.getById(task.getDestLoc()); if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { throw new BusinessException("destLoc:" + task.getDestLoc$() + " is not in IDLE status"); } destLoc.setLocSts(LocStsType.PAKIN.val()); destLoc.setUpdateTime(now); if (!locService.updateById(destLoc)) { throw new BusinessException("destLoc:" + task.getDestLoc$() + " failed to update"); if (maintainLocSts) { destLoc = locService.getById(task.getDestLoc()); if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { throw new BusinessException("destLoc:" + task.getDestLoc$() + " is not in IDLE status"); } destLoc.setLocSts(LocStsType.PAKIN.val()); destLoc.setUpdateTime(now); if (!locService.updateById(destLoc)) { throw new BusinessException("destLoc:" + task.getDestLoc$() + " failed to update"); } } break; case STA_TO_STA: zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/IntegrationRecordService.java
@@ -5,4 +5,6 @@ public interface IntegrationRecordService extends IService<IntegrationRecord> { Boolean syncRecord(IntegrationRecord record); } zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/IntegrationRecordServiceImpl.java
@@ -1,12 +1,34 @@ package com.zy.acs.manager.manager.service.impl; import com.zy.acs.framework.common.R; import com.zy.acs.manager.core.service.ThreadPoolRegulator; import com.zy.acs.manager.manager.mapper.IntegrationRecordMapper; import com.zy.acs.manager.manager.entity.IntegrationRecord; import com.zy.acs.manager.manager.service.IntegrationRecordService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.concurrent.CompletableFuture; @Service("integrationRecordService") public class IntegrationRecordServiceImpl extends ServiceImpl<IntegrationRecordMapper, IntegrationRecord> implements IntegrationRecordService { @Autowired private ThreadPoolRegulator threadPoolRegulator; @Override public Boolean syncRecord(IntegrationRecord record) { CompletableFuture<?> completableFuture = CompletableFuture.supplyAsync(() -> { // mapDataDispatcher.modifyDynamicMatrix(null, null, param.getAgvNo(), true); // avoidWaveCalculator.calcDynamicNodeByVehicle(agv, null); return R.ok(); }, threadPoolRegulator.getInstance()); return false; } } zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/TaskServiceImpl.java
@@ -17,6 +17,7 @@ import com.zy.acs.manager.manager.enums.*; import com.zy.acs.manager.manager.mapper.TaskMapper; import com.zy.acs.manager.manager.service.*; import com.zy.acs.manager.system.service.ConfigService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -50,6 +51,8 @@ private ActionService actionService; @Autowired private TravelService travelService; @Autowired private ConfigService configService; @Override public PageResult<Task> pageRel(PageParam<Task, BaseParam> pageParam) { @@ -288,6 +291,7 @@ if (!task.getTaskSts().equals(TaskStsType.COMPLETE.val())) { return; } Boolean maintainLocSts = configService.getVal("maintainLocSts", Boolean.class); Date now = new Date(); // loc status Loc oriLoc = null; @@ -296,31 +300,35 @@ Sta destSta = null; switch (Objects.requireNonNull(TaskTypeType.get(task.getTaskTypeEl()))) { case LOC_TO_LOC: oriLoc = locService.getById(task.getOriLoc()); if (oriLoc.getLocSts().equals(LocStsType.PAKOUT.val())) { oriLoc.setLocSts(LocStsType.IDLE.val()); oriLoc.setUpdateTime(now); if (!locService.updateById(oriLoc)) { log.error("Loc [{}] 库位修改状态失败", task.getOriLoc$()); if (maintainLocSts) { oriLoc = locService.getById(task.getOriLoc()); if (oriLoc.getLocSts().equals(LocStsType.PAKOUT.val())) { oriLoc.setLocSts(LocStsType.IDLE.val()); oriLoc.setUpdateTime(now); if (!locService.updateById(oriLoc)) { log.error("Loc [{}] 库位修改状态失败", task.getOriLoc$()); } } } destLoc = locService.getById(task.getDestLoc()); if (destLoc.getLocSts().equals(LocStsType.PAKIN.val())) { destLoc.setLocSts(LocStsType.STOCK.val()); destLoc.setUpdateTime(now); if (!locService.updateById(destLoc)) { log.error("Loc [{}] 库位修改状态失败", task.getDestLoc$()); destLoc = locService.getById(task.getDestLoc()); if (destLoc.getLocSts().equals(LocStsType.PAKIN.val())) { destLoc.setLocSts(LocStsType.STOCK.val()); destLoc.setUpdateTime(now); if (!locService.updateById(destLoc)) { log.error("Loc [{}] 库位修改状态失败", task.getDestLoc$()); } } } break; case LOC_TO_STA: oriLoc = locService.getById(task.getOriLoc()); if (oriLoc.getLocSts().equals(LocStsType.PAKOUT.val())) { oriLoc.setLocSts(LocStsType.IDLE.val()); oriLoc.setUpdateTime(now); if (!locService.updateById(oriLoc)) { log.error("Loc [{}] 库位修改状态失败", task.getOriLoc$()); if (maintainLocSts) { oriLoc = locService.getById(task.getOriLoc()); if (oriLoc.getLocSts().equals(LocStsType.PAKOUT.val())) { oriLoc.setLocSts(LocStsType.IDLE.val()); oriLoc.setUpdateTime(now); if (!locService.updateById(oriLoc)) { log.error("Loc [{}] 库位修改状态失败", task.getOriLoc$()); } } } @@ -331,12 +339,14 @@ oriSta = staService.getById(task.getOriSta()); staReserveService.confirmStaReserve(oriSta, task, 1, StaReserveType.OUT); destLoc = locService.getById(task.getDestLoc()); if (destLoc.getLocSts().equals(LocStsType.PAKIN.val())) { destLoc.setLocSts(LocStsType.STOCK.val()); destLoc.setUpdateTime(now); if (!locService.updateById(destLoc)) { log.error("Loc [{}] 库位修改状态失败", task.getDestLoc$()); if (maintainLocSts) { destLoc = locService.getById(task.getDestLoc()); if (destLoc.getLocSts().equals(LocStsType.PAKIN.val())) { destLoc.setLocSts(LocStsType.STOCK.val()); destLoc.setUpdateTime(now); if (!locService.updateById(destLoc)) { log.error("Loc [{}] 库位修改状态失败", task.getDestLoc$()); } } } break; @@ -361,31 +371,36 @@ public void maintainLocAndStaHandler(Task task, Boolean complete) { Loc oriLoc = null; Loc destLoc = null; Sta oriSta = null; Sta destSta = null; Boolean maintainLocSts = configService.getVal("maintainLocSts", Boolean.class); Date now = new Date(); TaskTypeType typeType = TaskTypeType.get(task.getTaskTypeEl()); switch (Objects.requireNonNull(typeType)) { case LOC_TO_LOC: oriLoc = locService.getById(task.getOriLoc()); destLoc = locService.getById(task.getDestLoc()); if (maintainLocSts) { oriLoc = locService.getById(task.getOriLoc()); destLoc = locService.getById(task.getDestLoc()); oriLoc.setLocSts(complete?LocStsType.IDLE.val():LocStsType.STOCK.val()); oriLoc.setUpdateTime(now); if (!locService.updateById(oriLoc)) { throw new BusinessException("Loc [" + oriLoc.getLocNo() + "] 库位修改状态失败 !!!"); } oriLoc.setLocSts(complete?LocStsType.IDLE.val():LocStsType.STOCK.val()); oriLoc.setUpdateTime(now); if (!locService.updateById(oriLoc)) { throw new BusinessException("Loc [" + oriLoc.getLocNo() + "] 库位修改状态失败 !!!"); } destLoc.setLocSts(complete?LocStsType.STOCK.val():LocStsType.IDLE.val()); destLoc.setUpdateTime(now); if (!locService.updateById(destLoc)) { throw new BusinessException("Loc [" + destLoc.getLocNo() + "] 库位修改状态失败 !!!"); destLoc.setLocSts(complete?LocStsType.STOCK.val():LocStsType.IDLE.val()); destLoc.setUpdateTime(now); if (!locService.updateById(destLoc)) { throw new BusinessException("Loc [" + destLoc.getLocNo() + "] 库位修改状态失败 !!!"); } } break; case LOC_TO_STA: oriLoc = locService.getById(task.getOriLoc()); oriLoc.setLocSts(complete?LocStsType.IDLE.val():LocStsType.STOCK.val()); oriLoc.setUpdateTime(now); if (!locService.updateById(oriLoc)) { throw new BusinessException("Loc [" + oriLoc.getLocNo() + "] 库位修改状态失败 !!!"); if (maintainLocSts) { oriLoc = locService.getById(task.getOriLoc()); oriLoc.setLocSts(complete?LocStsType.IDLE.val():LocStsType.STOCK.val()); oriLoc.setUpdateTime(now); if (!locService.updateById(oriLoc)) { throw new BusinessException("Loc [" + oriLoc.getLocNo() + "] 库位修改状态失败 !!!"); } } destSta = staService.getById(task.getDestSta()); @@ -403,11 +418,13 @@ staReserveService.cancelStaReserve(oriSta, task, 1, StaReserveType.OUT); } destLoc = locService.getById(task.getDestLoc()); destLoc.setLocSts(complete?LocStsType.STOCK.val():LocStsType.IDLE.val()); destLoc.setUpdateTime(now); if (!locService.updateById(destLoc)) { throw new BusinessException("Loc [" + destLoc.getLocNo() + "] 库位修改状态失败 !!!"); if (maintainLocSts) { destLoc = locService.getById(task.getDestLoc()); destLoc.setLocSts(complete?LocStsType.STOCK.val():LocStsType.IDLE.val()); destLoc.setUpdateTime(now); if (!locService.updateById(destLoc)) { throw new BusinessException("Loc [" + destLoc.getLocNo() + "] 库位修改状态失败 !!!"); } } break; case STA_TO_STA: zy-acs-manager/src/main/resources/application.yml
@@ -53,14 +53,14 @@ convey-plc: host: 10.10.10.222 port: 9090 url: /api/open/task/report timeout: 15000 uplink: enabled: true host: 10.10.10.222 port: 9090 host: 10.10.10.251 port: 8082 timeout: 30000 url: /rsf-open-api/rcs/api/open/task/report floyd: enable: false