| | |
| | | package com.zy.core.model.protocol; |
| | | |
| | | import com.zy.asrs.entity.BasRgv; |
| | | import com.zy.asrs.entity.BasRgvErrorLog; |
| | | import com.zy.core.enums.RgvModeType; |
| | | import com.zy.core.enums.RgvStatusType; |
| | | import lombok.Data; |
| | |
| | | |
| | | private transient Long loadingStartTime; |
| | | |
| | | /** |
| | | * 执行优先级 |
| | | * 0:不判断 |
| | | * 1:工位1先执行 |
| | | * 2:工位2先执行 |
| | | */ |
| | | public Short wrkTaskPri; |
| | | |
| | | public Short wrkTaskMove1; |
| | | |
| | | public Short wrkTaskMove2; |
| | | |
| | | |
| | | /** |
| | | * RGV当前状态工位1 |
| | |
| | | * 工位1任务号 |
| | | */ |
| | | public Integer taskNo1 = 0; |
| | | /** |
| | | * 工位1目标站 |
| | | */ |
| | | public Integer staNo1 = 0; |
| | | |
| | | /** |
| | | * RGV工位1当前状态 |
| | |
| | | public Short walkPos; |
| | | |
| | | /** |
| | | * 急停 |
| | | * 急停触发 |
| | | */ |
| | | public Boolean err1; |
| | | |
| | | /** |
| | | * 有物无资料 |
| | | * |
| | | */ |
| | | public Boolean err2; |
| | | |
| | |
| | | */ |
| | | public Boolean err7; |
| | | |
| | | public Boolean err8; |
| | | public Boolean err9; |
| | | public Boolean err10; |
| | | public Boolean err11; |
| | | public Boolean err12; |
| | | |
| | | ////////////////////// 工位2定义 ////////////////////////////////////////////////// |
| | | /** |
| | | * 工位2任务号 |
| | | */ |
| | | public Integer taskNo2 = 0; |
| | | /** |
| | | * 工位1目标站 |
| | | */ |
| | | public Integer staNo2 = 0; |
| | | |
| | | /** |
| | | * RGV工位2当前状态 |
| | |
| | | |
| | | |
| | | /////////////////////////////////////////////////////////////////////////////////////// |
| | | //配置信号----------------------------------------------------------------------------- |
| | | // 故障读取锁定标记 |
| | | private boolean errorMk = false; |
| | | //写入标记 |
| | | private boolean writeMk = true; |
| | | private Boolean chainForward1 = false; // 链条前进 1 |
| | | private Boolean chainReverse1 = false; // 链条后退 1 |
| | | private Boolean inverterAlarm = false; // 变频器报警 |
| | | private Boolean leftOverlimit2 = false; // 左超限 2 |
| | | private Boolean rightOverlimit2 = false; // 右超限 2 |
| | | private Boolean leftAtPosition2 = false; // 左到位 2 |
| | | private Boolean rightAtPosition2 = false; // 右到位 2 |
| | | private Boolean cargoSpeedReduction = false; // 货物减速 |
| | | private Boolean conveyorInverterAlarm2 = false; // 输送变频器报警 2 |
| | | |
| | | private Boolean emergencyStop = false; // 急停触发 |
| | | private Boolean slot1EmptyNoData = false; // 1号位有物无资料 |
| | | private Boolean slot2EmptyNoData = false; // 2号位有物无资料 |
| | | private Boolean commandErrorChainConflict = false; // 命令错误走链条冲突 |
| | | private Boolean targetPositionIssue = false; // 目标位下发错误 |
| | | private Boolean travelInverterError = false; // 走行变频器异常 |
| | | private Boolean photoelectric1Error = false; // 1号光电异常 |
| | | private Boolean photoelectric2Error = false; // 2号光电异常 |
| | | private Boolean timeoutConnectionWithLine = false; // 与输线时接超时 |
| | | private Boolean leftRollerTimeout = false; // 左侧滚筒运行超时 |
| | | private Boolean rightRollerTimeout = false; // 右侧滚筒运行超时 |
| | | private Boolean rgvRunTimeout = false; // rgv运行超时 |
| | | private Boolean position1ChainInverterError = false; // 1号工位链条变频器异常 |
| | | private Boolean position2ChainInverterError = false; // 2号工位链条变频器异常 |
| | | private Boolean frontRearLimit = false; // 前后极限位 |
| | | private Boolean emergencyButton = false; // 急停按钮 |
| | | private Boolean forwardButton = false; // 前进按钮 |
| | | private Boolean reverseButton = false; // 后退按钮 |
| | | private Boolean localRemote = false; // 本地/远程 |
| | | private Boolean reset = false; // 复位 |
| | | private Boolean travelBrakeSwitch = false; // 走行抱闸开关钮 |
| | | private Boolean travelSpeedLimitPhotoelectric = false; // 走行强制减速光电 |
| | | private Boolean leftOverlimit1 = false; // 左超限 1 |
| | | private Boolean rightOverlimit1 = false; // 右超限 1 |
| | | private Boolean leftAtPosition1 = false; // 左到位 1 |
| | | private Boolean rightAtPosition1 = false; // 右到位 1 |
| | | |
| | | private Boolean rightConveyor2 = false; // 右输送 2 |
| | | private Boolean leftConveyor2 = false; // 左输送 2 |
| | | //--------------------------------------------------------------------- |
| | | /** |
| | | * 异常码 |
| | | */ |
| | |
| | | * 堆垛机累计走行时长h |
| | | */ |
| | | public Float xDuration; |
| | | |
| | | |
| | | public BasRgvErrorLog toSqlModelError(){ |
| | | BasRgvErrorLog basRgvErrorLog = new BasRgvErrorLog(); |
| | | basRgvErrorLog.setRgvNo((int) RgvNo);// 设备号(假设有定义 siteId) |
| | | basRgvErrorLog.setChainForward1(chainForward1 ? "Y" : "N"); // 链条前进 1 |
| | | basRgvErrorLog.setChainReverse1(chainReverse1 ? "Y" : "N"); // 链条后退 1 |
| | | basRgvErrorLog.setInverterAlarm(inverterAlarm ? "Y" : "N"); // 变频器报警 |
| | | basRgvErrorLog.setLeftOverlimit2(leftOverlimit2 ? "Y" : "N"); // 左超限 2 |
| | | basRgvErrorLog.setRightOverlimit2(rightOverlimit2 ? "Y" : "N"); // 右超限 2 |
| | | basRgvErrorLog.setLeftAtPosition2(leftAtPosition2 ? "Y" : "N"); // 左到位 2 |
| | | basRgvErrorLog.setRightAtPosition2(rightAtPosition2 ? "Y" : "N"); // 右到位 2 |
| | | basRgvErrorLog.setCargoSpeedReduction(cargoSpeedReduction ? "Y" : "N"); // 货物减速 |
| | | basRgvErrorLog.setConveyorInverterAlarm2(conveyorInverterAlarm2 ? "Y" : "N"); // 输送变频器报警 2 |
| | | basRgvErrorLog.setEmergencyStop(emergencyStop ? "Y" : "N"); // 急停触发 |
| | | basRgvErrorLog.setSlot1EmptyNoData(slot1EmptyNoData ? "Y" : "N"); // 1号位有物无资料 |
| | | basRgvErrorLog.setSlot2EmptyNoData(slot2EmptyNoData ? "Y" : "N"); // 2号位有物无资料 |
| | | basRgvErrorLog.setCommandErrorChainConflict(commandErrorChainConflict ? "Y" : "N"); // 命令错误走链条冲突 |
| | | basRgvErrorLog.setTargetPositionIssue(targetPositionIssue ? "Y" : "N"); // 目标位下发错误 |
| | | basRgvErrorLog.setTravelInverterError(travelInverterError ? "Y" : "N"); // 走行变频器异常 |
| | | basRgvErrorLog.setPhotoelectric1Error(photoelectric1Error ? "Y" : "N"); // 1号光电异常 |
| | | basRgvErrorLog.setPhotoelectric2Error(photoelectric2Error ? "Y" : "N"); // 2号光电异常 |
| | | basRgvErrorLog.setTimeoutConnectionWithLine(timeoutConnectionWithLine ? "Y" : "N"); // 与输线时接超时 |
| | | basRgvErrorLog.setLeftRollerTimeout(leftRollerTimeout ? "Y" : "N"); // 左侧滚筒运行超时 |
| | | basRgvErrorLog.setRightRollerTimeout(rightRollerTimeout ? "Y" : "N"); // 右侧滚筒运行超时 |
| | | basRgvErrorLog.setRgvRunTimeout(rgvRunTimeout ? "Y" : "N"); // rgv运行超时 |
| | | basRgvErrorLog.setPosition1ChainInverterError(position1ChainInverterError ? "Y" : "N"); // 1号工位链条变频器异常 |
| | | basRgvErrorLog.setPosition2ChainInverterError(position2ChainInverterError ? "Y" : "N"); // 2号工位链条变频器异常 |
| | | basRgvErrorLog.setFrontRearLimit(frontRearLimit ? "Y" : "N"); // 前后极限位 |
| | | basRgvErrorLog.setEmergencyButton(emergencyButton ? "Y" : "N"); // 急停按钮 |
| | | basRgvErrorLog.setForwardButton(forwardButton ? "Y" : "N"); // 前进按钮 |
| | | basRgvErrorLog.setReverseButton(reverseButton ? "Y" : "N"); // 后退按钮 |
| | | basRgvErrorLog.setLocalRemote(localRemote ? "Y" : "N"); // 本地/远程 |
| | | basRgvErrorLog.setReset(reset ? "Y" : "N"); // 复位 |
| | | basRgvErrorLog.setTravelBrakeSwitch(travelBrakeSwitch ? "Y" : "N"); // 走行抱闸开关钮 |
| | | basRgvErrorLog.setTravelSpeedLimitPhotoelectric(travelSpeedLimitPhotoelectric ? "Y" : "N"); // 走行强制减速光电 |
| | | basRgvErrorLog.setLeftOverlimit1(leftOverlimit1 ? "Y" : "N"); // 左超限 1 |
| | | basRgvErrorLog.setRightOverlimit1(rightOverlimit1 ? "Y" : "N"); // 右超限 1 |
| | | basRgvErrorLog.setLeftAtPosition1(leftAtPosition1 ? "Y" : "N"); // 左到位 1 |
| | | basRgvErrorLog.setRightAtPosition1(rightAtPosition1 ? "Y" : "N"); // 右到位 1 |
| | | basRgvErrorLog.setRightConveyor2(rightConveyor2 ? "Y" : "N"); // 右输送 2 |
| | | basRgvErrorLog.setLeftConveyor2(leftConveyor2 ? "Y" : "N"); // 左输送 2 |
| | | |
| | | return basRgvErrorLog; |
| | | } |
| | | |
| | | public void setMode(Short mode) { |
| | | this.mode = mode; |
| | |
| | | return map.get(RgvPos); |
| | | } |
| | | |
| | | public Integer getRgvPosI2() { |
| | | // key: 站点号 value: 基准物理位置 |
| | | Map<Integer, Integer> posMap = new HashMap<>(); |
| | | posMap.put(1004, 6534); |
| | | posMap.put(1007, 33634); |
| | | posMap.put(1010, 75174); |
| | | posMap.put(1014, 102124); |
| | | posMap.put(1018, 138224); |
| | | posMap.put(1021, 178034); |
| | | posMap.put(1024, 219684); |
| | | posMap.put(1028, 246724); |
| | | posMap.put(1031, 288194); |
| | | posMap.put(2003, 314954); |
| | | posMap.put(2006, 288094); |
| | | posMap.put(2009, 246574); |
| | | posMap.put(2012, 219584); |
| | | posMap.put(2015, 177934); |
| | | posMap.put(2018, 138126); |
| | | posMap.put(2021, 102124); |
| | | posMap.put(2024, 75174); |
| | | posMap.put(2027, 33748); |
| | | posMap.put(2030, 6449); |
| | | |
| | | |
| | | int tolerance = 200; // 允许误差范围 |
| | | |
| | | for (Map.Entry<Integer, Integer> entry : posMap.entrySet()) { |
| | | int site = entry.getKey(); |
| | | int basePos = entry.getValue(); |
| | | if (Math.abs(RgvPos - basePos) <= tolerance) { |
| | | return site; |
| | | } |
| | | } |
| | | |
| | | return 0; // 没匹配到站点 |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public RgvProtocol clone() { |
| | | try { |