package com.wms_main.controller.wms;

import com.wms_main.model.dto.query.LocationQuery;
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
import com.wms_main.model.dto.response.wms.WmsApiResponse;
import com.wms_main.model.vo.wms.LocationVo;
import com.wms_main.model.vo.wms.PageVo;
import com.wms_main.service.controller.ILocationControllerService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * 卡特相关控制类
 */
@RestController
@ResponseBody
@CrossOrigin
@RequiredArgsConstructor
@RequestMapping("/wms/location")
public class LocationController {
    private final ILocationControllerService locationControllerService;// 库位控制类服务

    /**
     * 初始化库位
     * @param locationQuery 查询
     * @return 创建结果
     */
    @PostMapping("/genLocations")
    public BaseWmsApiResponse genLocations(@RequestBody LocationQuery locationQuery) {
        return locationControllerService.genLocations(locationQuery);
    }

    /**
     * 分页查询库位
     * @param locationQuery 查询参数
     * @return 查询结果
     */
    @PostMapping("/queryLocationsByPage")
    public WmsApiResponse<PageVo<LocationVo>> queryLocationsByPage(@RequestBody LocationQuery locationQuery) {
        return locationControllerService.queryLocationsByPage(locationQuery);
    }
}
