diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesPcnEnumUtil.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesPcnEnumUtil.java index ca147d9..417b218 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesPcnEnumUtil.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/MesPcnEnumUtil.java @@ -2484,7 +2484,8 @@ public class MesPcnEnumUtil { FIVE_MINS(300, "5分钟"), HALF_HOUR(1800, "半小时"), ONE_QUARTER(900, "一刻钟"), - ONE_MIN(60, "一分钟"); + ONE_MIN(60, "一分钟"), + DEFAULT(36000, "十小时"); private int value; private String description; @@ -6792,4 +6793,94 @@ public class MesPcnEnumUtil { } } + /** + * 工位程序数据缓存方式 + */ + @JsonFormat(shape = JsonFormat.Shape.OBJECT) + public enum PCN_DISPATCH_DATA_CACHE_TYPE { + REDIS("1", "REDIS"), + DB("2", "DB"), + ALL("3", "REDIS & DB"); + + private String value; + private String description; + + PCN_DISPATCH_DATA_CACHE_TYPE(String value, String description) { + this.value = value; + this.description = 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 String getValue() { + return value; + } + + + public String getDescription() { + return description; + } + } + + /** + * 工位程序数据缓存方式 + */ + @JsonFormat(shape = JsonFormat.Shape.OBJECT) + public enum PCN_DISPATCH_DATA_HANDLE_TYPE { + GET(1, "get", "GET"), + SAVE(2, "save", "SAVE"), + DELETE(3, "delete", "DELETE"); + + private int value; + private String method; + private String description; + + PCN_DISPATCH_DATA_HANDLE_TYPE(int value, String method, String description) { + this.value = value; + this.method = method; + this.description = description; + } + + public static String method(int val) { + String tmp = null; + for (int i = 0; i < values().length; i++) { + if (values()[i].value == val) { + tmp = values()[i].method; + } + } + return tmp; + } + + 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; + } + + public int getValue() { + return value; + } + + public String getMethod() { + return method; + } + + public String getDescription() { + return description; + } + } + + } diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesWorkCellDataCache.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesWorkCellDataCache.java new file mode 100644 index 0000000..61649d8 --- /dev/null +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/bean/MesWorkCellDataCache.java @@ -0,0 +1,99 @@ +package cn.estsh.i3plus.pojo.mes.bean; + +import cn.estsh.i3plus.pojo.base.bean.BaseBean; +import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; +import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; +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 org.hibernate.type.TimeType; +import org.springframework.util.StringUtils; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * @Description :工位程序数据缓存 + * @Reference : + * @Author : wangjie + * @CreateDate : 2019-08-30 + * @Modify: + **/ +@Data +@Entity +@DynamicInsert +@DynamicUpdate +@EqualsAndHashCode(callSuper = true) +@Inheritance(strategy = InheritanceType.JOINED) +@Table(name = "MES_WORK_CELL_DATA_CACHE", indexes = { + @Index(columnList = "KEY_"), + @Index(columnList = "KEY_, ITEM_") +}) +@Api("mes工位程序数据缓存表") +public class MesWorkCellDataCache extends BaseBean implements Serializable { + + private static final long serialVersionUID = -3883501945696764210L; + + @Column(name = "KEY_") + @ApiParam("KEY") + private String key; + + @Column(name = "ITEM_") + @ApiParam("元素") + private String item; + + @Lob + @Column(name = "VALUE_") + @ApiParam("值") + private String value; + + @Column(name = "CLAZZ_") + @ApiParam("对象CLASS") + private String clazz; + + @Column(name = "TIME_") + @ApiParam("过期时间") + private String time; + + public MesWorkCellDataCache() {} + + public MesWorkCellDataCache(String key, String item, String value, String clazz, String time, String organizeCode, String modifyDatetime) { + this.key = key; + this.item = item; + this.value = value; + this.clazz = clazz; + this.time = time; + super.organizeCode = organizeCode; + super.createDatetime = modifyDatetime; + super.modifyDatetime = modifyDatetime; + } + + public void override(String value, String clazz, String time, String organizeCode, String modifyDatetime) { + this.value = value; + this.clazz = clazz; + this.time = time; + super.organizeCode = organizeCode; + super.modifyDatetime = modifyDatetime; + if (super.isDeleted == CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) super.isDeleted = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(); + if (super.isValid == CommonEnumUtil.IS_VAILD.INVAILD.getValue()) super.isValid = CommonEnumUtil.IS_VAILD.VAILD.getValue(); + } + + public String getValue_(String curTime) { + + if (!StringUtils.isEmpty(this.time) && !this.time.equals(String.valueOf(MesPcnEnumUtil.EXPIRE_TIME.NEVER.getValue())) && this.time.compareTo(curTime) < 0) return null; + + if (super.isDeleted == CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) return null; + + if (super.isValid == CommonEnumUtil.IS_VAILD.INVAILD.getValue()) return null; + + return this.value; + } + + public MesWorkCellDataCache logicalDelete(){ + super.isDeleted = CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(); + return this; + } +} diff --git a/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesWorkCellDataCacheRepository.java b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesWorkCellDataCacheRepository.java new file mode 100644 index 0000000..35579d6 --- /dev/null +++ b/modules/i3plus-pojo-mes/src/main/java/cn/estsh/i3plus/pojo/mes/repository/MesWorkCellDataCacheRepository.java @@ -0,0 +1,17 @@ +package cn.estsh.i3plus.pojo.mes.repository; + +import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository; +import cn.estsh.i3plus.pojo.mes.bean.MesWorkCellDataCache; +import org.springframework.stereotype.Repository; + +/** + * @Description : + * @Reference : + * @Author : + * @CreateDate : 2020-05-18 16:49 + * @Modify: + **/ +@Repository +public interface MesWorkCellDataCacheRepository extends BaseRepository { + +}