#
lsh
2024-09-14 204d411e545412dc65545b1b9149479a6d07672a
#
3个文件已修改
1个文件已添加
101 ■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/RgvController.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/utils/NumUtils.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/utils/Utils.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/index.html 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/RgvController.java
@@ -13,6 +13,7 @@
import com.zy.asrs.service.BasRgvService;
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.service.impl.MainServiceImpl;
import com.zy.asrs.utils.NumUtils;
import com.zy.asrs.utils.Utils;
import com.zy.core.cache.MessageQueue;
import com.zy.core.cache.OutputQueue;
@@ -345,7 +346,7 @@
    public R ringThroughRgv(){
        List<RingThroughParam> result = new ArrayList<>();
//        for (RgvSlave rgv : slaveProperties.getRgv()) {
        for (int i = 1;i<10;i++) {
        for (int i = 1;i<2;i++) {
//            // 获取RGV信息
//            RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgv.getId());
//            if (rgvThread == null) {
@@ -359,9 +360,11 @@
//            ringThroughParam.setIndex(rgv.getId());
            ringThroughParam.setIndex(i);
            double[] doubles = Utils.RingThroughXY2(183.0, 100.0*i);
            ringThroughParam.setValueX(doubles[0]);
            ringThroughParam.setValueY(doubles[1]);
            double[] doubles = Utils.RingThroughXY2(183.0, NumUtils.GetRandomIntInRange(183));
//            double[] doubles = Utils.RingThroughXY2(183.0, 100*i );
            ringThroughParam.setValueX(doubles[0]-2.94);
            ringThroughParam.setValueY(doubles[1]-2.94);
            result.add(ringThroughParam);
        }
        return R.ok().add(result);
@@ -386,9 +389,9 @@
//            ringThroughParam.setIndex(rgv.getId());
            ringThroughParam.setIndex(i);
            double[] doubles = Utils.RingThroughXY2(183.0, 100.0*i);
            ringThroughParam.setValueX(doubles[0]);
            ringThroughParam.setValueY(doubles[1]);
            double[] doubles = Utils.RingThroughXY2(183.0, 100*i );
            ringThroughParam.setValueX(doubles[0]+2.94);
            ringThroughParam.setValueY(doubles[1]+2.94);
            result.add(ringThroughParam);
        }
        return R.ok().add(result);
src/main/java/com/zy/asrs/utils/NumUtils.java
New file
@@ -0,0 +1,61 @@
package com.zy.asrs.utils;
import java.util.Random;
public class NumUtils {
//    public static void main(String[] args) {
//
//
//
//        int randomInt = ;
//        System.out.println("随机整数: " + randomInt);
//
//
//        int randomIntInRange = ; // 0 到 99
//        System.out.println("0 到 99 之间的随机整数: " + randomIntInRange);
//
//
//        double randomDouble = random.nextDouble();
//        System.out.println("0 到 1 之间的随机浮点数: " + randomDouble);
//    }
    public static void main(String[] args) {
        // 获取一个 0 到 1 之间的随机浮点数
        double randomDouble = Math.random();
        System.out.println("0 到 1 之间的随机浮点数: " + randomDouble);
        // 获取一个指定范围内的随机整数,例如 [0, 100) 的随机数
        int randomIntInRange = (int) (Math.random() * 100); // 0 到 99
        System.out.println("0 到 99 之间的随机整数: " + randomIntInRange);
    }
    public static double GetRandomDouble(){
        // 获取一个 0 到 1 之间的随机浮点数
        return Math.random();
    }
    public static double GetRandomIntInRange(){
        // 获取一个指定范围内的随机整数,例如 [0, 100) 的随机数
        return (int) (Math.random() * 100);
    }
    public static double GetRandomInt(){
        Random random = new Random();
        // 获取一个随机整数
        return random.nextInt();
    }
    public static double GetRandomIntInRange(Integer integer){
        Random random = new Random();
        // 获取一个指定范围内的随机整数,例如 [0, 100) 的随机数
        return random.nextInt(integer);
    }
//
//    public static double GetRandomDouble(){
//        Random random = new Random();
//        // 获取一个 0 到 1 之间的随机浮点数
//        return random.nextDouble();
//    }
}
src/main/java/com/zy/asrs/utils/Utils.java
@@ -91,13 +91,13 @@
        double l = b / a;
        // 圆的已知参数
        double radius = 48; // 半径为48
        double radius = 47.52; // 半径为48
//        double circumference = ; // 计算圆周长
        double arcLength = 2 * Math.PI * radius * l; // 给出的弧长
        // 圆心坐标
        double centerX = 52.5;
        double centerY = 47.5;
        double centerX = 50;
        double centerY = 50;
        // 求弧度
        double theta = arcLength / radius;
src/main/webapp/views/index.html
@@ -63,8 +63,13 @@
            line-height: 24px;
            font-weight: bold;
            transition: transform 0.3s ease;
            background-color: #FF5722;
            transform: scale(1.2);
        }
        .bus {
            background-color: #2196F3;
            border: 20px solid;
            border-color: #2196F3;
            position: absolute;
            width: 24px;
            height: 24px;
@@ -73,14 +78,6 @@
            line-height: 24px;
            font-weight: bold;
            transition: transform 0.3s ease;
        }
        .station {
            background-color: #FF5722;
            transform: scale(1.2);
        }
        .bus {
            background-color: #2196F3;
            border: 20px solid #ffffff;
        }
        .station:hover, .bus:hover {
            transform: scale(1.4);
@@ -104,13 +101,13 @@
<!--        <div class="station" style="top: 30%; left: 0;">6</div>-->
        <!-- Stations on inner ring -->
<!--        <div class="station" style="top: 5%; left: 50%;">7</div>-->
        <div class="station" style="top: 0%; left: 0%;">500</div>
<!--        <div class="station" style="top: 25%; left: 80%;">8</div>-->
<!--        <div class="station" style="top: 75%; left: 80%;">9</div>-->
<!--        <div class="station" style="top: 95%; left: 50%;">10</div>-->
<!--        <div class="station" style="top: 75%; left: 20%;">11</div>-->
<!--        <div class="station" style="top: 25%; left: 20%;">12</div>-->
        <div v-for="station in tableDataDev" class="station" :style="{ top: station.valueX + '%', left: station.valueY + '%' }">{{ station.index }}</div>
<!--        <div v-for="station in tableDataDev" class="station" :style="{ top: station.valueX + '%', left: station.valueY + '%' }">{{ station.index }}</div>-->
        <!-- Buses -->