package com.prolog.cs.biz.outbound.resource;

import com.prolog.cs.basic.warehouse.model.BaseWmsWarehouseArea;
import com.prolog.cs.basic.warehouse.model.BaseWmsWarehouseMst;
import com.prolog.cs.basic.warehouse.model.BaseWmsWhWorkstation;
import com.prolog.cs.basic.warehouse.model.WmsWhSlideway;
import com.prolog.cs.basic.warehouse.model.dto.WmsWhBldgDTO;
import com.prolog.cs.basic.warehouse.model.dto.WmsWhSlidewayDTO;
import com.prolog.cs.basic.warehouse.model.vo.*;
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.*;

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

@FeignClient(value = "${prolog.service.warehouse}")
public interface WarehouseResource {

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

    @PostMapping("/container/is-enable")
    RestMessage<Boolean> isEnable(@RequestBody ContainerQueryVO queryVO);

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

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

    @PostMapping("/workstation/list-by-locator")
	RestMessage<List<BaseWmsWhWorkstation>> getWorkstationListByLocator(@RequestBody List<String> locatorIds);

    @PostMapping("/workstation/list-by-areacode")
    RestMessage<List<BaseWmsWhWorkstation>> getWorkstationListByAreaCode(@RequestBody Map<String,Object> map);
    
    @GetMapping("/wmsWhBldg/v1/page")
    RestMessage<Page<WmsWhBldgDTO>> list(@RequestParam(value = "warehouseId")String warehouseId,@RequestParam(value = "pageNum") Integer pageNum,@RequestParam(value = "pageSize") Integer pageSize);

    /**
     * 批量查询库位基础信息
     * @param locationIds
     * @return
     */
    @GetMapping("/locator/basic/list")
    RestMessage<List<WarehouseLocatorBasicInfo>> getLocationBasicInfos(@RequestParam("locatorIds") String[] locationIds);

    @RequestMapping(method = RequestMethod.GET, value = "/workstation/queryList",consumes="application/json")
    public RestMessage<List<BaseWmsWhWorkstation>> queryList(WhWorkstationQueryVO queryVO);

    @GetMapping("/locator/locatorIdByCategory")
    RestMessage<String> getLocatorIdByCategory(@RequestParam(value ="areaCategory")String areaCategory,@RequestParam(value ="warehouseId") String warehouseId);

    @GetMapping("/workstage/")
    RestMessage<List<StageInfo>> findStages(@RequestParam(value = "billType") String billType,
                                            @RequestParam(value = "buildingCode") String buildingCode,
                                            @RequestParam(value = "deliveryType") String deliveryType,
                                            @RequestParam(value = "shipLineId") String shipLineId);

    @GetMapping("/locator/info")
    RestMessage<LocationInfo> getLocationInfo(@RequestParam(value = "locationId") String locationId);

    @GetMapping("/workstage/all")
    RestMessage<List<StageInfo>> findAllStages();

    /**
     * 工作站分页查询
     * @param queryVO
     * @return
     */
    @GetMapping("/workstation/page")
    RestMessage<Page<BaseWmsWhWorkstation>> getPage(WhWorkstationQueryVO queryVO);

    /**
     * 工作站查询
     * @param id
     * @return
     */
    @GetMapping("/workstation")
    RestMessage<BaseWmsWhWorkstation> getById(@RequestParam(value = "id")String id);

    /**
     * 根据货位id获取货位所在库房是否是功能库房，key-货位id，value-是否是功能库房(0 不是,1 是)
     *
     * @param locatorIds
     * @return
     */
    @PostMapping("/locator/info-room/getIsFunctionRoom")
    RestMessage<Map<String, String>> getIsFunctionRoomByLocatorId(@RequestBody List<String> locatorIds);

    /**
     * 根据库区编号查询容器体积百分比
     * @param codes
     * @return
     */
    @GetMapping("/baseWmsWarehouseArea/volumePercentageByCodes")
    RestMessage<Map<String, String>> getVolumePercentageByCodes(@RequestParam("codes") String[] codes,@RequestParam("warehouseId")String warehouseId);

    @GetMapping("/baseWmsWarehouseArea/basic/getByAreaCodes")
    RestMessage<List<BaseWmsWarehouseArea>> getByAreaCodes(@RequestParam("warehouseId") String warehouseId,
                                                           @RequestParam(name = "warehouseAreaCodes", required = false) String[] warehouseAreaCodes);

    @PostMapping("/wmsWhSlideway/v1/findByParam")
    RestMessage<List<WmsWhSlideway>> findByParam(WmsWhSlidewayDTO wmsWhSlidewayDTO);

    @PostMapping("/wmsWhSlideway/v1/batchEdit")
    RestMessage<Object> batchEdit(List<WmsWhSlidewayDTO> wmsWhSlidewayDTOList);

    @PostMapping("/warehouse/getByWarehouseCode")
    public RestMessage<Map<String,BaseWmsWarehouseMst>> getByWarehouseCode(@RequestBody Set<String> warehouseCode);

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

    @GetMapping("/baseWmsWarehouseArea/basic/list")
    RestMessage<List<BaseWmsWarehouseArea>> getWarehouseAreaBasicInfos(@RequestParam("warehouseAreaIds") String[] warehouseAreaIds);
}
