Junjie
2023-03-27 8d7d4c402c57ac7a0d6826ce2e355ada4eded875
四向穿梭车页面数据显示、复位操作
7个文件已修改
291 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/ShuttleController.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/domain/vo/ShuttleMsgTableVo.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/domain/vo/ShuttleStateTableVo.java 125 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/enums/ShuttleTaskModeType.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/ShuttleThread.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/shuttle.html 67 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/ShuttleController.java
@@ -67,16 +67,27 @@
                continue;
            }
            vo.setTaskNo(shuttleProtocol.getTaskNo().intValue());  //  任务号
            if (!Cools.isEmpty(shuttleProtocol.getBusyStatus())) {
                vo.setStatus(shuttleProtocol.getBusyStatusType().desc); //  状态
            }
            vo.setBatteryPower(shuttleProtocol.getBatteryPower() + "%");
            vo.setSpeed(shuttleProtocol.getCurrentMoveServoSpeed());
            vo.setBusyStatus(shuttleProtocol.getBusyStatusType().desc); //四向穿梭车状态
            vo.setStatus(shuttleProtocol.getProtocolStatusType().desc);//当前任务状态
            vo.setCurrentCode(shuttleProtocol.getCurrentCode());//当前二维码
            vo.setBatteryTemp(shuttleProtocol.getBatteryTemp$() + "°");//电池温度
            vo.setBatteryPower(shuttleProtocol.getBatteryPower$() + "%");//电池电量
            vo.setPlcOutputStatusIO(shuttleProtocol.getPlcOutputStatusIO());//Plc输出状态IO
            vo.setPlcInputStatus(shuttleProtocol.getPlcInputStatus());//PLC输入状态
            vo.setCurrentOrBeforeCode(shuttleProtocol.getCurrentOrBeforeCode());//当前或者之前读到的二维码值
            vo.setCodeOffsetX(shuttleProtocol.getCodeOffsetX());//读到的二维码X方向偏移量
            vo.setCodeOffsetY(shuttleProtocol.getCodeOffsetY());//读到的二维码Y方向偏移量
            vo.setCurrentVoltage(shuttleProtocol.getCurrentVoltage());//当前的电压值
            vo.setCurrentAnalogValue(shuttleProtocol.getCurrentAnalogValue());//当前的模拟量值
            vo.setCurrentLiftServoSpeed(shuttleProtocol.getCurrentLiftServoSpeed());//当前的升降伺服速度
            vo.setCurrentMoveServoSpeed(shuttleProtocol.getCurrentMoveServoSpeed());//移动速度
            vo.setCurrentLiftServoLoad(shuttleProtocol.getCurrentLiftServoLoad());//当前的升降伺服负载率
            vo.setCurrentMoveServoLoad(shuttleProtocol.getCurrentMoveServoLoad());//当前的行走伺服负载率
            if (!Cools.isEmpty(shuttleProtocol.getErrorCode())) {
                vo.setAlarm1(String.valueOf(shuttleProtocol.getErrorCode()));
                vo.setErrorCode(shuttleProtocol.getErrorCode());//错误编号
            }
            if (!Cools.isEmpty(shuttleProtocol.getStatusErrorCode())) {
                vo.setAlarm2(String.valueOf(shuttleProtocol.getStatusErrorCode()));
                vo.setStatusErrorCode(shuttleProtocol.getStatusErrorCode());//错误信息码
            }
        }
        return R.ok().add(list);
@@ -102,18 +113,21 @@
                continue;
            }
            vo.setWorkNo(shuttleProtocol.getTaskNo().intValue());  //  任务号
            vo.setWorkNo(shuttleProtocol.getTaskNo().intValue());//任务号
            if (shuttleProtocol.getTaskNo() > 0) {
                WrkMast wrkMast = wrkMastService.selectById(shuttleProtocol.getTaskNo());
                if (wrkMast != null) {
                    //vo.setStatus(CrnStatusType.process(wrkMast.getIoType()).getDesc());   //  模式状态
                    vo.setSourceStaNo(wrkMast.getSourceStaNo$());    //  源站
                    vo.setStaNo(wrkMast.getStaNo$());   //  目标站
                    vo.setSourceLocNo(wrkMast.getSourceLocNo());    //  源库位
                    vo.setLocNo(wrkMast.getLocNo());    //  目标库位
                    vo.setSourceLocNo(wrkMast.getSourceLocNo());//源库位
                    vo.setDistLocNo(wrkMast.getLocNo());//目标库位
                }
            }
            vo.setSpeed(shuttleProtocol.getCurrentMoveServoSpeed());  // 速度
            if (shuttleProtocol.getProtocolStatusType() != null) {
                vo.setStatus(shuttleProtocol.getProtocolStatusType().desc);//状态
            }
            vo.setCurrentMoveServoSpeed(shuttleProtocol.getCurrentMoveServoSpeed());//当前的行走伺服速度
            vo.setCurrentMoveServoLoad(shuttleProtocol.getCurrentMoveServoLoad() + "%");//当前的行走伺服负载率
            vo.setCurrentLiftServoLoad(shuttleProtocol.getCurrentLiftServoLoad() + "%");//当前的升降伺服负载率
            vo.setCurrentLiftServoSpeed(shuttleProtocol.getCurrentLiftServoSpeed());//当前的升降伺服速度
            vo.setPakMk(shuttleProtocol.getPakMk()?"Y" : "N");    // 作业标记
        }
        return R.ok().add(list);
@@ -251,6 +265,10 @@
            return R.parse(BaseRes.PARAM);
        }
        if (Cools.isEmpty(param.getSourceLocNo(), param.getDistLocNo())) {
            return R.parse(BaseRes.PARAM);
        }
        for (ShuttleSlave shuttleSlave : slaveProperties.getShuttle()) {
            if (param.getShuttleNo().equals(shuttleSlave.getId())) {
                ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleSlave.getId());
src/main/java/com/zy/asrs/domain/vo/ShuttleMsgTableVo.java
@@ -14,31 +14,36 @@
    // 状态
    private String status = "-";
    // 源站
    private String sourceStaNo = "-";
    // 目标站
    private String staNo = "-";
    // 源库位
    private String sourceLocNo = "-";
    // 目标库位
    private String locNo = "-";
    // 异常
    private String error = "";
    // 原点
    private String origin = "";
    private String distLocNo = "-";
    // 命令
    private String command = "";
    // 速度
    private Short speed = 0;
    // 作业标记
    private String pakMk = "-";
    /**
     * 当前的升降伺服速度
     */
    private Short currentLiftServoSpeed;
    /**
     * 当前的行走伺服速度
     */
    private Short currentMoveServoSpeed;
    /**
     * 当前的升降伺服负载率
     */
    private String currentLiftServoLoad;
    /**
     * 当前的行走伺服负载率
     */
    private String currentMoveServoLoad;
}
src/main/java/com/zy/asrs/domain/vo/ShuttleStateTableVo.java
@@ -1,5 +1,7 @@
package com.zy.asrs.domain.vo;
import com.zy.core.enums.ShuttleErrorCodeType;
import com.zy.core.enums.ShuttleStatusType;
import lombok.Data;
@Data
@@ -11,34 +13,24 @@
    // 状态
    private String status = "-";
    // 有物
    private String loading = "-";
    //四向穿梭车忙装填
    private String busyStatus = "-";
    /**
     * 小车忙状态位枚举
     */
    private ShuttleStatusType busyStatusType;
    /**
     * 任务号
     */
    public Integer taskNo;
    // 正在执行任务
    private String execute;
    // 任务完成,等待WCS确认
    private String waiting;
    // 排
    private Short row;
    // 列
    private Short bay;
    // 层
    private Short lev;
    // 异常码1
    private String alarm1 = "-";
    // 异常码2
    private String alarm2 = "-";
    /**
     * 当前二维码
     * 0为空
     */
    private Short currentCode;
    /**
     * 电池电量
@@ -46,9 +38,79 @@
    public String batteryPower = "-";
    /**
     * 当前速度
     * 电池温度
     */
    public Short speed;
    public String batteryTemp = "-";
    /**
     * 错误编号
     */
    private Short errorCode;
    /**
     * Plc输出状态IO
     */
    private Short plcOutputStatusIO;
    /**
     * 错误信息码
     */
    private Short statusErrorCode;
    /**
     * 错误信息码枚举
     */
    private ShuttleErrorCodeType statusErrorCodeType;
    /**
     * PLC输入状态
     */
    private Short plcInputStatus;
    /**
     * 当前或者之前读到的二维码值
     */
    private Short currentOrBeforeCode;
    /**
     * 读到的二维码X方向偏移量
     */
    private Short codeOffsetX;
    /**
     * 读到的二维码Y方向偏移量
     */
    private Short codeOffsetY;
    /**
     * 当前的电压值
     */
    private Short currentVoltage;
    /**
     * 当前的模拟量值
     */
    private Short currentAnalogValue;
    /**
     * 当前的升降伺服速度
     */
    private Short currentLiftServoSpeed;
    /**
     * 当前的行走伺服速度
     */
    private Short currentMoveServoSpeed;
    /**
     * 当前的升降伺服负载率
     */
    private Short currentLiftServoLoad;
    /**
     * 当前的行走伺服负载率
     */
    private Short currentMoveServoLoad;
    /**
     * 充电状态
@@ -60,4 +122,19 @@
     */
    public String loca = "-";
    public String getStatusErrorCode$() {
        if(this.statusErrorCodeType == null) return null;
        return this.statusErrorCodeType.desc;
    }
    public void setStatusErrorCode(Short statusErrorCode) {
        this.statusErrorCode = statusErrorCode;
        this.statusErrorCodeType = ShuttleErrorCodeType.get(statusErrorCode.intValue());
    }
    public void setStatusErrorCode(ShuttleErrorCodeType type) {
        this.statusErrorCode = type.id.shortValue();
        this.statusErrorCodeType = type;
    }
}
src/main/java/com/zy/core/enums/ShuttleTaskModeType.java
@@ -11,6 +11,7 @@
    MOVE_RIGHT(6, "右移"),
    MOVE_TOP(7, "前移"),
    MOVE_BOTTOM(8, "后移"),
    RESET(9, "状态复位"),
    ;
    public Integer id;
src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java
@@ -233,10 +233,15 @@
    }
    //获取电池电量
    public Short getBatteryPower() {
    public Short getBatteryPower$() {
        return (short) (this.batteryPower * 0.1);
    }
    //获取电池温度
    public Short getBatteryTemp$() {
        return (short) (this.batteryTemp * 0.1);
    }
    /**
     * 设置小车状态
     */
src/main/java/com/zy/core/thread/ShuttleThread.java
@@ -372,6 +372,14 @@
                command.setRunDirection((short) (assignCommand.getTaskMode() - 4));
                command.setCommandEnd((short) 1);
                break;
            case 9://状态复位
                command.setCommandWord((short) 0);
                //设置四向穿梭车为空闲状态
                shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
                //任务号清零
                shuttleProtocol.setTaskNo((short) 0);
                break;
            default:
        }
        command.setCommandEnd((short) 1);
src/main/webapp/views/shuttle.html
@@ -33,19 +33,18 @@
                        <thead>
                            <tr>
                                <th>四向穿梭车</th>
                                <th>待定</th>
                                <th>状态</th>
                                <th>有物</th>
                                <th>在轨</th>
                                <th>任务状态</th>
                                <th>小车状态</th>
                                <th>当前二维码</th>
                                <th>电量</th>
                                <th>排</th>
                                <th>列</th>
                                <th>层</th>
                                <th>等待WCS确认</th>
                                <th>定位</th>
                                <th>充电状态</th>
                                <th>报警信息1</th>
                                <th>报警信息2</th>
                                <th>电池温度</th>
                                <th>错误编号</th>
                                <th>plc输出状态IO</th>
                                <th>当前或之前二维码</th>
                                <th>x偏移量</th>
                                <th>y偏移量</th>
                                <th>电压</th>
                                <th>模拟量</th>
                            </tr>
                        </thead>
                        <tbody>
@@ -61,11 +60,12 @@
                            <th>四向穿梭车</th>
                            <th>工作号</th>
                            <th>状态</th>
                            <th>源站</th>
                            <th>目标站</th>
                            <th>源库位</th>
                            <th>目标库位</th>
                            <th>速度</th>
                            <th>升降伺服速度</th>
                            <th>行走伺服速度</th>
                            <th>升降伺服负载</th>
                            <th>行走伺服负载</th>
                            <th>作业标记</th>
                        </tr>
                    </thead>
@@ -123,6 +123,7 @@
                            <button class="item" onclick="shuttleOperator(6)">右移</button>
                            <button class="item" onclick="shuttleOperator(7)">前移</button>
                            <button class="item" onclick="shuttleOperator(8)">后移</button>
                            <button class="item" onclick="shuttleOperator(9)">复位</button>
                        </div>
                    </fieldset>
                </div>
@@ -585,18 +586,17 @@
                        let tr = tableEl.find("tr").eq(i);
                        setVal(tr.children("td").eq(0), table[i-1].shuttleNo);
                        setVal(tr.children("td").eq(1), table[i-1].status);
                        setVal(tr.children("td").eq(2), table[i-1].status);
                        setVal(tr.children("td").eq(3), table[i-1].loading);
                        setVal(tr.children("td").eq(4), table[i-1].track);
                        setVal(tr.children("td").eq(5), table[i-1].batteryPower);
                        setVal(tr.children("td").eq(6), table[i-1].row);
                        setVal(tr.children("td").eq(7), table[i-1].bay);
                        setVal(tr.children("td").eq(8), table[i-1].lev);
                        setVal(tr.children("td").eq(9), table[i-1].waiting);
                        setVal(tr.children("td").eq(10), table[i-1].loca);
                        setVal(tr.children("td").eq(11), table[i-1].chargeStatus);
                        setVal(tr.children("td").eq(12), table[i-1].alarm1);
                        setVal(tr.children("td").eq(13), table[i-1].alarm2);
                        setVal(tr.children("td").eq(2), table[i-1].busyStatus);
                        setVal(tr.children("td").eq(3), table[i-1].currentCode);
                        setVal(tr.children("td").eq(4), table[i-1].batteryPower);
                        setVal(tr.children("td").eq(5), table[i-1].batteryTemp);
                        setVal(tr.children("td").eq(6), table[i-1].statusErrorCode$);
                        setVal(tr.children("td").eq(7), table[i-1].plcOutputStatusIO);
                        setVal(tr.children("td").eq(8), table[i-1].currentOrBeforeCode);
                        setVal(tr.children("td").eq(9), table[i-1].codeOffsetX);
                        setVal(tr.children("td").eq(10), table[i-1].codeOffsetY);
                        setVal(tr.children("td").eq(11), table[i-1].currentVoltage);
                        setVal(tr.children("td").eq(12), table[i-1].currentAnalogValue);
                    }
                } else if (res.code === 403){
                    window.location.href = baseUrl+"/login";
@@ -626,12 +626,13 @@
                        setVal(tr.children("td").eq(0), table[i-1].shuttleNo);
                        setVal(tr.children("td").eq(1), table[i-1].workNo);
                        setVal(tr.children("td").eq(2), table[i-1].status);
                        setVal(tr.children("td").eq(3), table[i-1].sourceStaNo);
                        setVal(tr.children("td").eq(4), table[i-1].staNo);
                        setVal(tr.children("td").eq(5), table[i-1].sourceLocNo);
                        setVal(tr.children("td").eq(6), table[i-1].locNo);
                        setVal(tr.children("td").eq(7), table[i-1].speed);
                        setVal(tr.children("td").eq(8), table[i-1].pakMk);
                        setVal(tr.children("td").eq(3), table[i-1].sourceLocNo);
                        setVal(tr.children("td").eq(4), table[i-1].distLocNo);
                        setVal(tr.children("td").eq(5), table[i-1].currentLiftServoSpeed);
                        setVal(tr.children("td").eq(6), table[i-1].currentMoveServoSpeed);
                        setVal(tr.children("td").eq(7), table[i-1].currentLiftServoLoad);
                        setVal(tr.children("td").eq(8), table[i-1].currentMoveServoLoad);
                        setVal(tr.children("td").eq(9), table[i-1].pakMk);
                    }
                } else if (res.code === 403){
                    window.location.href = baseUrl+"/login";