Преглед изворни кода

处理工序页面无法加载的问题

hh пре 1 година
родитељ
комит
2b36542c45

+ 3 - 2
entry/src/main/ets/common/constants/CommonConstants.ets

@@ -57,8 +57,9 @@ export default class CommonConstants {
   static readonly MATERIAL_ARRAY: MaterialInfo[] = [
     {id:1, materialNo:'111', materialName: 'PACA-ASSSD电路板', needNum: 5, storeNum: 100},
     {id:2, batchCode:'222', materialName: '小号螺丝', needNum: 100, storeNum: 100},
-    {id:1, materialNo:'333', materialName: '中号螺丝', needNum: 5, storeNum: 100},
-    {id:2, batchCode:'444', materialName: '中号螺帽', needNum: 5, storeNum: 100},
+    {id:3, materialNo:'333', materialName: '中号螺丝', needNum: 5, storeNum: 100},
+    {id:4, batchCode:'444', materialName: '中号螺帽', needNum: 5, storeNum: 100},
+    {id:5, batchCode:'555', materialName: '大号螺帽', needNum: 5, storeNum: 100},
   ]
 
   // 辅料类型

+ 0 - 1
entry/src/main/ets/model/database/AssistantSetModel.ets

@@ -105,7 +105,6 @@ class AssistantSetModel {
    * @returns 智汇助手id
    */
   addAssistantSet(set: AssistantSet): Promise<number>{
-    console.log('testTag', '===========新增执行=============')
     return this.rdbStore.insert(this.tableName, {USER_ID: set.userId, VOICE_WAKE_UP: set.voiceWakeUp, TIMBRE: set.timbre,
       WAKE_FREE: set.wakeFree, PROMPT_BROADCAST: set.promptBroadcast, VOICE_VOLUME: set.voiceVolume})
   }

+ 5 - 2
entry/src/main/ets/pages/process/MaterialCirculationPage.ets

@@ -128,8 +128,9 @@ struct MaterialCirculationPage {
             .width('100%')
             .justifyContent(FlexAlign.SpaceEvenly)
 
-            Flex({ wrap: FlexWrap.Wrap, justifyContent: FlexAlign.SpaceEvenly,  alignContent: FlexAlign.Start }) {
+            Flex({ wrap: FlexWrap.Wrap}) {
               ForEach(this.materialArray, (item: MaterialInfo, index: number) => {
+                Row().width('2%')
                 Column() {
                   Column() {
                     Text(item.materialName)
@@ -181,10 +182,12 @@ struct MaterialCirculationPage {
                 .borderRadius($r('app.float.general_border_radius'))
                 .backgroundColor($r('app.color.general_font_white_color'))
                 .onClick(()=>{
-
                   // this.bindConfirmController.open()
                 })
                 .margin({ bottom: 10})
+                if ((index + 1) % 2 === 0) {
+                  Row().width('2%')
+                }
               })
             }
             .width('100%')

+ 5 - 1
entry/src/main/ets/pages/process/ProcessDrawingPage.ets

@@ -25,8 +25,9 @@ struct ProcessDrawingPage {
       ProcessTitleComp({titleName: '图纸'})
 
       Scroll() {
-        Flex({ wrap: FlexWrap.Wrap, justifyContent: FlexAlign.SpaceEvenly}) {
+        Flex({ wrap: FlexWrap.Wrap}) {
           ForEach(this.drawingArray, (item: DrawingInfo, index: number)=>{
+            Row().width('1.3%')
             Column() {
               Row() {
                 Image(item.drawingPath)
@@ -57,6 +58,9 @@ struct ProcessDrawingPage {
             .backgroundColor($r('app.color.general_font_white_color'))
             .borderRadius($r('app.float.general_border_radius'))
             .margin({ bottom: 10})
+            if ((index + 1) % 3 === 0) {
+              Row().width('1.3%')
+            }
           })
         }
       }

+ 2 - 3
entry/src/main/ets/pages/process/ProcessHome.ets

@@ -411,11 +411,10 @@ struct ProcessHome {
                   // "operationId": this.processes[this.selectProcess].operationId,
                   // "qrCode": "20240402000054",
                   // "workOrderCode": this.orderArray[this.selectOrder].workOrderCode
-                  "operationId": 20,
-                  "qrCode": "20240408000011",
+                  "operationId": 170,
+                  "qrCode": "12020100000052404080014",
                   "workOrderCode": "GD2404080001"
                 })
-
                 router.pushUrl({
                   url: 'pages/process/ProcessStepPage',
                   params: {

+ 20 - 19
entry/src/main/ets/pages/process/ProcessStepPage.ets

@@ -22,18 +22,18 @@ import { ProcessTitleComp } from '../../common/component/ProcessTitleComp';
 import JGRequest from '../../common/util/request/Request';
 import StartWorkInfo from '../../viewmodel/StartWorkInfo';
 
-// const params = router.getParams(); // 获取传递过来的参数对象
-// const startWorkInfo = params['startWorkInfo']; // 获取开工信息
-// const processInfo = params['processInfo']; // 获取当前工序信息
+const params = router.getParams(); // 获取传递过来的参数对象
+const startWorkInfo = params['startWorkInfo']; // 获取开工信息
+const processInfo = params['processInfo']; // 获取当前工序信息
 
 @Entry
 @Component
 struct ProcessStepPage {
-  // todo 根据homePage传过来的值
-  startWorkInfo: StartWorkInfo = {materialCode: 'BL000001', materialName:'数据链处理机板硬件(国产化)', seqNo: '20240402000054'}
-  @State process: ProcessData = {operationId: 129, completeNum:'101',operationCode:'32434', operationSort:1, operationName: '物流采集'}
 
-  @State productSteps: ProcessStep[] = []
+  startWorkInfo: StartWorkInfo = startWorkInfo
+  @State process: ProcessData = processInfo
+
+  @State processSteps: ProcessStep[] = []
 
   private stepImages: Resource[] = CommonConstants.STEP_IMAGES
   private stepSelectImages: Resource[] = CommonConstants.STEP_SELECT_IMAGES
@@ -61,8 +61,9 @@ struct ProcessStepPage {
   })
 
   async aboutToAppear() {
-    this.productSteps = await JGRequest.get("/api/v1/process/opCompent/get/" + this.process.operationId, {})
-    if (this.productSteps && this.productSteps.length > 0) {
+    let res: ProcessStep[] = await JGRequest.get("/api/v1/process/opCompent/get/" + 129, {})
+    if (res && res.length > 0) {
+      this.processSteps = res
       this.selectStep = 0
     }
   }
@@ -180,7 +181,7 @@ struct ProcessStepPage {
         Column() {
           // 当前工序的工步列表
           List({space: 6}) {
-            ForEach(this.productSteps, (item: ProcessStep, index: number)=> {
+            ForEach(this.processSteps, (item: ProcessStep, index: number)=> {
               ListItem() {
                 Column() {
                   Image(this.selectStep === index ? this.stepSelectImages[item.compentType - 1] :  this.stepImages[item.compentType - 1])
@@ -209,29 +210,29 @@ struct ProcessStepPage {
           .margin({left: '2%'})
 
           Column() {
-            if (this.productSteps[this.selectStep].compentType === 1) {
+            if (this.processSteps && this.processSteps.length > 0 && this.processSteps[this.selectStep].compentType === 1) {
               MaterialCollectView({
                 mainMaterial: this.startWorkInfo.materialCode,
                 process: $process,
               })
-            } else if (this.productSteps[this.selectStep].compentType === 2) {
+            } else if (this.processSteps && this.processSteps.length > 0 && this.processSteps[this.selectStep].compentType === 2) {
               RecordItemView({
                 operationId: this.process.operationId,
                 processId: this.startWorkInfo.id
               })
-            } else if (this.productSteps[this.selectStep].compentType === 3) {
+            } else if (this.processSteps && this.processSteps.length > 0 && this.processSteps[this.selectStep].compentType === 3) {
               MultimediaCollectView()
-            } else if (this.productSteps[this.selectStep].compentType === 4) {
+            } else if (this.processSteps && this.processSteps.length > 0 && this.processSteps[this.selectStep].compentType === 4) {
               EsopView()
-            } else if (this.productSteps[this.selectStep].compentType === 5) {
+            } else if (this.processSteps && this.processSteps.length > 0 && this.processSteps[this.selectStep].compentType === 5) {
               SpotCheckView()
-            } else if (this.productSteps[this.selectStep].compentType === 6) {
+            } else if (this.processSteps && this.processSteps.length > 0 && this.processSteps[this.selectStep].compentType === 6) {
               EquipRecordView()
-            } else if (this.productSteps[this.selectStep].compentType === 7) {
+            } else if (this.processSteps && this.processSteps.length > 0 && this.processSteps[this.selectStep].compentType === 7) {
               FixtureView()
-            } else if (this.productSteps[this.selectStep].compentType === 8) {
+            } else if (this.processSteps && this.processSteps.length > 0 && this.processSteps[this.selectStep].compentType === 8) {
               DebugPairView()
-            } else if (this.productSteps[this.selectStep].compentType === 9) {
+            } else if (this.processSteps && this.processSteps.length > 0 && this.processSteps[this.selectStep].compentType === 9) {
               NameplateBindView({mainMaterial: this.startWorkInfo.materialCode})
             }
           }