/**   
 * @公司   青软实训QST
 * @作者 zhaokl
 */
package com.qst.dms.entity;

import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;

//货运物流信息
public class Transport extends DataBase implements Serializable{
	/**
	 * 经手人
	 */
	private String handler;
	/**
	 * 收货人
	 */
	private String reciver;
	/**
	 * 物流状态
	 */
	private int transportType;
	/**
	 * 物流状态常量:发货中, 送货中, 已签收
	 */
	public static final int SENDING = 1;// 发货中
	public static final int TRANSPORTING = 2;// 送货中
	public static final int RECEIVED = 3;// 已签收

	public String getHandler() {
		return handler;
	}

	public void setHandler(String handler) {
		this.handler = handler;
	}

	public String getReciver() {
		return reciver;
	}

	public void setReciver(String reciver) {
		this.reciver = reciver;
	}

	public int getTransportType() {
		return transportType;
	}

	public void setTransportType(int transportType) {
		this.transportType = transportType;
	}

	public Transport() {

	}

	public Transport(int id, Date time, String address, int type,
			String handler, String reciver, int transportType) {
		super(id, time, address, type);
		this.handler = handler;
		this.reciver = reciver;
		this.transportType = transportType;
	}

	static public Transport get_Transport(Object[] info)
	{
		int id = (Integer) info[0],type = (Integer) info[3],transportType = (Integer) info[6];
		Date time = Date.from( ((LocalDateTime)info[1]).atZone( ZoneId.systemDefault()).toInstant());
		String address = (String) info[2],handler = (String) info[4],reciver = (String)info[5];
		return new Transport(id,time,address,type,handler,reciver,transportType);
	}

	public Object[] get_DB_param()
	{
		return new Object[]{
				this.getId(),new Timestamp(this.getTime().getTime()),
				this.getAddress(),this.getType(),this.getHandler(),this.getReciver(),
				this.getTransportType()
		};
	}

	public String toString() {
		return this.getId() + "," + this.getTime() + "," + this.getAddress()
				+ "," + this.getType() + "," + handler + "," + transportType;
	}

}
