*
lsh
2025-08-18 16425e5c62f3e65a0e529d7c0ab851fa49b88ef0
*
6个文件已修改
321 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/RgvController.java 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/utils/Utils.java 130 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/RgvThread.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/license.lic 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/index.html 124 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/RgvController.java
@@ -61,6 +61,8 @@
    @Autowired
    private BasRgvService basRgvService;
    @Autowired
    private BasDevpService basDevpService;
    @Autowired
    private MainServiceImpl mainService;
    @Autowired
    private BasDevpPositionService basDevpPositionService;
@@ -355,8 +357,8 @@
            double[] doubles = Utils.getRgvPosNew(perimeter, rgvProtocol.RgvPos.doubleValue());
//            double[] doubles = Utils.RingThroughXY2(183.0, 100*i );
            ringThroughParam.setValueX(doubles[0]-2.94);
            ringThroughParam.setValueY(doubles[1]-2.94);
            ringThroughParam.setValueX(doubles[0]);
            ringThroughParam.setValueY(doubles[1]);
            ringThroughParam.setModeColor(rgvProtocol.modeType.color);
            ringThroughParam.setStatusColor(rgvProtocol.statusType.color);
            result.add(ringThroughParam);
@@ -371,10 +373,32 @@
        List<RingThroughParam> result = new ArrayList<>();
        List<BasDevpPosition> basDevpPositions = basDevpPositionService.selectList(new EntityWrapper<>());
        for (BasDevpPosition basDevpPosition : basDevpPositions){
            if (basDevpPosition.getDevNo() == 134){
                continue;
            }
            RingThroughParam ringThroughParam = new RingThroughParam();
            ringThroughParam.setModeColor("#FFFFFF");
            ringThroughParam.setStatusColor("#FFFFFF");
            try{
                BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no",basDevpPosition.getDevNo()));
                if (basDevp.getAutoing().equals("Y")){
                    if (basDevp.getLoading().equals("Y")){
                        ringThroughParam.setModeColor("#ab1839");
                        ringThroughParam.setStatusColor("#ab1839");
                    }
                    if (basDevp.getLoading().equals("N")){
                        ringThroughParam.setModeColor("#27AE60");
                        ringThroughParam.setStatusColor("#27AE60");
                    }
                } else {
                    ringThroughParam.setModeColor("#C0392B");
                    ringThroughParam.setStatusColor("#C0392B");
                }
            } catch (Exception e){
                System.out.println(e.getMessage());
                ringThroughParam.setModeColor("#000000");
                ringThroughParam.setStatusColor("#000000");
            }
            ringThroughParam.setIndex(basDevpPosition.getDevNo());
//            double[] doubles = Utils.RingThroughXYSta(perimeter, perimeter-basDevpPosition.getPlcPosition());
//            ringThroughParam.setValueX(doubles[0]>50? doubles[0]+6:doubles[0]-1);
src/main/java/com/zy/asrs/utils/Utils.java
@@ -132,54 +132,54 @@
    }
    public static double[] getRgvPosNew(Integer devNo,double a, double b) {
        double[] rgvPosNew = getRgvPosNew(a, b);
        switch (devNo){
            case 101:
            case 102:
            case 103:
            case 104:
            case 105:
            case 106:
            case 107:
            case 108:
            case 109:
            case 110:
            case 111:
                rgvPosNew[0] = rgvPosNew[0] - 30;
                rgvPosNew[1] = rgvPosNew[1];
                break;
            case 112:
            case 113:
            case 114:
            case 115:
                rgvPosNew[0] = rgvPosNew[0] + 30;
                rgvPosNew[1] = rgvPosNew[1];
                break;
            case 116:
            case 117:
            case 118:
            case 119:
            case 120:
            case 121:
            case 122:
            case 123:
            case 124:
            case 125:
            case 126:
            case 127:
            case 128:
            case 129:
            case 130:
            case 131:
            case 132:
            case 133:
                rgvPosNew[0] = rgvPosNew[0];
                rgvPosNew[1] = rgvPosNew[1] + 30;
                break;
            case 134:
                rgvPosNew[0] = rgvPosNew[0];
                rgvPosNew[1] = rgvPosNew[1] - 30;
                break;
        }
//        switch (devNo){
//            case 101:
//            case 102:
//            case 103:
//            case 104:
//            case 105:
//            case 106:
//            case 107:
//            case 108:
//            case 109:
//            case 110:
//            case 111:
//                rgvPosNew[0] = rgvPosNew[0] - 50;
//                rgvPosNew[1] = rgvPosNew[1];
//                break;
//            case 112:
//            case 113:
//            case 114:
//            case 115:
//                rgvPosNew[0] = rgvPosNew[0] + 30;
//                rgvPosNew[1] = rgvPosNew[1];
//                break;
//            case 116:
//            case 117:
//            case 118:
//            case 119:
//            case 120:
//            case 121:
//            case 122:
//            case 123:
//            case 124:
//            case 125:
//            case 126:
//            case 127:
//            case 128:
//            case 129:
//            case 130:
//            case 131:
//            case 132:
//            case 133:
//                rgvPosNew[0] = rgvPosNew[0];
//                rgvPosNew[1] = rgvPosNew[1] + 70;
//                break;
//            case 134:
//                rgvPosNew[0] = rgvPosNew[0];
//                rgvPosNew[1] = rgvPosNew[1] - 30;
//                break;
//        }
        return rgvPosNew;
    }
@@ -189,32 +189,44 @@
        // 类型说明:0-直线,1-圆弧(需要圆心坐标)
        Object[][] intervals = {
                // 直线区间(0-134400)
                {0.0, 120000.0, 0, 390.0, 775.0, 25.0, 775.0},
//                {起点, 终点, 类型, x1, y1, x2, y2,
                {0.0, 120000.0, 0, 390.0, 750.0, 60.0, 750.0},
//                // 弧线区间!!!直线区间!!!
                {120000.0, 127500.0, 0, 25.0, 775.0, 45.0, 822.0},
//                {120000.0, 127500.0, 2, 60.0, 750.0, 10.0, 800.0, 10.0, 750.0}, // 修正终点坐标
                {120000.0, 127500.0, 2, 60.0, 750.0, 10.0, 800.0, 60.0, 800.0}, // 修正终点坐标
//                {120000.0, 127500.0, 0, 25.0, 775.0, 45.0, 822.0},
                // 弧线区间!!!直线区间!!!
                {127500.0, 134900.0, 0, 45.0, 822.0, 65.0, 882.0},
//                {127500.0, 134900.0, 2, 10.0, 800.0, 60.0, 850.0, 10.0, 850.0}, // 修正终点坐标
                {127500.0, 134900.0, 2, 10.0, 800.0, 60.0, 850.0, 60.0, 800.0}, // 修正终点坐标
//                {127500.0, 134900.0, 0, 45.0, 822.0, 65.0, 882.0},
                // 直线区间
                {134900.0, 680103.0,0, 65.0, 882.0, 1115.0, 882.0},
                {134900.0, 680103.0,0, 60.0, 850.0, 1100.0, 850.0},
//                // 弧线区间(拐点116-115),控制点假设为(1125, 882)
//                {680103, 731550, 1115, 882, 1215, 775, 1125, 882},
                // 圆弧区间(拐点116-115)新参数:圆心(1115,775)
                {680103.0, 731550.0, 2, 1115.0, 882.0, 1215.0, 775.0, 1115.0, 775.0}, // 修正终点坐标
//                {680103.0, 731550.0, 2, 1100.0, 850.0, 1200.0, 750.0, 1200.0, 850.0}, // 修正终点坐标
                {680103.0, 731550.0, 2, 1100.0, 850.0, 1200.0, 750.0, 1100.0, 750.0}, // 修正终点坐标
                // 直线区间
                {731550.0, 972950.0,0, 1215.0, 775.0, 1215.0, 125.0},
                {731550.0, 972950.0,0, 1200.0, 750.0, 1200.0, 100.0},
                // 弧线区间(拐点112-顶点),控制点假设为(1215, 80)!!!直线区间!!!
                {972950.0, 1016193.0,0, 1215.0, 125.0, 1164.0, 80.0},
//                {972950.0, 1016193.0, 2, 1200.0, 100.0, 1150.0, 50.0, 1200.0, 50.0}, // 修正终点坐标
                {972950.0, 1016193.0, 2, 1200.0, 100.0, 1150.0, 50.0, 1150.0, 100.0}, // 修正终点坐标
//                {972950.0, 1016193.0,0, 1215.0, 125.0, 1164.0, 80.0},
                // 弧线区间(拐点-顶点-111),控制点假设为(1164, 125)!!!直线区间!!!
                {1016193.0, 1063563.0,0, 1164.0, 80.0, 1115.0, 125.0},
//                {1016193.0, 1063563.0, 2, 1150.0, 50.0, 1100.0, 100.0, 1100.0, 50.0}, // 修正终点坐标
                {1016193.0, 1063563.0, 2, 1150.0, 50.0, 1100.0, 100.0, 1150.0, 100.0}, // 修正终点坐标
//                {1016193.0, 1063563.0,0, 1164.0, 80.0, 1115.0, 125.0},
                // 直线区间
                {1063563.0, 1315250.0,0, 1115.0, 150.0, 1115.0, 720.0},
                {1063563.0, 1315250.0,0, 1100.0, 100.0, 1100.0, 700.0},
                // 弧线区间(拐点101-转弯),控制点假设为(1115, 750)
                {1315250.0, 1322829.0,0, 1115.0, 720.0, 1100.0, 750.0},
//                {1315250.0, 1322829.0, 2, 1100.0, 700.0, 1050.0, 750.0, 1100.0, 750.0}, // 修正终点坐标
                {1315250.0, 1322829.0, 2, 1100.0, 700.0, 1050.0, 750.0, 1050.0, 700.0}, // 修正终点坐标
//                {1315250.0, 1322829.0,0, 1115.0, 720.0, 1100.0, 750.0},
                // 直线区间
                {1322829.0, 1737000.0,0, 1090.0, 775.0, 390.0, 775.0},
                {1322829.0, 1737000.0,0, 1050.0, 750.0, 390.0, 750.0},
        };
        for (Object[] interval : intervals) {
src/main/java/com/zy/core/thread/RgvThread.java
@@ -13,6 +13,7 @@
import com.zy.asrs.service.BasRgvErrLogService;
import com.zy.asrs.service.BasRgvOptService;
import com.zy.asrs.service.BasRgvService;
import com.zy.asrs.utils.NumUtils;
import com.zy.core.ThreadHandler;
import com.zy.core.cache.MessageQueue;
import com.zy.core.cache.OutputQueue;
@@ -53,6 +54,7 @@
    private boolean resetFlag2 = false;
    private boolean connectRgv = false;
    private boolean alarmChangeSign = false;
    private int rgvIII = 1;
    public RgvThread(RgvSlave slave) {
        this.slave = slave;
@@ -61,6 +63,7 @@
    @Override
    @SuppressWarnings("InfiniteLoopStatement")
    public void run() {
        rgvIII = this.slave.getId();
        connectRgv = this.connect();
        while(!connectRgv){
            try {
@@ -312,6 +315,12 @@
                rgvProtocol.setAlarmList(alarmList);
//                rgvProtocol.setRgvPos((long)NumUtils.GetRandomIntInRange(1737000));
                rgvProtocol.setRgvPos((long) (10000*rgvIII+rgvProtocol.getRgvNo()*10000));
                if (rgvProtocol.getRgvPos()>1737000){
                    rgvIII = rgvProtocol.getRgvNo();
                    rgvProtocol.setRgvPos((long) (10000*rgvIII+rgvProtocol.getRgvNo()*10000));
                }
                rgvIII++;
                OutputQueue.RGV.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId()));
src/main/resources/application.yml
@@ -8,8 +8,8 @@
    name: @pom.build.finalName@
  datasource:
    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
    url: jdbc:sqlserver://127.0.0.1:50751;databasename=gdhmasrs
#    url: jdbc:sqlserver://127.0.0.1:50948;databasename=gdhmasrs
#    url: jdbc:sqlserver://127.0.0.1:50751;databasename=gdhmasrs
    url: jdbc:sqlserver://127.0.0.1:50948;databasename=gdhmasrs
    username: sa
    password: sa@123
  mvc:
@@ -64,7 +64,7 @@
  # RGV穿梭车1
  rgv[0]:
    id: 1
    ip: 172.17.196.3
    ip: 192.168.4.250
    port: 502
    rack: 0
    slot: 0
@@ -72,7 +72,7 @@
  # RGV穿梭车1
  rgv[1]:
    id: 2
    ip: 172.17.196.6
    ip: 192.168.4.250
    port: 502
    rack: 0
    slot: 0
@@ -80,7 +80,7 @@
  # RGV穿梭车1
  rgv[2]:
    id: 3
    ip: 172.17.196.9
    ip: 192.168.4.250
    port: 502
    rack: 0
    slot: 0
@@ -88,7 +88,7 @@
  # RGV穿梭车1
  rgv[3]:
    id: 4
    ip: 172.17.196.12
    ip: 192.168.4.250
    port: 502
    rack: 0
    slot: 0
@@ -96,7 +96,7 @@
  # RGV穿梭车1
  rgv[4]:
    id: 5
    ip: 172.17.196.15
    ip: 192.168.4.250
    port: 502
    rack: 0
    slot: 0
@@ -104,7 +104,7 @@
  # RGV穿梭车1
  rgv[5]:
    id: 6
    ip: 172.17.196.18
    ip: 192.168.4.250
    port: 502
    rack: 0
    slot: 0
@@ -112,7 +112,7 @@
  # RGV穿梭车1
  rgv[6]:
    id: 7
    ip: 172.17.196.21
    ip: 192.168.4.250
    port: 502
    rack: 0
    slot: 0
@@ -120,7 +120,7 @@
  # RGV穿梭车1
  rgv[7]:
    id: 8
    ip: 172.17.196.25
    ip: 192.168.4.250
    port: 502
    rack: 0
    slot: 0
@@ -128,7 +128,7 @@
  # RGV穿梭车1
  rgv[8]:
    id: 9
    ip: 172.17.196.28
    ip: 192.168.4.250
    port: 502
    rack: 0
    slot: 0
@@ -136,7 +136,7 @@
  # RGV穿梭车1
  rgv[9]:
    id: 10
    ip: 172.17.196.31
    ip: 192.168.4.250
    port: 502
    rack: 0
    slot: 0
src/main/resources/license.lic
Binary files differ
src/main/webapp/views/index.html
@@ -35,7 +35,7 @@
        .map {
            position: relative;
            width: 52vw;
            height: 80vh;
            height: 72vh;
            border-radius: 50%;
            display: flex;
            justify-content: center;
@@ -163,7 +163,7 @@
            background: #f0f9eb;
        }
        .container {
            width: 100vh;
            width: 52vw;
            height: 72vh;
            position: absolute;
            /*background: #8c939d;*/
@@ -204,7 +204,7 @@
        }
    </style>
</head>
<body>
<body id="app1">
    <!--<header>-->
    <!--    环形穿梭车智能系统-->
    <!--</header>-->
@@ -217,19 +217,9 @@
            <!--        <div class="outer-ring"></div>-->
<!--            <div v-for="track in energyGatheringRing" class="inner-ring" :style="{  borderColor: track.trackColor , boxShadow :  'inset 0 0 30px '+track.radiationColor+', 0 0 20px '+track.radiationColor}"></div>-->
<!--            <div v-for="track in energyGatheringRing" class="outer-ring" :style="{  borderColor: track.trackColor , boxShadow :  'inset 0 0 30px '+track.radiationColor+', 0 0 20px '+track.radiationColor}"></div>-->
            <svg class="container">
<!--                <path d="M 100,250-->
<!--                        L 100,800-->
<!--                        C 100,800 100,850 150,850-->
<!--                        C 150,850 200,850 200,800-->
<!--                        L 200,250-->
<!--                        C 200,250 200,200 250,200-->
<!--                        L 1100,200-->
<!--                        C 1100,200 1150,200 1150,150-->
<!--                        C 1150,150 1150,100 1100,100-->
<!--                        L 250,100-->
<!--                        C 250,100 90,90 100,250 z"-->
<!--                      style="fill:none; stroke:blue; stroke-width:4;" />-->
            <svg class="container"
                 viewBox="0 0 1200 850"
                 preserveAspectRatio="xMidYMid meet">
                <path d="M 1200,750
                        L 1200,100
                        C 1200,100 1200,50 1150,50
@@ -244,17 +234,11 @@
"
                      style="fill:none; stroke:blue; stroke-width:4;" />
            </svg>
<!--            <div class="bus-station">-->
<!--                <div v-for="(item,i) in devpPos1" class="bus-item-top" :style="'left:' + (75 + i * 15) + 'px'">{{item.dev_no}}</div>-->
<!--            </div>-->
<!--            <div class="bus-station" style="flex-direction: column">-->
<!--                <div v-for="(item,i) in devpPos2" class="bus-item-left" :style="'top:' + (200 + i * 50) + 'px'">{{item.dev_no}}</div>-->
<!--            </div>-->
<!--            <div class="bus-station" style="flex-direction: column">-->
<!--                <div v-for="(item,i) in devpPos3" class="bus-item-left2" :style="'top:' + (100 + i * 10) + 'px'">{{item.dev_no}}</div>-->
<!--            </div>-->
<!--             Stations on outer ring-->
            <div v-for="station in tableDataDev" class="station" :style="{ top: station.valueY + 'px', left: station.valueX + 'px' }">{{ station.index }}</div>
<!--            <div v-for="station in tableDataDev" class="station" :style="{ top: station.valueY + 'px', left: station.valueX + 'px' , backgroundColor: station.modeColor}">{{ station.index }}</div>-->
            <div v-for="station in tableDataDev" class="station" :style="{
                top: convertToCSSPosition(station.valueX, station.valueY).y + 'px',
                left: convertToCSSPosition(station.valueX, station.valueY).x + 'px',
                backgroundColor: station.modeColor}">{{ station.index }}</div>
            <div>
                <el-switch
                        style="display: block"
@@ -267,7 +251,11 @@
                </el-switch>
            </div>
            <!-- Buses -->
            <div v-for="bus in tableDataRgv" class="bus" :style="{ top: bus.valueY + 'px', left: bus.valueX + 'px' , borderColor: bus.modeColor, backgroundColor: bus.statusColor}">{{ bus.index }}</div>
<!--            <div v-for="bus in tableDataRgv" class="bus" :style="{ top: bus.valueY + 'px', left: bus.valueX + 'px' , borderColor: bus.modeColor, backgroundColor: bus.statusColor}">{{ bus.index }}</div>-->
            <div v-for="bus in tableDataRgv" class="bus" :style="{
                top: convertToCSSPosition(bus.valueX, bus.valueY).y + 'px',
                left: convertToCSSPosition(bus.valueX, bus.valueY).x + 'px',
                borderColor: bus.modeColor, backgroundColor: bus.statusColor}">{{ bus.index }}</div>
        </div>
        <!-- Left Task Bar -->
@@ -477,9 +465,18 @@
    </div>
    <script>
        // 在Vue实例外获取body尺寸
        function getBodySize() {
            return {
                width: document.body.clientWidth,
                height: document.body.clientHeight
            };
        }
        var app = new Vue({
            el: '#app',
            data: {
                containerSize: { width: 0, height: 0},
                bodySize: { width: 0, height: 0 },
                activeNames: ['1'],
                valueLeft: '0',
                valueLeft1: '0',
@@ -543,6 +540,24 @@
            watch: {
            },
            // 在 mounted 中初始化尺寸和监听
            mounted() {
                this.updateContainerSize();
                this.updateBodySize();
                window.addEventListener('resize', this.handleResize);
            },
            beforeDestroy() {
                window.removeEventListener('resize', this.handleResize);
            },
            computed: {
                mappedStations() {
                    return this.tableDataDev.map(station => ({
                        ...station,
                        position: this.convertToCSSPosition(station.valueX, station.valueY)
                    }));
                }
            },
            methods: {
                init(){
                    this.getTableDataRgv()
@@ -569,6 +584,52 @@
                    }, 1000)
                },
                // 获取容器实际尺寸
                updateContainerSize() {
                    const mapEl = this.$el.querySelector('.map');
                    this.containerSize = {
                        width: mapEl.clientWidth,
                        height: mapEl.clientHeight
                    };
                },
                // 更新body尺寸
                updateBodySize() {
                    this.bodySize = getBodySize();
                },
                // 坐标转换函数
                convertToCSSPosition(svgX, svgY) {
                    const svgWidth = 1200;  // SVG 原始宽度
                    let svgWidthR = 0;  //
                    const svgHeight = 850; // SVG 原始高度
                    let svgHeightR = 0; //
                    if (svgX>svgWidth/2){
                        svgWidthR = (((svgX-svgWidth/2)/svgWidth) * this.containerSize.width) + this.bodySize.width/2 - this.bodySize.width*((1-0.52)/2);
                    } else {
                        svgWidthR = this.bodySize.width/2 - (((svgWidth/2 - svgX)/svgWidth) * this.containerSize.width)  - this.bodySize.width*((1-0.52)/2);
                    }
                    if (svgY>svgHeight/2){
                        svgHeightR = (((svgY-svgHeight/2)/svgHeight) * this.containerSize.height) + this.bodySize.height/2 - this.bodySize.height*((1-0.72)/2);
                    } else {
                        svgHeightR = this.bodySize.height/2 - (((svgHeight/2 - svgY)/svgHeight) * this.containerSize.height)  - this.bodySize.height*((1-0.72)/2);
                    }
                    return {
                        x: svgWidthR,
                        y: svgHeightR
                    };
                },
                handleZoom(e) {
                    const scaleDelta = e.deltaY > 0 ? 0.9 : 1.1;
                    const currentScale = this.scale || 1;
                    const newScale = Math.max(0.5, Math.min(2, currentScale * scaleDelta));
                    // 应用缩放
                    const svgEl = this.$el.querySelector('.container');
                    svgEl.style.transform = `scale(${newScale})`;
                    this.scale = newScale;
                },
                verifyPassword(callback) {
                    this.$prompt('请输入管理员密码: root', '验证', {
                        confirmButtonText: '确定',
@@ -877,7 +938,12 @@
                            that.energyGatheringRing = res.data
                        }
                    });
                }
                },
                // 处理窗口大小变化
                handleResize: _.debounce(function() {
                    this.updateContainerSize();
                    this.updateBodySize();
                }, 100)
            }
        })