package com.uas.platform.b2b.model;

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

import org.codehaus.jackson.annotate.JsonIgnore;

/**
 * 平台里面，供应商发起的发货单明细
 * 
 * @author yingp
 * 
 */
@Table(name = "sale$senditem")
@Entity
public class SaleSendItem {

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

	/**
	 * 序号
	 */
	@Column(name = "si_number")
	private Short number;

	/**
	 * 客户送货提醒单
	 */
	@OneToOne(cascade = { CascadeType.REFRESH })
	@JoinColumn(name = "si_noticeid", insertable = false, updatable = false, nullable = false)
	private PurchaseNotice notice;

	@Column(name = "si_noticeid")
	private Long noticeId;

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

	/**
	 * 单价
	 */
	@Column(name = "si_price")
	private Double price;

	/**
	 * 发货单
	 */
	@ManyToOne(cascade = CascadeType.ALL, optional = true)
	@JoinColumn(name = "si_ssid", nullable = false)
	private SaleSend send;

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

	public Long getId() {
		return id;
	}

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

	public Short getNumber() {
		return number;
	}

	public void setNumber(Short number) {
		this.number = number;
	}

	@JsonIgnore
	public PurchaseNotice getNotice() {
		return notice;
	}

	public void setNotice(PurchaseNotice notice) {
		this.notice = notice;
	}

	public Double getQty() {
		return qty;
	}

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

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public SaleSend getSend() {
		return send;
	}

	public void setSend(SaleSend send) {
		this.send = send;
	}

	public String getRemark() {
		return remark;
	}

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

	public Long getNoticeId() {
		return noticeId;
	}

	public void setNoticeId(Long noticeId) {
		this.noticeId = noticeId;
	}

}
