pqc检测任务修改

This commit is contained in:
yf001217 2026-06-09 18:44:53 +08:00
parent 4a2f6acb05
commit 33c50fdf9c
8 changed files with 71 additions and 65 deletions

View File

@ -76,7 +76,7 @@ public class PqcInspectionRuleAddQO {
private String inspectionContent;
/**
* 检查类型0=工序检查1=关键物料拍照2=关键物料采集多选
* 检查类型0=工序检查1=关键物料拍照2=全部
*/
private List<Integer> inspectionType;

View File

@ -86,7 +86,7 @@ public class PqcInspectionRuleEditQO {
private String inspectionContent;
/**
* 检查类型多选
* 检查类型0=工序检查1=关键物料拍照2=全部
*/
private List<Integer> inspectionType;

View File

@ -34,7 +34,7 @@ public class PqcInspectionPointItemVO {
private String inspectionContent;
/**
* 检查类型0=工序检查1=关键物料拍照2=关键物料采集多选返回数组
* 检查类型0=工序检查1=关键物料拍照2=全部返回数组
*/
private List<Integer> inspectionType;

View File

@ -122,20 +122,20 @@ public class QmsPqcInspectionRuleControllerServiceImpl implements QmsPqcInspecti
Integer level = item.getInspectionLevel();
// 第1类关键物料拍照类
// 包含inspectionType = 0所有+ inspectionType = 2所有
if (type == 0 || type == 2) {
// 包含inspectionType = 1关键物料拍照+ inspectionType = 2全部
if (Objects.equals(type, 1) || Objects.equals(type, 2)) {
materialItems.add(vo);
}
// 第2类和第3类按星级分自检看1/2星QC看3星
if (Objects.equals(level, 1) || Objects.equals(level, 2) || Objects.equals(level, 3)) {
if (Objects.equals(level, 1) || Objects.equals(level, 2)) {
// 星级1或2 自检复核类
selfReviewItems.add(vo);
} else if (Objects.equals(level, 3)) {
// 星级3 QC检测类
qcItems.add(vo);
}
// 第2类自检只看1/2星的工序检查或全部
if ((Objects.equals(type, 0) || Objects.equals(type, 2))
&& (Objects.equals(level, 1) || Objects.equals(level, 2))) {
selfReviewItems.add(vo);
}
// 第3类3星不区分检测/采集全部由复核人员处理
if (Objects.equals(level, 3)) {
qcItems.add(vo);
}
}
@ -222,8 +222,8 @@ public class QmsPqcInspectionRuleControllerServiceImpl implements QmsPqcInspecti
List<PqcInspectionPointItemVO> itemVOs = items.stream()
.map(item -> {
PqcInspectionPointItemVO itemVO = BeanUtil.copyProperties(item, PqcInspectionPointItemVO.class);
// 位标志转换回List
itemVO.setInspectionType(bitmaskToList(item.getInspectionType()));
// 检查类型转换回List
itemVO.setInspectionType(inspectionTypeToList(item.getInspectionType()));
return itemVO;
})
.collect(Collectors.toList());
@ -599,7 +599,7 @@ public class QmsPqcInspectionRuleControllerServiceImpl implements QmsPqcInspecti
item.setInspectionCodeId(point.getId());
item.setSort(sort++);
item.setInspectionContent(itemQO.getInspectionContent());
item.setInspectionType(listToBitmask(itemQO.getInspectionType()));
item.setInspectionType(normalizeInspectionType(itemQO.getInspectionType()));
item.setInspectionMethods(itemQO.getInspectionMethods());
item.setInspectionImgUrl(itemQO.getInspectionImgUrl());
item.setInspectionLevel(itemQO.getInspectionLevel());
@ -656,7 +656,7 @@ public class QmsPqcInspectionRuleControllerServiceImpl implements QmsPqcInspecti
item.setInspectionCodeId(point.getId());
item.setSort(itemQO.getSort() != null ? itemQO.getSort() : sort++);
item.setInspectionContent(itemQO.getInspectionContent());
item.setInspectionType(listToBitmask(itemQO.getInspectionType()));
item.setInspectionType(normalizeInspectionType(itemQO.getInspectionType()));
item.setInspectionMethods(itemQO.getInspectionMethods());
item.setInspectionImgUrl(itemQO.getInspectionImgUrl());
item.setInspectionLevel(itemQO.getInspectionLevel());
@ -669,37 +669,33 @@ public class QmsPqcInspectionRuleControllerServiceImpl implements QmsPqcInspecti
}
}
// ========================= inspectionType 位标志转换 =========================
// ========================= inspectionType 转换 =========================
/**
* 将List<Integer>转换为位标志Integer
* 0=工序检查 bit 0 1
* 1=关键物料拍照 bit 1 2
* 2=关键物料采集 bit 2 4
* 前端兼容数组传参最终保存为枚举0=工序检查1=关键物料拍照2=全部
*/
private Integer listToBitmask(List<Integer> types) {
private Integer normalizeInspectionType(List<Integer> types) {
if (types == null || types.isEmpty()) {
return 0;
}
int result = 0;
for (Integer type : types) {
result |= (1 << type);
if (types.contains(2) || (types.contains(0) && types.contains(1))) {
return 2;
}
return result;
Integer type = types.get(0);
if (Objects.equals(type, 0) || Objects.equals(type, 1)) {
return type;
}
throw new NflgException(STATE.BusinessError, "检查类型只能为0工序检查、1关键物料拍照、2全部");
}
/**
* 将位标志Integer转换为List<Integer>
* 检查类型枚举转换为List<Integer>
*/
private List<Integer> bitmaskToList(Integer bitmask) {
if (bitmask == null || bitmask == 0) {
private List<Integer> inspectionTypeToList(Integer inspectionType) {
if (inspectionType == null) {
return Collections.emptyList();
}
List<Integer> result = new ArrayList<>();
if ((bitmask & 1) != 0) result.add(0);
if ((bitmask & 2) != 0) result.add(1);
if ((bitmask & 4) != 0) result.add(2);
return result;
return List.of(inspectionType);
}
// ========================= 导入 =========================
@ -1028,37 +1024,47 @@ public class QmsPqcInspectionRuleControllerServiceImpl implements QmsPqcInspecti
}
/**
* 解析检查项类别文本 位标志Integer
* 工序检查1, 关键物料采集拍照2, 全部3
* 解析检查项类别文本工序检查0, 关键物料拍照1, 全部2
*/
private Integer parseInspectionTypeText(String text) {
if (StrUtil.isBlank(text)) return 0;
if (StrUtil.isBlank(text)) {
return 0;
}
switch (text.trim()) {
case "工序检查": return 1;
case "关键物料采集拍照": return 2;
case "全部": return 3;
case "工序检查":
return 0;
case "关键物料拍照":
case "关键物料采集拍照":
return 1;
case "全部":
return 2;
default:
// 尝试数字解析
try { return Integer.parseInt(text.trim()); } catch (NumberFormatException e) {
throw new NflgException(STATE.BusinessError, "检查项类别\"" + text + "\"无法识别,请输入:工序检查/关键物料采集拍照/全部");
try {
Integer type = Integer.parseInt(text.trim());
if (Objects.equals(type, 0) || Objects.equals(type, 1) || Objects.equals(type, 2)) {
return type;
}
throw new NumberFormatException();
} catch (NumberFormatException e) {
throw new NflgException(STATE.BusinessError, "检查项类别\"" + text + "\"无法识别,请输入:工序检查/关键物料拍照/全部");
}
}
}
/**
* 位标志Integer 检查项类别文本
* 检查类型枚举 检查项类别文本
*/
private String inspectionTypeToText(Integer bitmask) {
if (bitmask == null || bitmask == 0) return "";
if (bitmask == 1) return "工序检查";
if (bitmask == 2) return "关键物料采集拍照";
if (bitmask == 3) return "全部";
// 其他位标志组合如4=关键物料采集也做处理
if (bitmask == 4) return "关键物料采集";
List<Integer> types = bitmaskToList(bitmask);
return types.stream().map(t -> {
switch (t) { case 0: return "工序检查"; case 1: return "关键物料采集拍照"; case 2: return "关键物料采集"; default: return ""; }
}).collect(Collectors.joining("+"));
private String inspectionTypeToText(Integer inspectionType) {
if (Objects.equals(inspectionType, 0)) {
return "工序检查";
}
if (Objects.equals(inspectionType, 1)) {
return "关键物料拍照";
}
if (Objects.equals(inspectionType, 2)) {
return "全部";
}
return "";
}
/**

View File

@ -44,7 +44,7 @@ public class PqcInspectionRuleExportDTO {
private String inspectionContent;
/**
* 检查项类别工序检查/关键物料采集拍照/全部
* 检查项类别工序检查/关键物料拍照/全部
*/
@ExcelColumn("检查项类别")
private String inspectionTypeText;
@ -91,4 +91,4 @@ public class PqcInspectionRuleExportDTO {
*/
@ExcelColumn("审核状态")
private String auditStatusText;
}
}

View File

@ -43,7 +43,7 @@ public class PqcInspectionRuleImportDTO {
private String inspectionContent;
/**
* 检查项类别必填工序检查/关键物料采集拍照/全部
* 检查项类别必填工序检查/关键物料拍照/全部
*/
@ExcelColumn("检查项类别*")
private String inspectionTypeText;
@ -77,4 +77,4 @@ public class PqcInspectionRuleImportDTO {
*/
@ExcelColumn("错误信息")
private String error;
}
}

View File

@ -12,19 +12,19 @@ public class QmsPqcInspectionPointItemsGroupedVO {
/**
* 第1类关键物料拍照类
* 包含inspectionType = 0所有+ inspectionType = 2所有
* 包含inspectionType = 1关键物料拍照+ inspectionType = 2全部
*/
private List<QmsPqcInspectionPointItemListVO> materialItems;
/**
* 第2类工序检查-自检复核类
* 包含inspectionType = 1且星级=1或2 + inspectionType = 2且星级=1或2
* 包含inspectionType = 0且星级=1或2 + inspectionType = 2且星级=1或2
*/
private List<QmsPqcInspectionPointItemListVO> selfReviewItems;
/**
* 第3类工序检查-QC检测类
* 包含inspectionType = 1且星级=3 + inspectionType = 2且星级=3
* 包含星级=3不区分检查类型
*/
private List<QmsPqcInspectionPointItemListVO> qcItems;
}

View File

@ -47,7 +47,7 @@ public class QmsPqcInspectionPointItems implements Serializable {
private String inspectionContent;
/**
* 检查类型位标志支持多选bit0=工序检查(1), bit1=关键物料拍照(2), bit2=关键物料采集(4)
* 检查类型0=工序检查1=关键物料拍照2=全部
*/
private Integer inspectionType;