| | |
| | | win = new BrowserWindow({ |
| | | title: 'Main window', |
| | | transparent: true, |
| | | frame:store.get('debug'),//关闭菜单栏 |
| | | frame:store.get('debug')===undefined?true:store.get('debug'),//关闭菜单栏 |
| | | fullscreen: true,// 开启默认全屏 |
| | | kiosk: true, |
| | | // autoHideMenuBar:store.get('debug'), |
| | |
| | | { |
| | | "name": "sign-tool", |
| | | "version": "2.7.0", |
| | | "version": "2.7.1", |
| | | "icon": "public/favicon.ico", |
| | | "main": "dist/electron/main/index.js", |
| | | "author": "", |
| New file |
| | |
| | | // 体重秤读取文件夹模式通讯 |
| | | const fs = require('fs'); |
| | | const fspre = require('fs/promises'); |
| | | const path = require("path"); |
| | | import {sockteStore} from '@/stores/sockteInfo' |
| | | import { confingInfoStore } from '@/stores/StoresConfing' |
| | | async function toDataTz(filepath:string) { |
| | | try { |
| | | const data = await fspre.readFile(filepath, { encoding: 'utf8' }); |
| | | // console.log('读取文件类容') |
| | | // console.log(data); |
| | | const list=data.split('kg') |
| | | if(list.length===2){ |
| | | const tztext= list[0].substring(list[0].length-7,list[0].length-2) |
| | | // 替换,当. |
| | | const res= tztext.replace(",",".") |
| | | console.log(res) |
| | | sockteStore().setweightSockte( |
| | | { |
| | | deviceName:'seca101', |
| | | type:"体重秤", |
| | | result:res, |
| | | resultTime:new Date().toString(), |
| | | state:2 |
| | | } |
| | | ) |
| | | delImg(filepath) |
| | | } |
| | | } catch (err) { |
| | | console.log(err); |
| | | } |
| | | } |
| | | const todatatzs= async (dateStr:string)=>{ |
| | | try { |
| | | // const pathName='D:/seca101/data' |
| | | const pathName = confingInfoStore().confingInfo.seca101Path |
| | | fs.readdir(pathName, function(err: any, files: string | any[]){ |
| | | var dirs: any[] = []; |
| | | (function iterator(i){ |
| | | if(i == files.length) { |
| | | var maxtime = 0; |
| | | var maxfileName = ''; |
| | | for(var j = 0;j<dirs.length;j++){ |
| | | var stat = fs.statSync(path.join(pathName,dirs[j])); |
| | | console.log(stat) |
| | | console.log(stat.birthtime) |
| | | var fileCreateTimeStamp = (new Date(stat.birthtime)).getTime(); |
| | | if(fileCreateTimeStamp>maxtime){ |
| | | maxtime = fileCreateTimeStamp; |
| | | maxfileName=dirs[j]; |
| | | } |
| | | } |
| | | // console.log('最终文件',maxfileName); |
| | | // 最新的文件路径 |
| | | const param=path.join(pathName,maxfileName) |
| | | |
| | | // console.log(dateStr,'人年识别时间') |
| | | var date1 = fs.statSync(param); |
| | | // const date2=date1.birthtime |
| | | // console.log('最终文件绝对路径',param); |
| | | //判断时间要大于人脸识别的时间 |
| | | // console.log(date1.birthtime,'体重写入时间') |
| | | const times1 = (new Date(date1.birthtime)).getTime(); |
| | | const times2=(new Date(dateStr)).getTime() |
| | | if(times1>times2){ |
| | | toDataTz(param) |
| | | }else{ |
| | | console.log(date1,dateStr) |
| | | delImg(param) |
| | | console.log('体重时间没有大于人脸识别时间') |
| | | } |
| | | return; |
| | | } |
| | | fs.stat(path.join(pathName, files[i]), function(err: any, data: { isFile: () => any; }){ |
| | | if(data.isFile()){ |
| | | dirs.push(files[i]); |
| | | } |
| | | iterator(i+1); |
| | | }); |
| | | })(0); |
| | | }) |
| | | } |
| | | catch(err){ |
| | | console.log(err); |
| | | } |
| | | } |
| | | //验证后删除文件图片 |
| | | const delImg=(path:string)=>{ |
| | | fs.unlink(path,(err:any)=>{ |
| | | if(err){ |
| | | console.log('删除失败') |
| | | }else{ |
| | | console.log('删除成功') |
| | | } |
| | | }) |
| | | } |
| | | export { |
| | | toDataTz, |
| | | todatatzs |
| | | } |
| New file |
| | |
| | | // 欧姆龙 HBP-9030 115200 |
| | | import { ElMessage } from 'element-plus' |
| | | const { SerialPort } = require('serialport') |
| | | const { DelimiterParser } = require('@serialport/parser-delimiter') |
| | | const { ReadyParser } = require('@serialport/parser-ready') |
| | | import {sockteStore} from '@/stores/sockteInfo' |
| | | |
| | | const initPort=(path:String,baudRate:Number)=>{ |
| | | console.log('初始化打开台衡M523体重秤端口') |
| | | const serialport = new SerialPort({ path, baudRate }, (err: any) => { |
| | | if (err) { |
| | | console.log(err) |
| | | ElMessage({ |
| | | message: '台衡M523体重秤端口打开失败!', |
| | | type: 'error', |
| | | }) |
| | | console.log(err) |
| | | }else{ |
| | | ElMessage({ |
| | | message: '台衡M523体重秤端口打开成功', |
| | | type: 'success', |
| | | }) |
| | | } |
| | | }) |
| | | serialport.on("close",(err: any)=>{ |
| | | console.log('台衡M523体重秤端口异常端口链接断开') |
| | | console.log(err) |
| | | }) |
| | | // 解析分割数据流 |
| | | //ST,GS 70.4kg |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // 53 54 2C 47 53 20 37 30 2E 34 6B 67 0D 0A HEX |
| | | const parser = serialport.pipe(new DelimiterParser({ delimiter:Buffer.from([107,103,13,10]),includeDelimiter:true })) |
| | | parser.on('data', (value: string | any[])=>{ |
| | | console.log(value.toString()) |
| | | const str=value.toString() |
| | | const list=str.split(' ') |
| | | console.log(list) |
| | | if(list.length===2&&list[0].search('ST,GS')!==-1){ |
| | | const re=list[1].trim() |
| | | const res=re.substring(0,re.length-2) |
| | | console.log(res,'获取到的体重') |
| | | sockteStore().setweightSockte( |
| | | { |
| | | deviceName:'台衡M523', |
| | | type:"体重秤", |
| | | result:res, |
| | | resultTime:new Date().toString(), |
| | | state:2 |
| | | } |
| | | ) |
| | | }else{ |
| | | console.log('数据格式不对') |
| | | } |
| | | }) // all data after READY is received |
| | | } |
| | | |
| | | export { |
| | | initPort, |
| | | } |
| | |
| | | } |
| | | const writePatient=(resultInfo:any)=>{ |
| | | // 给一个时间变化 |
| | | const da=new Date().toTimeString() |
| | | const da=new Date() |
| | | console.log(da) |
| | | const info={ |
| | | id:resultInfo.patientInfo===null?0:resultInfo.patientInfo.id, |
| | |
| | | xueyanjiPortPath:"COM35", |
| | | xueyanjiBaudRate:115200, |
| | | Is_tzc:false, |
| | | // 志荣的[zhiRongT605];台衡的M523[taiHengM523] //[s]eca101]读文件夹 |
| | | tzc_type:"seca101", |
| | | tzcPortPath:"COM34", |
| | | tzcBaudRate:1200 |
| | | tzcBaudRate:120,// zhiRongT605波特率1200;台衡523波特率9600 |
| | | seca101Path:"D:/seca101/data/"// 文件获取目录 |
| | | |
| | | }) |
| | | /** |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <el-dialog title="提示" v-model="netLink" width="30%"> |
| | | <!-- <el-dialog title="提示" v-model="netLink" width="30%"> |
| | | <span>无法链接到网络!</span> |
| | | </el-dialog> |
| | | </el-dialog> --> |
| | | </div> |
| | | </template> |
| | | <script setup lang="ts"> |
| | |
| | | import{initPort} from '@/samples/portApi' |
| | | import{initPort as oumulongHbp9030 } from '@/samples/deviceApi/oumulong-HBP-9030' |
| | | import{initPort as zhiRongT605 } from '@/samples/deviceApi/zhiRongT605' |
| | | |
| | | import{initPort as taiHengM523 } from '@/samples/deviceApi/taiHengM523' |
| | | // 读取体重文件 |
| | | import{toDataTz,todatatzs } from '@/samples/deviceApi/seca101' |
| | | import { ElLoading, ElMessage } from 'element-plus' |
| | | let trackerTask: any = null; |
| | | // 标识用的画布 |
| | |
| | | ipcRenderer.invoke('logger', '网络已经断开') |
| | | }else{ |
| | | ipcRenderer.invoke('logger', '网络已经恢复') |
| | | |
| | | } |
| | | return !sockte.netLink |
| | | }) |
| | | watch(netLink,()=>{ |
| | | if(!netLink.value){ |
| | | ElMessage.success('网络已经连接') |
| | | }else{ |
| | | ElMessage.warning('网络已断开,等待重连') |
| | | } |
| | | }) |
| | | |
| | | // 体重 |
| | |
| | | dialogVisible.value = false |
| | | speech.value?.speak({ text: str }).then(() => { |
| | | }) |
| | | |
| | | sockteStore().setweightSockte({ |
| | | type: "体重秤", |
| | | state: 2, |
| | |
| | | result: "", |
| | | resultTime: "" |
| | | }) |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | // 没有找到患者 |
| | |
| | | settime() |
| | | // 定时数秒器 |
| | | const tt = mode.weight.replace('.', '点') |
| | | speech.value?.speak({ text: `称重完成,${tt}kg` }).then(() => { |
| | | speech.value?.speak({ text: `称重完成,${tt}千克` }).then(() => { |
| | | console.log("播报完成...") |
| | | }) |
| | | patientCodeLs = mode.patientCode |
| | |
| | | sendPationCodeApi(inputCode.value) |
| | | setTimeout(function () { |
| | | inputCode.value = '' |
| | | }, 1000) |
| | | }, 5000) |
| | | } |
| | | // 点击10下关闭程序 |
| | | const guyanbi = () => { |
| | |
| | | } |
| | | } |
| | | onMounted(() => { |
| | | console.log(0%5) |
| | | console.log('页面初始化', os.hostname()) |
| | | setTimeout(()=>{ |
| | | |
| | | console.log('8秒后执行') |
| | | console.log('打印设置文件') |
| | | console.log(configData.value) |
| | |
| | | } |
| | | // 是否开启志荣体重秤联机 |
| | | if(configData.value.Is_tzc){ |
| | | zhiRongT605(configData.value.tzcPortPath,configData.value.tzcBaudRate) |
| | | //台衡M523 |
| | | if(configData.value.tzc_type==='taiHengM523'){ |
| | | taiHengM523(configData.value.tzcPortPath,configData.value.tzcBaudRate) |
| | | } |
| | | // seca101读取文件 |
| | | else if(configData.value.tzc_type==='seca101'){ |
| | | console.log('体重是读取文件') |
| | | } |
| | | else{ |
| | | zhiRongT605(configData.value.tzcPortPath,configData.value.tzcBaudRate) |
| | | } |
| | | } |
| | | // 是否开启脸识别 |
| | | isUseFaceRecogService.value = configData.value.isUseFaceRecogService |
| | |
| | | setInterval(function () { |
| | | clockNum.value-- |
| | | if(clockNum.value===0){ |
| | | |
| | | fuxuan() |
| | | } |
| | | inputRef.value.focus(); |
| | | |
| | | date.value=formatDate(new Date(),'YYYY-mm-dd HH:MM') |
| | | if(Number(date.value.substring(11,13))<12){ |
| | | timeShidaun.value='上午好!' |
| | |
| | | }else { |
| | | timeShidaun.value='晚上好!' |
| | | } |
| | | //5秒一次验证读取体重数据 |
| | | console.log(clockNum.value,clockNum.value%5==0) |
| | | if(clockNum.value%3==0){ |
| | | // 验证人脸识别已经通过但是还没有体重数据主动获取数据 |
| | | if(patientInfo.value.name!==''&&weightInfo.value.result==='0'){ |
| | | console.log('主动获取体重') |
| | | todatatzs(patientInfo.value.datetime) |
| | | } |
| | | } |
| | | inputRef.value.focus(); |
| | | |
| | | }, 1000) |
| | | speech.value = new Speech(); |
| | | speech.value?.setLanguage('zh-CN') |