Quellcode durchsuchen

设备数据采集;设备控制页面

hh vor 2 Wochen
Ursprung
Commit
6326739a1d

+ 2 - 4
entry/src/main/ets/common/util/Mqtt.ets

@@ -74,8 +74,6 @@ class MqttManager {
     topicCallbacks.forEach(cb => cb(topic, payload));
     try {
       const valueJson: MQTTReceiveData = JSON.parse(payload);
-      console.log('hhtest', 'topic========' + topic)
-      console.log('hhtest', 'payload========' + payload)
       if (CommonConstants.mqttSubscribeTopic1 != CommonConstants.mqttSubscribeTopic2 && CommonConstants.mqttSubscribeTopic2 == topic) {
         let device0: TempHumiditySensor = { Temperature: 0, Humidity: 0, OnlineStatus: 0 }
         for (const element of valueJson.d) {
@@ -94,7 +92,8 @@ class MqttManager {
           }
         }
         AppStorage.setOrCreate<TempHumiditySensor>('TempHumiditySensor', device0);
-        return
+        // todo 放开注释
+        // return
       }
       let device0: ThreeColourLight = { LedRed: 0, LedOrange: 0, LedGreen: 0, Buzzer: 0, OpenStatus: 0 }
       let device1: WeldFumeExtractor = { ExhaustFan: 0, OnlineStatus: 0}
@@ -181,7 +180,6 @@ class MqttManager {
       AppStorage.setOrCreate<AntiWristStrap>('AntiWristStrap', device4);
       AppStorage.setOrCreate<CardReader>('CardReader', device5);
       AppStorage.setOrCreate<Lighting>('Lighting', device6);
-
     } catch (e) {
       console.error("MQTT消息处理异常:", e);
     }

+ 0 - 1
entry/src/main/ets/common/util/request/ProcessRequest.ets

@@ -34,7 +34,6 @@ ProcessRequest.interceptors.request.use((config: InternalAxiosRequestConfig) =>
 
   // 以后登录之后可以在这里传
   config.headers.Authorization = CommonConstants.AUTH_TOKEN
-  config.headers.Authorization ='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOnsic3RhdGlvbkNvZGUiOiJ6aHVhbmd0aWFvMSIsInN0YXRpb25UeXBlIjoiMTgiLCJkZXB0SWQiOjE3LCJpZCI6MTAwMDAsInN0YXRpb25JcCI6IjE5Mi4xNjguMS4xMSIsInVzZXJOYW1lIjoiYWRtaW4iLCJvcmdJZCI6MTcsInN0YXRpb25JZCI6Njh9LCJkZXZpY2UiOiJhaW8iLCJlZmYiOjE3NDk1NDQ3MDA2ODAsInJuU3RyIjoicEpMekNUT210UTQyRVF5Y2FiNGRvd1IzNlVEbFJQeUYifQ.6HOZW7NbpuGrC7JoZgpkji8T3lApt-URuf302fv0MFI'
   printRequest(config)
   return config;
 }, (error: AxiosError) => {

+ 4 - 0
entry/src/main/ets/entryability/EntryAbility.ets

@@ -3,10 +3,14 @@ import hilog from '@ohos.hilog';
 import UIAbility from '@ohos.app.ability.UIAbility';
 import Want from '@ohos.app.ability.Want';
 import window from '@ohos.window';
+import ElectricScrewdriverPresetModel from '../model/ElectricScrewdriverPresetModel';
+import ElectricSolderingIronPresetModel from '../model/ElectricSolderingIronPresetModel';
 
 export default class EntryAbility extends UIAbility {
   onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+    ElectricScrewdriverPresetModel.initTaskDB(this.context)
+    ElectricSolderingIronPresetModel.initTaskDB(this.context)
   }
 
   onDestroy(): void {

+ 1 - 1
entry/src/main/ets/model/ElectricScrewdriverPresetModel.ets

@@ -23,7 +23,7 @@ class ElectricScrewdriverPresetModel {
       // 获取数据库存储对象
       this.rdbStore = await relationalStore.getRdbStore(context, config);
     } catch (err) {
-      console.info(`getRdbStore err ${JSON.stringify(err)}`);
+      console.info('hhtest', `getRdbStore err ${JSON.stringify(err)}`);
     }
     // 2.初始化SQL语句
     const sql = `CREATE TABLE IF NOT EXISTS` + this.tableName + `(

+ 1 - 1
entry/src/main/ets/model/ElectricSolderingIronPresetModel.ets

@@ -23,7 +23,7 @@ class ElectricSolderingIronPresetModel {
       // 获取数据库存储对象
       this.rdbStore = await relationalStore.getRdbStore(context, config);
     } catch (err) {
-      console.info(`getRdbStore err ${JSON.stringify(err)}`);
+      console.info('testTag', `getRdbStore err ${JSON.stringify(err)}`);
     }
     // 2.初始化SQL语句
     const sql = `CREATE TABLE IF NOT EXISTS ElectricSolderingIronPreset (

+ 6 - 1
entry/src/main/ets/pages/DeviceControllerPage.ets

@@ -121,7 +121,12 @@ struct DeviceControllerPage {
           .height($r('app.float.virtualSize_48'))
           .fillColor($r('app.color.FFFFFF'))
           .onClick(()=>{
-            router.back()
+            router.back({
+              url: 'pages/ProcessIndex',
+              params: {
+
+              }
+            })
           })
         Row().width('0.6%')
         Text(this.deviceShows[this.deviceType]?.deviceName!)

+ 18 - 1
entry/src/main/ets/pages/ProcessIndex.ets

@@ -39,6 +39,14 @@ import { InAndOutBoundDialog } from '../view/InAndOutBoundDialog';
 import { LittleMaterialRequestDialog } from '../view/LittleMaterialRequestDialog';
 import { PictureDrawingDialog } from '../view/PictureDrawingDialog';
 
+// 声明接受参数的类型
+interface PARAMS {
+  // 辅助操作标志
+  auxiliaryOperationFlag?: boolean,
+}
+
+const params = router.getParams() as PARAMS; // 获取传递过来的参数对象
+
 @Entry
 @Component
 struct ProcessIndex {
@@ -423,7 +431,7 @@ struct ProcessIndex {
   connectMQTT = async ()=> {
     const clientOptions: MqttClientOptions = {
       url: 'mqtt://192.168.1.3:1883',   // 替换实际IP
-      clientId: `116_ohos_client_${Date.now()}`,
+      clientId: `process_client_${Date.now()}`,
       persistenceType: 1,              // 使用英文逗号       // 建议开启自动重连
     };
     // MQTT连接配置
@@ -455,6 +463,12 @@ struct ProcessIndex {
     return USBDeviceManager.getInstance();
   }
 
+  onPageShow() {
+    if (params && params.auxiliaryOperationFlag) {
+      this.auxiliaryOperationController.open()
+    }
+  }
+
   async aboutToAppear() {
     try {
       const netHandle = connection.getDefaultNetSync();
@@ -464,6 +478,8 @@ struct ProcessIndex {
           connectionProperties.linkAddresses.forEach((address: connection.LinkAddress, index: number) => {
             if (address.address.address.startsWith(CommonConstants.ipPrefix)) {
               CommonConstants.mqttSubscribeTopic1 = 'station' + address.address.address.replace(CommonConstants.ipPrefix, '') + '/data/devices'
+              // todo 部署时放开注释
+              // CommonConstants.mqttSubscribePublish = 'station' + address.address.address.replace(CommonConstants.ipPrefix, '') + '/cmd/devices'
             }
           })
         }
@@ -811,6 +827,7 @@ struct ProcessIndex {
                         remark:'',
                         sortNum:0
                       })
+                      this.seqNo = this.scanCode
                     })
                 }
                 .width('65%')

+ 483 - 22
entry/src/main/ets/view/AuxiliaryOperationDialog.ets

@@ -3,7 +3,21 @@ import RequestParamModel from '../viewmodel/RequestParamModel'
 import WorkOrderSeq from '../viewmodel/WorkOrderSeq'
 import promptAction from '@ohos.promptAction'
 import ProcessInfo from '../viewmodel/process/ProcessInfo'
+import AntiWristStrap from '../viewmodel/device/AntiWristStrap';
+import ElectricScrewdriver from '../viewmodel/device/ElectricScrewdriver';
+import ElectricSolderingIron from '../viewmodel/device/ElectricSolderingIron';
+import ThreeColourLight from '../viewmodel/device/ThreeColourLight';
+import WeldFumeExtractor from '../viewmodel/device/WeldFumeExtractor'
+import Lighting from '../viewmodel/device/Lighting'
+import MqttDataItem from '../viewmodel/mqtt/MqttDataItem'
+import MqttCmdData from '../viewmodel/mqtt/MqttCmdData'
+import MqttManager from '../common/util/mqtt';
+import CommonConstants from '../common/constants/CommonConstants'
+import router from '@ohos.router'
+import CardReader from '../viewmodel/device/CardReader'
+import TempHumiditySensor from '../viewmodel/device/TempHumiditySensor'
 
+// 辅助操作弹窗
 @CustomDialog
 export struct AuxiliaryOperationDialog {
   // 工单编号
@@ -22,6 +36,26 @@ export struct AuxiliaryOperationDialog {
 
   //当前用户id
   @Consume('currentUserId') currentUserId: number
+  //照明
+  @StorageProp('Lighting') lighting: Lighting = {}
+   //三色灯
+  @StorageProp('ThreeColourLight') threeColourLight: ThreeColourLight = {}
+  //焊烟排烟机/空气净化器
+  @StorageProp('WeldFumeExtractor') weldFumeExtractor: WeldFumeExtractor = { ExhaustFan: 0}
+  // 电烙铁
+  @StorageProp('ElectricSolderingIron') solderingIron: ElectricSolderingIron = { SolderingCurrTemp: 0}
+  // 电动螺丝刀
+  @StorageProp('ElectricScrewdriver') screwdriver: ElectricScrewdriver = { TorqueHoldTime:0 }
+  // 防静电手环
+  @StorageProp('AntiWristStrap') wristStrap: AntiWristStrap = { RingWearNormal: 0, RingWearStandby: 0, RingWearFault: 0, OnlineStatus: 0}
+  // 读卡器
+  @StorageProp('CardReader') cardReader: CardReader = {}
+  // 温湿度传感器
+  @StorageProp('TempHumiditySensor') tempHumiditySensor: TempHumiditySensor = {}
+  // 相机是否在线
+  @StorageProp('CameraStatus') cameraStatus: boolean = false
+  // 扫码枪是否在线
+  @StorageProp('ScanningGunStatus') scanningGunStatus: boolean = false
 
   // 打开零星叫料弹窗
   openLittleMaterialRequestDialog?: () => void = () => {}
@@ -73,7 +107,7 @@ export struct AuxiliaryOperationDialog {
             .height($r('app.float.virtualSize_48'))
             .fillColor($r('app.color.60FFFFFF'))
           Circle()
-            .width($r('app.float.virtualSize_12'))
+            .width($r('app.float.virtualSize_14'))
             .height($r('app.float.virtualSize_12'))
             .fill($r('app.color.FF453A'))
         }
@@ -513,34 +547,463 @@ export struct AuxiliaryOperationDialog {
               .onClick(()=>{
 
               })
-
-
             }
             .width('90%')
             .height('6.6%')
             .justifyContent(FlexAlign.SpaceBetween)
             Blank().height('4.7%')
-            Row({space: 6}) {
-              Column() {
-                Row() {
-                  Circle()
-                    .width($r('app.float.virtualSize_12'))
-                    .height($r('app.float.virtualSize_12'))
-                    .fill($r('app.color.30D158'))
-                  Text('照明')
-                    .fontColor($r('app.color.0A84FF'))
-                    .fontSize($r('app.float.fontSize_24'))
-                    .fontWeight(FontWeight.Medium)
+            //  设备列表和设备控制
+            Column() {
+              // 照明+空气净化器
+              Row({space: 6}) {
+                // 照明
+                Column() {
+                  Row({space: 5}) {
+                    Circle()
+                      .width($r('app.float.virtualSize_14'))
+                      .height($r('app.float.virtualSize_14'))
+                      .fill(this.lighting.OnlineStatus === 1 ? $r('app.color.30D158') : $r('app.color.15FFFFFF'))
+                    Text('照明')
+                      .fontColor(this.lighting.lighting === 1 ? $r('app.color.90000000') : $r('app.color.FFFFFF'))
+                      .fontSize($r('app.float.fontSize_24'))
+                      .fontWeight(FontWeight.Medium)
+                  }
+                  .height('43.4%')
+                  .width('84.9%')
                 }
-                .height('43.4%')
-                .width('84.9%')
+                .height('100%')
+                .width('44.2%')
+                .backgroundColor(this.lighting.lighting === 1 ? $r('app.color.E5E5E5') : $r('app.color.20FFFFFF'))
+                .borderRadius($r('app.float.virtualSize_16'))
+                .onClick(()=>{
+                  let item: MqttDataItem = {
+                    tag: 'lighting',
+                    value: this.lighting?.lighting! === 1 ? 0 : 1
+                  }
+                  let mqttData: MqttCmdData = {
+                    w: [item]
+                  }
+                  // 发送控制命令
+                  MqttManager.publish(CommonConstants.mqttSubscribePublish, JSON.stringify(mqttData))
+                  // if (this.lighting?.OnlineStatus! === 1) {
+                  //   this.lighting = {
+                  //     lighting: item.value,
+                  //     OnlineStatus: 1
+                  //   }
+                  // }
+                })
+                // 排烟机
+                Column() {
+                  Row({space: 5}) {
+                    Circle()
+                      .width($r('app.float.virtualSize_14'))
+                      .height($r('app.float.virtualSize_14'))
+                      .fill(this.weldFumeExtractor.OnlineStatus === 1 ? $r('app.color.30D158') : $r('app.color.15FFFFFF'))
+                    Text('空气净化器')
+                      .fontColor(this.weldFumeExtractor.ExhaustFan === 1 ? $r('app.color.90000000') : $r('app.color.FFFFFF'))
+                      .fontSize($r('app.float.fontSize_24'))
+                      .fontWeight(FontWeight.Medium)
+                  }
+                  .height('43.4%')
+                  .width('84.9%')
+                }
+                .height('100%')
+                .width('44.2%')
+                .backgroundColor(this.weldFumeExtractor.ExhaustFan === 1 ? $r('app.color.E5E5E5') : $r('app.color.20FFFFFF'))
+                .borderRadius($r('app.float.virtualSize_16'))
+                .onClick(()=>{
+                  let item: MqttDataItem = {
+                    tag: 'ExhaustFan',
+                    value: this.weldFumeExtractor?.ExhaustFan! === 1 ? 0 : 1
+                  }
+                  let mqttData: MqttCmdData = {
+                    w: [item]
+                  }
+                  // 发送控制命令
+                  MqttManager.publish(CommonConstants.mqttSubscribePublish, JSON.stringify(mqttData))
+                  // if (this.weldFumeExtractor?.OnlineStatus! === 1) {
+                  //   this.weldFumeExtractor = {
+                  //     ExhaustFan: item.value,
+                  //     OnlineStatus: 1
+                  //   }
+                  // }
+                })
               }
-              .height('100%')
-              .width('44.2%')
+              .height('18.9%')
+              .width('100%')
+              .justifyContent(FlexAlign.Center)
+              // 工业相机+电烙铁
+              Row({space: 6}) {
+                // 工业相机
+                Column() {
+                  Row({space: 5}) {
+                    Circle()
+                      .width($r('app.float.virtualSize_14'))
+                      .height($r('app.float.virtualSize_14'))
+                      .fill(this.cameraStatus ? $r('app.color.30D158') : $r('app.color.15FFFFFF'))
+                    Text('工业相机')
+                      .fontColor(this.cameraStatus ? $r('app.color.90000000') : $r('app.color.FFFFFF'))
+                      .fontSize($r('app.float.fontSize_24'))
+                      .fontWeight(FontWeight.Medium)
+                  }
+                  .height('43.4%')
+                  .width('84.9%')
+                }
+                .height('100%')
+                .width('44.2%')
+                .backgroundColor($r('app.color.20FFFFFF'))
+                .borderRadius($r('app.float.virtualSize_16'))
+                .onClick(()=>{
+                //   todo 打开拍照弹窗
+                })
+                // 电烙铁
+                Column() {
+                  Row({space: 5}) {
+                    Circle()
+                      .width($r('app.float.virtualSize_14'))
+                      .height($r('app.float.virtualSize_14'))
+                      .fill(this.solderingIron.OnlineStatus === 1 ? $r('app.color.30D158') : $r('app.color.15FFFFFF'))
+                    Text('电烙铁')
+                      .fontColor($r('app.color.FFFFFF'))
+                      .fontSize($r('app.float.fontSize_24'))
+                      .fontWeight(FontWeight.Medium)
+                  }
+                  .height('43.4%')
+                  .width('84.9%')
+                  Column() {
+                    Row() {
+                      Text('设定温度 ')
+                        .fontColor($r('app.color.FFFFFF'))
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontWeight(FontWeight.Lighter)
+                      Text(this.solderingIron.SolderingCurrTemp ? this.solderingIron.SolderingCurrTemp + '℃' : '-')
+                        .fontColor(this.solderingIron.SolderingCurrTemp ? $r('app.color.0A84FF') : $r('app.color.20FFFFFF'))
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontWeight(FontWeight.Bold)
+                    }
+                    .width('100%')
+                  }
+                  .height('56.6%')
+                  .width('84.9%')
+                }
+                .height('100%')
+                .width('44.2%')
+                .backgroundColor($r('app.color.20FFFFFF'))
+                .borderRadius($r('app.float.virtualSize_16'))
+                .onClick(()=>{
+                  if (this.solderingIron?.OnlineStatus !== 1) {
+                    promptAction.showToast({
+                      message: `设备不在线,请检查设备连接!`,
+                      duration: 1500,
+                      bottom: 100
+                    })
+                    return
+                  }
+                  router.pushUrl({
+                    url: 'pages/DeviceControllerPage',
+                    params: {
+                      deviceType: 1,
+                      onlineStatus: this.solderingIron?.OnlineStatus
+                    }
+                  })
+                })
+              }
+              .height('18.9%')
+              .width('100%')
+              .justifyContent(FlexAlign.Center)
+              // 三色灯+电动螺丝刀
+              Row({space: 6}) {
+                // 三色灯
+                Column() {
+                  Row({space: 5}) {
+                    Circle()
+                      .width($r('app.float.virtualSize_14'))
+                      .height($r('app.float.virtualSize_14'))
+                      .fill(this.threeColourLight.OnlineStatus === 1 ? $r('app.color.30D158') : $r('app.color.15FFFFFF'))
+                    Text('三色灯')
+                      .fontColor($r('app.color.FFFFFF'))
+                      .fontSize($r('app.float.fontSize_24'))
+                      .fontWeight(FontWeight.Medium)
+                  }
+                  .height('43.4%')
+                  .width('84.9%')
+                  Column() {
+                    Row() {
+                      Text('当前颜色 ')
+                        .fontColor($r('app.color.FFFFFF'))
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontWeight(FontWeight.Lighter)
+                      Text(this.threeColourLight.LedRed! === 1 ? '红色' : (this.threeColourLight.LedOrange! === 1 ? '黄色' : (this.threeColourLight.LedGreen! === 1 ? '绿色' : '-')))
+                        .fontColor(this.threeColourLight.LedRed! === 1 ? $r('app.color.FF453A') : (this.threeColourLight.LedOrange! === 1 ? $r('app.color.FFD60A') : (this.threeColourLight.LedGreen! === 1 ? $r('app.color.30D158') : $r('app.color.20FFFFFF'))))
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontWeight(FontWeight.Bold)
+                    }
+                    .width('100%')
+                    Row() {
+                      Text('    蜂鸣器 ')
+                        .fontColor($r('app.color.FFFFFF'))
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontWeight(FontWeight.Lighter)
+                      Text(this.threeColourLight.Buzzer! === 1 ? '开启' : '关闭')
+                        .fontColor(this.threeColourLight.Buzzer! === 1 ? $r('app.color.0A84FF') : $r('app.color.15FFFFFF'))
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontWeight(FontWeight.Bold)
+                    }
+                    .width('100%')
+                  }
+                  .height('56.6%')
+                  .width('84.9%')
+                }
+                .height('100%')
+                .width('44.2%')
+                .backgroundColor($r('app.color.20FFFFFF'))
+                .borderRadius($r('app.float.virtualSize_16'))
+                .onClick(()=>{
+                  if (this.threeColourLight?.OnlineStatus !== 1) {
+                    promptAction.showToast({
+                      message: `设备不在线,请检查设备连接!`,
+                      duration: 1500,
+                      bottom: 100
+                    })
+                    return
+                  }
+                  router.pushUrl({
+                    url: 'pages/DeviceControllerPage',
+                    params: {
+                      deviceType: 0,
+                      onlineStatus: this.threeColourLight?.OnlineStatus
+                    }
+                  })
+                })
+                // 电动螺丝刀
+                Column() {
+                  Row({space: 5}) {
+                    Circle()
+                      .width($r('app.float.virtualSize_14'))
+                      .height($r('app.float.virtualSize_14'))
+                      .fill(this.screwdriver.OnlineStatus === 1 ? $r('app.color.30D158') : $r('app.color.15FFFFFF'))
+                    Text('电动螺丝刀')
+                      .fontColor($r('app.color.FFFFFF'))
+                      .fontSize($r('app.float.fontSize_24'))
+                      .fontWeight(FontWeight.Medium)
+                  }
+                  .height('43.4%')
+                  .width('84.9%')
+                  Column() {
+                    Row() {
+                      Text('预设转速 ')
+                        .fontColor($r('app.color.FFFFFF'))
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontWeight(FontWeight.Lighter)
+                      Text(this.screwdriver.TighteRotationDirection ? this.solderingIron + '℃' : '-')
+                        .fontColor(this.solderingIron.SolderingSetTemp ? $r('app.color.0A84FF') : $r('app.color.20FFFFFF'))
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontWeight(FontWeight.Bold)
+                    }
+                    .width('100%')
+                    Row() {
+                      Text('预设力矩 ')
+                        .fontColor($r('app.color.FFFFFF'))
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontWeight(FontWeight.Lighter)
+                      Text(this.solderingIron.SolderingSetTemp ? this.solderingIron + '℃' : '-')
+                        .fontColor(this.solderingIron.SolderingSetTemp ? $r('app.color.0A84FF') : $r('app.color.20FFFFFF'))
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontWeight(FontWeight.Bold)
+                    }
+                    .width('100%')
+                    Row() {
+                      Text('预设圈数 ')
+                        .fontColor($r('app.color.FFFFFF'))
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontWeight(FontWeight.Lighter)
+                      Text(this.solderingIron.SolderingSetTemp ? this.solderingIron + '℃' : '-')
+                        .fontColor(this.solderingIron.SolderingSetTemp ? $r('app.color.0A84FF') : $r('app.color.20FFFFFF'))
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontWeight(FontWeight.Bold)
+                    }
+                    .width('100%')
+                  }
+                  .height('56.6%')
+                  .width('84.9%')
+                }
+                .height('100%')
+                .width('44.2%')
+                .backgroundColor($r('app.color.20FFFFFF'))
+                .borderRadius($r('app.float.virtualSize_16'))
+                .onClick(()=>{
+                  if (this.solderingIron?.OnlineStatus !== 1) {
+                    promptAction.showToast({
+                      message: `设备不在线,请检查设备连接!`,
+                      duration: 1500,
+                      bottom: 100
+                    })
+                    return
+                  }
+                  router.pushUrl({
+                    url: 'pages/DeviceControllerPage',
+                    params: {
+                      deviceType: 2,
+                      onlineStatus: this.screwdriver?.OnlineStatus
+                    }
+                  })
+                })
+              }
+              .height('18.9%')
+              .width('100%')
+              .justifyContent(FlexAlign.Center)
+              // 读卡器+温湿度传感器
+              Row({space: 6}) {
+                // 读卡器
+                Column() {
+                  Row({space: 5}) {
+                    Circle()
+                      .width($r('app.float.virtualSize_14'))
+                      .height($r('app.float.virtualSize_14'))
+                      .fill(this.cardReader.OnlineStatus === 1 ? $r('app.color.30D158') : $r('app.color.15FFFFFF'))
+                    Text('读卡器')
+                      .fontColor($r('app.color.FFFFFF'))
+                      .fontSize($r('app.float.fontSize_24'))
+                      .fontWeight(FontWeight.Medium)
+                  }
+                  .height('43.4%')
+                  .width('84.9%')
+                  Column() {
+                    Row() {
+                      Text('读到卡号 ')
+                        .fontColor($r('app.color.FFFFFF'))
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontWeight(FontWeight.Lighter)
+                      Text(this.cardReader?.RfidCardNum1 && this.cardReader?.RfidCardNum2 ? this.cardReader.RfidCardNum1 + this.cardReader.RfidCardNum2 : '-')
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontColor(this.cardReader?.RfidCardNum1 && this.cardReader?.RfidCardNum2 ? $r('app.color.0A84FF') : $r('app.color.20FFFFFF'))
+                        .fontWeight(FontWeight.Bold)
+                    }
+                    .width('100%')
+                    .padding({left: '19.2%'})
+                  }
+                  .height('56.6%')
+                  .width('100%')
+                }
+                .height('100%')
+                .width('44.2%')
+                .backgroundColor($r('app.color.10FFFFFF'))
+                .borderRadius($r('app.float.virtualSize_16'))
+                // 温湿度传感器
+                Column() {
+                  Row({space: 5}) {
+                    Circle()
+                      .width($r('app.float.virtualSize_14'))
+                      .height($r('app.float.virtualSize_14'))
+                      .fill(this.tempHumiditySensor.OnlineStatus === 1 ? $r('app.color.30D158') : $r('app.color.15FFFFFF'))
+                    Text('温湿度计')
+                      .fontColor($r('app.color.FFFFFF'))
+                      .fontSize($r('app.float.fontSize_24'))
+                      .fontWeight(FontWeight.Medium)
+                  }
+                  .height('43.4%')
+                  .width('84.9%')
+                  Column() {
+                    Row() {
+                      Text('温度 ')
+                        .fontColor($r('app.color.FFFFFF'))
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontWeight(FontWeight.Lighter)
+                      Text(this.tempHumiditySensor?.Temperature ? this.tempHumiditySensor.Temperature / 10 + '℃' : '-')
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontColor(this.tempHumiditySensor?.Temperature ? $r('app.color.0A84FF') : $r('app.color.20FFFFFF'))
+                        .fontWeight(FontWeight.Bold)
+                    }
+                    .width('100%')
+                    .padding({left: '19.2%'})
+                    Row() {
+                      Text('湿度 ')
+                        .fontColor($r('app.color.FFFFFF'))
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontWeight(FontWeight.Lighter)
+                      Text(this.tempHumiditySensor?.Humidity ? this.tempHumiditySensor.Humidity / 10 + '%RH' : '-')
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontColor(this.tempHumiditySensor?.Temperature ? $r('app.color.0A84FF') : $r('app.color.20FFFFFF'))
+                        .fontWeight(FontWeight.Bold)
+                    }
+                    .width('100%')
+                    .padding({left: '19.2%'})
+                  }
+                  .height('56.6%')
+                  .width('100%')
+                }
+                .height('100%')
+                .width('44.2%')
+                .backgroundColor($r('app.color.10FFFFFF'))
+                .borderRadius($r('app.float.virtualSize_16'))
+              }
+              .height('18.9%')
+              .width('100%')
+              .justifyContent(FlexAlign.Center)
+              // 扫码枪+防静电手环
+              Row({space: 6}) {
+                // 扫码枪
+                Column() {
+                  Row({space: 5}) {
+                    Circle()
+                      .width($r('app.float.virtualSize_14'))
+                      .height($r('app.float.virtualSize_14'))
+                      .fill(this.scanningGunStatus ? $r('app.color.30D158') : $r('app.color.15FFFFFF'))
+                    Text('扫码枪')
+                      .fontColor($r('app.color.FFFFFF'))
+                      .fontSize($r('app.float.fontSize_24'))
+                      .fontWeight(FontWeight.Medium)
+                  }
+                  .height('43.4%')
+                  .width('84.9%')
+                }
+                .height('100%')
+                .width('44.2%')
+                .backgroundColor($r('app.color.10FFFFFF'))
+                .borderRadius($r('app.float.virtualSize_16'))
+                // 防静电手环
+                Column() {
+                  Row({space: 5}) {
+                    Circle()
+                      .width($r('app.float.virtualSize_14'))
+                      .height($r('app.float.virtualSize_14'))
+                      .fill(this.tempHumiditySensor.OnlineStatus === 1 ? $r('app.color.30D158') : $r('app.color.15FFFFFF'))
+                    Text('防静电手环')
+                      .fontColor($r('app.color.FFFFFF'))
+                      .fontSize($r('app.float.fontSize_24'))
+                      .fontWeight(FontWeight.Medium)
+                  }
+                  .height('43.4%')
+                  .width('84.9%')
+                  Column() {
+                    Row() {
+                      Text('佩戴 ')
+                        .fontColor($r('app.color.FFFFFF'))
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontWeight(FontWeight.Lighter)
+                      Text(this.wristStrap?.RingWearNormal! === 1 ? '是' : '否')
+                        .fontSize($r('app.float.fontSize_16'))
+                        .fontColor(this.wristStrap?.RingWearNormal! === 1 ? $r('app.color.0A84FF') : $r('app.color.20FFFFFF'))
+                        .fontWeight(FontWeight.Bold)
+                    }
+                    .width('100%')
+                    .padding({left: '19.2%'})
+                  }
+                  .height('56.6%')
+                  .width('100%')
+                }
+                .height('100%')
+                .width('44.2%')
+                .backgroundColor($r('app.color.10FFFFFF'))
+                .borderRadius($r('app.float.virtualSize_16'))
+              }
+              .height('18.9%')
+              .width('100%')
+              .justifyContent(FlexAlign.Center)
             }
-            .height('16%')
             .width('100%')
-            .justifyContent(FlexAlign.Center)
+            .layoutWeight(1)
+            .justifyContent(FlexAlign.SpaceBetween)
           }
           .width('31.3%')
           .height('100%')
@@ -563,6 +1026,4 @@ export struct AuxiliaryOperationDialog {
         .combine(TransitionEffect.translate({ y: 300 })) // 初始位置在屏幕下方
     )
   }
-
-
 }

+ 8 - 3
entry/src/main/ets/view/LoginInfoDialog.ets

@@ -10,6 +10,8 @@ export struct LoginInfoDialog {
   private scrollerList: Scroller = new Scroller()
   //当前工位
   @Consume('currentStation') currentStation: string
+  //当前工位id
+  @Consume('currentStationId') @Watch('loadStationMessage') currentStationId: string
   //当前部门
   @Consume('currentDept') currentDept: string
   //当前产线
@@ -48,7 +50,7 @@ export struct LoginInfoDialog {
       userName: this.userName,
       jobNumber: this.employeeCode,
     } as RequestParamModel) ;
-    if (!token || token.length == 0)  return
+    if (!token || token.length == 0) return
     CommonConstants.AUTH_TOKEN = token
     this.currentUserName = this.userName
     let res:UserInfo = await ProcessRequest.get('/api/auth') ;
@@ -60,8 +62,9 @@ export struct LoginInfoDialog {
     this.loginFlag = 3
   }
 
-  loadStationMessage= async ()=>{
+  async loadStationMessage() {
     let res = await ProcessRequest.post('/api/v1/sys/message/stationMessage', {
+      stationId: this.currentStationId
     } as RequestParamModel) as MessagePage;
     this.messages=res?.records??[]
     this.messages = [...this.messages].sort((a, b) => {
@@ -119,7 +122,9 @@ export struct LoginInfoDialog {
 
   async aboutToAppear() {
     if (this.currentUserName) {
-      this.loadStationMessage()
+      if (this.currentStationId) {
+        this.loadStationMessage()
+      }
       this.loginUser = await ProcessRequest.post('/api/v1/sys/user/get', {id: this.currentUserId!} as RequestParamModel) as UserInfo
       if (this.loginUser.depts) {
         this.loginUser.deptNames = this.loginUser?.depts[0]?.deptName!

+ 4 - 0
entry/src/main/resources/base/element/font.json

@@ -69,6 +69,10 @@
       "value": "9.6vp"
     },
     {
+      "name": "virtualSize_14",
+      "value": "8.4vp"
+    },
+    {
       "name": "virtualSize_12",
       "value": "7.2vp"
     },

+ 1 - 0
entry/src/main/resources/base/profile/main_pages.json

@@ -1,5 +1,6 @@
 {
   "src": [
+    "pages/DeviceControllerPage",
     "pages/ProcessIndex"
   ]
 }