|  |  | 
 |  |  | package com.zy.core.model.protocol; | 
 |  |  |  | 
 |  |  | import com.zy.asrs.entity.BasRgv; | 
 |  |  | import com.zy.entity.BasRgv; | 
 |  |  | import com.zy.core.enums.RgvModeType; | 
 |  |  | import com.zy.core.enums.RgvStatusType; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | import java.util.HashMap; | 
 |  |  | import java.util.Map; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020/8/7 | 
 |  |  |  */ | 
 |  |  | @Data | 
 |  |  | public class RgvProtocol { | 
 |  |  | public class RgvProtocol implements Cloneable{ | 
 |  |  |  | 
 |  |  |     private Integer RgvNo; | 
 |  |  |  | 
 |  |  | 
 |  |  |     public Short walkPos; | 
 |  |  |  | 
 |  |  |     //////////////////////     工位2定义   ////////////////////////////////////////////////// | 
 |  |  |     /** | 
 |  |  |      * 工位2任务号 | 
 |  |  |      */ | 
 |  |  |     public Short taskNo2 = 0; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * RGV工位2当前状态 | 
 |  |  |      * 0:空闲,无任务 | 
 |  |  |      * 11:取货中 | 
 |  |  |      * 12:放货中 | 
 |  |  |      * 10:任务完成等待WCS确认 | 
 |  |  |      */ | 
 |  |  |     public Short status2; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 状态枚举 | 
 |  |  |      */ | 
 |  |  |     public RgvStatusType statusType2; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 工位2有物 | 
 |  |  |      */ | 
 |  |  |     public Short loaded2; | 
 |  |  | //    /** | 
 |  |  | //     * 工位2任务号 | 
 |  |  | //     */ | 
 |  |  | //    public Short taskNo2 = 0; | 
 |  |  | // | 
 |  |  | //    /** | 
 |  |  | //     * RGV工位2当前状态 | 
 |  |  | //     * 0:空闲,无任务 | 
 |  |  | //     * 11:取货中 | 
 |  |  | //     * 12:放货中 | 
 |  |  | //     * 10:任务完成等待WCS确认 | 
 |  |  | //     */ | 
 |  |  | //    public Short status2; | 
 |  |  | // | 
 |  |  | //    /** | 
 |  |  | //     * 状态枚举 | 
 |  |  | //     */ | 
 |  |  | //    public RgvStatusType statusType2; | 
 |  |  | // | 
 |  |  | //    /** | 
 |  |  | //     * 工位2有物 | 
 |  |  | //     */ | 
 |  |  | //    public Short loaded2; | 
 |  |  |     /////////////////////////////////////////////////////////////////////////////////////// | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  | 
 |  |  |         this.status1 = RgvStatusType.get(type1).id.shortValue(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setStatus2(Short status2){ | 
 |  |  |         this.status2 = status2; | 
 |  |  |         this.statusType2 = RgvStatusType.get(status2); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setStatus2(RgvStatusType type2){ | 
 |  |  |         this.statusType2 = type2; | 
 |  |  |         this.status2 = RgvStatusType.get(type2).id.shortValue(); | 
 |  |  |     } | 
 |  |  | //    public void setStatus2(Short status2){ | 
 |  |  | //        this.status2 = status2; | 
 |  |  | //        this.statusType2 = RgvStatusType.get(status2); | 
 |  |  | //    } | 
 |  |  | // | 
 |  |  | //    public void setStatus2(RgvStatusType type2){ | 
 |  |  | //        this.statusType2 = type2; | 
 |  |  | //        this.status2 = RgvStatusType.get(type2).id.shortValue(); | 
 |  |  | //    } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 最近一次入出库类型 | 
 |  |  | 
 |  |  |             basRgv.setRgvErr(alarm.longValue()); | 
 |  |  |         } | 
 |  |  |         basRgv.setWrkNo1(taskNo1.intValue()); | 
 |  |  |         basRgv.setWrkNo2(taskNo2.intValue()); | 
 |  |  | //        basRgv.setWrkNo2(taskNo2.intValue()); | 
 |  |  |         return basRgv; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |     public Integer getRgvPosI(){ | 
 |  |  |         //需要根据现场改造  根据读到的值获取对应站点位置 | 
 |  |  |         Map<Short,Integer> map = new HashMap<>(); | 
 |  |  |         map.put((short) 1,100);map.put((short) 2,101); | 
 |  |  |         map.put((short) 3,106);map.put((short) 4,107); | 
 |  |  |         map.put((short) 5,112);map.put((short) 6,113); | 
 |  |  |         map.put((short) 7,119);map.put((short) 8,124); | 
 |  |  |         map.put((short) 9,149);map.put((short) 10,153); | 
 |  |  |         map.put((short) 11,157);map.put((short) 12,161); | 
 |  |  |         if (RgvPos==null) return 0; | 
 |  |  |         return RgvPos.intValue(); | 
 |  |  |  | 
 |  |  |         return map.get(RgvPos); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public RgvProtocol clone() { | 
 |  |  |         try { | 
 |  |  |             return (RgvProtocol) super.clone(); | 
 |  |  |         } catch (CloneNotSupportedException e) { | 
 |  |  |             e.printStackTrace(); | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } |