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
This commit is contained in:
Andy6M
2026-04-22 17:29:28 +08:00
parent 79c0815b70
commit 717f236332
2 changed files with 39 additions and 19 deletions

View File

@@ -2063,6 +2063,7 @@ class NewareBatteryTestSystem:
return { return {
"resource": resource_dump, "resource": resource_dump,
"coin_cell_code": coin_cell_code, "coin_cell_code": coin_cell_code,
"electrolyte_code": electrolyte_code,
"target_device": target_device, "target_device": target_device,
"mount_resource": mount_resource_dump, "mount_resource": mount_resource_dump,
"collector_mass": collector_mass, "collector_mass": collector_mass,
@@ -2259,7 +2260,9 @@ class NewareBatteryTestSystem:
battery_system: List[str], battery_system: List[str],
pole_weight: List[float] = None, pole_weight: List[float] = None,
coin_cell_code: List[str] = None, coin_cell_code: List[str] = None,
electrolyte_code: List[str] = None,
resource: List[ResourceSlot] = None, resource: List[ResourceSlot] = None,
output_dir: str = "D:\\2604Agentic_test",
) -> dict: ) -> dict:
""" """
对每颗电池计算测试参数、生成 XML 工步文件并通过 TCP 下发给新威测试仪。 对每颗电池计算测试参数、生成 XML 工步文件并通过 TCP 下发给新威测试仪。
@@ -2285,6 +2288,7 @@ class NewareBatteryTestSystem:
resource = resource or [] resource = resource or []
pole_weight = pole_weight or [] pole_weight = pole_weight or []
coin_cell_code = coin_cell_code or [] coin_cell_code = coin_cell_code or []
electrolyte_code = electrolyte_code or []
n = len(mount_resource) if mount_resource else 0 n = len(mount_resource) if mount_resource else 0
results = [] results = []
@@ -2302,9 +2306,9 @@ class NewareBatteryTestSystem:
"results": [], "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) 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) os.makedirs(backup_dir, exist_ok=True)
for i in range(n): for i in range(n):
@@ -2320,12 +2324,14 @@ class NewareBatteryTestSystem:
# 2. 获取电池标识与极片重量(按优先级 coin_cell_code > resource > 兜底) # 2. 获取电池标识与极片重量(按优先级 coin_cell_code > resource > 兜底)
res = resource[i] if i < len(resource) else None 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) (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 (getattr(res, "name", None) if res is not None else None)
or (res.get("name") if isinstance(res, dict) else None) or (res.get("name") if isinstance(res, dict) else None)
or f"battery_{i}" 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): if pole_weight and i < len(pole_weight):
pw = float(pole_weight[i]) pw = float(pole_weight[i])
elif res is not None: elif res is not None:

View File

@@ -753,6 +753,11 @@ neware_battery_test_system:
label: 电池条码列表 label: 电池条码列表
data_key: coin_cell_code data_key: coin_cell_code
data_source: executor data_source: executor
- handler_key: electrolyte_code
data_type: array
label: 电解液二维码列表
data_key: electrolyte_code
data_source: executor
placeholder_keys: placeholder_keys:
resource: unilabos_resources resource: unilabos_resources
target_device: unilabos_devices target_device: unilabos_devices
@@ -772,6 +777,8 @@ neware_battery_test_system:
battery_system: battery_system battery_system: battery_system
pole_weight: pole_weight pole_weight: pole_weight
coin_cell_code: coin_cell_code coin_cell_code: coin_cell_code
electrolyte_code: electrolyte_code
output_dir: output_dir
feedback: {} feedback: {}
result: result:
return_info: return_info return_info: return_info
@@ -979,6 +986,14 @@ neware_battery_test_system:
type: array type: array
items: items:
type: string type: string
electrolyte_code:
type: array
items:
type: string
output_dir:
type: string
default: 'D:\2604Agentic_test'
description: 备份输出根目录,子目录 xml_dir/backup_dir 将自动创建
required: required:
- mount_resource - mount_resource
- collector_mass - collector_mass
@@ -1001,6 +1016,8 @@ neware_battery_test_system:
battery_system: [] battery_system: []
pole_weight: [] pole_weight: []
coin_cell_code: [] coin_cell_code: []
electrolyte_code: []
output_dir: 'D:\2604Agentic_test'
handles: handles:
input: input:
- handler_key: resource - handler_key: resource
@@ -1051,6 +1068,18 @@ neware_battery_test_system:
data_key: coin_cell_code data_key: coin_cell_code
data_source: handle data_source: handle
io_type: source 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: [] output: []
placeholder_keys: placeholder_keys:
resource: unilabos_resources resource: unilabos_resources
@@ -1292,22 +1321,7 @@ neware_battery_test_system:
data_key: mount_resource data_key: mount_resource
data_source: handle data_source: handle
io_type: source io_type: source
output: 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
placeholder_keys: placeholder_keys:
resource: unilabos_resources resource: unilabos_resources
target_device: unilabos_devices target_device: unilabos_devices