package com.dev.swms.server.model.shipping;

import java.util.Date;
import java.util.Set;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

import com.dev.swms.server.model.base.Address;
import com.dev.swms.server.model.base.Contact;
import com.dev.swms.server.model.base.Line;
import com.dev.swms.server.model.base.Pilot;
import com.dev.swms.server.model.base.Structure;
import com.dev.swms.server.model.base.TransSite;
import com.dev.swms.server.model.base.Transportation;
import com.dev.swms.server.model.base.Vehicle;
import com.dev.swms.server.model.base.Warehouse;
import com.dev.swms.server.model.base.Worker;
import com.dev.energy.server.model.Entity;
import com.dev.energy.server.web.security.UserHolder;

public class MasterBOL extends Entity {
	/**
	 * @Description：装车单
	 * @author  dev
	 * @Modified_Reseaon：(1)、增加出发地和目的地，发车时间，状态（增加运抵）,交通工具
	 * @Date：2009-2-12
	 */
	private static final long serialVersionUID = 1L;

	/** 所属仓库 */
	private Warehouse warehouse;

	/** 代码 */
	private String code;

	/** 承运商 */
	private Structure carrier;

	/** 车牌号 */
	private String trailer;

	/** 收货方名称 */
	private String shipToName;
	
	/** 收货方地址 */
	private Address shipToAddress;
	
	/** 收货方联系方式 */
	private Contact shipToContact;

	/** 封条号 */
	private String sealNumber;

	/** 状态 */
	private String status;

	/** 描述 */
	private String description;

	/** BOL */
	private Set<BOL> BOLs;

	/** 最后修改人ID * */
	private Long userID;

	/** 最后修改人姓名 * */
	private String userName;

	/** 最后修改时间 * */
	private Date updateTime;

	/** 总体积 * */
	private double allShippedVolume;

	/** 总重量 * */
	private double allShippedWeight;
	
	/** 出入库状态（入库、出库）	 */
	private String storeType;
	
	/** 入库时间	 */
	private Date inputDate;
	
	/** 出库时间	 */
	private Date outputDate;
	
	/** 入库车辆管理作业人员 */
	private Worker inputWorker;
	
	/** 出库车辆管理作业人员 */
	private Worker outputWorker;
	
	/** 运输方式 **/
	private String shipmentMethod; 
	
	/** 配载方式 **/
	private String loading;
	
	//Start => (1)
	private TransSite startPosition;//出发地
	private TransSite aimPosition;//目的地
	private Date leaveTime;//发车时间
	private Transportation transportation;//交通工具
	//End => (1)
	/** 主司机 */
	private Pilot pilot;
	/** 司机姓名 */
	private String pilotName;
	/** 司机电话 */
	private String pilotTel;
	
	/**所属线路*/
	private Line line; 
	
	private double orderQuantity;//订单数量
	
	private double pickQuantity;//拣货数量
	
	private double shipQuantity;//发运数量
	
	private Vehicle vehicle;//车辆
	
	/** 货主 */
	private Structure company;
	
	/** 作业人员 */
	private Worker worker1;
	/** 作业人员 */
	private Worker worker2;
	/** 作业人员 */
	private Worker worker3;
	/** 作业人员 */
	private Worker worker4;
	
	//private PickTicket pickTicket;
	
	
	
	/*public PickTicket getPickTicket() {
		return pickTicket;
	}

	public void setPickTicket(PickTicket pickTicket) {
		this.pickTicket = pickTicket;
	}*/

	public Worker getWorker1() {
		return worker1;
	}

	public void setWorker1(Worker worker1) {
		this.worker1 = worker1;
	}

	public Worker getWorker2() {
		return worker2;
	}

	public void setWorker2(Worker worker2) {
		this.worker2 = worker2;
	}

	public Worker getWorker3() {
		return worker3;
	}

	public void setWorker3(Worker worker3) {
		this.worker3 = worker3;
	}

	public Worker getWorker4() {
		return worker4;
	}

	public void setWorker4(Worker worker4) {
		this.worker4 = worker4;
	}

	public Structure getCompany() {
		return company;
	}

	public void setCompany(Structure company) {
		this.company = company;
	}

	public Vehicle getVehicle() {
		return vehicle;
	}

	public void setVehicle(Vehicle vehicle) {
		this.vehicle = vehicle;
	}

	public double getOrderQuantity() {
		return orderQuantity;
	}

	public void setOrderQuantity(double orderQuantity) {
		this.orderQuantity = orderQuantity;
	}

	public double getPickQuantity() {
		return pickQuantity;
	}

	public void setPickQuantity(double pickQuantity) {
		this.pickQuantity = pickQuantity;
	}

	

	public double getShipQuantity() {
		return shipQuantity;
	}

	public void setShipQuantity(double shipQuantity) {
		this.shipQuantity = shipQuantity;
	}

	public Line getLine() {
		return line;
	}

	public void setLine(Line line) {
		this.line = line;
	}

	public Worker getInputWorker() {
		return inputWorker;
	}

	public void setInputWorker(Worker inputWorker) {
		this.inputWorker = inputWorker;
	}

	public Worker getOutputWorker() {
		return outputWorker;
	}

	public void setOutputWorker(Worker outputWorker) {
		this.outputWorker = outputWorker;
	}

	public Date getInputDate() {
		return inputDate;
	}

	public void setInputDate(Date inputDate) {
		this.inputDate = inputDate;
	}

	public Date getOutputDate() {
		return outputDate;
	}

	public void setOutputDate(Date outputDate) {
		this.outputDate = outputDate;
	}

	public String getStoreType() {
		return storeType;
	}

	public void setStoreType(String storeType) {
		this.storeType = storeType;
	}

	protected MasterBOL() {

	}

	public Structure getCarrier() {
		return carrier;
	}

	public void setCarrier(Structure carrier) {
		this.carrier = carrier;
	}

	public String getCode() {
		return code;
	}

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

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Set<BOL> getBOLs() {
		return BOLs;
	}

	public void setBOLs(Set<BOL> BOLs) {
		this.BOLs = BOLs;
	}
	
	public String getShipToName() {
		return shipToName;
	}

	public void setShipToName(String shipToName) {
		this.shipToName = shipToName;
	}

	public Address getShipToAddress() {
		return shipToAddress;
	}

	public void setShipToAddress(Address shipToAddress) {
		this.shipToAddress = shipToAddress;
	}

	public Contact getShipToContact() {
		return shipToContact;
	}

	public void setShipToContact(Contact shipToContact) {
		this.shipToContact = shipToContact;
	}

	public String getSealNumber() {
		return sealNumber;
	}

	public void setSealNumber(String sealNumber) {
		this.sealNumber = sealNumber;
	}

	public String getTrailer() {
		return trailer;
	}

	public void setTrailer(String trailer) {
		this.trailer = trailer;
	}

	public Warehouse getWarehouse() {
		return warehouse;
	}

	public void setWarehouse(Warehouse warehouse) {
		this.warehouse = warehouse;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public Long getUserID() {
		return userID;
	}

	public void setUserID(Long userID) {
		this.userID = userID;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public double getAllShippedVolume() {
		return this.allShippedVolume;
	}

	public void setAllShippedVolume(double allVolume) {
		this.allShippedVolume = allVolume;
	}

	public double getAllShippedWeight() {
		return this.allShippedWeight;
	}

	public void setAllShippedWeight(double allWeight) {
		this.allShippedWeight = allWeight;
	}

	public Pilot getPilot() {
		return pilot;
	}

	public void setPilot(Pilot pilot) {
		this.pilot = pilot;
	}

	public String getPilotName() {
		return pilotName;
	}

	public void setPilotName(String pilotName) {
		this.pilotName = pilotName;
	}

	public String getPilotTel() {
		return pilotTel;
	}

	public void setPilotTel(String pilotTel) {
		this.pilotTel = pilotTel;
	}

	public boolean equals(final Object other) {
		if (!(other instanceof MasterBOL))
			return false;
		MasterBOL castOther = (MasterBOL) other;
		return new EqualsBuilder().append(warehouse, castOther.getWarehouse())
				.append(code, castOther.getCode()).isEquals();
	}

	public int hashCode() {
		return new HashCodeBuilder().append(warehouse).append(code)
				.toHashCode();
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	/**
	 * 记录收货单的最新修改用户和修改时间信息
	 *
	 */
	public void setUserTracking() {
		this.setUserID(UserHolder.getUser().getId());
		this.setUserName(UserHolder.getUser().getName());
		this.setUpdateTime(new Date());
	}

	public String getShipmentMethod() {
		return shipmentMethod;
	}

	public void setShipmentMethod(String shipmentMethod) {
		this.shipmentMethod = shipmentMethod;
	}

	public String getLoading() {
		return loading;
	}

	public void setLoading(String loading) {
		this.loading = loading;
	}

	public TransSite getAimPosition() {
		return aimPosition;
	}

	public void setAimPosition(TransSite aimPosition) {
		this.aimPosition = aimPosition;
	}

	public Date getLeaveTime() {
		return leaveTime;
	}

	public void setLeaveTime(Date leaveTime) {
		this.leaveTime = leaveTime;
	}

	public TransSite getStartPosition() {
		return startPosition;
	}

	public void setStartPosition(TransSite startPosition) {
		this.startPosition = startPosition;
	}

	public Transportation getTransportation() {
		return transportation;
	}

	public void setTransportation(Transportation transportation) {
		this.transportation = transportation;
	}
}
