package com.uas.platform.b2b.model;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;

/**
 * 买家的采购验收单
 * 
 * @author yingp
 * 
 */
@Table(name = "purc$accept", indexes = {
		@Index(name = "unique_enuu_code", columnList = "pa_enuu,pa_code", unique = true),
		@Index(name = "pa_venduu_index", columnList = "pa_venduu"),
        @Index(name = "pa_enuu_index", columnList = "pa_enuu")
})
@Entity
public class PurchaseAccept implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "pa_id")
	private Long id;

	/**
	 * 单号
	 */
	@Column(name = "pa_code")
	private String code;

	/**
	 * 日期
	 */
	@Column(name = "pa_date")
	private Date date;

	/**
	 * 验收单 所属企业(买家)UU
	 */
	@Column(name = "pa_enuu")
	private Long enUU;

	/**
	 * 验收单 所属企业(买家)
	 */
	@OneToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH })
	@JoinColumn(name = "pa_enuu", insertable = false, updatable = false)
	private EnterpriseInfo enterprise;

	/**
	 * 送货单号
	 */
	@Column(name = "pa_sendcode")
	private String sendCode;

	/**
	 * 付款方式
	 */
	@Column(name = "pa_payments")
	private String payments;

	/**
	 * 币别
	 */
	@Column(name = "pa_currency")
	private String currency;

	/**
	 * 汇率
	 */
	@Column(name = "pa_rate")
	private Float rate;

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

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

	/**
	 * 录单人
	 */
	@Column(name = "pa_recorder")
	private String recorder;

	/**
	 * （对卖家）传输状态
	 */
	@Column(name = "pa_sendstatus")
	private Short sendStatus;

	/**
	 * 应付供应商名
	 */
	@Column(name = "pa_receivename")
	private String receivename;

	/**
	 * 应付供应商编号
	 */
	@Column(name = "pa_receivecode")
	private String receivecode;

	/**
	 * 验收明细
	 */
	@OneToMany(mappedBy = "accept", cascade = { CascadeType.REFRESH, CascadeType.PERSIST, CascadeType.REMOVE,
			CascadeType.MERGE }, fetch = FetchType.EAGER)
	@OrderBy("number")
	private Set<PurchaseAcceptItem> acceptItems;

	/**
	 * 已反过账(1 已反过账, 0|空 未反过账(默认未空))
	 */
	@Column(name = "pa_nonposting")
	private Short nonPosting;

	/**
	 * erpId
	 * 
	 * @return
	 */
	@Column(name = "pa_erpid")
	private Long erpId;

	public Long getId() {
		return id;
	}

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

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public Long getEnUU() {
		return enUU;
	}

	public void setEnUU(Long enUU) {
		this.enUU = enUU;
	}

	public String getPayments() {
		return payments;
	}

	public void setPayments(String payments) {
		this.payments = payments;
	}

	public String getSendCode() {
		return sendCode;
	}

	public void setSendCode(String sendCode) {
		this.sendCode = sendCode;
	}

	public String getCurrency() {
		return currency;
	}

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

	public Float getRate() {
		return rate;
	}

	public void setRate(Float rate) {
		this.rate = rate;
	}

	public Long getVendUU() {
		return vendUU;
	}

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

	public String getRemark() {
		return remark;
	}

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

	public String getRecorder() {
		return recorder;
	}

	public void setRecorder(String recorder) {
		this.recorder = recorder;
	}

	public Short getSendStatus() {
		return sendStatus;
	}

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

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public Set<PurchaseAcceptItem> getAcceptItems() {
		return acceptItems;
	}

	public void setAcceptItems(Set<PurchaseAcceptItem> acceptItems) {
		this.acceptItems = acceptItems;
	}

	public Short getNonPosting() {
		return nonPosting;
	}

	public void setNonPosting(Short nonPosting) {
		this.nonPosting = nonPosting;
	}

	public String getReceivename() {
		return receivename;
	}

	public void setReceivename(String receivename) {
		this.receivename = receivename;
	}

	public String getReceivecode() {
		return receivecode;
	}

	public void setReceivecode(String receivecode) {
		this.receivecode = receivecode;
	}

	public Long getErpId() {
		return erpId;
	}

	public void setErpId(Long erpId) {
		this.erpId = erpId;
	}

	public EnterpriseInfo getEnterprise() {
		return enterprise;
	}

	public void setEnterprise(EnterpriseInfo enterprise) {
		this.enterprise = enterprise;
	}

}
