Merge branch 'qms/yf' into qms/develop
This commit is contained in:
commit
2c1aaf56d0
|
|
@ -10,6 +10,7 @@ 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.common.pojo.vo.QmsPdiTaskRecordSummaryVO;
|
||||
import com.nflg.wms.starter.BaseController;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
|
|
@ -81,4 +82,13 @@ public class QmsPdiTaskRecordController extends BaseController {
|
|||
@NotNull(message = "检测记录ID不能为空") @RequestParam Long id) {
|
||||
return ApiResult.success(taskRecordControllerService.getInspectionImages(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务概要:基本信息 + 各类检测项数量统计
|
||||
*/
|
||||
@GetMapping("summary")
|
||||
public ApiResult<QmsPdiTaskRecordSummaryVO> summary(
|
||||
@NotNull(message = "任务ID不能为空") @RequestParam Long taskId) {
|
||||
return ApiResult.success(taskRecordControllerService.summary(taskId));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,12 +11,15 @@ 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.common.pojo.vo.QmsPdiTaskRecordSummaryVO;
|
||||
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.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;
|
||||
|
|
@ -41,6 +44,9 @@ public class QmsPdiTaskRecordControllerService {
|
|||
@Resource
|
||||
private IQmsPdiTaskRecordService taskRecordService;
|
||||
|
||||
@Resource
|
||||
private IQmsPdiDetectionRulesService detectionRulesService;
|
||||
|
||||
@Resource
|
||||
private IQmsPdiDetectionRulesStatusItemService statusItemService;
|
||||
|
||||
|
|
@ -316,4 +322,53 @@ public class QmsPdiTaskRecordControllerService {
|
|||
}
|
||||
return convertImageIdsToVO(result.getInspectionItemImage());
|
||||
}
|
||||
|
||||
// ========================= 任务概要 =========================
|
||||
|
||||
/**
|
||||
* 查询任务概要信息:基本信息 + 各类检测项数量统计
|
||||
*/
|
||||
public QmsPdiTaskRecordSummaryVO summary(Long taskId) {
|
||||
QmsPdiTaskRecord task = taskRecordService.getById(taskId);
|
||||
if (task == null) {
|
||||
throw new NflgException(STATE.BusinessError, "任务记录不存在");
|
||||
}
|
||||
|
||||
QmsPdiTaskRecordSummaryVO vo = new QmsPdiTaskRecordSummaryVO();
|
||||
vo.setTaskNo(task.getTaskNo());
|
||||
vo.setDeviceNo(task.getDeviceNo());
|
||||
vo.setOrderNo(task.getOrderNo());
|
||||
vo.setRequiredCompletionTime(task.getRequiredCompletionTime());
|
||||
|
||||
// 查询检测规则获取机型编号和检测版本
|
||||
if (task.getDetectionRulesId() != null) {
|
||||
QmsPdiDetectionRules rules = detectionRulesService.getById(task.getDetectionRulesId());
|
||||
if (rules != null) {
|
||||
vo.setMachineNo(rules.getMachineNo());
|
||||
vo.setInspectionVersion(rules.getInspectionVersion());
|
||||
}
|
||||
}
|
||||
|
||||
// 从 qms_pdi_inspection_results 按 inspection_item_type 分组统计
|
||||
List<QmsPdiInspectionResults> results = inspectionResultsService.lambdaQuery()
|
||||
.eq(QmsPdiInspectionResults::getTaskId, taskId)
|
||||
.list();
|
||||
|
||||
int staticCount = 0;
|
||||
int dynamicCount = 0;
|
||||
int specialCount = 0;
|
||||
for (QmsPdiInspectionResults r : results) {
|
||||
if (r.getInspectionItemType() == null) continue;
|
||||
switch (r.getInspectionItemType()) {
|
||||
case 0 -> staticCount++;
|
||||
case 1 -> dynamicCount++;
|
||||
case 3 -> specialCount++;
|
||||
}
|
||||
}
|
||||
vo.setStaticItemCount(staticCount);
|
||||
vo.setDynamicItemCount(dynamicCount);
|
||||
vo.setSpecialItemCount(specialCount);
|
||||
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
package com.nflg.wms.common.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* PDI任务概要信息VO
|
||||
*/
|
||||
@Data
|
||||
public class QmsPdiTaskRecordSummaryVO {
|
||||
|
||||
/**
|
||||
* 检验单号
|
||||
*/
|
||||
private String taskNo;
|
||||
|
||||
/**
|
||||
* 机型编号
|
||||
*/
|
||||
private String machineNo;
|
||||
|
||||
/**
|
||||
* 机台编号
|
||||
*/
|
||||
private String deviceNo;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 检测标准版本
|
||||
*/
|
||||
private String inspectionVersion;
|
||||
|
||||
/**
|
||||
* 要求完成日期
|
||||
*/
|
||||
private LocalDateTime requiredCompletionTime;
|
||||
|
||||
/**
|
||||
* 静态子项数量(inspection_item_type=0)
|
||||
*/
|
||||
private Integer staticItemCount;
|
||||
|
||||
/**
|
||||
* 动态子项数量(inspection_item_type=1)
|
||||
*/
|
||||
private Integer dynamicItemCount;
|
||||
|
||||
/**
|
||||
* 特殊子项数量(inspection_item_type=3)
|
||||
*/
|
||||
private Integer specialItemCount;
|
||||
}
|
||||
Loading…
Reference in New Issue