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$apbillitem")
@Entity
public class PurchaseApBillItem {

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

	/**
	 * 明细序号
	 */
	@Column(name = "papi_number")
	private Short number;

	/**
	 * 采购单号
	 */
	@Column(name = "papi_ordercode")
	private String orderCode;

	/**
	 * 采购单明细序号
	 */
	@Column(name = "papi_orderdetno")
	private Short orderDetno;

	/**
	 * 出入库单号
	 */
	@Column(name = "papi_pdinoutno")
	private String pdinoutNo;
	
	/**
	 * 物料
	 */
	@OneToOne(cascade = { CascadeType.REFRESH })
	@JoinColumn(name = "papi_product", updatable = false)
	private Product product;

	/**
	 * 数量
	 */
	@Column(name = "papi_thisvoqty")
	private Double thisvoQty;

	/**
	 * 采购单价
	 */
	@Column(name = "papi_price")
	private Double price;

	/**
	 * 税率s
	 */
	@Column(name = "papi_taxrate")
	private Double taxrate;

	/**
	 * 单据金额
	 */
	@Column(name = "papi_amount")
	private Double amount;

	/**
	 * 累计开票金额
	 */
	@Column(name = "papi_totalbillprice")
	private Double totalBillPrice;

	/**
	 * 本次开票数量
	 */
	@Column(name = "papi_qty")
	private Double qty;

	/**
	 * 本次开票单价
	 */
	@Column(name = "papi_thisvoprice")
	private Double thisvoPrice;

	/**
	 * 本次开票金额
	 */
	@Column(name = "papi_apamount")
	private Double apAmount;

	/**
	 * 本次 开票不含税金额
	 */
	@Column(name = "papi_noapamount")
	private Double noApAmount;

	/**
	 * 本次开票税额
	 */
	@Column(name = "papi_taxamount")
	private Double taxAmount;

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

	/**
	 * 已开票数
	 */
	@Column(name = "papi_invoqty")
	private Double invoQty;

	/**
	 * 已转开票记录数
	 */
	@Column(name = "papi_yqty")
	private Double yQty;
	
	/**
	 * 不良品入库单主记录
	 */
	@ManyToOne(cascade = CascadeType.ALL, optional = true)
	@JoinColumn(name = "papi_papid", nullable = false)
	private PurchaseApBill aPBill;

	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 String getOrderCode() {
		return orderCode;
	}

	public void setOrderCode(String orderCode) {
		this.orderCode = orderCode;
	}

	public Short getOrderDetno() {
		return orderDetno;
	}

	public void setOrderDetno(Short orderDetno) {
		this.orderDetno = orderDetno;
	}

	public String getPdinoutNo() {
		return pdinoutNo;
	}

	public void setPdinoutNo(String pdinoutNo) {
		this.pdinoutNo = pdinoutNo;
	}

	public Product getProduct() {
		return product;
	}

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

	public Double getThisvoQty() {
		return thisvoQty;
	}

	public void setThisvoQty(Double thisvoQty) {
		this.thisvoQty = thisvoQty;
	}

	public Double getPrice() {
		return price;
	}

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

	public Double getTaxrate() {
		return taxrate;
	}

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

	public Double getAmount() {
		return amount;
	}

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

	public Double getTotalBillPrice() {
		return totalBillPrice;
	}

	public void setTotalBillPrice(Double totalBillPrice) {
		this.totalBillPrice = totalBillPrice;
	}

	public Double getQty() {
		return qty;
	}

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

	public Double getThisvoPrice() {
		return thisvoPrice;
	}

	public void setThisvoPrice(Double thisvoPrice) {
		this.thisvoPrice = thisvoPrice;
	}

	public Double getApAmount() {
		return apAmount;
	}

	public void setApAmount(Double apAmount) {
		this.apAmount = apAmount;
	}

	public Double getNoApAmount() {
		return noApAmount;
	}

	public void setNoApAmount(Double noApAmount) {
		this.noApAmount = noApAmount;
	}

	public Double getTaxAmount() {
		return taxAmount;
	}

	public void setTaxAmount(Double taxAmount) {
		this.taxAmount = taxAmount;
	}

	public String getRemark() {
		return remark;
	}

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

	@JsonIgnore
	public PurchaseApBill getaPBill() {
		return aPBill;
	}

	public void setaPBill(PurchaseApBill aPBill) {
		this.aPBill = aPBill;
	}

	public Double getInvoQty() {
		return invoQty;
	}

	public void setInvoQty(Double invoQty) {
		this.invoQty = invoQty;
	}

	public Double getyQty() {
		return yQty;
	}

	public void setyQty(Double yQty) {
		this.yQty = yQty;
	}
	
	
	
	

}
