| | |
| | | row.setGroupHidden(i == 0 ? "" : GROUP_CELL_HIDDEN); |
| | | row.setRequirement(i < anchorCount |
| | | ? anchorRequirement(entry.indicator(), row) |
| | | : defaultStr(row.getStandardValue())); |
| | | : defaultStr(row.getRequirement())); |
| | | items.add(row); |
| | | } |
| | | } |
| | |
| | | /** 组头的「检测要求」放公式(分组项只有公式、没有规格),没配公式就照常放标准要求 */ |
| | | private static String anchorRequirement(MesQcIndicatorDO head, MesQcReportItemRespDTO row) { |
| | | String formula = defaultStr(head.getFormulaText()); |
| | | return formula.isEmpty() ? defaultStr(row.getStandardValue()) : formula; |
| | | return formula.isEmpty() ? defaultStr(row.getRequirement()) : formula; |
| | | } |
| | | |
| | | /** 组头没排进本单时补出来的那一行:只有指标本身,没有单据行 */ |
| | |
| | | String detailRemark, Map<Long, MesMdUnitMeasureDO> unitMap, |
| | | MesMdItemDO item) { |
| | | MesMdUnitMeasureDO unit = unitMap.get(line.unitMeasureId()); |
| | | if (unit == null && item != null) { |
| | | unit = unitMap.get(item.getUnitMeasureId()); |
| | | String measureUnit = inspectionUnit(indicator, unit); |
| | | String requirement = inspectionRequirement(line.minThreshold(), line.maxThreshold(), |
| | | line.checkMethod(), line.remark()); |
| | | if ((line.minThreshold() != null || line.maxThreshold() != null) && !measureUnit.isEmpty()) { |
| | | requirement += " " + measureUnit; |
| | | } |
| | | return new MesQcReportItemRespDTO() |
| | | .setIndicatorId(indicator.getId()) |
| | |
| | | .setCheckMethod(defaultStr(line.checkMethod())) |
| | | .setTool(defaultStr(line.tool())) |
| | | .setStandardValue(plain(line.standardValue())) |
| | | .setRequirement(requirement) |
| | | .setActualValue(defaultStr(value)) |
| | | .setUnit(unit == null ? "" : defaultStr(unit.getName())) |
| | | .setUnit(measureUnit) |
| | | .setUpperLimit(line.maxThreshold()) |
| | | .setLowerLimit(line.minThreshold()) |
| | | .setValueType(indicator.getResultType()) |
| | |
| | | .setRemark(mergeRemark(line.remark(), detailRemark)); |
| | | } |
| | | |
| | | /** 检测单位来自检测项或检验行,产品的包装单位不能作为检测单位。 */ |
| | | static String inspectionUnit(MesQcIndicatorDO indicator, MesMdUnitMeasureDO unit) { |
| | | if (MesQcIndicatorItemTypeEnum.isGroup(indicator.getItemType())) { |
| | | return ""; |
| | | } |
| | | return unit == null ? defaultStr(indicator.getUnitText()) : defaultStr(unit.getName()); |
| | | } |
| | | |
| | | /** 数值项展示允许区间;定性及分级项目保留方案正文中的完整要求。 */ |
| | | static String inspectionRequirement(BigDecimal lower, BigDecimal upper, String method, String remark) { |
| | | if (lower != null && upper != null) { |
| | | return lower.compareTo(upper) == 0 ? "=" + plain(lower) : plain(lower) + "~" + plain(upper); |
| | | } |
| | | if (lower != null) { |
| | | return "≥" + plain(lower); |
| | | } |
| | | if (upper != null) { |
| | | return "≤" + plain(upper); |
| | | } |
| | | if (method != null && method.startsWith("要求:")) { |
| | | int end = method.indexOf(";方法:"); |
| | | return end < 0 ? method.substring(3) : method.substring(3, end); |
| | | } |
| | | return remark != null && !remark.startsWith("10月8日至14日业务链") ? remark : ""; |
| | | } |
| | | |
| | | // ==================== 取行(四类同构) ==================== |
| | | |
| | | private List<LineRow> loadIqcLines(Long qcId) { |