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

import java.util.List;
import java.util.Map;

import org.springframework.transaction.annotation.Transactional;

import com.dev.swms.server.model.base.Warehouse;
import com.dev.swms.server.model.base.WarehouseArea;
import com.dev.energy.server.service.BaseManager;

@Transactional(readOnly = true)
public interface WarehouseManager extends BaseManager {
	/**
	 * 保存仓库，进行license验证
	 * @param warehouse
	 */
	@Transactional
	void storeWarehouse(Warehouse warehouse);
	/**
	 * 删除指定的仓库
	 * 系统只删除没有设置库位的仓库
	 * @param warehouseIds 选择的待删除仓库ID集合
	 */
	@Transactional
	void deleteAll(List<Long> warehouseIds);
	@Transactional
	void activeAll(List<Long> warehouseIds);
	
	Warehouse getWarehouseByCode(String code);
	
	Warehouse getWarehouseByLoginName(String loginName);
	
	/**
	 * 将所选仓库授权给用户
	 * @param warehouseId 选择的待授权的仓库ID
	 * @param userIds 所选择待授权用户的ID集合
	 */
	@Transactional
	abstract void invokeUsersToWarehouse(List<Long> userIds,Long warehouseId);

	/**
	 * 将所选仓库反授权给用户
	 * @param warehouseId 选择的待反授权的仓库ID
	 * @param userWarehouseIds 所选择待反授权用户仓库的ID集合
	 */
	@Transactional
	abstract void revokeUsersToWarehouse(List<Long> userWarehouseIds,Long warehouseId);

	/**
	 * 保存库区
	 * @param zone
	 */
	@Transactional
	public void storeZone(WarehouseArea zone);
	/**
	 * 保存库区
	 * @param zone
	 */
	@Transactional
	void storeZoneKams(WarehouseArea zone,String code) ;
	/**
	 * 删除库区
	 * @param zoneIds
	 */
	@Transactional
	public void deleteZoneAll(List<Long> zoneIds);
	/**
	 * 恢复库区
	 * @param zoneIds
	 */
	@Transactional
	void activeZone(List<Long> zoneIds);
	
	Map getThisWarehouse(Map m);
	
	/**
	 * 跟据用户Id获得用户全部的仓库列表
	 * @param userId
	 * @return
	 */
	List<Warehouse> getAvailableWarehousesByUserId(Long userId);
	
	Map getWareHousesForenergy(Map map);
	
	/**
	 * 构造所有仓库的库存可视化信息
	 * @param params
	 * @return
	 */
	Map init_WM_IV(Map params);
	
	@Transactional
	Map update_WM_IV(Map params);
	
	@Transactional
	Map update_WM_ZIV(Map params);
	
	Map init_Zone_IV(Map params);
	
	Map init_Location_IV(Map params);
	
	Map init_Location_RC_IV(Map params);
	
	Map init_Inventory_Data(Map params);
}
