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.Table;
import javax.persistence.Transient;
import java.io.Serializable;

/**
 * @Description :工位投料信息
 * @Reference :
 * @Author : Wynne.Lu
 * @CreateDate : 2019-09-17
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_CELL_FEED")
@Api("工位投料信息")
public class MesCellFeed extends BaseBean implements Serializable {
    private static final long serialVersionUID = 1947971369479107782L;

    @Column(name = "ORDER_NO")
    @ApiParam("工单号")
    private String orderNo;

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

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

    @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 = "SUPPLIER_CODE")
    @ApiParam("供应商代码")
    private String supplierCode;

    @Column(name = "RACK_NO")
    @ApiParam("料箱编号")
    private String rackNo;

    @Transient
    @ApiParam(value = "原料类型名称")
    private String rawTypeName;

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

}
