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

import java.util.Date;

import com.uas.platform.b2b.model.PurchaseNotice;
import com.uas.platform.b2b.model.PurchaseOrder;
import com.uas.platform.b2b.model.PurchaseOrderItem;
import com.uas.platform.b2b.support.SystemSession;
import com.uas.platform.core.model.Status;

/**
 * 买家ERP系统的送货提醒单（提醒卖家发货）
 * 
 * @author yingp
 * 
 */
public class PurchaseNotify {

	private long pn_id;
	private long ve_uu;
	private Date pn_indate;
	private Double pn_qty;
	private Date pn_delivery;
	private String pn_ordercode;
	private Short pn_orderdetno;
	private String pn_remark;
	private Double pn_endqty;

	public long getPn_id() {
		return pn_id;
	}

	public void setPn_id(long pn_id) {
		this.pn_id = pn_id;
	}

	public Date getPn_indate() {
		return pn_indate;
	}

	public void setPn_indate(Date pn_indate) {
		this.pn_indate = pn_indate;
	}

	public Double getPn_qty() {
		return pn_qty;
	}

	public void setPn_qty(Double pn_qty) {
		this.pn_qty = pn_qty;
	}

	public Date getPn_delivery() {
		return pn_delivery;
	}

	public void setPn_delivery(Date pn_delivery) {
		this.pn_delivery = pn_delivery;
	}

	public String getPn_ordercode() {
		return pn_ordercode;
	}

	public void setPn_ordercode(String pn_ordercode) {
		this.pn_ordercode = pn_ordercode;
	}

	public Short getPn_orderdetno() {
		return pn_orderdetno;
	}

	public void setPn_orderdetno(Short pn_orderdetno) {
		this.pn_orderdetno = pn_orderdetno;
	}

	public String getPn_remark() {
		return pn_remark;
	}

	public void setPn_remark(String pn_remark) {
		this.pn_remark = pn_remark;
	}

	public Double getPn_endqty() {
		return pn_endqty;
	}

	public void setPn_endqty(Double pn_endqty) {
		this.pn_endqty = pn_endqty;
	}

	public long getVe_uu() {
		return ve_uu;
	}

	public void setVe_uu(long ve_uu) {
		this.ve_uu = ve_uu;
	}

	/**
	 * 转为平台的客户送货提醒
	 * 
	 * @return
	 */
	public PurchaseNotice convert() {
		PurchaseNotice notice = new PurchaseNotice();
		notice.setSourceId(pn_id);
		notice.setDate(pn_indate);
		notice.setDelivery(pn_delivery);
		notice.setEndQty(pn_endqty);
		notice.setEnUU(SystemSession.getUser().getEnterprise().getUu());
		notice.setQty(pn_qty);
		notice.setRemark(pn_remark);
		notice.setVendUU(ve_uu);
		PurchaseOrder order = new PurchaseOrder();
		order.setCode(pn_ordercode);
		PurchaseOrderItem orderItem = new PurchaseOrderItem();
		orderItem.setNumber(pn_orderdetno);
		orderItem.setOrder(order);
		notice.setOrderItem(orderItem);
		notice.setStatus((short) Status.NOT_REPLY.value());
		notice.setSendStatus((short) Status.NOT_UPLOAD.value());
		return notice;
	}

}
