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.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;

/**
 * @Description :工序物料清单
 * @Reference :
 * @Author : jack.jia
 * @CreateDate : 2019-04-02
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_PROCESS_BOM")
@Api("工序物料清单")
public class MesProcessBom extends BaseBean {
    @Column(name = "PART_NO")
    @ApiParam("零件号")
    private String partNo;

    @Column(name = "PART_NAME")
    @ApiParam("产品物料名称")
    private String partName;

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

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

    @Column(name = "ROUTE_CODE")
    @ApiParam("流程代码")
    private String routeCode;

    @Column(name = "PROCESS_CODE")
    @ApiParam("工序代码")
    private String processCode;

    @Column(name = "ITEM_PART_NO")
    @ApiParam("子零件")
    private String itemPartNo;

    @Column(name = "ITEM_PART_NAME")
    @ApiParam("原材料物料名称")
    private String itemPartName;

    @Column(name = "QTY")
    @ColumnDefault("0")
    @ApiParam(value = "子零件数量", example = "0")
    private Double qty;

    @Column(name = "IS_REPEAT")
    @ApiParam(value = "是否可重复")
    private Integer isRepeat;

    @Column(name = "IS_CHECK")
    @ApiParam(value = "是否检查")
    private Integer isCheck;

    @Column(name = "IS_FEED")
    @ApiParam(value = "是否投料配置")
    private Integer isFeed;

    @Column(name = "is_BIND_KEY")
    @ApiParam(value = "是否绑定关键件")
    private Integer isBindKey;

    @Transient
    @ApiParam("是否已绑定")
    private Boolean isBind;

    @Transient
    @ApiParam("显示颜色")
    private String color;


    public double getQtyVal() {
        return this.qty == null ? 0.0d : this.qty;
    }

    public int getIsRepeatVal() {
        return this.isRepeat == null ? 0 : this.isRepeat;
    }

    public int getIsCheckVal() {
        return this.isCheck == null ? 0 : this.isCheck;
    }

    public boolean getIsBindVal() {
        return this.isBind == null ? false : this.isBind;
    }

    public int getIsFeedVal() {
        return this.isFeed == null ? 0 : this.isFeed;
    }

    @Override
    public String toString() {
        return "MesProcessBom{" +
                "partNo='" + partNo + '\'' +
                ", processCode='" + processCode + '\'' +
                ", itemPartNo='" + itemPartNo + '\'' +
                ", qty=" + qty +
                ", isRepeat=" + isRepeat +
                ", isCheck=" + isCheck +
                ", isFeed=" + isFeed +
                ", isBind=" + isBind +
                ", color='" + color + '\'' +
                ", id=" + id +
                ", organizeCode='" + organizeCode + '\'' +
                ", isValid=" + isValid +
                ", isDeleted=" + isDeleted +
                ", createUser='" + createUser + '\'' +
                ", createDatetime='" + createDatetime + '\'' +
                ", modifyUser='" + modifyUser + '\'' +
                ", modifyDatetime='" + modifyDatetime + '\'' +
                ", createDateTimeStart='" + createDateTimeStart + '\'' +
                ", createDateTimeEnd='" + createDateTimeEnd + '\'' +
                ", modifyDateTimeStart='" + modifyDateTimeStart + '\'' +
                ", modifyDateTimeEnd='" + modifyDateTimeEnd + '\'' +
                ", orderByParam='" + orderByParam + '\'' +
                ", ascOrDesc=" + ascOrDesc +
                '}';
    }
}
