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
a35819f1
Commit
a35819f1
authored
Mar 01, 2022
by
Aeolus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
757d141a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
myapps/automat/api/machine_portal.py
+10
-6
No files found.
myapps/automat/api/machine_portal.py
View file @
a35819f1
...
...
@@ -5,6 +5,7 @@
author:Aeolus
@file: hatch_portal.py
"""
import
datetime
import
logging
import
time
...
...
@@ -106,12 +107,15 @@ def run_create_machine_no():
if
machine
:
return
jsonify
(
MACHINE_MAC_DUPLICATE_ERROR
)
for
i
in
range
(
3
):
machine_no
=
int
(
time
.
time
())
machine
=
Machine
.
query
.
filter_by
(
machine_no
=
machine_no
)
.
first
()
if
not
machine
:
break
return
jsonify
(
MACHINE_NO_CREATE_ERROR
)
date_str
=
datetime
.
datetime
.
now
()
.
date
()
.
strftime
(
"
%
Y
%
m
%
d"
)[
2
:]
sql
=
"SELECT max(machine_no) as machine_no FROM machine where machine_no like '{}
%
'"
.
format
(
date_str
)
result
=
db
.
session
.
execute
(
sql
)
.
fetchone
()
if
result
:
max_machine_no
=
int
(
result
[
"machine_no"
])
machine_no
=
str
(
max_machine_no
+
1
)
else
:
machine_no
=
date_str
+
"0001"
machine_model
=
Machine
()
machine_model
.
machine_no
=
machine_no
machine_model
.
mac
=
mac
...
...
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