Browse Source

机器人异常处理

huhao@jgai.com 3 months ago
parent
commit
0c9b0e95b6
1 changed files with 33 additions and 28 deletions
  1. 33 28
      entry/src/main/ets/pages/RobotErrorHandle.ets

+ 33 - 28
entry/src/main/ets/pages/RobotErrorHandle.ets

@@ -1,7 +1,5 @@
 import CommonConstants from '../common/constants/CommonConstants'
 import RobotErrorHandleRequest from '../common/util/request/RobotErrorHandleRequest'
-import StorageRequest from '../common/util/request/StorageRequest'
-import MaterialBox from '../model/MaterialBox'
 import RobotInfo from '../model/RobotInfo'
 import RequestParam from '../viewmodel/RobotErrorHandle/RequestParam'
 import router from '@ohos.router'
@@ -710,10 +708,11 @@ struct HandleMoveErrorDialog {
   @State robotY: number = 0
   @State tempSelect: number = 1
   @State robotArray: Array<SelectOption> = []
-  @State vehicleArray: Array<SelectOption> = []
-  @State vehicleCode: string = ''
-  @State vehicleX: string = ''
-  @State vehicleY: string = ''
+  // 料箱
+  @State boxArray: Array<SelectOption> = []
+  @State boxCode: string = ''
+  @State boxX: string = ''
+  @State boxY: string = ''
   async aboutToAppear() {
     this.tempSelect = this.selectRobot
     if (this.robots && this.robots.length > 0) {
@@ -723,13 +722,11 @@ struct HandleMoveErrorDialog {
       }
     }
 
-    let res : Array<MaterialBox> = await StorageRequest.post('/api/v1/wms/vehicle/list', {
-      category: 0
-    } as RequestParam)
+    let res : Array<BoxInfo> = await RobotErrorHandleRequest.get('/api/v1/wcs/boxs', {})
     if (res && res.length > 0) {
-      for (const vehicle of res ) {
-        let option: SelectOption = { value: vehicle.code ? vehicle.code : '' }
-        this.vehicleArray.push(option)
+      for (const box of res ) {
+        let option: SelectOption = { value: box.no ? box.no : '' }
+        this.boxArray.push(option)
       }
     }
   }
@@ -750,8 +747,8 @@ struct HandleMoveErrorDialog {
             .fontSize($r('app.float.fontSize_18'))
             .width('30%')
             .height('100%')
-          Select(this.vehicleArray)
-            .value(this.vehicleCode)
+          Select(this.boxArray)
+            .value(this.boxCode)
             .font({ size: $r('app.float.robot_set_font_size'), weight: FontWeight.Medium})
             .fontColor($r('app.color.black_100'))
             .borderRadius($r('app.float.general_border_radius'))
@@ -764,14 +761,14 @@ struct HandleMoveErrorDialog {
             .optionFont({size: $r('app.float.fontSize_16'), weight: FontWeight.Medium})
             .menuAlign(MenuAlignType.START, {dx:0, dy:0})
             .onSelect(async (index: number) => {
-              this.vehicleCode = this.vehicleArray[index].value.toString()
-              if (this.vehicleCode && this.vehicleCode.length > 0) {
-                let res: VehicleLocation = await RobotErrorHandleRequest.get('/api/v1/wcs/box/state/' + this.vehicleCode, {}) as VehicleLocation
+              this.boxCode = this.boxArray[index].value.toString()
+              if (this.boxCode && this.boxCode.length > 0) {
+                let res: BoxLocation = await RobotErrorHandleRequest.get('/api/v1/wcs/box/state/' + this.boxCode, {}) as BoxLocation
                 if (res && res.pos && res.pos.length > 0 && res.pos.includes('-')) {
                   let strArray: string[] = res.pos.split('-')
                   if (strArray.length === 2) {
-                    this.vehicleX = strArray[0]
-                    this.vehicleY = strArray[1]
+                    this.boxX = strArray[0]
+                    this.boxY = strArray[1]
                   }
                 }
               }
@@ -787,7 +784,7 @@ struct HandleMoveErrorDialog {
             .fontSize($r('app.float.fontSize_18'))
             .width('20%')
             .height('100%')
-          Text(this.vehicleX)
+          Text(this.boxX)
             .fontColor($r('app.color.login_text_input_font_color'))
             .fontWeight(FontWeight.Medium)
             .fontSize($r('app.float.fontSize_24'))
@@ -807,7 +804,7 @@ struct HandleMoveErrorDialog {
             .fontSize($r('app.float.fontSize_18'))
             .width('20%')
             .height('100%')
-          Text(this.vehicleY)
+          Text(this.boxY)
             .fontColor($r('app.color.login_text_input_font_color'))
             .fontWeight(FontWeight.Medium)
             .fontSize($r('app.float.fontSize_24'))
@@ -983,16 +980,24 @@ struct HandleMoveErrorDialog {
   }
 }
 
-class VehicleLocation {
-  // 载具坐标
-  pos?: string
-  // 载具层级
-  level?: number
-}
-
 function delayExecution(callback: Function, delay: number) {
   let timerId = setInterval(() => {
     clearInterval(timerId);
     callback();
   }, delay);
+}
+
+class BoxInfo {
+  no?: string
+  x?: string
+  y?: string
+  level?: string
+}
+
+
+class BoxLocation {
+  // 载具坐标
+  pos?: string
+  // 载具层级
+  level?: number
 }