package com.uas.platform.b2b.model;

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

/**
 * 买家的委外验退单
 * 
 * @author aof
 * @date 2015年8月26日
 */
@Table(name = "make$return", indexes = {
		@Index(name = "make_return_code_index", columnList = "mr_code"),
		@Index(name = "make_return_enuu_index", columnList = "mr_enuu"),
		@Index(name = "make_return_venduu_index", columnList = "mr_venduu"),
		@Index(name = "make_return_enuu_code_index", columnList = "mr_code,mr_enuu", unique = true)
})
@Entity
public class MakeReturn implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 主键ID
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "mr_id")
	private Long id;

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

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

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

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

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

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

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

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

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

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

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

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

	/**
	 * 应付供应商名称
	 */
	@Column(name = "mr_receivename")
	private String receiveName;

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

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

	/**
	 * 对应erpid
	 * 
	 * @return
	 */
	@Column(name = "mr_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 Date getDate() {
		return date;
	}

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

	public Long getEnUU() {
		return enUU;
	}

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

	public String getSendCode() {
		return sendCode;
	}

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

	public String getPayments() {
		return payments;
	}

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

	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 Short getNonPosting() {
		return nonPosting;
	}

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

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public Set<MakeReturnItem> getReturnItems() {
		return returnItems;
	}

	public void setReturnItems(Set<MakeReturnItem> returnItems) {
		this.returnItems = returnItems;
	}

	public String getReceiveCode() {
		return receiveCode;
	}

	public void setReceiveCode(String receiveCode) {
		this.receiveCode = receiveCode;
	}

	public String getReceiveName() {
		return receiveName;
	}

	public void setReceiveName(String receiveName) {
		this.receiveName = receiveName;
	}

	public Long getErpId() {
		return erpId;
	}

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

}
