package com.zy.core.model.protocol; import com.zy.core.enums.LiftProtocolStatusType; import com.zy.core.model.command.LiftAssignCommand; import lombok.Data; import lombok.extern.slf4j.Slf4j; import java.util.Date; /** * 提升机 */ @Slf4j @Data public class LiftProtocol { /** * 提升机号 */ private Short liftNo; /** * 提升机内部二维码 */ private Short barcode = 1699; /** * 任务号 */ private Short taskNo = 0; /** * 四向穿梭车号 */ private Short shuttleNo = 0; /** * 当前提升机状态(内部自我维护) */ private Integer protocolStatus = 1; /** * 当前提升机状态枚举 */ private LiftProtocolStatusType protocolStatusType = LiftProtocolStatusType.IDLE; /** * 层 */ private Short lev; /** * 提升机锁定 */ private Boolean liftLock; /** * 位置到达反馈 */ private Short positionArrivalFeedback; /** * 准备就绪 * 就绪为1,未就绪为0 */ private Boolean ready; /** * 运行中 * 运行中为1,未运行为0 */ private Boolean running; /** * 联机/单机 * 联机为1,单机为0 */ private Boolean mode; /** * 输送线前端光电有货 * 有货为1,无货为0(前端指靠近货架侧) */ private Boolean lineFrontHasStock; /** * 输送线正转反馈 * 正转运行为1,否则为0 */ private Boolean forwardRotationFeedback; /** * 输送线反转反馈 * 反转运行为1,否则为0 */ private Boolean reverseFeedback; /** * 输送线电机过载 * 过载为0,正常为1 */ private Boolean motorOverload; /** * 输送线末端光电有货 * 有货为1,无货为0 */ private Boolean lineEndHasStock; /** * 进输送线卡托盘报警 * 报警为1,未报警为0 */ private Boolean inConveyLineCardTrayAlarm; /** * 出输送线卡托盘报警 * 报警为1,未报警为0 */ private Boolean outConveyLineCardTrayAlarm; /** * 平台位置偏差报警 * 报警为1,未报警为0 */ private Boolean platPositionDeviationAlarm; /** * 平台扭矩偏差报警 * 报警为1,未报警为0 */ private Boolean platTorqueDeviationAlarm; /** * 平台四向车检测 * 有车为1,无车为0 */ private Boolean platShuttleCheck; /** * 未就绪状态 * 1. 不在指定层 * 2. 四轴不同步 * 3. 平台前限光电被挡到(靠近货架) * 4. 平台后限光电被挡到(远离货架) * 5. 平台上限位报警 * 6. 平台下限位报警 * 7. 电柜急停报警 * 8. 输送线前限位被挡到(靠近货架) * 9. 输送线后限位被挡到(远离货架) * 10. 触摸屏紧急停止被按下 * 11. 四轴动力线断线 * 12. 单机模式 * 13. 四轴报警 * 14. 位置偏差过大 * 15. 扭矩偏差过大 * 16. 输送线过载 * 17. 进提升机卡托盘 * 18. 出提升机卡托盘 */ private Short notReady; /** * 伺服1错误 */ private Short servoError1; /** * 伺服2错误 */ private Short servoError2; /** * 伺服3错误 */ private Short servoError3; /** * 伺服4错误 */ private Short servoError4; /** * 提升机实际速度反馈 */ private Short liftActualSpeed; /** * 作业标记 */ private Boolean pakMk = true; /** * 四向穿梭车调度提升机时,需要锁定此标记 */ private Boolean securityMk = false; /** * 任务命令 */ private LiftAssignCommand assignCommand; /** * 出入库模式,1:入库,2:出库 */ private Integer outInModel; /** * 出入库模式起始站点 */ private Integer startSta; /** * 出入库模式目标站点 */ private Integer distSta; /** * 出入库模式步数 */ private Integer outInModelStep; /** * 工作时间 */ private Date wrkTime; public Short getLiftLockShortValue() { return liftLock ? (short) 1 : (short) 0; } /** * 设置提升机状态 */ public void setProtocolStatus(Integer status) { this.protocolStatus = status; this.protocolStatusType = LiftProtocolStatusType.get(status); } /** * 设置提升机状态 */ public void setProtocolStatus(LiftProtocolStatusType status) { this.protocolStatus = status.id; this.protocolStatusType = status; } // 是否处于空闲待命状态 public Boolean isIdle() { if(this.taskNo == null || this.liftLock == null || this.ready == null || this.running == null || this.mode == null || this.pakMk == null ){ return false; } boolean res = this.taskNo == 0 && !this.liftLock // && this.ready && !this.running && this.mode && this.pakMk.equals(true) && !this.securityMk ; return res; } // 是否处于空闲待命状态,不判断任务号 public Boolean isIdleNoTask() { if(this.taskNo == null || this.liftLock == null || this.ready == null || this.running == null || this.mode == null || this.pakMk == null ){ return false; } boolean res = !this.liftLock // && this.ready && !this.running && this.mode && this.pakMk && !this.securityMk ; return res; } public void setPositionArrivalFeedback(Short position) { Short lev = null; switch (position) { case 1: lev = 1; break; case 4: lev = 2; break; case 8: lev = 3; break; case 16: lev = 4; break; } this.lev = lev;//层高 this.positionArrivalFeedback = position;//位置到达反馈 } public Integer getPositionArrivalFeedback$() { if (this.positionArrivalFeedback == null) { return null; } switch (this.positionArrivalFeedback) { case 1: return 1; case 2: return 2; case 4: return 3; case 8: return 4; case 16: return 5; } return null; } }