import CommonConstants from '../common/constants/CommonConstants' import RobotErrorHandleRequest from '../common/util/request/RobotErrorHandleRequest' import MechanicalArmDebuggingRequest from '../common/util/request/MechanicalArmDebuggingRequest' import RobotInfo from '../model/RobotInfo' import RequestParam from '../viewmodel/RobotErrorHandle/RequestParam' import router from '@ohos.router' @Entry @Component export struct RobotErrorHandle { @State robots: RobotInfo[] = CommonConstants.ROBOTS @State list: Resource[] = [$r('app.media.car_preview'), $r('app.media.car_preview')] @State selectRobot: number = 0 @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 clickStatus: number[] = [1,1,1,1,1,1,1,1,1,1,1,1,1,1] @State reminds:string='1' @State robotArray: Array = [] aboutToAppear(): void { 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) } } } remindController: CustomDialogController = new CustomDialogController({ builder: RemindDialog({ remind: this.reminds,} ), }) RobotSingleMoveController: CustomDialogController = new CustomDialogController({ builder: RobotSingleMoveDialog({ robots: this.robots, selectRobot: this.selectRobot, } ), alignment: DialogAlignment.Center, autoCancel: true, customStyle: true, }) setRobotLocationController: CustomDialogController = new CustomDialogController({ builder: SetRobotLocationDialog({ robots: this.robots, selectRobot: this.selectRobot, }), alignment: DialogAlignment.Center, autoCancel: true, customStyle: true, }) /*handleMoveErrorController: CustomDialogController = new CustomDialogController({ builder: HandleMoveErrorDialog({ robots: this.robots, selectRobot: this.selectRobot, }), alignment: DialogAlignment.Center, autoCancel: true, customStyle: true, })*/ build() { Column() { Row() { Row() { Image($r('app.media.return')) .height(px2vp(48)) .width(px2vp(48)) .onClick(async () => { router.back() }) } .width('20%') Row() { Text('机器人控制') .padding(10) .height('100%') .fontSize($r('app.float.title_font_size')) } .justifyContent(FlexAlign.End) .width('40%') 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('40%') .height('100%') .margin({right: '5%'}) .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) => { this.selectRobot = index }) } .width('40%') .height('100%') .justifyContent(FlexAlign.End) } .width('100%') .height('8%') .padding({ left: px2vp(24) }) .alignItems(VerticalAlign.Center) .justifyContent(FlexAlign.Start) Row(){ Column() { Image($r('app.media.robot_move')) .width($r('app.float.general_icon_size')) .height($r('app.float.general_icon_size')) Text('位移') .fontSize($r('app.float.set_card_font_size')) .fontColor($r('app.color.general_font_color')) .opacity($r('app.float.general_font_opacity')) .fontWeight(FontWeight.Medium) } .borderRadius($r('app.float.general_border_radius')) .justifyContent(FlexAlign.Center) .width('10%') .height('100%') Divider().vertical(true).color($r('app.color.black_100')).height('80%') .margin({right: '2%'}) 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('20%') .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() }) Row() { Column() { Text('查询小车位置') .fontSize($r('app.float.robot_set_font_size')) .fontWeight(FontWeight.Medium) .margin({left: '10%'}) } .width('70%') Column() { Image($r('app.media.robot_list')) .width('55px') .height('55px') } .width('30%') } .width('20%') .height('60%') .backgroundColor(this.colorArray[1] == 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[1] = 2 delayExecution(()=>{ this.colorArray[1] = 1 }, 100) if (this.clickStatus[1] == 1) { this.clickStatus[1] = 2 delayExecution(()=>{ console.log('hhtest','状态修改') this.clickStatus[1] = 1 }, 2000) console.log('hhtest','执行函数:查询小车') let res: RgvInfo = await RobotErrorHandleRequest.get('/api/v1/wcs/rgv/' + this.robots[this.selectRobot].robotCode, {}) as RgvInfo if(res) { this.reminds = this.robots[this.selectRobot].robotCode+'小车位置:' + 'x:' + (res.x ? res.x : '') + ' y:' + (res.y ? res.y : ''); this.remindController.open() delayExecution(() => { console.log('hhtest', '状态修改') this.remindController.close() }, 2000) } } }) Row() { Column() { Text('查询小车状态') .fontSize($r('app.float.robot_set_font_size')) .fontWeight(FontWeight.Medium) .margin({left: '10%'}) } .width('70%') Column() { Image($r('app.media.search_state')) .width('55px') .height('55px') } .width('30%') } .width('20%') .height('60%') .backgroundColor(this.colorArray[12] == 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[12] = 2 delayExecution(()=>{ this.colorArray[12] = 1 }, 100) if (this.clickStatus[12] == 1) { this.clickStatus[12] = 2 delayExecution(()=>{ console.log('hhtest','状态修改') this.clickStatus[12] = 1 }, 2000) console.log('hhtest','执行函数:查询小车') let res: RgvInfo = await RobotErrorHandleRequest.get('/api/v1/wcs/rgv/' + this.robots[this.selectRobot].robotCode, {}) as RgvInfo let status:string = (res.status? res.status : '') if(status==='0') { this.reminds=this.robots[this.selectRobot].robotCode+'小车状态:静止' } else if (status==='1') { this.reminds=this.robots[this.selectRobot].robotCode+'小车状态:任务或充电' } else if (status==='2') { this.reminds=this.robots[this.selectRobot].robotCode+'小车状态:故障' } else{ this.reminds=this.robots[this.selectRobot].robotCode+'小车状态:故障' } this.remindController.open() delayExecution(() => { console.log('hhtest', '状态修改') this.remindController.close() }, 2000) } }) Row() { Column() { Text('单步移动小车') .fontSize($r('app.float.robot_set_font_size')) .fontWeight(FontWeight.Medium) .margin({left: '10%'}) } .width('70%') Column() { Image($r('app.media.single_move')) .width('55px') .height('55px') } .width('30%') } .width('20%') .height('60%') .backgroundColor(this.colorArray[13] == 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[13] = 2 delayExecution(()=>{ this.colorArray[13] = 1 }, 100) this.RobotSingleMoveController.open() }) } .height('22%') .width('100%') /* */ Row(){ Column() { Image($r('app.media.hanging_basket')) .width($r('app.float.general_icon_size')) .height($r('app.float.general_icon_size')) Text('吊篮') .fontSize($r('app.float.set_card_font_size')) .fontColor($r('app.color.general_font_color')) .opacity($r('app.float.general_font_opacity')) .fontWeight(FontWeight.Medium) } .borderRadius($r('app.float.general_border_radius')) .justifyContent(FlexAlign.Center) .width('10%') .height('100%') Divider().vertical(true).color($r('app.color.black_100')).height('80%') .margin({right: '2%'}) Row() { Column() { Text('移动吊盘') .fontSize($r('app.float.robot_set_font_size')) .fontWeight(FontWeight.Medium) .margin({left: '10%'}) } .width('70%') Column() { Image($r('app.media.hanging_basket_up')) .width('55px') .height('55px') } .width('30%') } .width('20%') .height('60%') .backgroundColor(this.colorArray[3] == 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[3] = 2 delayExecution(()=>{ this.colorArray[3] = 1 }, 100) if (this.clickStatus[3] == 1) { this.clickStatus[3] = 2 delayExecution(()=>{ console.log('hhtest','状态修改') this.clickStatus[3] = 1 }, 2000) console.log('hhtest','执行函数:移动吊盘') let res: object = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/moveBasket', { rgvNo: this.robots[this.selectRobot].robotCode, level: this.HingingLevel.toString(), } as RequestParam) console.log('移动吊盘:' + res.toString()) this.reminds = '移动吊盘' this.remindController.open() delayExecution(()=>{ console.log('hhtest','状态修改') this.remindController.close() }, 2000) } }) Row(){ Text('层数:') .fontWeight(FontWeight.Medium) .fontSize($r('app.float.fontSize_18')) .width('20%') .height('100%') .textAlign(TextAlign.End) // TextInput({ placeholder: '请输入数字', text: this.HingingLevel + ''}) // .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.HingingLevel = parseInt(value) // }) Select([ {value:"原位"}, {value:"第一层"}, {value:"第二层"}, {value:"第三层"}, {value:"第四层"}, {value:"第五层"}, {value:"第六层"}, {value:"抽屉位"}, ]) .selected(this.HingingIndex) .value(this.HingingString) .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('80%') .height('100%') .margin({right: '5%'}) .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,text:string) => { if(index!=7){ this.HingingLevel = index }else{ this.HingingLevel = 128 } this.HingingString = text this.HingingIndex = index }) } .width('20%') .height('30%') Row() { Column() { Text('抓夹张开') .fontSize($r('app.float.robot_set_font_size')) .fontWeight(FontWeight.Medium) .margin({left: '10%'}) } .width('70%') Column() { Image($r('app.media.open_zhuajia')) .width('55px') .height('55px') } .width('30%') } .width('20%') .height('60%') .backgroundColor(this.colorArray[4] == 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%',left:"23"}) .onClick(async ()=>{ this.colorArray[4] = 2 delayExecution(()=>{ this.colorArray[4] = 1 }, 100) if (this.clickStatus[4] == 1) { this.clickStatus[4] = 2 delayExecution(() => { console.log('hhtest', '状态修改') this.clickStatus[4] = 1 }, 2000) console.log('hhtest', '执行函数:张开抓夹') // 张开抓夹 let res: object = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/controlClip', { rgvNo: this.robots[this.selectRobot].robotCode, action: '1', } as RequestParam) console.log('抓夹张开:' + res.toString()) this.reminds = '抓夹张开' this.remindController.open() delayExecution(()=>{ this.remindController.close() }, 2000) } }) Row() { Column() { Text('抓夹闭合') .fontSize($r('app.float.robot_set_font_size')) .fontWeight(FontWeight.Medium) .margin({left: '10%'}) } .width('70%') Column() { Image($r('app.media.close_zhuajia')) .width('55px') .height('55px') } .width('30%') } .width('20%') .height('60%') .backgroundColor(this.colorArray[5] == 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[5] = 2 delayExecution(()=>{ this.colorArray[5] = 1 }, 100) if (this.clickStatus[5] == 1) { this.clickStatus[5] = 2 delayExecution(() => { console.log('hhtest', '状态修改') this.clickStatus[5] = 1 }, 2000) this.reminds = '抓夹闭合' this.remindController.open() delayExecution(()=>{ this.remindController.close() }, 2000) // 闭合抓夹 console.log('hhtest', '执行函数:闭合抓夹') let res: object = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/controlClip', { rgvNo: this.robots[this.selectRobot].robotCode, action: '2', } as RequestParam) console.log('抓夹闭合:' + res.toString()) this.reminds = '抓夹闭合' this.remindController.open() delayExecution(()=>{ this.remindController.close() }, 2000) } }) } .height('22%') .width('100%') Row(){ Column() { Image($r('app.media.robot_battery')) .width($r('app.float.general_icon_size')) .height($r('app.float.general_icon_size')) Text('电源') .fontSize($r('app.float.set_card_font_size')) .fontColor($r('app.color.general_font_color')) .opacity($r('app.float.general_font_opacity')) .fontWeight(FontWeight.Medium) } .borderRadius($r('app.float.general_border_radius')) .justifyContent(FlexAlign.Center) .width('10%') .height('100%') Divider().vertical(true).color($r('app.color.black_100')).height('80%') .margin({right: '2%'}) Row() { Column() { Text('电机开机') .fontSize($r('app.float.robot_set_font_size')) .fontWeight(FontWeight.Medium) .margin({left: '10%'}) } .width('70%') Column() { Image($r('app.media.electrical_machinery_on')) .width('55px') .height('55px') } .width('30%') } .width('20%') .height('60%') .backgroundColor(this.colorArray[6] == 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[6] = 2 delayExecution(()=>{ this.colorArray[6] = 1 }, 100) if (this.clickStatus[6] == 1) { this.clickStatus[6] = 2 delayExecution(() => { console.log('hhtest', '状态修改') this.clickStatus[6] = 1 }, 2000) console.log('hhtest', '执行函数:电机开机---') let res: object = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/rgvPowerOn', { rgvNo: this.robots[this.selectRobot].robotCode, option: 'motor' } as RequestParam) console.log('机器人开机:' + res.toString()); delayExecution(async () => { res = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/rgvPowerOn', { rgvNo: this.robots[this.selectRobot].robotCode, option: 'mainPower' } as RequestParam); console.log('机器人开机:' + res.toString()); res = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/rgvPowerOn', { rgvNo: this.robots[this.selectRobot].robotCode, option: 'mcu' } as RequestParam); console.log('机器人开机:' + res.toString()); }, 5000); this.reminds = '机器人开机' this.remindController.open() delayExecution(()=>{ this.remindController.close() }, 2000) } }) Row() { Column() { Text('电机关机') .fontSize($r('app.float.robot_set_font_size')) .fontWeight(FontWeight.Medium) .margin({left: '10%'}) } .width('70%') Column() { Image($r('app.media.electrical_machinery_off')) .width('55px') .height('55px') } .width('30%') } .width('20%') .height('60%') .backgroundColor(this.colorArray[7] == 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[7] = 2 delayExecution(()=>{ this.colorArray[7] = 1 }, 100) if (this.clickStatus[7] == 1) { this.clickStatus[7] = 2 delayExecution(() => { console.log('hhtest', '状态修改') this.clickStatus[7] = 1 }, 2000) console.log('hhtest', '执行函数:电机关机---') let res1: object = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/TurnChargingSwitch', { rgvNo: this.robots[this.selectRobot].robotCode, option: 'off' } as RequestParam); console.log('机器人关机:' + res1.toString()); delayExecution(async () => { let res: object = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/rgvPowerOff', { rgvNo: this.robots[this.selectRobot].robotCode, option: 'motor' } as RequestParam); console.log('机器人关机:' + res.toString()); delayExecution(async () => { res = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/rgvPowerOff', { rgvNo: this.robots[this.selectRobot].robotCode, option: 'mainPower' } as RequestParam); console.log('机器人关机:' + res.toString()); res = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/rgvPowerOff', { rgvNo: this.robots[this.selectRobot].robotCode, option: 'mcu' } as RequestParam); console.log('机器人关机:' + res.toString()); this.reminds = '机器人关机'; this.remindController.open(); delayExecution(() => { this.remindController.close(); }, 2000); }, 5000); }, 5000); } }) Row() { Column() { Text('开始充电') .fontSize($r('app.float.robot_set_font_size')) .fontWeight(FontWeight.Medium) .margin({left: '10%'}) } .width('70%') Column() { Image($r('app.media.robot_charge_connect')) .width('55px') .height('55px') } .width('30%') } .width('20%') .height('60%') .backgroundColor(this.colorArray[8] == 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[8] = 2 delayExecution(()=>{ this.colorArray[8] = 1 }, 100) if (this.clickStatus[8] == 1) { this.clickStatus[8] = 2 delayExecution(() => { console.log('hhtest', '状态修改') this.clickStatus[8] = 1 }, 2000) console.log('hhtest', '执行函数:开始充电---') let res: object = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/TurnChargingSwitch', { rgvNo: this.robots[this.selectRobot].robotCode, option: 'on' } as RequestParam) console.log('手动充电:' + res.toString()) this.reminds = '充电开始' this.remindController.open() delayExecution(()=>{ this.remindController.close() }, 2000) } }) Row() { Column() { Text('停止充电') .fontSize($r('app.float.robot_set_font_size')) .fontWeight(FontWeight.Medium) .margin({left: '10%'}) } .width('70%') Column() { Image($r('app.media.robot_charge_disconnect')) .width('55px') .height('55px') } .width('30%') } .width('20%') .height('60%') .backgroundColor(this.colorArray[9] == 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[9] = 2 delayExecution(()=>{ this.colorArray[9] = 1 }, 100) if (this.clickStatus[9] == 1) { this.clickStatus[9] = 2 delayExecution(() => { console.log('hhtest', '状态修改') this.clickStatus[9] = 1 }, 2000) console.log('hhtest', '执行函数:停止充电---') let res: object = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/TurnChargingSwitch', { rgvNo: this.robots[this.selectRobot].robotCode, option: 'off' } as RequestParam) console.log('手动充电结束:' + res.toString()) this.reminds = '充电结束' this.remindController.open() delayExecution(()=>{ this.remindController.close() }, 2000) } }) } .height('22%') .width('100%') Row(){ Column() { Image($r('app.media.open_close_door')) .width($r('app.float.general_icon_size')) .height($r('app.float.general_icon_size')) Text('开关门') .fontSize($r('app.float.set_card_font_size')) .fontColor($r('app.color.general_font_color')) .opacity($r('app.float.general_font_opacity')) .fontWeight(FontWeight.Medium) } .borderRadius($r('app.float.general_border_radius')) .justifyContent(FlexAlign.Center) .width('10%') .height('100%') Divider().vertical(true).color($r('app.color.black_100')).height('80%') .margin({right: '2%'}) Row() { Column() { Text('充电室开门') .fontSize($r('app.float.robot_set_font_size')) .fontWeight(FontWeight.Medium) .margin({left: '10%'}) } .width('70%') Column() { Image($r('app.media.open_door')) .width('55px') .height('55px') } .width('30%') } .width('20%') .height('60%') .backgroundColor(this.colorArray[10] == 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[10] = 2 delayExecution(()=>{ this.colorArray[10] = 1 }, 100) if (this.clickStatus[10] == 1) { this.clickStatus[10] = 2 delayExecution(()=>{ console.log('hhtest','状态修改') this.clickStatus[10] = 1 }, 2000) console.log('hhtest','执行函数:充电室开门') let res: object = await MechanicalArmDebuggingRequest.post('/api/v1/device/setup', { deviceNo: "EC2A-IM24R00", data: { output: "g0b20:1" } } as EtherCATInfo) console.log('http:' + res.toString()) this.reminds = '充电室开门' this.remindController.open() delayExecution(()=>{ console.log('hhtest','状态修改') this.remindController.close() }, 2000) } }) Row() { Column() { Text('充电室关门') .fontSize($r('app.float.robot_set_font_size')) .fontWeight(FontWeight.Medium) .margin({left: '10%'}) } .width('70%') Column() { Image($r('app.media.close_door')) .width('55px') .height('55px') } .width('30%') } .width('20%') .height('60%') .backgroundColor(this.colorArray[11] == 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[11] = 2 delayExecution(()=>{ this.colorArray[11] = 1 }, 100) if (this.clickStatus[11] == 1) { this.clickStatus[11] = 2 delayExecution(()=>{ console.log('hhtest','状态修改') this.clickStatus[11] = 1 }, 2000) console.log('hhtest','执行函数:充电室关门') let res: object = await MechanicalArmDebuggingRequest.post('/api/v1/device/setup', { deviceNo: "EC2A-IM24R00", data: { output: "g0b20:0" } } as EtherCATInfo) console.log('http:' + res.toString()) this.reminds = '充电室关门' this.remindController.open() delayExecution(()=>{ console.log('hhtest','状态修改') this.remindController.close() }, 2000) } }) Row() { Column() { Text('清除错误') .fontSize($r('app.float.robot_set_font_size')) .fontWeight(FontWeight.Medium) .margin({left: '10%'}) } .width('70%') Column() { Image($r('app.media.robot_clean')) .width('55px') .height('55px') } .width('30%') } .width('20%') .height('60%') .backgroundColor(this.colorArray[2] == 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[2] = 2 delayExecution(()=>{ this.colorArray[2] = 1 }, 100) if (this.clickStatus[2] == 1) { this.clickStatus[2] = 2 delayExecution(()=>{ console.log('hhtest','状态修改') this.clickStatus[2] = 1 }, 2000) console.log('hhtest','执行函数:清除错误') let res: ErrorMessage = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/clearRgvError', { rgvNo: this.robots[this.selectRobot].robotCode, } as RequestParam) console.log('清除错误:' + res.toString()) this.reminds = '清除错误' this.remindController.open() delayExecution(()=>{ console.log('hhtest','状态修改') this.remindController.close() }, 2000) } }) } .height('22%') .width('100%') } .backgroundColor($r('app.color.white_f1f3f5')) .width('100%') .height('100%') } } @CustomDialog struct RemindDialog { controller: CustomDialogController @Link remind: string build() { Column() { Text(this.remind) .fontSize(20) .margin({ top: 10, bottom: 10 }) } } } @CustomDialog struct RobotSingleMoveDialog { controller: CustomDialogController @Link robots: RobotInfo[] @Link selectRobot: number @State isInputEnabled: boolean = false; @State plusXDirection:number = 0 @State plusYDirection:number =0 @State minusXDirection:number =0 @State minusYDirection:number =0 @State moveColorArray: number[] = [1,1,1,1] build() { Column() { Row(){ Text('小车单步移动控制') .fontWeight(FontWeight.Medium) .fontSize($r('app.float.fontSize_30')) .focusable(true) .defaultFocus(true) } .height('20%') Row() { Row() { Text('X轴') .fontSize($r('app.float.fontSize_30')) .fontColor($r('app.color.general_font_color')) .opacity($r('app.float.general_font_opacity')) .fontWeight(FontWeight.Medium) } .borderRadius($r('app.float.general_border_radius')) .justifyContent(FlexAlign.Center) .width('15%') .height('90%') Divider().vertical(true).color($r('app.color.black_100')).height('80%') .margin({right: '2%'}) Row() { Text('正方向移动') .fontWeight(FontWeight.Medium) .fontSize($r('app.float.fontSize_24')) .height('100%') .textAlign(TextAlign.End) }.borderRadius($r('app.float.process_call_image_radius')) .margin({right: '2%',left:'3%' }) .justifyContent(FlexAlign.Center) .width('20%') .height('90%') .backgroundColor(this.moveColorArray[0] == 1 ? $r('app.color.process_divider_white_color') : $r('app.color.process_nameplate_grey_color')) .onClick(async ()=>{ this.moveColorArray[0] = 2 delayExecution(()=>{ this.moveColorArray[0] = 1 }, 100) let res: object = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/singleStepMoveRgv', { rgvNo: this.robots[this.selectRobot].robotCode, direction: 'x+', len:this.plusXDirection.toString(), } as RobotSingleMovePost) console.log('小车X正向移动:' + res.toString()) }) Row() { TextInput({ placeholder: '请输入数字', text: this.plusXDirection + '' }) .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('10%') .height('50%') .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.plusXDirection = parseInt(value) }) Text('步') .fontWeight(FontWeight.Medium) .fontSize($r('app.float.fontSize_18')) .height('100%') .textAlign(TextAlign.End) } Row() { Text('负方向移动') .fontWeight(FontWeight.Medium) .fontSize($r('app.float.fontSize_24')) .height('100%') .textAlign(TextAlign.End) }.borderRadius($r('app.float.process_call_image_radius')) .margin({right: '2%',left:'3%' }) .justifyContent(FlexAlign.Center) .width('20%') .height('90%') .backgroundColor(this.moveColorArray[1] == 1 ? $r('app.color.process_divider_white_color') : $r('app.color.process_nameplate_grey_color')) .onClick(async ()=>{ this.moveColorArray[1] = 2 delayExecution(()=>{ this.moveColorArray[1] = 1 }, 100) let res: object = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/singleStepMoveRgv', { rgvNo: this.robots[this.selectRobot].robotCode, direction: 'x-', len:this.minusXDirection.toString(), } as RobotSingleMovePost) console.log('小车X负向移动:' + res.toString()) }) Row() { TextInput({ placeholder: '请输入数字', text: this.minusXDirection + '' }) .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('10%') .height('50%') .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.minusXDirection = parseInt(value) }) Text('步') .fontWeight(FontWeight.Medium) .fontSize($r('app.float.fontSize_18')) .height('100%') .textAlign(TextAlign.End) } }.width('90%') .height('30%') .justifyContent(FlexAlign.Start) Row() { Row() { Text('Y轴') .fontSize($r('app.float.fontSize_30')) .fontColor($r('app.color.general_font_color')) .opacity($r('app.float.general_font_opacity')) .fontWeight(FontWeight.Medium) } .borderRadius($r('app.float.general_border_radius')) .justifyContent(FlexAlign.Center) .width('15%') .height('90%') Divider().vertical(true).color($r('app.color.black_100')).height('80%') .margin({right: '2%'}) Row() { Text('正方向移动') .fontWeight(FontWeight.Medium) .fontSize($r('app.float.fontSize_24')) .height('100%') .textAlign(TextAlign.End) }.borderRadius($r('app.float.process_call_image_radius')) .margin({right: '2%',left:'3%' }) .justifyContent(FlexAlign.Center) .width('20%') .height('90%') .backgroundColor(this.moveColorArray[2] == 1 ? $r('app.color.process_divider_white_color') : $r('app.color.process_nameplate_grey_color')) .onClick(async ()=>{ this.moveColorArray[2] = 2 delayExecution(()=>{ this.moveColorArray[2] = 1 }, 100) let res: object = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/singleStepMoveRgv', { rgvNo: this.robots[this.selectRobot].robotCode, direction: 'y+', len:this.plusYDirection.toString(), } as RobotSingleMovePost) console.log('小车Y正向移动:' + res.toString()) }) Row() { TextInput({ placeholder: '请输入数字', text: this.plusYDirection + '' }) .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('10%') .height('50%') .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.plusYDirection = parseInt(value) }) Text('步') .fontWeight(FontWeight.Medium) .fontSize($r('app.float.fontSize_18')) .height('100%') .textAlign(TextAlign.End) } Row() { Text('负方向移动') .fontWeight(FontWeight.Medium) .fontSize($r('app.float.fontSize_24')) .height('100%') .textAlign(TextAlign.End) }.borderRadius($r('app.float.process_call_image_radius')) .margin({right: '2%',left:'3%' }) .justifyContent(FlexAlign.Center) .width('20%') .height('90%') .backgroundColor(this.moveColorArray[3] == 1 ? $r('app.color.process_divider_white_color') : $r('app.color.process_nameplate_grey_color')) .onClick(async ()=>{ this.moveColorArray[3] = 2 delayExecution(()=>{ this.moveColorArray[3] = 1 }, 100) let res: object = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/singleStepMoveRgv', { rgvNo: this.robots[this.selectRobot].robotCode, direction: 'y-', len:this.minusYDirection.toString(), } as RobotSingleMovePost) console.log('小车Y负向移动:' + res.toString()) }) Row() { TextInput({ placeholder: '请输入数字', text: this.minusYDirection + '' }) .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('10%') .height('50%') .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.minusYDirection = parseInt(value) }) Text('步') .fontWeight(FontWeight.Medium) .fontSize($r('app.float.fontSize_18')) .height('100%') .textAlign(TextAlign.End) } }.width('90%') .height('30%') .justifyContent(FlexAlign.Start) } .width('50%') .height('30%') .backgroundColor($r('app.color.page_general_background')) .justifyContent(FlexAlign.SpaceEvenly) .borderRadius($r('app.float.general_border_radius')) } } //设置车位置弹窗 @CustomDialog struct SetRobotLocationDialog { controller: CustomDialogController @Link robots: RobotInfo[] @Link selectRobot: number @State robotX: number = 0 @State robotY: number = 0 @State tempSelect: number = 1 @State robotArray: Array = [] 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 let res: object = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/newposition', { rgvNo: this.robots[this.selectRobot].robotCode, x: this.robotX.toString(), y: this.robotY.toString() } as RequestParam) console.log('设置机器人位置:' + res.toString()) if (this.controller != undefined) { this.controller.close() } }) } .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 { controller: CustomDialogController @Link robots: RobotInfo[] @Link selectRobot: number @State robotX: number = 0 @State robotY: number = 0 @State tempSelect: number = 1 @State robotArray: Array = [] // 料箱 @State boxArray: Array = [] @State boxCode: string = '' @State boxX: string = '' @State boxY: string = '' async aboutToAppear() { 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) } } let res : Array = await RobotErrorHandleRequest.get('/api/v1/wcs/boxs', {}) if (res && res.length > 0) { for (const box of res ) { let option: SelectOption = { value: box.no ? box.no : '' } this.boxArray.push(option) } } } build() { Row() { 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('30%') .height('100%') 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')) .width('50%') .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(async (index: number) => { 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.boxX = strArray[0] this.boxY = strArray[1] } } } }) } .width('80%') .height('20%') .justifyContent(FlexAlign.Center) Row(){ Text('X轴:') .fontWeight(FontWeight.Medium) .fontSize($r('app.float.fontSize_18')) .width('20%') .height('100%') Text(this.boxX) .fontColor($r('app.color.login_text_input_font_color')) .fontWeight(FontWeight.Medium) .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')) } .width('80%') .height('20%') .justifyContent(FlexAlign.Center) Row(){ Text('Y轴:') .fontWeight(FontWeight.Medium) .fontSize($r('app.float.fontSize_18')) .width('20%') .height('100%') Text(this.boxY) .fontColor($r('app.color.login_text_input_font_color')) .fontWeight(FontWeight.Medium) .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')) } .width('80%') .height('20%') .justifyContent(FlexAlign.Center) } .height('100%') .width('49.5%') .justifyContent(FlexAlign.SpaceEvenly) Column(){ Divider().vertical(true).color($r('app.color.black_100')) .height('100%') } .width('1%') .height('100%') 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.tempSelect) .value(this.robots && this.robots[this.tempSelect] && this.robots[this.tempSelect].robotCode ? this.robots[this.tempSelect].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) => { 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 let res: object = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/newposition', { rgvNo: this.robots[this.selectRobot].robotCode, x: this.robotX.toString(), y: this.robotY.toString() } as RequestParam) console.log('设置机器人位置:' + res.toString()) res = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/clearRgvError', { rgvNo: this.robots[this.selectRobot].robotCode, } as RequestParam) console.log('清除错误:' + res.toString()) res = await RobotErrorHandleRequest.post('/api/v1/wcs/rgv/clearRgvError', { rgvNo: this.robots[this.selectRobot].robotCode, } as RequestParam) console.log('清除错误:' + res.toString()) if (this.controller != undefined) { this.controller.close() } }) } .justifyContent(FlexAlign.Center) .height('25%') .width('100%') } .height('100%') .width('49.5%') .justifyContent(FlexAlign.SpaceBetween) } .width('80%') .height('74%') .backgroundColor($r('app.color.page_general_background')) .justifyContent(FlexAlign.SpaceBetween) .borderRadius($r('app.float.general_border_radius')) } }*/ /*function delayExecution(callback: Function, delay: number) { setTimeout(() => { callback(); }, delay); }*/ function delayExecution(callback: Function, delay: number) { let timerId = setInterval(() => { clearInterval(timerId); callback(); }, delay); } class ErrorMessage{ code?:string message?:string data?:string } class RgvInfo{ id?:string x?:string y?:string status?:string auto?:string dx?:string dy?:string mv?:string batlevel?:string charging?:string errCode?:string cmd?:string load?:string boxNo?:string regTime?:string traMiles?:string chargeCount?:string forward?:string ts?:string } class DeviceData { output?: string; } class EtherCATInfo{ deviceNo?:string data?:DeviceData; } class RobotSingleMovePost{ rgvNo?:string direction?:string; len?:string; }