package com.uas.platform.b2b.model;

import java.io.Serializable;
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;

/**
 * 平台里面，供应商发起的发货单<br>
 * （以供应商的视角）
 * 
 * @author yingp
 * 
 */
@Table(name = "sale$send")
@Entity
public class SaleSend implements Serializable {

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

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sale$send_gen")
	@SequenceGenerator(name = "sale$send_gen", sequenceName = "sale$send_seq", allocationSize = 1)
	@Column(name = "ss_id")
	private Long id;

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

	/**
	 * 发货单 所属企业(卖家)UU
	 */
	@Column(name = "ss_enuu")
	private Long enUU;

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

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

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

	/**
	 * 客户企业UU
	 */
	@Column(name = "ss_custuu")
	private Long custUU;

	/**
	 * 客户联系人UU
	 */
	@Column(name = "ss_custuseruu")
	private Long custUserUU;

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

	/**
	 * 发货明细
	 */
	@OneToMany(mappedBy = "send", cascade = { CascadeType.REFRESH, CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.MERGE }, fetch = FetchType.EAGER)
	@OrderBy("number")
	private Set<SaleSendItem> sendItems;

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

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

	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 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 getCustUU() {
		return custUU;
	}

	public void setCustUU(Long custUU) {
		this.custUU = custUU;
	}

	public Long getCustUserUU() {
		return custUserUU;
	}

	public void setCustUserUU(Long custUserUU) {
		this.custUserUU = custUserUU;
	}

	public String getRemark() {
		return remark;
	}

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

	public Set<SaleSendItem> getSendItems() {
		return sendItems;
	}

	public void setSendItems(Set<SaleSendItem> sendItems) {
		this.sendItems = sendItems;
	}

	public Short getSendStatus() {
		return sendStatus;
	}

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

	public Short getBackStatus() {
		return backStatus;
	}

	public void setBackStatus(Short backStatus) {
		this.backStatus = backStatus;
	}

}
