no message
parent
b3c5a94cfe
commit
cdaf0fce14
|
|
@ -4,7 +4,10 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.cpte.modules.basic.dto.AreaDTO;
|
||||
import org.cpte.modules.basic.entity.Area;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
|
|
@ -18,6 +21,8 @@ import org.springframework.beans.BeanUtils;
|
|||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
|
|
@ -47,7 +52,7 @@ public class AreaController extends JeecgController<Area, IAreaService> {
|
|||
*/
|
||||
@Operation(summary = "库区 - 分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<AreaDTO>> queryPageList(Area area,
|
||||
public Result<IPage<Area>> queryPageList(Area area,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "keyword", required = false) String keyword,
|
||||
|
|
@ -58,79 +63,15 @@ public class AreaController extends JeecgController<Area, IAreaService> {
|
|||
if (StringUtils.isNotBlank(keyword)) {
|
||||
queryWrapper.and(wrapper -> wrapper.likeRight("area_code", keyword).or().likeRight("area_name", keyword));
|
||||
}
|
||||
if(StringUtils.isNotBlank(areaCode)){
|
||||
List<String> areaCodes= Arrays.asList(areaCode.split(","));
|
||||
if (StringUtils.isNotBlank(areaCode)) {
|
||||
List<String> areaCodes = Arrays.asList(areaCode.split(","));
|
||||
queryWrapper.in("area_code", areaCodes);
|
||||
}
|
||||
queryWrapper.orderByAsc("create_time");
|
||||
Page<Area> page = new Page<Area>(pageNo, pageSize);
|
||||
IPage<Area> pageList = areaService.page(page, queryWrapper);
|
||||
|
||||
// 将 Entity 转换为 DTO
|
||||
IPage<AreaDTO> dtoPage = pageList.convert(entity -> {
|
||||
AreaDTO dto = new AreaDTO();
|
||||
BeanUtils.copyProperties(entity, dto);
|
||||
return dto;
|
||||
});
|
||||
|
||||
return Result.OK(dtoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param area
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库区 - 添加")
|
||||
@Operation(summary = "库区 - 添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Area area) {
|
||||
areaService.save(area);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param area
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库区 - 编辑")
|
||||
@Operation(summary = "库区 - 编辑")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody Area area) {
|
||||
areaService.updateById(area);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 id 删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库区 - 通过 id 删除")
|
||||
@Operation(summary = "库区 - 通过 id 删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) Long id) {
|
||||
areaService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库区 - 批量删除")
|
||||
@Operation(summary = "库区 - 批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.areaService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -168,4 +109,91 @@ public class AreaController extends JeecgController<Area, IAreaService> {
|
|||
BeanUtils.copyProperties(area, dto);
|
||||
return Result.OK(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param area
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库区 - 添加")
|
||||
@Operation(summary = "库区 - 添加")
|
||||
@RequiresPermissions("base:base_area:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Area area) {
|
||||
areaService.save(area);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param area
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库区 - 编辑")
|
||||
@Operation(summary = "库区 - 编辑")
|
||||
@RequiresPermissions("base:base_area:edit")
|
||||
@RequestMapping(value = "/edit", method = { RequestMethod.PUT, RequestMethod.POST })
|
||||
public Result<String> edit(@RequestBody Area area) {
|
||||
areaService.updateById(area);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 id 删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库区 - 通过 id 删除")
|
||||
@Operation(summary = "库区 - 通过 id 删除")
|
||||
@RequiresPermissions("base:base_area:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) Long id) {
|
||||
areaService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库区 - 批量删除")
|
||||
@Operation(summary = "库区 - 批量删除")
|
||||
@RequiresPermissions("base:base_area:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.areaService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param area
|
||||
*/
|
||||
@RequiresPermissions("base:base_area:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, Area area) {
|
||||
return super.exportXls(request, area, Area.class, "库区");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("base:base_area:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, Area.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ package org.cpte.modules.basic.controller;
|
|||
|
||||
import java.util.Arrays;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.cpte.modules.basic.dto.ItemDTO;
|
||||
import org.cpte.modules.basic.entity.Item;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
|
|
@ -16,16 +18,11 @@ import org.springframework.beans.BeanUtils;
|
|||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
|
||||
/**
|
||||
* @Description: 物料
|
||||
* @author: cpte
|
||||
* @Date: 2025-10-27
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name = "物料")
|
||||
@RestController
|
||||
@RequestMapping("/api/wms/basic/item")
|
||||
|
|
@ -34,25 +31,15 @@ public class ItemController extends JeecgController<Item, IItemService> {
|
|||
@Autowired
|
||||
private IItemService itemService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param item
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "物料 - 分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<ItemDTO>> queryPageList(Item item,
|
||||
public Result<IPage<Item>> queryPageList(Item item,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "keyword", required = false) String keyword,
|
||||
HttpServletRequest req) {
|
||||
|
||||
QueryWrapper<Item> queryWrapper = QueryGenerator.initQueryWrapper(item, req.getParameterMap());
|
||||
// 如果提供了 keyword,则同时对 itemCode 和 itemName 进行模糊搜索
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
queryWrapper.and(wrapper -> wrapper.likeRight("item_code", keyword).or().likeRight("item_name", keyword));
|
||||
}
|
||||
|
|
@ -60,79 +47,9 @@ public class ItemController extends JeecgController<Item, IItemService> {
|
|||
Page<Item> page = new Page<Item>(pageNo, pageSize);
|
||||
IPage<Item> pageList = itemService.page(page, queryWrapper);
|
||||
|
||||
// 将 Entity 转换为 DTO
|
||||
IPage<ItemDTO> dtoPage = pageList.convert(entity -> {
|
||||
ItemDTO dto = new ItemDTO();
|
||||
BeanUtils.copyProperties(entity, dto);
|
||||
return dto;
|
||||
});
|
||||
|
||||
return Result.OK(dtoPage);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "物料 - 添加")
|
||||
@Operation(summary = "物料 - 添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Item item) {
|
||||
itemService.save(item);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "物料 - 编辑")
|
||||
@Operation(summary = "物料 - 编辑")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody Item item) {
|
||||
itemService.updateById(item);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 id 删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "物料 - 通过 id 删除")
|
||||
@Operation(summary = "物料 - 通过 id 删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) Long id) {
|
||||
itemService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "物料 - 批量删除")
|
||||
@Operation(summary = "物料 - 批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.itemService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 id 查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "物料 - 通过 id 查询")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result<ItemDTO> queryById(@PathVariable("id") Long id) {
|
||||
|
|
@ -145,12 +62,6 @@ public class ItemController extends JeecgController<Item, IItemService> {
|
|||
return Result.OK(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过编码查询
|
||||
*
|
||||
* @param itemCode
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "物料 - 通过编码查询")
|
||||
@GetMapping(value = "/code/{itemCode}")
|
||||
public Result<ItemDTO> queryByCode(@PathVariable("itemCode") String itemCode) {
|
||||
|
|
@ -163,4 +74,53 @@ public class ItemController extends JeecgController<Item, IItemService> {
|
|||
return Result.OK(dto);
|
||||
}
|
||||
|
||||
@AutoLog(value = "物料 - 添加")
|
||||
@Operation(summary = "物料 - 添加")
|
||||
@RequiresPermissions("base:base_item:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Item item) {
|
||||
itemService.save(item);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "物料 - 编辑")
|
||||
@Operation(summary = "物料 - 编辑")
|
||||
@RequiresPermissions("base:base_item:edit")
|
||||
@RequestMapping(value = "/edit", method = { RequestMethod.PUT, RequestMethod.POST })
|
||||
public Result<String> edit(@RequestBody Item item) {
|
||||
itemService.updateById(item);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "物料 - 通过 id 删除")
|
||||
@Operation(summary = "物料 - 通过 id 删除")
|
||||
@RequiresPermissions("base:base_item:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) Long id) {
|
||||
itemService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "物料 - 批量删除")
|
||||
@Operation(summary = "物料 - 批量删除")
|
||||
@RequiresPermissions("base:base_item:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.itemService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@RequiresPermissions("base:base_item:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, Item item) {
|
||||
return super.exportXls(request, item, Item.class, "物料");
|
||||
}
|
||||
|
||||
@RequiresPermissions("base:base_item:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, Item.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,10 @@ import java.util.stream.Collectors;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.cpte.modules.basic.dto.PointDTO;
|
||||
import org.cpte.modules.basic.entity.Area;
|
||||
import org.cpte.modules.basic.entity.Point;
|
||||
|
|
@ -21,21 +23,16 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
|
||||
/**
|
||||
* @Description: 库位
|
||||
* @author: cpte
|
||||
* @Date: 2025-10-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name = "库位")
|
||||
@RestController
|
||||
@RequestMapping("/api/wms/basic/point")
|
||||
|
|
@ -47,15 +44,6 @@ public class PointController extends JeecgController<Point, IPointService> {
|
|||
@Autowired
|
||||
private IAreaService areaService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param point
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "库位 - 分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Point>> queryPageList(Point point,
|
||||
|
|
@ -66,13 +54,12 @@ public class PointController extends JeecgController<Point, IPointService> {
|
|||
HttpServletRequest req) {
|
||||
|
||||
QueryWrapper<Point> queryWrapper = QueryGenerator.initQueryWrapper(point, req.getParameterMap());
|
||||
// 如果提供了 keyword,则同时对 pointCode 模糊搜索
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
queryWrapper.and(wrapper -> wrapper.likeRight("point_code", keyword));
|
||||
}
|
||||
if(StringUtils.isNotBlank(areaCode)){
|
||||
if (StringUtils.isNotBlank(areaCode)) {
|
||||
LambdaQueryWrapper<Area> areaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
List<String> areaCodes= Arrays.asList(areaCode.split(","));
|
||||
List<String> areaCodes = Arrays.asList(areaCode.split(","));
|
||||
areaQueryWrapper.in(Area::getAreaCode, areaCodes);
|
||||
List<Area> areaList = areaService.list(areaQueryWrapper);
|
||||
List<Long> areaIds = areaList.stream().map(Area::getId).distinct().toList();
|
||||
|
|
@ -84,93 +71,28 @@ public class PointController extends JeecgController<Point, IPointService> {
|
|||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param point
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库位 - 添加")
|
||||
@Operation(summary = "库位 - 添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Point point) {
|
||||
pointService.save(point);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param point
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库位 - 编辑")
|
||||
@Operation(summary = "库位 - 编辑")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody Point point) {
|
||||
pointService.updateById(point);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 id 删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库位 - 通过 id 删除")
|
||||
@Operation(summary = "库位 - 通过 id 删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) Long id) {
|
||||
pointService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库位 - 批量删除")
|
||||
@Operation(summary = "库位 - 批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.pointService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 id 查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "库位 - 通过 id 查询")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result<Point> queryById(@PathVariable("id") Long id) {
|
||||
public Result<PointDTO> queryById(@PathVariable("id") Long id) {
|
||||
Point point = pointService.getById(id);
|
||||
if (point == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(point);
|
||||
PointDTO dto = new PointDTO();
|
||||
BeanUtils.copyProperties(point, dto);
|
||||
return Result.OK(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过编码查询
|
||||
*
|
||||
* @param pointCode
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "库位 - 通过编码查询")
|
||||
@GetMapping(value = "/code/{pointCode}")
|
||||
public Result<Point> queryByCode(@PathVariable("pointCode") String pointCode) {
|
||||
public Result<PointDTO> queryByCode(@PathVariable("pointCode") String pointCode) {
|
||||
Point point = pointService.validatePoint(pointCode);
|
||||
if (point == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(point);
|
||||
PointDTO dto = new PointDTO();
|
||||
BeanUtils.copyProperties(point, dto);
|
||||
return Result.OK(dto);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询出库工作站")
|
||||
|
|
@ -184,4 +106,53 @@ public class PointController extends JeecgController<Point, IPointService> {
|
|||
return Result.OK(pointCodes);
|
||||
}
|
||||
|
||||
@AutoLog(value = "库位 - 添加")
|
||||
@Operation(summary = "库位 - 添加")
|
||||
@RequiresPermissions("base:base_point:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Point point) {
|
||||
pointService.save(point);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "库位 - 编辑")
|
||||
@Operation(summary = "库位 - 编辑")
|
||||
@RequiresPermissions("base:base_point:edit")
|
||||
@RequestMapping(value = "/edit", method = { RequestMethod.PUT, RequestMethod.POST })
|
||||
public Result<String> edit(@RequestBody Point point) {
|
||||
pointService.updateById(point);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "库位 - 通过 id 删除")
|
||||
@Operation(summary = "库位 - 通过 id 删除")
|
||||
@RequiresPermissions("base:base_point:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) Long id) {
|
||||
pointService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "库位 - 批量删除")
|
||||
@Operation(summary = "库位 - 批量删除")
|
||||
@RequiresPermissions("base:base_point:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.pointService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@RequiresPermissions("base:base_point:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, Point point) {
|
||||
return super.exportXls(request, point, Point.class, "库位");
|
||||
}
|
||||
|
||||
@RequiresPermissions("base:base_point:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, Point.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,16 +4,15 @@ import java.util.Arrays;
|
|||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.cpte.modules.basic.entity.Stock;
|
||||
import org.cpte.modules.basic.service.IStockService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -21,14 +20,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* @Description: 容器
|
||||
* @author: cpte
|
||||
* @Date: 2025-10-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name = "容器")
|
||||
@RestController
|
||||
@RequestMapping("/api/wms/basic/stock")
|
||||
|
|
@ -37,15 +29,6 @@ public class StockController extends JeecgController<Stock, IStockService> {
|
|||
@Autowired
|
||||
private IStockService stockService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param stock
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "容器 - 分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Stock>> queryPageList(Stock stock,
|
||||
|
|
@ -55,7 +38,6 @@ public class StockController extends JeecgController<Stock, IStockService> {
|
|||
@RequestParam(name = "izScan", required = false) boolean izScan,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<Stock> queryWrapper = QueryGenerator.initQueryWrapper(stock, req.getParameterMap());
|
||||
// 如果提供了 keyword,则同时对 stock_code 模糊搜索
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
queryWrapper.and(wrapper -> wrapper.likeRight("stock_code", keyword));
|
||||
}
|
||||
|
|
@ -66,14 +48,9 @@ public class StockController extends JeecgController<Stock, IStockService> {
|
|||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param stock
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "容器 - 添加")
|
||||
@Operation(summary = "容器 - 添加")
|
||||
@RequiresPermissions("base:base_stock:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Stock stock) {
|
||||
stockService.save(stock);
|
||||
|
|
@ -81,54 +58,33 @@ public class StockController extends JeecgController<Stock, IStockService> {
|
|||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param stock
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "容器 - 编辑")
|
||||
@Operation(summary = "容器 - 编辑")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
@RequiresPermissions("base:base_stock:edit")
|
||||
@RequestMapping(value = "/edit", method = { RequestMethod.PUT, RequestMethod.POST })
|
||||
public Result<String> edit(@RequestBody Stock stock) {
|
||||
stockService.updateById(stock);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 id 删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "容器 - 通过 id 删除")
|
||||
@Operation(summary = "容器 - 通过 id 删除")
|
||||
@RequiresPermissions("base:base_stock:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) Long id) {
|
||||
stockService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "容器 - 批量删除")
|
||||
@Operation(summary = "容器 - 批量删除")
|
||||
@RequiresPermissions("base:base_stock:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.stockService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 id 查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "容器 - 通过 id 查询")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result<Stock> queryById(@PathVariable("id") Long id) {
|
||||
|
|
@ -139,12 +95,6 @@ public class StockController extends JeecgController<Stock, IStockService> {
|
|||
return Result.OK(stock);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过编码查询
|
||||
*
|
||||
* @param stockCode
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "容器 - 通过编码查询")
|
||||
@GetMapping(value = "/code/{stockCode}")
|
||||
public Result<Stock> queryByCode(@PathVariable("stockCode") String stockCode) {
|
||||
|
|
@ -155,4 +105,16 @@ public class StockController extends JeecgController<Stock, IStockService> {
|
|||
return Result.OK(stock);
|
||||
}
|
||||
|
||||
@RequiresPermissions("base:base_stock:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, Stock stock) {
|
||||
return super.exportXls(request, stock, Stock.class, "容器");
|
||||
}
|
||||
|
||||
@RequiresPermissions("base:base_stock:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, Stock.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ import java.util.Map;
|
|||
* WMS 入库服务启动类
|
||||
*/
|
||||
@Slf4j
|
||||
@SpringBootApplication(scanBasePackages = {"org.jeecg", "org.cpte", "org.cpte.modules"})
|
||||
@EnableAutoConfiguration(exclude = {MongoAutoConfiguration.class})
|
||||
@SpringBootApplication(scanBasePackages = { "org.jeecg", "org.cpte", "org.cpte.modules" })
|
||||
@EnableAutoConfiguration(exclude = { MongoAutoConfiguration.class })
|
||||
@ImportAutoConfiguration(JustAuthAutoConfiguration.class) // spring boot 3.x justauth 兼容性处理
|
||||
@EnableFeignClients(basePackages = {"org.cpte.feign"}) // 启用 Feign 客户端,包含 client 和 config 包
|
||||
@EnableFeignClients(basePackages = { "org.cpte.feign" }) // 启用 Feign 客户端,包含 client 和 config 包
|
||||
public class WmsInboundApplication extends SpringBootServletInitializer {
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ import io.swagger.v3.oas.annotations.Operation;
|
|||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 入库单
|
||||
* @author: cpte
|
||||
|
|
@ -50,7 +49,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|||
*/
|
||||
@Tag(name = "入库单")
|
||||
@RestController
|
||||
@RequestMapping("/inbound/asn")
|
||||
@RequestMapping("/api/wms/inbound/asn")
|
||||
@Slf4j
|
||||
public class AsnController {
|
||||
|
||||
|
|
@ -88,6 +87,36 @@ public class AsnController {
|
|||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 id 查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "入库单 - 通过 id 查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<Asn> queryById(@RequestParam(name = "id", required = true) Long id) {
|
||||
Asn asn = asnService.getById(id);
|
||||
if (asn == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(asn);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 id 查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "入库明细主表 ID 查询")
|
||||
@GetMapping(value = "/queryAsnDetailByMainId")
|
||||
public Result<List<AsnDetail>> queryAsnDetailListByMainId(@RequestParam(name = "id", required = true) Long id) {
|
||||
List<AsnDetail> asnDetailList = asnDetailService.selectByMainId(id);
|
||||
return Result.OK(asnDetailList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
|
|
@ -114,7 +143,7 @@ public class AsnController {
|
|||
@AutoLog(value = "入库单 - 编辑")
|
||||
@Operation(summary = "入库单 - 编辑")
|
||||
@RequiresPermissions("inbound:data_asn:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
@RequestMapping(value = "/edit", method = { RequestMethod.PUT, RequestMethod.POST })
|
||||
public Result<String> edit(@RequestBody AsnPage asnPage) {
|
||||
Asn existingAsn = asnService.getById(asnPage.getId());
|
||||
if (existingAsn == null) {
|
||||
|
|
@ -156,38 +185,6 @@ public class AsnController {
|
|||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 id 查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "入库单 - 通过 id 查询")
|
||||
@Operation(summary = "入库单 - 通过 id 查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<Asn> queryById(@RequestParam(name = "id", required = true) Long id) {
|
||||
Asn asn = asnService.getById(id);
|
||||
if (asn == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(asn);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 id 查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "入库明细通过主表 ID 查询")
|
||||
@Operation(summary = "入库明细主表 ID 查询")
|
||||
@GetMapping(value = "/queryAsnDetailByMainId")
|
||||
public Result<List<AsnDetail>> queryAsnDetailListByMainId(@RequestParam(name = "id", required = true) Long id) {
|
||||
List<AsnDetail> asnDetailList = asnDetailService.selectByMainId(id);
|
||||
return Result.OK(asnDetailList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出 excel
|
||||
*
|
||||
|
|
@ -202,13 +199,13 @@ public class AsnController {
|
|||
QueryWrapper<Asn> queryWrapper = QueryGenerator.initQueryWrapper(asn, request.getParameterMap());
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
//配置选中数据查询条件
|
||||
// 配置选中数据查询条件
|
||||
String selections = request.getParameter("selections");
|
||||
if (oConvertUtils.isNotEmpty(selections)) {
|
||||
List<String> selectionList = Arrays.asList(selections.split(","));
|
||||
queryWrapper.in("id", selectionList);
|
||||
}
|
||||
//Step.2 获取导出数据
|
||||
// Step.2 获取导出数据
|
||||
List<Asn> asnList = asnService.list(queryWrapper);
|
||||
|
||||
// Step.3 组装 pageList
|
||||
|
|
|
|||
Loading…
Reference in New Issue