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

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
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 javax.persistence.Transient;
import java.io.Serializable;
import java.util.List;

/**
 * @Description :工作中心
 * @Reference :
 * @Author : jack.jia
 * @CreateDate : 2019-04-02
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_WORK_CENTER")
@Api("工作中心")
public class MesWorkCenter extends BaseBean implements Serializable {
    private static final long serialVersionUID = 5583253625290231595L;

    @Column(name = "WORK_CENTER_CODE")
    @ApiParam("工作中心代码")
    private String workCenterCode;

    @Column(name = "WORK_CENTER_NAME")
    @ApiParam("工作中心名称")
    private String workCenterName;

    @Column(name = "ERP_WORK_CENTER")
    @ApiParam("ERP工作中心")
    private String erpWorkCenter;

    @Column(name = "WORK_VER")
    @ApiParam("工作版本")
    private String workVer;

    @Column(name = "AREA_CODE")
    @ApiParam("生产区域代码")
    private String areaCode;

    @Column(name = "RUNNING_STATUS")
    @ApiParam("运行状态")
    private String runningStatus;

    @Column(name = "PRODUCTION_CAPACITY")
    @ApiParam("产能")
    private Integer productionCapacity;

    @Column(name = "GENERATE_TYPE")
    @ApiParam("条码生成模式")
    private Integer generateType;

    // 10=工单作业，20=标准作业
    @Column(name = "MONITOR_TYPE")
    @ApiParam("工位监控模式")
    private Integer monitorType;

    @Column(name = "PLAN_TAKT")
    @ApiParam("节拍")
    private Integer planTakt;

    @Column(name = "SEQ")
    @ApiParam("序号")
    private Integer seq;

    @Column(name = "IS_EQU_MONITOR")
    @ApiParam("是否需要设备自动报警")
    private Integer isEquMonitor;

    @Transient
    @ApiParam(value = "子集列表")
    private List<MesWorkCell> childTreeList;

    @Transient
    @ApiParam(value = "名称")
    private String name;

    // 默认值 -1
    @Transient
    @ApiParam(value = "父节点", access = "父节点", example = "-1")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long parentId;
}
