induction_admin.html
16.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<title>{{ _('感应式料架系统') }}-Admin</title>
<link rel="icon" href="/static/favicon.ico">
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
</head>
<body style="font-size:18px;">
{% set index=4 %}
{% import 'head.html' as head with context%}
{{ head }}
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
<h2>{{ _('料架系统') }}</h2>
<hr class="divider">
<!-- 灯条测试 -->
<div class="panel panel-warning">
<div class="panel-heading">
<h3 class="panel-title">{{ _('手动阈值') }}</h3>
</div>
<div class="panel-body">
<label for="pa" class="col-sm-2">{{ _('地址编号') }}</label>
<div class="col-sm-3">
<input id="params" style="width: 80%;">
</div>
<div class="col-sm-5">
<input type="button" value="{{ _('设置阈值') }}" class="btn btn-warning"
onclick="hancalibrate()" />
<input type="button" value="{{ _('获取阈值') }}" class="btn btn-warning"
onclick="getcalibrate()" />
</div>
</div>
</div>
<!-- step send -->
<div class="panel panel-warning">
<div class="panel-heading">
<h3 class="panel-title">{{ _('随机亮灯') }}</h3>
</div>
<div class="panel-body">
<div class="col-sm-4">
<input type="button" value="{{ _('发送') }}" class="btn btn-warning" onclick="randomtest()" />
</div>
</div>
</div>
<!-- auto -->
<div class="panel panel-warning">
<div class="panel-heading">
<h3 class="panel-title">{{ _('标定') }}</h3>
</div>
<div class="panel-body">
<label for="a1" class="col-sm-2">{{ _('地址编号') }}</label>
<div class="col-sm-3">
<select id='addr' class="form-control">
<option>A1</option>
<option>A2</option>
<option>A3</option>
<option>A4</option>
<option>A5</option>
<option>A6</option>
<option>A7</option>
<option>A8</option>
<option>A9</option>
<option>B1</option>
<option>B2</option>
<option>B3</option>
<option>B4</option>
<option>B5</option>
<option>B6</option>
<option>B7</option>
<option>B8</option>
<option>B9</option>
<option>99</option>
</select>
</div>
<label for="a2" class="col-sm-2">{{ _('参数') }}</label>
<div class="col-sm-3">
<select id='calibrate' class="form-control">
<option>autotrain</option>
<option>max</option>
<option>min</option>
</select>
</div>
<!-- <label for="io" class="col-sm-1">地址编号</label> -->
<div class="col-sm-4">
<input type="button" value="{{ _('自动标定') }}" class="btn btn-warning"
onclick="auto_calibrate()" />
</div><!-- /.col-sm-4 -->
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">{{ _('地址检测') }}</h3>
</div>
<div class="panel-body">
<!-- <label for="a3" class="col-sm-1">地址检测</label> -->
<div class="col-sm-2">
<input type="button" value="{{ _('亮灯检测') }}" class="btn btn-warning"
onclick="adminled_test()" />
</div>
<div class="col-sm-2">
<input type="button" value="Site Report" class="btn btn-warning" onclick="Site_Report()" />
</div>
<div class="col-sm-2">
<input type="button" value="{{ _('传感器地址') }}" class="btn btn-warning"
onclick="adminaddr_test()" />
</div>
<div class="col-sm-2">
<input type="button" value="{{ _('重建库位') }}" class="btn btn-warning"
onclick="buildstore()" />
</div>
<div class="col-sm-2">
<input type="button" value="{{ _('重启控制器') }}" class="btn btn-warning"
onclick="restart()" />
</div>
<div class="col-sm-2">
<input type="button" value="{{ _('下载库位表') }}" class="btn btn-warning"
onclick="location.href='/downloadstore'" />
</div>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">{{ _('串口调试') }}</h3>
</div>
<div class="panel-body">
<!-- <label for="a3" class="col-sm-1">地址检测</label> -->
<div class="col-sm-12">
<select class="form-control" onchange="$('#command').val(this.value)" style="width:300px">
<option>快捷指令</option>
<option>report</option>
<option>A1</option>
<option>{"ADDR":"1","action":"info"}</option>
<option>{"ADDR":"1","action":"PrintStatus"}</option>
<option>{"ADDR":"99","action":"diagnosMode"}</option>
</select>
</div>
<div class="col-sm-12">
<input type="text" id="command" class="form-control" style="width:300px;float: left;margin: 5px;"/>
<input type="button" value="{{ _('发送') }}" class="btn btn-warning" onclick="command_test()" style="float: left;;margin: 5px"/>
<input type="checkbox" id="autoclear" class="form-control checkbox" value="123" style="height: 20px;width:20px;float: left;margin: 5px" />自动清除历史数据
</div>
<div class="col-sm-12"></div>
<!-- <label for="a4" class="col-sm-1">阈值</label>
<div class="col-sm-3">
<input id="threshold">
</div> -->
<div class="col-sm-12">
<textarea type="text" id="commandrecv" style="width: 90%;height: 300px;"></textarea>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var x;
$(document).ready(function () {
return;
x = setInterval(function () {
$.ajax({
url: "/readserial",
type: "get",
//data: JSON.stringify(ionum),
contentType: "application/json",
dataType: 'json',
success: function (data) {
// $("#testinfo").html(data.msg)
console.log(data.msg);
$("#commandrecv").val($("#commandrecv").val() + data.msg);
},
error: function (e) {
//alert("error");
}
})
}, 2000);
});
// 设置阈值
function hancalibrate() {
if (confirm("{{ _('请谨慎操作') }}")) {
var ionum = document.getElementById("params").value
// console.log(data)
$.ajax({
url: "/hancalibrate",
type: "post",
data: JSON.stringify(ionum),
contentType: "application/json",
dataType: 'json',
success: function (data) {
// $("#testinfo").html(data.msg)
alert(data.msg);
},
error: function (e) {
alert("error");
}
})
}
}
// step send
function randomtest() {
// var ionum = document.getElementById("io").value
// console.log(data)
$.ajax({
url: "/randomtest",
type: "post",
// data:JSON.stringify(ionum),
contentType: "application/json",
dataType: 'json',
success: function (data) {
// $("#testinfo").html(data.msg)
alert(data.msg);
},
error: function (e) {
alert("error");
}
})
}
// auto_calibrate
function auto_calibrate() {
if (confirm("{{ _('请谨慎操作') }}")) {
var addrs = document.getElementById("addr").value;
addrs = addrs.replace('B', 'A1');
addrs = addrs.replace('A', '');
var data = {
"addr": addrs,
"calibrate": document.getElementById("calibrate").value
}
$.ajax({
url: "/auto_calibrate",
type: "post",
data: JSON.stringify(data),
contentType: "application/json",
dataType: 'json',
success: function (data) {
// $("#testinfo").html(data.msg)
alert(data.msg);
},
error: function (e) {
alert("error");
}
})
}
}
// 获取阈值
function getcalibrate() {
if (confirm("{{ _('请谨慎操作') }}")) {
var ionum = document.getElementById("params").value
// console.log(data)
$.ajax({
url: "/getcalibrate",
type: "post",
data: JSON.stringify(ionum),
contentType: "application/json",
dataType: 'json',
success: function (data) {
// $("#testinfo").html(data.msg)
alert(data.msg);
},
error: function (e) {
alert("error");
}
})
}
}
// thre
function adminaddr_test() {
if (confirm("{{ _('请谨慎操作') }}")) {
$.ajax({
url: "/adminaddr_test",
type: "post",
// data:JSON.stringify(data),
contentType: "application/json",
dataType: 'json',
success: function (data) {
// $("#testinfo").html(data.msg)
alert(data.msg);
},
error: function (e) {
alert("error");
}
})
}
}
function Site_Report() {
$.ajax({
url: "/sitereport",
type: "post",
// data:JSON.stringify(data),
contentType: "application/json",
dataType: 'json',
success: function (data) {
// $("#testinfo").html(data.msg)
alert(data.msg);
},
error: function (e) {
alert("error");
}
})
}
function buildstore() {
if (confirm("{{ _('请谨慎操作') }}")) {
$.ajax({
url: "/buildstore",
type: "post",
// data:JSON.stringify(data),
contentType: "application/json",
dataType: 'json',
success: function (data) {
// $("#testinfo").html(data.msg)
alert(data.msg);
},
error: function (e) {
alert("error");
}
})
}
}
function restart() {
if (confirm("{{ _('请谨慎操作') }}")) {
$.ajax({
url: "/restart",
type: "post",
// data:JSON.stringify(data),
contentType: "application/json",
dataType: 'json',
success: function (data) {
// $("#testinfo").html(data.msg)
alert(data.msg);
},
error: function (e) {
alert("error");
}
})
}
}
function command_test() {
var data = {
"command": document.getElementById("command").value
}
if ($("#autoclear")[0].checked){
$("#commandrecv").val("");
}
$.ajax({
url: "/writeserial",
type: "post",
data: JSON.stringify(data),
contentType: "application/json",
dataType: 'json',
success: function (data) {
// $("#testinfo").html(data.msg)
$("#commandrecv").val($("#commandrecv").val() + data.msg.replace(/\/\//g, "\r\n"));
},
error: function (e) {
alert("error");
}
})
}
function adminled_test() {
if (confirm("{{ _('请谨慎操作') }}")) {
$.ajax({
url: "/adminled_test",
type: "post",
// data:JSON.stringify(data),
contentType: "application/json",
dataType: 'json',
success: function (data) {
// $("#testinfo").html(data.msg)
alert(data.msg);
},
error: function (e) {
alert("error");
}
})
}
}
</script>
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
</body>
</html>