package cn.estsh.i3plus.pojo.mes.bean;


import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.mes.model.ProductDataModel;
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.*;
import java.io.Serializable;
import java.util.List;

/**
 * @Description:
 * @Reference:
 * @Author: joke.wang
 * @CreateDate:2019\10\9 0009
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_PLC", indexes = {
        @Index(columnList = "PLC_CODE"),
        @Index(columnList = "TAG_ADDRESS")
})
@Api("PLC配置表")
public class MesPlc extends BaseBean implements Serializable {
    private static final long serialVersionUID = -7172265186837551268L;

    @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 = "DEVICE")
    @ApiParam("终端")
    private String device;

    @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 = "ANALYSIS_RULE")
    @ApiParam("解析规则")
    private String analysisRule;

    @Column(name = "IS_ANALYSIS")
    @ApiParam("是否解析")
    private String isAnalysis;

    @Column(name = "PLC_CFG")
    @ApiParam("PLC配置")
    private String plcCfg;

    @Column(name = "BUSI_TYPE")
    @ApiParam("业务类型")
    private Integer busiType;

    @Column(name = "EQUIPMENT_CODE")
    @ApiParam("设备代码")
    private String equipmentCode;

    @Column(name = "TOOLING_CODE ")
    @ApiParam("工装代码")
    private String toolingCode;

    @Column(name = "WORK_CENTER_CODE")
    @ApiParam("生产线")
    private String workCenterCode;

    @Column(name = "WORK_CELL_CODE")
    @ApiParam("工位")
    private String workCellCode;

    @Column(name = "FEED_VALUE")
    @ApiParam("反馈值")
    private String feedValue;

    @Column(name = "OBJECT_CODE")
    @ApiParam("对象代码")
    private String objectCode;

    @Column(name = "OPC_URL")
    @ApiParam("OPCUA路径")
    private String opcUrl;

    @Column(name = "NAME_SPACE_INDEX")
    @ApiParam("空间索引")
    private Integer nameSpaceIndex = 2;

    @Column(name = "PLC_TYPE")
    @ApiParam("PLC类型")
    private Integer plcType;

    @Column(name = "USER_NAME")
    @ApiParam("用户名")
    private String userName;

    @Column(name = "PASSWORD")
    @ApiParam("密码")
    private String password;

    @Column(name = "DEFAULT_RULE")
    @ApiParam("默认赋值属性")
    private String defaultRule;

    @Column(name = "DATA_DIRECT")
    @ApiParam("数据方向 10 plc->mes 20 mes->plc 30共用地址")
    private Integer dataDirect;

    @Column(name = "CALLBACK_METHOD")
    @ApiParam("回调方法名称")
    private String callbackMethod;

    @Transient
    @ApiParam("设备名称")
    private String equipmentName;

    @Transient
    @ApiParam("OPC值")
    private List<ProductDataModel> opcValue;


    @Transient
    @ApiParam("标签数据")
    private String tableValue;

}
