package cn.estsh.i3plus.ext.mes.pcn.pojo.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;

/**
 * @Author: wangjie
 * @CreateDate: 2021/01/17 17:35 下午
 * @Description:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_WORK_ORDER_PROCESS_BOM", indexes = {
        @Index(columnList = "ORGANIZE_CODE,WORK_ORDER_NO,PROCESS_CODE")
})
@Api("工单工序BOM")
public class MesWorkOrderProcessBom extends BaseBean implements Serializable {

    private static final long serialVersionUID = -7250279357720843152L;
    
    @Column(name = "WORK_ORDER_NO")
    @ApiParam("生产工单号")
    private String workOrderNo;

    @Column(name = "PART_NO")
    @ApiParam("成品物料编码")
    private String partNo;

    @Column(name = "PART_NAME_RDD")
    @ApiParam("成品物料名称")
    private String partNameRdd;

    @Column(name = "ITEM_PART_NO")
    @ApiParam("原材料物料编码")
    private String itemPartNo;

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

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

    @Column(name = "PROCESS_NAME")
    @ApiParam("工序名称")
    private String processName;

    @Column(name = "QTY", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam(value = "原材料物料数量", example = "0")
    private Double qty;

    @Column(name = "SEQ")
    @ApiParam("关键件序号")
    private Double seq;

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

}
