程序优化
This commit is contained in:
1 parent
2093ff5526
commit
10640a63c2
8 files changed
+260
-44
No files matched your search
+11
-1
@@ -5,7 +5,7 @@ if platform.system() == 'Windows':
|
||||
sys.path.append('e:\\libs\\')
|
||||
else:
|
||||
sys.path.append('/data/deploy/make3d/make2/libs/')
|
||||
import config, libs,libs_db
|
||||
import config, libs,libs_db,common
|
||||
redisLocal = config.redis_local
|
||||
def find_and_maximize_window(window_title):
|
||||
windows = []
|
||||
@@ -23,6 +23,16 @@ def find_and_maximize_window(window_title):
|
||||
print(f'found {window_title} hwnd:{hwnd}')
|
||||
left, top, right, bottom = win32gui.GetWindowRect(hwnd)
|
||||
return pid, left, top, right, bottom
|
||||
|
||||
if "screen" in win32gui.GetWindowText(hwnd):
|
||||
pid = win32gui.GetWindowText(hwnd).split('screen')[0].split(' ')[0].split('-')[0].split('*')[0].split('_')[0]
|
||||
time.sleep(3)
|
||||
#截屏
|
||||
if pid != "":
|
||||
common.saveScreenImg(pid)
|
||||
time.sleep(3)
|
||||
ag.hotkey('alt', 'f4')
|
||||
|
||||
return '0', 0, 0, 0, 0
|
||||
|
||||
# def get_defineDistances(pid, left, top, right, bottom):
|
||||
|
||||
+25
-4
@@ -9,7 +9,7 @@ import config, libs,libs_db
|
||||
def main(cmd, order_id):
|
||||
if cmd == 'print': #order_id
|
||||
key = 'model:printOrder'
|
||||
elif cmd == 'repair': #order_id
|
||||
elif cmd == 'repair': #reqpair_order_id
|
||||
key = 'model:IndependentRepairTeamcheckGLBQueue'
|
||||
elif cmd == 'make3d': #pid
|
||||
key = 'model:make'
|
||||
@@ -33,7 +33,7 @@ def cmd(cmdName,pid):
|
||||
key = ""
|
||||
if cmdName == 'print': #order_id
|
||||
key = 'model:printOrder'
|
||||
elif cmdName == 'repair': #order_id
|
||||
elif cmdName == 'repair': #repair_order_id
|
||||
key = 'model:IndependentRepairTeamcheckGLBQueue'
|
||||
elif cmdName == 'make3d': #pid
|
||||
key = 'model:make'
|
||||
@@ -54,7 +54,7 @@ def cmd(cmdName,pid):
|
||||
exit(1)
|
||||
data = res["data"]
|
||||
|
||||
if cmdName == 'print' or cmdName == 'repair':
|
||||
if cmdName == 'print':
|
||||
#需要去吃查询pid 对应的order_id
|
||||
#遍历data
|
||||
for i in data:
|
||||
@@ -75,7 +75,26 @@ def cmd(cmdName,pid):
|
||||
break
|
||||
except ValueError:
|
||||
print("输入不满足要求,请重新输入")
|
||||
|
||||
elif cmdName == "repair":
|
||||
#需要去吃查询pid 对应的repair_order_id
|
||||
#遍历data
|
||||
for i in data:
|
||||
#获取 pid 对应的数据
|
||||
tempData = data[i]
|
||||
if len(tempData) == 1:
|
||||
#pid 只有对应的一笔数据就可以直接插入了
|
||||
main(cmdName, str(tempData[0]["model_repair_order_id"]))
|
||||
else:
|
||||
while True:
|
||||
try:
|
||||
tempDataStrings = listDataToStr(tempData,cmdName)
|
||||
model_repair_order_id = int(input("pid-"+i+"对应有多个数据,请从下列中选择正确的model_repair_order_id填入\r\n"+tempDataStrings+"\r\n->"))
|
||||
# 在这里处理用户输入的整数
|
||||
print("输入的是: ", model_repair_order_id)
|
||||
main(cmdName, str(model_repair_order_id))
|
||||
break
|
||||
except ValueError:
|
||||
print("输入不满足要求,请重新输入")
|
||||
elif cmdName == 'foot':
|
||||
|
||||
#遍历data
|
||||
@@ -106,6 +125,8 @@ def listDataToStr(data,cmdName):
|
||||
for i in data:
|
||||
if cmdName == "foot":
|
||||
strMessage += i['createTime']+" print_id:"+str(i['print_id'])+"\r\n"
|
||||
elif cmdName == "repair":
|
||||
strMessage += i['createTime']+" model_repair_order_id:"+str(i['model_repair_order_id'])+"\r\n"
|
||||
else:
|
||||
strMessage += i['createTime']+" order_id:"+str(i['order_id'])+"\r\n"
|
||||
return strMessage
|
||||
|
||||
Reference in new issue
Block a user