1
0

2 Commits 4c4cac5f35 ... 3a7c5472ad

Autor SHA1 Nachricht Datum
  yixiaojun 3a7c5472ad Merge remote-tracking branch 'origin/master' vor 1 Jahr
  yixiaojun 8c9c3250c4 卡片服务 vor 1 Jahr

+ 1 - 59
entry/src/main/ets/common/component/BottomOperateComp.ets

@@ -1,54 +1,6 @@
 import router from '@ohos.router'
 import NoticeInfo from '../../model/NoticeInfo'
-@CustomDialog
-struct factoryCardDialog {
-  @Link SmartFactoryCardDelete:number
-  controller: CustomDialogController
-  cancel: () => void
-  confirm: () => void
-  build(){
-    Column(){
-      Column(){
-        Text('卡片服务')
-          .margin(px2vp(5))
-          .width('100%')
-          .fontWeight(FontWeight.Medium)
-          .fontSize(px2vp(38))
-          .height('50%')
-          .textAlign(TextAlign.Start)
-          .onClick(()=>{
-            this.controller.close()
-            this.SmartFactoryCardDelete=0
-          })
-        Divider().width('80%')
-        Text('删除卡片')
-          .height('50%')
-          .margin(px2vp(5))
-          .width('100%')
-          .fontWeight(FontWeight.Medium)
-          .fontSize(px2vp(38))
-          .textAlign(TextAlign.Start)
-          .onClick(()=>{
-            this.SmartFactoryCardDelete=1
-            this.controller.close()
-          })
 
-      }
-      .borderRadius(px2vp(15))
-      .width('100%')
-      .height('40%')
-      .backgroundColor($r('app.color.process_divider_white_color'))
-      Image($r('app.media.jg_circular_icon'))
-        .width(px2vp(150))
-        .height(px2vp(150))
-        .borderRadius(15)
-    }
-    .alignItems(HorizontalAlign.Start)
-    .width('10%')
-    .height('30%')
-
-  }
-}
 /*
  * 底部操作栏
  * */
@@ -66,16 +18,7 @@ export struct BottomOperateComp {
       this.isClick =! this.isClick
     }
   })
-  // SmartFactoryCardDialogController: CustomDialogController = new CustomDialogController({
-  //   builder:factoryCardDialog({
-  //     SmartFactoryCardDelete:this.SmartFactoryCardDelete
-  //   }
-  //   ),
-  //   alignment: DialogAlignment.Bottom,
-  //   autoCancel:true,
-  //   customStyle:true,
-  //   offset: { dx: 20, dy: 50 }
-  // })
+
 
   build() {
     Stack() {
@@ -127,7 +70,6 @@ export struct BottomOperateComp {
         .gesture(
           LongPressGesture({ repeat: false })
             .onActionEnd(() => {
-             // this.SmartFactoryCardDialogController.open()
             })
         )
 

+ 7 - 0
entry/src/main/ets/common/constants/CommonConstants.ets

@@ -53,6 +53,7 @@ import ProcessStandardData from '../../model/processmodel/ProcessStandardData'
 import ProcessStep from '../../model/processmodel/ProcessStep'
 import ProductInfo from '../../model/processmodel/ProductInfo'
 import RobotInfo from '../../model/RobotInfo'
+import UniversalCard from  '../../model/UniversalCard'
 
 export default class CommonConstants {
 
@@ -152,4 +153,10 @@ export default class CommonConstants {
     {step: 2, momentMin: 1.4, momentMax: 1.5, momentUnit: 'N.m', rotateMin: 4500, rotateMax: 5500, rotateUnit: '°'},
     {step: 3, momentMin: 1.2, momentMax: 1.3, momentUnit: 'N.m', rotateMin: 2600, rotateMax: 3500, rotateUnit: '°'},
   ];
+  //卡片服务
+  static  readonly Card_DATA:Array<UniversalCard>=[
+    {id:0, userId:0, cardType:1,cardStatus:1,cardSort:0},
+    {id:0, userId:0, cardType:3,cardStatus:1,cardSort:0},
+    {id:0, userId:0, cardType:5,cardStatus:1,cardSort:0},
+  ];
 }

+ 24 - 0
entry/src/main/ets/model/ComponentLocation.ets

@@ -0,0 +1,24 @@
+export class componentLocation{
+
+  static rect_left
+  static rect_top
+  static rect_right
+  static rect_bottom
+  static rect_value
+
+  //获取组件所占矩形区域坐标
+  static getComponentRect(key) {
+    let strJson = getInspectorByKey(key)
+    let obj = JSON.parse(strJson)
+    console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj))
+    let rectInfo = JSON.parse('[' + obj.$rect + ']')
+    console.info("[getInspectorByKey] rectInfo is: " + rectInfo)
+    this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0]
+    this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1]
+    this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0]
+    this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1]
+    return this.rect_value = {
+      "left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom
+    }
+  }
+}

+ 110 - 111
entry/src/main/ets/pages/Index.ets

@@ -1,9 +1,12 @@
+import {componentLocation} from  '../model/ComponentLocation'
 import { TitleStateComp } from '../common/component/TitleStateComp';
 import { BottomOperateComp } from '../common/component/BottomOperateComp';
 import router from '@ohos.router'
 import { TaskComp } from '../common/component/TaskComp'
 import {  Warehousing}from  '../common/component/Warehousing'
 import { SmartFactoryCard }from  '../common/component/SmartFactoryCard'
+import CommonConstants from '../common/constants/CommonConstants'
+import UniversalCard from  '../model/UniversalCard'
 @CustomDialog
 struct login {
   @Link textValue: string
@@ -59,103 +62,65 @@ struct login {
 }
 @CustomDialog
 struct confirmPopup {
-  @Link longPressDelete:number
+  @Link cardServices:UniversalCard[]
   controller: CustomDialogController
   cancel: () => void
   confirm: () => void
+  @Link x: number
+  @Link  y: number
+  @Link index:number
   build(){
     Column(){
       Column(){
-        Text('卡片服务')
-          .margin(px2vp(5))
-          .width('100%')
-          .fontWeight(FontWeight.Medium)
-          .fontSize(px2vp(38))
-          .height('50%')
-          .textAlign(TextAlign.Start)
-          .onClick(()=>{
-            this.controller.close()
-            this.longPressDelete=0
-          })
-        Divider().width('80%')
-        Text('删除卡片')
-          .height('50%')
-          .margin(px2vp(5))
-          .width('100%')
-          .fontWeight(FontWeight.Medium)
-          .fontSize(px2vp(38))
-          .textAlign(TextAlign.Start)
-          .onClick(()=>{
-            this.longPressDelete=1
-            this.controller.close()
-          })
+        Row(){
+          Image($r('app.media.card'))
+            .width(px2vp(50))
+            .height(px2vp(50))
+          Text('卡片服务')
+            .padding({left:10})
+            .margin(px2vp(5))
+            .width('100%')
+            .fontWeight(FontWeight.Medium)
+            .fontSize(px2vp(38))
+            .textAlign(TextAlign.Start)
+            .onClick(()=>{
+              this.controller.close()
+              this.cardServices[this.index]= {
+                id:this.cardServices[this.index].id,
+                userId:this.cardServices[this.index].userId,
+                cardType:this.cardServices[this.index].cardType,
+                cardStatus:1,
+                cardSort:this.cardServices[this.index].cardSort,
+              }
+            })
+
+        }.width('100%')
+        .height('80%')
+        .padding({left:10})
+        .borderRadius(px2vp(15))
+        .backgroundColor($r('app.color.general_font_white_color'))
+        Divider()
+          .width('80%')
 
       }
+      .margin({bottom:5})
       .borderRadius(px2vp(15))
-      .width('100%')
-      .height('40%')
-      .backgroundColor($r('app.color.process_divider_white_color'))
-      Image($r('app.media.gongxu'))
-        .width(px2vp(220))
-        .height(px2vp(220))
-        .borderRadius(15)
-    }
-    .alignItems(HorizontalAlign.Start)
-    .width('10%')
-    .height('30%')
+      .height('20%')
+      .width('120%')
+      .backgroundColor($r('app.color.general_font_white_color'))
 
-  }
-}
-@CustomDialog
-struct smartWarehouseCard {
-  @Link martWarehouseCardDelete:number
-  controller: CustomDialogController
-  cancel: () => void
-  confirm: () => void
-  build(){
-    Column(){
-      Column(){
-        Text('卡片服务')
-          .margin(px2vp(5))
-          .width('100%')
-          .fontWeight(FontWeight.Medium)
-          .fontSize(px2vp(38))
-          .height('50%')
-          .textAlign(TextAlign.Start)
-          .onClick(()=>{
-            this.controller.close()
-            this.martWarehouseCardDelete=0
-          })
-        Divider().width('80%')
-        Text('删除卡片')
-          .height('50%')
-          .margin(px2vp(5))
-          .width('100%')
-          .fontWeight(FontWeight.Medium)
-          .fontSize(px2vp(38))
-          .textAlign(TextAlign.Start)
-          .onClick(()=>{
-            this.martWarehouseCardDelete=1
-            this.controller.close()
-          })
 
-      }
-      .borderRadius(px2vp(15))
-      .width('100%')
-      .height('40%')
-      .backgroundColor($r('app.color.process_divider_white_color'))
-      Image($r('app.media.storage'))
+      Image(this.index===1?$r("app.media.processImages"):$r('app.media.storage'))
         .width(px2vp(220))
         .height(px2vp(220))
         .borderRadius(15)
     }
     .alignItems(HorizontalAlign.Start)
-    .width('10%')
-    .height('30%')
-
+    .width('350px')
+    .height('600px')
+    .offset({x:this.x+20+'px', y:this.y-340+'px'})
   }
 }
-
 @CustomDialog
 struct shutdown {
   @Link shutdownTransparency:number
@@ -216,11 +181,14 @@ struct shutdown {
 @Entry
 @Component
 struct Index {
+  @State index:number=0
+  @State x:number=0
+  @State y:number=0
+  @State cardServices:UniversalCard[] = CommonConstants.Card_DATA
   @State  SmartFactoryCardDelete:number=0
   @State SmartFactoryDelete:number=0
   @State  SmartFactoryCarLongPressDelete:number=0
   @State storageCardDelete:number=0
-  @State martWarehouseCardDelete:number=0
   @State smartWarehouseCard:number=0
   @State avatarFrame:boolean=false
   @State deleteConfirmation:number=0
@@ -253,26 +221,16 @@ struct Index {
   })
   confirmPopupDialogController: CustomDialogController = new CustomDialogController({
     builder: confirmPopup({
-      longPressDelete:this.longPressDelete,
+      x:this.x,
+      y:this.y,
+      index:this.index,
+      cardServices:this.cardServices
     }
       ),
-    alignment: DialogAlignment.Bottom,
-    autoCancel:true,
-    customStyle:true,
-    offset: { dx: -95, dy: -40 }
-  })
-  smartWarehouseCardDialogController: CustomDialogController = new CustomDialogController({
-    builder:smartWarehouseCard({
-      martWarehouseCardDelete:this.martWarehouseCardDelete
-    }
-    ),
-    alignment: DialogAlignment.Bottom,
+    alignment: DialogAlignment.TopStart,
     autoCancel:true,
     customStyle:true,
-    offset: { dx: -320, dy: -40 }
   })
-
-
   build() {
     Stack(){
       Row() {
@@ -284,7 +242,7 @@ struct Index {
           Row() {
 
             Flex({ wrap: FlexWrap.Wrap }) {
-              if (this.longPressDelete===0){
+              if (this.cardServices[1].cardStatus===1){
                 Stack(){
                   Column(){
                     TaskComp({isHomePage: this.isHomePage})
@@ -329,7 +287,13 @@ struct Index {
                         .backgroundColor(  $r('app.color.robot_set_card_blue'))
                         .onClick(()=>{
                           this.deleteConfirmation=0
-                          this.longPressDelete=1
+                          this.cardServices[1]= {
+                            id:this.cardServices[1].id,
+                            userId:this.cardServices[1].userId,
+                            cardType:this.cardServices[1].cardType,
+                            cardStatus:2,
+                            cardSort:this.cardServices[1].cardSort,
+                          }
                         })
                     }
                     .justifyContent(FlexAlign.Center)
@@ -340,7 +304,7 @@ struct Index {
                 }
 
               }
-              if (this.martWarehouseCardDelete===0){
+              if (this.cardServices[0].cardStatus===1){
                 Stack(){
                   Column(){
                     Warehousing()
@@ -361,10 +325,10 @@ struct Index {
                   .gesture(
                     LongPressGesture({ repeat: false })
                       .onActionEnd(() => {
-                        this. smartWarehouseCard=1
+                        this.smartWarehouseCard=1
                       })
                   )
-                  if (this. smartWarehouseCard===1){
+                  if (this.smartWarehouseCard===1){
                     Row(){
                       Text('取消')
                         .fontWeight(FontWeight.Medium)
@@ -391,7 +355,13 @@ struct Index {
                         .backgroundColor(  $r('app.color.robot_set_card_blue'))
                         .onClick(()=>{
                           this.smartWarehouseCard=0
-                          this.martWarehouseCardDelete=1
+                          this.cardServices[0]= {
+                            id:this.cardServices[0].id,
+                            userId:this.cardServices[0].userId,
+                            cardType:this.cardServices[0].cardType,
+                            cardStatus:2,
+                            cardSort:this.cardServices[0].cardSort,
+                          }
                         })
                     }
                     .justifyContent(FlexAlign.Center)
@@ -474,7 +444,7 @@ struct Index {
               Image($r("app.media.shezhi"))
                 .width('60%')
                 .height('60%')
-                .borderRadius(15)
+                .margin({top:5})
               Text('设置')
                 .width('100%')
                 .textAlign(TextAlign.Center)
@@ -496,7 +466,7 @@ struct Index {
               Image($r("app.media.storage"))
                 .width('60%')
                 .height('60%')
-                .borderRadius(15)
+                .margin({top:5})
               Text('智能仓储')
                 .width('100%')
                 .textAlign(TextAlign.Center)
@@ -508,7 +478,9 @@ struct Index {
             .height('90%')
             .borderRadius(15)
             .backgroundColor('#4d000000')
+            .id('smartWarehousing')
             .onClick(() => {
+
               router.pushUrl({
                 url: 'pages/Storage'
               })
@@ -516,14 +488,27 @@ struct Index {
             .gesture(
               LongPressGesture({ repeat: false })
                 .onActionEnd(() => {
-                  this.smartWarehouseCardDialogController.open()
+                  let rect = componentLocation.getComponentRect('smartWarehousing')
+                  let touchPoint: TouchObject = {
+                    id: 1,
+                    x: rect.left, // 组件中心点x坐标
+                    y:rect.bottom, // 组件中心点y坐标
+                    type: TouchType.Down,
+                    screenX: rect.left + (rect.right - rect.left) / 2, // 组件中心点x坐标
+                    screenY: rect.left + (rect.right - rect.left) / 2, // 组件中心点y坐标
+                  }
+                  this.x=touchPoint.x
+                  this.y=touchPoint.y
+                  this.index=0
+                  this.confirmPopupDialogController.open()
+
                 })
             )
             Column({ space: 10 }) {
               Image($r('app.media.jiqiren'))
                 .width('60%')
                 .height('60%')
-                .borderRadius(15)
+                .margin({top:5})
               Text('机器人调试')
                 .width('100%')
                 .textAlign(TextAlign.Center)
@@ -542,10 +527,10 @@ struct Index {
             })
 
             Column({ space: 10 }) {
-              Image($r('app.media.gongxu'))
+              Image($r("app.media.processImages"))
                 .width('60%')
                 .height('60%')
-                .borderRadius(15)
+                .margin({top:5})
               Text('工序操作')
                 .width('100%')
                 .textAlign(TextAlign.Center)
@@ -557,6 +542,7 @@ struct Index {
             .justifyContent(FlexAlign.Center)
             .height('90%')
             .borderRadius(15)
+            .id('workingProcedure')
             .backgroundColor('#4d000000')
             .onClick(() => {
               router.pushUrl({
@@ -566,7 +552,19 @@ struct Index {
             .gesture(
               LongPressGesture({ repeat: false })
                 .onActionEnd(() => {
-                 this.confirmPopupDialogController.open()
+                  let rect = componentLocation.getComponentRect('workingProcedure')
+                  let touchPoint: TouchObject = {
+                    id: 1,
+                    x: rect.left, // 组件中心点x坐标
+                    y:rect.bottom, // 组件中心点y坐标
+                    type: TouchType.Down,
+                    screenX: rect.left + (rect.right - rect.left) / 2, // 组件中心点x坐标
+                    screenY: rect.left + (rect.right - rect.left) / 2, // 组件中心点y坐标
+                  }
+                  this.x=touchPoint.x
+                  this.y=touchPoint.y
+                  this.index=1
+                  this.confirmPopupDialogController.open()
                 })
             )
 
@@ -574,7 +572,7 @@ struct Index {
               Image($r('app.media.baobiao'))
                 .width('60%')
                 .height('60%')
-                .borderRadius(15)
+                .margin({top:5})
               Text('统计报表')
                 .width('100%')
                 .textAlign(TextAlign.Center)
@@ -590,8 +588,9 @@ struct Index {
           }
           .width('100%')
           .height('16%')
-          BottomOperateComp({ isHomePage: this.isHomePage,/*
-            SmartFactoryCardDelete:this.SmartFactoryCardDelete*/})
+          BottomOperateComp({ isHomePage: this.isHomePage,
+          }
+          )
         }
         .backgroundImage($r('app.media.BG'))
         .backgroundImageSize({ width: '100%', height: '100%' })

+ 1 - 1
entry/src/main/ets/view/IntelligentStorageWarehousing.ets

@@ -363,7 +363,7 @@ struct ChuKU {
                         .justifyContent(FlexAlign.Center)
                         .alignItems(HorizontalAlign.Start)
                         Row(){
-                          Image($r('app.media.emptybox'))
+                          Image($r("app.media.materialBox"))
                             .width('150px')
                             .height('150px')
                         }.width('50%')

Datei-Diff unterdrückt, da er zu groß ist
+ 3 - 0
entry/src/main/resources/base/media/card.svg