Merge remote-tracking branch '惠信/feature/NoScanning' into feature/NoScanning

This commit is contained in:
曹鹏飞 2026-06-09 19:27:50 +08:00
commit e1702158ef
8 changed files with 71 additions and 66 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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