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

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.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 org.codehaus.jackson.annotate.JsonIgnore;

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

/**
 * 客户采购询价单明细（历史数据）
 * 
 * @author yingp
 *
 */
@Table(name = "purc$inquiryitems$his")
@Entity(name = "PurchaseInquiryItemHistory")
public class PurchaseInquiryItem {

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

	/**
	 * 来源（买家ERP采购询价明细）的ID
	 */
	@Column(name = "id_sourceid", updatable = false)
	private Long sourceId;

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

	/**
	 * 询价单
	 */
	@ManyToOne(cascade = CascadeType.ALL, optional = true)
	@JoinColumn(name = "id_inid", nullable = false)
	private PurchaseInquiry inquiry;

	/**
	 * 买家采购员UU
	 */
	@Column(name = "id_useruu")
	private Long userUU;

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

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

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

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

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

	/**
	 * 供应商UU
	 */
	@Column(name = "id_venduu")
	private Long vendUU;

	/**
	 * 供应商联系人UU
	 */
	@Column(name = "id_venduseruu")
	private Long vendUserUU;

	/**
	 * （买家预先提供的）有效期始
	 */
	@Column(name = "id_fromdate")
	private Date fromDate;

	/**
	 * （买家预先提供的）有效期止
	 */
	@Column(name = "id_todate")
	private Date toDate;

	/**
	 * （卖家报的）有效期始
	 */
	@Column(name = "id_vendfromdate")
	private Date vendFromDate;

	/**
	 * （卖家报的）有效期止
	 */
	@Column(name = "id_vendtodate")
	private Date vendToDate;

	/**
	 * （卖家报的）最小订购量
	 */
	@Column(name = "id_minorderqty")
	private Double minOrderQty;

	/**
	 * （卖家报的）最小包装量
	 */
	@Column(name = "id_minpackqty")
	private Double minPackQty;

	/**
	 * 分段报价明细
	 */
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@JoinColumn(name = "ir_idid")
	@OrderBy("lapQty")
	private Set<PurchaseInquiryReply> replies;

	/**
	 * {未回复、已回复}
	 */
	@Column(name = "id_status")
	private Short status;

	/**
	 * (针对卖家的)询价传输状态{待上传、已下载}
	 */
	@Column(name = "id_sendstatus")
	private Short sendStatus;

	/**
	 * (针对买家的)报价信息传输状态{待上传、已下载}
	 */
	@Column(name = "id_backstatus")
	private Short backStatus;

	/**
	 * (针对卖家的)报价信息传输状态{待上传、已下载}
	 */
	@Column(name = "id_replysendstatus")
	private Short replySendStatus;

	/**
	 * 是否采纳
	 */
	@Column(name = "id_agreed")
	private Short agreed;

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

	/**
	 * 是否买家已设置分段数
	 */
	@Column(name = "id_custlap")
	private Short custLap;

	public Long getId() {
		return id;
	}

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

	@JsonIgnore
	public Long getSourceId() {
		return sourceId;
	}

	public void setSourceId(Long sourceId) {
		this.sourceId = sourceId;
	}

	public Short getNumber() {
		return number;
	}

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

	public PurchaseInquiry getInquiry() {
		return inquiry;
	}

	public void setInquiry(PurchaseInquiry inquiry) {
		this.inquiry = inquiry;
	}

	public Product getProduct() {
		return product;
	}

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

	public Long getProductId() {
		return productId;
	}

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

	public String getCurrency() {
		return currency;
	}

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

	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 Date getFromDate() {
		return fromDate;
	}

	public void setFromDate(Date fromDate) {
		this.fromDate = fromDate;
	}

	public Date getToDate() {
		return toDate;
	}

	public void setToDate(Date toDate) {
		this.toDate = toDate;
	}

	public Date getVendFromDate() {
		return vendFromDate;
	}

	public void setVendFromDate(Date vendFromDate) {
		this.vendFromDate = vendFromDate;
	}

	public Date getVendToDate() {
		return vendToDate;
	}

	public void setVendToDate(Date vendToDate) {
		this.vendToDate = vendToDate;
	}

	public Long getVendUU() {
		return vendUU;
	}

	public void setVendUU(Long vendUU) {
		this.vendUU = vendUU;
	}

	public Set<PurchaseInquiryReply> getReplies() {
		return replies;
	}

	public void setReplies(Set<PurchaseInquiryReply> replies) {
		this.replies = replies;
	}

	public Long getVendUserUU() {
		return vendUserUU;
	}

	public void setVendUserUU(Long vendUserUU) {
		this.vendUserUU = vendUserUU;
	}

	public Short getAgreed() {
		return agreed;
	}

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

	public Short getStatus() {
		return status;
	}

	public void setStatus(Short status) {
		this.status = status;
	}

	public Short getSendStatus() {
		return sendStatus;
	}

	public void setSendStatus(Short sendStatus) {
		this.sendStatus = sendStatus;
	}

	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 Short getBackStatus() {
		return backStatus;
	}

	public void setBackStatus(Short backStatus) {
		this.backStatus = backStatus;
	}

	public Short getReplySendStatus() {
		return replySendStatus;
	}

	public void setReplySendStatus(Short replySendStatus) {
		this.replySendStatus = replySendStatus;
	}

	public Short getDecideStatus() {
		return decideStatus;
	}

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

	public Short getCustLap() {
		return custLap;
	}

	public void setCustLap(Short custLap) {
		this.custLap = custLap;
	}

	public Long getUserUU() {
		return userUU;
	}

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