package com.uas.platform.b2b.model;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnore;

@Table(name = "purc$orderitems")
@Entity
public class PurchaseOrderAllItem {

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "purc$orderitems_gen")
	@SequenceGenerator(name = "purc$orderitems_gen", sequenceName = "purc$orderitems_seq", allocationSize = 1)
	@Column(name = "pd_id")
	private Long id;

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

	/**
	 * 采购订单
	 */
	@ManyToOne(cascade = CascadeType.ALL, optional = true)
	@JoinColumn(name = "pd_puid", nullable = false)
	private PurchaseOrderAll order;

	/**
	 * 产品ID
	 */
	@Column(name = "pd_prid")
	private Long productId;

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

	/**
	 * 数量
	 */
	@Column(name = "pd_qty")
	private Double qty;

	/**
	 * 已回复的数量
	 */
	@Column(name = "pd_replyqty")
	private Double replyQty;

	/**
	 * (最近一次)回复的交期
	 */
	@Column(name = "pd_replydelivery")
	private Date replyDelivery;
	
	/**
	 * (最近一次)回复的备注
	 */
	@Column(name = "pd_replyremark")
	private String replyRemark;

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

	/**
	 * 含税单价
	 */
	@Column(name = "pd_price")
	private Double price;

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

	/**
	 * 处理状态（已回复、未回复），全部回复后改为已回复
	 */
	@Column(name = "pd_status", insertable = false, updatable = false)
	private Short status;

	/**
	 * 含税金额
	 */
	@Column(name = "pd_amount", insertable = false, updatable = false)
	private Double amount;

	/**
	 * 不含税单价
	 */
	@Column(name = "pd_notaxprice", insertable = false, updatable = false)
	private Double noTaxPrice;

	/**
	 * 不含税金额
	 */
	@Column(name = "pd_notaxamount", insertable = false, updatable = false)
	private Double noTaxAmount;

	/**
	 * 交货日期
	 */
	@Column(name = "pd_delivery")
	private Date delivery;

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

	@JsonIgnore
	public PurchaseOrderAll getOrder() {
		return order;
	}

	public void setOrder(PurchaseOrderAll order) {
		this.order = order;
	}

	public Long getProductId() {
		return productId;
	}

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

	public Product getProduct() {
		return product;
	}

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

	public Double getQty() {
		return qty;
	}

	public void setQty(Double qty) {
		this.qty = qty;
	}

	public Double getReplyQty() {
		return replyQty;
	}

	public void setReplyQty(Double replyQty) {
		this.replyQty = replyQty;
	}

	public String getRemark() {
		return remark;
	}

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

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public Float getTaxrate() {
		return taxrate;
	}

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

	public Double getAmount() {
		return amount;
	}

	public void setAmount(Double amount) {
		this.amount = amount;
	}

	public Double getNoTaxPrice() {
		return noTaxPrice;
	}

	public void setNoTaxPrice(Double noTaxPrice) {
		this.noTaxPrice = noTaxPrice;
	}

	public Double getNoTaxAmount() {
		return noTaxAmount;
	}

	public void setNoTaxAmount(Double noTaxAmount) {
		this.noTaxAmount = noTaxAmount;
	}

	public Date getDelivery() {
		return delivery;
	}

	public void setDelivery(Date delivery) {
		this.delivery = delivery;
	}

	public Date getReplyDelivery() {
		return replyDelivery;
	}

	public void setReplyDelivery(Date replyDelivery) {
		this.replyDelivery = replyDelivery;
	}

	public String getReplyRemark() {
		return replyRemark;
	}

	public void setReplyRemark(String replyRemark) {
		this.replyRemark = replyRemark;
	}

	public Short getStatus() {
		return status;
	}

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