deving
This commit is contained in:
+1
-1
@@ -367,7 +367,7 @@ async def process_file_core(
|
||||
tasks[task_id]["geometry_data"] = geometry_data
|
||||
tasks[task_id]["analysis_result"] = analysis_result
|
||||
tasks[task_id]["cavity_data"] = detailed_cavity_json
|
||||
tasks[task_id]["key_info"] = cavity_key_info
|
||||
tasks[task_id]["key_info"] = detailed_cavity_json # 传递完整数据给前端
|
||||
tasks[task_id]["status"] = ProcessingStatus.COMPLETED
|
||||
tasks[task_id]["completed_at"] = str(datetime.now())
|
||||
|
||||
|
||||
+14
-19
@@ -30,11 +30,12 @@ class HTMLGenerator:
|
||||
topology = geometry_data.get("topology", {})
|
||||
center_of_mass = geometry_data.get("center_of_mass", [0, 0, 0])
|
||||
cavity_html = ""
|
||||
if cavity_data:
|
||||
# 强制测试:无论cavity_data如何,都显示面板
|
||||
if True:
|
||||
# 安全获取嵌套数据
|
||||
metadata = cavity_data.get("metadata", {})
|
||||
manufacturing_info = cavity_data.get("manufacturing_info", {})
|
||||
mold_cavities = cavity_data.get("mold_cavities", {})
|
||||
metadata = cavity_data.get("metadata", {}) if cavity_data else {}
|
||||
manufacturing_info = cavity_data.get("manufacturing_info", {}) if cavity_data else {}
|
||||
mold_cavities = cavity_data.get("mold_cavities", {}) if cavity_data else {}
|
||||
cavity_key_info = mold_cavities.get("cavity_key_info", {})
|
||||
geo_chars = cavity_key_info.get("geometric_characteristics", {})
|
||||
|
||||
@@ -43,10 +44,10 @@ class HTMLGenerator:
|
||||
logger.info(f"生成HTML - 产品体积: {geo_chars.get('product_volume')}")
|
||||
|
||||
cavity_html = f"""
|
||||
<div id="cavity-info-panel" style="position: absolute; top: 10px; right: 10px;">
|
||||
<h3>🔧 关键工艺参数</h3>
|
||||
<div style="margin: 10px 0;">
|
||||
<strong>模具参数</strong>
|
||||
<div id="cavity-info-panel" style="position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,0.95); padding: 15px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); max-width: 320px;">
|
||||
<h3 style="margin: 0 0 10px 0;">🔧 关键工艺参数</h3>
|
||||
<div style="margin: 10px 0; border-bottom: 1px solid #ddd; padding-bottom: 5px;">
|
||||
<strong style="color: #333;">模具参数</strong>
|
||||
</div>
|
||||
<div class="metric">
|
||||
<span class="metric-label">收缩率:</span>
|
||||
@@ -60,8 +61,8 @@ class HTMLGenerator:
|
||||
<span class="metric-label">分型线长度:</span>
|
||||
<span class="metric-value">{manufacturing_info.get("parting_line_length", "N/A")}</span>
|
||||
</div>
|
||||
<div style="margin: 10px 0;">
|
||||
<strong>几何特性</strong>
|
||||
<div style="margin: 10px 0; border-bottom: 1px solid #ddd; padding-bottom: 5px;">
|
||||
<strong style="color: #333;">几何特性</strong>
|
||||
</div>
|
||||
<div class="metric">
|
||||
<span class="metric-label">产品体积:</span>
|
||||
@@ -75,8 +76,8 @@ class HTMLGenerator:
|
||||
<span class="metric-label">壁厚范围:</span>
|
||||
<span class="metric-value">{geo_chars.get("wall_thickness_range", "N/A")}</span>
|
||||
</div>
|
||||
<div style="margin: 10px 0;">
|
||||
<strong>制造要求</strong>
|
||||
<div style="margin: 10px 0; border-bottom: 1px solid #ddd; padding-bottom: 5px;">
|
||||
<strong style="color: #333;">制造要求</strong>
|
||||
</div>
|
||||
<div class="metric">
|
||||
<span class="metric-label">型腔材料:</span>
|
||||
@@ -98,13 +99,7 @@ class HTMLGenerator:
|
||||
"""
|
||||
else:
|
||||
logger.warning(f"cavity_data 为空,无法显示工艺参数 - 文件: {stp_filename}")
|
||||
# 即使没有cavity_data,也生成一个空面板占位
|
||||
cavity_html = """
|
||||
<div id="cavity-info-panel" style="position: absolute; top: 10px; right: 10px; background: rgba(255,0,0,0.1); padding: 10px;">
|
||||
<h3>🔧 关键工艺参数</h3>
|
||||
<div style="color: red;">数据未加载</div>
|
||||
</div>
|
||||
"""
|
||||
cavity_html = ""
|
||||
html_content = f"""
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
|
||||
+55
-16
@@ -576,25 +576,64 @@ function displayKeyInfo(keyInfo) {
|
||||
return;
|
||||
}
|
||||
|
||||
const moldParams = keyInfo.mold_parameters || {};
|
||||
const geoChars = keyInfo.geometric_characteristics || {};
|
||||
const manuReqs = keyInfo.manufacturing_requirements || {};
|
||||
// 从正确的数据结构中提取数据
|
||||
const metadata = keyInfo.metadata || {};
|
||||
const manufacturingInfo = keyInfo.manufacturing_info || {};
|
||||
const moldCavities = keyInfo.mold_cavities || {};
|
||||
const cavityKeyInfo = moldCavities.cavity_key_info || {};
|
||||
const geoChars = cavityKeyInfo.geometric_characteristics || {};
|
||||
|
||||
keyInfoDiv.innerHTML = `
|
||||
<h4>模具参数</h4>
|
||||
<p>收缩率: ${moldParams.shrinkage_rate || 'N/A'}</p>
|
||||
<p>拔模角: ${moldParams.draft_angle || 'N/A'}</p>
|
||||
<p>分型线长度: ${moldParams.parting_line_length || 'N/A'} mm</p>
|
||||
<div class="data-item">
|
||||
<div class="data-label">🔧 模具参数</div>
|
||||
</div>
|
||||
<div class="data-item">
|
||||
<div class="data-label">收缩率</div>
|
||||
<div class="data-value">${metadata.shrinkage_rate !== undefined ? metadata.shrinkage_rate : 'N/A'}</div>
|
||||
</div>
|
||||
<div class="data-item">
|
||||
<div class="data-label">拔模角</div>
|
||||
<div class="data-value">${metadata.draft_angle !== undefined ? metadata.draft_angle + '°' : 'N/A'}</div>
|
||||
</div>
|
||||
<div class="data-item">
|
||||
<div class="data-label">分型线长度</div>
|
||||
<div class="data-value">${manufacturingInfo.parting_line_length || 'N/A'}</div>
|
||||
</div>
|
||||
|
||||
<h4>几何特性</h4>
|
||||
<p>产品体积: ${geoChars.product_volume || 'N/A'}</p>
|
||||
<p>产品重量: ${geoChars.product_weight || 'N/A'}</p>
|
||||
<p>壁厚范围: ${geoChars.wall_thickness_range || 'N/A'}</p>
|
||||
<div class="data-item" style="margin-top: 15px;">
|
||||
<div class="data-label">📐 几何特性</div>
|
||||
</div>
|
||||
<div class="data-item">
|
||||
<div class="data-label">产品体积</div>
|
||||
<div class="data-value">${geoChars.product_volume || 'N/A'}</div>
|
||||
</div>
|
||||
<div class="data-item">
|
||||
<div class="data-label">产品重量</div>
|
||||
<div class="data-value">${geoChars.product_weight || 'N/A'}</div>
|
||||
</div>
|
||||
<div class="data-item">
|
||||
<div class="data-label">壁厚范围</div>
|
||||
<div class="data-value">${geoChars.wall_thickness_range || 'N/A'}</div>
|
||||
</div>
|
||||
|
||||
<h4>制造要求</h4>
|
||||
<p>型腔材料: ${manuReqs.cavity_material || 'N/A'}</p>
|
||||
<p>硬度: ${manuReqs.hardness || 'N/A'}</p>
|
||||
<p>表面光洁度: ${manuReqs.surface_finish || 'N/A'}</p>
|
||||
<p>预估周期: ${manuReqs.estimated_cycle_time || 'N/A'}</p>
|
||||
<div class="data-item" style="margin-top: 15px;">
|
||||
<div class="data-label">⚙️ 制造要求</div>
|
||||
</div>
|
||||
<div class="data-item">
|
||||
<div class="data-label">型腔材料</div>
|
||||
<div class="data-value">${manufacturingInfo.mold_material || 'N/A'}</div>
|
||||
</div>
|
||||
<div class="data-item">
|
||||
<div class="data-label">硬度</div>
|
||||
<div class="data-value">${manufacturingInfo.mold_hardness || 'N/A'}</div>
|
||||
</div>
|
||||
<div class="data-item">
|
||||
<div class="data-label">表面光洁度</div>
|
||||
<div class="data-value">${manufacturingInfo.surface_finish || 'N/A'}</div>
|
||||
</div>
|
||||
<div class="data-item">
|
||||
<div class="data-label">预估周期</div>
|
||||
<div class="data-value">${manufacturingInfo.estimated_cycle_time || 'N/A'}</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user