package com.uas.platform.b2b.erp.model;

import com.uas.platform.b2b.model.PurchaseNotice;
import com.uas.platform.b2b.model.SaleSendItem;

/**
 * 卖家ERP系统的发货单明细
 * 
 * @author yingp
 * 
 */
public class SaleOutDetail {

	private short pd_pdno;
	private Double pd_outqty;
	private Double pd_sendprice;
	/**
	 * 关联的送货提醒单ID
	 */
	private Long b2b_pn_id;

	public short getPd_pdno() {
		return pd_pdno;
	}

	public void setPd_pdno(short pd_pdno) {
		this.pd_pdno = pd_pdno;
	}

	public Double getPd_outqty() {
		return pd_outqty;
	}

	public void setPd_outqty(Double pd_outqty) {
		this.pd_outqty = pd_outqty;
	}

	public Double getPd_sendprice() {
		return pd_sendprice;
	}

	public void setPd_sendprice(Double pd_sendprice) {
		this.pd_sendprice = pd_sendprice;
	}

	public Long getB2b_pn_id() {
		return b2b_pn_id;
	}

	public void setB2b_pn_id(Long b2b_pn_id) {
		this.b2b_pn_id = b2b_pn_id;
	}

	public SaleOutDetail() {
	}

	/**
	 * 平台的发货单，传到卖家平台
	 * 
	 * @param item
	 */
	public SaleOutDetail(SaleSendItem item) {
		this.b2b_pn_id = item.getNotice().getId();
		this.pd_outqty = item.getQty();
		this.pd_pdno = item.getNumber();
		this.pd_sendprice = item.getPrice();
	}

	public SaleSendItem convert() {
		SaleSendItem item = new SaleSendItem();
		item.setNumber(this.pd_pdno);
		item.setPrice(this.pd_sendprice);
		item.setQty(this.pd_outqty);
		PurchaseNotice notice = new PurchaseNotice();
		notice.setId(this.b2b_pn_id);
		item.setNotice(notice);
		item.setNoticeId(this.b2b_pn_id);
		return item;
	}

}
