package com.uas.platform.b2b.model;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.OrderBy;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnore;
@Table(name = "purc$forecast")
@Entity
public class PurchaseForecastAll implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "purc$forecast_gen")
	@SequenceGenerator(name = "purc$forecast_gen", sequenceName = "purc$forecast_seq", allocationSize = 1)
	@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 Enterprise enterprise;

	/**
	 * 采购预测单所属采购员
	 */
	@OneToOne(cascade = { CascadeType.REFRESH })
	@JoinColumn(name = "pf_useruu", insertable = false, updatable = false)
	private User 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;

	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 Enterprise getEnterprise() {
		return enterprise;
	}

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

	public User getUser() {
		return user;
	}

	public void setUser(User 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;
	}

	@JsonIgnore
	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;
	}
	
	
	
}
