From 424a7783c0064e5e1e94cea2691fa9d822f78460 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期二, 27 五月 2025 08:48:18 +0800
Subject: [PATCH] gx

---
 src/views/home/index.vue           |   28 +++++----
 imgs/1747872963959.png             |    0 
 imgs/1747871314850.png             |    0 
 imgs/1747872961935.png             |    0 
 src/samples/sockteStomp.ts         |    1 
 imgs/1747872966020.png             |    0 
 imgs/1747959861905.png             |    0 
 imgs/1747900669498.png             |    0 
 imgs/1747955547919.png             |    0 
 src/stores/sockteInfo.ts           |   42 +++-----------
 src/samples/deviceApi/XK3190A12.ts |   83 ++-------------------------
 11 files changed, 33 insertions(+), 121 deletions(-)

diff --git a/imgs/1747871314850.png b/imgs/1747871314850.png
new file mode 100644
index 0000000..8688273
--- /dev/null
+++ b/imgs/1747871314850.png
Binary files differ
diff --git a/imgs/1747872961935.png b/imgs/1747872961935.png
new file mode 100644
index 0000000..60bf7ab
--- /dev/null
+++ b/imgs/1747872961935.png
Binary files differ
diff --git a/imgs/1747872963959.png b/imgs/1747872963959.png
new file mode 100644
index 0000000..ef61ab8
--- /dev/null
+++ b/imgs/1747872963959.png
Binary files differ
diff --git a/imgs/1747872966020.png b/imgs/1747872966020.png
new file mode 100644
index 0000000..a0e82aa
--- /dev/null
+++ b/imgs/1747872966020.png
Binary files differ
diff --git a/imgs/1747900669498.png b/imgs/1747900669498.png
new file mode 100644
index 0000000..baea1fb
--- /dev/null
+++ b/imgs/1747900669498.png
Binary files differ
diff --git a/imgs/1747955547919.png b/imgs/1747955547919.png
new file mode 100644
index 0000000..29db53b
--- /dev/null
+++ b/imgs/1747955547919.png
Binary files differ
diff --git a/imgs/1747959861905.png b/imgs/1747959861905.png
new file mode 100644
index 0000000..c5dfbc7
--- /dev/null
+++ b/imgs/1747959861905.png
Binary files differ
diff --git a/src/samples/deviceApi/XK3190A12.ts b/src/samples/deviceApi/XK3190A12.ts
index f9e6073..8a47728 100644
--- a/src/samples/deviceApi/XK3190A12.ts
+++ b/src/samples/deviceApi/XK3190A12.ts
@@ -16,8 +16,6 @@
 let serialPort:any; // 串口实例
 
 const initPort=(path:String,baudRate:Number)=>{
-    // 是否清零了
-   let  sfqingling=true
     // 配置文件定义的对此次数
     const yanjiancishu=confingInfoStore().confingInfo.jianyancishu===undefined?4:confingInfoStore().confingInfo.jianyancishu
     console.log('初始化打开XK3190-A12体重秤端口',yanjiancishu)
@@ -100,10 +98,10 @@
         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 str=value.toString() 
             // 截取结果
             // const list=str.substring(2,10) 得到数字
-
+            ipcRenderer.invoke('logger', `收到体重秤数据${value.toString()}`)
             const list = parseFloat(str.replace(/[^\d.]/g, '')).toString();
             console.log(list)
             if(Number(list)>20){
@@ -117,9 +115,9 @@
                 // 对比4次结果都一致
                 if(duibinum>=yanjiancishu){
                     // 数据发送  体重没有清零  下次就不播报不发送
-                    sfqingling=false
                     const res=Number(list)
                     console.log(res,'获取到的体重')
+                    ipcRenderer.invoke('logger', `获取到的体重${res.toString()}`)
                     sockteStore().setweightSockte(
                         {
                             deviceName:'XK3190-A12',
@@ -132,13 +130,14 @@
                     duibinum=0
                     lisijieguo=''
                 }else{
-                    // sfqingling=false
                 }
 
                 
 
             }else{
-                sfqingling=true
+                // 小于20 就做测量准备 可以扫码识别了
+                sockteStore().setis测量准备(true)
+                ipcRenderer.invoke('logger', `小于20就算归零状态了,可以继续人脸识别`)
                 console.log('小于20')
             }  
         }) // all data after READY is received
@@ -152,75 +151,7 @@
     }
     
 
-    // const serialport  = new SerialPort({ path, baudRate }, (err: any) => {
-    //     if (err) {
-    //         console.log(err)
-    //         ElMessage({
-    //             message: 'XK3190-A12体重秤端口打开失败!',
-    //             type: 'error',
-    //         })
-    //         console.log(err)
-    //     }else{
-    //         ElMessage({
-    //             message: 'XK3190-A12体重秤端口打开成功',
-    //             type: 'success',
-    //         })
-    //     } 
-    // })
-    // serialport.on("close",(err: any)=>{
-    //     console.log('XK3190-A12体重秤端口异常端口链接断开')
-    //     console.log(err)
-    // })
-    // // 解析分割数据流
-    // // 77 6E 30 30 30 30 30 2E 30 6B 67 0D 0A
-    // // 77 6E 30 30 30 30 32 38 2E 36 6B 67 0D 0A
-    // // 77 6E 30 30 30 30 32 38 2E 36 6B 67 0D 0A
-    // //wn000016.6kg
-    // 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.substring(2,10) 得到数字
-
-    //     const list = parseFloat(str.replace(/[^\d.]/g, '')).toString();
-    //     console.log(list)
-    //     if(Number(list)>20){
-    //         // 判断是否相等 相等加一
-    //         if(list===lisijieguo){
-    //             duibinum++
-    //         }else{
-    //             lisijieguo=list
-    //             duibinum=0
-    //         }
-    //         // 对比4次结果都一致
-    //         if(duibinum>=yanjiancishu){
-    //             // 数据发送  体重没有清零  下次就不播报不发送
-    //             sfqingling=false
-    //             const res=Number(list)
-    //             console.log(res,'获取到的体重')
-    //             sockteStore().setweightSockte(
-    //                 {
-    //                     deviceName:'XK3190-A12',
-    //                     type:"体重秤",
-    //                     result:res.toString(),
-    //                     resultTime:new Date().toString(),
-    //                     state:2
-    //                 }
-    //             )
-    //             duibinum=0
-    //             lisijieguo=''
-    //         }else{
-    //             // sfqingling=false
-    //         }
-
-            
-
-    //     }else{
-    //         sfqingling=true
-    //         console.log('小于20')
-    //     }  
-    // }) // all data after READY is received
+    
 }
 
 export {
diff --git a/src/samples/sockteStomp.ts b/src/samples/sockteStomp.ts
index 5f6a3f9..2320f04 100644
--- a/src/samples/sockteStomp.ts
+++ b/src/samples/sockteStomp.ts
@@ -94,6 +94,7 @@
         isScheduled:resultInfo.isScheduled,
         isAfterMed:resultInfo.isAfterMed,
         deviceNo:resultInfo.deviceNo,
+        设备分区名称:resultInfo.设备分区名称,
         preWeight:resultInfo.preWeight,
         // s上次体重
         lastTimeAfterWeight:resultInfo.lastTimeAfterWeight,
diff --git a/src/stores/sockteInfo.ts b/src/stores/sockteInfo.ts
index c3ae235..6ed2aa0 100644
--- a/src/stores/sockteInfo.ts
+++ b/src/stores/sockteInfo.ts
@@ -75,39 +75,15 @@
      * @param infoObj 体重结果
      */
     function setweightSockte(infoObj:info){
-        console.log('更新体重秤看看有没有患者信息')
-       const patientInfo = patientInfoStore();
-       // 当患者信息有名字 ,还有体重值,我就放弃体重赋值
-       if(patientInfo.patientInfo.name!==''&&weightSockte.value.result!=='0'){
-             console.log('当患者信息有名字 ,还有体重值,我就放弃体重赋值')
-            return true
-       }
-       // 当患者信息没有 ,体重有值的时候
-       else if(patientInfo.patientInfo.name===''&&weightSockte.value.result!=='0'){
-            console.log('当患者信息没有 ,体重有值的时候')
-            console.log(patientInfo.patientInfo.name,weightSockte.value.result);
-            if(Number(infoObj.result)>10||Number(infoObj.result)===0){
-                weightSockte.value.deviceName=infoObj.deviceName
-                weightSockte.value.result=infoObj.result
-                weightSockte.value.resultTime=infoObj.resultTime
-                weightSockte.value.state=infoObj.state
-            }else{
-                console.log('体重不足10kg')
-            }
-       }
-       else{
-        console.log('直接赋值')
-            console.log(patientInfo.patientInfo.name,weightSockte.value.result);
-            if(Number(infoObj.result)>10||Number(infoObj.result)===0){
-                weightSockte.value.deviceName=infoObj.deviceName
-                weightSockte.value.result=infoObj.result
-                weightSockte.value.resultTime=infoObj.resultTime
-                weightSockte.value.state=infoObj.state
-            }else{
-                console.log('体重不足10kg')
-            }
-       }
-       
+        console.log('写入体重结果',infoObj)
+        if(infoObj.result&&Number(infoObj.result)>10){
+            weightSockte.value.deviceName=infoObj.deviceName
+            weightSockte.value.result=infoObj.result
+            weightSockte.value.resultTime=infoObj.resultTime
+            weightSockte.value.state=infoObj.state
+        }else{
+            console.log('体重不足10kg,我就算他归零状态了')
+        }
        
     }
      /**
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index bd80506..b3849c8 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -15,8 +15,6 @@
             <el-col v-if="dialogVisible" :span="12" style="text-align: right;padding-top: 10px;">
                 <el-input  v-model="inputCode" ref="inputRef" id="inputCode" @change="inputChabge"  style="width: 400px; height: 40px;ime-mode:active;margin-right: 20px;"  
                 placeholder="请输入患者卡号或扫描条码" />
-                
-            
             </el-col>
             <el-col v-else :span="12">
                 <div class="dateclas" style="float: right;margin-top: 20px;">
@@ -60,7 +58,8 @@
                             </div>
                             <div style="display: grid;place-items: center;font-size: 120px;font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;font-weight: 800;color: #65AAF6;">
                                 <template v-if="configData.deviceType==='体重秤'">
-                                  {{ weightInfo.result }}
+                                  <!-- {{ weightInfo.result }} -->
+                                  {{weightInfoResult}}
                                 </template>
                                 <template v-else>
                                   {{ Number(gao_ya) }}
@@ -91,20 +90,21 @@
                                 
                               </template>
                             </div>
-                            <div class="textwenben" style="height: 70%; font-size: 80px; color: #9F61DC;font-weight: 1000;">
+                            <div class="textwenben" style="height: 70%; font-size: 80px; color: #9F61DC;font-weight: 1000;text-align: center;">
                               <template v-if="configData.deviceType==='体重秤'">
                                   <template v-if="patientInfo.isAfterMed===0&&!configData.gantiziShow">
-                                    {{ patientInfo.deviceNo }}
+                                    <div style="font-size: 50px"> {{ patientInfo.设备分区名称 }}<br/>{{ patientInfo.deviceNo }}</div>
+                                   
                                   </template>
-                                  <template v-else>{{patientInfo.pureWeight}}</template>
+                                  <template v-else>{{ patientInfo.设备分区名称 }}<br/>{{ patientInfo.deviceNo }}</template>
                                     
                                 </template>
                                 <template v-else>
                                   <template v-if="patientInfo.isAfterMed===0">
-                                    {{ patientInfo.deviceNo }}
+                                    <div style="font-size: 50px">  {{ patientInfo.设备分区名称 }}<br/>{{ patientInfo.deviceNo }}</div>
                                   </template>
                                   <template v-else>
-                                    {{ patientInfo.deviceNo }}
+                                    <div style="font-size: 50px">{{ patientInfo.设备分区名称 }}<br/>{{ patientInfo.deviceNo }}</div>
                                   </template>
                                   
                                 </template>
@@ -322,6 +322,8 @@
 const datetext=computed(()=>{
   return  formatDate(new Date(),'YYYY-mm-dd  WWW')
 })
+/**体重发送时候显示在界面的体重 */
+const weightInfoResult=ref() 
 let timer:any=new Date()
 const date=ref('')
 const timeShidaun=ref('')
@@ -671,6 +673,7 @@
 watch(
   () => patientInfo.value.datetime,
   () => {
+    weightInfoResult.value=''
     patientCodeLs = ''
     patientCodeLsXy = ''
     aimTSL.value = ''
@@ -681,7 +684,7 @@
       // 人脸识别成功后 1查看是否开启测温
       // console.log(`患者信息识别成功:${patientInfo.value.name}`)
       ipcRenderer.invoke('logger', `患者信息识别成功:${patientInfo.value.name}`)
-      let str = `${patientInfo.value.name}识别成功。床号:${patientInfo.value.deviceNo}`
+      let str = `${patientInfo.value.name}识别成功,分区:${patientInfo.value.设备分区名称},床号:${patientInfo.value.deviceNo},`
       dialogVisible.value = false
       speech.value?.speak({ text: str }).then(() => {
       })
@@ -776,6 +779,7 @@
           ipcRenderer.invoke('logger', `开始发送结果到服务器:患者:${patientInfo.value.name},体重结果:${weightInfo.value.result}`)
           console.log(`开始发送结果到服务器:患者:${patientInfo.value.name},体重结果:${weightInfo.value.result}`)
           sundModeTz()
+          weightInfoResult.value=weightInfo.value.result
         }
         else {
             // 临时患者code=当前患者code
@@ -876,7 +880,7 @@
     ipcRenderer.invoke('logger', '结果上传成功')
     // 测量结果发送成功后就一定要体重秤归零才行  关闭体重秤归零状态为false
     // 只增对M503
-    if(configData.value.tzc_type==='M503'||configData.value.tzc_type==='seca101Banger'){
+    if(configData.value.tzc_type==='M503'||configData.value.tzc_type==='seca101Banger'||configData.value.tzc_type==='XK3190-A12'){
       console.log('发送清理体重归零')
       sockteStore().setis测量准备(false)
     }
@@ -1171,8 +1175,8 @@
   const X= jgTime(lsDateTime,new Date())
   //人脸上传到阿里云  
   // 只有是结果归零状态才能进行识别   
-  console.log(`检查人脸是否要上传到阿里云识别:${sockteStore().is测量准备}`)
-  if(dialogVisible.value&&X>configData.value.face_push&&isworkTime(new Date())&&sockteStore().is测量准备){
+  console.log(`检查人脸是否要上传到阿里云识别:归零状态${sockteStore().is测量准备},`)
+  if(dialogVisible.value&&X>configData.value.face_push&&sockteStore().is测量准备){
     lsDateTime=new Date()
     // console.log(X,'上传图片间隔')
     base64toFile(image)

--
Gitblit v1.8.0