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;
import java.io.Serializable;

/**
 * @Description:
 * @Reference:
 * @Author: Crish
 * @CreateDate:2019-04-16-17:36
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_KPSN_RULE")
@Api("关键件条码校验规则")
public class MesKpsnRule extends BaseBean implements Serializable {
    private static final long serialVersionUID = 8238308232531730720L;
    @Column(name = "PART_NO")
    @ApiParam("物料号")
    private String partNo;

    @Column(name = "LENGTH")
    @ApiParam("长度")
    private Integer length;

    @Column(name = "FROM1")
    @ApiParam("起始1")
    private Integer from1;

    @Column(name = "TO1")
    @ApiParam("至1")
    private Integer to1;

    @Column(name = "FIX1")
    @ApiParam("内容1")
    private String fix1;

    @Column(name = "FROM2")
    @ApiParam("起始2")
    private Integer from2;

    @Column(name = "TO2")
    @ApiParam("至2")
    private Integer to2;

    @Column(name = "FIX2")
    @ApiParam("内容2")
    private String fix2;

    @Column(name = "TYPE")
    @ApiParam("类型")
    private String type;

    @Column(name = "BIND_RULE")
    @ApiParam("绑定规则")
    private Integer bandRule;

    @Column(name = "SUPPLIER_CODE")
    @ApiParam("供应商代码")
    private String supplierCode;

    public int getLengthVal() {
        return this.length == null ? 0 : this.length;
    }

    public int getFrom1Val() {
        return this.from1 == null ? 0 : this.from1;
    }

    public int getTo1Val() {
        return this.to1 == null ? 0 : this.to1;
    }

    public int getFrom2Val() {
        return this.from2 == null ? 0 : this.from2;
    }

    public int getTo2Val() {
        return this.to2 == null ? 0 : this.to2;
    }
}
