Index: ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp
===================================================================
diff -u -r34219 -r34390
--- ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp (.../awaitForRecycleList.jsp) (revision 34219)
+++ ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp (.../awaitForRecycleList.jsp) (revision 34390)
@@ -294,6 +294,14 @@
height: 733px;
width: 940px;
}
+#connectPort {
+ width: 104px;
+ height: 42px;
+ display: block;
+ background-position: 0 -91px;
+ overflow: hidden;
+ line-height: 200px;
+}
@@ -348,6 +356,7 @@
+ 连接FRID设备
Index: ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/awaitForRecycleList.js
===================================================================
diff -u -r34366 -r34390
--- ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/awaitForRecycleList.js (.../awaitForRecycleList.js) (revision 34366)
+++ ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/awaitForRecycleList.js (.../awaitForRecycleList.js) (revision 34390)
@@ -187,7 +187,7 @@
if (result.data[i].recyclingStatus == '部分回收' || (haveUnRecycling && sstsConfig.enableRecyclingRecordBGColorWhenRecycleAmountLessThanApplyAmount)) {
trColor = 'bgcolor="yellow"';
}
-
+
if(confirmRecyclingAmount && recycleAmountNeedConfirm == '是' && status !== '已确认'){
if(sstsConfig.backgroundColorOfRecyclingRecordWhichRecyclingAmountNotEqualToAppplyAmount){
var config = sstsConfig.backgroundColorOfRecyclingRecordWhichRecyclingAmountNotEqualToAppplyAmount;
@@ -1614,6 +1614,83 @@
return parseInt(value);
}
+
+function connectPort() {
+ if ('serial' in navigator) {
+ openPort();
+ } else {
+ layer.msg('你的浏览器不支持串口连接!');
+ }
+}
+
+//读取数据
+function dealWithData(value) {
+ var dataString = "";
+ var barcode = '';
+ if (value.length > 10) {
+ for (var i = 0; i < value.length; i++) {
+ if (value[i] !== '' && value[i] !== 13 && value[i] !== 10) {
+ dataString += String.fromCharCode(value[i]);
+ }
+ }
+ }
+ if (dataString !== '' && dataString.indexOf('M') >= 0) {
+ barcode = dataString.substring(dataString.indexOf('M') + 1, dataString.indexOf('FF'));
+ if (barcode !== '') {
+ loadBarcodeDevice(barcode);
+ }
+ }
+}
+
+var keepReading = true;
+var reader;
+var writer;
+
+//打开串口并连接
+async function openPort() {
+ try {
+ // 获取用户之前授予该网站访问权限的所有串口
+ var port = await navigator.serial.requestPort();
+ await port.open({ baudRate: 115200 }, { dataBits: 8 }, { stopBits: 1 }, { parity: 'none' });
+ layer.msg('设备已连接!');
+ reader = port.readable.getReader();
+ writer = port.writable.getWriter();
+ encoder = new TextEncoder();
+ //设置循环查询获取用户区的数据
+ await writer.write(encoder.encode(">x m 1 03 00 04\r\n"));
+ while (port.readable && keepReading) {
+ try {
+ while (true) {
+ var { value, done } = await reader.read();
+ if (done) {
+ reader.releaseLock();
+ writer.releaseLock();
+ break;
+ }
+ if (value) {
+ dealWithData(value);
+ }
+ }
+ } catch (error) {
+ layer.msg('连接失败!');
+ } finally {
+ console.log(port.readable, keepReading);
+ }
+ }
+ } catch (error) {
+ layer.msg('连接失败:' + error);
+ }
+}
+
+window.addEventListener('beforeunload', function () {
+ if(keepReading && reader){
+ keepReading = false;
+ reader.cancel();
+ reader.releaseLock();
+ writer.releaseLock();
+ }
+})
+
$(document).ready(function () {
/*Annie 快速入框权限*/
if (sstsConfig.enableExpressIntoContainer) {
@@ -1668,6 +1745,10 @@
$("#rememberCheckBox").attr("checked", true);
}
+ if (sstsConfig.enableRFIDTousseIdCard && !isIE()) {
+ $("#openPortBtn").show();
+ }
+
//点击checkBox事件
$("#rememberCheckBox").click(function () {
var isChecked = $("#rememberCheckBox").attr("checked");
Index: ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recycleForTouchScreen.js
===================================================================
diff -u -r34263 -r34390
--- ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recycleForTouchScreen.js (.../recycleForTouchScreen.js) (revision 34263)
+++ ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recycleForTouchScreen.js (.../recycleForTouchScreen.js) (revision 34390)
@@ -7265,6 +7265,82 @@
window.onunload = cleanIsRecyclingFun;
}
+function connectPort() {
+ if ('serial' in navigator) {
+ openPort();
+ } else {
+ layer.msg('你的浏览器不支持串口连接!');
+ }
+}
+
+var keepReading = true;
+var reader;
+var writer;
+
+//打开串口并连接
+async function openPort() {
+ try {
+ // 获取用户之前授予该网站访问权限的所有串口
+ var port = await navigator.serial.requestPort();
+ await port.open({ baudRate: 115200 }, { dataBits: 8 }, { stopBits: 1 }, { parity: 'none' });
+ layer.msg('设备已连接!');
+ reader = port.readable.getReader();
+ writer = port.writable.getWriter();
+ encoder = new TextEncoder();
+ //设置循环查询获取用户区的数据
+ await writer.write(encoder.encode(">x m 1 03 00 04\r\n"));
+ while (port.readable && keepReading) {
+ try {
+ while (true) {
+ var { value, done } = await reader.read();
+ if (done) {
+ reader.releaseLock();
+ writer.releaseLock();
+ break;
+ }
+ if (value) {
+ dealWithData(value);
+ }
+ }
+ } catch (error) {
+ layer.msg('连接失败!');
+ } finally {
+ console.log(port.readable, keepReading);
+ }
+ }
+ } catch (error) {
+ layer.msg('连接失败:' + error);
+ }
+}
+
+//读取数据
+function dealWithData(value) {
+ var dataString = "";
+ var barcode = '';
+ if (value.length > 10) {
+ for (var i = 0; i < value.length; i++) {
+ if (value[i] !== '' && value[i] !== 13 && value[i] !== 10) {
+ dataString += String.fromCharCode(value[i]);
+ }
+ }
+ }
+ if (dataString !== '' && dataString.indexOf('M') >= 0) {
+ barcode = dataString.substring(dataString.indexOf('M') + 1, dataString.indexOf('FF'));
+ if (barcode !== '') {
+ loadBarcodeDevice(barcode);
+ }
+ }
+}
+
+window.addEventListener('beforeunload', function () {
+ if(keepReading && reader){
+ keepReading = false;
+ reader.cancel();
+ reader.releaseLock();
+ writer.releaseLock();
+ }
+})
+
$(function () {
// 是否开启根据科室加载模板
openLoadTemplateByUnit();
@@ -7288,6 +7364,9 @@
if (sstsConfig.showSelfTransportorInRecycleForm) {
$('.departmentSender').show();
}
+ if(sstsConfig.enableRFIDTousseIdCard && !isIE()){
+ $("#openPortBtn").show();
+ }
})
/**