|
@@ -4,6 +4,7 @@ import MechanicalArmDebuggingRequest from '../common/util/request/MechanicalArmD
|
|
|
import RobotInfo from '../model/RobotInfo'
|
|
|
import RequestParam from '../viewmodel/RobotErrorHandle/RequestParam'
|
|
|
import router from '@ohos.router'
|
|
|
+import promptAction from '@ohos.promptAction'
|
|
|
@Entry
|
|
|
@Component
|
|
|
export struct RobotErrorHandle {
|
|
@@ -15,7 +16,7 @@ export struct RobotErrorHandle {
|
|
|
@State HingingLevel: number = 0
|
|
|
@State HingingIndex: number = 0
|
|
|
@State HingingString: string = '原位'
|
|
|
- @State colorArray: number[] = [1,1,1,1,1,1,1,1,1,1,1,1,1,1]
|
|
|
+ @State colorArray: number[] = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
|
|
|
@State clickStatus: number[] = [1,1,1,1,1,1,1,1,1,1,1,1,1,1]
|
|
|
@State reminds:string='1'
|
|
|
@State robotArray: Array<SelectOption> = []
|
|
@@ -54,7 +55,16 @@ export struct RobotErrorHandle {
|
|
|
autoCancel: true,
|
|
|
customStyle: true,
|
|
|
})
|
|
|
-
|
|
|
+ //坐标移动小车控制器
|
|
|
+ setRobotByXYController: CustomDialogController = new CustomDialogController({
|
|
|
+ builder: SetRobotByXYDialog({
|
|
|
+ robots: this.robots,
|
|
|
+ selectRobot: this.selectRobot,
|
|
|
+ }),
|
|
|
+ alignment: DialogAlignment.Center,
|
|
|
+ autoCancel: true,
|
|
|
+ customStyle: true,
|
|
|
+ })
|
|
|
/*handleMoveErrorController: CustomDialogController = new CustomDialogController({
|
|
|
builder: HandleMoveErrorDialog({
|
|
|
robots: this.robots,
|
|
@@ -141,10 +151,9 @@ export struct RobotErrorHandle {
|
|
|
|
|
|
Divider().vertical(true).color($r('app.color.black_100')).height('80%')
|
|
|
.margin({right: '2%'})
|
|
|
-
|
|
|
Row() {
|
|
|
Column() {
|
|
|
- Text('设置小车位置')
|
|
|
+ Text('坐标移动小车')
|
|
|
.fontSize($r('app.float.robot_set_font_size'))
|
|
|
.fontWeight(FontWeight.Medium)
|
|
|
.margin({left: '10%'})
|
|
@@ -152,27 +161,28 @@ export struct RobotErrorHandle {
|
|
|
.width('70%')
|
|
|
|
|
|
Column() {
|
|
|
- Image($r('app.media.coordinate_edit'))
|
|
|
+ Image($r('app.media.single_move'))
|
|
|
.width('55px')
|
|
|
.height('55px')
|
|
|
}
|
|
|
.width('30%')
|
|
|
}
|
|
|
- .width('20%')
|
|
|
+ .width('15%')
|
|
|
.height('60%')
|
|
|
- .backgroundColor(this.colorArray[0] == 1 ? $r('app.color.process_divider_white_color') : $r('app.color.process_nameplate_grey_color'))
|
|
|
+ .backgroundColor(this.colorArray[14] == 1 ? $r('app.color.process_divider_white_color') : $r('app.color.process_nameplate_grey_color'))
|
|
|
.alignItems(VerticalAlign.Center)
|
|
|
.justifyContent(FlexAlign.End)
|
|
|
.borderRadius($r('app.float.process_call_image_radius'))
|
|
|
.margin({right: '2%' })
|
|
|
.onClick(async ()=>{
|
|
|
- this.colorArray[0] = 2
|
|
|
+ this.colorArray[14] = 2
|
|
|
delayExecution(()=>{
|
|
|
- this.colorArray[0] = 1
|
|
|
+ this.colorArray[14] = 1
|
|
|
}, 100)
|
|
|
- this.setRobotLocationController.open()
|
|
|
+ this.setRobotByXYController.open()
|
|
|
})
|
|
|
|
|
|
+
|
|
|
Row() {
|
|
|
Column() {
|
|
|
Text('查询小车位置')
|
|
@@ -189,7 +199,7 @@ export struct RobotErrorHandle {
|
|
|
}
|
|
|
.width('30%')
|
|
|
}
|
|
|
- .width('20%')
|
|
|
+ .width('15%')
|
|
|
.height('60%')
|
|
|
.backgroundColor(this.colorArray[1] == 1 ? $r('app.color.process_divider_white_color') : $r('app.color.process_nameplate_grey_color'))
|
|
|
.alignItems(VerticalAlign.Center)
|
|
@@ -236,7 +246,7 @@ export struct RobotErrorHandle {
|
|
|
}
|
|
|
.width('30%')
|
|
|
}
|
|
|
- .width('20%')
|
|
|
+ .width('15%')
|
|
|
.height('60%')
|
|
|
.backgroundColor(this.colorArray[12] == 1 ? $r('app.color.process_divider_white_color') : $r('app.color.process_nameplate_grey_color'))
|
|
|
.alignItems(VerticalAlign.Center)
|
|
@@ -296,7 +306,7 @@ export struct RobotErrorHandle {
|
|
|
}
|
|
|
.width('30%')
|
|
|
}
|
|
|
- .width('20%')
|
|
|
+ .width('15%')
|
|
|
.height('60%')
|
|
|
.backgroundColor(this.colorArray[13] == 1 ? $r('app.color.process_divider_white_color') : $r('app.color.process_nameplate_grey_color'))
|
|
|
.alignItems(VerticalAlign.Center)
|
|
@@ -311,7 +321,36 @@ export struct RobotErrorHandle {
|
|
|
this.RobotSingleMoveController.open()
|
|
|
})
|
|
|
|
|
|
+ Row() {
|
|
|
+ Column() {
|
|
|
+ Text('设置小车位置')
|
|
|
+ .fontSize($r('app.float.robot_set_font_size'))
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .margin({left: '10%'})
|
|
|
+ }
|
|
|
+ .width('70%')
|
|
|
|
|
|
+ Column() {
|
|
|
+ Image($r('app.media.coordinate_edit'))
|
|
|
+ .width('55px')
|
|
|
+ .height('55px')
|
|
|
+ }
|
|
|
+ .width('30%')
|
|
|
+ }
|
|
|
+ .width('15%')
|
|
|
+ .height('60%')
|
|
|
+ .backgroundColor(this.colorArray[0] == 1 ? $r('app.color.process_divider_white_color') : $r('app.color.process_nameplate_grey_color'))
|
|
|
+ .alignItems(VerticalAlign.Center)
|
|
|
+ .justifyContent(FlexAlign.End)
|
|
|
+ .borderRadius($r('app.float.process_call_image_radius'))
|
|
|
+ .margin({right: '2%' })
|
|
|
+ .onClick(async ()=>{
|
|
|
+ this.colorArray[0] = 2
|
|
|
+ delayExecution(()=>{
|
|
|
+ this.colorArray[0] = 1
|
|
|
+ }, 100)
|
|
|
+ this.setRobotLocationController.open()
|
|
|
+ })
|
|
|
}
|
|
|
.height('22%')
|
|
|
.width('100%')
|
|
@@ -1405,6 +1444,173 @@ struct SetRobotLocationDialog {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+//坐标移动小车位置弹窗
|
|
|
+@CustomDialog
|
|
|
+struct SetRobotByXYDialog {
|
|
|
+ controller: CustomDialogController
|
|
|
+
|
|
|
+ @Link robots: RobotInfo[]
|
|
|
+ @Link selectRobot: number
|
|
|
+
|
|
|
+ @State robotX: number = 0
|
|
|
+ @State robotY: number = 0
|
|
|
+ @State tempSelect: number = 1
|
|
|
+ @State robotArray: Array<SelectOption> = []
|
|
|
+ aboutToAppear(): void {
|
|
|
+ this.tempSelect = this.selectRobot
|
|
|
+ if (this.robots && this.robots.length > 0) {
|
|
|
+ for (const robot of this.robots ) {
|
|
|
+ let option: SelectOption = { value: robot.robotCode ? robot.robotCode : ''}
|
|
|
+ this.robotArray.push(option)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ build() {
|
|
|
+ Column() {
|
|
|
+ Row(){
|
|
|
+ Text('坐标移动小车')
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .fontSize($r('app.float.fontSize_50'))
|
|
|
+ }
|
|
|
+ .height('20%')
|
|
|
+
|
|
|
+ Row() {
|
|
|
+ Text('机器人:')
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .fontSize($r('app.float.fontSize_18'))
|
|
|
+ .width('20%')
|
|
|
+ .height('100%')
|
|
|
+ .textAlign(TextAlign.End)
|
|
|
+ Select(this.robotArray)
|
|
|
+ .selected(this.selectRobot)
|
|
|
+ .value(this.robots && this.robots[this.selectRobot] && this.robots[this.selectRobot].robotCode ? this.robots[this.selectRobot].robotCode : '')
|
|
|
+ .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'))
|
|
|
+ .width('60%')
|
|
|
+ .height('100%')
|
|
|
+ .backgroundColor($r('app.color.robot_set_coord_card_grey'))
|
|
|
+ .selectedOptionFontColor($r('app.color.blue_100'))
|
|
|
+ .selectedOptionFont({size: $r('app.float.fontSize_16'), weight: FontWeight.Bold})
|
|
|
+ .optionFontColor($r('app.color.black_100'))
|
|
|
+ .optionFont({size: $r('app.float.fontSize_16'), weight: FontWeight.Medium})
|
|
|
+ .menuAlign(MenuAlignType.START, {dx:0, dy:0})
|
|
|
+ .onSelect((index: number) => {
|
|
|
+ console.log('hhtest', index);
|
|
|
+ this.tempSelect = index
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .width('80%')
|
|
|
+ .height('15%')
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+
|
|
|
+ Row(){
|
|
|
+ Text('X轴:')
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .fontSize($r('app.float.fontSize_18'))
|
|
|
+ .width('20%')
|
|
|
+ .height('100%')
|
|
|
+ .textAlign(TextAlign.End)
|
|
|
+ TextInput({ placeholder: '请输入数字', text: this.robotX + ''})
|
|
|
+ .placeholderColor($r('app.color.login_text_input_placeholder_color'))
|
|
|
+ .placeholderFont({ size: $r('app.float.robot_set_font_size'), weight: FontWeight.Medium })
|
|
|
+ .fontColor($r('app.color.login_text_input_font_color'))
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .type(InputType.Number)
|
|
|
+ .maxLength(6)
|
|
|
+ .fontSize($r('app.float.fontSize_24'))
|
|
|
+ .width('60%')
|
|
|
+ .height('100%')
|
|
|
+ .opacity($r('app.float.general_font_opacity'))
|
|
|
+ .borderRadius($r('app.float.general_border_radius'))
|
|
|
+ .backgroundColor($r('app.color.robot_set_coord_card_grey'))
|
|
|
+ .onChange((value: string) => {
|
|
|
+ this.robotX = parseInt(value)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .width('80%')
|
|
|
+ .height('15%')
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+
|
|
|
+ Row(){
|
|
|
+ Text('Y轴:')
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .fontSize($r('app.float.fontSize_18'))
|
|
|
+ .width('20%')
|
|
|
+ .height('100%')
|
|
|
+ .textAlign(TextAlign.End)
|
|
|
+ TextInput({ placeholder: '请输入数字', text: this.robotY + ''})
|
|
|
+ .placeholderColor($r('app.color.login_text_input_placeholder_color'))
|
|
|
+ .placeholderFont({ size: $r('app.float.robot_set_font_size'), weight: FontWeight.Medium })
|
|
|
+ .fontColor($r('app.color.login_text_input_font_color'))
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .type(InputType.Number)
|
|
|
+ .maxLength(6)
|
|
|
+ .fontSize($r('app.float.fontSize_24'))
|
|
|
+ .width('60%')
|
|
|
+ .height('100%')
|
|
|
+ .opacity($r('app.float.general_font_opacity'))
|
|
|
+ .borderRadius($r('app.float.general_border_radius'))
|
|
|
+ .backgroundColor($r('app.color.robot_set_coord_card_grey'))
|
|
|
+ .onChange((value: string) => {
|
|
|
+ this.robotY = parseInt(value)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .width('80%')
|
|
|
+ .height('15%')
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+
|
|
|
+ Row() {
|
|
|
+ Button('取消')
|
|
|
+ .fontSize($r('app.float.robot_set_font_size'))
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .fontColor($r('app.color.robot_set_card_blue'))
|
|
|
+ .width('32%')
|
|
|
+ .height('50%')
|
|
|
+ .borderRadius($r('app.float.robot_set_radius'))
|
|
|
+ .backgroundColor($r('app.color.robot_set_coord_card_grey'))
|
|
|
+ .onClick(() => {
|
|
|
+ this.controller?.close()
|
|
|
+ })
|
|
|
+ Row()
|
|
|
+ .width('2.5%')
|
|
|
+ Button('确认')
|
|
|
+ .fontSize($r('app.float.robot_set_font_size'))
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .fontColor($r('app.color.general_font_white_color'))
|
|
|
+ .width('32%')
|
|
|
+ .height('50%')
|
|
|
+ .borderRadius($r('app.float.robot_set_radius'))
|
|
|
+ .backgroundColor($r('app.color.robot_set_card_blue'))
|
|
|
+ .onClick(async() => {
|
|
|
+ this.selectRobot = this.tempSelect
|
|
|
+ promptAction.showToast({
|
|
|
+ message: "任务进行中,请等待....",
|
|
|
+ duration: 1800,
|
|
|
+ bottom: '50%'
|
|
|
+ })
|
|
|
+ this.controller?.close()
|
|
|
+ let res: object = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/movergv', {
|
|
|
+ rgvNo: this.robots[this.selectRobot].robotCode,
|
|
|
+ destX: this.robotX.toString(),
|
|
|
+ destY: this.robotY.toString()
|
|
|
+ } as RequestParam)
|
|
|
+ console.log('移动机器人位置:' + res.toString())
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ .height('25%')
|
|
|
+ .width('100%')
|
|
|
+
|
|
|
+ }
|
|
|
+ .width('48%')
|
|
|
+ .height('74%')
|
|
|
+ .backgroundColor($r('app.color.page_general_background'))
|
|
|
+ .justifyContent(FlexAlign.SpaceBetween)
|
|
|
+ .borderRadius($r('app.float.general_border_radius'))
|
|
|
+ }
|
|
|
+}
|
|
|
//处理移动错误弹窗
|
|
|
/*@CustomDialog
|
|
|
struct HandleMoveErrorDialog {
|