package cn.estsh.i3plus.pojo.mes.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.Index;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * @Description :mes系统业务动作
 * @Reference :
 * @Author : jack.jia
 * @CreateDate : 2019-04-12
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_RAW_PART_SN", indexes = {@Index(columnList = "RAW_SN")})
@Api("原材料信息")
public class MesRawPartSn extends BaseBean implements Serializable {
    private static final long serialVersionUID = 1590983555938105569L;

    @Column(name = "PART_NO")
    @ApiParam("物料号")
    private String partNo;

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

    @Column(name = "RAW_TYPE")
    @ApiParam("原料类型")
    private String rawType;

    @Column(name = "RAW_SN")
    @ApiParam("原材料条码")
    private String rawSn;

    @Column(name = "RAW_QTY", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("数量")
    private Double rawQty;

    @Column(name = "LOT_NO")
    @ApiParam("生产批次")
    private String lotNo;

    @Column(name = "FIX_LOT_NO")
    @ApiParam("特殊批次")
    private String fixLotNo;

    @Column(name = "STATUS")
    @ApiParam("原料状态")
    private Integer status;

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

    public double getRawQtyVal() {
        return this.rawQty == null ? 0l : this.rawQty;
    }

    public int getStatusVal() {
        return this.status == null ? 0 : this.status;
    }

}
