zjj
2024-05-24 92ac16fad20cbd4c0035501ef04605bdb960fc18
#提升机状态
7个文件已修改
1个文件已添加
193 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/ConsoleController.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/domain/vo/HoistDataVo.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/model/protocol/StaProtocol.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/SiemensDevpThread.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/wcs/css/render.css 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/wcs/js/console.js 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/wcs/js/console.map.js 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/realtimeWatch/console.html 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/ConsoleController.java
@@ -123,6 +123,28 @@
        return R.ok().add(vos);
    }
    @PostMapping("/latest/data/hoist")
    @ManagerAuth(memo = "提升机实时数据")
    public R hoistLatestData(){
        List<HoistDataVo> vos = new ArrayList<>();
        Map<Integer, StaProtocol> stations = new HashMap<>();
        for (DevpSlave devp : slaveProperties.getDevp()) {
            DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
            if (null != devpThread) {
                stations.putAll(devpThread.getStation());
            }
        }
        for (Map.Entry<Integer, StaProtocol> entry : stations.entrySet()) {
            HoistDataVo vo = new HoistDataVo();
            StaProtocol staProtocol = entry.getValue();
            vo.setHoistId(String.valueOf(entry.getKey()));
            vo.setPlace(staProtocol.getPlace());
            vos.add(vo);
        }
        return R.ok().add(vos);
    }
    @PostMapping("/latest/data/crn")
    @ManagerAuth(memo = "堆垛机实时数据")
    public R crnLatestData(){
src/main/java/com/zy/asrs/domain/vo/HoistDataVo.java
New file
@@ -0,0 +1,9 @@
package com.zy.asrs.domain.vo;
import lombok.Data;
@Data
public class HoistDataVo {
    private String hoistId;
    private String place;
}
src/main/java/com/zy/core/model/protocol/StaProtocol.java
@@ -68,6 +68,23 @@
    //条码
    private String barcode = null;
    private boolean place1 = false;
    private boolean place2 = false;
    public String getPlace(){
        if (place1 && place2){
            return "到位信号异常";
        }
        if (place1){
            return "一楼到位";
        }
        if (place2){
            return "二楼到位";
        }
            return "不在定位";
    }
    // 外形检测 ------------------------------------------------------------------------
    // 前超限
src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -71,6 +71,12 @@
        add(400);add(401);add(402);add(403);
        add(404);add(405);add(406);add(407);
    }};
    public static final ArrayList<Integer> hoist1 = new ArrayList<Integer>() {{
        add(302);add(303);
    }};
    public static final ArrayList<Integer> hoist2 = new ArrayList<Integer>() {{
        add(402);add(403);
    }};
    /**
     * 条码数量
@@ -97,6 +103,17 @@
                return staNos3;
            case 4:
                return staNos4;
            default:
                throw new CoolException("服务器异常");
        }
    }
    private ArrayList<Integer> getHoist() {
        switch (slave.getId()) {
            case 3:
                return hoist1;
            case 4:
                return hoist2;
            default:
                throw new CoolException("服务器异常");
        }
@@ -276,6 +293,35 @@
                }
            }
        }
        if (slave.getId() == 3 || slave.getId() == 4){
            ArrayList<Integer> hoist = getHoist();
            int hoistSize = hoist.size();
            OperateResultExOne<byte[]> resultHoist = siemensS7Net.Read("DB15.0", (short) 33);
            if (resultHoist.IsSuccess) {
                    Integer siteId = hoist.get(0); // 站点编号
                    StaProtocol staProtocol = station.get(siteId);
                    if (null == staProtocol) {
                        staProtocol = new StaProtocol();
                        staProtocol.setSiteId(siteId);
                        station.put(siteId, staProtocol);
                    }
                    boolean[] status = siemensS7Net.getByteTransform().TransBool(resultHoist.Content, 32, 1);
                    staProtocol.setPlace1(status[0]);
                    staProtocol.setPlace2(status[1]);
                Integer siteId2 = hoist.get(1); // 站点编号
                staProtocol = station.get(siteId2);
                if (null == staProtocol) {
                    staProtocol = new StaProtocol();
                    staProtocol.setSiteId(siteId);
                    station.put(siteId, staProtocol);
                }
                boolean[] status2 = siemensS7Net.getByteTransform().TransBool(resultHoist.Content, 32, 1);
                staProtocol.setPlace1(status2[2]);
                staProtocol.setPlace2(status2[3]);
            }
        }
        if (slave.getId() == 1){
src/main/webapp/static/wcs/css/render.css
@@ -562,6 +562,15 @@
    background-color: rgb(157, 217, 162);
    font-size: 10px;
}
.hoist {
    position: absolute;
    color: #a19c9c;
    border: 1px solid rgb(108,167,168);
    cursor: pointer;
    text-align: center;
    background-color: rgb(157, 217, 162);
    font-size: 10px;
}
.barcode1{
    position: absolute;
    width: 100px;
src/main/webapp/static/wcs/js/console.js
@@ -10,9 +10,11 @@
    tracks = '',
    stn = '',
    barcode = '',
    hoist = '',
    stns = '',
    stnArr = [],
    barcodeArr = [],
    hoistArr = [],
    floorBtn = '',
    floorBtns = '',
    floorBtnss = '',
@@ -127,6 +129,7 @@
        let stnss = areas[i].stns
        let barcodes = areas[i].barcode
        let hoists = areas[i].hoist
        let floor = areas[i].text
        floorId = areas[i].id
        var position = (i+1)*100
@@ -142,6 +145,7 @@
        var n = 1
        stnArr[index] = ''
        barcodeArr[index] = ''
        hoistArr[index] = ''
        total[index] = ''
        for (let j = 0; j < stnss.length; j++) {
            if (stnss[j].type == "stn") {
@@ -174,8 +178,17 @@
                "px;left: "+ barcodes[k].left + "px'>" + "</div>"
            barcodeArr[i] = barcodeArr[i] + barcode
        }
        for (let k = 0; k < hoists.length; k++) {
            hoist = "<div class='hoist' id='" + hoists[k].id +
                "'style='width:" + hoists[k].width +
                "px;height: " + hoists[k].height +
                "px;line-height: " + hoists[k].height +
                "px;top: "+ hoists[k].top +
                "px;left: "+ hoists[k].left + "px'>" + "</div>"
            hoistArr[i] = hoistArr[i] + hoist
        }
    }
    floorInfo = racks + rackDescs + tracks + crns + stnArr[0] + floorBtnss + barcodeArr[0]
    floorInfo = racks + rackDescs + tracks + crns + stnArr[0] + floorBtnss + barcodeArr[0]+hoistArr[0]
    $(".main-part").append(floorInfo)
    $("#line-total").html(total[0])
@@ -184,7 +197,7 @@
}
function changFloor(e) {
    $(".main-part").empty()  // 清空节点
    floorInfo = racks  + stnArr[e] +rackDescs + crns + tracks + floorBtnss + barcodeArr[e]
    floorInfo = racks  + stnArr[e] +rackDescs + crns + tracks + floorBtnss + barcodeArr[e]+hoistArr[e]
    $(".main-part").append(floorInfo)
    $("#line-total").empty()
    $("#line-total").html(total[e])
src/main/webapp/static/wcs/js/console.map.js
@@ -708,6 +708,44 @@
                    "width": 80,
                    "height": 20
                }
            ],
            "hoist": [
                {
                    "type": "hoist",
                    "id": "hoist-302",
                    "text": "",
                    "top": 640,
                    "left": 1500,
                    "width": 50,
                    "height": 20
                },
                {
                    "type": "hoist",
                    "id": "hoist-303",
                    "text": "",
                    "top": 595,
                    "left": 1500,
                    "width": 50,
                    "height": 20
                },
                {
                    "type": "hoist",
                    "id": "hoist-402",
                    "text": "",
                    "top": 480,
                    "left": 1500,
                    "width": 50,
                    "height": 20
                },
                {
                    "type": "hoist",
                    "id": "hoist-403",
                    "text": "",
                    "top": 527,
                    "left": 1500,
                    "width": 50,
                    "height": 20
                }
            ]
        }, {
            "type": "floor",
@@ -1114,6 +1152,18 @@
                    "height": 0
                }
            ],
            "hoist": [
                {
                    "type": "hoist",
                    "id": "hoist-999",
                    "text": "",
                    "top": 570,
                    "left": 1590,
                    "width": 80,
                    "height": 0
                }
            ]
        }]
    }]
src/main/webapp/views/realtimeWatch/console.html
@@ -503,6 +503,7 @@
    // 初始化
    getSitesInfo();
    getCrnInfo();
    getHoistInfo();
    getSystemRunningStatus();
    getBarcodeInfo();
    getScaleInfo();
@@ -515,6 +516,7 @@
    }, 1000);
    setInterval(function () {
        getSitesInfo();
        getHoistInfo();
    }, 3000);
    // 系统运行开关
@@ -664,6 +666,27 @@
    }
    // 扫码器实时数据获取
    function getHoistInfo() {
        $.ajax({
            url: baseUrl + "/console/latest/data/hoist",
            headers: {'token': localStorage.getItem('token')},
            method: 'POST',
            success: function (res) {
                if (res.code === 200) {
                    var hoists = res.data;
                    for (var i = 0; i < hoists.length; i++) {
                        $("#hoist-"+hoists[i].hoistId).html(hoists[i].place ? hoists[i].place : "--");
                    }
                } else if (res.code === 403) {
                    parent.location.href = baseUrl + "/login";
                } else {
                    console.log(res.msg);
                }
            }
        });
    }
    // 扫码器实时数据获取
    function getBarcodeInfo() {
        $.ajax({
            url: baseUrl + "/console/latest/data/barcode",