截图未测试

This commit is contained in:
2026-06-05 10:17:36 +08:00
parent 10db652cbc
commit 3b2063c007
8 changed files with 55 additions and 48 deletions

View File

@@ -241,54 +241,56 @@ class DeviceAutomation:
task_count = 0 task_count = 0
max_tasks = 1 # 最大任务数量,防止无限循环 max_tasks = 1 # 最大任务数量,防止无限循环
while task_count < max_tasks: # while task_count < max_tasks:
# 获取测量任务 # 获取测量任务
logging.info(f"设备 {self.device_id} 获取测量任务 (第{task_count + 1}次)") logging.info(f"设备 {self.device_id} 获取测量任务 (第{task_count + 1}次)")
# task_data = apis.get_measurement_task() # task_data = apis.get_measurement_task()
# logging.info(f"设备 {self.device_id} 获取到的测量任务: {task_data}") # logging.info(f"设备 {self.device_id} 获取到的测量任务: {task_data}")
task_data = { task_data = {
"id": 39, "id": 39,
"user_name": "czsczq115ykl", "user_name": "czsczq115ykl",
"name": "czsczq115ykl", "name": "czsczq115ykl",
"line_num": "L179451", "line_num": "L179451",
"line_name": "CDWZQ-2标-资阳沱江特大桥-23-35-山区", "line_name": "CDWZQ-2标-资阳沱江特大桥-23-35-山区",
"remaining": "0", "remaining": "0",
"status": 1 "status": 1
} }
if not task_data: if not task_data:
logging.info(f"设备 {self.device_id} 未获取到状态为1的测量任务等待后重试") logging.info(f"设备 {self.device_id} 未获取到状态为1的测量任务等待后重试")
time.sleep(1) # 等待1秒后重试 time.sleep(1) # 等待1秒后重试
break # break
# continue # continue
# 设置全局变量
global_variable.GLOBAL_CURRENT_PROJECT_NAME = task_data.get('line_name', '')
global_variable.GLOBAL_LINE_NUM = task_data.get('line_num', '')
logging.info(f"设备 {self.device_id} 当前要处理的项目名称:{global_variable.GLOBAL_CURRENT_PROJECT_NAME}")
# 执行测量操作
# logging.info(f"设备 {self.device_id} 开始执行测量操作")
if not self.measure_tabbar_page.measure_tabbar_page_manager():
logging.error(f"设备 {self.device_id} 测量操作执行失败")
# # 返回到测量页面
# self.driver.back()
# self.check_and_click_confirm_popup_appium()
continue # 继续下一个任务
logging.info(f"设备 {self.device_id} 测量页面操作执行成功")
# 在测量操作完成后执行断面里程配置
logging.info(f"设备 {self.device_id} 开始执行断面里程配置")
if not self.section_mileage_config_page.section_mileage_config_page_manager():
logging.error(f"设备 {self.device_id} 断面里程配置执行失败")
continue # 继续下一个任务
# 任务完成后短暂等待
logging.info(f"设备 {self.device_id}{task_count}个任务完成")
task_count += 1
# 设置全局变量
global_variable.GLOBAL_CURRENT_PROJECT_NAME = task_data.get('line_name', '')
global_variable.GLOBAL_LINE_NUM = task_data.get('line_num', '')
logging.info(f"设备 {self.device_id} 当前要处理的项目名称:{global_variable.GLOBAL_CURRENT_PROJECT_NAME}")
# 执行测量操作
# logging.info(f"设备 {self.device_id} 开始执行测量操作")
if not self.measure_tabbar_page.measure_tabbar_page_manager():
logging.error(f"设备 {self.device_id} 测量操作执行失败")
# # 返回到测量页面
# self.driver.back()
# self.check_and_click_confirm_popup_appium()
# continue # 继续下一个任务
logging.info(f"设备 {self.device_id} 测量页面操作执行成功")
# 在测量操作完成后执行断面里程配置
logging.info(f"设备 {self.device_id} 开始执行断面里程配置")
if not self.section_mileage_config_page.section_mileage_config_page_manager():
logging.error(f"设备 {self.device_id} 断面里程配置执行失败")
# continue # 继续下一个任务
# 任务完成后短暂等待
logging.info(f"设备 {self.device_id}{task_count}个任务完成")
task_count += 1
# +++++++++++++white+++++++++++++++++
logging.info(f"设备 {self.device_id} 已完成{task_count}个任务,结束打数据流程") logging.info(f"设备 {self.device_id} 已完成{task_count}个任务,结束打数据流程")
if task_count == 0: if task_count == 0:
logging.error(f"没有完成打数据的线路,结束任务") logging.error(f"没有完成打数据的线路,结束任务")

View File

@@ -266,7 +266,6 @@ class CheckStation:
if not self.click_adjustment_button(device_id): if not self.click_adjustment_button(device_id):
self.logger.error(f"设备 {device_id} 点击平差处理按钮失败") self.logger.error(f"设备 {device_id} 点击平差处理按钮失败")
return False return False
return True return True
def click_adjustment_button(self, device_id): def click_adjustment_button(self, device_id):

View File

@@ -122,6 +122,12 @@ class LoginPage:
pass pass
accounts = apis.get_accounts_from_server("68ef0e02b0138d25e2ac9918") accounts = apis.get_accounts_from_server("68ef0e02b0138d25e2ac9918")
# 检查accounts是否为None如果是则设为空列表
if accounts is None:
logging.warning("获取账户列表返回None设为空列表")
accounts = []
matches = [acc for acc in accounts if acc.get("username") == existing_username] matches = [acc for acc in accounts if acc.get("username") == existing_username]
password = None password = None
account_id = False account_id = False