diff --git a/equipment_calculation/bcl_calculator.py b/equipment_calculation/bcl_calculator.py index bf3256c..fb76b5c 100644 --- a/equipment_calculation/bcl_calculator.py +++ b/equipment_calculation/bcl_calculator.py @@ -10,7 +10,7 @@ import copy # 配置logging logging.basicConfig( - level=logging.DEBUG, + level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", handlers=[logging.FileHandler("bcl_calculator.log"), logging.StreamHandler()], ) diff --git a/equipment_calculation/bcl_utils.py b/equipment_calculation/bcl_utils.py index 6c69917..190102a 100644 --- a/equipment_calculation/bcl_utils.py +++ b/equipment_calculation/bcl_utils.py @@ -316,7 +316,7 @@ def init_bcl_calculator(software_category, engineering_type, calculation_type): # 构建计算配置路径 # 格式:计算配置/软件类型(主网,配网,技改)/计算类型(工程量,人材机)/工程类型(预算,清单) - config_path = f"计算配置/{software_category}/{calculation_type}/{engineering_type}" + config_path = f"equipment_calculation/计算配置/{software_category}/{calculation_type}/{engineering_type}" print(f"加载计算配置: {config_path}") @@ -333,14 +333,14 @@ def init_bcl_calculator(software_category, engineering_type, calculation_type): print(f"创建计算配置目录失败: {e}") # 如果目录不存在,使用默认配置 - default_path = "计算配置/主网/工程量/预算" + default_path = "equipment_calculation/计算配置/主网/工程量/预算" print(f"使用默认计算配置: {default_path}") # 检查默认配置目录是否存在 if not os.path.exists(default_path): print(f"默认计算配置目录不存在: {default_path}") # 尝试使用原始默认配置 - original_default_path = "计算配置/主网/主网预算" + original_default_path = "equipment_calculation/计算配置/主网/主网预算" print(f"尝试使用原始默认计算配置: {original_default_path}") if os.path.exists(original_default_path): @@ -356,14 +356,14 @@ def init_bcl_calculator(software_category, engineering_type, calculation_type): if False == result: print(f"加载脚本错误: {calculator.get_last_error()}") # 尝试使用默认配置 - default_path = "计算配置/主网/工程量/预算" + default_path = "equipment_calculation/计算配置/主网/工程量/预算" print(f"尝试使用默认计算配置: {default_path}") # 检查默认配置目录是否存在 if not os.path.exists(default_path): print(f"默认计算配置目录不存在: {default_path}") # 尝试使用原始默认配置 - original_default_path = "计算配置/主网/主网预算" + original_default_path = "equipment_calculation/计算配置/主网/主网预算" print(f"尝试使用原始默认计算配置: {original_default_path}") if os.path.exists(original_default_path): diff --git a/equipment_calculation/main.py b/equipment_calculation/main.py index a05020d..831f60f 100644 --- a/equipment_calculation/main.py +++ b/equipment_calculation/main.py @@ -295,8 +295,8 @@ def process_BCL_calculate(input_folder: str, output_folder: str) -> List[Tuple[s def main(): """程序入口""" - input_folder = "project2json/outputs" - output_folder = "outputs-2" + input_folder = "project2json/outputs/json" + output_folder = "project2json/outputs/bcl_results" results = process_BCL_calculate(input_folder, output_folder) diff --git a/equipment_calculation/software_calculators.py b/equipment_calculation/software_calculators.py index 55ab574..d2fef44 100644 --- a/equipment_calculation/software_calculators.py +++ b/equipment_calculation/software_calculators.py @@ -401,6 +401,14 @@ class MainGridBudgetCalculator(CalculatorBase): """创建主网预算计算策略""" return MainGridBudgetCalculationStrategy() + def set_output_dir(self, output_dir): + """ + 设置计算结果的输出目录 + + :param output_dir: 输出目录的路径 + """ + self.output_dir = output_dir + def apply_quantity_fee_rules(self) -> None: """应用主网预算特定的工程量取费规则""" print(f"应用{self.software_type.name}特定的工程量取费规则 - 对节点进行预处理") @@ -467,6 +475,14 @@ class MainGridBillCalculator(CalculatorBase): """创建主网清单计算策略""" return MainGridBillCalculationStrategy() + def set_output_dir(self, output_dir): + """ + 设置计算结果的输出目录 + + :param output_dir: 输出目录的路径 + """ + self.output_dir = output_dir + def apply_quantity_fee_rules(self) -> None: """应用主网清单特定的工程量取费规则""" print(f"应用{self.software_type.name}特定的工程量取费规则 - 对节点进行预处理") @@ -531,6 +547,14 @@ class DistributionBudgetCalculator(CalculatorBase): def __init__(self): super().__init__(DISTRIBUTION_BUDGET) + def set_output_dir(self, output_dir): + """ + 设置计算结果的输出目录 + + :param output_dir: 输出目录的路径 + """ + self.output_dir = output_dir + def create_calculation_strategy(self) -> CalculationStrategy: """创建配网预算计算策略""" return DistributionBudgetCalculationStrategy() @@ -562,6 +586,14 @@ class DistributionBillCalculator(CalculatorBase): """创建配网清单计算策略""" return DistributionBillCalculationStrategy() + def set_output_dir(self, output_dir): + """ + 设置计算结果的输出目录 + + :param output_dir: 输出目录的路径 + """ + self.output_dir = output_dir + def apply_quantity_fee_rules(self) -> None: """应用配网清单特定的工程量取费规则""" print(f"应用{self.software_type.name}特定的工程量取费规则") @@ -589,6 +621,14 @@ class TechnicalRenovationBudgetCalculator(CalculatorBase): """创建技改预算计算策略""" return TechnicalRenovationBudgetCalculationStrategy() + def set_output_dir(self, output_dir): + """ + 设置计算结果的输出目录 + + :param output_dir: 输出目录的路径 + """ + self.output_dir = output_dir + def apply_quantity_fee_rules(self) -> None: """应用技改预算特定的工程量取费规则""" print(f"应用{self.software_type.name}特定的工程量取费规则") @@ -616,6 +656,14 @@ class TechnicalRenovationBillCalculator(CalculatorBase): """创建技改清单计算策略""" return TechnicalRenovationBillCalculationStrategy() + def set_output_dir(self, output_dir): + """ + 设置计算结果的输出目录 + + :param output_dir: 输出目录的路径 + """ + self.output_dir = output_dir + def apply_quantity_fee_rules(self) -> None: """应用技改清单特定的工程量取费规则""" print(f"应用{self.software_type.name}特定的工程量取费规则") diff --git a/project2json/outputs/merged/主网清单变电.json b/project2json/outputs/merged/主网清单变电.json deleted file mode 100644 index e69de29..0000000