设备自动报警

yun-zuoyi
wynne1005 5 years ago
parent 814d22fe09
commit c117515b69

@ -5598,4 +5598,124 @@ public class MesPcnEnumUtil {
return tmp;
}
}
/**
*
*/
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum EQU_AUTO_ALARM_TYPE {
NORMAL(10, "正常"),
RUNNING(20, "正在运行"),
ERROR(30, "发生异常");
private String description;
private Integer value;
EQU_AUTO_ALARM_TYPE(Integer value, String description) {
this.value = value;
this.description = description;
}
public Integer getValue() {
return value;
}
public String getDescription() {
return description;
}
public static String valueOfDescription(String val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value.equals(val)) {
tmp = values()[i].description;
}
}
return tmp;
}
public static Integer descriptionOfValue(String description) {
Integer tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].description.equals(description)) {
tmp = values()[i].value;
}
}
return tmp;
}
}
/**
*
*/
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum LINE_OPERATION_TYPE {
DB(10, "数据库"),
PLC(20, "PLC");
private int value;
private String description;
LINE_OPERATION_TYPE(int value, String description) {
this.value = value;
this.description = description;
}
public int getValue() {
return value;
}
public String getDescription() {
return description;
}
public static String valueOfDescription(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) {
tmp = values()[i].description;
}
}
return tmp;
}
}
/**
* 线
*/
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum WORK_CENTER_MONITOR_BUSI_TYPE {
EQU_ALARM(10, "设备自动报警");
private int value;
private String description;
WORK_CENTER_MONITOR_BUSI_TYPE(int value, String description) {
this.value = value;
this.description = description;
}
public int getValue() {
return value;
}
public String getDescription() {
return description;
}
public static String valueOfDescription(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) {
tmp = values()[i].description;
}
}
return tmp;
}
}
}

@ -0,0 +1,43 @@
package cn.estsh.i3plus.pojo.mes.bean;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import java.io.Serializable;
/**
* @Author: Wynne.Lu
* @CreateDate: 2019/10/16 2:42 PM
* @Description:
**/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_EQU_ALARM_LOG", indexes = {
@Index(columnList = "CREATE_DATE_TIME"),
@Index(columnList = "WORK_CENTER_CODE")
})
@Api("设备自动报警日志")
public class MesEquAlarmLog extends BaseBean implements Serializable {
private static final long serialVersionUID = -494552645021304934L;
@Column(name = "WORK_CENTER_CODE")
@ApiParam("工作中心")
private String workCenterCode;
@Column(name = "MESSAGE")
@ApiParam("异常信息")
private String message;
}

@ -0,0 +1,67 @@
package cn.estsh.i3plus.pojo.mes.bean;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
* @author Wynne.Lu
* @date 2020/9/29 17:25
* @desc
*/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_LINE_OPERATION")
@Api(value = "产线 开线或停线")
public class MesLineOperation extends BaseBean implements Serializable {
private static final long serialVersionUID = -710375930652577157L;
@Column(name = "WORK_CENTER_CODE")
@ApiParam("产线")
private String workCenterCode;
@Column(name = "WORK_CELL_CODE")
@ApiParam("工位")
private String workCellCode;
@Column(name = "OBJECT_TYPE")
@ApiParam("对象类型")
private Integer objectType;
/**
* MesDataSource dsCode plcCode
*/
@Column(name = "OBJECT_CODE")
@ApiParam("对象代码")
private String objectCode;
@Column(name = "OP_TYPE")
@ApiParam("操作类型 开线、停线")
private Integer opType;
/**
* db jdbc example:update a set b=:b
*/
@Column(name = "DB_OP_CMD")
@ApiParam("db操作指令")
private String dbOpCmd;
/**
* plc
*/
@Column(name = "PLC_OP_VALUE")
@ApiParam("plc更新值")
private String plcOpValue;
}

@ -24,14 +24,14 @@ import java.io.Serializable;
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_TAKT_LEVEL_CONFIG", indexes = {
@Table(name = "MES_TAKT_ALARM_CONTINUOUS_CONFIG", indexes = {
@Index(columnList = "WORK_CENTER_CODE")
})
@Api("节拍故障等级配置表")
public class MesTaktAlarmContinuousConfig extends BaseBean implements Serializable {
private static final long serialVersionUID = -1046263075313178823L;
@Column(name = "WORK_CETNER_CODE")
@Column(name = "WORK_CENTER_CODE")
@ApiParam("产线")
private String workCenterCode;
@ -55,4 +55,12 @@ public class MesTaktAlarmContinuousConfig extends BaseBean implements Serializab
@ApiParam("是否触发安灯")
private Integer isTriggerAndon;
@Column(name = "OBJECT_TYPE")
@ApiParam("对象类型")
private Integer objectType;
@Column(name = "OBJECT_CODE")
@ApiParam("对象代码")
private String objectCode;
}

@ -31,7 +31,7 @@ import java.io.Serializable;
public class MesTaktAlarmLevelConfig extends BaseBean implements Serializable {
private static final long serialVersionUID = -3550230985173772736L;
@Column(name = "WORK_CETNER_CODE")
@Column(name = "WORK_CENTER_CODE")
@ApiParam("产线")
private String workCenterCode;
@ -51,6 +51,10 @@ public class MesTaktAlarmLevelConfig extends BaseBean implements Serializable {
@ApiParam("是否触发安灯")
private Integer isTriggerAndon;
@Column(name = "ANDON_API_TYPE")
@ApiParam("安灯接口类型")
private Integer andonApiType;
@Column(name = "MIN_MULTIPLE")
@ApiParam("最小倍数")
private Double minMultiple;
@ -59,4 +63,12 @@ public class MesTaktAlarmLevelConfig extends BaseBean implements Serializable {
@ApiParam("最大倍数")
private Double maxMultiple;
@Column(name = "OBJECT_TYPE")
@ApiParam("对象类型")
private Integer objectType;
@Column(name = "OBJECT_CODE")
@ApiParam("对象代码")
private String objectCode;
}

@ -33,7 +33,7 @@ import java.io.Serializable;
public class MesTaktAlarmRecord extends BaseBean implements Serializable {
private static final long serialVersionUID = 3267756779912298635L;
@Column(name = "WORK_CETNER_CODE")
@Column(name = "WORK_CENTER_CODE")
@ApiParam("产线")
private String workCenterCode;
@ -54,6 +54,6 @@ public class MesTaktAlarmRecord extends BaseBean implements Serializable {
private String levelCode;
@Column(name = "IS_PROCESSED")
@ApiParam("异常等级")
@ApiParam("是否完成")
private Integer isProcessed = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue();
}

@ -79,6 +79,10 @@ public class MesWorkCenter extends BaseBean implements Serializable {
@ApiParam("序号")
private Integer seq;
@Column(name = "IS_EQU_MONITOR")
@ApiParam("是否需要设备自动报警")
private Integer isEquMonitor;
@Transient
@ApiParam(value = "子集列表")
private List<MesWorkCell> childTreeList;

@ -0,0 +1,63 @@
package cn.estsh.i3plus.pojo.mes.bean;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import java.io.Serializable;
/**
* @Author: Wynne.Lu
* @CreateDate: 2019/10/16 2:42 PM
* @Description:
**/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_WORK_CENTER_MONITOR_LOG", indexes = {
@Index(columnList = "CREATE_DATE_TIME"),
@Index(columnList = "WORK_CENTER_CODE")
})
@Api("工位监控异常信息")
public class MesWorkCenterMonitorLog extends BaseBean implements Serializable {
private static final long serialVersionUID = 1432794181428753903L;
@Column(name = "WORK_CENTER_CODE")
@ApiParam("工作中心")
private String workCenterCode;
@Column(name = "PART_NO")
@ApiParam("物料号")
private String partNo;
@Column(name = "WORK_ORDER_NO")
@ApiParam("工单")
private String workOrderNo;
@Column(name = "PROCESS_CODE")
@ApiParam("工序")
private String processCode;
@Column(name = "ROUTE_CODE")
@ApiParam("流程")
private String routeCode;
@Column(name = "MESSAGE")
@ApiParam("异常信息")
private String message;
@Column(name = "BUSI_TYPE")
@ApiParam("业务类型")
private Integer busiType;
}

@ -1,8 +1,11 @@
package cn.estsh.i3plus.pojo.mes.model;
import cn.estsh.i3plus.pojo.mes.bean.MesTaktAlarmContinuousConfig;
import cn.estsh.i3plus.pojo.mes.bean.MesTaktAlarmLevelConfig;
import cn.estsh.i3plus.pojo.mes.bean.MesTaktAlarmRecord;
import lombok.Data;
import java.util.List;
import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit;
@ -16,10 +19,17 @@ public class AlarmMessage implements Delayed {
private MesTaktAlarmRecord taktAlarmRecord;
private List<MesTaktAlarmLevelConfig> levelConfigs;
private List<MesTaktAlarmContinuousConfig> continuousConfigs;
private long time;
public AlarmMessage(MesTaktAlarmRecord taktAlarmRecord, long time, TimeUnit unit) {
public AlarmMessage(MesTaktAlarmRecord taktAlarmRecord, List<MesTaktAlarmLevelConfig> levelConfigs,
List<MesTaktAlarmContinuousConfig> continuousConfigs, long time, TimeUnit unit) {
this.taktAlarmRecord = taktAlarmRecord;
this.levelConfigs = levelConfigs;
this.continuousConfigs = continuousConfigs;
this.time = System.currentTimeMillis() + (time > 0 ? unit.toMillis(time) : 0);
}

@ -0,0 +1,34 @@
package cn.estsh.i3plus.pojo.mes.model;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
import lombok.Data;
import java.io.Serializable;
/**
* @author Wynne.Lu
* @date 2020/9/29 11:42
* @desc
*/
@Data
public class EquAutoAlarmModel implements Serializable {
private static final long serialVersionUID = -8671950864141698966L;
private String org;
private String workCenterCode;
private Integer takt;
private String plcTagAddr;
private String levelCode;
private String startTime;
private String endTime;
private Integer isFinished = MesPcnEnumUtil.EQU_AUTO_ALARM_TYPE.NORMAL.getValue();
}

@ -0,0 +1,16 @@
package cn.estsh.i3plus.pojo.mes.repository;
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
import cn.estsh.i3plus.pojo.mes.bean.MesLineOperation;
import org.springframework.stereotype.Repository;
/**
* @Description :
* @Reference :
* @Author : jack.jia
* @CreateDate : 2019-04-02
* @Modify:
**/
@Repository
public interface MesLineOperationRepository extends BaseRepository<MesLineOperation, Long> {
}

@ -0,0 +1,13 @@
package cn.estsh.i3plus.pojo.mes.repository;
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCenterMonitorLog;
/**
* @Author: Wynne.Lu
* @CreateDate: 2019/9/27 1:58 PM
* @Description:
**/
public interface MesWorkCenterMonitorLogRepository extends BaseRepository<MesWorkCenterMonitorLog, Long> {
}
Loading…
Cancel
Save