实现方案导入导出,根据选项自动生成文件名
This commit is contained in:
76
web/layui/plugin/EWScanUID.js
Normal file
76
web/layui/plugin/EWScanUID.js
Normal file
@@ -0,0 +1,76 @@
|
||||
async function EWScanUID()
|
||||
{
|
||||
ShowCommMes("自动扫描脚本本加载",MesgType.MESG_TYPE_INFO);
|
||||
fac_bind_init_flag =1;
|
||||
var content_str = '<div class="layui-row" style="line-height: 1.8rem; padding-top: 2px;">';
|
||||
|
||||
content_str += '<div class="layui-col-xs2">'
|
||||
content_str += '<button type="button" class="layui-btn layui-btn-normal plugin_bind_test" style="height: 1.8rem; line-height: 1.8rem;width: 90%;" onclick="Ew_StartScanUid()">扫描</button>';
|
||||
content_str += '</div>'
|
||||
content_str += '<div class="layui-col-xs2 ">';
|
||||
content_str += '<div class="grid-demo grid-demo-bg1" style="margin-left: 3px;text-align: center;border-radius: 2px; background-color: #eee;" >分配因子</div> </div>';
|
||||
|
||||
content_str += '<div class="layui-col-xs2">';
|
||||
content_str += '<div class="grid-demo grid-demo-bg1" style="margin:0 4px ;text-align: center;border-radius: 2px;" >';
|
||||
content_str += '<input type="text" value="" class="layui-input ewscan_auto_fac" style="height: 1.8rem; line-height: 1.8rem; padding-left:0px; text-align:left;">';
|
||||
content_str += '</div></div>';
|
||||
|
||||
content_str += '<div class="layui-col-xs2 ">';
|
||||
content_str += '<div class="grid-demo grid-demo-bg1" style="margin-left: 3px;text-align: center;border-radius: 2px; background-color: #eee;" >最大地址</div> </div>';
|
||||
|
||||
content_str += '<div class="layui-col-xs2">';
|
||||
content_str += '<div class="grid-demo grid-demo-bg1" style="margin:0 4px ;text-align: center;border-radius: 2px;" >';
|
||||
content_str += '<input type="text" value="" class="layui-input ewscan_auto_maxaddr" style="height: 1.8rem; line-height: 1.8rem; padding-left:0px; text-align:left;">';
|
||||
content_str += '</div></div>';
|
||||
|
||||
content_str += '</div>'
|
||||
$("#Oper_View").append(content_str);
|
||||
}
|
||||
|
||||
async function Ew_StartScanUid()
|
||||
{
|
||||
var scan_uid_rtv = [];
|
||||
var max_addr = parseInt($(".ewscan_auto_maxaddr").val(),10);
|
||||
var auto_fac = parseInt($(".ewscan_auto_fac").val(),10);
|
||||
ShowCommMes("启动搜索 最大个数 "+max_addr +" 随机值 "+ auto_fac ,MesgType.MESG_TYPE_INFO);
|
||||
epro2_oper.cmd = 35;
|
||||
await Ep2_autoSetAddr(max_addr,auto_fac);
|
||||
await TransSleep(200);
|
||||
epro2_oper.cmd = 9;
|
||||
epro2_oper.cycle_bgaddr = 21;
|
||||
epro2_oper.cycle_endaddr = max_addr+21;
|
||||
epro2_oper.cycle_group_count = 100;
|
||||
epro2_oper.sys_states ="80 00";
|
||||
Ep2_Inspect_OK = [];
|
||||
await Ep2_Inspect_Task(0);
|
||||
if(Ep2_Inspect_OK.length == 0)
|
||||
{
|
||||
ShowCommMes("搜索结束。。。。。。。。",MesgType.MESG_TYPE_INFO);
|
||||
return ;
|
||||
}
|
||||
await TransSleep(2000);
|
||||
var rtv = 0;
|
||||
for(var i = 0; i < Ep2_Inspect_OK.length; i++)
|
||||
{
|
||||
epro2_oper.cmd = 19;
|
||||
epro2_oper.commaddr = Ep2_Inspect_OK[i];
|
||||
rtv = await Ep2_ReadUID();
|
||||
if(rtv != 0)
|
||||
{
|
||||
await TransSleep(50);
|
||||
continue;
|
||||
|
||||
}
|
||||
scan_uid_rtv[scan_uid_rtv.length] = epro2_oper.uid;
|
||||
epro2_oper.cmd = 100;
|
||||
await Ep2_UpdateAddr(max_addr+50);
|
||||
await TransSleep(50);
|
||||
}
|
||||
for(var i = 0; i < scan_uid_rtv.length; i++)
|
||||
{
|
||||
ShowCommMes("UID: "+ scan_uid_rtv[i],MesgType.MESG_TYPE_INFO);
|
||||
}
|
||||
ShowCommMes("成功搜索 "+scan_uid_rtv.length+" 个UID",MesgType.MESG_TYPE_INFO);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user