package com.zy.core.model.protocol;
|
|
import com.zy.asrs.entity.BasJar;
|
import com.zy.core.enums.CrnModeType;
|
import com.zy.core.enums.JarModeType;
|
import com.zy.core.enums.JarStatusType;
|
import lombok.Data;
|
import lombok.extern.slf4j.Slf4j;
|
|
import java.util.Date;
|
|
/**
|
* Created by vincent on 2024/6/21
|
*/
|
@Slf4j
|
@Data
|
public class JarProtocol {
|
|
/**
|
* 设备号
|
*/
|
private Integer jarNo;
|
|
/**
|
* 1 = 联机模式
|
* 0 = 脱机模式
|
*/
|
public Integer mode;
|
|
public JarModeType modeType;
|
|
|
/**
|
IDLE(0, "空闲"),
|
MOVING(1, "入料中"),
|
SOS(2, "硫化中"),
|
WAITING1(3, "出料中"),
|
WAITING2(4, "停止"),
|
WAITING3(5, "进料门打开中"),
|
WAITING4(6, "出料门打开中"),
|
WAITING5(7, "进料门关闭中"),
|
OFF_LINE(8, "出料门关闭中"),
|
OTHER(100, "其它"),
|
*/
|
public Short status;
|
|
public JarStatusType statusType;
|
|
/*
|
* 左门状态
|
* 进料门
|
* */
|
private boolean leftDoor;
|
|
/*
|
* 右门状态
|
* 出料门
|
* */
|
private boolean rightDoor;
|
|
/*
|
* 左门可开
|
* 进料门
|
* */
|
private boolean leftInEnable;
|
|
/*
|
* 左门可关
|
* 进料门
|
* */
|
private boolean leftOutEnable;
|
|
/*
|
* 右门可开
|
* 出料门
|
* */
|
private boolean rightInEnable;
|
|
/*
|
* 右门可关
|
* 出料门
|
* */
|
private boolean rightOutEnable;
|
|
/*
|
* 自动
|
* */
|
private boolean autoing;
|
|
/*
|
* open the left door
|
* 进料门
|
* */
|
public Integer leftDoorOpen;
|
|
/*
|
* close the left door
|
* 进料门
|
* */
|
public Integer leftDoorClose;
|
|
/*
|
* open the right door
|
* 出料门
|
* */
|
public Integer rightDoorOpen;
|
|
/*
|
* close the right door
|
* 出料门
|
* */
|
public Integer rightDoorClose;
|
|
public Float jarTemperature;
|
public Float jarPressure;
|
public boolean holdingSign = false;
|
public boolean openDoorSign = false;
|
public boolean closeDoorSign = false;
|
public Short upStatus = 0;
|
|
|
|
/**
|
* 异常码
|
*/
|
public Integer jarErr = 0;
|
|
public void setStatus(Short status){
|
this.status = status;
|
this.statusType = JarStatusType.get(status);
|
}
|
|
public void setStatus(JarStatusType type){
|
this.statusType = type;
|
this.status = JarStatusType.get(type).id.shortValue();
|
}
|
|
public void setMode(Integer mode) {
|
this.mode = mode;
|
this.modeType = JarModeType.get(mode);
|
}
|
|
public void setMode(JarModeType type) {
|
this.modeType = type;
|
this.mode = JarModeType.get(type).id;
|
}
|
|
public BasJar toSqlModel(BasJar basJar){
|
if (jarErr!=null) {
|
basJar.setJarErr(jarErr);
|
}
|
basJar.setJarMode(mode);
|
basJar.setJarStatus(status.intValue());
|
basJar.setLeftDoor(leftDoor?"Y":"N");
|
basJar.setRightDoor(rightDoor?"Y":"N");
|
basJar.setLeftInEnable(leftInEnable?"Y":"N");
|
basJar.setLeftOutEnable(leftOutEnable?"Y":"N");
|
basJar.setRightInEnable(rightInEnable?"Y":"N");
|
basJar.setRightOutEnable(rightOutEnable?"Y":"N");
|
basJar.setAutoing(autoing?"Y":"N");
|
basJar.setJarTemperature(jarTemperature);
|
basJar.setJarPressure(jarPressure);
|
if (holdingSign){
|
basJar.setHoldingTime(new Date());
|
}
|
if (openDoorSign){
|
basJar.setOpenTime(new Date());
|
}
|
if (closeDoorSign){
|
basJar.setCloseTime(new Date());
|
}
|
|
return basJar;
|
}
|
|
}
|