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

import java.util.Date;

import com.uas.platform.b2b.model.Product;
import com.uas.platform.b2b.model.PurchaseOrderAllItem;
import com.uas.platform.b2b.support.SystemSession;
import com.uas.platform.core.model.Status;

/**
 * ERP系统的采购订单明细
 * 
 * @author yingp
 * 
 */
public class PurchaseDetail {

	private String pd_code;
	private String pd_prodcode;
	private Double pd_qty;
	private Double pd_price;
	private Date pd_delivery;
	private String pd_remark;
	private Float pd_rate;
	private short pd_detno;

	public String getPd_code() {
		return pd_code;
	}

	public void setPd_code(String pd_code) {
		this.pd_code = pd_code;
	}

	public String getPd_prodcode() {
		return pd_prodcode;
	}

	public void setPd_prodcode(String pd_prodcode) {
		this.pd_prodcode = pd_prodcode;
	}

	public Double getPd_qty() {
		return pd_qty;
	}

	public void setPd_qty(Double pd_qty) {
		this.pd_qty = pd_qty;
	}

	public Double getPd_price() {
		return pd_price;
	}

	public void setPd_price(Double pd_price) {
		this.pd_price = pd_price;
	}

	public Date getPd_delivery() {
		return pd_delivery;
	}

	public void setPd_delivery(Date pd_delivery) {
		this.pd_delivery = pd_delivery;
	}

	public String getPd_remark() {
		return pd_remark;
	}

	public void setPd_remark(String pd_remark) {
		this.pd_remark = pd_remark;
	}

	public Float getPd_rate() {
		return pd_rate;
	}

	public void setPd_rate(Float pd_rate) {
		this.pd_rate = pd_rate;
	}

	public short getPd_detno() {
		return pd_detno;
	}

	public void setPd_detno(short pd_detno) {
		this.pd_detno = pd_detno;
	}

	/**
	 * 转为平台的采购订单明细
	 * 
	 * @return
	 */
	public PurchaseOrderAllItem convert() {
		PurchaseOrderAllItem item = new PurchaseOrderAllItem();
		item.setDelivery(this.pd_delivery);
		item.setNumber(this.pd_detno);
		item.setPrice(this.pd_price);
		item.setQty(this.pd_qty);
		item.setTaxrate(this.pd_rate);
		item.setStatus((short) Status.NOT_REPLY.value());
		Product product = new Product();
		product.setCode(this.pd_prodcode);
		product.setEnUU(SystemSession.getUser().getEnterprise().getUu());
		item.setProduct(product);
		return item;
	}

}
