|
|
@ -3588,6 +3588,11 @@ public class ScheduleServiceImpl implements ScheduleService { |
|
|
ScheduleTodoMessageEntity pendingLockTodo = getLatestPendingLockTodo(inData); |
|
|
ScheduleTodoMessageEntity pendingLockTodo = getLatestPendingLockTodo(inData); |
|
|
if (pendingLockTodo != null) { |
|
|
if (pendingLockTodo != null) { |
|
|
resultMap.put("todoInfoCode", pendingLockTodo.getInfoCode()); |
|
|
resultMap.put("todoInfoCode", pendingLockTodo.getInfoCode()); |
|
|
|
|
|
resultMap.put("warningLevel", pendingLockTodo.getWarningLevel()); |
|
|
|
|
|
resultMap.put("lockedTime", formatDateTime(pendingLockTodo.getCreatedTime())); |
|
|
|
|
|
resultMap.put("matchedRollIndex", pendingLockTodo.getMatchedRollIndex()); |
|
|
|
|
|
resultMap.put("matchedDefectRate", pendingLockTodo.getMatchedDefectRate()); |
|
|
|
|
|
resultMap.put("matchedTotalQty", pendingLockTodo.getMatchedTotalQty()); |
|
|
if (FLAG_N.equalsIgnoreCase(pendingLockTodo.getAuditFlag())) { |
|
|
if (FLAG_N.equalsIgnoreCase(pendingLockTodo.getAuditFlag())) { |
|
|
resultMap.put("matched", true); |
|
|
resultMap.put("matched", true); |
|
|
resultMap.put("action", ACTION_LOCK_PAGE); |
|
|
resultMap.put("action", ACTION_LOCK_PAGE); |
|
|
@ -3649,8 +3654,8 @@ public class ScheduleServiceImpl implements ScheduleService { |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
fillSplitRuleMatchResult(resultMap, rule, child); |
|
|
fillSplitRuleMatchResult(resultMap, rule, child); |
|
|
resultMap.put("matchedRollIndex", metricContext.rollIndex); |
|
|
|
|
|
saveSplitRuleMatchedData(inData, String.valueOf(resultMap.get("action")), child); |
|
|
|
|
|
|
|
|
fillSplitRuleMetricData(resultMap, metricContext); |
|
|
|
|
|
saveSplitRuleMatchedData(inData, String.valueOf(resultMap.get("action")), child, metricContext); |
|
|
return resultMap; |
|
|
return resultMap; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -3678,6 +3683,11 @@ public class ScheduleServiceImpl implements ScheduleService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
resultMap.put("todoInfoCode", pendingLockTodo.getInfoCode()); |
|
|
resultMap.put("todoInfoCode", pendingLockTodo.getInfoCode()); |
|
|
|
|
|
resultMap.put("warningLevel", pendingLockTodo.getWarningLevel()); |
|
|
|
|
|
resultMap.put("lockedTime", formatDateTime(pendingLockTodo.getCreatedTime())); |
|
|
|
|
|
resultMap.put("matchedRollIndex", pendingLockTodo.getMatchedRollIndex()); |
|
|
|
|
|
resultMap.put("matchedDefectRate", pendingLockTodo.getMatchedDefectRate()); |
|
|
|
|
|
resultMap.put("matchedTotalQty", pendingLockTodo.getMatchedTotalQty()); |
|
|
if (FLAG_N.equalsIgnoreCase(pendingLockTodo.getAuditFlag())) { |
|
|
if (FLAG_N.equalsIgnoreCase(pendingLockTodo.getAuditFlag())) { |
|
|
resultMap.put("locked", true); |
|
|
resultMap.put("locked", true); |
|
|
resultMap.put("lockPage", FLAG_Y); |
|
|
resultMap.put("lockPage", FLAG_Y); |
|
|
@ -4069,6 +4079,7 @@ public class ScheduleServiceImpl implements ScheduleService { |
|
|
resultMap.put("conditionNo", condition.getConditionNo()); |
|
|
resultMap.put("conditionNo", condition.getConditionNo()); |
|
|
resultMap.put("triggerEvent", triggerEvent); |
|
|
resultMap.put("triggerEvent", triggerEvent); |
|
|
resultMap.put("forceType", forceType); |
|
|
resultMap.put("forceType", forceType); |
|
|
|
|
|
resultMap.put("warningLevel", condition.getWarningLevel()); |
|
|
resultMap.put("responsibilityDept", condition.getResponsibilityDept()); |
|
|
resultMap.put("responsibilityDept", condition.getResponsibilityDept()); |
|
|
|
|
|
|
|
|
if ("异常代码".equals(triggerEvent)) { |
|
|
if ("异常代码".equals(triggerEvent)) { |
|
|
@ -4098,11 +4109,17 @@ public class ScheduleServiceImpl implements ScheduleService { |
|
|
|
|
|
|
|
|
private void saveSplitRuleMatchedData(SearchScheduleData inData, |
|
|
private void saveSplitRuleMatchedData(SearchScheduleData inData, |
|
|
String action, |
|
|
String action, |
|
|
SysSceneExceptionRuleConditionEntity matchedCondition) { |
|
|
|
|
|
|
|
|
SysSceneExceptionRuleConditionEntity matchedCondition, |
|
|
|
|
|
SplitRollMetricContext metricContext) { |
|
|
String responsibilityDept = matchedCondition == null ? "" : StringUtils.trimWhitespace(matchedCondition.getResponsibilityDept()); |
|
|
String responsibilityDept = matchedCondition == null ? "" : StringUtils.trimWhitespace(matchedCondition.getResponsibilityDept()); |
|
|
|
|
|
String warningLevel = matchedCondition == null ? "" : StringUtils.trimWhitespace(matchedCondition.getWarningLevel()); |
|
|
|
|
|
Integer matchedRollIndex = metricContext == null ? null : metricContext.rollIndex; |
|
|
|
|
|
BigDecimal matchedDefectRate = getMetricValue(metricContext, "不良率"); |
|
|
|
|
|
BigDecimal matchedTotalQty = getMetricValue(metricContext, "总数"); |
|
|
if (ACTION_LOCK_PAGE.equals(action)) { |
|
|
if (ACTION_LOCK_PAGE.equals(action)) { |
|
|
saveSplitRuleCacheData(inData); |
|
|
saveSplitRuleCacheData(inData); |
|
|
saveSplitRuleTodoMessage(inData, true, false, false, responsibilityDept); |
|
|
|
|
|
|
|
|
saveSplitRuleTodoMessage(inData, true, false, false, responsibilityDept, warningLevel, |
|
|
|
|
|
matchedRollIndex, matchedDefectRate, matchedTotalQty); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (ACTION_OPEN_DEFECT.equals(action) || ACTION_OPEN_DOWNTIME.equals(action)) { |
|
|
if (ACTION_OPEN_DEFECT.equals(action) || ACTION_OPEN_DOWNTIME.equals(action)) { |
|
|
@ -4111,7 +4128,8 @@ public class ScheduleServiceImpl implements ScheduleService { |
|
|
// 异常截卷流程等同“产量报告 + 换班结转”,提示类规则也需要缓存当前数据 |
|
|
// 异常截卷流程等同“产量报告 + 换班结转”,提示类规则也需要缓存当前数据 |
|
|
saveSplitRuleCacheData(inData); |
|
|
saveSplitRuleCacheData(inData); |
|
|
} |
|
|
} |
|
|
saveSplitRuleTodoMessage(inData, false, true, true, responsibilityDept); |
|
|
|
|
|
|
|
|
saveSplitRuleTodoMessage(inData, false, true, true, responsibilityDept, warningLevel, |
|
|
|
|
|
matchedRollIndex, matchedDefectRate, matchedTotalQty); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -4166,7 +4184,11 @@ public class ScheduleServiceImpl implements ScheduleService { |
|
|
boolean lockRequired, |
|
|
boolean lockRequired, |
|
|
boolean operated, |
|
|
boolean operated, |
|
|
boolean audited, |
|
|
boolean audited, |
|
|
String responsibilityDept) { |
|
|
|
|
|
|
|
|
String responsibilityDept, |
|
|
|
|
|
String warningLevel, |
|
|
|
|
|
Integer matchedRollIndex, |
|
|
|
|
|
BigDecimal matchedDefectRate, |
|
|
|
|
|
BigDecimal matchedTotalQty) { |
|
|
if (inData == null || !StringUtils.hasText(inData.getSite()) || !StringUtils.hasText(inData.getBuNo()) |
|
|
if (inData == null || !StringUtils.hasText(inData.getSite()) || !StringUtils.hasText(inData.getBuNo()) |
|
|
|| !StringUtils.hasText(inData.getOrderNo()) || !StringUtils.hasText(inData.getSeqNo())) { |
|
|
|| !StringUtils.hasText(inData.getOrderNo()) || !StringUtils.hasText(inData.getSeqNo())) { |
|
|
return; |
|
|
return; |
|
|
@ -4205,10 +4227,38 @@ public class ScheduleServiceImpl implements ScheduleService { |
|
|
entity.setReportTime(now); |
|
|
entity.setReportTime(now); |
|
|
entity.setReportBy(operator); |
|
|
entity.setReportBy(operator); |
|
|
} |
|
|
} |
|
|
|
|
|
entity.setWarningLevel(StringUtils.hasText(warningLevel) ? truncate(warningLevel, 20) : null); |
|
|
|
|
|
entity.setMatchedRollIndex(matchedRollIndex); |
|
|
|
|
|
entity.setMatchedDefectRate(matchedDefectRate); |
|
|
|
|
|
entity.setMatchedTotalQty(matchedTotalQty); |
|
|
entity.setResponsibilityDept(StringUtils.hasText(responsibilityDept) ? responsibilityDept : null); |
|
|
entity.setResponsibilityDept(StringUtils.hasText(responsibilityDept) ? responsibilityDept : null); |
|
|
scheduleTodoMessageMapper.insertTodoMessage(entity); |
|
|
scheduleTodoMessageMapper.insertTodoMessage(entity); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void fillSplitRuleMetricData(Map<String, Object> resultMap, SplitRollMetricContext metricContext) { |
|
|
|
|
|
if (metricContext == null) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
resultMap.put("matchedRollIndex", metricContext.rollIndex); |
|
|
|
|
|
resultMap.put("matchedDefectRate", getMetricValue(metricContext, "不良率")); |
|
|
|
|
|
resultMap.put("matchedTotalQty", getMetricValue(metricContext, "总数")); |
|
|
|
|
|
resultMap.put("lockedTime", DateUtil.getStringDate(new Date(), "yyyy-MM-dd HH:mm:ss")); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private BigDecimal getMetricValue(SplitRollMetricContext metricContext, String metricKey) { |
|
|
|
|
|
if (metricContext == null || metricContext.metricMap == null || !StringUtils.hasText(metricKey)) { |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
return metricContext.metricMap.get(metricKey); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String formatDateTime(Date date) { |
|
|
|
|
|
if (date == null) { |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
return DateUtil.getStringDate(date, "yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private ScheduleTodoMessageEntity getLatestPendingLockTodo(SearchScheduleData inData) { |
|
|
private ScheduleTodoMessageEntity getLatestPendingLockTodo(SearchScheduleData inData) { |
|
|
if (inData == null || !StringUtils.hasText(inData.getSite()) || !StringUtils.hasText(inData.getBuNo()) |
|
|
if (inData == null || !StringUtils.hasText(inData.getSite()) || !StringUtils.hasText(inData.getBuNo()) |
|
|
|| !StringUtils.hasText(inData.getOrderNo()) || !StringUtils.hasText(inData.getSeqNo())) { |
|
|
|| !StringUtils.hasText(inData.getOrderNo()) || !StringUtils.hasText(inData.getSeqNo())) { |
|
|
|