Merge branch 'dev' into test

yun-zuoyi
jenkins 6 years ago
commit 30eee05b1c

@ -1,6 +1,7 @@
package cn.estsh.i3plus.pojo.base.enumutil;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.StringUtils;
/**
* @Description :
@ -532,7 +533,7 @@ public class MesPcnEnumUtil {
PLC(10, "PLC"),
DB(20, "DB"),
OTHER(30,"OTHER");
OTHER(30, "OTHER");
private int value;
private String description;
@ -562,6 +563,204 @@ public class MesPcnEnumUtil {
}
/**
* 线
*/
@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;
}
}
/**
* MesPlanOrderstatus
*/
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
@ -961,5 +1160,4 @@ public class MesPcnEnumUtil {
}
}
}

@ -39,4 +39,8 @@ public class MesDataObject extends BaseBean {
@Column(name="DS_CODE")
@ApiParam("数据源代码")
private String dsCode;
@Column(name="OPERATE_TYPE")
@ApiParam("操作类型")
private Integer operateType;
}

@ -25,7 +25,7 @@ import javax.persistence.Table;
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_DB")
@Api("地址清单")
public class MesDB extends BaseBean {
public class MesDb extends BaseBean {
@Column(name="DS_CODE")
@ApiParam("数据源代码")

@ -55,6 +55,10 @@ public class MesEquipment extends BaseBean {
@ApiParam("区域代码")
private String areaCode;
@Column(name="CONNECT_TYPE")
@ApiParam("连接类型")
private Integer connectType;
@Transient
@ApiParam(value ="名称")
private String name;

@ -52,4 +52,8 @@ public class MesObjectCfg extends BaseBean {
@ApiParam("主键标记")
private String fieldPk;
@Column(name="POJO_ATTR")
@ApiParam("对应的pojo属性")
private String pojoAttr;
}

@ -0,0 +1,81 @@
package cn.estsh.i3plus.pojo.mes.pcn.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;
/**
* @Author: Wynne.Lu
* @CreateDate: 2019/9/25 8:07 PM
* @Description:
**/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_PLC")
@Api("PLC配置表")
public class MesPlc extends BaseBean {
@Column(name = "PLC_CODE")
@ApiParam("PLC代码")
private String plcCode;
@Column(name = "PLC_NAME")
@ApiParam("PLC名称")
private String plcName;
@Column(name = "PLC_MODEL")
@ApiParam("PLC型号")
private String plcModel;
@Column(name = "PLC_IP")
@ApiParam("PLC IP")
private String plcIp;
@Column(name = "CHANNEL")
@ApiParam("通道")
private String channel;
@Column(name = "TAG_NAME")
@ApiParam("标签名称")
private String tagName;
@Column(name = "TAG_ADDRESS")
@ApiParam("标签地址")
private String tagAddress;
@Column(name = "DATA_TYPE")
@ApiParam("标签数据类型")
private String dataType;
@Column(name = "GROUP_NAME")
@ApiParam("分组名称")
private String groupName;
@Column(name = "EQU_CODE")
@ApiParam("设备代码")
private String equCode;
@Column(name = "WORK_CENTER_CODE")
@ApiParam("工作中心")
private String workCenterCode;
@Column(name = "WORK_CELL_CODE")
@ApiParam("工作单元")
private String workCellCode;
@Column(name = "ENABLED")
@ApiParam("是否启用 0 false 1 true")
private Integer enabled;
}

@ -0,0 +1,50 @@
package cn.estsh.i3plus.pojo.mes.pcn.model;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Map;
/**
* @Author: Wynne.Lu
* @CreateDate: 2019/9/25 7:41 PM
* @Description:
**/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Api("PLC交互model")
public class PLCInteracticeModel {
private String serverIp;
private String serverPort;
private String mwContext;
private String protocol;
private String plcCode;
private String dataType;
private String userName;
private String password;
private Integer enabled;
private String realm;
private String tag;
private String value;
private String comment;
private String authenKey;
}

@ -0,0 +1,35 @@
package cn.estsh.i3plus.pojo.mes.pcn.model;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author: Wynne.Lu
* @CreateDate: 2019/9/28 10:17 AM
* @Description:
**/
@Data
@Api("PLC Redis Cache key")
public class PlcCacheKeyModel {
private String channel;
private String device;
private String tag;
public PlcCacheKeyModel(String channel, String device, String tag) {
this.channel = channel;
this.device = device;
this.tag = tag;
}
public String getPlcCacheKey() {
return channel + ":" + device + ":" + tag;
}
}

@ -48,6 +48,9 @@ public class WcCheckModel {
@ApiParam("开线信号")
private Integer onlineSignal;
@ApiParam("开线对象")
MesWcCheckRecord onlineSignalEqu;
@ApiParam("是否通过")
private Integer isPass;
@ -57,12 +60,12 @@ public class WcCheckModel {
@ApiParam("工单")
private String workOrder;
@ApiParam("工单零件数量")
private Long qty;
@ApiParam("产品号")
private String partNo;
@ApiParam("需要展示的数据")
private Map<String, String> need2ShowMap;
public WcCheckModel initialWcCheckModel() {
WcCheckModel wcCheckModel = new WcCheckModel();
@ -76,6 +79,8 @@ public class WcCheckModel {
wcCheckModel.setRoutesColumn(new HashMap<>());
wcCheckModel.setOnlineSignal(MesPcnEnumUtil.ONLINE_SIGNAL.NON_CHECK.getValue());
wcCheckModel.setIsPass(MesPcnEnumUtil.IS_WCCHECK_PASS.NON_PASS.getValue());
onlineSignalEqu=new MesWcCheckRecord();
wcCheckModel.setNeed2ShowMap(new HashMap<>());
Map<String, String> dataColumnRelationMap = new HashMap<>();
dataColumnRelationMap.put("people", "peopleColumn");

@ -0,0 +1,13 @@
package cn.estsh.i3plus.pojo.mes.pcn.repository;
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
import cn.estsh.i3plus.pojo.mes.pcn.bean.MesDataObject;
/**
* @Author: Wynne.Lu
* @CreateDate: 2019/9/27 1:59 PM
* @Description:
**/
public interface MesDataObjectRepository extends BaseRepository<MesDataObject,Long> {
}

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

@ -0,0 +1,13 @@
package cn.estsh.i3plus.pojo.mes.pcn.repository;
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
import cn.estsh.i3plus.pojo.mes.pcn.bean.MesObjectCfg;
/**
* @Author: Wynne.Lu
* @CreateDate: 2019/9/27 1:59 PM
* @Description:
**/
public interface MesObjectCfgRepository extends BaseRepository<MesObjectCfg, Long> {
}

@ -0,0 +1,15 @@
package cn.estsh.i3plus.pojo.mes.pcn.repository;
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
import cn.estsh.i3plus.pojo.mes.pcn.bean.MesPlc;
import org.springframework.stereotype.Repository;
/**
* @Author: Wynne.Lu
* @CreateDate: 2019/9/26 7:47 PM
* @Description:
**/
@Repository
public interface MesPlcRepository extends BaseRepository<MesPlc, Long> {
}

@ -39,4 +39,8 @@ public class MesDataObject extends BaseBean {
@Column(name="DS_CODE")
@ApiParam("数据源代码")
private String dsCode;
@Column(name="OPERATE_TYPE")
@ApiParam("操作类型")
private Integer operateType;
}

@ -25,7 +25,7 @@ import javax.persistence.Table;
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_DB")
@Api("地址清单")
public class MesDB extends BaseBean {
public class MesDb extends BaseBean {
@Column(name = "DS_CODE")
@ApiParam("数据源代码")

@ -52,4 +52,8 @@ public class MesObjectCfg extends BaseBean {
@ApiParam("主键标记")
private String fieldPk;
@Column(name="POJO_ATTR")
@ApiParam("对应的pojo属性")
private String pojoAttr;
}

Loading…
Cancel
Save