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

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

import com.dev.swms.server.model.base.Item;
import com.dev.swms.server.model.base.Location;
import com.dev.swms.server.model.base.Warehouse;
import com.dev.energy.server.model.Entity;

public class ItemSupplyRule extends Entity {
	/**
	 * 仓库
	 */
	private Warehouse warehouse;
	/**
	 * 货品
	 */
	private Item item;
	/** 
	 * 补货下限 
	 */
	private Double minReplenishment;
	/** 
	 * 补货上限 
	 */
	private Double maxReplenishment;
	/** 
	 * 补货数量 
	 */
	private Double replenishmentQuantity;
	/** 
	 * 补货库位 
	 */
	private Location replenishmentLocation;


	public Item getItem() {
		return item;
	}
	public void setItem(Item item) {
		this.item = item;
	}
	public Double getMaxReplenishment() {
		return maxReplenishment;
	}
	public void setMaxReplenishment(Double maxReplenishment) {
		this.maxReplenishment = maxReplenishment;
	}
	public Double getMinReplenishment() {
		return minReplenishment;
	}
	public void setMinReplenishment(Double minReplenishment) {
		this.minReplenishment = minReplenishment;
	}
	public Location getReplenishmentLocation() {
		return replenishmentLocation;
	}
	public void setReplenishmentLocation(Location replenishmentLocation) {
		this.replenishmentLocation = replenishmentLocation;
	}
	public Double getReplenishmentQuantity() {
		return replenishmentQuantity;
	}
	public void setReplenishmentQuantity(Double replenishmentQuantity) {
		this.replenishmentQuantity = replenishmentQuantity;
	}
	public Warehouse getWarehouse() {
		return warehouse;
	}
	public void setWarehouse(Warehouse warehouse) {
		this.warehouse = warehouse;
	}
	
	public boolean equals(final Object other) {
		if (!(other instanceof ItemSupplyRule))
			return false;
		ItemSupplyRule castOther = (ItemSupplyRule) other;
		return new EqualsBuilder().append(warehouse, castOther.getWarehouse())
				.append(item, castOther.getItem()).
				append(replenishmentLocation,castOther.getReplenishmentLocation()).isEquals();
	}
	public int hashCode() {
		return new HashCodeBuilder().append(warehouse).append(item).append(replenishmentLocation)
				.toHashCode();
	}

}
