package com.uas.platform.b2b.model;

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

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.OrderBy;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnore;

import com.alibaba.fastjson.annotation.JSONField;

/**
 * 
 * 针对应付对账单明细回复记录
 * 
 * @author suntg
 * @date 2015年10月12日 15:23:16
 */
@Table(name = "sale$archeckreply")
@Entity
public class SaleARCheckReply implements Serializable {

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

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

	/**
	 * 回复时日期
	 */
	@Column(name = "sacr_date")
	@OrderBy
	private Date date;

	/**
	 * 采购订单明细
	 */
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH })
	@JoinColumn(name = "sacr_itemid", insertable = false, updatable = false)
	private SaleARCheckItem item;
	
	/**
	 * 对账单明细id
	 */
	@Column(name = "sacr_itemid")
	private Long itemId;

	/**
	 * 数量
	 */
	@Column(name = "sacr_qty")
	private Double qty;

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

	/**
	 * (回传到卖家ERP的)传输状态{待上传、已下载}
	 */
	@Column(name = "sacr_sendstatus")
	private Short sendStatus;

	/**
	 * 回复人
	 */
	@Column(name = "sacr_recorder")
	private String recorder;

	/**
	 * 类型{供应商ERP回复、供应商平台回复、采购主动回复}
	 */
	@Column(name = "sacr_type")
	private String type;

	public Long getId() {
		return id;
	}

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

	public Date getDate() {
		return date;
	}

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

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

	public Double getQty() {
		return qty;
	}
	
	@JsonIgnore
	@JSONField(serialize = false)
	public SaleARCheckItem getItem() {
		return item;
	}

	public void setItem(SaleARCheckItem item) {
		this.item = item;
	}

	public Long getItemId() {
		return itemId;
	}

	public void setItemId(Long itemId) {
		this.itemId = itemId;
	}

	public String getRemark() {
		return remark;
	}

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

	public Short getSendStatus() {
		return sendStatus;
	}

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

	public String getRecorder() {
		return recorder;
	}

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

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	/**
	 * 回复详情
	 * 
	 * @return
	 */
	public String replyDescription() {
		return this.recorder + "确认数量：" + this.qty;
	}
	
}
