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

import java.util.Date;

import com.uas.platform.b2b.model.Product;
import com.uas.platform.b2b.model.PurchaseOrderChangeItem;
import com.uas.platform.b2b.model.PurchaseOrderItem;
import com.uas.platform.b2b.support.SystemSession;

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

	private short pcd_detno;
	private short pcd_pddetno;
	private String pcd_prodcode;
	private String pcd_newprodcode;
	private Double pcd_newqty;
	private Double pcd_newprice;
	private Date pcd_newdelivery;
	private Float pcd_newtaxrate;
	private String pcd_remark;

	public short getPcd_detno() {
		return pcd_detno;
	}

	public void setPcd_detno(short pcd_detno) {
		this.pcd_detno = pcd_detno;
	}

	public short getPcd_pddetno() {
		return pcd_pddetno;
	}

	public void setPcd_pddetno(short pcd_pddetno) {
		this.pcd_pddetno = pcd_pddetno;
	}

	public String getPcd_prodcode() {
		return pcd_prodcode;
	}

	public void setPcd_prodcode(String pcd_prodcode) {
		this.pcd_prodcode = pcd_prodcode;
	}

	public String getPcd_newprodcode() {
		return pcd_newprodcode;
	}

	public void setPcd_newprodcode(String pcd_newprodcode) {
		this.pcd_newprodcode = pcd_newprodcode;
	}

	public Double getPcd_newqty() {
		return pcd_newqty;
	}

	public void setPcd_newqty(Double pcd_newqty) {
		this.pcd_newqty = pcd_newqty;
	}

	public Double getPcd_newprice() {
		return pcd_newprice;
	}

	public void setPcd_newprice(Double pcd_newprice) {
		this.pcd_newprice = pcd_newprice;
	}

	public Date getPcd_newdelivery() {
		return pcd_newdelivery;
	}

	public void setPcd_newdelivery(Date pcd_newdelivery) {
		this.pcd_newdelivery = pcd_newdelivery;
	}

	public Float getPcd_newtaxrate() {
		return pcd_newtaxrate;
	}

	public void setPcd_newtaxrate(Float pcd_newtaxrate) {
		this.pcd_newtaxrate = pcd_newtaxrate;
	}

	public String getPcd_remark() {
		return pcd_remark;
	}

	public void setPcd_remark(String pcd_remark) {
		this.pcd_remark = pcd_remark;
	}

	/**
	 * 转为平台的采购订单变更单明细
	 * 
	 * @return
	 */
	public PurchaseOrderChangeItem convert() {
		PurchaseOrderChangeItem changeItem = new PurchaseOrderChangeItem();
		changeItem.setNewDelivery(this.pcd_newdelivery);
		changeItem.setNewPrice(this.pcd_newprice);
		changeItem.setNewQty(this.pcd_newqty);
		changeItem.setNewTaxrate(this.pcd_newtaxrate);
		changeItem.setNumber(this.pcd_detno);
		changeItem.setRemark(this.pcd_remark);
		PurchaseOrderItem orderItem = new PurchaseOrderItem();
		orderItem.setNumber(this.pcd_pddetno);
		changeItem.setOrderItem(orderItem);
		Product newProduct = new Product();
		newProduct.setEnUU(SystemSession.getUser().getEnterprise().getUu());
		newProduct.setCode(this.pcd_newprodcode);
		changeItem.setNewProduct(newProduct);
		return changeItem;
	}

}
