|
|
|
@ -1138,6 +1138,7 @@ def route_all_from_payload(doc, payload, options=None):
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
report["missing_endpoint_uuids"] = sorted(missing_endpoint_uuids)
|
|
|
|
report["missing_endpoint_uuids"] = sorted(missing_endpoint_uuids)
|
|
|
|
|
|
|
|
_write_auto_route_batch_diagnostic(doc, report)
|
|
|
|
return report
|
|
|
|
return report
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1180,6 +1181,53 @@ def format_route_all_report(report):
|
|
|
|
return message
|
|
|
|
return message
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _clear_auto_route_batch_diagnostics(doc):
|
|
|
|
|
|
|
|
group = WiringObjects.ensure_diagnostic_group(doc, _project_uuid(doc))
|
|
|
|
|
|
|
|
removed = 0
|
|
|
|
|
|
|
|
for obj in list(getattr(group, "Group", []) or []):
|
|
|
|
|
|
|
|
if (getattr(obj, "QetDiagnosticKind", "") or "").strip() != "AutoRouteBatch":
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
group.removeObject(obj)
|
|
|
|
|
|
|
|
except Exception:
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
group.Group = [
|
|
|
|
|
|
|
|
candidate
|
|
|
|
|
|
|
|
for candidate in list(getattr(group, "Group", []) or [])
|
|
|
|
|
|
|
|
if candidate is not obj
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
except Exception:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
if doc.getObject(getattr(obj, "Name", "")) is not None:
|
|
|
|
|
|
|
|
doc.removeObject(obj.Name)
|
|
|
|
|
|
|
|
removed += 1
|
|
|
|
|
|
|
|
except Exception:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
return removed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _write_auto_route_batch_diagnostic(doc, report):
|
|
|
|
|
|
|
|
if doc is None or not isinstance(report, dict):
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
if not report.get("errors") and not report.get("missing_endpoint_uuids") and report.get("collision_warnings", 0) <= 0:
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
project_uuid = _project_uuid(doc)
|
|
|
|
|
|
|
|
group = WiringObjects.ensure_diagnostic_group(doc, project_uuid)
|
|
|
|
|
|
|
|
_clear_auto_route_batch_diagnostics(doc)
|
|
|
|
|
|
|
|
diagnostic = doc.addObject("App::DocumentObjectGroup", _unique_name(doc, "QETAutoRouteDiagnostic"))
|
|
|
|
|
|
|
|
diagnostic.Label = "QET Auto Route Diagnostic"
|
|
|
|
|
|
|
|
_set_string(diagnostic, "QetDiagnosticKind", "AutoRouteBatch", "QET diagnostic kind")
|
|
|
|
|
|
|
|
_set_string(
|
|
|
|
|
|
|
|
diagnostic,
|
|
|
|
|
|
|
|
"QetDiagnosticJson",
|
|
|
|
|
|
|
|
json.dumps(report, ensure_ascii=False),
|
|
|
|
|
|
|
|
"QET auto-routing batch diagnostic payload",
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
group.addObject(diagnostic)
|
|
|
|
|
|
|
|
return diagnostic
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _iter_wire_tasks(doc):
|
|
|
|
def _iter_wire_tasks(doc):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
task_group = doc.getObject("QETWiring_01_Tasks")
|
|
|
|
task_group = doc.getObject("QETWiring_01_Tasks")
|
|
|
|
|