起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 20833|回复: 26

[结贴] 中控ID100二代身份证读卡器信息SDK如何接口到BEX5的员工档案

  [复制链接]

21

主题

116

帖子

426

积分

中级会员

Rank: 3Rank: 3

积分
426
QQ
发表于 2017-6-23 11:06:35 | 显示全部楼层 |阅读模式
版本: 其它(帖子中说明) 小版本号:
数据库: MS SQLServer 服务器操作系统: Windows 应用服务器: Tomcat
客户端操作系统: 其它(帖子中说明) 浏览器: Chrome
您好!
WIN10下BEX5V3.7PRE 里 ,我想在自制的员工信息表中用中控ID100二代身份证读卡器读取相应的字段。先存入MSSQL的表中,然后引用到JS页面中,如何操作?是否有朋友实践过类似案例?能分享下吗?相关SDK见附件!
QQ图片20170623110142.png

IDCardReader SDK2.0.chm

117.7 KB, 下载次数: 455

91

主题

13万

帖子

3万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
35920
发表于 2017-6-23 11:42:41 | 显示全部楼层
html页面中怎么用的在.w中就是同样的,引用js的时候可以参考
http://doc.wex5.com/?p=4222
远程的联系方法QQ1392416607,添加好友时,需在备注里注明其论坛名字及ID,公司等信息
发远程时同时也发一下帖子地址,方便了解要解决的问题  WeX5教程  WeX5下载



如按照该方法解决,请及时跟帖,便于版主结贴
回复 支持 反对

使用道具 举报

21

主题

116

帖子

426

积分

中级会员

Rank: 3Rank: 3

积分
426
QQ
 楼主| 发表于 2017-6-27 09:33:11 | 显示全部楼层
请问,我想在页面的button的onclick事件中单独调取
  1.         Device.prototype.startFun = function()
  2.         {
  3.                 //创建设备
  4.                 var device = new Device();
  5.                 var myDevice = device.createDevice("Cert");
  6.                 //显示提示信息
  7.                 myDevice.setMessage();
  8.                 setting.Methods.checkWebServer(myDevice);
  9.         };
复制代码


我该怎么写这段。另外,我是参考http://doc.wex5.com/?p=4222  来引用外部JS的,如
  1.         var $ = require("jquery");
  2.         var justep = require("$UI/system/lib/justep");
  3.         var baseISSOnline = require("./baseISSOnline");
  4.         var baseISSObject = require("./baseISSObject");
  5.         var jquery = require("./jquery-1.4.2.min");
  6.         var common = require("./common");
复制代码

那请问:

  1.         Model.prototype.button7Click = function(event){
  2.                  
  3.                        
  4.         };
复制代码

这个我应该怎么写?有没的范例可学习的?

外部JS如下代码:
  1. var Device = function()
  2. {
  3.         message : ""
  4. };
  5. function createISSonlineDevice(setting)
  6. {
  7.         var ISSOnline = "ZKIDROnline";
  8.         var browserFlag = getBrowserType() || "";
  9.         //刷卡信息返回默认方法
  10.         if(typeof setting.Methods == "object")
  11.         {
  12.                 if(typeof setting.Methods.showMessage != "function")
  13.                 {
  14.                         setting.Methods.showMessage = function(type,message)
  15.                         {
  16.                                 $("#cert_message").text(message);
  17.                                 $("#cert_message_type").text(msgType[type]);
  18.                         }
  19.                 }
  20.                 //检查驱动安装默认方法
  21.                 if(typeof setting.Methods.checkWebServer != "function")
  22.                 {
  23.                         setting.Methods.checkWebServer = function(myDevice)
  24.                         {
  25.                                 var ISSVersion = function(){};
  26.                                 ZK.extend(ISSVersion, Device, {
  27.                                         message : "",
  28.                                         url : "/info",
  29.                                         interfaceResult :
  30.                                         {
  31.                                                 0:{mean:"成功",message:"二代身份证读取成功!",type:"success",notShow:true}
  32.                                         },
  33.                                         dealDeviceData:function(result){
  34.                                                 var existVersion = result.data.server_version;//2.7.1
  35.                                                 var curVersion = "${application['fpDriver.version']}";//3.5.2
  36.                                                 var existVersionArr = existVersion.split(".");
  37.                                                 var curVersionArr = curVersion.split(".");
  38.                                                 var isLast = true;
  39.                                                 var len = existVersionArr.length;
  40.                                                 for(var i=len;i>0;i--)
  41.                                                 {
  42.                                                         var existVersionTemp = parseInt(existVersionArr[i-1]);
  43.                                                         var curVersionTemp = parseInt(curVersionArr[i-1]);
  44.                                                         if(existVersionTemp<curVersionTemp)
  45.                                                         {
  46.                                                                 isLast = false;
  47.                                                         }
  48.                                                         else if(existVersionTemp>curVersionTemp)
  49.                                                         {
  50.                                                                 isLast = true;
  51.                                                         }
  52.                                                         else
  53.                                                         {
  54.                                                                                                         }
  55.                                                 }
  56.                                                  
  57.                                                 //if(result.data.server_version >= "${application['fpDriver.version']}")
  58.                                                 if(isLast)
  59.                                                 {
  60.                                                         if(typeof setting.Methods.detectSuccess == "function")
  61.                                                         {
  62.                                                                 setting.Methods.detectSuccess();
  63.                                                         }
  64.                                                         if(typeof myDevice == "object")
  65.                                                         {
  66.                                                                 //连接设备,处理返回信息
  67.                                                                 setTimeout(function(){
  68.                                                                         myDevice.accessDevice();
  69.                                                                 },100);
  70.                                                         }
  71.                                                 }
  72.                                                 else
  73.                                                 {
  74.                                                         if(typeof setting.Methods.detectWarning == "function")
  75.                                                         {
  76.                                                                 setting.Methods.detectWarning();
  77.                                                         }
  78.                                                         if(typeof myDevice == "object")
  79.                                                         {
  80.                                                                 //连接设备,处理返回信息
  81.                                                                 setTimeout(function(){
  82.                                                                         myDevice.accessDevice();
  83.                                                                 },100);
  84.                                                         }
  85.                                                         else
  86.                                                         {
  87.                                                                 if(typeof setting.Methods.notInstall == "function")
  88.                                                                 {
  89.                                                                         setting.Methods.notInstall();
  90.                                                                 }
  91.                                                         }
  92.                                                 }
  93.                                         },
  94.                                         installDrive:function(){
  95.                                                 if(typeof setting.Methods.detectError == "function")
  96.                                                 {
  97.                                                         setting.Methods.detectError();
  98.                                                 }
  99.                                                 if(typeof myDevice == "object")
  100.                                                 {
  101.                                                         closeMessage();
  102.                                                         //驱动未安装
  103.                                                         setting.Methods.downloadDrive();
  104.                                                 }
  105.                                                 else
  106.                                                 {
  107.                                                         if(typeof setting.Methods.notInstall == "function")
  108.                                                         {
  109.                                                                 setting.Methods.notInstall();
  110.                                                         }
  111.                                                 }
  112.                                                
  113.                                                 return false;
  114.                                         }
  115.                                 });
  116.                                  
  117.                                 var version = new ISSVersion();
  118.                                 version.accessDevice();
  119.                         }
  120.                 }
  121.                 //下载驱动默认方法
  122.                 if(typeof setting.Methods.downloadDrive != "function")
  123.                 {
  124.                         setting.Methods.downloadDrive = function()
  125.                         {
  126.                                 messageBox({messageType: "confirm", text: "请安装相关硬件驱动!点击确定下载驱动。",
  127.                                 callback: function(result){
  128.                                                 if(result)
  129.                                                 {
  130.                                                         window.location.href = "middleware/ZKIDROnline.exe";
  131.                                                 }
  132.                                                 closeMessage();
  133.                                 }});
  134.                         }
  135.                 }
  136.         }
  137.         /**
  138.          * 设备
  139.          */
  140.        
  141.         var buttonNames = {"Cert":"","Scanner":"","Barcode":""};
  142.         if(typeof setting.Cert == "object")
  143.         {
  144.                 buttonNames.Cert = setting.Cert.select;
  145.                 //身份证阅读器
  146.                 var Cert = function(){};
  147.                 ZK.extend(Cert, Device, {
  148.                         //提示信息
  149.                         message : "请将二代身份证放到读卡区域...",
  150.                         //服务url
  151.                         url : "/ScanReadIdCardInfo?OP-DEV=1&CMD-URL=4&common=1" + "&random=" + getRandomNum(),
  152.                         //接口返回值
  153.                         interfaceResult :
  154.                         {
  155.                                 0:{mean:"成功",message:"二代身份证读取成功!",type:"success"},
  156.                                 1:{mean:"端口打开失败",message:"未检测到二代身份证阅读器!",type:"warning"},
  157.                                 2:{mean:"数据传输超时",message:"未检测到二代身份证阅读器!",type:"error"},
  158.                                 10:{mean:"没有找到卡",message:"未读取到身份证,请重新刷卡!",type:"warning"},
  159.                                 11:{mean:"读卡操作失败",message:"未检测到二代身份证阅读器!",type:"error"},
  160.                                 20:{mean:"自检失败",message:"二代身份证读取失败!",type:"error"},
  161.                                 30:{mean:"其他错误",message:"二代身份证读取失败!",type:"error"},
  162.                                 40:{mean:"相片解码失败",message:"二代身份证读取失败!",type:"error"},
  163.                                 100:{mean:"超时",message:"未读取到身份证,请重新刷卡!",type:"warning"},
  164.                                 200:{mean:"GetBase64PhotoData",message:"二代身份证读取失败!",type:"error"}
  165.                         },
  166.                         dealDeviceData:setting.Cert.callBack
  167.                 });
  168.         }
  169.        
  170.         //工厂
  171.         var DeviceFactory =
  172.         {
  173.                 createDevice : function(button){
  174.                         var device;
  175.                         switch(button){
  176.                                 case "Cert":
  177.                                         device = new Cert();
  178.                                         break;
  179.                                 case "Scanner":
  180.                                         device = new Scanner();
  181.                                         break;
  182.                                 case "Barcode":
  183.                                 default:
  184.                                         device = new BarcodeScanner();
  185.                                         break;
  186.                         }
  187.                         return device;
  188.                 }
  189.         }
  190.        
  191.         //设备通信,得到硬件返回的数据
  192.         Device.prototype.accessDevice = function()
  193.         {
  194.                 $("#iss").css("width","25%");
  195.                 if(browserFlag == "html5"||browserFlag == "simple")
  196.                 {
  197.                         this.ajaxAccess(this.url);
  198.                 }
  199.                 else if(browserFlag == "simple")
  200.                 {
  201.                         this.xDomainAccess(this.url);
  202.                 }
  203.                 else
  204.                 {
  205.                         if(window.console)
  206.                         {
  207.                                 console.error("browserFlag is missing");
  208.                         }
  209.                 }
  210.         };
  211.        
  212.         Device.prototype.startFun = function()
  213.         {
  214.                 //创建设备
  215.                 var device = new Device();
  216.                 var myDevice = device.createDevice("Cert");
  217.                 //显示提示信息
  218.                 myDevice.setMessage();
  219.                 setting.Methods.checkWebServer(myDevice);
  220.         };
  221.         /*
  222.         $.each(buttonNames, function(key, value){
  223.                 if(value)
  224.                 {
  225.                         $(document).off("click",value);
  226.                         $(document).on("click",value,function(e){
  227.                                 $(value).blur();
  228.                                 //创建设备
  229.                                 var device = new Device();
  230.                                 var myDevice = device.createDevice(key);
  231.                                 //显示提示信息
  232.                                 myDevice.setMessage();
  233.                                 setting.Methods.checkWebServer(myDevice);
  234.                         });
  235.                 }
  236.                
  237.         });
  238. */
  239.         setting.Methods.checkWebServer();
  240. }
复制代码
回复 支持 反对

使用道具 举报

21

主题

116

帖子

426

积分

中级会员

Rank: 3Rank: 3

积分
426
QQ
 楼主| 发表于 2017-6-27 09:37:57 | 显示全部楼层
补充说明下,就是想调用外部JS中其中一个方法。
回复 支持 反对

使用道具 举报

91

主题

13万

帖子

3万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
35920
发表于 2017-6-27 10:58:28 | 显示全部楼层
引用了js文件中直接调用里面的方法就可以啊
远程的联系方法QQ1392416607,添加好友时,需在备注里注明其论坛名字及ID,公司等信息
发远程时同时也发一下帖子地址,方便了解要解决的问题  WeX5教程  WeX5下载



如按照该方法解决,请及时跟帖,便于版主结贴
回复 支持 反对

使用道具 举报

21

主题

116

帖子

426

积分

中级会员

Rank: 3Rank: 3

积分
426
QQ
 楼主| 发表于 2017-6-27 11:27:48 | 显示全部楼层
这句应该怎么写?
baseISSOnline.startFun() 【提示startFun   undefined】 还是
baseISSOnline.Device.prototype.startFun  【提示Device  undefined】?
回复 支持 反对

使用道具 举报

91

主题

13万

帖子

3万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
35920
发表于 2017-6-27 11:43:18 | 显示全部楼层
require("./baseISSOnline");引用正确吗?
远程的联系方法QQ1392416607,添加好友时,需在备注里注明其论坛名字及ID,公司等信息
发远程时同时也发一下帖子地址,方便了解要解决的问题  WeX5教程  WeX5下载



如按照该方法解决,请及时跟帖,便于版主结贴
回复 支持 反对

使用道具 举报

21

主题

116

帖子

426

积分

中级会员

Rank: 3Rank: 3

积分
426
QQ
 楼主| 发表于 2017-6-27 11:46:39 | 显示全部楼层
        var baseISSOnline = require("$UI/DEMOERP/HR/process/HR_EP_Employee/baseISSOnline");

我换了还是报这个undefined
回复 支持 反对

使用道具 举报

91

主题

13万

帖子

3万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
35920
发表于 2017-6-27 13:17:26 | 显示全部楼层
3l楼发的是这个js文件的内容?
不符合模块化的,引用后直接调用方法就可以
js.png
远程的联系方法QQ1392416607,添加好友时,需在备注里注明其论坛名字及ID,公司等信息
发远程时同时也发一下帖子地址,方便了解要解决的问题  WeX5教程  WeX5下载



如按照该方法解决,请及时跟帖,便于版主结贴
回复 支持 反对

使用道具 举报

21

主题

116

帖子

426

积分

中级会员

Rank: 3Rank: 3

积分
426
QQ
 楼主| 发表于 2017-6-27 19:20:45 | 显示全部楼层
你好!我参照您提供的方法,修改了引用非规范AMD的JS文件。现在不报错。问题来了。扫描的值传不过来。
$("#fName")这个写法是什么意思?
下面是接收值
  1. function setCertificateData(result)
  2. {
  3.         $("#fName").val(result.Certificate.Name);}
复制代码

下面是接口返回的值JSON格式
  1. {
  2.     "ret":0,
  3.     "Certificate":
  4.     {
  5.         "Name": "", //姓名
  6.         "Sex": "",  //性别
  7.         "Nation": "",   //民族
  8.         "Birthday": "", //出生日期
  9.         "Address": "",  //常住地址
  10.         "IDNumber": "", //身份证号
  11.         "IDIssued": "", //签发机关
  12.         "IssuedData": "",   //签发日期
  13.         "ValidDate": "",    //有效期截止日期
  14.         "Other": "(null)",        //
  15.         "CardNumber": "(null)",   //
  16.         "PhotoName": "(null)",   
  17.         "Base64Photo": "base64照片",  //Base64照片
  18.         "ImageName": "(null)",
  19.         "Base64Image": "(null)",
  20.         "fp_feature1":"Base64 String", //第一个登记手指指纹特征
  21.         "fp_feature2":"Base64 String"  //第二个登记手指指纹特征
  22. }
复制代码
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2024-5-5 00:05 , Processed in 0.109957 second(s), 28 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表