Merge branch 'qms/yf' into qms/develop
This commit is contained in:
commit
eafe4aeff3
|
|
@ -7,7 +7,6 @@ import com.nflg.wms.common.pojo.qo.QmsPdiDetectionRulesAddQO;
|
|||
import com.nflg.wms.common.pojo.qo.QmsPdiDetectionRulesCopyQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiDetectionRulesSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiDetectionRulesUpdateQO;
|
||||
import com.nflg.qms.admin.pojo.vo.QmsPdiDetectionRulesDetailVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiDetectionRulesVO;
|
||||
import com.nflg.wms.common.util.EecExcelUtil;
|
||||
import com.nflg.wms.starter.BaseController;
|
||||
|
|
@ -150,15 +149,4 @@ public class QmsPdiDetectionRulesController extends BaseController {
|
|||
@RequestBody(required = false) List<Long> ids) throws IOException {
|
||||
pdiDetectionRulesControllerService.export(response, ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询PDI检测规则详情(含动静态检测项、发货前检查项、部件列表)
|
||||
*
|
||||
* @param id 规则ID(必传)
|
||||
*/
|
||||
@GetMapping("detail")
|
||||
public ApiResult<QmsPdiDetectionRulesDetailVO> detail(
|
||||
@NotNull(message = "ID不能为空") @RequestParam Long id) {
|
||||
return ApiResult.success(pdiDetectionRulesControllerService.detail(id));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.nflg.qms.admin.controller;
|
||||
|
||||
import com.nflg.qms.admin.pojo.vo.QmsPdiInspectionResultsDetailVO;
|
||||
import com.nflg.qms.admin.service.QmsPdiInspectionResultsControllerService;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.PageData;
|
||||
|
|
@ -13,7 +12,6 @@ import com.nflg.wms.common.pojo.vo.QmsPdiInspectionResultsPageVO;
|
|||
import com.nflg.wms.starter.BaseController;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
|
@ -62,13 +60,4 @@ public class QmsPdiInspectionResultsController extends BaseController {
|
|||
@RequestBody QmsPdiInspectionResultsSearchQO request) {
|
||||
return ApiResult.success(inspectionResultsControllerService.search(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 按质检单号查询详情(检测项按类型分4个list返回:静态/动态/装车前/特殊)
|
||||
*/
|
||||
@GetMapping("detail")
|
||||
public ApiResult<QmsPdiInspectionResultsDetailVO> detail(
|
||||
@NotBlank(message = "质检单号不能为空") @RequestParam String taskNo) {
|
||||
return ApiResult.success(inspectionResultsControllerService.detail(taskNo));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.nflg.qms.admin.controller;
|
|||
|
||||
import com.nflg.qms.admin.service.QmsPdiStatusItemControllerService;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.PageData;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiSortBatchUpdateQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiStatusItemAddQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiStatusItemExportQO;
|
||||
|
|
@ -93,10 +94,10 @@ public class QmsPdiStatusItemController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 分页查询(按状态分组,各自独立分页返回)
|
||||
* 分页查询(按传入的类型查询单类型分页)
|
||||
*/
|
||||
@GetMapping("/search")
|
||||
public ApiResult<QmsPdiStatusItemGroupVO> search(@Valid QmsPdiStatusItemSearchQO request) {
|
||||
@PostMapping("/search")
|
||||
public ApiResult<PageData<QmsPdiStatusItemGroupVO.QmsPdiStatusItemVO>> search(@Valid @RequestBody QmsPdiStatusItemSearchQO request) {
|
||||
return ApiResult.success(statusItemControllerService.search(request));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@ package com.nflg.qms.admin.controller;
|
|||
import com.nflg.qms.admin.service.QmsPdiTaskRecordControllerService;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.PageData;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordDetailQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordDefectSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordStatusItemDetailQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordTransferQO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiTaskRecordDefectPageVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiTaskRecordDetailVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiTaskRecordPageVO;
|
||||
import com.nflg.wms.starter.BaseController;
|
||||
|
|
@ -46,13 +48,29 @@ public class QmsPdiTaskRecordController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询检测任务详情
|
||||
* 返回:订单编号、机型编号、机台编号、检查版本、检测状态、检验结果、检验员、检验完成日期
|
||||
* 以及4类检测项分页列表:静态、动态、特殊、准备发货
|
||||
* 不合格物料分页查询(已完成+不合格+存在不合格检测项,关联工单流程状态)
|
||||
*/
|
||||
@PostMapping("detail")
|
||||
public ApiResult<QmsPdiTaskRecordDetailVO> detail(@Valid @RequestBody QmsPdiTaskRecordDetailQO request) {
|
||||
return ApiResult.success(taskRecordControllerService.detail(request));
|
||||
@PostMapping("searchDefect")
|
||||
public ApiResult<PageData<QmsPdiTaskRecordDefectPageVO>> searchDefect(@RequestBody QmsPdiTaskRecordDefectSearchQO request) {
|
||||
return ApiResult.success(taskRecordControllerService.searchDefect(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 准备发货详情(装车前检测项,不分页)
|
||||
*/
|
||||
@GetMapping("loadingDetail")
|
||||
public ApiResult<List<QmsPdiTaskRecordDetailVO.LoadingItemDetailVO>> loadingDetail(
|
||||
@NotNull(message = "任务记录ID不能为空") @RequestParam Long id) {
|
||||
return ApiResult.success(taskRecordControllerService.loadingDetail(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 静态/动态/特殊检测项详情(分页)
|
||||
*/
|
||||
@PostMapping("statusItemDetail")
|
||||
public ApiResult<PageData<QmsPdiTaskRecordDetailVO.StatusItemVO>> statusItemDetail(
|
||||
@Valid @RequestBody QmsPdiTaskRecordStatusItemDetailQO request) {
|
||||
return ApiResult.success(taskRecordControllerService.statusItemDetail(request));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
package com.nflg.qms.admin.pojo.vo;
|
||||
|
||||
import com.nflg.wms.repository.entity.QmsPdiComponentAnagement;
|
||||
import com.nflg.wms.repository.entity.QmsPdiDetectionRules;
|
||||
import com.nflg.wms.repository.entity.QmsPdiDetectionRulesDeliveryItem;
|
||||
import com.nflg.wms.repository.entity.QmsPdiDetectionRulesStatusItem;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* PDI检测规则详情 VO(含4张关联表数据)
|
||||
*/
|
||||
@Data
|
||||
public class QmsPdiDetectionRulesDetailVO {
|
||||
|
||||
/**
|
||||
* 检测规则主表数据
|
||||
*/
|
||||
private QmsPdiDetectionRules rules;
|
||||
|
||||
/**
|
||||
* 动静态检测项列表(qms_pdi_detection_rules_status_item)
|
||||
*/
|
||||
private List<QmsPdiDetectionRulesStatusItem> statusItems;
|
||||
|
||||
/**
|
||||
* 发货前检查项列表(qms_pdi_detection_rules_delivery_item)
|
||||
*/
|
||||
private List<QmsPdiDetectionRulesDeliveryItem> deliveryItems;
|
||||
|
||||
/**
|
||||
* 部件列表(qms_pdi_component_anagement)
|
||||
*/
|
||||
private List<QmsPdiComponentAnagement> components;
|
||||
}
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
package com.nflg.qms.admin.pojo.vo;
|
||||
|
||||
import com.nflg.wms.repository.entity.QmsPdiInspectionResults;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* PDI现场检测记录 详情VO(按 taskNo 查询)
|
||||
*/
|
||||
@Data
|
||||
public class QmsPdiInspectionResultsDetailVO {
|
||||
|
||||
/**
|
||||
* 任务单ID
|
||||
*/
|
||||
private Long taskId;
|
||||
|
||||
/**
|
||||
* 机型编号
|
||||
*/
|
||||
private String machineNo;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 机台编号
|
||||
*/
|
||||
private String deviceNo;
|
||||
|
||||
/**
|
||||
* 质检单号/任务单号
|
||||
*/
|
||||
private String taskNo;
|
||||
|
||||
/**
|
||||
* 质检版本
|
||||
*/
|
||||
private String inspectionVersion;
|
||||
|
||||
/**
|
||||
* 送检时间
|
||||
*/
|
||||
private LocalDateTime submissionTime;
|
||||
|
||||
/**
|
||||
* 要求完成时间
|
||||
*/
|
||||
private LocalDateTime requiredCompletionTime;
|
||||
|
||||
/**
|
||||
* 静态检测项列表(inspection_item_type=0)
|
||||
*/
|
||||
private List<QmsPdiInspectionResults> staticItems;
|
||||
|
||||
/**
|
||||
* 动态检测项列表(inspection_item_type=1)
|
||||
*/
|
||||
private List<QmsPdiInspectionResults> dynamicItems;
|
||||
|
||||
/**
|
||||
* 装车前检测项明细列表(inspection_item_type=2)
|
||||
*/
|
||||
private List<LoadingItemDetailVO> loadingItems;
|
||||
|
||||
/**
|
||||
* 特殊检测项列表(inspection_item_type=3)
|
||||
*/
|
||||
private List<QmsPdiInspectionResults> specialItems;
|
||||
|
||||
/**
|
||||
* 装车前检测项明细VO
|
||||
*/
|
||||
@Data
|
||||
public static class LoadingItemDetailVO {
|
||||
|
||||
/**
|
||||
* 发货检查项ID
|
||||
*/
|
||||
private Long deliveryItemId;
|
||||
|
||||
/**
|
||||
* 检查项目
|
||||
*/
|
||||
private String checklist;
|
||||
|
||||
/**
|
||||
* 现场图片/视频列表
|
||||
*/
|
||||
private List<String> inspectionItemImage;
|
||||
}
|
||||
}
|
||||
|
|
@ -13,7 +13,6 @@ import com.nflg.wms.common.pojo.qo.QmsPdiDetectionRulesCopyQO;
|
|||
import com.nflg.wms.common.pojo.qo.QmsPdiDetectionRulesSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiDetectionRulesUpdateQO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiDetectionRulesVO;
|
||||
import com.nflg.qms.admin.pojo.vo.QmsPdiDetectionRulesDetailVO;
|
||||
import com.nflg.wms.common.util.EecExcelUtil;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
import com.nflg.wms.repository.entity.QmsPdiComponentAnagement;
|
||||
|
|
@ -472,34 +471,4 @@ public class QmsPdiDetectionRulesControllerService {
|
|||
(ids != null && !ids.isEmpty()) ? ids : null);
|
||||
EecExcelUtil.export("PDI检测规则导出", "检测规则列表", data, response);
|
||||
}
|
||||
|
||||
// ========================= 详情 =========================
|
||||
|
||||
/**
|
||||
* 查询PDI检测规则详情(含4张关联表数据)
|
||||
*/
|
||||
public QmsPdiDetectionRulesDetailVO detail(Long id) {
|
||||
QmsPdiDetectionRules rules = pdiDetectionRulesService.getById(id);
|
||||
if (Objects.isNull(rules)) {
|
||||
throw new NflgException(STATE.BusinessError, "PDI检测规则不存在");
|
||||
}
|
||||
List<QmsPdiDetectionRulesStatusItem> statusItems = statusItemService.lambdaQuery()
|
||||
.eq(QmsPdiDetectionRulesStatusItem::getDetectionRulesId, id)
|
||||
.orderByAsc(QmsPdiDetectionRulesStatusItem::getId)
|
||||
.list();
|
||||
List<QmsPdiDetectionRulesDeliveryItem> deliveryItems = deliveryItemService.lambdaQuery()
|
||||
.eq(QmsPdiDetectionRulesDeliveryItem::getDetectionRulesId, id)
|
||||
.orderByAsc(QmsPdiDetectionRulesDeliveryItem::getId)
|
||||
.list();
|
||||
List<QmsPdiComponentAnagement> components = componentService.lambdaQuery()
|
||||
.eq(QmsPdiComponentAnagement::getDetectionRulesId, id)
|
||||
.orderByAsc(QmsPdiComponentAnagement::getId)
|
||||
.list();
|
||||
QmsPdiDetectionRulesDetailVO vo = new QmsPdiDetectionRulesDetailVO();
|
||||
vo.setRules(rules);
|
||||
vo.setStatusItems(statusItems);
|
||||
vo.setDeliveryItems(deliveryItems);
|
||||
vo.setComponents(components);
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.nflg.qms.admin.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.qms.admin.pojo.vo.QmsPdiInspectionResultsDetailVO;
|
||||
import com.nflg.wms.common.constant.STATE;
|
||||
import com.nflg.wms.common.exception.NflgException;
|
||||
import com.nflg.wms.common.pojo.PageData;
|
||||
|
|
@ -11,12 +10,8 @@ import com.nflg.wms.common.pojo.qo.QmsPdiInspectionResultsSubmitQO;
|
|||
import com.nflg.wms.common.pojo.qo.QmsPdiStatusItemsFillQO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiInspectionResultsPageVO;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
import com.nflg.wms.repository.entity.QmsPdiDetectionRules;
|
||||
import com.nflg.wms.repository.entity.QmsPdiDetectionRulesDeliveryItem;
|
||||
import com.nflg.wms.repository.entity.QmsPdiInspectionResults;
|
||||
import com.nflg.wms.repository.entity.QmsPdiTaskRecord;
|
||||
import com.nflg.wms.repository.service.IQmsPdiDetectionRulesDeliveryItemService;
|
||||
import com.nflg.wms.repository.service.IQmsPdiDetectionRulesService;
|
||||
import com.nflg.wms.repository.service.IQmsPdiInspectionResultsService;
|
||||
import com.nflg.wms.repository.service.IQmsPdiTaskRecordService;
|
||||
import jakarta.annotation.Resource;
|
||||
|
|
@ -40,12 +35,6 @@ public class QmsPdiInspectionResultsControllerService {
|
|||
@Resource
|
||||
private IQmsPdiTaskRecordService taskRecordService;
|
||||
|
||||
@Resource
|
||||
private IQmsPdiDetectionRulesService detectionRulesService;
|
||||
|
||||
@Resource
|
||||
private IQmsPdiDetectionRulesDeliveryItemService deliveryItemService;
|
||||
|
||||
// ========================= 动静态检查项填写 =========================
|
||||
|
||||
/**
|
||||
|
|
@ -226,88 +215,4 @@ public class QmsPdiInspectionResultsControllerService {
|
|||
result.setTotal((int) page.getTotal());
|
||||
return result;
|
||||
}
|
||||
|
||||
// ========================= 详情查询 =========================
|
||||
|
||||
/**
|
||||
* 按 taskNo 查询详情,按检验项类型分4个list返回(静态/动态/装车前/特殊)
|
||||
*/
|
||||
public QmsPdiInspectionResultsDetailVO detail(String taskNo) {
|
||||
// 查任务单
|
||||
QmsPdiTaskRecord taskRecord = taskRecordService.lambdaQuery()
|
||||
.eq(QmsPdiTaskRecord::getTaskNo, taskNo)
|
||||
.one();
|
||||
if (Objects.isNull(taskRecord)) {
|
||||
throw new NflgException(STATE.BusinessError, "任务单不存在,taskNo=" + taskNo);
|
||||
}
|
||||
|
||||
// 查检测规则
|
||||
QmsPdiDetectionRules rule = detectionRulesService.getById(taskRecord.getDetectionRulesId());
|
||||
|
||||
// 查现场检测记录(按 task_id)
|
||||
List<QmsPdiInspectionResults> allResults = inspectionResultsService.lambdaQuery()
|
||||
.eq(QmsPdiInspectionResults::getTaskId, taskRecord.getId())
|
||||
.list();
|
||||
|
||||
QmsPdiInspectionResultsDetailVO vo = new QmsPdiInspectionResultsDetailVO();
|
||||
vo.setTaskId(taskRecord.getId());
|
||||
vo.setMachineNo(rule != null ? rule.getMachineNo() : null);
|
||||
vo.setOrderNo(taskRecord.getOrderNo());
|
||||
vo.setDeviceNo(taskRecord.getDeviceNo());
|
||||
vo.setTaskNo(taskRecord.getTaskNo());
|
||||
vo.setInspectionVersion(rule != null ? rule.getInspectionVersion() : null);
|
||||
vo.setSubmissionTime(taskRecord.getSubmissionTime());
|
||||
vo.setRequiredCompletionTime(taskRecord.getRequiredCompletionTime());
|
||||
vo.setStaticItems(allResults.stream()
|
||||
.filter(r -> Objects.equals(r.getInspectionItemType(), 0))
|
||||
.collect(Collectors.toList()));
|
||||
vo.setDynamicItems(allResults.stream()
|
||||
.filter(r -> Objects.equals(r.getInspectionItemType(), 1))
|
||||
.collect(Collectors.toList()));
|
||||
vo.setSpecialItems(allResults.stream()
|
||||
.filter(r -> Objects.equals(r.getInspectionItemType(), 3))
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
// 装车前检测项(type=2),查询所有明细
|
||||
List<QmsPdiInspectionResults> loadingResults = allResults.stream()
|
||||
.filter(r -> Objects.equals(r.getInspectionItemType(), 2))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!loadingResults.isEmpty()) {
|
||||
// 批量查 delivery_item
|
||||
java.util.Set<Long> deliveryItemIds = loadingResults.stream()
|
||||
.map(QmsPdiInspectionResults::getInspectionItemId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
java.util.Map<Long, QmsPdiDetectionRulesDeliveryItem> deliveryItemMap = java.util.Map.of();
|
||||
if (!deliveryItemIds.isEmpty()) {
|
||||
List<QmsPdiDetectionRulesDeliveryItem> deliveryItems = deliveryItemService.listByIds(deliveryItemIds);
|
||||
deliveryItemMap = deliveryItems.stream()
|
||||
.collect(Collectors.toMap(QmsPdiDetectionRulesDeliveryItem::getId, di -> di, (a, b) -> a));
|
||||
}
|
||||
|
||||
// 构建明细列表
|
||||
java.util.Map<Long, QmsPdiDetectionRulesDeliveryItem> finalMap = deliveryItemMap;
|
||||
List<QmsPdiInspectionResultsDetailVO.LoadingItemDetailVO> detailList = new java.util.ArrayList<>();
|
||||
for (QmsPdiInspectionResults lr : loadingResults) {
|
||||
QmsPdiInspectionResultsDetailVO.LoadingItemDetailVO detailVO = new QmsPdiInspectionResultsDetailVO.LoadingItemDetailVO();
|
||||
detailVO.setDeliveryItemId(lr.getInspectionItemId());
|
||||
|
||||
QmsPdiDetectionRulesDeliveryItem di = finalMap.get(lr.getInspectionItemId());
|
||||
if (di != null) {
|
||||
detailVO.setChecklist(di.getChecklist());
|
||||
}
|
||||
|
||||
// 拆分图片
|
||||
if (lr.getInspectionItemImage() != null && !lr.getInspectionItemImage().isEmpty()) {
|
||||
detailVO.setInspectionItemImage(List.of(lr.getInspectionItemImage().split(",")));
|
||||
}
|
||||
|
||||
detailList.add(detailVO);
|
||||
}
|
||||
vo.setLoadingItems(detailList);
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,20 +215,11 @@ public class QmsPdiStatusItemControllerService {
|
|||
// ========================= 分页查询 =========================
|
||||
|
||||
/**
|
||||
* 查询PDI检测项,按状态分组、各自独立分页返回
|
||||
* 查询PDI检测项,按传入的 status 查询单类型分页
|
||||
*/
|
||||
public QmsPdiStatusItemGroupVO search(QmsPdiStatusItemSearchQO request) {
|
||||
QmsPdiStatusItemGroupVO vo = new QmsPdiStatusItemGroupVO();
|
||||
// 静态检测项(status=0)
|
||||
vo.setStaticItems(buildStatusItemPage(request.getDetectionRulesId(), 0,
|
||||
request.getStaticPage(), request.getStaticSize()));
|
||||
// 动态检测项(status=1)
|
||||
vo.setDynamicItems(buildStatusItemPage(request.getDetectionRulesId(), 1,
|
||||
request.getDynamicPage(), request.getDynamicSize()));
|
||||
// 特殊检测项(status=2)
|
||||
vo.setSpecialItems(buildStatusItemPage(request.getDetectionRulesId(), 2,
|
||||
request.getSpecialPage(), request.getSpecialSize()));
|
||||
return vo;
|
||||
public PageData<QmsPdiStatusItemGroupVO.QmsPdiStatusItemVO> search(QmsPdiStatusItemSearchQO request) {
|
||||
return buildStatusItemPage(request.getDetectionRulesId(), request.getStatus(),
|
||||
request.getPage(), request.getPageSize());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,24 +4,22 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.nflg.wms.common.constant.STATE;
|
||||
import com.nflg.wms.common.exception.NflgException;
|
||||
import com.nflg.wms.common.pojo.PageData;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordDetailQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordDefectSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordStatusItemDetailQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordTransferQO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiTaskRecordDetailVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiTaskRecordDefectPageVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiTaskRecordPageVO;
|
||||
import com.nflg.wms.repository.entity.QmsPdiDetectionRules;
|
||||
import com.nflg.wms.repository.entity.QmsPdiDetectionRulesDeliveryItem;
|
||||
import com.nflg.wms.repository.entity.QmsPdiDetectionRulesStatusItem;
|
||||
import com.nflg.wms.repository.entity.QmsPdiInspectionResults;
|
||||
import com.nflg.wms.repository.entity.QmsPdiTaskRecord;
|
||||
import com.nflg.wms.repository.entity.User;
|
||||
import com.nflg.wms.repository.entity.FileUploadRecord;
|
||||
import com.nflg.wms.repository.service.IQmsPdiDetectionRulesDeliveryItemService;
|
||||
import com.nflg.wms.repository.service.IQmsPdiDetectionRulesService;
|
||||
import com.nflg.wms.repository.service.IQmsPdiDetectionRulesStatusItemService;
|
||||
import com.nflg.wms.repository.service.IQmsPdiInspectionResultsService;
|
||||
import com.nflg.wms.repository.service.IQmsPdiTaskRecordService;
|
||||
import com.nflg.wms.repository.service.IUserService;
|
||||
import com.nflg.wms.repository.service.IFileUploadRecordService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -43,9 +41,6 @@ public class QmsPdiTaskRecordControllerService {
|
|||
@Resource
|
||||
private IQmsPdiTaskRecordService taskRecordService;
|
||||
|
||||
@Resource
|
||||
private IQmsPdiDetectionRulesService detectionRulesService;
|
||||
|
||||
@Resource
|
||||
private IQmsPdiDetectionRulesStatusItemService statusItemService;
|
||||
|
||||
|
|
@ -58,9 +53,6 @@ public class QmsPdiTaskRecordControllerService {
|
|||
@Resource
|
||||
private IFileUploadRecordService fileUploadRecordService;
|
||||
|
||||
@Resource
|
||||
private IUserService userService;
|
||||
|
||||
// ========================= 转办 =========================
|
||||
|
||||
/**
|
||||
|
|
@ -90,69 +82,44 @@ public class QmsPdiTaskRecordControllerService {
|
|||
return result;
|
||||
}
|
||||
|
||||
// ========================= ID查询 =========================
|
||||
// ========================= 不合格物料查询 =========================
|
||||
|
||||
/**
|
||||
* 根据ID查询检测任务详情
|
||||
* - 检验结果统一:所有检测项均有结果 → "合格",否则为空
|
||||
* - 检验员:检测规则.质检负责人 → user.username
|
||||
* - 静态/动态/特殊各自独立分页返回,装车前不分页
|
||||
* 不合格物料分页查询(已完成+不合格+存在不合格检测项,关联工单状态)
|
||||
*/
|
||||
public QmsPdiTaskRecordDetailVO detail(QmsPdiTaskRecordDetailQO request) {
|
||||
public PageData<QmsPdiTaskRecordDefectPageVO> searchDefect(QmsPdiTaskRecordDefectSearchQO request) {
|
||||
Page<QmsPdiTaskRecordDefectPageVO> page = taskRecordService.searchDefect(request);
|
||||
PageData<QmsPdiTaskRecordDefectPageVO> result = new PageData<>();
|
||||
result.setItems(page.getRecords());
|
||||
result.setTotal((int) page.getTotal());
|
||||
return result;
|
||||
}
|
||||
|
||||
// ========================= 准备发货详情(装车前检测项,不分页) =========================
|
||||
|
||||
/**
|
||||
* 查询装车前检测项列表(type=2,不分页)
|
||||
*/
|
||||
public List<QmsPdiTaskRecordDetailVO.LoadingItemDetailVO> loadingDetail(Long id) {
|
||||
QmsPdiTaskRecord record = taskRecordService.getById(id);
|
||||
if (Objects.isNull(record)) {
|
||||
throw new NflgException(STATE.BusinessError, "检测任务记录不存在");
|
||||
}
|
||||
return buildLoadingItems(record.getId());
|
||||
}
|
||||
|
||||
// ========================= 静态/动态/特殊检测项详情(分页) =========================
|
||||
|
||||
/**
|
||||
* 查询静态/动态/特殊检测项详情(分页,按类型查询)
|
||||
*/
|
||||
public PageData<QmsPdiTaskRecordDetailVO.StatusItemVO> statusItemDetail(QmsPdiTaskRecordStatusItemDetailQO request) {
|
||||
QmsPdiTaskRecord record = taskRecordService.getById(request.getId());
|
||||
if (Objects.isNull(record)) {
|
||||
throw new NflgException(STATE.BusinessError, "检测任务记录不存在");
|
||||
}
|
||||
|
||||
// 查检测规则
|
||||
QmsPdiDetectionRules rule = detectionRulesService.getById(record.getDetectionRulesId());
|
||||
|
||||
// 查检验员姓名
|
||||
String inspectorName = null;
|
||||
if (rule != null && rule.getInspectorId() != null) {
|
||||
User inspector = userService.getById(rule.getInspectorId());
|
||||
if (inspector != null) {
|
||||
inspectorName = inspector.getUserName();
|
||||
}
|
||||
}
|
||||
|
||||
// 统一检验结果:所有检测项均有结果 → "合格",否则为空
|
||||
long totalResults = inspectionResultsService.lambdaQuery()
|
||||
.eq(QmsPdiInspectionResults::getTaskId, request.getId())
|
||||
.count();
|
||||
long filledResults = inspectionResultsService.lambdaQuery()
|
||||
.eq(QmsPdiInspectionResults::getTaskId, request.getId())
|
||||
.isNotNull(QmsPdiInspectionResults::getInspectionItemResults)
|
||||
.count();
|
||||
String inspectionResult = (totalResults > 0 && filledResults == totalResults) ? "合格" : null;
|
||||
|
||||
// 构建头信息
|
||||
QmsPdiTaskRecordDetailVO vo = new QmsPdiTaskRecordDetailVO();
|
||||
vo.setOrderNo(record.getOrderNo());
|
||||
vo.setMachineNo(rule != null ? rule.getMachineNo() : null);
|
||||
vo.setDeviceNo(record.getDeviceNo());
|
||||
vo.setInspectionVersion(rule != null ? rule.getInspectionVersion() : null);
|
||||
vo.setInspectionEnable(record.getInspectionEnable());
|
||||
vo.setInspectionResult(inspectionResult);
|
||||
vo.setInspectorName(inspectorName);
|
||||
vo.setDetectionCompletionTime(record.getDetectionCompletionTime());
|
||||
|
||||
// 静态检测项(type=0)独立分页
|
||||
vo.setStaticItems(buildStatusItemPage(record.getId(), 0,
|
||||
request.getStaticPage(), request.getStaticSize()));
|
||||
|
||||
// 动态检测项(type=1)独立分页
|
||||
vo.setDynamicItems(buildStatusItemPage(record.getId(), 1,
|
||||
request.getDynamicPage(), request.getDynamicSize()));
|
||||
|
||||
// 特殊检测项(type=3)独立分页
|
||||
vo.setSpecialItems(buildStatusItemPage(record.getId(), 3,
|
||||
request.getSpecialPage(), request.getSpecialSize()));
|
||||
|
||||
// 装车前检测项(type=2)不分页
|
||||
vo.setLoadingItems(buildLoadingItems(record.getId()));
|
||||
|
||||
return vo;
|
||||
return buildStatusItemPage(record.getId(), request.getInspectionItemType(),
|
||||
request.getPage(), request.getPageSize());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@ public class QmsPdiInspectionResultsSearchQO {
|
|||
/**
|
||||
* 当前页
|
||||
*/
|
||||
private Long current = 1L;
|
||||
private Integer page = 1;
|
||||
|
||||
/**
|
||||
* 每页条数
|
||||
*/
|
||||
private Long size = 10L;
|
||||
private Integer pageSize = 20;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import jakarta.validation.constraints.NotNull;
|
|||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* PDI动静态检测项 分页查询请求参数(按状态分组,各自独立分页)
|
||||
* PDI动静态检测项 分页查询请求参数(单类型查询)
|
||||
*/
|
||||
@Data
|
||||
public class QmsPdiStatusItemSearchQO {
|
||||
|
|
@ -16,32 +16,18 @@ public class QmsPdiStatusItemSearchQO {
|
|||
private Long detectionRulesId;
|
||||
|
||||
/**
|
||||
* 静态检测项页码(默认1)
|
||||
* 页码(默认1)
|
||||
*/
|
||||
private Integer staticPage = 1;
|
||||
private Integer page = 1;
|
||||
|
||||
/**
|
||||
* 静态检测项每页条数(默认20)
|
||||
* 每页条数(默认20)
|
||||
*/
|
||||
private Integer staticSize = 20;
|
||||
private Integer pageSize = 20;
|
||||
|
||||
/**
|
||||
* 动态检测项页码(默认1)
|
||||
* PDI检测项类型(必传):0=静态,1=动态,2=特殊
|
||||
*/
|
||||
private Integer dynamicPage = 1;
|
||||
|
||||
/**
|
||||
* 动态检测项每页条数(默认20)
|
||||
*/
|
||||
private Integer dynamicSize = 20;
|
||||
|
||||
/**
|
||||
* 特殊检测项页码(默认1)
|
||||
*/
|
||||
private Integer specialPage = 1;
|
||||
|
||||
/**
|
||||
* 特殊检测项每页条数(默认20)
|
||||
*/
|
||||
private Integer specialSize = 20;
|
||||
@NotNull(message = "PDI检测项类型不能为空")
|
||||
private Integer status;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* PDI不合格物料 分页查询请求参数
|
||||
*/
|
||||
@Data
|
||||
public class QmsPdiTaskRecordDefectSearchQO {
|
||||
|
||||
/**
|
||||
* 机型编号(可选)
|
||||
*/
|
||||
private String machineNo;
|
||||
|
||||
/**
|
||||
* 订单编号(可选)
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 机台编号(可选)
|
||||
*/
|
||||
private String deviceNo;
|
||||
|
||||
/**
|
||||
* 质检人名字(可选,模糊查询)
|
||||
*/
|
||||
private String inspectorName;
|
||||
|
||||
/**
|
||||
* 所属工厂编号(可选)
|
||||
*/
|
||||
private String factoryNo;
|
||||
|
||||
/**
|
||||
* 检验类型(可选):0=新机检测,1=库存检测
|
||||
*/
|
||||
private Integer inspectionType;
|
||||
|
||||
/**
|
||||
* 工单流程状态(可选,来自qms_issue_ticket.status):0=待流转,1=处理中,2=已完成
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 当前页
|
||||
*/
|
||||
private Integer page = 1;
|
||||
|
||||
/**
|
||||
* 每页条数
|
||||
*/
|
||||
private Integer pageSize = 20;
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* PDI检测任务详情查询请求参数
|
||||
*/
|
||||
@Data
|
||||
public class QmsPdiTaskRecordDetailQO {
|
||||
|
||||
/**
|
||||
* 任务单ID(必传)
|
||||
*/
|
||||
@NotNull(message = "任务单ID不能为空")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 静态检测项页码(默认1)
|
||||
*/
|
||||
private Integer staticPage = 1;
|
||||
|
||||
/**
|
||||
* 静态检测项每页条数(默认20)
|
||||
*/
|
||||
private Integer staticSize = 20;
|
||||
|
||||
/**
|
||||
* 动态检测项页码(默认1)
|
||||
*/
|
||||
private Integer dynamicPage = 1;
|
||||
|
||||
/**
|
||||
* 动态检测项每页条数(默认20)
|
||||
*/
|
||||
private Integer dynamicSize = 20;
|
||||
|
||||
/**
|
||||
* 特殊检测项页码(默认1)
|
||||
*/
|
||||
private Integer specialPage = 1;
|
||||
|
||||
/**
|
||||
* 特殊检测项每页条数(默认20)
|
||||
*/
|
||||
private Integer specialSize = 20;
|
||||
}
|
||||
|
|
@ -48,10 +48,10 @@ public class QmsPdiTaskRecordSearchQO {
|
|||
/**
|
||||
* 当前页
|
||||
*/
|
||||
private Long current = 1L;
|
||||
private Integer page = 1;
|
||||
|
||||
/**
|
||||
* 每页条数
|
||||
*/
|
||||
private Long size = 10L;
|
||||
private Integer pageSize = 20;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* PDI检测任务 静态/动态/特殊检测项详情 分页查询请求参数
|
||||
*/
|
||||
@Data
|
||||
public class QmsPdiTaskRecordStatusItemDetailQO {
|
||||
|
||||
/**
|
||||
* 任务记录ID(必传)
|
||||
*/
|
||||
@NotNull(message = "任务记录ID不能为空")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 检测项类型(必传):0=静态,1=动态,3=特殊
|
||||
*/
|
||||
@NotNull(message = "检测项类型不能为空")
|
||||
private Integer inspectionItemType;
|
||||
|
||||
/**
|
||||
* 当前页(默认1)
|
||||
*/
|
||||
private Integer page = 1;
|
||||
|
||||
/**
|
||||
* 每页条数(默认20)
|
||||
*/
|
||||
private Integer pageSize = 20;
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
package com.nflg.wms.common.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* PDI不合格物料 分页查询返回VO
|
||||
*/
|
||||
@Data
|
||||
public class QmsPdiTaskRecordDefectPageVO {
|
||||
|
||||
/**
|
||||
* 任务记录ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 检测任务编号
|
||||
*/
|
||||
private String taskNo;
|
||||
|
||||
/**
|
||||
* 机台编号
|
||||
*/
|
||||
private String deviceNo;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 所属工厂编号
|
||||
*/
|
||||
private String factoryNo;
|
||||
|
||||
/**
|
||||
* 质检类型(来自检测规则):0=新机检测,1=库存检测
|
||||
*/
|
||||
private Integer inspectionType;
|
||||
|
||||
/**
|
||||
* 质检版本号(来自检测规则)
|
||||
*/
|
||||
private String inspectionVersion;
|
||||
|
||||
/**
|
||||
* 机型编号(来自检测规则)
|
||||
*/
|
||||
private String machineNo;
|
||||
|
||||
/**
|
||||
* 质检状态(固定为2=已完成)
|
||||
*/
|
||||
private Integer inspectionEnable;
|
||||
|
||||
/**
|
||||
* 质检结果
|
||||
*/
|
||||
private String inspectionInspection;
|
||||
|
||||
/**
|
||||
* 质检人名字
|
||||
*/
|
||||
private String inspectorName;
|
||||
|
||||
/**
|
||||
* 帮办人名字
|
||||
*/
|
||||
private String assistantName;
|
||||
|
||||
/**
|
||||
* 质检时间(开始检测时间)
|
||||
*/
|
||||
private LocalDateTime startDetectionTime;
|
||||
|
||||
/**
|
||||
* 送检时间
|
||||
*/
|
||||
private LocalDateTime submissionTime;
|
||||
|
||||
/**
|
||||
* 要求完成时间
|
||||
*/
|
||||
private LocalDateTime requiredCompletionTime;
|
||||
|
||||
/**
|
||||
* 完成检测时间
|
||||
*/
|
||||
private LocalDateTime detectionCompletionTime;
|
||||
|
||||
/**
|
||||
* 是否超期
|
||||
*/
|
||||
private Boolean overdue;
|
||||
|
||||
/**
|
||||
* 工单流程状态(来自qms_issue_ticket.status):0=待流转,1=处理中,2=已完成;null=未创建工单
|
||||
*/
|
||||
private Short status;
|
||||
}
|
||||
|
|
@ -1,77 +1,15 @@
|
|||
package com.nflg.wms.common.pojo.vo;
|
||||
|
||||
import com.nflg.wms.common.pojo.PageData;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* PDI检测任务详情 VO
|
||||
* PDI检测任务详情 VO(仅包含内部类定义)
|
||||
*/
|
||||
@Data
|
||||
public class QmsPdiTaskRecordDetailVO {
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 机型编号
|
||||
*/
|
||||
private String machineNo;
|
||||
|
||||
/**
|
||||
* 机台编号
|
||||
*/
|
||||
private String deviceNo;
|
||||
|
||||
/**
|
||||
* 检测版本
|
||||
*/
|
||||
private String inspectionVersion;
|
||||
|
||||
/**
|
||||
* 检测状态:0=待检查,1=检验中,2=已完成
|
||||
*/
|
||||
private Integer inspectionEnable;
|
||||
|
||||
/**
|
||||
* 检验结果:null=未完成(有空项),合格=全部完成
|
||||
*/
|
||||
private String inspectionResult;
|
||||
|
||||
/**
|
||||
* 检验员姓名(检测规则.质检负责人 → user.username)
|
||||
*/
|
||||
private String inspectorName;
|
||||
|
||||
/**
|
||||
* 检验完成日期
|
||||
*/
|
||||
private LocalDateTime detectionCompletionTime;
|
||||
|
||||
/**
|
||||
* 静态检测项列表(inspection_item_type=0,分页)
|
||||
*/
|
||||
private PageData<StatusItemVO> staticItems;
|
||||
|
||||
/**
|
||||
* 动态检测项列表(inspection_item_type=1,分页)
|
||||
*/
|
||||
private PageData<StatusItemVO> dynamicItems;
|
||||
|
||||
/**
|
||||
* 特殊检测项列表(inspection_item_type=3,分页)
|
||||
*/
|
||||
private PageData<StatusItemVO> specialItems;
|
||||
|
||||
/**
|
||||
* 装车前检测项明细列表(inspection_item_type=2,不分页)
|
||||
*/
|
||||
private List<LoadingItemDetailVO> loadingItems;
|
||||
|
||||
/**
|
||||
* 静态/动态/特殊检测项 子VO
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -45,6 +45,11 @@ public class QmsPdiTaskRecordPageVO {
|
|||
*/
|
||||
private String inspectionVersion;
|
||||
|
||||
/**
|
||||
* 机型编号(来自检测规则)
|
||||
*/
|
||||
private String machineNo;
|
||||
|
||||
/**
|
||||
* 质检状态:0待检查,1检验中,2已完成
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ package com.nflg.wms.repository.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordDefectSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordSearchQO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiTaskRecordDefectPageVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiTaskRecordPageVO;
|
||||
import com.nflg.wms.repository.entity.QmsPdiTaskRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
|
@ -19,4 +21,10 @@ public interface QmsPdiTaskRecordMapper extends BaseMapper<QmsPdiTaskRecord> {
|
|||
*/
|
||||
Page<QmsPdiTaskRecordPageVO> search(Page<QmsPdiTaskRecordPageVO> page,
|
||||
@Param("request") QmsPdiTaskRecordSearchQO request);
|
||||
|
||||
/**
|
||||
* 不合格物料分页查询(关联检测规则、质检人、帮办人、工单状态)
|
||||
*/
|
||||
Page<QmsPdiTaskRecordDefectPageVO> searchDefect(Page<QmsPdiTaskRecordDefectPageVO> page,
|
||||
@Param("request") QmsPdiTaskRecordDefectSearchQO request);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ package com.nflg.wms.repository.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordDefectSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordSearchQO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiTaskRecordDefectPageVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiTaskRecordPageVO;
|
||||
import com.nflg.wms.repository.entity.QmsPdiTaskRecord;
|
||||
|
||||
|
|
@ -15,4 +17,9 @@ public interface IQmsPdiTaskRecordService extends IService<QmsPdiTaskRecord> {
|
|||
* 分页查询
|
||||
*/
|
||||
Page<QmsPdiTaskRecordPageVO> search(QmsPdiTaskRecordSearchQO request);
|
||||
|
||||
/**
|
||||
* 不合格物料分页查询
|
||||
*/
|
||||
Page<QmsPdiTaskRecordDefectPageVO> searchDefect(QmsPdiTaskRecordDefectSearchQO request);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class QmsPdiInspectionResultsServiceImpl
|
|||
|
||||
@Override
|
||||
public Page<QmsPdiInspectionResultsPageVO> search(QmsPdiInspectionResultsSearchQO request) {
|
||||
Page<QmsPdiInspectionResultsPageVO> page = new Page<>(request.getCurrent(), request.getSize());
|
||||
Page<QmsPdiInspectionResultsPageVO> page = new Page<>(request.getPage(), request.getPageSize());
|
||||
return baseMapper.search(page, request);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ package com.nflg.wms.repository.service.impl;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordDefectSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiTaskRecordSearchQO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiTaskRecordDefectPageVO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiTaskRecordPageVO;
|
||||
import com.nflg.wms.repository.entity.QmsPdiTaskRecord;
|
||||
import com.nflg.wms.repository.mapper.QmsPdiTaskRecordMapper;
|
||||
|
|
@ -18,7 +20,13 @@ public class QmsPdiTaskRecordServiceImpl extends ServiceImpl<QmsPdiTaskRecordMap
|
|||
|
||||
@Override
|
||||
public Page<QmsPdiTaskRecordPageVO> search(QmsPdiTaskRecordSearchQO request) {
|
||||
Page<QmsPdiTaskRecordPageVO> page = new Page<>(request.getCurrent(), request.getSize());
|
||||
Page<QmsPdiTaskRecordPageVO> page = new Page<>(request.getPage(), request.getPageSize());
|
||||
return baseMapper.search(page, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<QmsPdiTaskRecordDefectPageVO> searchDefect(QmsPdiTaskRecordDefectSearchQO request) {
|
||||
Page<QmsPdiTaskRecordDefectPageVO> page = new Page<>(request.getPage(), request.getPageSize());
|
||||
return baseMapper.searchDefect(page, request);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
t.factory_no AS factoryNo,
|
||||
r.inspection_type AS inspectionType,
|
||||
r.inspection_version AS inspectionVersion,
|
||||
r.machine_no AS machineNo,
|
||||
t.inspection_enable AS inspectionEnable,
|
||||
t.inspection_inspection AS inspectionInspection,
|
||||
ui.user_name AS inspectorName,
|
||||
|
|
@ -46,15 +47,83 @@
|
|||
<if test="request.factoryNo != null and request.factoryNo != ''">
|
||||
AND t.factory_no = #{request.factoryNo}
|
||||
</if>
|
||||
<!-- 排除有不合格项的任务单(允许为空,但不能有false) -->
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM qms_pdi_inspection_results ir
|
||||
WHERE ir.task_id = t.id
|
||||
AND ir.inspection_item_results = false
|
||||
<!-- 合格物料过滤:inspection_enable=0/1不校验;inspection_enable=2校验自身结果+检测项结果(type=2除外) -->
|
||||
AND (
|
||||
t.inspection_enable IN (0, 1)
|
||||
OR (
|
||||
t.inspection_enable = 2
|
||||
AND t.inspection_inspection = '合格'
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM qms_pdi_inspection_results ir
|
||||
WHERE ir.task_id = t.id
|
||||
AND ir.inspection_item_type != 2
|
||||
AND ir.inspection_item_results = false
|
||||
)
|
||||
)
|
||||
)
|
||||
</where>
|
||||
ORDER BY t.id DESC
|
||||
</select>
|
||||
|
||||
<select id="searchDefect" resultType="com.nflg.wms.common.pojo.vo.QmsPdiTaskRecordDefectPageVO">
|
||||
SELECT
|
||||
t.id,
|
||||
t.task_no AS taskNo,
|
||||
t.device_no AS deviceNo,
|
||||
t.order_no AS orderNo,
|
||||
t.factory_no AS factoryNo,
|
||||
r.inspection_type AS inspectionType,
|
||||
r.inspection_version AS inspectionVersion,
|
||||
r.machine_no AS machineNo,
|
||||
t.inspection_enable AS inspectionEnable,
|
||||
t.inspection_inspection AS inspectionInspection,
|
||||
ui.user_name AS inspectorName,
|
||||
ua.user_name AS assistantName,
|
||||
t.start_detection_time AS startDetectionTime,
|
||||
t.submission_time AS submissionTime,
|
||||
t.required_completion_time AS requiredCompletionTime,
|
||||
t.detection_completion_time AS detectionCompletionTime,
|
||||
t.overdue,
|
||||
it.status AS status
|
||||
FROM qms_pdi_task_record t
|
||||
LEFT JOIN qms_pdi_detection_rules r ON r.id = t.detection_rules_id
|
||||
LEFT JOIN "user" ui ON ui.id = r.inspector_id
|
||||
LEFT JOIN "user" ua ON ua.id = t.assistant_id
|
||||
LEFT JOIN qms_issue_ticket it ON it.source_type = 1 AND it.source_id = t.id
|
||||
<where>
|
||||
<!-- 固定条件:已完成 + 不合格 + 存在不合格检测项 -->
|
||||
AND t.inspection_enable = 2
|
||||
AND t.inspection_inspection = '不合格'
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM qms_pdi_inspection_results ir
|
||||
WHERE ir.task_id = t.id
|
||||
AND ir.inspection_item_results = false
|
||||
)
|
||||
<if test="request.inspectionType != null">
|
||||
AND r.inspection_type = #{request.inspectionType}
|
||||
</if>
|
||||
<if test="request.machineNo != null and request.machineNo != ''">
|
||||
AND r.machine_no = #{request.machineNo}
|
||||
</if>
|
||||
<if test="request.orderNo != null and request.orderNo != ''">
|
||||
AND t.order_no = #{request.orderNo}
|
||||
</if>
|
||||
<if test="request.deviceNo != null and request.deviceNo != ''">
|
||||
AND t.device_no = #{request.deviceNo}
|
||||
</if>
|
||||
<if test="request.inspectorName != null and request.inspectorName != ''">
|
||||
AND ui.user_name ILIKE CONCAT('%', #{request.inspectorName}, '%')
|
||||
</if>
|
||||
<if test="request.factoryNo != null and request.factoryNo != ''">
|
||||
AND t.factory_no = #{request.factoryNo}
|
||||
</if>
|
||||
<if test="request.status != null">
|
||||
AND it.status = #{request.status}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY t.id DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue