|  |  | 
 |  |  | package com.zy.asrs.wcs.rcs.model.protocol; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.zy.asrs.framework.common.Cools; | 
 |  |  | import com.zy.asrs.framework.common.SpringUtils; | 
 |  |  | import com.zy.asrs.wcs.core.utils.RedisUtil; | 
 |  |  | import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant; | 
 |  |  | import com.zy.asrs.wcs.rcs.entity.BasLiftErr; | 
 |  |  | import com.zy.asrs.wcs.rcs.entity.Device; | 
 |  |  | import com.zy.asrs.wcs.rcs.model.enums.LiftProtocolStatusType; | 
 |  |  | import com.zy.asrs.wcs.rcs.service.BasLiftErrService; | 
 |  |  | import lombok.Data; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  |  | 
 |  |  | @Slf4j | 
 |  |  | @Data | 
 |  |  | public class LiftProtocol { | 
 |  |  | public class LiftProtocol implements Cloneable { | 
 |  |  |  | 
 |  |  |     //**********************必须存在属性********************** | 
 |  |  |     /** | 
 |  |  | 
 |  |  |     /** | 
 |  |  |      * 作业标记 | 
 |  |  |      */ | 
 |  |  |     private Boolean pakMk = false; | 
 |  |  |     private Boolean pakMk = true; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 指令下发时间 | 
 |  |  |      */ | 
 |  |  |     private Long sendTime = 0L; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 日志采集时间 | 
 |  |  | 
 |  |  |      * 设备信息 | 
 |  |  |      */ | 
 |  |  |     private Device device; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 扩展字段 | 
 |  |  |      */ | 
 |  |  |     private Object extend; | 
 |  |  |  | 
 |  |  |     public String getRun$() { | 
 |  |  |         if (this.run == null) { | 
 |  |  |             return "未知"; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return this.run ? "运行中" : "空闲"; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getReady$() { | 
 |  |  |         if (this.ready == null) { | 
 |  |  |             return "未知"; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return this.ready ? "就绪" : "未就绪"; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getModel$() { | 
 |  |  |         if (this.model == null) { | 
 |  |  |             return "未知"; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return this.model ? "自动" : "手动"; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 设置提升机状态 | 
 |  |  | 
 |  |  |         this.protocolStatusType = status; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setTaskNo(Integer taskNo) { | 
 |  |  |     public synchronized void setTaskNo(Integer taskNo) { | 
 |  |  |         RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); | 
 |  |  |         if (null != redisUtil) { | 
 |  |  |             redisUtil.set(DeviceRedisConstant.LIFT_FLAG + this.liftNo, taskNo); | 
 |  |  | 
 |  |  |         return this.taskNo == null ? 0 : this.taskNo; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getErrorCode$() { | 
 |  |  |         if (this.errorCode == null) { | 
 |  |  |             return ""; | 
 |  |  |         } | 
 |  |  |         BasLiftErrService basLiftErrService = SpringUtils.getBean(BasLiftErrService.class); | 
 |  |  |         BasLiftErr liftErr = basLiftErrService.getOne(new LambdaQueryWrapper<BasLiftErr>() | 
 |  |  |                 .eq(BasLiftErr::getErrorCode, this.errorCode) | 
 |  |  |                 .eq(BasLiftErr::getHostId, this.device.getHostId()) | 
 |  |  |                 .eq(BasLiftErr::getDevicePlc, this.device.getDevicePlc())); | 
 |  |  |         if (liftErr != null) { | 
 |  |  |             return this.errorCode + "-" + liftErr.getErrName(); | 
 |  |  |         } | 
 |  |  |         return errorCode; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public LiftProtocol clone() { | 
 |  |  |         try { | 
 |  |  |             return (LiftProtocol) super.clone(); | 
 |  |  |         } catch (CloneNotSupportedException e) { | 
 |  |  |             e.printStackTrace(); | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } |