/**
 * There are <a href="https://github.com/ketayao/keta-custom">keta-custom</a> code generation
 */
package com.sw.mes.yb.plan.entity;

import com.sw.mes.base.factory.product.entity.ProductModel;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
* @Author
* @Description：
* @Date: Create in
* @Modified By:
*/
@Data
@Entity
@Table(name="plan_yb_production_order")
@DynamicUpdate
@DynamicInsert
public class YbProductionOrder{
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
	/**
	 * guid,plnatid+date+time+流水
	 */
    @Column(length=80)
    private String tid;
    
	/**
	 * sap char(12)
sap中最多12位
	 */
    @Column(length=12)
    private String aufnr;
    
	/**
	 * fab name
工厂编码
	 */
    @Column(length=40)
    private String werks;
    
	/**
	 * need to sync with sap
需要与sap一致
	 */
    @Column(length=40)
    private String auart;
    
	/**
	 * product id
产品物料编码
	 */
    @Column(length=18)
    private String matnr;
    
	/**
	 * 数量，业务可能调整
	 */
    @Column(length=19)
    private BigDecimal menge;
    
	/**
	 * 单位    业务可能调整
	 */
    @Column(length=30)
    private String meins;
    
	/**
	 * 优先级1 ~ 9，业务可能调整
	 */
    @Column(nullable=false, length=20)
    private String aprio;
    
	/**
	 * null, reserve
空白，保留字段
	 */
    @Column(length=40)
    private String customerid;
    
	/**
	 * sales order
销售订单信息
	 */
    @Column(length=40)
    private String salesorder;
    
	/**
	 * owner
负责人
	 */
    @Column(length=40)
    private String ownerengineer;
    
	/**
	 * plan end date
计划结束时间
	 */
    @Column(length=19)
	@Temporal(TemporalType.TIMESTAMP)
    private Date gltrp;
    
	/**
	 * plan start date
计划开始时间
	 */
    @Column(length=19)
	@Temporal(TemporalType.TIMESTAMP)
    private Date gstrp;
    
	/**
	 * order status
订单状态
	 */
    @Column(length=40)
    private String status;
    
	/**
	 * comment
订单备注
	 */
    @Column(length=255)
    private String comment;
    
	/**
	 * 保税号
	 */
    @Column(length=30)
    private String bonded;
    
	/**
	 * 研发项目编号
	 */
    @Column(length=20)
    private String rdNum;
    
	/**
	 * 晶体板块用来标注特殊圆棒或方棒的字段
	 */
    @Column(length=20)
    private String rdInd;
    
	/**
	 * 预留字段
	 */
    @Column(length=40)
    private String field1;
    
	/**
	 * 预留字段
	 */
    @Column(length=40)
    private String field2;
    
	/**
	 * 预留字段
	 */
    @Column(length=40)
    private String field3;
    
	/**
	 * 预留字段
	 */
    @Column(length=40)
    private String field4;
    
	/**
	 * 预留字段
	 */
    @Column(length=40)
    private String field5;
    
	/**
	 * 创建时间
	 */
    @Column(length=19)
	@Temporal(TemporalType.TIMESTAMP)
    private Date createDate;
    
	/**
	 * 是否生产
	 */
    @Column(nullable=false, length=0)
    private Boolean productionStatus;

    /**
     * 产品信息
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @NotFound(action= NotFoundAction.IGNORE)
    @JoinColumn(name = "product_model_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    private ProductModel productModel;
    
	/**
	 * 研发唯一标识
	 */
    @Column(length=20)
    private String rdonlylogo;
    
	/**
	 * 加工能力id
	 */
    @Column(nullable=false, length=10)
    private Integer machineCapacityId;

    /**
     * 产品类别
     */
    @Column(length=50)
    private String productType;

    /**
     * 电阻类型
     */
    @Column
    private String resistanceType;
    

	public YbProductionOrder() {
	}

	public YbProductionOrder(Long id) {
		this.id = id;
	}
}
