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.ColumnDefault;
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_CELL")
@Api("工作单元")
public class MesWorkCell extends BaseBean implements Serializable {
    private static final long serialVersionUID = 8552890090536989486L;

    @Column(name = "WORK_CELL_CODE")
    @ApiParam("工作单元代码")
    private String workCellCode;

    @Column(name = "WORK_CELL_NAME")
    @ApiParam("工作单元名称")
    private String workCellName;

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

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

    @Column(name = "WORK_CELL_TYPE")
    @ApiParam("工位类型")
    private Integer workCellType;

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

    @Column(name = "WORK_CELL_IP")
    @ApiParam("工作单元IP")
    private String workCellIp;

    @Column(name = "WORK_CELL_PORT")
    @ApiParam("工作单元端口")
    private String workCellPort;

    @Column(name = "GRADE")
    @ApiParam("工位等级")
    private Integer grade;

    @Column(name = "TARGET_PASS_RATE", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("目标合格率")
    private Double targetPassRate;

    @Column(name = "STAND_TAKT")
    @ApiParam("标准节拍")
    private Integer standTakt;

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

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

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

    @Transient
    @ApiParam("工位类型名称")
    private String workCellTypeName;

    @Transient
    @ApiParam("安灯呼叫状态")
    private Integer andonQueueStatus;

}
