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

import java.io.File;
import java.util.List;
import java.util.Map;

import org.springframework.transaction.annotation.Transactional;

import com.dev.swms.server.model.base.Item;
import com.dev.swms.server.model.base.Location;
import com.dev.swms.server.model.base.Location2;
import com.dev.swms.server.model.base.LpBarCode;
import com.dev.swms.server.model.base.Stowage;
import com.dev.energy.server.service.BaseManager;

@Transactional(readOnly = true)
public interface LocationManager extends BaseManager {
	/**
	 * 保存库位资料
	 * 保存时自动加入库位所属仓库信息
	 * @param location 待保存的库位
	 */
	@Transactional
	void storeLocation(Location location);
	@Transactional
	void storeLpBarCode(String prefix,int start,int end);
	@Transactional
	public void storeLpBarCode(LpBarCode lp);
	@Transactional
	void storeLocation2(Location2 location);
	
	/**
	 * 删除指定的库位
	 * 如果库位在库存日志中已有记录，则不能删除
	 * @param locationIds 选中库位的ID集合
	 */
	@Transactional
	void deleteAll(List<Long> locationIds);
	/**
	 * 恢复库位
	 * @param locationIds
	 */
	@Transactional
	void active(List<Long> locationIds);	
	
	/**
	 * 通过
	 * @param locationIds
	 */
	@Transactional
	void pass(List<Long> locationIds);	
	
	/**
	 * 不通过
	 * @param locationIds
	 */
	@Transactional
	void noPass(List<Long> locationIds);	
	
	/**
	 * 保存库位定位分类
	 * @param stowage
	 */
	@Transactional
	void storeStowage(Stowage stowage);
	
	/**
	 * 删除承载类型
	 * @param stowageIds
	 */
	@Transactional
	void deleteStowages(List<Long> stowageIds);
	/**
	 * 恢复承载类型
	 * @param stowageIds
	 */
	@Transactional
	void activeStowages(List<Long> stowageIds);	
	/**
	 * 库位锁定(只能锁定存货库位)
	 * @param locationIds
	 */
	@Transactional
	void lock(List<Long> locationIds, String lockIn, String lockOut, String reason);
	
	/**
	 * 库位解锁（只能解锁存货库位）
	 * @param locationIds
	 */
	@Transactional
	void unlock(List<Long> locationIds, String lockIn, String lockOut);
	
	@Transactional
	void storeBatchLocation(Location location, Integer aisleEnd, Integer lineEnd, Integer colEnd, Integer rowEnd, String frontString, Integer aisleCount, String aisleString, Integer lineCount, String lineString, Integer colCount, String colString, Integer rowCount);

	@Transactional
	void editBatchLocations(Location location,List<Long> ids);
	
	@Transactional
	void deleteBatchLocations(List<Long> locationIds);

	/**
	 * 库位分析报告
	 * @param map
	 * @return
	 */
	String locationAnalyze(Map map);
	
	@Transactional
	Location getLocation(String locationCode);
	
	/**添加库位到库位定位*/
	@Transactional
	void addlocationToPosition(Long positionid,List<Long> parentIds,Long zid,String type ,Long sid,String rackType);
	
	/**刪除库位定位中的库位*/
	@Transactional
	void deletelocationFromPosition(List<Long> ids);
	
	//库位导入
	@Transactional
	void imporLocation(File file);
	//库位更新
	@Transactional
	void imporLocationUpdate(File file);
	//库位代码关联更新
	@Transactional
	void importUpdate(File file);
	@Transactional
	void storeItem(Item item) throws Exception;
}
