From 513f54c61991af2078c9098845df3e840ea5b863 Mon Sep 17 00:00:00 2001 From: zhang <zc857179121@qq.com> Date: 星期二, 17 六月 2025 14:29:48 +0800 Subject: [PATCH] 1 --- zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java | 56 +++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 35 insertions(+), 21 deletions(-) diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java index dbf5fd2..c18e9f1 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java @@ -48,7 +48,7 @@ */ @Slf4j @Service("mainService") -public class MainService { +public class MainService implements IMainService { @Autowired private BusService busService; @@ -284,7 +284,9 @@ */ @Transactional(propagation = Propagation.REQUIRES_NEW) public void buildMajorTask(Long agvId, List<Task> taskList) { - if (Cools.isEmpty(agvId, taskList)) { return; } + if (Cools.isEmpty(agvId, taskList)) { + return; + } try { // valid ----------------------------------------------- Agv agv = agvService.getById(agvId); @@ -324,16 +326,18 @@ * val: new TaskPosDto(taskId, new Double[]{code.getX(), code.getY()}, posType) */ Map<String, List<TaskPosDto>> groups = new HashMap<>(); - final String sameGroupXy = configService.getVal( "sameGroupXy", String.class); + final String sameGroupXy = configService.getVal("sameGroupXy", String.class); int backpackLev = 0; for (Task task : taskList) { - backpackLev ++; + backpackLev++; Code startCode = null; Code endCode = null; - Loc oriLoc = null; Loc destLoc = null; - Sta oriSta = null; Sta destSta = null; + Loc oriLoc = null; + Loc destLoc = null; + Sta oriSta = null; + Sta destSta = null; switch (Objects.requireNonNull(TaskTypeType.get(task.getTaskTypeEl()))) { case LOC_TO_LOC: oriLoc = locService.getById(task.getOriLoc()); @@ -436,7 +440,7 @@ // re-order by agv current position Code currCode = codeService.getCacheById(agvDetail.getRecentCode()); - Double[] currPosition = new Double[] {currCode.getX(), currCode.getY()}; + Double[] currPosition = new Double[]{currCode.getX(), currCode.getY()}; List<List<TaskPosDto>> pickGroups = new ArrayList<>(); List<List<TaskPosDto>> dropGroups = new ArrayList<>(); @@ -482,7 +486,7 @@ List<Segment> segmentList = new ArrayList<>(); for (List<TaskPosDto> dtoList : list) { for (TaskPosDto taskPosDto : dtoList) { - segSerial ++; + segSerial++; AgvBackpackType backpackType = AgvBackpackDto.find(backpackDtoList, taskPosDto.getTaskId()); assert null != backpackType; @@ -530,9 +534,12 @@ /** * 鍏呯數 鍥炲緟鏈轰綅浠诲姟 */ - @Transactional(propagation = Propagation.REQUIRES_NEW) // although there is a Transactional here that the lock is isolated, but we can't join the caller's Transactional + @Transactional(propagation = Propagation.REQUIRES_NEW) + // although there is a Transactional here that the lock is isolated, but we can't join the caller's Transactional public boolean buildMinorTask(Long agvId, TaskTypeType taskType, String destination, Jam jam) { - if (Cools.isEmpty(agvId, taskType)) { return false; } + if (Cools.isEmpty(agvId, taskType)) { + return false; + } try { String agvNo = agvService.getAgvNo(agvId); if (!agvService.judgeEnable(agvId)) { @@ -579,7 +586,7 @@ task.setAgvId(agvId); task.setUuid(String.valueOf(snowflakeIdWorker.nextId()).substring(3)); List<Task> lastTasks = taskService.list(new LambdaQueryWrapper<Task>().orderByDesc(Task::getId)); - task.setSeqNum(Utils.generateSeqNum(Cools.isEmpty(lastTasks)?null:lastTasks.get(0).getSeqNum())); + task.setSeqNum(Utils.generateSeqNum(Cools.isEmpty(lastTasks) ? null : lastTasks.get(0).getSeqNum())); task.setOriCode(agvDetail.getCode()); task.setDestCode(endCode.getId()); // lane @@ -587,7 +594,7 @@ if (null != destLane) { task.setDestLaneHash(destLane.getHashCode()); } - task.setPriority(taskType.equals(TaskTypeType.TO_CHARGE)?2:1); + task.setPriority(taskType.equals(TaskTypeType.TO_CHARGE) ? 2 : 1); task.setTaskSts(TaskStsType.ASSIGN.val()); task.setTaskType(taskType.val()); task.setIoTime(now); @@ -609,11 +616,12 @@ } // generate segment - int segSerial = 0; segSerial ++; + int segSerial = 0; + segSerial++; List<Segment> segmentList = new ArrayList<>(); String posType = ""; - switch (taskType){ + switch (taskType) { case TO_CHARGE: posType = TaskPosDto.PosType.TO_CHARGE.toString(); break; @@ -685,7 +693,9 @@ @Transactional public synchronized void generateAction(Long agvId, List<Segment> segmentList, List<String> pathList, Date algoStartTime) { try { - if (Cools.isEmpty(agvId, segmentList)) { return; } + if (Cools.isEmpty(agvId, segmentList)) { + return; + } Date now = new Date(); long actionPrepareSts = ActionStsType.PREPARE.val(); // JSONObject storeDirection = configService.getVal("storeDirection", JSONObject.class); @@ -727,7 +737,9 @@ List<String> pathListPart = pathList.subList(pathList.indexOf(lastCode.getData()), pathList.indexOf(code.getData()) + 1); for (int i = 0; i < pathListPart.size(); i++) { - if (i == 0) { continue; } + if (i == 0) { + continue; + } String next = pathListPart.get(i); @@ -936,7 +948,7 @@ task.getBusId(), // 鎬荤嚎 task.getId(), // 浠诲姟 null, // 鍔ㄤ綔鍙� - null, // 浼樺厛绾� + null, // 浼樺厛绾� ActionTypeType.ReadyReleaseToShelvesLoc.desc, // 鍚嶇О (double) agvDirectionType.val, // 灞炴�у�� lastCode.getData(), // 鍦伴潰鐮� @@ -1437,9 +1449,9 @@ // segment list List<Segment> segmentList = segmentService.list(new LambdaQueryWrapper<Segment>() - .eq(Segment::getGroupId, serialNo) + .eq(Segment::getGroupId, serialNo) // .eq(Segment::getState, SegmentStateType.RUNNING.toString()) - .orderByAsc(Segment::getSerial) + .orderByAsc(Segment::getSerial) ); // settlement @@ -1469,8 +1481,10 @@ for (Segment segment : segmentList) { boolean taskComplete = false; - Task task = taskService.getById(segment.getTaskId()); assert null != task; - TaskTypeType typeType = TaskTypeType.get(task.getTaskTypeEl()); assert null != typeType; + Task task = taskService.getById(segment.getTaskId()); + assert null != task; + TaskTypeType typeType = TaskTypeType.get(task.getTaskTypeEl()); + assert null != typeType; TaskPosDto.PosType posType = TaskPosDto.queryPosType(segment.getPosType()); switch (Objects.requireNonNull(posType)) { -- Gitblit v1.9.1