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.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * 平台里面，供应商发起的主动报价单<br>
 * （以供应商的视角）
 * 
 * @author yingp
 * 
 */
@Table(name = "sale$quotation")
@Entity
public class SaleQuotation implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -5284541388827978036L;

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sale$quotation_gen")
	@SequenceGenerator(name = "sale$quotation_gen", sequenceName = "sale$quotation_seq", allocationSize = 1)
	@Column(name = "qu_id")
	private Long id;

	/**
	 * 流水号
	 */
	@Column(name = "qu_code")
	private String code;

	/**
	 * 所属企业(卖家)UU
	 */
	@Column(name = "qu_enuu")
	private Long enUU;
	
	/**
	 * 所属用户(卖家)UU
	 */
	@Column(name = "qu_useruu")
	private Long userUU;

	/**
	 * 客户UU
	 */
	@Column(name = "qu_custuu")
	private Long custUU;

	/**
	 * 客户联系人UU
	 */
	@Column(name = "qu_custuseruu")
	private Long custUserUU;

	/**
	 * 录入日期（有效开始日期）
	 */
	@Column(name = "qu_date")
	private Date date;

	/**
	 * 有效截止日期
	 */
	@Column(name = "qu_enddate")
	private Date endDate;

	/**
	 * 币种
	 */
	@Column(name = "qu_currency")
	private String currency;

	/**
	 * 汇率
	 */
	@Column(name = "qu_rate")
	private Float rate;

	/**
	 * 税率
	 */
	@Column(name = "qu_taxrate")
	private Float taxrate;

	/**
	 * 备注
	 */
	@Column(name = "qu_remark")
	private String remark;

	/**
	 * （对买家）传输状态
	 */
	@Column(name = "qu_sendstatus")
	private Short sendStatus;

	/**
	 * 报价明细
	 */
	@OneToMany(mappedBy = "quotation", cascade = { CascadeType.REFRESH, CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.MERGE }, fetch = FetchType.EAGER)
	@OrderBy("number")
	private Set<SaleQuotationItem> quotationItems;

	public Long getId() {
		return id;
	}

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

	public String getCode() {
		return code;
	}

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

	public Long getEnUU() {
		return enUU;
	}

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

	public Date getDate() {
		return date;
	}

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

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public String getCurrency() {
		return currency;
	}

	public void setCurrency(String currency) {
		this.currency = currency;
	}

	public Float getRate() {
		return rate;
	}

	public void setRate(Float rate) {
		this.rate = rate;
	}

	public Float getTaxrate() {
		return taxrate;
	}

	public void setTaxrate(Float taxrate) {
		this.taxrate = taxrate;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Long getCustUU() {
		return custUU;
	}

	public void setCustUU(Long custUU) {
		this.custUU = custUU;
	}

	public Long getCustUserUU() {
		return custUserUU;
	}

	public void setCustUserUU(Long custUserUU) {
		this.custUserUU = custUserUU;
	}

	public Short getSendStatus() {
		return sendStatus;
	}

	public void setSendStatus(Short sendStatus) {
		this.sendStatus = sendStatus;
	}
	
	public Long getUserUU() {
		return userUU;
	}

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

	public Set<SaleQuotationItem> getQuotationItems() {
		return quotationItems;
	}

	public void setQuotationItems(Set<SaleQuotationItem> quotationItems) {
		this.quotationItems = quotationItems;
	}

}
