12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745 |
- 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<SelectOption> = []
- 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<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
- 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<SelectOption> = []
- // 料箱
- @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) {
- for (const robot of this.robots ) {
- let option: SelectOption = { value: robot.robotCode ? robot.robotCode : ''}
- this.robotArray.push(option)
- }
- }
- let res : Array<BoxInfo> = 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;
- }
|