package com.uas.platform.b2b.model;

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;

/**
 * 买家的采购验退单明细
 * 
 * @author suntg
 * 
 */
@Table(name = "purc$returnitem")
@Entity
public class PurchaseReturnItem {

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

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

	/**
	 * 数量
	 */
	@Column(name = "pri_qty")
	private Double qty;
	
	/**
	 * 采购单价
	 */
	@Column(name = "pri_orderprice")
	private Double orderPrice;
	
	/**
	 * 单价
	 */
	@Column(name = "pri_taxrate")
	private Double taxrate;

	/**
	 * 验收单主记录
	 */
	@ManyToOne(cascade = CascadeType.ALL, optional = true)
	@JoinColumn(name = "pri_prid", nullable = false)
	private PurchaseReturn purchaseReturn;

	/**
	 * 采购订单明细
	 */
	@OneToOne(cascade = { CascadeType.REFRESH })
	@JoinColumn(name = "pri_pdid", insertable = false, updatable = false)
	private PurchaseOrderItem orderItem;

	@Column(name = "pri_pdid")
	private Long orderItemId;
	
	/**
	 * 入库批号
	 */
	@Column(name = "pri_batchcode")
	private String batchCode;

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

	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 Double getQty() {
		return qty;
	}

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

	public void setOrderPrice(Double orderPrice) {
		this.orderPrice = orderPrice;
	}

	public String getRemark() {
		return remark;
	}

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

	@JsonIgnore
	public PurchaseReturn getPurchaseReturn() {
		return purchaseReturn;
	}

	public void setPurchaseReturn(PurchaseReturn purchaseReturn) {
		this.purchaseReturn = purchaseReturn;
	}

	public PurchaseOrderItem getOrderItem() {
		return orderItem;
	}

	public void setOrderItem(PurchaseOrderItem orderItem) {
		this.orderItem = orderItem;
	}

	public Long getOrderItemId() {
		return orderItemId;
	}

	public void setOrderItemId(Long orderItemId) {
		this.orderItemId = orderItemId;
	}

	public String getBatchCode() {
		return batchCode;
	}

	public void setBatchCode(String batchCode) {
		this.batchCode = batchCode;
	}

	public Double getTaxrate() {
		return taxrate;
	}

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

}
