feat(wms): 新增WMS月度报功能模块
- 新增WMS月度报实体类、VO、BO及Mapper接口W - 实现MS月度报的增删改查及分页查询功能 - 提供导出Excel报表功能 - 添加权限控制注解及-日志记录 完善下拉框查询接口 - 补充MyBatis XML映射文件基础结构 - qms为状态字段添加中文注释说明取值含义 -qms 增加检测结果判断逻辑及规格比较方法 - qms添加标准规格值判断的TODO标记 - 注释掉DmsRealtimeAlarmReportController中权限校验注解 - 注释掉DmsReportController中故障追溯报表权限校验注解hwmom-htk
parent
d4cc4f4758
commit
e0d9d6fe48
@ -0,0 +1,117 @@
|
||||
package org.dromara.wms.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.wms.domain.vo.WmsMonthlyReportVo;
|
||||
import org.dromara.wms.domain.bo.WmsMonthlyReportBo;
|
||||
import org.dromara.wms.service.IWmsMonthlyReportService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* WMS月度报
|
||||
* 前端访问路由地址为:/wms/wmsMonthlyReport
|
||||
*
|
||||
* @author zch
|
||||
* @date 2025-09-25
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/wmsMonthlyReport")
|
||||
public class WmsMonthlyReportController extends BaseController {
|
||||
|
||||
private final IWmsMonthlyReportService wmsMonthlyReportService;
|
||||
|
||||
/**
|
||||
* 查询WMS月度报列表
|
||||
*/
|
||||
@SaCheckPermission("wms:wmsMonthlyReport:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsMonthlyReportVo> list(WmsMonthlyReportBo bo, PageQuery pageQuery) {
|
||||
return wmsMonthlyReportService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出WMS月度报列表
|
||||
*/
|
||||
@SaCheckPermission("wms:wmsMonthlyReport:export")
|
||||
@Log(title = "WMS月度报", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsMonthlyReportBo bo, HttpServletResponse response) {
|
||||
List<WmsMonthlyReportVo> list = wmsMonthlyReportService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "WMS月度报", WmsMonthlyReportVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取WMS月度报详细信息
|
||||
*
|
||||
* @param reportId 主键
|
||||
*/
|
||||
@SaCheckPermission("wms:wmsMonthlyReport:query")
|
||||
@GetMapping("/{reportId}")
|
||||
public R<WmsMonthlyReportVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long reportId) {
|
||||
return R.ok(wmsMonthlyReportService.queryById(reportId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增WMS月度报
|
||||
*/
|
||||
@SaCheckPermission("wms:wmsMonthlyReport:add")
|
||||
@Log(title = "WMS月度报", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsMonthlyReportBo bo) {
|
||||
return toAjax(wmsMonthlyReportService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改WMS月度报
|
||||
*/
|
||||
@SaCheckPermission("wms:wmsMonthlyReport:edit")
|
||||
@Log(title = "WMS月度报", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsMonthlyReportBo bo) {
|
||||
return toAjax(wmsMonthlyReportService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除WMS月度报
|
||||
*
|
||||
* @param reportIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("wms:wmsMonthlyReport:remove")
|
||||
@Log(title = "WMS月度报", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{reportIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] reportIds) {
|
||||
return toAjax(wmsMonthlyReportService.deleteWithValidByIds(List.of(reportIds), true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下拉框查询WMS月度报列表
|
||||
*/
|
||||
|
||||
@GetMapping("/getWmsMonthlyReportList")
|
||||
public R<List<WmsMonthlyReportVo>> getWmsMonthlyReportList(WmsMonthlyReportBo bo) {
|
||||
List<WmsMonthlyReportVo> list = wmsMonthlyReportService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package org.dromara.wms.mapper;
|
||||
|
||||
import org.dromara.wms.domain.WmsMonthlyReport;
|
||||
import org.dromara.wms.domain.vo.WmsMonthlyReportVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* WMS月度报Mapper接口
|
||||
*
|
||||
* @author zch
|
||||
* @date 2025-09-25
|
||||
*/
|
||||
public interface WmsMonthlyReportMapper extends BaseMapperPlus<WmsMonthlyReport, WmsMonthlyReportVo> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package org.dromara.wms.service;
|
||||
|
||||
import org.dromara.wms.domain.WmsMonthlyReport;
|
||||
import org.dromara.wms.domain.vo.WmsMonthlyReportVo;
|
||||
import org.dromara.wms.domain.bo.WmsMonthlyReportBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* WMS月度报Service接口
|
||||
*
|
||||
* @author zch
|
||||
* @date 2025-09-25
|
||||
*/
|
||||
public interface IWmsMonthlyReportService {
|
||||
|
||||
/**
|
||||
* 查询WMS月度报
|
||||
*
|
||||
* @param reportId 主键
|
||||
* @return WMS月度报
|
||||
*/
|
||||
WmsMonthlyReportVo queryById(Long reportId);
|
||||
|
||||
/**
|
||||
* 分页查询WMS月度报列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return WMS月度报分页列表
|
||||
*/
|
||||
TableDataInfo<WmsMonthlyReportVo> queryPageList(WmsMonthlyReportBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的WMS月度报列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return WMS月度报列表
|
||||
*/
|
||||
List<WmsMonthlyReportVo> queryList(WmsMonthlyReportBo bo);
|
||||
|
||||
/**
|
||||
* 新增WMS月度报
|
||||
*
|
||||
* @param bo WMS月度报
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(WmsMonthlyReportBo bo);
|
||||
|
||||
/**
|
||||
* 修改WMS月度报
|
||||
*
|
||||
* @param bo WMS月度报
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(WmsMonthlyReportBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除WMS月度报信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,150 @@
|
||||
package org.dromara.wms.service.impl;
|
||||
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.wms.domain.bo.WmsMonthlyReportBo;
|
||||
import org.dromara.wms.domain.vo.WmsMonthlyReportVo;
|
||||
import org.dromara.wms.domain.WmsMonthlyReport;
|
||||
import org.dromara.wms.mapper.WmsMonthlyReportMapper;
|
||||
import org.dromara.wms.service.IWmsMonthlyReportService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* WMS月度报Service业务层处理
|
||||
*
|
||||
* @author zch
|
||||
* @date 2025-09-25
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsMonthlyReportServiceImpl implements IWmsMonthlyReportService {
|
||||
|
||||
private final WmsMonthlyReportMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询WMS月度报
|
||||
*
|
||||
* @param reportId 主键
|
||||
* @return WMS月度报
|
||||
*/
|
||||
@Override
|
||||
public WmsMonthlyReportVo queryById(Long reportId){
|
||||
return baseMapper.selectVoById(reportId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询WMS月度报列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return WMS月度报分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsMonthlyReportVo> queryPageList(WmsMonthlyReportBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<WmsMonthlyReport> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsMonthlyReportVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的WMS月度报列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return WMS月度报列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsMonthlyReportVo> queryList(WmsMonthlyReportBo bo) {
|
||||
MPJLambdaWrapper<WmsMonthlyReport> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<WmsMonthlyReport> buildQueryWrapper(WmsMonthlyReportBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<WmsMonthlyReport> lqw = JoinWrappers.lambda(WmsMonthlyReport.class)
|
||||
.selectAll(WmsMonthlyReport.class)
|
||||
.eq(bo.getReportId() != null, WmsMonthlyReport::getReportId, bo.getReportId())
|
||||
.eq(bo.getReportYear() != null, WmsMonthlyReport::getReportYear, bo.getReportYear())
|
||||
.eq(bo.getReportMonth() != null, WmsMonthlyReport::getReportMonth, bo.getReportMonth())
|
||||
.eq(bo.getMaterialTypeId() != null, WmsMonthlyReport::getMaterialTypeId, bo.getMaterialTypeId())
|
||||
.like(StringUtils.isNotBlank(bo.getMaterialTypeName()), WmsMonthlyReport::getMaterialTypeName, bo.getMaterialTypeName())
|
||||
.eq(bo.getCurrentInstockCount() != null, WmsMonthlyReport::getCurrentInstockCount, bo.getCurrentInstockCount())
|
||||
.eq(bo.getCurrentInstockQty() != null, WmsMonthlyReport::getCurrentInstockQty, bo.getCurrentInstockQty())
|
||||
.eq(bo.getCurrentOutstockCount() != null, WmsMonthlyReport::getCurrentOutstockCount, bo.getCurrentOutstockCount())
|
||||
.eq(bo.getCurrentOutstockQty() != null, WmsMonthlyReport::getCurrentOutstockQty, bo.getCurrentOutstockQty())
|
||||
.eq(bo.getLastInstockCount() != null, WmsMonthlyReport::getLastInstockCount, bo.getLastInstockCount())
|
||||
.eq(bo.getLastInstockQty() != null, WmsMonthlyReport::getLastInstockQty, bo.getLastInstockQty())
|
||||
.eq(bo.getLastOutstockCount() != null, WmsMonthlyReport::getLastOutstockCount, bo.getLastOutstockCount())
|
||||
.eq(bo.getLastOutstockQty() != null, WmsMonthlyReport::getLastOutstockQty, bo.getLastOutstockQty())
|
||||
.eq(bo.getInstockCountDiff() != null, WmsMonthlyReport::getInstockCountDiff, bo.getInstockCountDiff())
|
||||
.eq(bo.getInstockQtyDiff() != null, WmsMonthlyReport::getInstockQtyDiff, bo.getInstockQtyDiff())
|
||||
.eq(bo.getOutstockCountDiff() != null, WmsMonthlyReport::getOutstockCountDiff, bo.getOutstockCountDiff())
|
||||
.eq(bo.getOutstockQtyDiff() != null, WmsMonthlyReport::getOutstockQtyDiff, bo.getOutstockQtyDiff())
|
||||
.eq(bo.getInventoryMaterialCount() != null, WmsMonthlyReport::getInventoryMaterialCount, bo.getInventoryMaterialCount())
|
||||
.eq(bo.getInventoryQty() != null, WmsMonthlyReport::getInventoryQty, bo.getInventoryQty())
|
||||
.orderByDesc(WmsMonthlyReport::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增WMS月度报
|
||||
*
|
||||
* @param bo WMS月度报
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsMonthlyReportBo bo) {
|
||||
WmsMonthlyReport add = MapstructUtils.convert(bo, WmsMonthlyReport.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setReportId(add.getReportId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改WMS月度报
|
||||
*
|
||||
* @param bo WMS月度报
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsMonthlyReportBo bo) {
|
||||
WmsMonthlyReport update = MapstructUtils.convert(bo, WmsMonthlyReport.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsMonthlyReport entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除WMS月度报信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.wms.mapper.WmsMonthlyReportMapper">
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue