Junjie
2023-12-20 ca6062762cf95a074635626ce185d2fd14512e76
#提升机异常码
3个文件已修改
29 ■■■■■ 已修改文件
src/main/java/com/zy/core/model/protocol/LiftProtocol.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/LiftThread.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/lift.html 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/model/protocol/LiftProtocol.java
@@ -1,5 +1,8 @@
package com.zy.core.model.protocol;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.BasLiftErr;
import com.zy.asrs.service.BasLiftErrService;
import com.zy.core.enums.LiftProtocolStatusType;
import com.zy.core.model.command.LiftAssignCommand;
import lombok.Data;
@@ -91,6 +94,11 @@
     * 设备故障
     */
    private Boolean deviceError;
    /**
     * 故障码
     */
    private Short errorCode;
    /**
     * 任务地址
@@ -214,5 +222,17 @@
        return res;
    }
    public String getErrCode$() {
        if (this.errorCode == null) {
            return "";
        }
        BasLiftErrService basLiftErrService = SpringUtils.getBean(BasLiftErrService.class);
        BasLiftErr basLiftErr = basLiftErrService.selectById(this.errorCode);
        if (basLiftErr == null) {
            return String.valueOf(this.errorCode);
        }
        return basLiftErr.getErrName();
    }
}
src/main/java/com/zy/core/thread/LiftThread.java
@@ -272,6 +272,13 @@
                }
            }
            Thread.sleep(100);
            //获取提升机异常数据
            OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB82.22.0", (short) 2);
            if (result3.IsSuccess) {
                liftProtocol.setErrorCode(siemensS7Net.getByteTransform().TransInt16(result3.Content, 0));//错误码
            }
        } catch (Exception e) {
            OutputQueue.LIFT.offer(MessageFormat.format("【{0}】提升机plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
        }
src/main/webapp/views/lift.html
@@ -40,6 +40,7 @@
                        <th>右超限</th>
                        <th>超高</th>
                        <th>超重</th>
                        <th>异常信息</th>
                    </tr>
                    </thead>
                    <tbody>
@@ -286,6 +287,7 @@
                        setVal(tr.children("td").eq(11), table[i-1].rightOverrun$);
                        setVal(tr.children("td").eq(12), table[i-1].overHeight$);
                        setVal(tr.children("td").eq(13), table[i-1].overWeight$);
                        setVal(tr.children("td").eq(14), table[i-1].errCode$);
                    }
                } else if (res.code === 403){
                    window.location.href = baseUrl+"/login";