Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
Automat
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冯佳佳
Automat
Commits
21635be2
Commit
21635be2
authored
Jan 19, 2022
by
Aeolus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
1eff871a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
6 deletions
+17
-6
myapps/automat/api/machine_portal.py
+1
-1
myapps/pc_management/api/hatch_portal.py
+7
-1
myapps/pc_management/api/production_portal.py
+9
-4
No files found.
myapps/automat/api/machine_portal.py
View file @
21635be2
...
@@ -130,7 +130,7 @@ def run_bind_serial_num():
...
@@ -130,7 +130,7 @@ def run_bind_serial_num():
machine
=
Machine
.
query
.
filter_by
(
machine_no
=
machine_no
)
.
first
()
machine
=
Machine
.
query
.
filter_by
(
machine_no
=
machine_no
)
.
first
()
if
not
machine
:
if
not
machine
:
return
jsonify
(
MACHINE_NOT_EXIST_ERROR
)
return
jsonify
(
MACHINE_NOT_EXIST_ERROR
)
machine
.
device_id
=
serial_num
machine
.
qrcode_no
=
serial_num
db
.
session
.
add
(
machine
)
db
.
session
.
add
(
machine
)
db
.
session
.
commit
()
db
.
session
.
commit
()
return
BaseResponse
(
data
=
{
"machine_no"
:
machine_no
,
"serial_num"
:
serial_num
})
return
BaseResponse
(
data
=
{
"machine_no"
:
machine_no
,
"serial_num"
:
serial_num
})
myapps/pc_management/api/hatch_portal.py
View file @
21635be2
...
@@ -48,7 +48,13 @@ def run_hatch_list():
...
@@ -48,7 +48,13 @@ def run_hatch_list():
where hatch.machine_no in ( select machine_no from admin_machine where
where hatch.machine_no in ( select machine_no from admin_machine where
admin_machine.user_id = {user_id} and admin_machine.status = 1)
admin_machine.user_id = {user_id} and admin_machine.status = 1)
"""
.
format
(
user_id
=
admin
.
id
)
"""
.
format
(
user_id
=
admin
.
id
)
if
g
.
user
.
level
==
1
:
where_sql
=
" where 0=0"
else
:
where_sql
=
""" where p.id in ( select production_type_id from admin_production_type where
admin_production_type.user_id = {} and admin_production_type.status = 1
)
)"""
.
format
(
admin
.
id
)
where_sql
=
" "
where_sql
=
" "
if
keyword
:
if
keyword
:
where_sql
+=
"""
where_sql
+=
"""
...
...
myapps/pc_management/api/production_portal.py
View file @
21635be2
...
@@ -413,8 +413,7 @@ def run_production_type_list():
...
@@ -413,8 +413,7 @@ def run_production_type_list():
if
g
.
user
.
level
==
1
:
if
g
.
user
.
level
==
1
:
where_sql
=
" where 0=0"
where_sql
=
" where 0=0"
else
:
else
:
where_sql
=
""" where p.id in (
where_sql
=
""" where p.id in ( select production_type_id from admin_production_type where
select production_type_id from admin_production_type where
admin_production_type.user_id = {} and admin_production_type.status = 1
admin_production_type.user_id = {} and admin_production_type.status = 1
)
)
)"""
.
format
(
admin
.
id
)
)"""
.
format
(
admin
.
id
)
...
@@ -505,8 +504,14 @@ def get_production_type_detail():
...
@@ -505,8 +504,14 @@ def get_production_type_detail():
select_sql
=
"""select b.id,b.production_type_name,b.status
select_sql
=
"""select b.id,b.production_type_name,b.status
"""
"""
from_sql
=
""" from production_type b """
from_sql
=
""" from production_type b """
if
g
.
user
.
level
==
1
:
where_sql
=
" where b.id ={}"
.
format
(
production_type_id
)
where_sql
=
" where 0=0"
else
:
where_sql
=
""" where p.id in ( select production_type_id from admin_production_type where
admin_production_type.user_id = {} and admin_production_type.status = 1
)
)"""
.
format
(
admin
.
id
)
where_sql
+=
" and b.id ={}"
.
format
(
production_type_id
)
result
=
db
.
session
.
execute
(
select_sql
+
from_sql
+
where_sql
)
.
fetchall
()
result
=
db
.
session
.
execute
(
select_sql
+
from_sql
+
where_sql
)
.
fetchall
()
if
not
result
or
len
(
result
)
!=
1
:
if
not
result
or
len
(
result
)
!=
1
:
...
...
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