|
|
@@ -84,8 +84,8 @@ public class MesProductLeakagePointStatController extends BaseController {
|
|
|
@RequiresPermissions("mes:mesProductQm:view")
|
|
|
@RequestMapping(value = "chartData")
|
|
|
@ResponseBody
|
|
|
- public Map<String, Object> chartData(String leakagePoint, String sn, Date startDate, Date endDate) {
|
|
|
- List<MesProductHf> records = findRecords(sn, startDate, endDate);
|
|
|
+ public Map<String, Object> chartData(String leakagePoint, String sn, String dataType, Date startDate, Date endDate) {
|
|
|
+ List<MesProductHf> records = findRecords(sn, startDate, endDate, dataType);
|
|
|
Map<String, Integer> pointCounts = new HashMap<>();
|
|
|
for (MesProductHf record : records) {
|
|
|
if (StringUtils.isBlank(record.getHfFlag())) continue;
|
|
|
@@ -159,12 +159,12 @@ public class MesProductLeakagePointStatController extends BaseController {
|
|
|
result.put("trend", trend);
|
|
|
result.put("totalCount", pointCounts.getOrDefault(selectedPoint, 0));
|
|
|
result.put("workpieceCount", details.size());
|
|
|
- result.put("rawRecordCount", records.size());
|
|
|
- result.putAll(buildQualityData(records, startDate, endDate));
|
|
|
+ result.putAll(buildQualityData(records, startDate, endDate, dataType));
|
|
|
+ result.put("rawRecordCount", result.get("qualityTotal"));
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- private Map<String, Object> buildQualityData(List<MesProductHf> hfRecords, Date startDate, Date endDate) {
|
|
|
+ private Map<String, Object> buildQualityData(List<MesProductHf> hfRecords, Date startDate, Date endDate, String dataType) {
|
|
|
MesProductQm query = new MesProductQm();
|
|
|
if (startDate != null) query.setTestTime_gte(startDate);
|
|
|
if (endDate != null) query.setTestTime_lte(endOfDay(endDate));
|
|
|
@@ -173,6 +173,8 @@ public class MesProductLeakagePointStatController extends BaseController {
|
|
|
int noPoint = 0;
|
|
|
Map<String, Integer> pointCounts = new LinkedHashMap<>();
|
|
|
for (MesProductQm record : mesProductQmService.findList(query)) {
|
|
|
+ if ("leakagePoint".equals(dataType)) continue;
|
|
|
+ if (!matchesDataType(record.getOprno(), dataType)) continue;
|
|
|
if ("OK".equalsIgnoreCase(record.getTestResult())) qualified++;
|
|
|
else { defective++; noPoint++; }
|
|
|
}
|
|
|
@@ -279,7 +281,7 @@ public class MesProductLeakagePointStatController extends BaseController {
|
|
|
|
|
|
private List<MesProductLeakagePointStat> buildStatistics(String leakagePoint, String sn, Date startDate, Date endDate) {
|
|
|
Map<String, MesProductLeakagePointStat> statistics = new LinkedHashMap<>();
|
|
|
- for (MesProductHf record : findRecords(sn, startDate, endDate)) {
|
|
|
+ for (MesProductHf record : findRecords(sn, startDate, endDate, "all")) {
|
|
|
if (StringUtils.isBlank(record.getSn()) || StringUtils.isBlank(record.getHfFlag())) continue;
|
|
|
for (String item : record.getHfFlag().split(",")) {
|
|
|
String point = normalizeLeakPoint(item);
|
|
|
@@ -313,12 +315,22 @@ public class MesProductLeakagePointStatController extends BaseController {
|
|
|
return rows;
|
|
|
}
|
|
|
|
|
|
- private List<MesProductHf> findRecords(String sn, Date startDate, Date endDate) {
|
|
|
+ private List<MesProductHf> findRecords(String sn, Date startDate, Date endDate, String dataType) {
|
|
|
MesProductHf query = new MesProductHf();
|
|
|
query.setSn(sn);
|
|
|
if (startDate != null) query.setCreateDate_gte(startDate);
|
|
|
if (endDate != null) query.setCreateDate_lte(endOfDay(endDate));
|
|
|
- return mesProductHfService.findList(query);
|
|
|
+ List<MesProductHf> records = mesProductHfService.findList(query);
|
|
|
+ if (StringUtils.isBlank(dataType) || "all".equals(dataType) || "leakagePoint".equals(dataType)) return records;
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ /** Keeps leak-point records separate while grouping gas-tightness records by their inspection station. */
|
|
|
+ private boolean matchesDataType(String oprno, String dataType) {
|
|
|
+ if (StringUtils.isBlank(dataType) || "all".equals(dataType) || "leakagePoint".equals(dataType)) return true;
|
|
|
+ String station = CommonUitl.formatOprno(oprno);
|
|
|
+ if ("semiFinished".equals(dataType)) return "INSP030".equals(station) || "INSP080".equals(station);
|
|
|
+ return "finishedPackage".equals(dataType) && "INSP090".equals(station);
|
|
|
}
|
|
|
|
|
|
/** Date-only filters are inclusive of the selected end date, matching the detection-record page. */
|