|
|
|
|
package com.glxp.api.controller.auth;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.glxp.api.common.enums.ResultEnum;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.entity.auth.InvSpace;
|
|
|
|
|
import com.glxp.api.req.auth.FilterInvSpaceRequest;
|
|
|
|
|
import com.glxp.api.req.system.DeleteRequest;
|
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.api.res.auth.InvSpaceResponse;
|
|
|
|
|
import com.glxp.api.service.auth.InvSpaceService;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
|
|
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.RestController;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 货位字典接口
|
|
|
|
|
*/
|
|
|
|
|
@Slf4j
|
|
|
|
|
@RestController
|
|
|
|
|
public class InvSpaceController {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private InvSpaceService invSpaceService;
|
|
|
|
|
|
|
|
|
|
@GetMapping("/spms/inv/space/filter")
|
|
|
|
|
public BaseResponse filterList(FilterInvSpaceRequest filterInvSpaceRequest) {
|
|
|
|
|
List<InvSpaceResponse> list = invSpaceService.filterList(filterInvSpaceRequest);
|
|
|
|
|
PageInfo<InvSpaceResponse> pageInfo = new PageInfo<>(list);
|
|
|
|
|
PageSimpleResponse<InvSpaceResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
pageSimpleResponse.setList(list);
|
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加货位
|
|
|
|
|
*
|
|
|
|
|
* @param invSpace
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/spms/inv/space/add")
|
|
|
|
|
public BaseResponse addSpace(@RequestBody InvSpace invSpace, BindingResult bindingResult) {
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
|
if (null == invSpace) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
|
|
|
|
}
|
|
|
|
|
return invSpaceService.addSpace(invSpace);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除货位
|
|
|
|
|
*
|
|
|
|
|
* @param deleteRequest
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/spms/inv/space/delete")
|
|
|
|
|
public BaseResponse deleteSpace(@RequestBody DeleteRequest deleteRequest) {
|
|
|
|
|
if (null == deleteRequest || StrUtil.isBlank(deleteRequest.getId())) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "参数不能为空");
|
|
|
|
|
}
|
|
|
|
|
return invSpaceService.deleteSpace(deleteRequest.getId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 更新货位信息
|
|
|
|
|
*
|
|
|
|
|
* @param invSpace
|
|
|
|
|
* @param bindingResult
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/spms/inv/space/update")
|
|
|
|
|
public BaseResponse updateSpace(@RequestBody InvSpace invSpace, BindingResult bindingResult) {
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
|
if (null == invSpace) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "参数不能为空");
|
|
|
|
|
}
|
|
|
|
|
return invSpaceService.updateSpace(invSpace);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询货位的编码和名称列表,不分页
|
|
|
|
|
*
|
|
|
|
|
* @param filterInvSpaceRequest
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/spms/inv/space/getSpaceCodeList")
|
|
|
|
|
public BaseResponse getSpaceCodeList(FilterInvSpaceRequest filterInvSpaceRequest) {
|
|
|
|
|
List<InvSpaceResponse> list = invSpaceService.getSpaceCodeList(filterInvSpaceRequest);
|
|
|
|
|
return ResultVOUtils.success(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|