Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
董杰
/
SmartShelf-raspberry
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit fe927fd1
由
董杰
编写于
2021-04-25 13:21:17 +0800
浏览文件
选项
浏览文件
标签
下载
差异文件
合并分支 '0419' 到 'master'
0419 查看合并请求
!1
2 个父辈
faf29547
a2af0b92
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
314 行增加
和
119 行删除
smartshelf/app/__init__.py
smartshelf/app/autoback.py
smartshelf/app/messages.pot
smartshelf/app/post.py
smartshelf/app/qr_code.py
smartshelf/app/routes.py
smartshelf/app/state/version.txt
smartshelf/app/templates/ledtest.html
smartshelf/app/templates/shelfconfig.html
smartshelf/app/translations/en/LC_MESSAGES/messages.mo
smartshelf/app/translations/en/LC_MESSAGES/messages.po
smartshelf/app/__init__.py
查看文件 @
fe927fd
...
@@ -34,5 +34,5 @@ def get_locale():
...
@@ -34,5 +34,5 @@ def get_locale():
return
request
.
accept_languages
.
best_match
(
LANGUAGES
.
keys
())
return
request
.
accept_languages
.
best_match
(
LANGUAGES
.
keys
())
from
app
import
routes
,
post
,
led_strip
,
driver_gpio
,
autoback
from
app
import
routes
,
post
,
led_strip
,
driver_gpio
,
autoback
,
qr_code
# return app
# return app
\ No newline at end of file
\ No newline at end of file
smartshelf/app/autoback.py
查看文件 @
fe927fd
...
@@ -142,3 +142,22 @@ def process_file():
...
@@ -142,3 +142,22 @@ def process_file():
def
reboot
():
def
reboot
():
os
.
system
(
'/prog/./restart.sh'
)
os
.
system
(
'/prog/./restart.sh'
)
def
openteam
():
# os.system('/usr/bin/./teamviwer')
cmd
=
"nohub /opt/teamviewer/tv_bin/TeamViewer"
run
=
pexpect
.
spawn
(
'su -c "
%
s" root'
%
cmd
)
time
.
sleep
(
0.5
)
run
.
sendline
(
'xxx'
)
# cmd1 = "./teamviwer"
# run1 = pexpect.spawn('su -c "%s" root' %cmd1)
# time.sleep(0.5)
# run1.sendline('xxx')
logging
.
warning
(
"teamview open"
)
@app.route
(
'/openteamview'
,
methods
=
[
'POST'
])
def
openteamview
():
openteam
()
info
=
{
'operation'
:
'已打开teamview'
}
return
json
.
dumps
(
info
)
smartshelf/app/messages.pot
查看文件 @
fe927fd
...
@@ -8,7 +8,7 @@ msgid ""
...
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-04-
08 16:38
+0800\n"
"POT-Creation-Date: 2021-04-
19 15:19
+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
...
@@ -21,171 +21,183 @@ msgstr ""
...
@@ -21,171 +21,183 @@ msgstr ""
msgid "智能料架系统"
msgid "智能料架系统"
msgstr ""
msgstr ""
#: templates/base.html:2
3 templates/ledtest.html:23
#: templates/base.html:2
6 templates/ledtest.html:24
#: templates/shelfconfig.html:
79
#: templates/shelfconfig.html:
80
msgid "亮灯料架"
msgid "亮灯料架"
msgstr ""
msgstr ""
#: templates/base.html:
27 templates/ledtest.html:27
#: templates/base.html:
30 templates/ledtest.html:28
#: templates/shelfconfig.html:8
3
#: templates/shelfconfig.html:8
4
msgid "控制"
msgid "控制"
msgstr ""
msgstr ""
#: templates/base.html:
28 templates/ledtest.html:28
#: templates/base.html:
31 templates/ledtest.html:29
#: templates/shelfconfig.html:8
4
#: templates/shelfconfig.html:8
5
msgid "测试"
msgid "测试"
msgstr ""
msgstr ""
#: templates/base.html:
29 templates/ledtest.html:29
#: templates/base.html:
32 templates/ledtest.html:30
#: templates/shelfconfig.html:8
5
#: templates/shelfconfig.html:8
6
msgid "料架配置"
msgid "料架配置"
msgstr ""
msgstr ""
#: templates/base.html:
45 templates/ledtest.html:45
#: templates/base.html:
58 templates/ledtest.html:46
#: templates/shelfconfig.html:10
1
#: templates/shelfconfig.html:10
2
msgid "料架系统"
msgid "料架系统"
msgstr ""
msgstr ""
#: templates/base.html:
50
#: templates/base.html:
63
msgid "开关"
msgid "开关"
msgstr ""
msgstr ""
#: templates/base.html:
53
#: templates/base.html:
66
msgid "启动"
msgid "启动"
msgstr ""
msgstr ""
#: templates/base.html:
54
#: templates/base.html:
67
msgid "停止"
msgid "停止"
msgstr ""
msgstr ""
#: templates/base.html:
62 templates/ledtest.html:137
#: templates/base.html:
75 templates/ledtest.html:159
#: templates/shelfconfig.html:15
4
#: templates/shelfconfig.html:15
5
msgid "提醒消息"
msgid "提醒消息"
msgstr ""
msgstr ""
#: templates/base.html:
67 templates/ledtest.html:142
#: templates/base.html:
80 templates/ledtest.html:164
#: templates/shelfconfig.html:1
59
#: templates/shelfconfig.html:1
60
msgid "运行状态"
msgid "运行状态"
msgstr ""
msgstr ""
#: templates/base.html:
72 templates/ledtest.html:152
#: templates/base.html:
85 templates/ledtest.html:174
#: templates/shelfconfig.html:16
4
#: templates/shelfconfig.html:16
5
msgid "配置文件加载状态"
msgid "配置文件加载状态"
msgstr ""
msgstr ""
#: templates/base.html:
77 templates/shelfconfig.html:124
#: templates/base.html:
90 templates/shelfconfig.html:125
#: templates/shelfconfig.html:1
69
#: templates/shelfconfig.html:1
70
msgid "服务器地址"
msgid "服务器地址"
msgstr ""
msgstr ""
#: templates/base.html:
82 templates/shelfconfig.html:130
#: templates/base.html:
95 templates/shelfconfig.html:131
#: templates/shelfconfig.html:17
4
#: templates/shelfconfig.html:17
5
msgid "料架编号"
msgid "料架编号"
msgstr ""
msgstr ""
#: templates/base.html:
87
#: templates/base.html:
100
msgid "服务器连接状态"
msgid "服务器连接状态"
msgstr ""
msgstr ""
#: templates/base.html:
96 templates/ledtest.html:131
#: templates/base.html:
109 templates/ledtest.html:153
#: templates/shelfconfig.html:14
8
#: templates/shelfconfig.html:14
9
msgid "运行日志&状态信息"
msgid "运行日志&状态信息"
msgstr ""
msgstr ""
#: templates/base.html:1
01
#: templates/base.html:1
14
msgid "日志下载"
msgid "日志下载"
msgstr ""
msgstr ""
#: templates/base.html:1
04
#: templates/base.html:1
17
msgid "下载日志"
msgid "下载日志"
msgstr ""
msgstr ""
#: templates/base.html:1
11
#: templates/base.html:1
24
msgid "日志"
msgid "日志"
msgstr ""
msgstr ""
#: templates/ledtest.html:5
0
#: templates/ledtest.html:5
1
msgid "灯条测试"
msgid "灯条测试"
msgstr ""
msgstr ""
#: templates/ledtest.html:5
3 templates/ledtest.html:109
#: templates/ledtest.html:5
4 templates/ledtest.html:110
msgid "通道"
msgid "通道"
msgstr ""
msgstr ""
#: templates/ledtest.html:6
0 templates/ledtest.html:88
#: templates/ledtest.html:6
1 templates/ledtest.html:89
#: templates/ledtest.html:11
6
#: templates/ledtest.html:11
7
msgid "颜色"
msgid "颜色"
msgstr ""
msgstr ""
#: templates/ledtest.html:7
0
#: templates/ledtest.html:7
1
msgid "灯条全开"
msgid "灯条全开"
msgstr ""
msgstr ""
#: templates/ledtest.html:7
1
#: templates/ledtest.html:7
2
msgid "灯条关闭"
msgid "灯条关闭"
msgstr ""
msgstr ""
#: templates/ledtest.html:7
7
#: templates/ledtest.html:7
8
msgid "库位操作测试"
msgid "库位操作测试"
msgstr ""
msgstr ""
#: templates/ledtest.html:8
0
#: templates/ledtest.html:8
1
msgid "库位"
msgid "库位"
msgstr ""
msgstr ""
#: templates/ledtest.html:9
8 templates/ledtest.html:124
#: templates/ledtest.html:9
9 templates/ledtest.html:125
msgid "亮灯"
msgid "亮灯"
msgstr ""
msgstr ""
#: templates/ledtest.html:
99 templates/ledtest.html:125
#: templates/ledtest.html:
100 templates/ledtest.html:126
msgid "灭灯"
msgid "灭灯"
msgstr ""
msgstr ""
#: templates/ledtest.html:10
0
#: templates/ledtest.html:10
1
msgid "重置"
msgid "重置"
msgstr ""
msgstr ""
#: templates/ledtest.html:10
6
#: templates/ledtest.html:10
7
msgid "状态灯测试"
msgid "状态灯测试"
msgstr ""
msgstr ""
#: templates/ledtest.html:133
msgid "下载库位二维码"
msgstr ""
#: templates/ledtest.html:145
msgid "下载二维码"
msgstr ""
#: templates/ledtest.html:147
#: templates/ledtest.html:147
msgid "单个二维码尺寸(含白色底框)尺寸为16*16mm,黑码尺寸为10*10mm"
msgstr ""
#: templates/ledtest.html:169
msgid "测试消息"
msgid "测试消息"
msgstr ""
msgstr ""
#: templates/shelfconfig.html:10
6
#: templates/shelfconfig.html:10
7
msgid "配置文件"
msgid "配置文件"
msgstr ""
msgstr ""
#: templates/shelfconfig.html:11
0
#: templates/shelfconfig.html:11
1
msgid "选择文件"
msgid "选择文件"
msgstr ""
msgstr ""
#: templates/shelfconfig.html:11
3
#: templates/shelfconfig.html:11
4
msgid "上传"
msgid "上传"
msgstr ""
msgstr ""
#: templates/shelfconfig.html:1
19
#: templates/shelfconfig.html:1
20
msgid "服务器配置"
msgid "服务器配置"
msgstr ""
msgstr ""
#: templates/shelfconfig.html:13
4
#: templates/shelfconfig.html:13
5
msgid "保存"
msgid "保存"
msgstr ""
msgstr ""
#: templates/shelfconfig.html:1
39
#: templates/shelfconfig.html:1
40
msgid "控制器备份&升级"
msgid "控制器备份&升级"
msgstr ""
msgstr ""
#: templates/shelfconfig.html:14
3
#: templates/shelfconfig.html:14
4
msgid "料架升级"
msgid "料架升级"
msgstr ""
msgstr ""
#: templates/shelfconfig.html:1
79
#: templates/shelfconfig.html:1
80
msgid "操作提醒"
msgid "操作提醒"
msgstr ""
msgstr ""
#: templates/shelfconfig.html:18
4
#: templates/shelfconfig.html:18
5
msgid "软件版本"
msgid "软件版本"
msgstr ""
msgstr ""
smartshelf/app/post.py
查看文件 @
fe927fd
...
@@ -318,8 +318,8 @@ def check_leds():
...
@@ -318,8 +318,8 @@ def check_leds():
if
leds
:
if
leds
:
if
channel
==
'1'
and
not
statusgreenA
:
if
channel
==
'1'
and
not
statusgreenA
:
statusgreenA
=
True
statusgreenA
=
True
driver_gpio
.
init
(
SET_CHANNEL
[
'
red
A'
])
driver_gpio
.
init
(
SET_CHANNEL
[
'
yellow
A'
])
driver_gpio
.
gpio_high
(
SET_CHANNEL
[
'
red
A'
])
driver_gpio
.
gpio_high
(
SET_CHANNEL
[
'
yellow
A'
])
# t = threading.Thread(target=deal_with_greenA)
# t = threading.Thread(target=deal_with_greenA)
# t.start()
# t.start()
logging
.
warning
(
"A面黄状态灯开启"
)
logging
.
warning
(
"A面黄状态灯开启"
)
...
@@ -327,19 +327,19 @@ def check_leds():
...
@@ -327,19 +327,19 @@ def check_leds():
statusgreenB
=
True
statusgreenB
=
True
# t = threading.Thread(target=deal_with_greenB)
# t = threading.Thread(target=deal_with_greenB)
# t.start()
# t.start()
driver_gpio
.
init
(
SET_CHANNEL
[
'
red
B'
])
driver_gpio
.
init
(
SET_CHANNEL
[
'
yellow
B'
])
driver_gpio
.
gpio_high
(
SET_CHANNEL
[
'
red
B'
])
driver_gpio
.
gpio_high
(
SET_CHANNEL
[
'
yellow
B'
])
logging
.
warning
(
"B面黄状态灯开启"
)
logging
.
warning
(
"B面黄状态灯开启"
)
else
:
else
:
if
channel
==
'1'
and
statusgreenA
:
if
channel
==
'1'
and
statusgreenA
:
statusgreenA
=
False
statusgreenA
=
False
driver_gpio
.
init
(
SET_CHANNEL
[
'
red
A'
])
driver_gpio
.
init
(
SET_CHANNEL
[
'
yellow
A'
])
driver_gpio
.
gpio_low
(
SET_CHANNEL
[
'
red
A'
])
driver_gpio
.
gpio_low
(
SET_CHANNEL
[
'
yellow
A'
])
logging
.
warning
(
"A面黄状态灯关闭"
)
logging
.
warning
(
"A面黄状态灯关闭"
)
elif
channel
==
'2'
and
statusgreenB
:
elif
channel
==
'2'
and
statusgreenB
:
statusgreenB
=
False
statusgreenB
=
False
driver_gpio
.
init
(
SET_CHANNEL
[
'
red
B'
])
driver_gpio
.
init
(
SET_CHANNEL
[
'
yellow
B'
])
driver_gpio
.
gpio_low
(
SET_CHANNEL
[
'
red
B'
])
driver_gpio
.
gpio_low
(
SET_CHANNEL
[
'
yellow
B'
])
logging
.
warning
(
"B面黄状态灯关闭"
)
logging
.
warning
(
"B面黄状态灯关闭"
)
...
...
smartshelf/app/qr_code.py
0 → 100644
查看文件 @
fe927fd
import
os
import
sys
import
qrcode
# from PIL import Image
from
PIL
import
Image
,
ImageDraw
,
ImageFont
,
ImageFilter
import
numpy
from
app
import
app
from
flask
import
jsonify
,
render_template
,
request
,
send_from_directory
import
matplotlib.font_manager
as
fm
import
logging
code_path
=
'/prog/smartshelf/app/static/uploads'
def
make_qrcode
(
file_code
):
# for line in all_data:
# A_NUMBER = line[0]
# c_start = int(line[1])
# c_stop = int(line[2])
# dirs_str = deal_line_code(project_number,A_NUMBER,c_start,c_stop)
# resize(project_number,dirs_str)
# current_path_file=os.path.join(code_path,t_file)
qr
=
qrcode
.
QRCode
(
version
=
1
,
error_correction
=
qrcode
.
constants
.
ERROR_CORRECT_L
,
box_size
=
10
,
border
=
0
)
qr
.
add_data
(
file_code
)
qr
.
make
(
fit
=
True
)
img
=
qr
.
make_image
()
file
=
"{}/{}.png"
.
format
(
code_path
,
file_code
)
img
.
save
(
file
)
# img1.save("./{}_qr_jpg/{}/{}.jpg".format(project_number,dirs_str,filename[:-4]))
return
True
def
resize
(
file_code
):
# path = './{}_qr_png/{}'.format(project_number,dirs_str)
# path_list = os.listdir(path)
img1
=
Image
.
open
(
"{}/{}.png"
.
format
(
code_path
,
file_code
))
# img1 = Image.open("E:/qr_png/code/0/{}.png".format(filename))
img1
=
img1
.
resize
((
300
,
300
),
Image
.
ANTIALIAS
)
# print (filename[:-4])
img1
.
save
(
"{}/{}.jpg"
.
format
(
code_path
,
file_code
))
def
deal_number
(
file_code
):
print
(
file_code
)
color
=
"White"
img_str
=
Image
.
new
(
"RGB"
,(
480
,
90
),
color
)
img_str
.
save
(
"{}/temp_number.jpg"
.
format
(
code_path
))
im
=
Image
.
open
(
"{}/temp_number.jpg"
.
format
(
code_path
))
# font = ImageFont.truetype('simsun.ttc',55)
# font = ImageFont.truetype(fm.findfont(fm.FontProperties(family='DejaVu Sans')),63)
if
os
.
path
.
isfile
(
"/usr/share/fonts/truetype/dejavu/simsun.ttf"
):
font
=
ImageFont
.
truetype
(
"/usr/share/fonts/truetype/dejavu/simsun.ttf"
,
75
)
draw
=
ImageDraw
.
Draw
(
im
)
draw
.
text
((
50
,
20
),
file_code
,
font
=
font
,
fill
=
'#000'
)
else
:
font
=
ImageFont
.
truetype
(
fm
.
findfont
(
fm
.
FontProperties
(
family
=
'DejaVu Sans'
)),
75
)
draw
=
ImageDraw
.
Draw
(
im
)
draw
.
text
((
30
,
20
),
file_code
,
font
=
font
,
fill
=
'#000'
)
# draw.text((60,13), filename, font=font, fill='#000') #602项目改动
im
.
save
(
"{}/temp_number.jpg"
.
format
(
code_path
))
def
paste
(
file_code
):
color
=
'white'
target
=
Image
.
new
(
"RGB"
,(
300
,
390
),
color
)
# qr = Image.open("E:/qr_png/jpg_code/B/{}".format(filename))
# qr = Image.open("E:/code_tool/{}/{}/{}.jpg".format(source_path,path_str,filename))
qr
=
Image
.
open
(
'{}/{}.jpg'
.
format
(
code_path
,
file_code
))
im
=
Image
.
open
(
'{}/temp_number.jpg'
.
format
(
code_path
))
a
=
0
# 图片距离左边的大小
b
=
0
# 图片距离上边的大小
c
=
300
# 图片距离左边的大小 + 图片自身宽度
d
=
300
# 图片距离上边的大小 + 图片自身高度
target
.
paste
(
qr
,
(
a
,
b
,
c
,
d
))
e
=
0
f
=
300
# target.paste(im, (e, f))
target
.
save
(
"{}/code_img_str.jpg"
.
format
(
code_path
))
targeta
=
Image
.
new
(
"RGB"
,(
480
,
480
),
color
)
targetb
=
Image
.
open
(
"{}/code_img_str.jpg"
.
format
(
code_path
))
targeta
.
paste
(
targetb
,
(
90
,
60
))
targeta
.
paste
(
im
,
(
0
,
360
))
targeta
.
save
(
"{}/{}.jpg"
.
format
(
code_path
,
file_code
))
logging
.
warning
(
"库位二维码生成成功:{}"
.
format
(
file_code
))
@app.route
(
'/downqrcode/'
,
methods
=
[
'GET'
,
'POST'
],
strict_slashes
=
False
)
def
downqrcode
():
# file_code = '001-01-001'
file_code
=
str
(
request
.
args
.
get
(
"code"
))
make_qrcode
(
file_code
)
resize
(
file_code
)
deal_number
(
file_code
)
paste
(
file_code
)
c_path
=
'/prog/smartshelf/app/static/uploads/'
filename
=
'{}.jpg'
.
format
(
file_code
)
if
request
.
method
==
"GET"
:
if
os
.
path
.
isfile
(
os
.
path
.
join
(
c_path
,
filename
)):
return
send_from_directory
(
c_path
,
filename
,
as_attachment
=
True
)
\ No newline at end of file
\ No newline at end of file
smartshelf/app/routes.py
查看文件 @
fe927fd
...
@@ -15,6 +15,7 @@ from rpi_ws281x import Adafruit_NeoPixel, Color,PixelStrip
...
@@ -15,6 +15,7 @@ from rpi_ws281x import Adafruit_NeoPixel, Color,PixelStrip
from
app
import
app
,
babel
from
app
import
app
,
babel
# from app import socketio
# from app import socketio
from
app.led_strip
import
get_strip
from
app.led_strip
import
get_strip
from
app
import
driver_gpio
import
logging
import
logging
import
RPi.GPIO
as
GPIO
import
RPi.GPIO
as
GPIO
from
flask_babel
import
Babel
,
gettext
as
_
from
flask_babel
import
Babel
,
gettext
as
_
...
@@ -49,7 +50,7 @@ try:
...
@@ -49,7 +50,7 @@ try:
except
Exception
as
e
:
except
Exception
as
e
:
logging
.
warning
(
"配置文件加载失败,请上传配置文件"
)
logging
.
warning
(
"配置文件加载失败,请上传配置文件"
)
config_state
=
'加载失败,请在配置页面上传配置文件'
config_state
=
'加载失败,请在配置页面上传配置文件'
SET_CHANNEL
=
{
'greenA'
:
5
,
'
redA'
:
6
,
'greenB'
:
17
,
'redB'
:
27
}
SET_CHANNEL
=
{
'greenA'
:
5
,
'
yellowA'
:
6
,
'redA'
:
16
,
'greenB'
:
17
,
'yellowB'
:
27
,
'redB'
:
23
}
SET_LED_CHANNEL
=
{
'1'
:
12
,
'2'
:
21
}
SET_LED_CHANNEL
=
{
'1'
:
12
,
'2'
:
21
}
led_lights1
=
{}
led_lights1
=
{}
...
@@ -94,16 +95,22 @@ def workinglight():
...
@@ -94,16 +95,22 @@ def workinglight():
if
channel
==
'channel1'
:
if
channel
==
'channel1'
:
if
color
==
'green'
:
if
color
==
'green'
:
pin
=
SET_CHANNEL
[
'greenA'
]
pin
=
SET_CHANNEL
[
'greenA'
]
elif
color
==
'yellow'
:
pin
=
SET_CHANNEL
[
'yellowA'
]
else
:
else
:
pin
=
SET_CHANNEL
[
'redA'
]
pin
=
SET_CHANNEL
[
'redA'
]
else
:
else
:
if
color
==
'green'
:
if
color
==
'green'
:
pin
=
SET_CHANNEL
[
'greenB'
]
pin
=
SET_CHANNEL
[
'greenB'
]
elif
color
==
'yellow'
:
pin
=
SET_CHANNEL
[
'yellowB'
]
else
:
else
:
pin
=
SET_CHANNEL
[
'redB'
]
pin
=
SET_CHANNEL
[
'redB'
]
GPIO
.
setmode
(
GPIO
.
BCM
)
# GPIO.setmode(GPIO.BCM)
GPIO
.
setup
(
pin
,
GPIO
.
OUT
)
# GPIO.setup(pin,GPIO.OUT)
GPIO
.
output
(
pin
,
GPIO
.
HIGH
)
# GPIO.output(pin,GPIO.HIGH)
driver_gpio
.
init
(
pin
)
driver_gpio
.
gpio_high
(
pin
)
msg
=
"通道:{};状态灯{}点亮"
.
format
(
channel
,
color
)
msg
=
"通道:{};状态灯{}点亮"
.
format
(
channel
,
color
)
logging
.
warning
(
msg
)
logging
.
warning
(
msg
)
info
=
[]
info
=
[]
...
@@ -119,16 +126,22 @@ def workingoff():
...
@@ -119,16 +126,22 @@ def workingoff():
if
channel
==
'channel1'
:
if
channel
==
'channel1'
:
if
color
==
'green'
:
if
color
==
'green'
:
pin
=
SET_CHANNEL
[
'greenA'
]
pin
=
SET_CHANNEL
[
'greenA'
]
elif
color
==
'yellow'
:
pin
=
SET_CHANNEL
[
'yellowA'
]
else
:
else
:
pin
=
SET_CHANNEL
[
'redA'
]
pin
=
SET_CHANNEL
[
'redA'
]
else
:
else
:
if
color
==
'green'
:
if
color
==
'green'
:
pin
=
SET_CHANNEL
[
'greenB'
]
pin
=
SET_CHANNEL
[
'greenB'
]
elif
color
==
'yellow'
:
pin
=
SET_CHANNEL
[
'yellowB'
]
else
:
else
:
pin
=
SET_CHANNEL
[
'redB'
]
pin
=
SET_CHANNEL
[
'redB'
]
GPIO
.
setmode
(
GPIO
.
BCM
)
# GPIO.setmode(GPIO.BCM)
GPIO
.
setup
(
pin
,
GPIO
.
OUT
)
# GPIO.setup(pin,GPIO.OUT)
GPIO
.
output
(
pin
,
GPIO
.
LOW
)
# GPIO.output(pin,GPIO.LOW)
driver_gpio
.
init
(
pin
)
driver_gpio
.
gpio_low
(
pin
)
msg
=
"通道:{};状态灯{}关闭"
.
format
(
channel
,
color
)
msg
=
"通道:{};状态灯{}关闭"
.
format
(
channel
,
color
)
logging
.
warning
(
msg
)
logging
.
warning
(
msg
)
info
=
[]
info
=
[]
...
...
smartshelf/app/state/version.txt
查看文件 @
fe927fd
1.1
\ No newline at end of file
\ No newline at end of file
1.2
\ No newline at end of file
\ No newline at end of file
smartshelf/app/templates/ledtest.html
查看文件 @
fe927fd
...
@@ -118,6 +118,7 @@
...
@@ -118,6 +118,7 @@
<div
class=
"col-sm-3"
>
<div
class=
"col-sm-3"
>
<select
id=
'workcolor'
class=
"form-control"
>
<select
id=
'workcolor'
class=
"form-control"
>
<option>
green
</option>
<option>
green
</option>
<option>
yellow
</option>
<option>
red
</option>
<option>
red
</option>
</select>
</select>
</div>
</div>
...
@@ -127,6 +128,27 @@
...
@@ -127,6 +128,27 @@
</div>
<!-- /.col-sm-4 -->
</div>
<!-- /.col-sm-4 -->
</div>
</div>
</div>
</div>
<div
class=
"panel panel-success"
>
<div
class=
"panel-heading"
>
<h3
class=
"panel-title"
>
{{ _('下载库位二维码') }}
</h3>
</div>
<div
class=
"panel-body"
>
<form
action=
"/downqrcode"
method=
"GET"
>
<div
class=
"col-sm-3"
>
<select
name=
"code"
class=
"form-control"
>
{% for optionv in option_list %}
<option>
{{ optionv }}
</option>
{% endfor %}
</select>
</div>
<div
class=
"col-sm-3"
>
<input
type=
"submit"
class=
"btn btn-info"
value=
{{
_
('下载二维码')
}}
>
</div>
<label
for=
"cha11"
class=
"col-sm-4"
>
{{ _('单个二维码尺寸(含白色底框)尺寸为16*16mm,黑码尺寸为10*10mm') }}
</label>
</form>
</div>
</div>
</div>
</div>
<div
class=
"col-md-6"
>
<div
class=
"col-md-6"
>
<h2>
{{ _('运行日志
&
状态信息') }}
</h2>
<h2>
{{ _('运行日志
&
状态信息') }}
</h2>
...
...
smartshelf/app/templates/shelfconfig.html
查看文件 @
fe927fd
...
@@ -142,6 +142,7 @@
...
@@ -142,6 +142,7 @@
<div
class=
"panel-body"
>
<div
class=
"panel-body"
>
<!-- <input type="button" value="软件备份" class="btn btn-info" onclick="backup()"/> -->
<!-- <input type="button" value="软件备份" class="btn btn-info" onclick="backup()"/> -->
<input
type=
"button"
value=
{{
_
('料架升级')
}}
class=
"btn btn-info"
onclick=
"upgrade()"
/>
<input
type=
"button"
value=
{{
_
('料架升级')
}}
class=
"btn btn-info"
onclick=
"upgrade()"
/>
<!-- <input type="button" value={{ _('teamview') }} class="btn btn-info" onclick="openteamview()"/> -->
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -338,6 +339,28 @@
...
@@ -338,6 +339,28 @@
}
}
}
}
function
openteamview
(){
if
(
confirm
(
"确认打开"
))
{
$
.
ajax
({
url
:
"/openteamview"
,
type
:
"post"
,
// data:JSON.stringify(data),
contentType
:
"application/json"
,
dataType
:
'json'
,
success
:
function
(
data
){
$
(
"#operation"
).
html
(
data
.
operation
)
alert
(
data
.
operation
);
},
error
:
function
(
e
){
alert
(
"升级成功,请刷新浏览器"
);
}
})
}
else
{
alert
(
"已取消"
);
}
}
</script>
</script>
<script
src=
"/static/js/jquery.min.js"
></script>
<script
src=
"/static/js/jquery.min.js"
></script>
<script
src=
"/static/js/bootstrap.min.js"
></script>
<script
src=
"/static/js/bootstrap.min.js"
></script>
...
...
smartshelf/app/translations/en/LC_MESSAGES/messages.mo
查看文件 @
fe927fd
此文件类型无法预览
smartshelf/app/translations/en/LC_MESSAGES/messages.po
查看文件 @
fe927fd
...
@@ -7,7 +7,7 @@ msgid ""
...
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-04-
08 16:38
+0800\n"
"POT-Creation-Date: 2021-04-
19 15:19
+0800\n"
"PO-Revision-Date: 2021-04-08 16:25+0800\n"
"PO-Revision-Date: 2021-04-08 16:25+0800\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en\n"
"Language: en\n"
...
@@ -22,171 +22,183 @@ msgstr ""
...
@@ -22,171 +22,183 @@ msgstr ""
msgid "智能料架系统"
msgid "智能料架系统"
msgstr "SmartShelf"
msgstr "SmartShelf"
#: templates/base.html:2
3 templates/ledtest.html:23
#: templates/base.html:2
6 templates/ledtest.html:24
#: templates/shelfconfig.html:
79
#: templates/shelfconfig.html:
80
msgid "亮灯料架"
msgid "亮灯料架"
msgstr "Lighting material rack"
msgstr "Lighting material rack"
#: templates/base.html:
27 templates/ledtest.html:27
#: templates/base.html:
30 templates/ledtest.html:28
#: templates/shelfconfig.html:8
3
#: templates/shelfconfig.html:8
4
msgid "控制"
msgid "控制"
msgstr "Control"
msgstr "Control"
#: templates/base.html:
28 templates/ledtest.html:28
#: templates/base.html:
31 templates/ledtest.html:29
#: templates/shelfconfig.html:8
4
#: templates/shelfconfig.html:8
5
msgid "测试"
msgid "测试"
msgstr "Test"
msgstr "Test"
#: templates/base.html:
29 templates/ledtest.html:29
#: templates/base.html:
32 templates/ledtest.html:30
#: templates/shelfconfig.html:8
5
#: templates/shelfconfig.html:8
6
msgid "料架配置"
msgid "料架配置"
msgstr "Material rack configuration"
msgstr "Material rack configuration"
#: templates/base.html:
45 templates/ledtest.html:45
#: templates/base.html:
58 templates/ledtest.html:46
#: templates/shelfconfig.html:10
1
#: templates/shelfconfig.html:10
2
msgid "料架系统"
msgid "料架系统"
msgstr "Material rack system"
msgstr "Material rack system"
#: templates/base.html:
50
#: templates/base.html:
63
msgid "开关"
msgid "开关"
msgstr "switch"
msgstr "switch"
#: templates/base.html:
53
#: templates/base.html:
66
msgid "启动"
msgid "启动"
msgstr "Start"
msgstr "Start"
#: templates/base.html:
54
#: templates/base.html:
67
msgid "停止"
msgid "停止"
msgstr "Stop"
msgstr "Stop"
#: templates/base.html:
62 templates/ledtest.html:137
#: templates/base.html:
75 templates/ledtest.html:159
#: templates/shelfconfig.html:15
4
#: templates/shelfconfig.html:15
5
msgid "提醒消息"
msgid "提醒消息"
msgstr "Reminder message"
msgstr "Reminder message"
#: templates/base.html:
67 templates/ledtest.html:142
#: templates/base.html:
80 templates/ledtest.html:164
#: templates/shelfconfig.html:1
59
#: templates/shelfconfig.html:1
60
msgid "运行状态"
msgid "运行状态"
msgstr "Running status"
msgstr "Running status"
#: templates/base.html:
72 templates/ledtest.html:152
#: templates/base.html:
85 templates/ledtest.html:174
#: templates/shelfconfig.html:16
4
#: templates/shelfconfig.html:16
5
msgid "配置文件加载状态"
msgid "配置文件加载状态"
msgstr "Configuration file loading status"
msgstr "Configuration file loading status"
#: templates/base.html:
77 templates/shelfconfig.html:124
#: templates/base.html:
90 templates/shelfconfig.html:125
#: templates/shelfconfig.html:1
69
#: templates/shelfconfig.html:1
70
msgid "服务器地址"
msgid "服务器地址"
msgstr "Server address"
msgstr "Server address"
#: templates/base.html:
82 templates/shelfconfig.html:130
#: templates/base.html:
95 templates/shelfconfig.html:131
#: templates/shelfconfig.html:17
4
#: templates/shelfconfig.html:17
5
msgid "料架编号"
msgid "料架编号"
msgstr "Material rack number"
msgstr "Material rack number"
#: templates/base.html:
87
#: templates/base.html:
100
msgid "服务器连接状态"
msgid "服务器连接状态"
msgstr "Server connection status"
msgstr "Server connection status"
#: templates/base.html:
96 templates/ledtest.html:131
#: templates/base.html:
109 templates/ledtest.html:153
#: templates/shelfconfig.html:14
8
#: templates/shelfconfig.html:14
9
msgid "运行日志&状态信息"
msgid "运行日志&状态信息"
msgstr "Run log & status information"
msgstr "Run log & status information"
#: templates/base.html:1
01
#: templates/base.html:1
14
msgid "日志下载"
msgid "日志下载"
msgstr "Log"
msgstr "Log"
#: templates/base.html:1
04
#: templates/base.html:1
17
msgid "下载日志"
msgid "下载日志"
msgstr "download log"
msgstr "download log"
#: templates/base.html:1
11
#: templates/base.html:1
24
msgid "日志"
msgid "日志"
msgstr "running log"
msgstr "running log"
#: templates/ledtest.html:5
0
#: templates/ledtest.html:5
1
msgid "灯条测试"
msgid "灯条测试"
msgstr "Light bar test"
msgstr "Light bar test"
#: templates/ledtest.html:5
3 templates/ledtest.html:109
#: templates/ledtest.html:5
4 templates/ledtest.html:110
msgid "通道"
msgid "通道"
msgstr "channel"
msgstr "channel"
#: templates/ledtest.html:6
0 templates/ledtest.html:88
#: templates/ledtest.html:6
1 templates/ledtest.html:89
#: templates/ledtest.html:11
6
#: templates/ledtest.html:11
7
msgid "颜色"
msgid "颜色"
msgstr "color"
msgstr "color"
#: templates/ledtest.html:7
0
#: templates/ledtest.html:7
1
msgid "灯条全开"
msgid "灯条全开"
msgstr "light"
msgstr "light"
#: templates/ledtest.html:7
1
#: templates/ledtest.html:7
2
msgid "灯条关闭"
msgid "灯条关闭"
msgstr "off"
msgstr "off"
#: templates/ledtest.html:7
7
#: templates/ledtest.html:7
8
msgid "库位操作测试"
msgid "库位操作测试"
msgstr "Location operation test"
msgstr "Location operation test"
#: templates/ledtest.html:8
0
#: templates/ledtest.html:8
1
msgid "库位"
msgid "库位"
msgstr "Location"
msgstr "Location"
#: templates/ledtest.html:9
8 templates/ledtest.html:124
#: templates/ledtest.html:9
9 templates/ledtest.html:125
msgid "亮灯"
msgid "亮灯"
msgstr "light"
msgstr "light"
#: templates/ledtest.html:
99 templates/ledtest.html:125
#: templates/ledtest.html:
100 templates/ledtest.html:126
msgid "灭灯"
msgid "灭灯"
msgstr "off"
msgstr "off"
#: templates/ledtest.html:10
0
#: templates/ledtest.html:10
1
msgid "重置"
msgid "重置"
msgstr "reset"
msgstr "reset"
#: templates/ledtest.html:10
6
#: templates/ledtest.html:10
7
msgid "状态灯测试"
msgid "状态灯测试"
msgstr "Status light test"
msgstr "Status light test"
#: templates/ledtest.html:133
msgid "下载库位二维码"
msgstr "download location QR code"
#: templates/ledtest.html:145
msgid "下载二维码"
msgstr "download"
#: templates/ledtest.html:147
#: templates/ledtest.html:147
msgid "单个二维码尺寸(含白色底框)尺寸为16*16mm,黑码尺寸为10*10mm"
msgstr "Single QR code size(including white bottom frame) size is 16*16mm,black code size is 10*10mm"
#: templates/ledtest.html:169
msgid "测试消息"
msgid "测试消息"
msgstr "test message"
msgstr "test message"
#: templates/shelfconfig.html:10
6
#: templates/shelfconfig.html:10
7
msgid "配置文件"
msgid "配置文件"
msgstr "config file"
msgstr "config file"
#: templates/shelfconfig.html:11
0
#: templates/shelfconfig.html:11
1
msgid "选择文件"
msgid "选择文件"
msgstr "Select file"
msgstr "Select file"
#: templates/shelfconfig.html:11
3
#: templates/shelfconfig.html:11
4
msgid "上传"
msgid "上传"
msgstr "Upload"
msgstr "Upload"
#: templates/shelfconfig.html:1
19
#: templates/shelfconfig.html:1
20
msgid "服务器配置"
msgid "服务器配置"
msgstr "server configuration"
msgstr "server configuration"
#: templates/shelfconfig.html:13
4
#: templates/shelfconfig.html:13
5
msgid "保存"
msgid "保存"
msgstr "save"
msgstr "save"
#: templates/shelfconfig.html:1
39
#: templates/shelfconfig.html:1
40
msgid "控制器备份&升级"
msgid "控制器备份&升级"
msgstr "Controller backup & upgrade"
msgstr "Controller backup & upgrade"
#: templates/shelfconfig.html:14
3
#: templates/shelfconfig.html:14
4
msgid "料架升级"
msgid "料架升级"
msgstr "software upgrade"
msgstr "software upgrade"
#: templates/shelfconfig.html:1
79
#: templates/shelfconfig.html:1
80
msgid "操作提醒"
msgid "操作提醒"
msgstr "Operation reminder"
msgstr "Operation reminder"
#: templates/shelfconfig.html:18
4
#: templates/shelfconfig.html:18
5
msgid "软件版本"
msgid "软件版本"
msgstr "Software version"
msgstr "Software version"
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论