package com.uas.platform.b2b.history.model;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import com.uas.platform.b2b.model.Product;

/**
 * 主动报价单明细（历史数据）
 * 
 * @author yingp
 * 
 */
@Table(name = "sale$quotationitem$his")
@Entity(name = "SaleQuotationItemHistory")
public class SaleQuotationItem {

	@Id
	@Column(name = "qd_id")
	private Long id;

	/**
	 * 序号
	 */
	@Column(name = "qd_number")
	private Short number;

	/**
	 * 关联主动报价单主记录
	 */
	@ManyToOne(cascade = CascadeType.ALL, optional = true)
	@JoinColumn(name = "qd_quid", nullable = false)
	private SaleQuotation quotation;

	/**
	 * 产品
	 */
	@OneToOne(cascade = { CascadeType.REFRESH })
	@JoinColumn(name = "qd_prid", insertable = false, updatable = false)
	private Product product;

	@Column(name = "qd_prid")
	private Long productId;

	/**
	 * 客户料
	 */
	@Column(name = "qd_custprcode")
	private String custProductCode;

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

	/**
	 * 最小订购量
	 */
	@Column(name = "qd_minorderqty")
	private Double minOrderQty;

	/**
	 * 最小包装量
	 */
	@Column(name = "qd_minpackqty")
	private Double minPackQty;

	/**
	 * 分段报价明细
	 */
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@JoinColumn(name = "qdd_qdid")
	@OrderBy("lapQty")
	private Set<SaleQuotationPrice> prices;
	
	/**
	 * 是否采纳
	 */
	@Column(name = "qd_agreed")
	private Short agreed;

	/**
	 * (针对卖家的)是否采纳信息传输状态{待上传、已下载}
	 */
	@Column(name = "qd_decidestatus")
	private Short decideStatus;

	public Long getId() {
		return id;
	}

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

	public Short getNumber() {
		return number;
	}

	public void setNumber(Short number) {
		this.number = number;
	}

	public SaleQuotation getQuotation() {
		return quotation;
	}

	public void setQuotation(SaleQuotation quotation) {
		this.quotation = quotation;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public String getCustProductCode() {
		return custProductCode;
	}

	public void setCustProductCode(String custProductCode) {
		this.custProductCode = custProductCode;
	}

	public Long getProductId() {
		return productId;
	}

	public void setProductId(Long productId) {
		this.productId = productId;
	}

	public String getRemark() {
		return remark;
	}

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

	public Double getMinOrderQty() {
		return minOrderQty;
	}

	public void setMinOrderQty(Double minOrderQty) {
		this.minOrderQty = minOrderQty;
	}

	public Double getMinPackQty() {
		return minPackQty;
	}

	public void setMinPackQty(Double minPackQty) {
		this.minPackQty = minPackQty;
	}

	public Set<SaleQuotationPrice> getPrices() {
		return prices;
	}

	public void setPrices(Set<SaleQuotationPrice> prices) {
		this.prices = prices;
	}

	public Short getAgreed() {
		return agreed;
	}

	public void setAgreed(Short agreed) {
		this.agreed = agreed;
	}

	public Short getDecideStatus() {
		return decideStatus;
	}

	public void setDecideStatus(Short decideStatus) {
		this.decideStatus = decideStatus;
	}

}
