Przeglądaj źródła

esop接口对接

hh 1 rok temu
rodzic
commit
e8554abd85

+ 26 - 13
entry/src/main/ets/pages/LoginPage.ets

@@ -16,10 +16,14 @@ struct LoginPage {
   @State dept: DeptInfo = null
   @State workstation: WorkstationInfo = null
 
+  deptArray: DeptInfo[] = []
+  workstationArray: WorkstationInfo[] = []
+
   // 部门选择弹框
   selectDeptController: CustomDialogController = new CustomDialogController({
     builder: SelectDeptDialog({
-      dept: this.dept
+      dept: this.dept,
+      deptArray: this.deptArray
     }),
     autoCancel: true,
     alignment: DialogAlignment.Center,
@@ -30,7 +34,8 @@ struct LoginPage {
   // 工位选择弹框
   selectWorkstationController: CustomDialogController = new CustomDialogController({
     builder: SelectWorkstationDialog({
-      workstation: this.workstation
+      workstation: this.workstation,
+      workstationArray: this.workstationArray,
     }),
     autoCancel: true,
     alignment: DialogAlignment.Center,
@@ -56,6 +61,17 @@ struct LoginPage {
         })
       }
     }
+
+    //登录时,查询部门
+    this.deptArray = await JGRequest.get("/api/v1/sys/dept/orgList", {}) as DeptInfo[]
+    if (this.deptArray && this.deptArray.length > 0) {
+      this.dept = this.deptArray[0]
+    }
+    // 查询工位
+    this.workstationArray = await JGRequest.get("/api/v1/base/station/queryStationList", {}) as WorkstationInfo[]
+    if (this.workstationArray && this.workstationArray.length > 0) {
+      this.workstation = this.workstationArray[0]
+    }
   }
 
   build() {
@@ -259,8 +275,10 @@ struct SelectDeptDialog {
   cancel: () => void = () => {}
   confirm: () => void = () => {}
 
-  async aboutToAppear() {
-    this.deptArray = await JGRequest.get("/api/v1/sys/dept/orgList", {}) as DeptInfo[]
+  aboutToAppear() {
+    for (const element of this.deptArray) {
+      console.log('testTag', '----------' +JSON.stringify(element));
+    }
   }
 
   build() {
@@ -288,7 +306,7 @@ struct SelectDeptDialog {
               }
               .height('15%')
               .width('80%')
-              .backgroundColor(this.dept && this.dept === item.id ? $r('app.color.order_select_background') : $r('app.color.general_card_background_color'))
+              .backgroundColor(this.dept && this.dept.id === item.id ? $r('app.color.order_select_background') : $r('app.color.general_card_background_color'))
               .borderRadius($r('app.float.general_border_radius'))
               .padding({left: 10})
               .onClick(()=>{
@@ -325,16 +343,11 @@ struct SelectWorkstationDialog {
   cancel: () => void = () => {}
   confirm: () => void = () => {}
 
-
-  async aboutToAppear() {
-    this.workstationArray = await JGRequest.get("/api/v1/base/station/queryStationList", {}) as WorkstationInfo[]
-  }
-
   build() {
     Column() {
       Row() {
         Text('选择工位')
-          .fontSize($r('app.float.process_card_middle_font_size'))
+          .fontSize($r('app.float.process_card_large_font_size'))
           .fontWeight(FontWeight.Medium)
           .fontColor($r('app.color.general_font_color'))
           .opacity($r('app.float.general_font_opacity'))
@@ -350,12 +363,12 @@ struct SelectWorkstationDialog {
                 Text(item.name)
                   .fontSize($r('app.float.process_card_small_font_size'))
                   .fontWeight(FontWeight.Medium)
-                  .fontColor($r('app.color.general_font_color'))
+                  .fontColor(this.workstation && this.workstation.id === item.id ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
                   .opacity($r('app.float.general_font_opacity'))
               }
               .height('15%')
               .width('80%')
-              .backgroundColor($r('app.color.general_card_background_color'))
+              .backgroundColor(this.workstation && this.workstation.id === item.id ? $r('app.color.order_select_background') : $r('app.color.general_card_background_color'))
               .borderRadius($r('app.float.general_border_radius'))
               .padding({left: 10})
               .onClick(()=>{

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

@@ -222,9 +222,12 @@ struct ProcessStepPage {
             } else if (this.processSteps && this.processSteps.length > 0 && this.processSteps[this.selectStep].compentType.toString() === '3') {
               MultimediaCollectView({startWorkInfo: this.startWorkInfo})
             } else if (this.processSteps && this.processSteps.length > 0 && this.processSteps[this.selectStep].compentType.toString() === '4') {
-              EsopView()
+              EsopView({operationId: this.process.operationId,})
             } else if (this.processSteps && this.processSteps.length > 0 && this.processSteps[this.selectStep].compentType.toString() === '5') {
-              SpotCheckView()
+              SpotCheckView({
+                operationId: this.process.operationId,
+                processId: this.startWorkInfo.id
+              })
             } else if (this.processSteps && this.processSteps.length > 0 && this.processSteps[this.selectStep].compentType.toString() === '6') {
               EquipRecordView()
             } else if (this.processSteps && this.processSteps.length > 0 && this.processSteps[this.selectStep].compentType.toString() === '7') {

+ 1 - 0
entry/src/main/ets/view/processview/EquipRecordView.ets

@@ -202,6 +202,7 @@ class EquipCheckRecord {
   equipType?: number
   // 设备类型名称
   equipTypeName?: string
+  // 设备名称
   equipName?: string
   // 检定标准
   checkStandard?: string

Plik diff jest za duży
+ 73 - 17
entry/src/main/ets/view/processview/EsopView.ets


+ 118 - 40
entry/src/main/ets/view/processview/SpotCheckView.ets

@@ -1,16 +1,32 @@
+import CommonConstants from '../../common/constants/CommonConstants'
+import JGRequest from '../../common/util/request/Request'
+
 @Component
 export struct SpotCheckView {
+  // 生产过程id(开工信息id)
+  processId: number
+  // 工序id
+  operationId: number
+  @State checkArray: CheckItem[] = []
+
+  @State resultArray: string[] = []
+  async aboutToAppear() {
+    this.checkArray = await JGRequest.post('/api/v1/process/check/list', {
+      "operationId": this.operationId,
+      "processId": this.processId,
+    })
 
-  @State checkArray: CheckItem[] = [
-    {checkName: '外观尺寸检查', unit: 'cm', standardValue: 10, upperLimit: 10.3, lowerLimit: 9.8, actualValue: 0},
-    {checkName: '外观尺寸检查', unit: 'cm', standardValue: 10, upperLimit: 10.3, lowerLimit: 9.8, actualValue: 0, checkResult:1},
-    {checkName: '外观尺寸检查', unit: 'cm', standardValue: 10, upperLimit: 10.3, lowerLimit: 9.8, actualValue: 0, checkResult: 2},
-  ]
+    if (this.checkArray && this.checkArray.length > 0) {
+      for (const check of this.checkArray) {
+        this.resultArray.push(check.result ? check.result : '')
+      }
+    }
+  }
 
   build() {
     Column() {
       Grid() {
-        ForEach(this.checkArray, (item: CheckItem) => {
+        ForEach(this.checkArray, (item: CheckItem, index: number) => {
           GridItem() {
             Row() {
               Column() {
@@ -25,17 +41,17 @@ export struct SpotCheckView {
                   .opacity($r('app.float.process_step_font_opacity'))
                   .fontWeight(FontWeight.Regular)
                 Row().height('12%')
-                Text('标准值:' + item.standardValue)
+                Text('标准值:' + item.standard)
                   .fontSize($r('app.float.process_card_small_font_size'))
                   .fontColor($r('app.color.general_font_color'))
                   .opacity($r('app.float.process_step_font_opacity'))
                   .fontWeight(FontWeight.Regular)
-                Text('上限值:' + item.upperLimit)
+                Text('上限值:' + item.upper)
                   .fontSize($r('app.float.process_card_small_font_size'))
                   .fontColor($r('app.color.general_font_color'))
                   .opacity($r('app.float.process_step_font_opacity'))
                   .fontWeight(FontWeight.Regular)
-                Text('下线值:' + item.lowerLimit)
+                Text('下限值:' + item.lower)
                   .fontSize($r('app.float.process_card_small_font_size'))
                   .fontColor($r('app.color.general_font_color'))
                   .opacity($r('app.float.process_step_font_opacity'))
@@ -43,36 +59,65 @@ export struct SpotCheckView {
               }
               .width('56%')
               .height('100%')
-              .padding({left: '7%'})
+              .padding({ left: '7%' })
               .alignItems(HorizontalAlign.Start)
               .justifyContent(FlexAlign.Center)
 
-              Column({space:5}) {
+              Column({ space: 5 }) {
                 Text('结果')
                   .fontSize($r('app.float.process_card_small_font_size'))
                   .fontColor($r('app.color.general_font_color'))
                   .opacity($r('app.float.process_step_font_opacity'))
                   .fontWeight(FontWeight.Regular)
-               Row({space: 10}) {
-                 Text('合格')
-                   .fontSize($r('app.float.process_card_middle_font_size'))
-                   .fontColor($r('app.color.general_font_color'))
-                   .fontWeight(FontWeight.Medium)
-                   .textAlign(TextAlign.Center)
-                   .backgroundColor(item.checkResult && item.checkResult === 1 ? $r('app.color.process_card_green_color') : $r('app.color.process_card_grey_color'))
-                   .borderRadius($r('app.float.general_border_radius'))
-                   .height('32%')
-                   .width('40%')
-                 Text('不合格')
-                   .fontSize($r('app.float.process_card_middle_font_size'))
-                   .fontColor($r('app.color.general_font_color'))
-                   .fontWeight(FontWeight.Medium)
-                   .textAlign(TextAlign.Center)
-                   .backgroundColor(item.checkResult && item.checkResult === 2 ? $r('app.color.process_card_red_color') : $r('app.color.process_card_grey_color'))
-                   .borderRadius($r('app.float.general_border_radius'))
-                   .width('40%')
-                   .height('32%')
-               }
+                Row({ space: 10 }) {
+                  Row() {
+                    Text('合格')
+                      .fontSize($r('app.float.process_card_middle_font_size'))
+                      .fontColor(this.resultArray[index] === '1' ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
+                      .fontWeight(FontWeight.Medium)
+                  }
+                  .backgroundColor(this.resultArray[index] === '1' ? $r('app.color.process_card_green_color') : $r('app.color.process_card_grey_color'))
+                  .borderRadius($r('app.float.general_border_radius'))
+                  .justifyContent(FlexAlign.Center)
+                  .height('32%')
+                  .width('40%')
+                  .onClick(async () => {
+                    if (item.result && item.result === '1') {
+                      return
+                    }
+                    await JGRequest.post('/api/v1/process/check/update', {
+                      "id": item.id,
+                      "operator": CommonConstants.USER_ID,
+                      "processId": this.processId,
+                      "result": 1
+                    })
+                    this.resultArray[index] = '1'
+                  })
+
+                  Row() {
+                    Text('不合格')
+                      .fontSize($r('app.float.process_card_middle_font_size'))
+                      .fontColor(this.resultArray[index] === '2' ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
+                      .fontWeight(FontWeight.Medium)
+                  }
+                  .backgroundColor(this.resultArray[index] === '2' ? $r('app.color.process_card_red_color') : $r('app.color.process_card_grey_color'))
+                  .borderRadius($r('app.float.general_border_radius'))
+                  .justifyContent(FlexAlign.Center)
+                  .width('40%')
+                  .height('32%')
+                  .onClick(async () => {
+                    if (item.result && item.result === '2') {
+                      return
+                    }
+                    await JGRequest.post('/api/v1/process/check/update', {
+                      "id": item.id,
+                      "operator": CommonConstants.USER_ID,
+                      "processId": this.processId,
+                      "result": 2
+                    })
+                    this.resultArray[index] = '2'
+                  })
+                }
               }
               .width('44%')
               .height('100%')
@@ -90,21 +135,54 @@ export struct SpotCheckView {
       .columnsTemplate('1fr 1fr')
       .width('98%')
       .rowsGap(10)
-      .margin({top: 10})
+      .margin({ top: 10 })
     }
     .width('100%')
     .height('100%')
   }
 }
 
-
 class CheckItem {
-  unit?: string
+  // 创建时间
+  created?: string
+  // 创建人
+  creator?: string
+  // 删除标识
+  deleted?: number
+  // 部门ID
+  deptId?: string
+  // 主键id
+  id?: number
+  // 修改时间
+  updated?: string
+  // 上次修改人
+  updator?: string
+  // 工序点检项编码
+  checkCode?: string
+  // 工序点检项名称
   checkName?: string
-  standardValue?: number
-  upperLimit?: number
-  lowerLimit?: number
-  actualValue?: number
-  // 1.合格 2.不合格
-  checkResult?: number
+  // 内容
+  content?: string
+  // 下限值
+  lower?: string
+  // 工序检验项id
+  operationCheckId?: string
+  // 操作人
+  operator?: string
+  // 组织ID
+  orgId?: string
+  // 生产过程id
+  processId?: string
+  // 结果
+  result?: string
+  // 排序号
+  sortNum?: number
+  // 标准值
+  standard?: string
+  // 步骤id
+  stepInstanceId?: string
+  // 单位
+  unit?: string
+  // 上限值
+  upper?: string
 }