This commit is contained in:
dongchangxi committed 2025-12-10 17:14:34 +08:00
1 parent 549c2b8f55
commit b7843917ff
11 files changed
+362 -25

No files matched your search

@@ -8,12 +8,12 @@ import os
from .utils.request import requestApiToUpdateSliceStatusComplate
#"C:/test/10192_small_No4/data"
def BeginSliceing(batchId,machineId, folderPath):
def BeginSliceing(batchId,machineId, folderPath,data):
# 打开3d切片软件
start_exe()
time.sleep(1)
start_exe(data)
time.sleep(5)
#点击确认按钮
click_confirm()
# click_confirm()
#先打开导入文件的弹框
clickFileIMportShow()
time.sleep(1)
@@ -29,7 +29,7 @@ def BeginSliceing(batchId,machineId, folderPath):
log("切片结束")
time.sleep(5)
#切片完成之后,将切片文件打包成zip文件,上传到OSS,并且请求api 更新批次状态为切片完成
requestApiToUpdateSliceStatusComplate(batchId, 0)
# requestApiToUpdateSliceStatusComplate(batchId, 0)
# sadd 插入对应的队列
r = redisClient()
r.sadd('pb:begin_print_machine_'+machineId, batchId)
@@ -62,6 +62,6 @@ def main(work_dir=None):
batchId = data.split('_')[0] #批次ID
# machineType = data.split('_')[1] #机型类型
machineId = data.split('_')[2].replace('No', '') #机器ID
BeginSliceing(batchId,machineId,folderPath)
BeginSliceing(batchId,machineId,folderPath,data)
time.sleep(10)
@@ -1,7 +1,7 @@
import uiautomation as auto
from utils.config import cfg
softName = "赛纳3D打印控制系统 V1.4.3.2"
softName = cfg('exe.soft_name', None)
# 遍历所有控件 找到
def findAndClick(control, depth=0,index=1):
@@ -71,12 +71,18 @@ def findAndClick(control, depth=0,index=1):
# 点击导入文件按钮
def clickFileIMportShow():
if softName is None:
print(f"错误:软件名称未配置")
exit(1)
control = auto.WindowControl(searchDepth=1, Name=softName)
clickRes = findAndClick(control,index=1)
return clickRes
# 点击开始切片按钮
def clickBegingSlice():
if softName is None:
print(f"错误:软件名称未配置")
exit(1)
control = auto.WindowControl(searchDepth=1, Name=softName)
clickRes = findAndClick(control,index=2)
return clickRes
@@ -3,9 +3,21 @@ import os
import subprocess
import time
import uiautomation as auto
exe_path = r"C:\Users\Administrator\Desktop\排版软件\NormalTek.ThreeDPrinter.UI.exe"
from utils.config import cfg
# exe_path = cfg('exe.small_exe', None)
# if exe_path is None:
# print(f"错误:exe_path 未配置")
# exit(1)
def start_exe():
def start_exe(data):
exe_path = None
if "small" in data:
exe_path = cfg('exe.small_exe', None)
elif "big" in data:
exe_path = cfg('exe.big_exe', None)
else:
print(f"错误:机型类型未配置")
exit(1)
try:
# 检查文件是否存在
if not os.path.exists(exe_path):