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

import java.sql.Date;
import java.util.List;

import com.uas.platform.b2b.model.EnterpriseInfo;
import com.uas.platform.b2b.model.MakeOrder;
import com.uas.platform.b2b.support.SystemSession;
import com.uas.platform.core.model.Constant;
import com.uas.platform.core.model.Status;

/**
 * ERP系统的委外加工单
 * 
 * @author suntg
 */
public class Make {

	/**
	 * id
	 */
	private Long ma_id;

	/**
	 * 委外编号
	 */
	private String ma_code;

	/**
	 * 单据日期
	 */
	private Date ma_date;

	/**
	 * 单据类型
	 */
	private String ma_tasktype;

	/**
	 * 需求日期
	 */
	private Date ma_requiredate;

	/**
	 * 供应商UU号
	 */
	private Long ve_uu;

	/**
	 * 物料编号
	 */
	private String ma_prodcode;

	/**
	 * 需求数量
	 */
	private Double ma_qty;

	/**
	 * 已生产数
	 */
	private Double ma_makeqty;

	/**
	 * 工单类型
	 */
	private String ma_kind;

	/**
	 * 加工单价
	 */
	private Double ma_price;

	/**
	 * 加工金额
	 */
	private Double ma_total;

	/**
	 * 币别
	 */
	private String ma_currency;

	/**
	 * 汇率
	 */
	private Float ma_rate;

	/**
	 * 税率
	 */
	private Float ma_taxrate;

	/**
	 * 收货地址
	 */
	private String ma_shipaddresscode;

	/**
	 * 付款方式
	 */
	private String ma_payments;

	/**
	 * 录入人
	 */
	private String ma_recorder;

	/**
	 * 计划开工日期
	 */
	private Date ma_planbegindate;

	/**
	 * 计划完工日期
	 */
	private Date ma_planenddate;

	/**
	 * 审核人
	 */
	private String ma_auditman;

	/**
	 * 备注
	 */
	private String ma_remark;

	/**
	 * 送货工厂
	 */
	private String ma_factory;

	/**
	 * 用料明细
	 */
	private List<MakeMaterial> materials;

	public String getMa_factory() {
		return ma_factory;
	}

	public void setMa_factory(String ma_factory) {
		this.ma_factory = ma_factory;
	}

	public Long getMa_id() {
		return ma_id;
	}

	public void setMa_id(Long ma_id) {
		this.ma_id = ma_id;
	}

	public String getMa_code() {
		return ma_code;
	}

	public void setMa_code(String ma_code) {
		this.ma_code = ma_code;
	}

	public Date getMa_date() {
		return ma_date;
	}

	public void setMa_date(Date ma_date) {
		this.ma_date = ma_date;
	}

	public String getMa_tasktype() {
		return ma_tasktype;
	}

	public void setMa_tasktype(String ma_tasktype) {
		this.ma_tasktype = ma_tasktype;
	}

	public Date getMa_requiredate() {
		return ma_requiredate;
	}

	public void setMa_requiredate(Date ma_requiredate) {
		this.ma_requiredate = ma_requiredate;
	}

	public Long getVe_uu() {
		return ve_uu;
	}

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

	public String getMa_prodcode() {
		return ma_prodcode;
	}

	public void setMa_prodcode(String ma_prodcode) {
		this.ma_prodcode = ma_prodcode;
	}

	public Double getMa_qty() {
		return ma_qty;
	}

	public void setMa_qty(Double ma_qty) {
		this.ma_qty = ma_qty;
	}

	public Double getMa_makeqty() {
		return ma_makeqty;
	}

	public void setMa_makeqty(Double ma_makeqty) {
		this.ma_makeqty = ma_makeqty;
	}

	public String getMa_kind() {
		return ma_kind;
	}

	public void setMa_kind(String ma_kind) {
		this.ma_kind = ma_kind;
	}

	public Double getMa_price() {
		return ma_price;
	}

	public void setMa_price(Double ma_price) {
		this.ma_price = ma_price;
	}

	public Double getMa_total() {
		return ma_total;
	}

	public void setMa_total(Double ma_total) {
		this.ma_total = ma_total;
	}

	public String getMa_currency() {
		return ma_currency;
	}

	public void setMa_currency(String ma_currency) {
		this.ma_currency = ma_currency;
	}

	public Float getMa_rate() {
		return ma_rate;
	}

	public void setMa_rate(Float ma_rate) {
		this.ma_rate = ma_rate;
	}

	public Float getMa_taxrate() {
		return ma_taxrate;
	}

	public void setMa_taxrate(Float ma_taxrate) {
		this.ma_taxrate = ma_taxrate;
	}

	public String getMa_shipaddresscode() {
		return ma_shipaddresscode;
	}

	public void setMa_shipaddresscode(String ma_shipaddresscode) {
		this.ma_shipaddresscode = ma_shipaddresscode;
	}

	public String getMa_payments() {
		return ma_payments;
	}

	public void setMa_payments(String ma_payments) {
		this.ma_payments = ma_payments;
	}

	public String getMa_recorder() {
		return ma_recorder;
	}

	public void setMa_recorder(String ma_recorder) {
		this.ma_recorder = ma_recorder;
	}

	public Date getMa_planbegindate() {
		return ma_planbegindate;
	}

	public void setMa_planbegindate(Date ma_planbegindate) {
		this.ma_planbegindate = ma_planbegindate;
	}

	public Date getMa_planenddate() {
		return ma_planenddate;
	}

	public void setMa_planenddate(Date ma_planenddate) {
		this.ma_planenddate = ma_planenddate;
	}

	public String getMa_auditman() {
		return ma_auditman;
	}

	public void setMa_auditman(String ma_auditman) {
		this.ma_auditman = ma_auditman;
	}

	public String getMa_remark() {
		return ma_remark;
	}

	public void setMa_remark(String ma_remark) {
		this.ma_remark = ma_remark;
	}

	public List<MakeMaterial> getMaterials() {
		return materials;
	}

	public void setMaterials(List<MakeMaterial> materials) {
		this.materials = materials;
	}

	public MakeOrder convert() {
		MakeOrder make = new MakeOrder();
		make.setAuditor(ma_auditman);
		make.setCode(ma_code);
		make.setCommence(ma_planbegindate);
		make.setComplete(ma_planenddate);
		make.setCurrency(ma_currency);
		make.setDate(ma_date);
		make.setDelivery(ma_requiredate);
		make.setEnd(Constant.NO);
		make.setEnUU(SystemSession.getUser().getEnterprise().getUu());
		make.setEnterprise(new EnterpriseInfo(SystemSession.getUser().getEnterprise()));
		make.setKind(ma_kind);
		make.setMakeQty(ma_makeqty);
		make.setPayments(ma_payments);
		make.setPrice(ma_price);
		make.setQty(ma_qty);
		make.setRate(ma_rate);
		make.setRecorder(ma_recorder);
		make.setRemark(ma_remark);
		make.setSendStatus((short) Status.NOT_UPLOAD.value());
		make.setShipAddress(ma_shipaddresscode);
		make.setTaxrate(ma_taxrate);
		make.setTotal(ma_total);
		make.setType(ma_tasktype);
		make.setUserUU(SystemSession.getUser().getUserUU());
		make.setVendUU(ve_uu);
		make.setReplyQty((double) 0);
		make.setStatus((short) Status.NOT_REPLY.value());
		make.setFactory(this.ma_factory);
		make.setErpId(ma_id);
		return make;
	}

}
