package com.uas.search.console.b2b.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * 采购单明细
 * 
 * @author sunyj
 * @since 2016年11月9日 下午2:51:26
 */
@Entity
@Table(name = "purc$orderitems")
public class PurchaseOrderItemSimpleInfo {

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

	/**
	 * 数量 （数量用于判断是否为待交货）
	 */
	@Column(name = "pd_qty")
	private Double qty;

	/**
	 * 客户已验收数量
	 */
	@Column(name = "pd_acceptqty")
	private Double acceptQty;

	/**
	 * 客户验退数量
	 */
	@Column(name = "pd_returnqty")
	private Double returnQty;

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

	/**
	 * 采购单
	 */
	@OneToOne(cascade = { CascadeType.REFRESH })
	@JoinColumn(name = "pd_puid", insertable = false, updatable = false)
	private PurchaseOrderSimpleInfo2 purchaseOrder;

	public Long getId() {
		return id;
	}

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

	public ProductSimpleInfo getProduct() {
		return product;
	}

	public Double getQty() {
		if (null == qty) {
			return (double) 0;
		}
		return qty;
	}

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

	public Double getAcceptQty() {
		if (null == acceptQty) {
			return (double) 0;
		}
		return acceptQty;
	}

	public void setAcceptQty(Double acceptQty) {
		this.acceptQty = acceptQty;
	}

	public Double getReturnQty() {
		if (null == returnQty) {
			return (double) 0;
		}
		return returnQty;
	}

	public void setReturnQty(Double returnQty) {
		this.returnQty = returnQty;
	}

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

	public PurchaseOrderSimpleInfo2 getPurchaseOrder() {
		return purchaseOrder;
	}

	public void setPurchaseOrder(PurchaseOrderSimpleInfo2 purchaseOrder) {
		this.purchaseOrder = purchaseOrder;
	}

	@Override
	public String toString() {
		return "PurchaseOrderItemSimpleInfo [id=" + id + ", qty=" + qty + ", acceptQty=" + acceptQty + ", returnQty="
				+ returnQty + ", product=" + product + ", purchaseOrder=" + purchaseOrder + "]";
	}

}
