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

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

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

import com.dev.swms.server.model.abstractEntity.AbstractMoveDoc;
import com.dev.swms.server.model.abstractEntity.AbstractMoveDocDetail;
import com.dev.swms.server.model.abstractEntity.DesignList;
import com.dev.swms.server.model.abstractEntity.Pinfan;
import com.dev.swms.server.model.base.Item;
import com.dev.swms.server.model.base.ItemKey;
import com.dev.swms.server.model.base.Location;
import com.dev.swms.server.model.base.LotInfo;
import com.dev.swms.server.model.base.NewLotInfo;
import com.dev.swms.server.model.base.PackageUnit;
import com.dev.swms.server.model.base.WarehouseArea;
import com.dev.swms.server.model.inventory.Inventory;
import com.dev.swms.server.model.inventory.Stock;
import com.dev.swms.server.model.inventory.Task;
import com.dev.swms.server.model.inventory.TaskLog;
import com.dev.swms.server.model.inventory.TaskType;
import com.dev.swms.server.service.GlobalParamUtils;
import com.dev.swms.server.utils.DoubleUtils;
import com.dev.energy.server.exception.BusinessException;
import com.dev.energy.server.model.EntityFactory;

public class PickTicketDetail extends AbstractMoveDocDetail {
	private static final long serialVersionUID = -5958182551379914930L;
	/** 所属发货单 */
	private PickTicket pickTicket;
	
	private PlanShipDetail psd;
	/** 具体商品 */
	private Item item;
	private Pinfan pf;
	/** 批次属性 */
	private NewLotInfo newLotInfo;
	/** 计划数量 */
	private double orderQuantity;
	/** 基本单位数量 */
	private double orderQtyOfMasterUnit;
	/** 预分配数量 */
	private double preAllocatedQuantity;
	/** 预分配批次 */
	private String preAllocatedLot;
	/** 已分配数量 */
	private double allocatedQuantity;
	/** 拣货数量 */
	private double pickedQuantity;
	/** 已发运数量 */
	private double shippedQuantity;
	/** 包装单位 */
	private PackageUnit packageUnit;
	/** 发货记录 */
	private Set<Task> tasks = new HashSet<Task>();
	/** 包箱数量 */
	private double packageQuantity;
	/** BOL数量 */
	private double BOLQuantity;
	/** 补货单号 */
	private String applyDoc;
	/** 补货单明细ID */
	private Long applyDocDetailId;
	/** 是否需要补货 */
	private Boolean oldRecord = Boolean.FALSE;
	
	/** 设变 */
	private Boolean beSb = Boolean.FALSE;
	/** 备货日期 */
	private Date allocateTime;
	
	/** 发货日期 */
	private Date shipTime;
	/** SOI */
	private String SOI;
	/** 存货日期 */
	private Date storageDate;
	/**CA系数*/
	private Double caCoefficient=0D;
	
	private double volume;//体积
	
	private double weight;//重量--净重
	
	/** 行号*/
	private String lineNumber;
	
	private double realWeight;//实发重量--毛重
	
	/** 良品退货数 */
	private double rejectQuantity;//纯需要数量
	
	/** 良品直退数 */
	private double rejectZTQuantity;//在途数量
	
	/** 线边接收数量 不良品退货数 */
	private double norejectQuantity;
	
	/** 不良品直退数 */
	private double norejectZTQuantity;
	
//	private double kcQty;//
	
	private double xqQty;//需要数量
	
	private double invQty;//线边库存数量
	/** 备注*/
	private String invStatus;
	
	/** 库存状态*/
	private String note;
	/** 所属库区 */
	private WarehouseArea zone;//拣货库区
	/** 所属库区 */
	private WarehouseArea zone1;//收货库仓库
	/** 所属库区 */
	private WarehouseArea zone2;//出库仓库
	/** 所属库位 */
	private Location location;
	/** 所属具体商品库存 */
	private ItemKey itemKey;
	private String specs;//A/C
	private String content;//加工内容
	private String bonded;//保税
	private double quantity;//收容数
	private String hezi;//荷姿
	private String single;//单用
	private double quantity4=0;//备货数量汇总(根据份数拆分)
	private double quantity5=0;//备货需求数(根据份数拆分)
	private double xs=0;//收容箱数
	private DesignList designList;//设变
	private double tlQty=0;
	
	
	public double getTlQty() {
		return tlQty;
	}

	public void setTlQty(double tlQty) {
		this.tlQty = tlQty;
	}

	public Boolean getBeSb() {
		return beSb;
	}

	public void setBeSb(Boolean beSb) {
		this.beSb = beSb;
	}


	/**制造库位*/
	private Location zzkw;
	
	public double getQuantity5() {
		return quantity5;
	}

	public void setQuantity5(double quantity5) {
		this.quantity5 = quantity5;
	}

	public double getXs() {
		return xs;
	}

	public void setXs(double xs) {
		this.xs = xs;
	}

	public Location getZzkw() {
		return zzkw;
	}

	public void setZzkw(Location zzkw) {
		this.zzkw = zzkw;
	}

	public Pinfan getPf() {
		return pf;
	}

	public void setPf(Pinfan pf) {
		this.pf = pf;
	}

	public DesignList getDesignList() {
		return designList;
	}

	public void setDesignList(DesignList designList) {
		this.designList = designList;
	}

	public double getQuantity4() {
		return quantity4;
	}

	public void setQuantity4(double quantity4) {
		this.quantity4 = quantity4;
	}
	public String getSpecs() {
		return specs;
	}
	public void setSpecs(String specs) {
		this.specs = specs;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getBonded() {
		return bonded;
	}
	public void setBonded(String bonded) {
		this.bonded = bonded;
	}
	public double getQuantity() {
		return quantity;
	}
	public void setQuantity(double quantity) {
		this.quantity = quantity;
	}
	
	public String getHezi() {
		return hezi;
	}
	public void setHezi(String hezi) {
		this.hezi = hezi;
	}
	public String getSingle() {
		return single;
	}
	public void setSingle(String single) {
		this.single = single;
	}
	public WarehouseArea getZone1() {
		return zone1;
	}
	public void setZone1(WarehouseArea zone1) {
		this.zone1 = zone1;
	}
	public WarehouseArea getZone2() {
		return zone2;
	}
	public void setZone2(WarehouseArea zone2) {
		this.zone2 = zone2;
	}
	public double getInvQty() {
		return invQty;
	}
	public void setInvQty(double invQty) {
		this.invQty = invQty;
	}
	public double getXqQty() {
		return xqQty;
	}
	public void setXqQty(double xqQty) {
		this.xqQty = xqQty;
	}
	public WarehouseArea getZone() {
		return zone;
	}
	public void setZone(WarehouseArea zone) {
		this.zone = zone;
	}
	public Location getLocation() {
		return location;
	}
	public void setLocation(Location location) {
		this.location = location;
	}
	public ItemKey getItemKey() {
		return itemKey;
	}
	public void setItemKey(ItemKey itemKey) {
		this.itemKey = itemKey;
	}
	public Date getAllocateTime() {
		return allocateTime;
	}
	public void setAllocateTime(Date allocateTime) {
		this.allocateTime = allocateTime;
	}
	public Date getShipTime() {
		return shipTime;
	}
	public void setShipTime(Date shipTime) {
		this.shipTime = shipTime;
	}
	public String getInvStatus() {
		return invStatus;
	}
	public void setInvStatus(String invStatus) {
		this.invStatus = invStatus;
	}
	public String getNote() {
		return note;
	}
	public void setNote(String note) {
		this.note = note;
	}
	public Boolean getOldRecord() {
		return oldRecord;
	}

	public double getRejectQuantity() {
		return rejectQuantity;
	}
	public void setRejectQuantity(double rejectQuantity) {
		this.rejectQuantity = rejectQuantity;
	}
	public double getRejectZTQuantity() {
		return rejectZTQuantity;
	}
	public void setRejectZTQuantity(double rejectZTQuantity) {
		this.rejectZTQuantity = rejectZTQuantity;
	}
	public double getNorejectQuantity() {
		return norejectQuantity;
	}
	public void setNorejectQuantity(double norejectQuantity) {
		this.norejectQuantity = norejectQuantity;
	}
	public double getNorejectZTQuantity() {
		return norejectZTQuantity;
	}
	public void setNorejectZTQuantity(double norejectZTQuantity) {
		this.norejectZTQuantity = norejectZTQuantity;
	}
	public double getRealWeight() {
		return realWeight;
	}
	public void setRealWeight(double realWeight) {
		this.realWeight = realWeight;
	}


	private String locType;
	public String getLocType() {
		return locType;
	}
	public void setLocType(String locType) {
		this.locType = locType;
	}

	public PlanShipDetail getPsd() {
		return psd;
	}
	public void setPsd(PlanShipDetail psd) {
		this.psd = psd;
	}
	public String getLineNumber() {
		return lineNumber;
	}

	public void setLineNumber(String lineNumber) {
		this.lineNumber = lineNumber;
	}

	public double getVolume() {
		return volume;
	}

	public void setVolume(double volume) {
		this.volume = volume;
	}

	public double getWeight() {
		return weight;
	}

	public void setWeight(double weight) {
		this.weight = weight;
	}

	
	public Double getCaCoefficient() {
		return caCoefficient;
	}
	public void setCaCoefficient(Double caCoefficient) {
		this.caCoefficient = caCoefficient;
	}
	public PickTicketDetail(){
		
	}
	
	@Override
	public boolean equals(final Object other) {
		if (!(other instanceof PickTicketDetail))
			return false;
		PickTicketDetail castOther = (PickTicketDetail) other;
		return new EqualsBuilder().append(pickTicket, castOther.pickTicket)
				                  .append(item, castOther.item)
				                  .append(newLotInfo,castOther.newLotInfo)
				                  .append(packageUnit,castOther.packageUnit)
				                  .append(caCoefficient,castOther.caCoefficient)
				                  .append(oldRecord,castOther.oldRecord)
				                  .append(lineNumber,castOther.lineNumber)
				                  .isEquals();
						
						
						
						
	}
	@Override
	public int hashCode() {
		return new HashCodeBuilder().append(pickTicket)
				.append(item)
				.append(newLotInfo)
				.append(packageUnit)
				.append(caCoefficient)
				.append(oldRecord)
				.append(lineNumber)
				.toHashCode();
	}
	
	public Date getStorageDate() {
		return storageDate;
	}
	public void setStorageDate(Date storageDate) {
		this.storageDate = storageDate;
	}
	public String getSOI() {
		return SOI;
	}
	public void setSOI(String soi) {
		SOI = soi;
	}
	public Boolean isOldRecord() {
		return oldRecord;
	}
	public void setOldRecord(Boolean oldRecord) {
		this.oldRecord = oldRecord;
	}
	public Long getApplyDocDetailId() {
		return applyDocDetailId;
	}
	public void setApplyDocDetailId(Long applyDocDetailId) {
		this.applyDocDetailId = applyDocDetailId;
	}
	public String getApplyDoc() {
		return applyDoc;
	}
	public void setApplyDoc(String applyDoc) {
		this.applyDoc = applyDoc;
	}
	public double getPackageQuantity() {
		return packageQuantity;
	}
	public void setPackageQuantity(double packageQuantity) {
		this.packageQuantity = packageQuantity;
	}
	public double getBOLQuantity() {
		return BOLQuantity;
	}
	public void setBOLQuantity(double quantity) {
		BOLQuantity = quantity;
	}
	public String getPreAllocatedLot() {
		return preAllocatedLot;
	}
	public void setPreAllocatedLot(String preAllocatedLot) {
		this.preAllocatedLot = preAllocatedLot;
	}
	public Item getItem() {
		return item;
	}
	public void setItem(Item item) {
		this.item = item;
	}
	public NewLotInfo getNewLotInfo() {
		return newLotInfo;
	}
	public void setNewLotInfo(NewLotInfo newLotInfo) {
		this.newLotInfo = newLotInfo;
	}
	public LotInfo getLotInfo(){
		return null;
	}
	public void setLotInfo(LotInfo lotInfo){
		//do Nothing 
		;
	}
	public double getPickedQuantity() {
		return pickedQuantity;
	}
	public void setPickedQuantity(double pickedQuantity) {
		this.pickedQuantity = pickedQuantity;
	}
	public double getPreAllocatedQuantity() {
		return preAllocatedQuantity;
	}
	public void setPreAllocatedQuantity(double preAllocatedQuantity) {
		this.preAllocatedQuantity = preAllocatedQuantity;
	}
	public double getAllocatedQuantity() {
		return allocatedQuantity;
	}
	public void setAllocatedQuantity(double allocatedQuantity) {
		this.allocatedQuantity = allocatedQuantity;
	}
	public double getOrderQuantity() {
		return orderQuantity;
	}
	public void setOrderQuantity(double orderQuantity) {
		this.orderQuantity = orderQuantity;
	}
	public PickTicket getPickTicket() {
		return pickTicket;
	}
	public void setPickTicket(PickTicket pickTicket) {
		this.pickTicket = pickTicket;
	}
	public double getShippedQuantity() {
		return shippedQuantity;
	}
	public void setShippedQuantity(double shippedQuantity) {
		this.shippedQuantity = shippedQuantity;
	}	
	public PackageUnit getPackageUnit() {
		return packageUnit;
	}
	public void setPackageUnit(PackageUnit packageUnit) {
		this.packageUnit = packageUnit;
	}	
	public double getOrderQtyOfMasterUnit() {
		return orderQtyOfMasterUnit;
	}
	public void setOrderQtyOfMasterUnit(double orderQtyOfMasterUnit) {
		this.orderQtyOfMasterUnit = orderQtyOfMasterUnit;
	}
	public AbstractMoveDoc getAbstractMoveDoc() {
		return this.getPickTicket();
	}
	public Set<Task> getTasks() {
		return tasks;
	}
	public void setTasks(Set<Task> tasks) {
		this.tasks = tasks;
	}

	/**
	 * 获取发货单明细的未分配数量
	 * @return 
	 */
	public double getUnallocateQuantity() {
//		return this.preAllocatedQuantity-this.allocatedQuantity;
		return this.orderQtyOfMasterUnit-this.allocatedQuantity;
	}
	
	/** 
	 * 获取明细对应发货单或批拣单的code 
	 */
	public String getCode() {
		return this.getPickTicket().getCode();
	}
	
	/**
	 * 获取发货单对应发货月台
	 */
	public Location getAllocateDstLoc() {
		return this.getPickTicket().getDock();
	}

	/**
	 * 增加发货单明细的已分配数量，并记录发货日志
	 * @param quantity
	 */
	public Task allocate(String bhCode,Inventory inventory, double quantity) {
		this.allocatedQuantity += quantity;
		this.allocateTime=new Date();
		this.setItemKey(inventory.getItemKey());
		Task t=addTask(bhCode,TaskType.MV_PICKTICKET, 
				inventory.getLocation(),
//				inventory.getItemKey().getPinfan().getLocation(),
				this.getPickTicket().getDock(),
				inventory.getLP(), 
				inventory.getLP(), 
				inventory.getItemKey(), 
				inventory.getStorageDate(), 
				inventory.getSOI(),
				inventory.getStatus(),
				quantity,
				inventory.getPackageUnit(),
				inventory.getZone(),//扣仓库
				this.zone1);//收仓库
		return t;
	}
	
	/**
	 * 越库上架分配
	 * @param quantity
	 */
	public void allocateCross(double quantity){
		this.preAllocatedQuantity += DoubleUtils.formatByPrecision(quantity,this.getPackageUnit().getPrecision());
		this.allocatedQuantity += DoubleUtils.formatByPrecision(quantity,this.getPackageUnit().getPrecision());
		this.getPickTicket().allocateCross(DoubleUtils.formatByPrecision(quantity,this.getPackageUnit().getPrecision()));
	}
	
	/**
	 * 减少发货单明细的已分配数量
	 * @param quantity
	 */
	public void unallocate(double quantity) {
		this.allocatedQuantity -= DoubleUtils.formatByPrecision(quantity,this.getPackageUnit().getPrecision());
		this.pickTicket.unallocate(DoubleUtils.formatByPrecision(quantity,this.getPackageUnit().getPrecision()));
	}
	
	/**
	 * 越库上架取消分配
	 * @param quantity
	 */
	public void unallocateCross(double quantity){
		this.preAllocatedQuantity -= DoubleUtils.formatByPrecision(quantity,this.getPackageUnit().getPrecision());
		this.allocatedQuantity -= DoubleUtils.formatByPrecision(quantity,this.getPackageUnit().getPrecision());
		pickTicket.setPreAllocatedQuantity(pickTicket.getPreAllocatedQuantity()-DoubleUtils.formatByPrecision(quantity,this.getPackageUnit().getPrecision()));
		pickTicket.setAllocatedQuantity(pickTicket.getAllocatedQuantity()-DoubleUtils.formatByPrecision(quantity,this.getPackageUnit().getPrecision()));
		
		if(pickTicket.getAllocatedQuantity()==0&&pickTicket.getPreAllocatedQuantity()>0){
			pickTicket.setStatus(PickTicketStatus.PREALLOCATE);
		} else if(pickTicket.getPreAllocatedQuantity()==0){
			pickTicket.setStatus(PickTicketStatus.ACTIVE);
		}
	}
	
    public Task addTask(String bhCode,String taskType, Location fromLocation, Location toLocation, Stock srcLp, 
    		Stock dstLp, ItemKey itemKey, Date storageDate, String soi, String status, 
    		double allocatedQuantity, PackageUnit packageUnit,WarehouseArea zone,WarehouseArea outzone) {
		if (this.getTasks() == null) {
			this.setTasks(new HashSet<Task>());
		}
		Task t=getTask(bhCode,taskType, fromLocation, toLocation, srcLp, dstLp, itemKey, storageDate, soi, status, 
				allocatedQuantity, packageUnit, zone,outzone);
		return t;
	}
    
	private Task getTask(String bhCode,String taskType, Location fromLocation, Location toLocation, Stock srcLp, 
			Stock dstLp, ItemKey itemKey, Date storageDate, String soi, String status, 
			double allocatedQuantity, PackageUnit packageUnit,WarehouseArea zone,WarehouseArea outzone) {
		Task task = EntityFactory.getEntity(Task.class);
		task.setCode(GlobalParamUtils.generateCodeByType("generateTask"));
		task.setType(taskType);
		task.setSrcLoc(fromLocation);
		task.setSrcLP(srcLp);
		task.setSrcLPCode(srcLp==null?null:srcLp.getLP());
		task.setDstLoc(toLocation);
		task.setDstLP(dstLp);
		task.setDstLPCode(dstLp==null?null:dstLp.getLP());
		task.setItemKey(itemKey);
		task.setStorageDate(storageDate);
		task.setSOI(soi);
		task.setInventoryStatus(status);
		task.setPackageUnit(packageUnit);
		task.setPlanQuantityMU(allocatedQuantity);
		task.setPlanQuantity(allocatedQuantity);
		task.setBillCode(this.getPickTicket().getCode());
		task.setOrderDate(this.getPickTicket().getOrderDate());//增加订单日期
		task.setPickTicketDetail(this);
		task.setBhCode(bhCode);
		task.setZone(zone);
		task.setOutZone(outzone);
		this.getTasks().add(task);
		return task;
	}
	
	/**
     * 增加拣货单明细的订单数量
     * @param quantity 待增加的订单数量
     */
    public void addOrderQuantity(double orderQuantity, PackageUnit unit) {
        this.orderQuantity += DoubleUtils.formatByPrecision(orderQuantity,this.getPackageUnit().getPrecision());
        this.orderQtyOfMasterUnit += DoubleUtils.formatByPrecision(orderQuantity*unit.getConvertFigure(),this.getPackageUnit().getPrecision());
    }
    
	/**
	 * 发货确认
	 * @param quantity 单一发货时的发货数量
	 */
	public void ship(double quantity){
		this.shippedQuantity += DoubleUtils.formatByPrecision(quantity,this.getPackageUnit().getPrecision());
		this.BOLQuantity -= DoubleUtils.formatByPrecision(quantity,this.getPackageUnit().getPrecision());
		this.packageQuantity -= DoubleUtils.formatByPrecision(quantity,this.getPackageUnit().getPrecision());
		this.pickTicket.ship(DoubleUtils.formatByPrecision(quantity,this.getPackageUnit().getPrecision()));
	}

	public void pickConfirm(double pickedQuantity,double weight){
		int precision=0;//this.getPackageUnit().getPrecision();
		this.pickedQuantity +=DoubleUtils.formatByPrecision(pickedQuantity,precision);
		this.realWeight+=weight;
		this.pickTicket.pickConfirm(DoubleUtils.formatByPrecision(pickedQuantity,precision),realWeight);
		this.shipTime=new Date();
	}

	/** 
	 * 明细预分配
	 * @param lot 预分配批次号
	 * @param quantity 预分配数量
	 */
	public void preAllocate(String lot, Double quantity) {
		this.preAllocatedLot = lot;
		this.preAllocatedQuantity +=DoubleUtils.formatByPrecision(quantity,this.getPackageUnit().getPrecision());
		if (this.preAllocatedQuantity > this.orderQtyOfMasterUnit) {
			throw new BusinessException("preAlloate.quantity.error");
		}
		this.getPickTicket().preAllocate(quantity);
	}

	/**
	 * 明细取消预分配
	 * @param quantity
	 */
	public void unPreAllocate(Double quantity) {
		this.preAllocatedQuantity -= DoubleUtils.formatByPrecision(quantity,this.getPackageUnit().getPrecision());
		if (this.preAllocatedQuantity < 0) {
			throw new BusinessException("unPreAlloate.quantity.error");
		}
		this.getPickTicket().unPreAllocate(DoubleUtils.formatByPrecision(quantity,this.getPackageUnit().getPrecision()));
	}
	
	/**
	 * 获取发货单明细的剩余未预分配数量
	 * @return
	 */
	public Double getUnPreAllocateQuantity() {
		return this.orderQtyOfMasterUnit - this.preAllocatedQuantity;
	}
	public Double getUnPreAllocateQuantityCA() {
		double qty=this.orderQtyOfMasterUnit - this.preAllocatedQuantity;
		if(this.getCaCoefficient()>0){
			qty=((int)qty/this.getCaCoefficient())*this.getCaCoefficient();
		}
		return qty;
	}
	
	public Double getUnPreAllocateQuantityBH() {
		double qty=this.orderQtyOfMasterUnit - this.preAllocatedQuantity;
		if(this.getCaCoefficient()>0){
			qty=qty-((int)qty/this.getCaCoefficient())*this.getCaCoefficient();
		}
		return qty;
	}
	
	public void autoPack(TaskLog taskLog) {
		this.BOLQuantity += DoubleUtils.formatByPrecision(taskLog.getMovedQuantity()*taskLog.getPackageUnit().getConvertFigure(),this.getPackageUnit().getPrecision());
		this.packageQuantity += taskLog.getMovedQuantity()*taskLog.getPackageUnit().getConvertFigure();
		this.pickTicket.autoPack(taskLog);
	}
	
	public void manualAutoPack(double inputQty,PackageUnit pkg) {
		this.BOLQuantity += DoubleUtils.formatByPrecision(inputQty*pkg.getConvertFigure(),this.getPackageUnit().getPrecision());
		this.packageQuantity += DoubleUtils.formatByPrecision(inputQty*pkg.getConvertFigure(),this.getPackageUnit().getPrecision());
		this.pickTicket.manualAutoPack(inputQty,pkg);
	}
	
	public double split(Inventory inventory){
		// 只有备货库位中包装为基本包装时才能够分单成功
		if (inventory.getPackageUnit().getConvertFigure() != 1) {
			return 0;
		}
		double moveQty = (this.getPreAllocatedQuantity() - this.getAllocatedQuantity()) <= inventory.getAvaliableQuantity() ? 
				(this.getPreAllocatedQuantity() - this.getAllocatedQuantity()) : inventory.getAvaliableQuantity();
				
		setAllocatedQuantity(getAllocatedQuantity() + moveQty);
		getPickTicket().setAllocatedQuantity(getPickTicket().getAllocatedQuantity() + moveQty);
		getPickTicket().setStatus(PickTicketStatus.ALLOCATE);
		//写分单task
		addTask(null,TaskType.MV_WAVESPLIT, inventory.getLocation(),
				getPickTicket().getDock(),
				null, null, 
				inventory.getItemKeyInventory().getItemKey(),
				inventory.getStorageDate(),
				inventory.getSOI(),
				Inventory.STATUS_VALID,
				moveQty,
				inventory.getPackageUnit(),
				inventory.getZone(),
				this.getPickTicket().getZone());
		inventory.allocate(moveQty, null, null);
		return moveQty;
	}
	
	public void pickBack(double pickedQty) {
		this.allocatedQuantity -=pickedQty;// DoubleUtils.formatByPrecision(pickedQty,this.getPackageUnit().getPrecision());
		this.pickedQuantity -= pickedQty;//DoubleUtils.formatByPrecision(pickedQty,this.getPackageUnit().getPrecision());
		//this.getPlanPickTicketDetail().pickBack(DoubleUtils.formatByPrecision(pickedQty,this.getPackageUnit().getPrecision()));
//		this.getPickTicket().pickBack(DoubleUtils.formatByPrecision(pickedQty,this.getPackageUnit().getPrecision()));
		this.getPickTicket().pickBack(pickedQty);
	}
	
}
