上传代码

This commit is contained in:
chentianrui
2025-09-08 17:58:02 +08:00
parent be848c3e78
commit f5f26c5cf8
76 changed files with 839039 additions and 2695 deletions
+30 -11
View File
@@ -28,6 +28,8 @@ class CalculatorBase(ABC):
self.calculation_strategy = self.create_calculation_strategy()
# 默认输出目录
self.output_dir = os.path.join("计算结果", self.software_type.name)
# 新增:BCL 脚本目录(优先使用新接口)
self.bcl_dir: str | None = None
def create_calculation_strategy(self) -> CalculationStrategy:
"""
@@ -60,6 +62,15 @@ class CalculatorBase(ABC):
if hasattr(self.calculation_strategy, "set_output_dir"):
self.calculation_strategy.set_output_dir(output_dir)
def set_bcl_dir(self, bcl_dir: str) -> None:
"""
设置 BCL 脚本目录路径(新接口)。
Args:
bcl_dir: BCL 目录路径
"""
self.bcl_dir = bcl_dir
def _append_log(self, text: str, filename: str = "performance_memory_log.txt") -> str:
"""将文本即时追加写入输出目录下的日志文件,并返回日志路径。"""
try:
@@ -121,12 +132,16 @@ class CalculatorBase(ABC):
# 外层只初始化一次 BCL 计算器
from equipment_calculation.bcl_utils import init_bcl_calculator
init_bcl_calculator(
software_category=self.software_type.category.value,
engineering_type=self.software_type.engineering_type.value,
calculation_type="工程量",
project_type=project_type,
)
if getattr(self, "bcl_dir", None):
init_bcl_calculator(self.bcl_dir)
# else:
# # 兼容老接口
# init_bcl_calculator(
# software_category=self.software_type.category.value,
# engineering_type=self.software_type.engineering_type.value,
# calculation_type="工程量",
# project_type=project_type,
# )
if project_name:
# 处理单个项目划分
@@ -177,11 +192,15 @@ class CalculatorBase(ABC):
# 外层只初始化一次 BCL 计算器(人材机)
from equipment_calculation.bcl_utils import init_bcl_calculator
init_bcl_calculator(
software_category=self.software_type.category.value,
engineering_type=self.software_type.engineering_type.value,
calculation_type="人材机",
)
if getattr(self, "bcl_dir", None):
init_bcl_calculator(self.bcl_dir)
# else:
# # 兼容老接口
# init_bcl_calculator(
# software_category=self.software_type.category.value,
# engineering_type=self.software_type.engineering_type.value,
# calculation_type="人材机",
# )
if project_name:
# 处理单个项目划分