#
vincentlu
1 天以前 289c3501e04d2781c4b1592c5430a1c648307749
#
3个文件已修改
34 ■■■■ 已修改文件
zy-acs-manager/src/main/java/com/zy/acs/manager/core/domain/PathDto.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/TrafficService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/core/domain/PathDto.java
@@ -1,6 +1,9 @@
package com.zy.acs.manager.core.domain;
import com.zy.acs.framework.common.Cools;
import lombok.Data;
import java.util.List;
/**
 * Created by vincent on 2023/6/19
@@ -28,4 +31,14 @@
        this.turn = turn;
    }
    public static void markTurn(List<PathDto> pathTrace, Double direction) {
        if (Cools.isEmpty(pathTrace) || direction == null) {
            return;
        }
        PathDto current = pathTrace.get(pathTrace.size() - 1);
        current.setDirection(direction);
        current.setTurn(true);
    }
}
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
@@ -895,8 +895,9 @@
     */
    @Transactional
    public synchronized List<PathDto> generateAction(Long agvId, List<Segment> segmentList, List<String> pathList, Date algoStartTime) {
        List<PathDto> pathTrace = new ArrayList<>();
        try {
            if (Cools.isEmpty(agvId, segmentList)) { return; }
            if (Cools.isEmpty(agvId, segmentList)) { return pathTrace; }
            Date now = new Date();
            long actionPrepareSts = ActionStsType.PREPARE.val();
//            JSONObject storeDirection = configService.getVal("storeDirection", JSONObject.class);
@@ -925,6 +926,7 @@
            if (!lastCode.getData().equals(pathList.get(0))) {
                throw new CoolException("AGV[" + agvNo + "]定位偏移...");
            }
            pathTrace.add(new PathDto(lastCode.getData(), lastDirection, false));
            boolean first = true;
            for (Segment segment : segmentList) {
@@ -990,6 +992,7 @@
                                        now    // 工作时间
                                ));
                                lastDirection = nextLaneDir;
                                PathDto.markTurn(pathTrace, lastDirection);
                            }
                            if (nextDirection.equals(oppNextLaneDir)) {
@@ -1058,6 +1061,7 @@
                                        ));
                                        lastDirection = nextDirection;
                                        PathDto.markTurn(pathTrace, lastDirection);
                                    }
                                }
                            }
@@ -1083,6 +1087,7 @@
                            ));
                            lastDirection = nextDirection;
                            PathDto.markTurn(pathTrace, lastDirection);
                        }
                        // run
@@ -1105,6 +1110,7 @@
                        ));
                        lastCode = nextCode;
                        pathTrace.add(new PathDto(lastCode.getData(), lastDirection, false));
                    }
@@ -1150,6 +1156,7 @@
                        ));
                        lastDirection = firstTurnDir;
                        PathDto.markTurn(pathTrace, lastDirection);
                    }
                    first = false;
@@ -1277,6 +1284,7 @@
                                    now    // 工作时间
                            ));
                            lastDirection = oriStaWorkDirection;
                            PathDto.markTurn(pathTrace, lastDirection);
                        }
                        // 计算货叉工作方向
                        actuatorDirectionType = ActuatorDirectionType.fromVal(oriSta.getActDir());
@@ -1342,6 +1350,7 @@
                                    now    // 工作时间
                            ));
                            lastDirection = destStaWorkDirection;
                            PathDto.markTurn(pathTrace, lastDirection);
                        }
                        // 背篓取货
                        if (backupAction) {
@@ -1402,6 +1411,7 @@
                                    now    // 工作时间
                            ));
                            lastDirection = chargeDirection;
                            PathDto.markTurn(pathTrace, lastDirection);
                        }
                        // charge
@@ -1556,6 +1566,7 @@
            }
            log.info("{}号Agv动作组装完成,指令数量:{}", agvNo, newActionList.size());
            return pathTrace;
        } catch (Exception e) {
            log.error("mainService.generateAction", e);
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -1612,6 +1623,7 @@
                    if (!taskService.updateById(task)) {
                        throw new BusinessException(task.getSeqNum() + "任务更新失败");
                    }
                }
            }
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/TrafficService.java
@@ -9,6 +9,7 @@
import com.zy.acs.manager.common.utils.MapDataUtils;
import com.zy.acs.manager.core.constant.MapDataConstant;
import com.zy.acs.manager.core.domain.BlockVehicleDto;
import com.zy.acs.manager.core.domain.PathDto;
import com.zy.acs.manager.core.domain.TaskPosDto;
import com.zy.acs.manager.core.domain.type.BlockSeverityType;
import com.zy.acs.manager.core.service.astart.MapDataDispatcher;
@@ -277,12 +278,12 @@
                }
            }
            mapService.lockPath(null, pathList, agv.getUuid());
//            startTime = System.currentTimeMillis();
            mainService.generateAction(segment.getAgvId(), segmentList, pathList, now);
            List<PathDto> pathDtoList = mainService.generateAction(segment.getAgvId(), segmentList, pathList, now);
//            System.out.println("generateAction: " + (System.currentTimeMillis() - startTime));
            mapService.lockPath(null, pathList, agv.getUuid());
        } catch (Exception e) {
            log.error("TrafficService.trigger", e);
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();