This commit is contained in:
砂糖
2026-03-25 17:22:24 +08:00
14 changed files with 579 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ import com.klp.common.core.validate.EditGroup;
import com.klp.common.enums.BusinessType;
import com.klp.common.utils.poi.ExcelUtil;
import com.klp.domain.vo.WmsCoilPendingActionVo;
import com.klp.domain.vo.WmsCoilPendingActionIdCoilVo;
import com.klp.domain.vo.TheoryCycleRegressionResultVo;
import com.klp.domain.bo.WmsCoilPendingActionBo;
import com.klp.service.IWmsCoilPendingActionService;
@@ -48,6 +49,14 @@ public class WmsCoilPendingActionController extends BaseController {
return iWmsCoilPendingActionService.queryPageList(bo, pageQuery);
}
/**
* 查询钢卷待操作:仅返回 actionId 与 coilId
*/
@GetMapping("/actionCoilIdList")
public R<List<WmsCoilPendingActionIdCoilVo>> actionCoilIdList(WmsCoilPendingActionBo bo) {
return R.ok(iWmsCoilPendingActionService.queryActionIdCoilIdList(bo));
}
/**
* 导出钢卷待操作列表
*/

View File

@@ -0,0 +1,99 @@
package com.klp.controller;
import java.util.List;
import java.util.Arrays;
import lombok.RequiredArgsConstructor;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import com.klp.common.annotation.RepeatSubmit;
import com.klp.common.annotation.Log;
import com.klp.common.core.controller.BaseController;
import com.klp.common.core.domain.PageQuery;
import com.klp.common.core.domain.R;
import com.klp.common.core.validate.AddGroup;
import com.klp.common.core.validate.EditGroup;
import com.klp.common.enums.BusinessType;
import com.klp.common.utils.poi.ExcelUtil;
import com.klp.domain.vo.WmsReportResultStorageVo;
import com.klp.domain.bo.WmsReportResultStorageBo;
import com.klp.service.IWmsReportResultStorageService;
import com.klp.common.core.page.TableDataInfo;
/**
* 报结果存储JSON+横向对比专用)
*
* @author klp
* @date 2026-03-25
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/wms/reportResultStorage")
public class WmsReportResultStorageController extends BaseController {
private final IWmsReportResultStorageService iWmsReportResultStorageService;
/**
* 查询报结果存储JSON+横向对比专用)列表
*/
@GetMapping("/list")
public TableDataInfo<WmsReportResultStorageVo> list(WmsReportResultStorageBo bo, PageQuery pageQuery) {
return iWmsReportResultStorageService.queryPageList(bo, pageQuery);
}
/**
* 导出报结果存储JSON+横向对比专用)列表
*/
@Log(title = "报结果存储JSON+横向对比专用)", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(WmsReportResultStorageBo bo, HttpServletResponse response) {
List<WmsReportResultStorageVo> list = iWmsReportResultStorageService.queryList(bo);
ExcelUtil.exportExcel(list, "报结果存储JSON+横向对比专用)", WmsReportResultStorageVo.class, response);
}
/**
* 获取报结果存储JSON+横向对比专用)详细信息
*
* @param storageId 主键
*/
@GetMapping("/{storageId}")
public R<WmsReportResultStorageVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long storageId) {
return R.ok(iWmsReportResultStorageService.queryById(storageId));
}
/**
* 新增报结果存储JSON+横向对比专用)
*/
@Log(title = "报结果存储JSON+横向对比专用)", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsReportResultStorageBo bo) {
return toAjax(iWmsReportResultStorageService.insertByBo(bo));
}
/**
* 修改报结果存储JSON+横向对比专用)
*/
@Log(title = "报结果存储JSON+横向对比专用)", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsReportResultStorageBo bo) {
return toAjax(iWmsReportResultStorageService.updateByBo(bo));
}
/**
* 删除报结果存储JSON+横向对比专用)
*
* @param storageIds 主键串
*/
@Log(title = "报结果存储JSON+横向对比专用)", businessType = BusinessType.DELETE)
@DeleteMapping("/{storageIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] storageIds) {
return toAjax(iWmsReportResultStorageService.deleteWithValidByIds(Arrays.asList(storageIds), true));
}
}

View File

@@ -0,0 +1,55 @@
package com.klp.domain;
import com.baomidou.mybatisplus.annotation.*;
import com.klp.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* 报结果存储JSON+横向对比专用)对象 wms_report_result_storage
*
* @author klp
* @date 2026-03-25
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("wms_report_result_storage")
public class WmsReportResultStorage extends BaseEntity {
private static final long serialVersionUID=1L;
/**
* 主键ID
*/
@TableId(value = "storage_id")
private Long storageId;
/**
* 报表日期(横向对比用)
*/
private Date reportDate;
/**
* 报表类型(横向对比用)
*/
private String reportType;
/**
* 产线类型(横向对比用)
*/
private String productionLine;
/**
* 报表完整JSON数据
*/
private String reportJson;
/**
* 备注
*/
private String remark;
/**
* 删除标志0=正常1=已删除)
*/
@TableLogic
private Integer delFlag;
}

View File

@@ -0,0 +1,68 @@
package com.klp.domain.bo;
import com.klp.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.*;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
/**
* 报结果存储JSON+横向对比专用)业务对象 wms_report_result_storage
*
* @author klp
* @date 2026-03-25
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WmsReportResultStorageBo extends BaseEntity {
/**
* 主键ID
*/
private Long storageId;
/**
* 报表日期(横向对比用)
*/
private Date reportDate;
/**
* 报表日期开始(时间段筛选)
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date reportDateStart;
/**
* 报表日期结束(时间段筛选)
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date reportDateEnd;
/**
* 报表类型(横向对比用)
*/
private String reportType;
/**
* 产线类型(横向对比用)
*/
private String productionLine;
/**
* 报表完整JSON数据
*/
private String reportJson;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,25 @@
package com.klp.domain.vo;
import lombok.Data;
import java.io.Serializable;
/**
* 钢卷待操作:仅返回 actionId 与 coilId
*/
@Data
public class WmsCoilPendingActionIdCoilVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 操作主键ID
*/
private Long actionId;
/**
* 对应的钢卷ID
*/
private Long coilId;
}

View File

@@ -0,0 +1,64 @@
package com.klp.domain.vo;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.klp.common.annotation.ExcelDictFormat;
import com.klp.common.convert.ExcelDictConvert;
import lombok.Data;
/**
* 报结果存储JSON+横向对比专用)视图对象 wms_report_result_storage
*
* @author klp
* @date 2026-03-25
*/
@Data
@ExcelIgnoreUnannotated
public class WmsReportResultStorageVo {
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
@ExcelProperty(value = "主键ID")
private Long storageId;
/**
* 报表日期(横向对比用)
*/
@ExcelProperty(value = "报表日期", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "横=向对比用")
private Date reportDate;
/**
* 报表类型(横向对比用)
*/
@ExcelProperty(value = "报表类型", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "横=向对比用")
private String reportType;
/**
* 产线类型(横向对比用)
*/
@ExcelProperty(value = "产线类型", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "横=向对比用")
private String productionLine;
/**
* 报表完整JSON数据
*/
@ExcelProperty(value = "报表完整JSON数据")
private String reportJson;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
}

View File

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.klp.common.core.mapper.BaseMapperPlus;
import com.klp.domain.WmsCoilPendingAction;
import com.klp.domain.vo.WmsCoilPendingActionVo;
import com.klp.domain.vo.WmsCoilPendingActionIdCoilVo;
import org.apache.ibatis.annotations.Param;
/**
@@ -17,6 +18,11 @@ public interface WmsCoilPendingActionMapper extends BaseMapperPlus<WmsCoilPendin
Page<WmsCoilPendingActionVo> selectVoPagePlus(Page<Object> build,@Param("ew") QueryWrapper<WmsCoilPendingAction> lqw);
/**
* 仅返回 actionId 与 coilId
*/
java.util.List<WmsCoilPendingActionIdCoilVo> selectActionIdCoilIdList(@Param("ew") QueryWrapper<WmsCoilPendingAction> lqw);
/**
* 更新删除标志(绕过@TableLogic注解限制)
* @param actionId 操作ID

View File

@@ -0,0 +1,15 @@
package com.klp.mapper;
import com.klp.domain.WmsReportResultStorage;
import com.klp.domain.vo.WmsReportResultStorageVo;
import com.klp.common.core.mapper.BaseMapperPlus;
/**
* 报结果存储JSON+横向对比专用Mapper接口
*
* @author klp
* @date 2026-03-25
*/
public interface WmsReportResultStorageMapper extends BaseMapperPlus<WmsReportResultStorageMapper, WmsReportResultStorage, WmsReportResultStorageVo> {
}

View File

@@ -1,6 +1,7 @@
package com.klp.service;
import com.klp.domain.vo.WmsCoilPendingActionVo;
import com.klp.domain.vo.WmsCoilPendingActionIdCoilVo;
import com.klp.domain.bo.WmsCoilPendingActionBo;
import com.klp.common.core.domain.PageQuery;
import com.klp.common.core.page.TableDataInfo;
@@ -33,6 +34,11 @@ public interface IWmsCoilPendingActionService {
*/
List<WmsCoilPendingActionVo> queryList(WmsCoilPendingActionBo bo);
/**
* 查询钢卷待操作:仅返回 actionId 与 coilId 列表
*/
List<WmsCoilPendingActionIdCoilVo> queryActionIdCoilIdList(WmsCoilPendingActionBo bo);
/**
* 新增钢卷待操作
*/

View File

@@ -0,0 +1,49 @@
package com.klp.service;
import com.klp.domain.WmsReportResultStorage;
import com.klp.domain.vo.WmsReportResultStorageVo;
import com.klp.domain.bo.WmsReportResultStorageBo;
import com.klp.common.core.page.TableDataInfo;
import com.klp.common.core.domain.PageQuery;
import java.util.Collection;
import java.util.List;
/**
* 报结果存储JSON+横向对比专用Service接口
*
* @author klp
* @date 2026-03-25
*/
public interface IWmsReportResultStorageService {
/**
* 查询报结果存储JSON+横向对比专用)
*/
WmsReportResultStorageVo queryById(Long storageId);
/**
* 查询报结果存储JSON+横向对比专用)列表
*/
TableDataInfo<WmsReportResultStorageVo> queryPageList(WmsReportResultStorageBo bo, PageQuery pageQuery);
/**
* 查询报结果存储JSON+横向对比专用)列表
*/
List<WmsReportResultStorageVo> queryList(WmsReportResultStorageBo bo);
/**
* 新增报结果存储JSON+横向对比专用)
*/
Boolean insertByBo(WmsReportResultStorageBo bo);
/**
* 修改报结果存储JSON+横向对比专用)
*/
Boolean updateByBo(WmsReportResultStorageBo bo);
/**
* 校验并批量删除报结果存储JSON+横向对比专用)信息
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

View File

@@ -18,6 +18,7 @@ import com.klp.domain.vo.TheoryCyclePointVo;
import com.klp.domain.vo.TheoryCycleRegressionResultVo;
import com.klp.domain.vo.TheoryCycleRegressionVo;
import com.klp.domain.vo.WmsCoilPendingActionVo;
import com.klp.domain.vo.WmsCoilPendingActionIdCoilVo;
import com.klp.mapper.WmsCoilPendingActionMapper;
import com.klp.mapper.WmsMaterialCoilMapper;
import com.klp.service.IWmsCoilPendingActionService;
@@ -149,6 +150,13 @@ public class WmsCoilPendingActionServiceImpl implements IWmsCoilPendingActionSer
return baseMapper.selectVoList(lqw);
}
@Override
public List<WmsCoilPendingActionIdCoilVo> queryActionIdCoilIdList(WmsCoilPendingActionBo bo) {
// 复用与 /list 相同的查询条件buildQueryWrapperPlus
QueryWrapper<WmsCoilPendingAction> lqw = buildQueryWrapperPlus(bo);
return baseMapper.selectActionIdCoilIdList(lqw);
}
private LambdaQueryWrapper<WmsCoilPendingAction> buildQueryWrapper(WmsCoilPendingActionBo bo) {
LambdaQueryWrapper<WmsCoilPendingAction> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getCoilId() != null, WmsCoilPendingAction::getCoilId, bo.getCoilId());

View File

@@ -0,0 +1,144 @@
package com.klp.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.klp.common.core.page.TableDataInfo;
import com.klp.common.core.domain.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.klp.common.exception.ServiceException;
import com.klp.common.utils.StringUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.klp.domain.bo.WmsReportResultStorageBo;
import com.klp.domain.vo.WmsReportResultStorageVo;
import com.klp.domain.WmsReportResultStorage;
import com.klp.mapper.WmsReportResultStorageMapper;
import com.klp.service.IWmsReportResultStorageService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;
/**
* 报结果存储JSON+横向对比专用Service业务层处理
*
* @author klp
* @date 2026-03-25
*/
@RequiredArgsConstructor
@Service
public class WmsReportResultStorageServiceImpl implements IWmsReportResultStorageService {
private final WmsReportResultStorageMapper baseMapper;
/**
* 查询报结果存储JSON+横向对比专用)
*/
@Override
public WmsReportResultStorageVo queryById(Long storageId){
return baseMapper.selectVoById(storageId);
}
/**
* 查询报结果存储JSON+横向对比专用)列表
*/
@Override
public TableDataInfo<WmsReportResultStorageVo> queryPageList(WmsReportResultStorageBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<WmsReportResultStorage> lqw = buildQueryWrapper(bo);
Page<WmsReportResultStorageVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* 查询报结果存储JSON+横向对比专用)列表
*/
@Override
public List<WmsReportResultStorageVo> queryList(WmsReportResultStorageBo bo) {
LambdaQueryWrapper<WmsReportResultStorage> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<WmsReportResultStorage> buildQueryWrapper(WmsReportResultStorageBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<WmsReportResultStorage> lqw = Wrappers.lambdaQuery();
if (bo.getReportDateStart() != null || bo.getReportDateEnd() != null) {
lqw.ge(bo.getReportDateStart() != null, WmsReportResultStorage::getReportDate, bo.getReportDateStart());
lqw.le(bo.getReportDateEnd() != null, WmsReportResultStorage::getReportDate, bo.getReportDateEnd());
} else {
lqw.eq(bo.getReportDate() != null, WmsReportResultStorage::getReportDate, bo.getReportDate());
}
lqw.eq(StringUtils.isNotBlank(bo.getReportType()), WmsReportResultStorage::getReportType, bo.getReportType());
lqw.eq(StringUtils.isNotBlank(bo.getProductionLine()), WmsReportResultStorage::getProductionLine, bo.getProductionLine());
lqw.eq(StringUtils.isNotBlank(bo.getReportJson()), WmsReportResultStorage::getReportJson, bo.getReportJson());
lqw.orderByDesc(WmsReportResultStorage::getReportDate);
return lqw;
}
/**
* 新增报结果存储JSON+横向对比专用)
*/
@Override
public Boolean insertByBo(WmsReportResultStorageBo bo) {
WmsReportResultStorage add = BeanUtil.toBean(bo, WmsReportResultStorage.class);
validEntityBeforeSave(add);
// 当天仅允许存在一条计算结果(精确到“天”);如需修改请走更新接口
Date baseDate = add.getReportDate() != null ? add.getReportDate() : new Date();
ZoneId zone = ZoneId.systemDefault();
LocalDate day = baseDate.toInstant().atZone(zone).toLocalDate();
ZonedDateTime startZdt = day.atStartOfDay(zone);
ZonedDateTime endZdt = day.plusDays(1).atStartOfDay(zone).minusNanos(1);
Date startOfDay = Date.from(startZdt.toInstant());
Date endOfDay = Date.from(endZdt.toInstant());
LambdaQueryWrapper<WmsReportResultStorage> existsQw = Wrappers.lambdaQuery();
existsQw.ge(WmsReportResultStorage::getReportDate, startOfDay)
.le(WmsReportResultStorage::getReportDate, endOfDay)
.eq(StringUtils.isNotBlank(add.getReportType()), WmsReportResultStorage::getReportType, add.getReportType())
.eq(StringUtils.isNotBlank(add.getProductionLine()), WmsReportResultStorage::getProductionLine, add.getProductionLine());
Long cnt = baseMapper.selectCount(existsQw);
if (cnt != null && cnt > 0) {
throw new ServiceException("今天已经存在计算结果了");
}
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setStorageId(add.getStorageId());
}
return flag;
}
/**
* 修改报结果存储JSON+横向对比专用)
*/
@Override
public Boolean updateByBo(WmsReportResultStorageBo bo) {
WmsReportResultStorage update = BeanUtil.toBean(bo, WmsReportResultStorage.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(WmsReportResultStorage entity){
//TODO 做一些数据校验,如唯一约束
}
/**
* 批量删除报结果存储JSON+横向对比专用)
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteBatchIds(ids) > 0;
}
}

View File

@@ -0,0 +1,22 @@
<?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="com.klp.mapper.WmsReportResultStorageMapper">
<resultMap type="com.klp.domain.WmsReportResultStorage" id="WmsReportResultStorageResult">
<result property="storageId" column="storage_id"/>
<result property="reportDate" column="report_date"/>
<result property="reportType" column="report_type"/>
<result property="productionLine" column="production_line"/>
<result property="reportJson" column="report_json"/>
<result property="remark" column="remark"/>
<result property="delFlag" column="del_flag"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
</resultMap>
</mapper>

View File

@@ -90,6 +90,15 @@
${ew.customSqlSegment}
</select>
<!-- 仅返回 actionId 与 coilId -->
<select id="selectActionIdCoilIdList" resultType="com.klp.domain.vo.WmsCoilPendingActionIdCoilVo">
select
wcpa.action_id as actionId,
wcpa.coil_id as coilId
from wms_coil_pending_action wcpa
${ew.customSqlSegment}
</select>
<!-- 根据操作ID和删除标志查询记录(包含已删除记录) -->
<select id="selectByActionIdAndDelFlag" resultType="com.klp.domain.WmsCoilPendingAction">
SELECT *