|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package cn.estsh.i3plus.pojo.base.enumutil;
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description :
|
|
|
|
@ -350,14 +351,16 @@ public class MesPcnEnumUtil {
|
|
|
|
|
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
|
|
|
|
|
public enum WORK_CENTER_RUNNING_STATUS {
|
|
|
|
|
|
|
|
|
|
RUNNING(1, "开线"),
|
|
|
|
|
STOPPED(2, "停线");
|
|
|
|
|
RUNNING(1, "start", "开线"),
|
|
|
|
|
STOPPED(2, "stop", "停线");
|
|
|
|
|
|
|
|
|
|
private int value;
|
|
|
|
|
private String code;
|
|
|
|
|
private String description;
|
|
|
|
|
|
|
|
|
|
WORK_CENTER_RUNNING_STATUS(int value, String description) {
|
|
|
|
|
WORK_CENTER_RUNNING_STATUS(int value, String code, String description) {
|
|
|
|
|
this.value = value;
|
|
|
|
|
this.code = code;
|
|
|
|
|
this.description = description;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -365,6 +368,10 @@ public class MesPcnEnumUtil {
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getCode() {
|
|
|
|
|
return code;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getDescription() {
|
|
|
|
|
return description;
|
|
|
|
|
}
|
|
|
|
@ -378,6 +385,16 @@ public class MesPcnEnumUtil {
|
|
|
|
|
}
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String valueOfCode(int val) {
|
|
|
|
|
String tmp = null;
|
|
|
|
|
for (int i = 0; i < values().length; i++) {
|
|
|
|
|
if (values()[i].value == val) {
|
|
|
|
|
tmp = values()[i].code;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -386,10 +403,10 @@ public class MesPcnEnumUtil {
|
|
|
|
|
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
|
|
|
|
|
public enum WC_CHECK_TYPE {
|
|
|
|
|
|
|
|
|
|
PERSON(10, "person", "人"),
|
|
|
|
|
EQUIPMENT(20, "equipment", "机"),
|
|
|
|
|
MATERIAL(30, "material", "料"),
|
|
|
|
|
ROUTE(40, "route", "法"),
|
|
|
|
|
PERSON(10, "people", "人"),
|
|
|
|
|
EQUIPMENT(20, "equipments", "设备"),
|
|
|
|
|
MATERIAL(30, "materials", "物料"),
|
|
|
|
|
ROUTE(40, "routes", "工艺"),
|
|
|
|
|
ONLINE_SIGNAL(50, "onlineSignal", "开线信号");
|
|
|
|
|
|
|
|
|
|
private int value;
|
|
|
|
@ -423,6 +440,16 @@ public class MesPcnEnumUtil {
|
|
|
|
|
}
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String valueOfCode(int val) {
|
|
|
|
|
String tmp = null;
|
|
|
|
|
for (int i = 0; i < values().length; i++) {
|
|
|
|
|
if (values()[i].value == val) {
|
|
|
|
|
tmp = values()[i].code;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -498,4 +525,240 @@ public class MesPcnEnumUtil {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设备连接类型
|
|
|
|
|
*/
|
|
|
|
|
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
|
|
|
|
|
public enum EQP_CONNECT_TYPE {
|
|
|
|
|
|
|
|
|
|
PLC(10, "PLC"),
|
|
|
|
|
DB(20, "DB"),
|
|
|
|
|
OTHER(30, "OTHER");
|
|
|
|
|
|
|
|
|
|
private int value;
|
|
|
|
|
private String description;
|
|
|
|
|
|
|
|
|
|
EQP_CONNECT_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 DB_OPERATION_TYPE {
|
|
|
|
|
|
|
|
|
|
INSERT(10, "insert", "新增"),
|
|
|
|
|
SELECT(20, "select", "查询"),
|
|
|
|
|
UPDATE(30, "update", "更新");
|
|
|
|
|
|
|
|
|
|
private int value;
|
|
|
|
|
private String code;
|
|
|
|
|
private String description;
|
|
|
|
|
|
|
|
|
|
DB_OPERATION_TYPE(int value, String code, String description) {
|
|
|
|
|
this.value = value;
|
|
|
|
|
this.code = code;
|
|
|
|
|
this.description = description;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getValue() {
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getCode() {
|
|
|
|
|
return code;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String valueOfCode(int val) {
|
|
|
|
|
String tmp = null;
|
|
|
|
|
for (int i = 0; i < values().length; i++) {
|
|
|
|
|
if (values()[i].value == val) {
|
|
|
|
|
tmp = values()[i].code;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 数据库连接方式
|
|
|
|
|
*/
|
|
|
|
|
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
|
|
|
|
|
public enum DATA_SOURCE_TYPE {
|
|
|
|
|
SOURCE_MARIA_DB(10, "MariaDB", "MariaDB 10.1","com.mysql.jdbc.Driver",3306,null),
|
|
|
|
|
SOURCE_SQL_SERVER(20, "SQL Server", "SQL Server 2017","com.microsoft.sqlserver.jdbc.SQLServerDriver",1433,"dbo"),
|
|
|
|
|
SOURCE_ORACLE(30, "Oracle", "Oralce 12C","oracle.jdbc.driver.OracleDriver",1521,null),
|
|
|
|
|
SOURCE_POSTGRE_SQL(40, "PostgreSql", "PostgreSql 10.5","org.postgresql.Driver",5432,"public");
|
|
|
|
|
|
|
|
|
|
private int value;
|
|
|
|
|
private String code;
|
|
|
|
|
private String description;
|
|
|
|
|
private String driverClassName;
|
|
|
|
|
private int defaultPort;
|
|
|
|
|
private String defaultSchemaPattern;
|
|
|
|
|
|
|
|
|
|
private DATA_SOURCE_TYPE (int value, String code, String description,String driverClassName,int port,String defaultSchemaPattern) {
|
|
|
|
|
this.value = value;
|
|
|
|
|
this.code = code;
|
|
|
|
|
this.description = description;
|
|
|
|
|
this.driverClassName = driverClassName;
|
|
|
|
|
this.defaultPort = port;
|
|
|
|
|
this.defaultSchemaPattern = defaultSchemaPattern;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getValue() {
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getCode() {
|
|
|
|
|
return code;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getDescription() {
|
|
|
|
|
return description;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getDriverClassName() {
|
|
|
|
|
return driverClassName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getDefaultPort() {
|
|
|
|
|
return defaultPort;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getDefaultSchemaPattern() {
|
|
|
|
|
return defaultSchemaPattern;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String valueOfCode(int val) {
|
|
|
|
|
String tmp = null;
|
|
|
|
|
for (int i = 0; i < values().length; i++) {
|
|
|
|
|
if (values()[i].value == val) {
|
|
|
|
|
tmp = values()[i].code;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static int codeOfValue(String code) {
|
|
|
|
|
int tmp = 1;
|
|
|
|
|
for (int i = 0; i < values().length; i++) {
|
|
|
|
|
if (values()[i].code.equals(code)) {
|
|
|
|
|
tmp = values()[i].value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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 static DATA_SOURCE_TYPE valueOf(int val) {
|
|
|
|
|
String tmp = null;
|
|
|
|
|
for (int i = 0; i < values().length; i++) {
|
|
|
|
|
if (values()[i].value == val) {
|
|
|
|
|
return values()[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String codeOfDescription(String code) {
|
|
|
|
|
String tmp = null;
|
|
|
|
|
for (int i = 0; i < values().length; i++) {
|
|
|
|
|
if (values()[i].code.equals(code)) {
|
|
|
|
|
tmp = values()[i].description;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getJDBCUrl(String database,String host,Integer port){
|
|
|
|
|
if(this.getValue() == SOURCE_MARIA_DB.getValue()){
|
|
|
|
|
return getJDBCUrlMySQL(database,host,port);
|
|
|
|
|
}else if(this.getValue() == SOURCE_ORACLE.getValue()){
|
|
|
|
|
return getJDBCUrlOracle(database,host,port);
|
|
|
|
|
}else if(this.getValue() == SOURCE_POSTGRE_SQL.getValue()){
|
|
|
|
|
return getJDBCUrlPostgreSQL(database,host,port);
|
|
|
|
|
}else if(this.getValue() == SOURCE_SQL_SERVER.getValue()){
|
|
|
|
|
return getJDBCUrlSQLServer(database,host,port);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static DATA_SOURCE_TYPE getDataSourceURL(String databaseProductName){
|
|
|
|
|
if(StringUtils.isNotBlank(databaseProductName)){
|
|
|
|
|
if(databaseProductName.indexOf(":mysql:") != -1){
|
|
|
|
|
return SOURCE_MARIA_DB;
|
|
|
|
|
}else if(databaseProductName.indexOf(":oracle:") != -1){
|
|
|
|
|
return SOURCE_ORACLE;
|
|
|
|
|
}else if(databaseProductName.indexOf(":postgresql:") != -1){
|
|
|
|
|
return SOURCE_POSTGRE_SQL;
|
|
|
|
|
}else if(databaseProductName.indexOf(":sqlserver:") != -1){
|
|
|
|
|
return SOURCE_SQL_SERVER;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getJDBCUrlMySQL(String database,String host,Integer port){
|
|
|
|
|
return "jdbc:mysql://"+host+":"+port+"/"+database+"?autoReconnect=true&useSSL=false&characterEncoding=utf-8";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getJDBCUrlOracle(String database,String host,Integer port){
|
|
|
|
|
return "jdbc:oracle:thin:@"+host+":"+port+":"+database;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getJDBCUrlPostgreSQL(String database,String host,Integer port){
|
|
|
|
|
return "jdbc:postgresql://"+host+":"+port+"/"+database;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getJDBCUrlSQLServer(String database,String host,Integer port){
|
|
|
|
|
return "jdbc:sqlserver://" + host + ":" + port + ";database=" + database;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|