|
|
|
|
@ -1777,6 +1777,45 @@ def _route_lane_summary(report):
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _route_track_min_capacity(route_track):
|
|
|
|
|
if not isinstance(route_track, dict):
|
|
|
|
|
return None
|
|
|
|
|
capacities = []
|
|
|
|
|
for segment in route_track.get("segments", []) or []:
|
|
|
|
|
carrier = segment.get("carrier", {}) if isinstance(segment, dict) else {}
|
|
|
|
|
if not isinstance(carrier, dict):
|
|
|
|
|
continue
|
|
|
|
|
try:
|
|
|
|
|
capacity = int(float(carrier.get("capacity", 0) or 0))
|
|
|
|
|
except Exception:
|
|
|
|
|
capacity = 0
|
|
|
|
|
if capacity > 0:
|
|
|
|
|
capacities.append(capacity)
|
|
|
|
|
if not capacities:
|
|
|
|
|
return None
|
|
|
|
|
return min(capacities)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _route_capacity_pressure_summary(report, lane_summary):
|
|
|
|
|
if not lane_summary:
|
|
|
|
|
return {}
|
|
|
|
|
max_parallel_wires = int(lane_summary.get("max_lane_index", 0) or 0) + 1
|
|
|
|
|
min_capacity = None
|
|
|
|
|
for route in report.get("routes", []) or []:
|
|
|
|
|
if not isinstance(route, dict):
|
|
|
|
|
continue
|
|
|
|
|
route_capacity = _route_track_min_capacity(route.get("route_track", {}))
|
|
|
|
|
if route_capacity is None:
|
|
|
|
|
continue
|
|
|
|
|
min_capacity = route_capacity if min_capacity is None else min(min_capacity, route_capacity)
|
|
|
|
|
if min_capacity is None or max_parallel_wires <= min_capacity:
|
|
|
|
|
return {}
|
|
|
|
|
return {
|
|
|
|
|
"max_parallel_wires": max_parallel_wires,
|
|
|
|
|
"min_capacity": min_capacity,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def format_eplan_connection_route_report(report):
|
|
|
|
|
message = "批量生成布线连接完成:routed={0}, collision_warnings={1}, missing_terminals={2}".format(
|
|
|
|
|
report.get("routed", 0),
|
|
|
|
|
@ -1834,6 +1873,12 @@ def format_eplan_connection_route_report(report):
|
|
|
|
|
lane_summary.get("max_lane_index", 0),
|
|
|
|
|
float(lane_summary.get("spacing_mm", 0.0) or 0.0),
|
|
|
|
|
)
|
|
|
|
|
capacity_pressure = _route_capacity_pressure_summary(report, lane_summary)
|
|
|
|
|
if capacity_pressure:
|
|
|
|
|
message += "\n容量提示:最大并行线数 {0},路径最小容量 {1}。".format(
|
|
|
|
|
capacity_pressure.get("max_parallel_wires", 0),
|
|
|
|
|
capacity_pressure.get("min_capacity", 0),
|
|
|
|
|
)
|
|
|
|
|
route_source_sample = _route_source_sample_text(report)
|
|
|
|
|
if route_source_sample:
|
|
|
|
|
message += "\n{0}".format(route_source_sample)
|
|
|
|
|
|