feat(qms): Add tablet PQC task record search
- Add tablet-specific query support for PQC task records - Expose controller and service handling for tablet search requests
This commit is contained in:
parent
09cdc953c3
commit
a2817e45ed
|
|
@ -5,6 +5,7 @@ import com.nflg.wms.common.pojo.ApiResult;
|
||||||
import com.nflg.wms.common.pojo.PageData;
|
import com.nflg.wms.common.pojo.PageData;
|
||||||
import com.nflg.wms.common.pojo.qo.QmsPqcTaskRecordDraftQO;
|
import com.nflg.wms.common.pojo.qo.QmsPqcTaskRecordDraftQO;
|
||||||
import com.nflg.wms.common.pojo.qo.QmsPqcTaskRecordSearchQO;
|
import com.nflg.wms.common.pojo.qo.QmsPqcTaskRecordSearchQO;
|
||||||
|
import com.nflg.wms.common.pojo.qo.QmsPqcTaskRecordTabletSearchQO;
|
||||||
import com.nflg.wms.common.pojo.vo.*;
|
import com.nflg.wms.common.pojo.vo.*;
|
||||||
import com.nflg.qms.admin.service.QmsPqcTaskRecordControllerService;
|
import com.nflg.qms.admin.service.QmsPqcTaskRecordControllerService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
|
@ -12,8 +13,6 @@ import jakarta.validation.Valid;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PQC任务 Controller
|
* PQC任务 Controller
|
||||||
*
|
*
|
||||||
|
|
@ -35,6 +34,11 @@ public class QmsPqcTaskRecordController {
|
||||||
return ApiResult.success(pqcTaskRecordService.searchPqcTaskList(request));
|
return ApiResult.success(pqcTaskRecordService.searchPqcTaskList(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/search/tablet")
|
||||||
|
public ApiResult<PageData<QmsPqcTaskRecordTabletPageVO>> searchTablet(@Valid @RequestBody QmsPqcTaskRecordTabletSearchQO request) {
|
||||||
|
return ApiResult.success(pqcTaskRecordService.searchPqcTaskTabletList(request));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 2. 查询PQC任务详情(PC端)
|
* 2. 查询PQC任务详情(PC端)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.nflg.wms.common.exception.NflgException;
|
||||||
import com.nflg.wms.common.pojo.PageData;
|
import com.nflg.wms.common.pojo.PageData;
|
||||||
import com.nflg.wms.common.pojo.qo.QmsPqcTaskRecordDraftQO;
|
import com.nflg.wms.common.pojo.qo.QmsPqcTaskRecordDraftQO;
|
||||||
import com.nflg.wms.common.pojo.qo.QmsPqcTaskRecordSearchQO;
|
import com.nflg.wms.common.pojo.qo.QmsPqcTaskRecordSearchQO;
|
||||||
|
import com.nflg.wms.common.pojo.qo.QmsPqcTaskRecordTabletSearchQO;
|
||||||
import com.nflg.wms.common.pojo.vo.*;
|
import com.nflg.wms.common.pojo.vo.*;
|
||||||
import com.nflg.wms.common.util.UserUtil;
|
import com.nflg.wms.common.util.UserUtil;
|
||||||
import com.nflg.wms.common.util.VUtil;
|
import com.nflg.wms.common.util.VUtil;
|
||||||
|
|
@ -243,6 +244,87 @@ public class QmsPqcTaskRecordControllerService {
|
||||||
return pageData;
|
return pageData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PageData<QmsPqcTaskRecordTabletPageVO> searchPqcTaskTabletList(QmsPqcTaskRecordTabletSearchQO request) {
|
||||||
|
LambdaQueryWrapper<QmsPqcTaskRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
|
if (Boolean.TRUE.equals(request.getIsReview())) {
|
||||||
|
queryWrapper.in(QmsPqcTaskRecord::getStatus, (short) 1, (short) 2, (short) 3)
|
||||||
|
.orderByAsc(QmsPqcTaskRecord::getStatus)
|
||||||
|
.orderByDesc(QmsPqcTaskRecord::getCreateTime);
|
||||||
|
} else {
|
||||||
|
queryWrapper.eq(QmsPqcTaskRecord::getStatus, (short) 0)
|
||||||
|
.isNotNull(QmsPqcTaskRecord::getRelatedTaskId)
|
||||||
|
.orderByDesc(QmsPqcTaskRecord::getCreateTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrUtil.isNotBlank(request.getKey())) {
|
||||||
|
queryWrapper.and(wrapper -> wrapper.like(QmsPqcTaskRecord::getTaskNo, request.getKey())
|
||||||
|
.or()
|
||||||
|
.like(QmsPqcTaskRecord::getModelNo, request.getKey()));
|
||||||
|
}
|
||||||
|
|
||||||
|
Page<QmsPqcTaskRecord> page = pqcTaskRecordService.page(
|
||||||
|
new Page<>(request.getPage(), request.getPageSize()),
|
||||||
|
queryWrapper
|
||||||
|
);
|
||||||
|
|
||||||
|
List<QmsPqcTaskRecordTabletPageVO> voList = new ArrayList<>();
|
||||||
|
if (page.getRecords() != null && !page.getRecords().isEmpty()) {
|
||||||
|
Set<Long> pointIds = page.getRecords().stream()
|
||||||
|
.map(QmsPqcTaskRecord::getInspectionPointId)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
Map<Long, QmsPqcInspectionPoint> pointMap = new HashMap<>();
|
||||||
|
if (!pointIds.isEmpty()) {
|
||||||
|
List<QmsPqcInspectionPoint> points = pqcInspectionPointService.listByIds(pointIds);
|
||||||
|
pointMap = points.stream()
|
||||||
|
.collect(Collectors.toMap(QmsPqcInspectionPoint::getId, p -> p));
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<Long> ruleIds = pointMap.values().stream()
|
||||||
|
.map(QmsPqcInspectionPoint::getPqcRuleId)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
Map<Long, Integer> ruleVersionMap = new HashMap<>();
|
||||||
|
if (!ruleIds.isEmpty()) {
|
||||||
|
List<QmsPqcInspectionRule> rules = pqcInspectionRuleService.listByIds(ruleIds);
|
||||||
|
ruleVersionMap = rules.stream()
|
||||||
|
.collect(Collectors.toMap(QmsPqcInspectionRule::getId, QmsPqcInspectionRule::getRuleVersion));
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<Long, QmsPqcInspectionPoint> finalPointMap = pointMap;
|
||||||
|
Map<Long, Integer> finalRuleVersionMap = ruleVersionMap;
|
||||||
|
|
||||||
|
for (QmsPqcTaskRecord record : page.getRecords()) {
|
||||||
|
QmsPqcTaskRecordTabletPageVO vo = new QmsPqcTaskRecordTabletPageVO();
|
||||||
|
vo.setId(record.getId());
|
||||||
|
vo.setStatus(record.getStatus());
|
||||||
|
vo.setTaskNo(record.getTaskNo());
|
||||||
|
vo.setModelNo(record.getModelNo());
|
||||||
|
vo.setAufnr(record.getAufnr());
|
||||||
|
vo.setCreateTime(record.getCreateTime());
|
||||||
|
vo.setDeadline(null);
|
||||||
|
|
||||||
|
QmsPqcInspectionPoint point = finalPointMap.get(record.getInspectionPointId());
|
||||||
|
if (point != null) {
|
||||||
|
vo.setStepName(point.getStepName());
|
||||||
|
vo.setRuleVersion(finalRuleVersionMap.get(point.getPqcRuleId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
voList.add(vo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PageData<QmsPqcTaskRecordTabletPageVO> pageData = new PageData<>();
|
||||||
|
pageData.setPage((int) page.getCurrent());
|
||||||
|
pageData.setPageSize((int) page.getSize());
|
||||||
|
pageData.setTotal((int) page.getTotal());
|
||||||
|
pageData.setItems(voList);
|
||||||
|
return pageData;
|
||||||
|
}
|
||||||
|
|
||||||
// 其他5个功能将在后续实现...
|
// 其他5个功能将在后续实现...
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.nflg.wms.common.pojo.qo;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PQC任务平板分页查询参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class QmsPqcTaskRecordTabletSearchQO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否为复检
|
||||||
|
*/
|
||||||
|
@NotNull(message = "是否为复检不能为空")
|
||||||
|
private Boolean isReview;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关键字,匹配检验单号或机型编号
|
||||||
|
*/
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页码
|
||||||
|
*/
|
||||||
|
private Integer page = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每页条数
|
||||||
|
*/
|
||||||
|
private Integer pageSize = 10;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
package com.nflg.wms.common.pojo.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PQC任务平板分页返回对象
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class QmsPqcTaskRecordTabletPageVO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务状态
|
||||||
|
*/
|
||||||
|
private Short status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务编号
|
||||||
|
*/
|
||||||
|
private String taskNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机型编号
|
||||||
|
*/
|
||||||
|
private String modelNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 步装名称
|
||||||
|
*/
|
||||||
|
private String stepName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单编号
|
||||||
|
*/
|
||||||
|
private String aufnr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测标准版本
|
||||||
|
*/
|
||||||
|
private Integer ruleVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 限期
|
||||||
|
*/
|
||||||
|
private LocalDateTime deadline;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue