Merge remote-tracking branch '惠信/feature/NoScanning' into feature/NoScanning
This commit is contained in:
commit
e1702158ef
|
|
@ -76,7 +76,7 @@ public class PqcInspectionRuleAddQO {
|
|||
private String inspectionContent;
|
||||
|
||||
/**
|
||||
* 检查类型:0=工序检查,1=关键物料拍照,2=关键物料采集(多选)
|
||||
* 检查类型:0=工序检查,1=关键物料拍照,2=全部
|
||||
*/
|
||||
private List<Integer> inspectionType;
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public class PqcInspectionRuleEditQO {
|
|||
private String inspectionContent;
|
||||
|
||||
/**
|
||||
* 检查类型:多选
|
||||
* 检查类型:0=工序检查,1=关键物料拍照,2=全部
|
||||
*/
|
||||
private List<Integer> inspectionType;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class PqcInspectionPointItemVO {
|
|||
private String inspectionContent;
|
||||
|
||||
/**
|
||||
* 检查类型:0=工序检查,1=关键物料拍照,2=关键物料采集(多选,返回数组)
|
||||
* 检查类型:0=工序检查,1=关键物料拍照,2=全部(返回数组)
|
||||
*/
|
||||
private List<Integer> inspectionType;
|
||||
|
||||
|
|
|
|||
|
|
@ -122,21 +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类:工序检查(按类型和星级分)
|
||||
// 包含:inspectionType = 1 或 2
|
||||
if (type == 1 || type == 2) {
|
||||
if (level == 1 || level == 2) {
|
||||
// 星级1或2 → 自检复核类
|
||||
// 第2类:自检只看1/2星的工序检查或全部
|
||||
if ((Objects.equals(type, 0) || Objects.equals(type, 2))
|
||||
&& (Objects.equals(level, 1) || Objects.equals(level, 2))) {
|
||||
selfReviewItems.add(vo);
|
||||
} else if (level == 3) {
|
||||
// 星级3 → QC检测类
|
||||
qcItems.add(vo);
|
||||
}
|
||||
|
||||
// 第3类:3星不区分检测/采集,全部由复核人员处理
|
||||
if (Objects.equals(level, 3)) {
|
||||
qcItems.add(vo);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -223,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());
|
||||
|
|
@ -600,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());
|
||||
|
|
@ -657,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());
|
||||
|
|
@ -670,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);
|
||||
}
|
||||
|
||||
// ========================= 导入 =========================
|
||||
|
|
@ -1029,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 "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class PqcInspectionRuleExportDTO {
|
|||
private String inspectionContent;
|
||||
|
||||
/**
|
||||
* 检查项类别(工序检查/关键物料采集拍照/全部)
|
||||
* 检查项类别(工序检查/关键物料拍照/全部)
|
||||
*/
|
||||
@ExcelColumn("检查项类别")
|
||||
private String inspectionTypeText;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class PqcInspectionRuleImportDTO {
|
|||
private String inspectionContent;
|
||||
|
||||
/**
|
||||
* 检查项类别(必填):工序检查/关键物料采集拍照/全部
|
||||
* 检查项类别(必填):工序检查/关键物料拍照/全部
|
||||
*/
|
||||
@ExcelColumn("检查项类别*")
|
||||
private String inspectionTypeText;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class QmsPqcInspectionPointItems implements Serializable {
|
|||
private String inspectionContent;
|
||||
|
||||
/**
|
||||
* 检查类型(位标志,支持多选):bit0=工序检查(1), bit1=关键物料拍照(2), bit2=关键物料采集(4)
|
||||
* 检查类型:0=工序检查,1=关键物料拍照,2=全部
|
||||
*/
|
||||
private Integer inspectionType;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue