package com.uas.platform.b2b.model;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * 买家的不良品入库单
 * 
 * @author suntg
 * 
 */
@Table(name = "purc$badin")
@Entity
public class PurchaseBadIn implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1712055713281560008L;

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

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

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

	/**
	 * 验收单 所属企业(买家)UU
	 */
	@Column(name = "pb_enuu")
	private Long enUU;
	
	/**
	 * 送货单号
	 */
	@Column(name = "pb_sendcode")
	private String sendCode;

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

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

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

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

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

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

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

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

	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<PurchaseBadInItem> getBadInItems() {
		return badInItems;
	}

	public void setBadInItems(Set<PurchaseBadInItem> badInItems) {
		this.badInItems = badInItems;
	}

}
