hh 2 هفته پیش
والد
کامیت
fb8064f48d

+ 2 - 1
entry/src/main/ets/common/constants/CommonConstants.ets

@@ -30,7 +30,8 @@ export default class CommonConstants {
   static readonly STORAGE_TYPE: string[] = ['电子元器件', '电路板', '结构件', '辅助材料']
   static readonly ipPrefix: string = '192.168.1.'
   static mqttSubscribeTopic1: string = 'station11/data/devices';
-  static readonly mqttSubscribeTopic2: string = 'station100/data/devices';
+  static readonly mqttSubscribeTopic2: string = 'station11/data/devices';
+  static readonly mqttSubscribeTopic3: string = 'station100/data/devices';
   static readonly mqttSubscribePublish: string = 'station11/cmd/devices';
   // 默认随机ip
   static readonly STATION_DEFAULT_IP: string = '192.168.1.' + Math.floor(Math.random() * 90 + 10)

+ 20 - 1
entry/src/main/ets/common/util/Mqtt.ets

@@ -183,9 +183,28 @@ class MqttManager {
           AppStorage.setOrCreate<Lighting>('Lighting', device6)
           AppStorage.setOrCreate<TempHumiditySensor>('TempHumiditySensor', device7)
         }
+      } else if (CommonConstants.mqttSubscribeTopic2 == topic) {
+        //订阅主题二的接收数据
+        let device0: TempHumiditySensor = { Temperature: 0, Humidity: 0, OnlineStatus: 0 }
+        for (const element of valueJson.d) {
+          if (CommonConstants.attrMap.has(element.tag)) {
+            let deviceType: string = CommonConstants.attrMap.get(element.tag) ?? '';
+            switch (deviceType) {
+              case DeviceType.TempHumiditySensor:
+                if (element.tag! === 'Temperature') {
+                  device0.Temperature = element.value
+                } else if (element.tag! === 'Humidity') {
+                  device0.Humidity = element.value
+                }
+                device0.OnlineStatus = 1
+                break;
+            }
+          }
+        }
+        AppStorage.setOrCreate<TempHumiditySensor>('TempHumiditySensor', device0);
       }
       //订阅主题二的接收数据
-      else if(CommonConstants.mqttSubscribeTopic2 == topic){
+      else if(CommonConstants.mqttSubscribeTopic3 == topic){
         const station1Set = valueJson?.d?.find(item => item.tag === 'Station1Set')?.value;
         const station1Weight = decodeWeight(valueJson?.d?.find(item => item.tag === 'Station1Weight')?.value);
         const rfidStringIn = decodeRfidString(

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

@@ -12,7 +12,7 @@ import { printError, printRequest, printResponse, handleRes } from './Helps';
 
 // jiaxiaoqiang:这里要改
  const baseUrl = "http://192.168.1.3:30010"//huajing
-// const baseUrl = "http://192.168.1.246:8058" // huhao本地
+// const baseUrl = "http://192.168.1.246:30010" // huhao本地
 const DEBUG = true //
 
 // 创建实例

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

@@ -269,6 +269,7 @@ struct ProcessIndex {
       if (this.isConnected ) {
         console.info('hhtest', 'MQTT connected successfully');
         await MqttManager.subscribe(CommonConstants.mqttSubscribeTopic1);
+        await MqttManager.subscribe(CommonConstants.mqttSubscribeTopic3);
         if (CommonConstants.mqttSubscribeTopic1 != CommonConstants.mqttSubscribeTopic2) {
           await MqttManager.subscribe(CommonConstants.mqttSubscribeTopic2);
         }
@@ -302,8 +303,8 @@ struct ProcessIndex {
           connectionProperties.linkAddresses.forEach((address: connection.LinkAddress, index: number) => {
             this.stationIp = address.address.address
             if (address.address.address.startsWith(CommonConstants.ipPrefix)) {
-              CommonConstants.mqttSubscribeTopic1 = 'station' + address.address.address.replace(CommonConstants.ipPrefix, '') + '/data/devices'
               // todo 部署时放开注释
+              // CommonConstants.mqttSubscribeTopic1 = 'station' + address.address.address.replace(CommonConstants.ipPrefix, '') + '/data/devices'
               // CommonConstants.mqttSubscribePublish = 'station' + address.address.address.replace(CommonConstants.ipPrefix, '') + '/cmd/devices'
             }
           })

+ 8 - 8
entry/src/main/ets/view/AuxiliaryOperationView.ets

@@ -806,12 +806,12 @@ export struct AuxiliaryOperationView {
                   .width('84.9%')
                   Column() {
                     Row() {
-                      Text('预设转速 ')
+                      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'))
+                      Text(this.screwdriver.OnlineStatus != 1 ? '-' : (this.screwdriver.TighteRotationDirection! === 0 ? '顺时针' : '逆时针'))
+                        .fontColor(this.screwdriver.OnlineStatus === 1 ? $r('app.color.0A84FF') : $r('app.color.20FFFFFF'))
                         .fontSize($r('app.float.fontSize_16'))
                         .fontWeight(FontWeight.Bold)
                     }
@@ -821,19 +821,19 @@ export struct AuxiliaryOperationView {
                         .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'))
+                      Text(this.screwdriver.OnlineStatus === 1 && this.screwdriver.TightenTorqueTarget ? this.screwdriver.TightenTorqueTarget + 'Kgf.cm' : '-')
+                        .fontColor(this.screwdriver.OnlineStatus === 1 && this.screwdriver.TightenTorqueTarget ? $r('app.color.0A84FF') : $r('app.color.20FFFFFF'))
                         .fontSize($r('app.float.fontSize_16'))
                         .fontWeight(FontWeight.Bold)
                     }
                     .width('100%')
                     Row() {
-                      Text('预设圈数 ')
+                      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'))
+                      Text(this.screwdriver.OnlineStatus === 1 && this.screwdriver.FloatDetectionTurns ? this.solderingIron + 'r' : '-')
+                        .fontColor(this.screwdriver.OnlineStatus === 1 && this.screwdriver.FloatDetectionTurns ? $r('app.color.0A84FF') : $r('app.color.20FFFFFF'))
                         .fontSize($r('app.float.fontSize_16'))
                         .fontWeight(FontWeight.Bold)
                     }