package com.zy.common.model.agv; import com.alibaba.fastjson.annotation.JSONField; import com.core.common.Cools; import com.zy.asrs.entity.BasAgv; import com.zy.common.model.enums.AgvStatusType; import lombok.Data; import java.io.Serializable; import java.util.Date; /** * Created by vincent on 2021/5/19 */ @Data public class AgvInfo implements Cloneable, Serializable { private static final long serialVersionUID = 1L; // 小车编号 private Integer Id; // 是否启用(true:启用,false:禁用) private Boolean IsUse; // 当前位置点位 private String CurrentNode; // 当前电量 private String Power; // 一般状态(01:前往取货点,02:取货点取货,03:前往送货点,04:送货点放货,05:任务完成,06:空闲,07:故障,08:充电中,09:手动,10:失联,11:离线,12:行走) private String Status; @JSONField(serialize = false) private transient AgvStatusType agvStatus; // 故障码 private String Fault; // 任务号 private String taskcode; // 任务点 private String Point_Number; // 任务类型(1:行走,2:取货,3:放货,4:充电) private String ActionType; @Override public AgvInfo clone() { try { return (AgvInfo) super.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } return null; } public BasAgv toSqlModel(){ BasAgv basAgv = new BasAgv(); basAgv.setAgvId(this.getId()); basAgv.setIsUser(this.getIsUse()?1:0); basAgv.setCurrentNode(this.getCurrentNode()); basAgv.setPower(this.getPower()); basAgv.setStatus(Cools.isEmpty(this.getAgvStatus())?0:Integer.parseInt(this.getAgvStatus().id)); basAgv.setFault(this.getFault()); basAgv.setTaskCode(this.getTaskcode()); basAgv.setEndLoc(this.getPoint_Number()); basAgv.setAction(Cools.isEmpty(this.getActionType())?0:Integer.parseInt(this.getActionType())); basAgv.setModiTime(new Date()); return basAgv; } }