Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EMUAFactory
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mayinghao
EMUAFactory
Commits
1b68d653
Commit
1b68d653
authored
Jun 25, 2025
by
mayinghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1地址改为正式版,2添加登录异常判断3中断上传暂时未开放
parent
a7025954
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
47 deletions
+55
-47
main.py
main.py
+44
-42
config.cpython-38.pyc
multipleThread/__pycache__/config.cpython-38.pyc
+0
-0
thread_resume.cpython-38.pyc
multipleThread/__pycache__/thread_resume.cpython-38.pyc
+0
-0
thread_upload.cpython-38.pyc
multipleThread/__pycache__/thread_upload.cpython-38.pyc
+0
-0
config.py
multipleThread/config.py
+1
-1
thread_resume.py
multipleThread/thread_resume.py
+4
-1
thread_upload.py
multipleThread/thread_upload.py
+6
-3
No files found.
main.py
View file @
1b68d653
...
...
@@ -35,11 +35,11 @@ from multipleThread.config import *
user_now
=
''
token
=
''
# 工厂上传登录地址
login_url
=
'https://
uat.
emku.laidecloud.com/console/pc/userLoginByToken.ajax'
login_url
=
'https://emku.laidecloud.com/console/pc/userLoginByToken.ajax'
# order信息地址
order_info_url
=
"https://
uat.
emku.laidecloud.com/console/productOrder/experimentOrderList.ajax"
order_info_url
=
"https://emku.laidecloud.com/console/productOrder/experimentOrderList.ajax"
# order detail
order_detail_url
=
"https://
uat.
emku.laidecloud.com/console/productOrder/uploadorderdetail.ajax"
order_detail_url
=
"https://emku.laidecloud.com/console/productOrder/uploadorderdetail.ajax"
# 未完成任务列表
job_list
=
{}
...
...
@@ -51,8 +51,6 @@ uncomplete_json_folder = "./upload_tag"
thread_index
=
0
# 密码加密存储类
class
PasswordManager
:
def
__init__
(
self
,
storage_file
=
'data.json'
,
key_file
=
'secret.key'
):
...
...
@@ -177,7 +175,8 @@ class OrderDetail(QMainWindow):
self
.
table
.
sortItems
(
1
,
Qt
.
AscendingOrder
)
layout
.
addWidget
(
self
.
table
)
self
.
check_if_has_unfinished
()
#self.check_if_has_unfinished()
def
load_sample_data
(
self
):
"""加载示例数据"""
...
...
@@ -279,7 +278,7 @@ class OrderDetail(QMainWindow):
self
.
progress_widgets
.
append
({
"widget"
:
widget
,
"progess_bar"
:
progress_bar
,
"label"
:
status_label
,
"index"
:
current_index
})
#self.buttons.append(button)
thread
=
QThread
()
upload
=
Upload_Thread
(
self
.
counter
,
order_id
,
type_info
)
upload
=
Upload_Thread
(
self
.
counter
,
order_id
,
type_info
,
token
)
upload
.
filename
=
file_path
upload
.
moveToThread
(
thread
)
upload
.
updateSignal
.
connect
(
self
.
changeProcessbar
)
...
...
@@ -333,9 +332,11 @@ class OrderDetail(QMainWindow):
# 创建按钮
button
=
QPushButton
(
f
"继续上传"
)
label
=
QLabel
(
local_file_path
)
# 将部件添加到水平布局
h_layout
.
addWidget
(
progress_bar
)
h_layout
.
addWidget
(
label
)
h_layout
.
addWidget
(
button
)
# 将水平布局添加到主布局
...
...
@@ -343,7 +344,7 @@ class OrderDetail(QMainWindow):
self
.
progress_bars
.
append
(
progress_bar
)
self
.
buttons
.
append
(
button
)
thread
=
QThread
()
resume_thread
=
Resume_Thread
(
self
.
counter
,
(
local_file_path
,
upload_id
,
order_id
,
type_info
,
uuid_str
,
total_size
))
resume_thread
=
Resume_Thread
(
self
.
counter
,
(
local_file_path
,
upload_id
,
order_id
,
type_info
,
uuid_str
,
total_size
,
token
))
resume_thread
.
moveToThread
(
thread
)
resume_thread
.
updateSignal
.
connect
(
self
.
changeProcessbar
)
self
.
resume_loads
.
append
(
resume_thread
)
...
...
@@ -366,7 +367,7 @@ class OrderDetail(QMainWindow):
OrderDetail
.
_instance
=
None
event
.
accept
()
def
upload_file
(
self
,
filename
,
order_id
,
type
):
def
upload_file
(
self
,
filename
,
order_id
,
type
_info
):
# 显示上传进度条
self
.
program_bar
.
setVisible
(
True
)
self
.
send_data
=
0
...
...
@@ -420,8 +421,10 @@ class OrderDetail(QMainWindow):
self
.
program_bar
.
setValue
(
0
)
self
.
program_bar
.
setVisible
(
False
)
self
.
file_label
.
setText
(
f
"{filename}上传完成"
)
datas
=
{
"id"
:
str
(
order_id
),
"name"
:
self
.
uuid_str
+
"."
+
extension
,
"path"
:
name_prefix
,
"info"
:
key
,
"type"
:
type
}
response
=
requests
.
post
(
callback_url
,
data
=
datas
)
datas
=
{
"id"
:
str
(
order_id
),
"name"
:
self
.
uuid_str
+
"."
+
extension
,
"path"
:
name_prefix
,
"info"
:
key
,
"type"
:
type_info
}
headers
=
{
'token'
:
token
,
'User-Agent'
:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
}
response
=
requests
.
post
(
callback_url
,
data
=
datas
,
headers
=
headers
)
res
=
response
.
json
()
if
res
[
"obj"
]
==
"保存成功"
:
time_str
=
time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
,
time
.
localtime
())
...
...
@@ -832,37 +835,36 @@ class LoginWindow(QMainWindow):
else
:
myobj
=
{
'username'
:
account
,
'password'
:
password
}
response
=
requests
.
post
(
login_url
,
data
=
myobj
)
data
=
response
.
json
()
if
data
[
'resMsg'
]
==
"登录成功"
:
print
(
"access success"
)
global
user_now
,
token
user_now
=
account
token
=
data
[
'obj'
][
'token'
]
try
:
# 登录成功且记住账号没有被选中
keep_username
=
1
keep_password
=
1
if
not
self
.
ui
.
checkBox
.
checkState
():
self
.
pm
.
add_password
(
"one"
,
""
,
""
,
0
,
0
)
else
:
# 记住密码没选中
if
not
self
.
ui
.
checkBox_2
.
checkState
():
password
=
""
keep_password
=
0
self
.
pm
.
add_password
(
"one"
,
account
,
password
,
keep_username
,
keep_password
)
except
Exception
as
e
:
print
(
e
)
self
.
order_info_page
=
EqipInfoWindow
()
self
.
order_info_page
.
show
()
self
.
close
()
else
:
try
:
response
=
requests
.
post
(
login_url
,
data
=
myobj
)
data
=
response
.
json
()
print
(
data
)
if
data
[
'resMsg'
]
==
"登录成功"
:
print
(
"access success"
)
global
user_now
,
token
user_now
=
account
token
=
data
[
'obj'
][
'token'
]
try
:
# 登录成功且记住账号没有被选中
keep_username
=
1
keep_password
=
1
if
not
self
.
ui
.
checkBox
.
checkState
():
self
.
pm
.
add_password
(
"one"
,
""
,
""
,
0
,
0
)
else
:
# 记住密码没选中
if
not
self
.
ui
.
checkBox_2
.
checkState
():
password
=
""
keep_password
=
0
self
.
pm
.
add_password
(
"one"
,
account
,
password
,
keep_username
,
keep_password
)
except
Exception
as
e
:
print
(
e
)
self
.
order_info_page
=
EqipInfoWindow
()
self
.
order_info_page
.
show
()
self
.
close
()
else
:
self
.
ui
.
stackedWidget
.
setCurrentIndex
(
0
)
except
Exception
as
e
:
print
(
"response is not a json format "
)
self
.
ui
.
stackedWidget
.
setCurrentIndex
(
0
)
...
...
multipleThread/__pycache__/config.cpython-38.pyc
View file @
1b68d653
No preview for this file type
multipleThread/__pycache__/thread_resume.cpython-38.pyc
View file @
1b68d653
No preview for this file type
multipleThread/__pycache__/thread_upload.cpython-38.pyc
View file @
1b68d653
No preview for this file type
multipleThread/config.py
View file @
1b68d653
...
...
@@ -11,4 +11,4 @@ part_size = 5 * 1024 * 1024
# 阿里云前缀
name_prefix
=
"https://qgongye.oss-cn-shanghai.aliyuncs.com
\\
upload/order"
# 回调地址
callback_url
=
"https://uat.emku.laidecloud.com/console/productOrder/filePthSave.ajax"
\ No newline at end of file
callback_url
=
"https://emku.laidecloud.com/console/productOrder/filePthSave.ajax"
\ No newline at end of file
multipleThread/thread_resume.py
View file @
1b68d653
...
...
@@ -33,6 +33,7 @@ class Resume_Thread(QObject):
self
.
order_id
=
job_list
[
2
]
self
.
uuid_str
=
job_list
[
4
]
self
.
total_size
=
job_list
[
5
]
self
.
token
=
job_list
[
6
]
def
pause
(
self
):
self
.
_isPause
=
True
...
...
@@ -141,7 +142,9 @@ class Resume_Thread(QObject):
datas
=
{
"id"
:
str
(
self
.
order_id
),
"name"
:
self
.
uuid_str
+
"."
+
extension
,
"path"
:
name_prefix
,
"info"
:
key
,
"type"
:
self
.
type_info
}
response
=
requests
.
post
(
callback_url
,
data
=
datas
)
headers
=
{
'token'
:
self
.
token
,
'User-Agent'
:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
}
response
=
requests
.
post
(
callback_url
,
data
=
datas
,
headers
=
headers
)
res
=
response
.
json
()
print
(
res
[
"obj"
])
...
...
multipleThread/thread_upload.py
View file @
1b68d653
...
...
@@ -18,7 +18,7 @@ class Upload_Thread(QObject):
finishSignal
=
pyqtSignal
(
str
)
updateSignal
=
pyqtSignal
(
tuple
)
def
__init__
(
self
,
thread_num
=
0
,
order_id
=
None
,
type_info
=
None
):
def
__init__
(
self
,
thread_num
=
0
,
order_id
=
None
,
type_info
=
None
,
token
=
""
):
QObject
.
__init__
(
self
)
# 要发送的文件地址
self
.
_filename
=
''
...
...
@@ -33,7 +33,7 @@ class Upload_Thread(QObject):
self
.
uuid_str
=
str
(
uuid
.
uuid4
())
self
.
type_info
=
type_info
self
.
order_id
=
order_id
self
.
token
=
token
def
pause
(
self
):
self
.
_isPause
=
True
...
...
@@ -155,6 +155,9 @@ class Upload_Thread(QObject):
datas
=
{
"id"
:
str
(
self
.
order_id
),
"name"
:
self
.
uuid_str
+
"."
+
extension
,
"path"
:
name_prefix
,
"info"
:
key
,
"type"
:
self
.
type_info
}
response
=
requests
.
post
(
callback_url
,
data
=
datas
)
headers
=
{
'token'
:
self
.
token
,
'User-Agent'
:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
}
response
=
requests
.
post
(
callback_url
,
data
=
datas
,
headers
=
headers
)
res
=
response
.
json
()
print
(
res
[
"obj"
])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment