package com.uas.platform.b2b.model;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;

/**
 * 采购预单
 */
@Table(name = "purc$forecast", indexes = {@Index(name = "unique_enuu_code", columnList = "pf_enuu,pf_code", unique = true)})
@Entity
public class PurchaseForecastAll implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "pf_id")
	private Long id;

	/**
	 * 采购预测单所属企业UU
	 */
	@Column(name = "pf_enuu")
	private Long enUU;

	/**
	 * 采购预测企业
	 */
	@OneToOne(cascade = { CascadeType.REFRESH })
	@JoinColumn(name = "pf_enuu", insertable = false, updatable = false)
	private EnterpriseInfo enterprise;

	/**
	 * 采购预测单所属采购员
	 */
	@OneToOne(cascade = { CascadeType.REFRESH })
	@JoinColumn(name = "pf_useruu", insertable = false, updatable = false)
	private UserBaseInfo user;

	/**
	 * 采购预测单所属采购员UU
	 */
	@Column(name = "pf_useruu")
	private Long userUU;

	/**
	 * 采购预测单号
	 */
	@Column(name = "pf_code")
	private String code;

	/**
	 * 采购预测类型
	 */
	@Column(name = "pf_kind")
	private String kind;

	/**
	 * 单据归属日期
	 */
	@Column(name = "pf_date")
	private Date date;

	/**
	 * 录单人
	 */
	@Column(name = "pf_recorder")
	private String recorder;

	/**
	 * 用途
	 */
	@Column(name = "pf_purpose")
	private String purpose;

	/**
	 * 采购预测单明细
	 */
	@OneToMany(mappedBy = "order", cascade = { CascadeType.REFRESH, CascadeType.PERSIST, CascadeType.REMOVE,
			CascadeType.MERGE }, fetch = FetchType.EAGER)
	@OrderBy("number")
	private Set<PurchaseForecastAllItem> forecastItems;

	/**
	 * 对应的erpid
	 * 
	 * @return
	 */
	@Column(name = "pf_erpid")
	private Long erpId;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getEnUU() {
		return enUU;
	}

	public void setEnUU(Long enUU) {
		this.enUU = enUU;
	}

	public EnterpriseInfo getEnterprise() {
		return enterprise;
	}

	public void setEnterprise(EnterpriseInfo enterprise) {
		this.enterprise = enterprise;
	}

	public UserBaseInfo getUser() {
		return user;
	}

	public void setUser(UserBaseInfo user) {
		this.user = user;
	}

	public Long getUserUU() {
		return userUU;
	}

	public void setUserUU(Long userUU) {
		this.userUU = userUU;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getKind() {
		return kind;
	}

	public void setKind(String kind) {
		this.kind = kind;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getRecorder() {
		return recorder;
	}

	public void setRecorder(String recorder) {
		this.recorder = recorder;
	}

	public Set<PurchaseForecastAllItem> getForecastItems() {
		return forecastItems;
	}

	public void setForecastItems(Set<PurchaseForecastAllItem> forecastItems) {
		this.forecastItems = forecastItems;
	}

	public String getPurpose() {
		return purpose;
	}

	public void setPurpose(String purpose) {
		this.purpose = purpose;
	}

	public Long getErpId() {
		return erpId;
	}

	public void setErpId(Long erpId) {
		this.erpId = erpId;
	}

}
