package com.uas.search.console.b2b.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * 平台里面，客户收到供应商的送样后的认定单
 * 
 * @author suntg
 *
 */
@Table(name = PurcProofingapprovalSimpleInfo.TABLE_NAME)
@Entity
public class PurcProofingapprovalSimpleInfo {

	/**
	 * 表名
	 */
	public static final String TABLE_NAME = "PURC$PROOFINGAPPROVAL";

	/**
	 * 各字段列名（也是存储索引时的field名）
	 */
	public static final String ID_FIELD = "psa_id";

	public static final String CODE_FIELD = "psa_code";

	public static final String ENTERPRISE_FIELD = "psa_enuu";

	public static final String DATE_FIELD = "psa_indate";

	public static final String PSCODE_FIELD = "psa_pscode";

	public static final String SSCODE_FIELD = "psa_sscode";

	public static final String PRODCODE_FIELD = "psa_prodcode";

	public static final String PRODDETAIL_FIELD = "psa_proddetail";

	public static final String PRODSPEC_FIELD = "psa_prodSpec";

	public static final String VEND_FIELD = "psa_venduu";

	public static final String RESULT_FIELD = "psa_finalresult";

	@Id
	@Column(name = ID_FIELD)
	private Long id;

	/**
	 * 认定单号编号
	 */
	@Column(name = CODE_FIELD)
	private String code;
	/**
	 * 打样申请单号
	 */
	@Column(name = PSCODE_FIELD)
	private String pscode;
	/**
	 * 送样单号
	 */
	@Column(name = SSCODE_FIELD)
	private String sscode;

	/**
	 * 日期
	 */
	@Column(name = DATE_FIELD)
	private Date date;

	/**
	 * 企业UU
	 */
	@OneToOne
	@JoinColumn(name = ENTERPRISE_FIELD, insertable = false, updatable = false)
	private EnterpriseSimpleInfo enterprise;

	/**
	 * 供应商UU
	 */
	@OneToOne
	@JoinColumn(name = VEND_FIELD, insertable = false, updatable = false)
	private EnterpriseSimpleInfo vend;

	/**
	 * 物料编号
	 */
	@Column(name = PRODCODE_FIELD)
	private String prodCode;
	/**
	 * 物料名称
	 */
	@Column(name = PRODDETAIL_FIELD)
	private String prodDetail;
	/**
	 * 物料规格
	 */
	@Column(name = PRODSPEC_FIELD)
	private String prodSpec;

	/**
	 * 结果
	 */
	@Column(name = RESULT_FIELD)
	private String result;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getPscode() {
		return pscode;
	}

	public void setPscode(String pscode) {
		this.pscode = pscode;
	}

	public String getSscode() {
		return sscode;
	}

	public void setSscode(String sscode) {
		this.sscode = sscode;
	}

	public EnterpriseSimpleInfo getVend() {
		return vend;
	}

	public void setVend(EnterpriseSimpleInfo vend) {
		this.vend = vend;
	}

	public String getProdCode() {
		return prodCode;
	}

	public void setProdCode(String prodCode) {
		this.prodCode = prodCode;
	}

	public String getProdDetail() {
		return prodDetail;
	}

	public void setProdDetail(String prodDetail) {
		this.prodDetail = prodDetail;
	}

	public String getProdSpec() {
		return prodSpec;
	}

	public void setProdSpec(String prodSpec) {
		this.prodSpec = prodSpec;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public EnterpriseSimpleInfo getEnterprise() {
		return enterprise;
	}

	public void setEnterprise(EnterpriseSimpleInfo enterprise) {
		this.enterprise = enterprise;
	}

	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}

	/**
	 * 获取所有可以搜索的字段列名（索引的field名）
	 * 
	 * @return 可以搜索的字段列名
	 */
	public static List<String> getKeywordFields() {
		List<String> fields = new ArrayList<>();
		fields.add(CODE_FIELD);
		fields.add(VEND_FIELD);
		fields.add(PRODCODE_FIELD);
		fields.add(PRODDETAIL_FIELD);
		fields.add(PRODSPEC_FIELD);
		fields.add(PSCODE_FIELD);
		fields.add(SSCODE_FIELD);
		return fields;
	}

	@Override
	public String toString() {
		return "PurcProofingapprovalSimpleInfo [id=" + id + ", code=" + code + ", pscode=" + pscode + ", sscode="
				+ sscode + ", date=" + date + ", enterprise=" + enterprise + ", vend=" + vend + ", prodCode=" + prodCode
				+ ", prodDetail=" + prodDetail + ", prodSpec=" + prodSpec + ", result=" + result + "]";
	}

}