refactor(qms-pdi): 重构PDI检测项及部件管理相关功能
- 将检测项中的部件描述字段改为部件ID,关联部件表数据 - 新增部件管理功能,支持部件的增删改查及排序 - 在PDI检测项新增接口自动处理部件注册及排序 - 批量删除支持区分部件ID和检测项ID,实现联动删除 - 导入检测项时自动识别导入部件,动态创建部件及排序 - 查询检测项时按部件分组返回,提升数据结构清晰度 - 巡检工单及检测结果展示时通过部件ID获取部件名称显示 - 新增API支持根据部件ID查询检测项及现场记录 - QmsPdiReportVO 和 QmsIqcReportVO新增环比统计字段,完善报表数据 - 修改导出模板及分页查询逻辑,统一部件相关字段处理 - 优化图片ID收集及批量查询,提升接口性能和稳定性
This commit is contained in:
parent
6822693429
commit
acdd965b3c
|
|
@ -51,10 +51,9 @@ public class QmsPdiComponentControllerService {
|
||||||
public void add(QmsPdiComponentAddQO request) {
|
public void add(QmsPdiComponentAddQO request) {
|
||||||
QmsPdiComponentAnagement entity = new QmsPdiComponentAnagement()
|
QmsPdiComponentAnagement entity = new QmsPdiComponentAnagement()
|
||||||
.setComponentName(request.getComponentName())
|
.setComponentName(request.getComponentName())
|
||||||
.setDeliveryRulesId(request.getDeliveryRulesId())
|
|
||||||
.setDetectionRulesId(request.getDetectionRulesId())
|
.setDetectionRulesId(request.getDetectionRulesId())
|
||||||
.setCreateBy(UserUtil.getUserName())
|
.setCreateBy(UserUtil.getUserName())
|
||||||
.setCreaeteTime(LocalDateTime.now());
|
.setCreateTime(LocalDateTime.now());
|
||||||
componentService.save(entity);
|
componentService.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -74,9 +73,6 @@ public class QmsPdiComponentControllerService {
|
||||||
if (StrUtil.isNotBlank(request.getComponentName())) {
|
if (StrUtil.isNotBlank(request.getComponentName())) {
|
||||||
updateChain.set(QmsPdiComponentAnagement::getComponentName, request.getComponentName());
|
updateChain.set(QmsPdiComponentAnagement::getComponentName, request.getComponentName());
|
||||||
}
|
}
|
||||||
if (Objects.nonNull(request.getDeliveryRulesId())) {
|
|
||||||
updateChain.set(QmsPdiComponentAnagement::getDeliveryRulesId, request.getDeliveryRulesId());
|
|
||||||
}
|
|
||||||
updateChain.update();
|
updateChain.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -258,10 +258,9 @@ public class QmsPdiDetectionRulesControllerService {
|
||||||
List<QmsPdiComponentAnagement> newComponents = components.stream()
|
List<QmsPdiComponentAnagement> newComponents = components.stream()
|
||||||
.map(item -> new QmsPdiComponentAnagement()
|
.map(item -> new QmsPdiComponentAnagement()
|
||||||
.setDetectionRulesId(newId)
|
.setDetectionRulesId(newId)
|
||||||
.setDeliveryRulesId(item.getDeliveryRulesId())
|
|
||||||
.setComponentName(item.getComponentName())
|
.setComponentName(item.getComponentName())
|
||||||
.setCreateBy(operator)
|
.setCreateBy(operator)
|
||||||
.setCreaeteTime(now))
|
.setCreateTime(now))
|
||||||
.collect(java.util.stream.Collectors.toList());
|
.collect(java.util.stream.Collectors.toList());
|
||||||
componentService.saveBatch(newComponents);
|
componentService.saveBatch(newComponents);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ public class QmsPdiStatusItemControllerService {
|
||||||
component.setDetectionRulesId(request.getDetectionRulesId());
|
component.setDetectionRulesId(request.getDetectionRulesId());
|
||||||
component.setSort(maxComponentSort + 1);
|
component.setSort(maxComponentSort + 1);
|
||||||
component.setCreateBy(operator);
|
component.setCreateBy(operator);
|
||||||
component.setCreaeteTime(now);
|
component.setCreateTime(now);
|
||||||
componentAnagementService.save(component);
|
componentAnagementService.save(component);
|
||||||
|
|
||||||
componentsId = component.getId();
|
componentsId = component.getId();
|
||||||
|
|
@ -342,12 +342,14 @@ public class QmsPdiStatusItemControllerService {
|
||||||
} else {
|
} else {
|
||||||
// 新部件,插入到部件表
|
// 新部件,插入到部件表
|
||||||
currentComponentSort++;
|
currentComponentSort++;
|
||||||
|
// 部件名称:如果以英文字母结束,追加换行符
|
||||||
|
String componentName = appendNewlineIfEndsWithEnglish(dto.getComponentsDes());
|
||||||
QmsPdiComponentAnagement component = new QmsPdiComponentAnagement();
|
QmsPdiComponentAnagement component = new QmsPdiComponentAnagement();
|
||||||
component.setComponentName(dto.getComponentsDes());
|
component.setComponentName(componentName);
|
||||||
component.setDetectionRulesId(detectionRulesId);
|
component.setDetectionRulesId(detectionRulesId);
|
||||||
component.setSort(currentComponentSort);
|
component.setSort(currentComponentSort);
|
||||||
component.setCreateBy(operator);
|
component.setCreateBy(operator);
|
||||||
component.setCreaeteTime(now);
|
component.setCreateTime(now);
|
||||||
componentAnagementService.save(component);
|
componentAnagementService.save(component);
|
||||||
|
|
||||||
componentsId = component.getId();
|
componentsId = component.getId();
|
||||||
|
|
@ -359,13 +361,7 @@ public class QmsPdiStatusItemControllerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理检查核实内容:如果以英文字母结束,追加换行符
|
// 处理检查核实内容:如果以英文字母结束,追加换行符
|
||||||
String content = dto.getInspectionContent();
|
dto.setInspectionContent(appendNewlineIfEndsWithEnglish(dto.getInspectionContent()));
|
||||||
if (StrUtil.isNotBlank(content)) {
|
|
||||||
char lastChar = content.charAt(content.length() - 1);
|
|
||||||
if ((lastChar >= 'a' && lastChar <= 'z') || (lastChar >= 'A' && lastChar <= 'Z')) {
|
|
||||||
dto.setInspectionContent(content + "\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 插入检测项
|
// 插入检测项
|
||||||
int itemSort = componentItemCountMap.getOrDefault(componentsId, 0) + 1;
|
int itemSort = componentItemCountMap.getOrDefault(componentsId, 0) + 1;
|
||||||
|
|
@ -386,6 +382,20 @@ public class QmsPdiStatusItemControllerService {
|
||||||
markMaintained(detectionRulesId);
|
markMaintained(detectionRulesId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 如果文本以英文字母结尾,则追加换行符
|
||||||
|
*/
|
||||||
|
private String appendNewlineIfEndsWithEnglish(String text) {
|
||||||
|
if (StrUtil.isBlank(text)) {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
char lastChar = text.charAt(text.length() - 1);
|
||||||
|
if ((lastChar >= 'a' && lastChar <= 'z') || (lastChar >= 'A' && lastChar <= 'Z')) {
|
||||||
|
return text + "\n";
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
// ========================= 分页查询 =========================
|
// ========================= 分页查询 =========================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,6 @@ public class QmsPdiComponentAddQO {
|
||||||
@NotBlank(message = "部件名称不能为空")
|
@NotBlank(message = "部件名称不能为空")
|
||||||
private String componentName;
|
private String componentName;
|
||||||
|
|
||||||
/**
|
|
||||||
* 动静态检测项ID(必传)
|
|
||||||
*/
|
|
||||||
@NotNull(message = "动静态检测项ID不能为空")
|
|
||||||
private Long deliveryRulesId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PDI检测规则ID(必传)
|
* PDI检测规则ID(必传)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,4 @@ public class QmsPdiComponentUpdateQO {
|
||||||
* 部件名称(可选)
|
* 部件名称(可选)
|
||||||
*/
|
*/
|
||||||
private String componentName;
|
private String componentName;
|
||||||
|
|
||||||
/**
|
|
||||||
* 动静态检测项ID(可选)
|
|
||||||
*/
|
|
||||||
private Long deliveryRulesId;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,6 @@ public class QmsPdiComponentAnagement implements Serializable {
|
||||||
*/
|
*/
|
||||||
private String componentName;
|
private String componentName;
|
||||||
|
|
||||||
/**
|
|
||||||
* 动静态检测项ID
|
|
||||||
*/
|
|
||||||
private Long deliveryRulesId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PDI检测规则ID
|
* PDI检测规则ID
|
||||||
*/
|
*/
|
||||||
|
|
@ -54,5 +49,5 @@ public class QmsPdiComponentAnagement implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
private LocalDateTime creaeteTime;
|
private LocalDateTime createTime;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue