package com.prolog.cs.biz.inbound.remote;

import com.prolog.cs.basic.warehouse.model.BaseWmsWarehouseArea;
import com.prolog.cs.basic.warehouse.model.BaseWmsWarehouseLocator;
import com.prolog.cs.basic.warehouse.model.BaseWmsWarehouseMst;
import com.prolog.cs.basic.warehouse.model.BaseWmsWhContainer;
import com.prolog.cs.basic.warehouse.model.vo.ContainerQueryVO;
import com.prolog.cs.basic.warehouse.model.vo.WarehouseAreaQueryVO;
import com.prolog.cs.basic.warehouse.model.vo.WarehouseLocatorBasicInfo;
import com.prolog.cs.basic.warehouse.model.vo.WhLocatorQueryVO;
import com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.core.pojo.Page;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

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

/**
 * 基础wms仓库服务远程调用
 *
 * @author Xiong
 */
@FeignClient(value = "${prolog.service.warehouse}")
public interface BaseWmsWarehouseCaller {

    /**
     * 获取货位远程接口
     *
     * @param warehouseLocatorCode
     * @param warehouseLocatorName
     * @param warehouseName
     * @param warehouseId
     * @param pageSize
     * @param pageNum
     * @return
     */
    @GetMapping("/locator/page")
    public RestMessage<Page<BaseWmsWarehouseLocator>> getLocatorPage(@RequestParam("warehouseLocatorCode") String warehouseLocatorCode, @RequestParam("warehouseLocatorName") String warehouseLocatorName, @RequestParam("warehouseName") String warehouseName, @RequestParam("warehouseId") String warehouseId, @RequestParam("pageSize") Integer pageSize, @RequestParam("pageNum") Integer pageNum);

    /**
     * 获取容器远程接口
     *
     * @param containerCode
     * @param containerType
     * @param warehouseId
     * @param pageSize
     * @param pageNum
     * @return
     */
    @GetMapping("/container/page")
    public RestMessage<Page<BaseWmsWhContainer>> getContainerPage(@RequestParam("containerCode") String containerCode, @RequestParam("containerType") String containerType, @RequestParam("warehouseId") String warehouseId, @RequestParam("pageSize") Integer pageSize, @RequestParam("pageNum") Integer pageNum);

    /**
     * 根据仓库id,库别查询库区集合
     *
     * @ApiOperation(value = "根据仓库id,库别查询库区集合(简单)")
     */
    @GetMapping("baseWmsWarehouseArea/listSimpleInfo")
    public RestMessage<Object> listSimpleInfo(WarehouseAreaQueryVO queryVO);

    /**
     * 根据货位编码获取货位数据
     *
     * @ApiOperation(value = "根据货位编码获取货位数据")
     * @ApiImplicitParam(name = "queryMap", value =
     * "货位编码集合,数据示例:{warehouseId:'',warehouseLocatorCodes:['','']}")
     */
    @PostMapping("/locator/basic/getLocationsByCodes")
    RestMessage<Map<String, BaseWmsWarehouseLocator>> getLocationsByCodes(@RequestBody Map<String, Object> queryMap);

    @PostMapping("/locator/list")
    RestMessage<List<BaseWmsWarehouseLocator>> getList(@RequestBody WhLocatorQueryVO queryVO);

    /**
     * 根据map条件查询库位map数据
     *
     * @return
     * @ApiOperation(value = "根据map条件查询库位map数据(库位限定用)")
     * @ApiImplicitParam(name = "listMap", value =
     * "数据示例:{'warehouserId':'','warehouseCategoryCode':'库别','locatorIdList':[],'logicIdList':[]}")
     */
    @PostMapping("/locator/basic/getLocations2Map")
    public RestMessage<Map<String, BaseWmsWarehouseLocator>> getLocations2Map(@RequestBody Map<String, Object> listMap);

    /**
     * 容器占用
     */
    //    @ApiOperation(value="容器占用(可批量)")
    @PostMapping("container/used")
    public RestMessage<Object> used(@RequestBody ContainerQueryVO queryVO);

    /**
     * 容器释放
     */
    //    @ApiOperation(value="容器释放(可批量)")
    @PostMapping("container/release")
    public RestMessage<Object> release(@RequestBody ContainerQueryVO queryVO);

    /**
     * 批量查询仓库信息
     *
     * @return 仓库信息
     */
    @GetMapping("/warehouse")
    RestMessage<BaseWmsWarehouseMst> warehouse(@RequestParam("id") String id);

    /**
     * 随机获取货位接口
     *
     * @param locatorQueryMap
     * @return
     */
    @PostMapping("/locator/basic/getRandomLocations2Map")
    public RestMessage<Map<String, BaseWmsWarehouseLocator>> getRandomLocations2Map(@RequestBody Map<String, Object> locatorQueryMap);

    //	  @ApiOperation(value="批次校验容器编号是否存在/可用")
    @PostMapping("/container/batchVaildateEnable")
    public RestMessage<Object> batchVaildateEnable(@RequestBody ContainerQueryVO queryVO);

    @GetMapping("/locator/detail/list")
    public RestMessage<List<Map<String, Object>>> getLocationDetailInfos(@RequestParam(name = "locatorIds") String[] locatorIds);

    @GetMapping("/locator/basic/list")
    public RestMessage<List<WarehouseLocatorBasicInfo>> getLocationBasicInfos(@RequestParam(name = "locatorIds") String[] locatorIds);

    /**
     * 条件查询所有
     */
    @ApiOperation("条件查询所有")
    @PostMapping("/baseWmsWarehouseArea/findAll")
    RestMessage<List<BaseWmsWarehouseArea>> findAll(BaseWmsWarehouseArea dto);


    @GetMapping("/locator/info-code")
    RestMessage<WarehouseLocatorBasicInfo> getLocationInfoByCode(@RequestParam("warehouseId") String warehouseId, @RequestParam("locationCode") String locationCode);


    /**
     * 批量查询仓库信息
     *
     * @return 仓库信息
     */
    @PostMapping("/warehouse/getByWarehouseCode")
    RestMessage<Map<String, BaseWmsWarehouseMst>> getByWarehouseCode(@RequestBody Set<String> warehouseCode);

    @PostMapping("/locator/getLocatorAreaPickMode")
    public RestMessage<Map<String, Boolean>> getLocatorAreaPickMode(@RequestBody List<String> locatorIds);
}
