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
1eff871a
Commit
1eff871a
authored
Jan 19, 2022
by
Aeolus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
a25281bc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
35 deletions
+43
-35
myapps/automat/api/tallyman_portal.py
+2
-2
myapps/pc_management/api/production_portal.py
+41
-33
No files found.
myapps/automat/api/tallyman_portal.py
View file @
1eff871a
...
@@ -238,7 +238,7 @@ def get_tallyman_hatch_list():
...
@@ -238,7 +238,7 @@ def get_tallyman_hatch_list():
"machine_no"
:
i
.
machine_no
,
"machine_no"
:
i
.
machine_no
,
"hatch_no"
:
i
.
hatch_no
,
"hatch_no"
:
i
.
hatch_no
,
"production_id"
:
i
.
production_id
,
"production_id"
:
i
.
production_id
,
"name"
:
i
.
name
,
"name"
:
i
.
production_
name
,
"status"
:
i
.
status
,
"status"
:
i
.
status
,
"left_count"
:
i
.
left_count
,
"left_count"
:
i
.
left_count
,
"total_count"
:
i
.
total_count
"total_count"
:
i
.
total_count
...
@@ -281,7 +281,7 @@ def run_tally_start():
...
@@ -281,7 +281,7 @@ def run_tally_start():
tally_record
.
machine_no
=
i
.
machine_no
tally_record
.
machine_no
=
i
.
machine_no
tally_record
.
hatch_no
=
i
.
hatch_no
tally_record
.
hatch_no
=
i
.
hatch_no
tally_record
.
production_id
=
i
.
production_id
tally_record
.
production_id
=
i
.
production_id
tally_record
.
production_name
=
i
.
name
tally_record
.
production_name
=
i
.
production_
name
tally_record
.
tally_count
=
i
.
total_count
-
i
.
left_count
if
i
.
left_count
>
0
else
i
.
total_count
tally_record
.
tally_count
=
i
.
total_count
-
i
.
left_count
if
i
.
left_count
>
0
else
i
.
total_count
tally_record
.
status
=
1
tally_record
.
status
=
1
db
.
session
.
add
(
tally_record
)
db
.
session
.
add
(
tally_record
)
...
...
myapps/pc_management/api/production_portal.py
View file @
1eff871a
...
@@ -43,14 +43,15 @@ def run_production_list():
...
@@ -43,14 +43,15 @@ def run_production_list():
count_sql
=
"select count(p.id) as total_count"
count_sql
=
"select count(p.id) as total_count"
from_sql
=
""" from production p
from_sql
=
""" from production p
left join brand on p.brand_id = brand.id
left join brand on p.brand_id = brand.id
left join production_type on p.production_type_id = production_type.id
left join production_type on p.production_type_id = production_type.id
where p.id in ( select production_id from admin_production where
"""
admin_production.user_id = {} and admin_production.status = 1
)
"""
.
format
(
admin
.
id
)
where_sql
=
" "
if
g
.
user
.
level
==
1
:
where_sql
=
" where 0=0"
else
:
where_sql
=
""" where p.id in ( select production_id from admin_production where
admin_production.user_id = {} and admin_production.status = 1
)"""
.
format
(
admin
.
id
)
if
keyword
:
if
keyword
:
where_sql
+=
"""
where_sql
+=
"""
and CONCAT(p.production_name, brand_name,production_type_name, p.production_no) LIKE '
%
{keyword}
%
'
and CONCAT(p.production_name, brand_name,production_type_name, p.production_no) LIKE '
%
{keyword}
%
'
...
@@ -68,12 +69,6 @@ def run_production_list():
...
@@ -68,12 +69,6 @@ def run_production_list():
result
=
db
.
session
.
execute
(
select_sql
+
from_sql
+
where_sql
+
order_sql
+
limit_sql
)
.
fetchall
()
result
=
db
.
session
.
execute
(
select_sql
+
from_sql
+
where_sql
+
order_sql
+
limit_sql
)
.
fetchall
()
"""
select p.id, p.production_no, p.name, p.title, p.brand_id,p.production_type_id, p.price,p.original_price,
p.weight, p.weight_unit, p.expiration_date, p.expiration_date_unit, p.is_expiration_date,
p.weight_error, p.img, p.tags, p.content,p.summary, p.status,
brand.name as brand_name, production_type.name as production_type_name
"""
return_data
=
[]
return_data
=
[]
for
info
in
result
:
for
info
in
result
:
return_data
.
append
(
return_data
.
append
(
...
@@ -231,15 +226,17 @@ def get_production_detail():
...
@@ -231,15 +226,17 @@ def get_production_detail():
"""
"""
from_sql
=
""" from production p
from_sql
=
""" from production p
left join brand on p.brand_id = brand.id
left join brand on p.brand_id = brand.id
left join production_type on p.production_type_id = production_type.id
left join production_type on p.production_type_id = production_type.id
where p.id in (
"""
if
g
.
user
.
level
==
1
:
where_sql
=
" where 0=0"
else
:
where_sql
=
""" where p.id in (
select production_id from admin_production where
select production_id from admin_production where
admin_production.user_id = {} and admin_production.status = 1
admin_production.user_id = {} and admin_production.status = 1
)
)"""
.
format
(
admin
.
id
)
where_sql
+=
" and p.id={}"
.
format
(
production_id
)
"""
.
format
(
admin
.
id
)
where_sql
=
" and p.id={}"
.
format
(
production_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
:
...
@@ -276,13 +273,15 @@ def run_brand_list():
...
@@ -276,13 +273,15 @@ def run_brand_list():
select_sql
=
"""select b.id, b.brand_name,b.status, b.img
select_sql
=
"""select b.id, b.brand_name,b.status, b.img
"""
"""
count_sql
=
"select count(b.id) as total_count"
count_sql
=
"select count(b.id) as total_count"
from_sql
=
""" from brand b where b.id in (
from_sql
=
""" from brand b
select brand_id from admin_brand where
"""
admin_brand.user_id = {} and admin_brand.status = 1
if
g
.
user
.
level
==
1
:
)
where_sql
=
" where 0=0"
"""
.
format
(
admin
.
id
)
else
:
where_sql
=
""" where b.id in (
where_sql
=
""
select brand_id from admin_brand where
admin_brand.user_id = {} and admin_brand.status = 1
)"""
.
format
(
admin
.
id
)
if
keyword
:
if
keyword
:
where_sql
+=
"""
where_sql
+=
"""
and CONCAT( b.brand_name) LIKE '
%
{keyword}
%
'
and CONCAT( b.brand_name) LIKE '
%
{keyword}
%
'
...
@@ -373,8 +372,14 @@ def get_brand_detail():
...
@@ -373,8 +372,14 @@ def get_brand_detail():
select_sql
=
"""select b.id,b.brand_name,b.status, b.img
select_sql
=
"""select b.id,b.brand_name,b.status, b.img
"""
"""
from_sql
=
""" from brand b """
from_sql
=
""" from brand b """
if
g
.
user
.
level
==
1
:
where_sql
=
" where b.id ={}"
.
format
(
brand_id
)
where_sql
=
" where 0=0"
else
:
where_sql
=
""" where b.id in (
select brand_id from admin_brand where
admin_brand.user_id = {} and admin_brand.status = 1
)"""
.
format
(
admin
.
id
)
where_sql
+=
" and b.id ={}"
.
format
(
brand_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
:
...
@@ -403,13 +408,16 @@ def run_production_type_list():
...
@@ -403,13 +408,16 @@ def run_production_type_list():
select_sql
=
"""select p.id, p.production_type_name,p.status
select_sql
=
"""select p.id, p.production_type_name,p.status
"""
"""
count_sql
=
"select count(p.id) as total_count"
count_sql
=
"select count(p.id) as total_count"
from_sql
=
""" from production_type p where p.id in (
from_sql
=
""" from production_type p
"""
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
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
)
where_sql
=
" "
if
keyword
:
if
keyword
:
where_sql
+=
"""
where_sql
+=
"""
and CONCAT( p.production_type_name) LIKE '
%
{keyword}
%
'
and CONCAT( p.production_type_name) LIKE '
%
{keyword}
%
'
...
...
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