package com.dev.swms.server.service.receiving;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.dev.swms.server.model.base.Location;
import com.dev.swms.server.model.base.PackageUnit;
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.receiving.MoveDoc;
import com.dev.swms.server.model.receiving.MoveDocDetail;

@Transactional(readOnly = true)
public interface PutawayAllocator {
	/**
	 * 调用上架分配算法（控制同仓库同一时间只能一个进程）
	 * @param moveDocIds
	 * @param type
	 * @return 分配信息
	 */
	@Transactional
	String allocate(Long moveDocId);

	/**
	 * 对指定的上架计划取消分配
	 * @param moveDoc
	 */
	@Transactional
	void unallocate(MoveDoc moveDoc);
	
	/**
	 * 对指定的上架明细取消分配
	 * @param moveDoc
	 */
	@Transactional
	void unallocateTask(Task task);
	
	/**
	 * 手工上架分配
	 * @param moveDoc
	 * @return 
	 */
	@Transactional
	Task manualAllocatebyLocation(MoveDocDetail detail, Location location, PackageUnit packageUnit, double toBeMovedQty,Stock srcLp);
	
	/**
	 * 直接对选中库存上架分配
	 * @param detail
	 * @param inventory
	 * @param quantity
	 */
	@Transactional
	String allocateByDetailAndInventory(MoveDocDetail detail, Inventory inventory, double quantity);
	
	@Transactional
	Double calculateLocationCanPutAwayQty(Location location, PackageUnit packageUnit);
}
