From 717f23633265826e160bd467f665945f7c24292d Mon Sep 17 00:00:00 2001 From: Andy6M Date: Wed, 22 Apr 2026 17:29:28 +0800 Subject: [PATCH] feat(neware): submit_auto_export_excel add manual backup path and electrolyte_code - Add output_dir param, backup dir derived from user input (xml_dir/backup_dir auto-created) - Add electrolyte_code param, backup file name format: coin_cell_code-electrolyte_code-devid-subdevid-chlid - manual_confirm return value adds electrolyte_code field for downstream passthrough - YAML: manual_confirm output handles add electrolyte_code - YAML: submit_auto_export_excel goal/schema/goal_default/handles add output_dir and electrolyte_code - YAML: battery_transfer_confirm output changed to empty list Made-with: Cursor --- .../neware_battery_test_system.py | 12 +++-- .../devices/neware_battery_test_system.yaml | 46 ++++++++++++------- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/unilabos/devices/neware_battery_test_system/neware_battery_test_system.py b/unilabos/devices/neware_battery_test_system/neware_battery_test_system.py index 015e08c8..38b90d5f 100644 --- a/unilabos/devices/neware_battery_test_system/neware_battery_test_system.py +++ b/unilabos/devices/neware_battery_test_system/neware_battery_test_system.py @@ -2063,6 +2063,7 @@ class NewareBatteryTestSystem: return { "resource": resource_dump, "coin_cell_code": coin_cell_code, + "electrolyte_code": electrolyte_code, "target_device": target_device, "mount_resource": mount_resource_dump, "collector_mass": collector_mass, @@ -2259,7 +2260,9 @@ class NewareBatteryTestSystem: battery_system: List[str], pole_weight: List[float] = None, coin_cell_code: List[str] = None, + electrolyte_code: List[str] = None, resource: List[ResourceSlot] = None, + output_dir: str = "D:\\2604Agentic_test", ) -> dict: """ 对每颗电池计算测试参数、生成 XML 工步文件并通过 TCP 下发给新威测试仪。 @@ -2285,6 +2288,7 @@ class NewareBatteryTestSystem: resource = resource or [] pole_weight = pole_weight or [] coin_cell_code = coin_cell_code or [] + electrolyte_code = electrolyte_code or [] n = len(mount_resource) if mount_resource else 0 results = [] @@ -2302,9 +2306,9 @@ class NewareBatteryTestSystem: "results": [], } - xml_dir = os.path.join(os.path.dirname(__file__), "xml_recipes") + xml_dir = os.path.join(output_dir, "xml_dir") os.makedirs(xml_dir, exist_ok=True) - backup_dir = self._last_backup_dir or os.path.join(os.path.dirname(__file__), "backup") + backup_dir = os.path.join(output_dir, "backup_dir") os.makedirs(backup_dir, exist_ok=True) for i in range(n): @@ -2320,12 +2324,14 @@ class NewareBatteryTestSystem: # 2. 获取电池标识与极片重量(按优先级 coin_cell_code > resource > 兜底) res = resource[i] if i < len(resource) else None - coin_id = ( + base_coin = ( (coin_cell_code[i] if i < len(coin_cell_code) and coin_cell_code[i] else None) or (getattr(res, "name", None) if res is not None else None) or (res.get("name") if isinstance(res, dict) else None) or f"battery_{i}" ) + elec_code = electrolyte_code[i] if i < len(electrolyte_code) and electrolyte_code[i] else "" + coin_id = f"{base_coin}-{elec_code}-{devid}-{subdevid}-{chlid}" if pole_weight and i < len(pole_weight): pw = float(pole_weight[i]) elif res is not None: diff --git a/unilabos/registry/devices/neware_battery_test_system.yaml b/unilabos/registry/devices/neware_battery_test_system.yaml index e56dae03..698ad3c8 100644 --- a/unilabos/registry/devices/neware_battery_test_system.yaml +++ b/unilabos/registry/devices/neware_battery_test_system.yaml @@ -753,6 +753,11 @@ neware_battery_test_system: label: 电池条码列表 data_key: coin_cell_code data_source: executor + - handler_key: electrolyte_code + data_type: array + label: 电解液二维码列表 + data_key: electrolyte_code + data_source: executor placeholder_keys: resource: unilabos_resources target_device: unilabos_devices @@ -772,6 +777,8 @@ neware_battery_test_system: battery_system: battery_system pole_weight: pole_weight coin_cell_code: coin_cell_code + electrolyte_code: electrolyte_code + output_dir: output_dir feedback: {} result: return_info: return_info @@ -979,6 +986,14 @@ neware_battery_test_system: type: array items: type: string + electrolyte_code: + type: array + items: + type: string + output_dir: + type: string + default: 'D:\2604Agentic_test' + description: 备份输出根目录,子目录 xml_dir/backup_dir 将自动创建 required: - mount_resource - collector_mass @@ -1001,6 +1016,8 @@ neware_battery_test_system: battery_system: [] pole_weight: [] coin_cell_code: [] + electrolyte_code: [] + output_dir: 'D:\2604Agentic_test' handles: input: - handler_key: resource @@ -1051,6 +1068,18 @@ neware_battery_test_system: data_key: coin_cell_code data_source: handle io_type: source + - handler_key: electrolyte_code + data_type: array + label: 电解液二维码列表 + data_key: electrolyte_code + data_source: handle + io_type: source + - handler_key: output_dir + data_type: string + label: 备份输出目录 + data_key: output_dir + data_source: handle + io_type: source output: [] placeholder_keys: resource: unilabos_resources @@ -1292,22 +1321,7 @@ neware_battery_test_system: data_key: mount_resource data_source: handle io_type: source - output: - - handler_key: target_device - data_type: device_id - label: 目标设备 - data_key: target_device - data_source: executor - - handler_key: resource - data_type: resource - label: 待转移资源 - data_key: resource.@flatten - data_source: executor - - handler_key: mount_resource - data_type: resource - label: 目标孔位 - data_key: mount_resource.@flatten - data_source: executor + output: [] placeholder_keys: resource: unilabos_resources target_device: unilabos_devices