2 Achegas 60f6a3eef5 ... 2a8e22561a

Autor SHA1 Mensaxe Data
  hh 2a8e22561a Merge remote-tracking branch 'origin/master' hai 1 ano
  hh 3019eb411f 对接生产设备信息接口;登录后查询数据字典 hai 1 ano

+ 4 - 5
entry/src/main/ets/common/constants/CommonConstants.ets

@@ -5,6 +5,8 @@ import ProcessHandleData from '../../model/processmodel/ProcessHandleData'
 import ProcessStandardData from '../../model/processmodel/ProcessStandardData'
 import ProductInfo from '../../model/processmodel/ProductInfo'
 import RobotInfo from '../../model/RobotInfo'
+import HashMap from '@ohos.util.HashMap'
+import DictValue from '../../model/DictValue'
 
 export default class CommonConstants {
 
@@ -14,6 +16,8 @@ export default class CommonConstants {
   // 附件地址前缀
   static FILE_URL_PREFIX : string = 'http://192.168.101.4:9000'
 
+  static DICT_DATA: HashMap<string, DictValue[]> = new HashMap<string, DictValue[]>()
+
   // 当前登录用户id
   static USER_ID : number = 1
 
@@ -30,11 +34,6 @@ export default class CommonConstants {
     {id:1, storageName:'晶格智能仓储1', xSize:7, ySize: 5, defaultLayer:5},
   ]
 
-  // 工步数据
-  static readonly PRODUCT_DATA: ProductInfo = {
-    id:1,productName:'SASD-FSDDS-大天线', productCode: 'SASD-FSDDS_ASDFSFDGHFS', productModel: ''
-  }
-
   // 工步展示图
   static readonly STEP_IMAGES: Resource[] = [
     $r('app.media.material_collect_black'), $r('app.media.record_item_black'), $r('app.media.multimedia_collect_black'),

+ 1 - 1
entry/src/main/ets/model/DetailsList.ets

@@ -1,4 +1,4 @@
-export default class detailsList{
+export default class DetailsList {
   index?:number
   //产品规格
   spec?:string

+ 8 - 0
entry/src/main/ets/model/DictInfo.ets

@@ -0,0 +1,8 @@
+import DictValue from './DictValue'
+
+export default class DictInfo {
+  // 字典编码
+  dictCode?: string
+  // 字典值
+  list?: DictValue[]
+}

+ 8 - 0
entry/src/main/ets/model/DictValue.ets

@@ -0,0 +1,8 @@
+export default class DictValue {
+  // 字典标签
+  dictLabel?: string
+  // 字典排序
+  dictSort?: number
+  // 字典值
+  dictValue?: string
+}

+ 10 - 2
entry/src/main/ets/pages/Index.ets

@@ -8,8 +8,8 @@ import { SmartFactoryCard }from  '../common/component/SmartFactoryCard'
 import CommonConstants from '../common/constants/CommonConstants'
 import UniversalCard from  '../model/UniversalCard'
 import UniversalCardModel from '../model/database/UniversalCardModel';
-import formProvider from '@ohos.app.form.formProvider';
-import UserInfo from '../model/UserInfo';
+import JGRequest from '../common/util/request/Request';
+import DictInfo from '../model/DictInfo';
 
 //登录退出
 @CustomDialog
@@ -270,6 +270,14 @@ struct Index {
   })
 
   async aboutToAppear(){
+    // 查询数据字典放到CommonConstants的DICT_DATA变量中
+    let res: DictInfo[] = await JGRequest.post('/api/v1/sys/dictData/all', {})
+    if (res && res.length > 0) {
+      for (const dict of res) {
+        CommonConstants.DICT_DATA.set(dict.dictCode, dict.list)
+      }
+    }
+
     // 1.根据当前用户id查询他配置的万能卡片
     this.cardServices = await UniversalCardModel.getListByUserId(CommonConstants.USER_ID)
     if (!this.cardServices || this.cardServices.length <= 0) {

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

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

+ 102 - 36
entry/src/main/ets/view/processview/EquipRecordView.ets

@@ -1,17 +1,28 @@
+import CommonConstants from '../../common/constants/CommonConstants'
+import JGRequest from '../../common/util/request/Request'
+import DictValue from '../../model/DictValue'
+
 @Component
 export struct EquipRecordView {
 
   private clickTypeName: string = ''
-  @State recordArray: EquipCheckRecord[] = [
-    {equipName: '高温试验箱001', equipType: 1, checkStandard: '高温:50~100℃ 低温:-5~-10℃ ±1℃', recordCode: 'sds12313213213213231', checkPeriod: '2026-11-11', isExpired:2},
-    {equipName: '高温试验箱002', equipType: 1, checkStandard: '高温:50~100℃ 低温:-5~-10℃ ±1℃', recordCode: 'sds123132132132132e3', isExpired:1 },
-    {equipName: '高温试验箱003', equipType: 1, checkStandard: '高温:50~100℃ 低温:-5~-10℃ ±1℃', recordCode: 'sds1231321321321cf41', isExpired:1 },
-  ]
+  @State equipArray: EquipCheckRecord[] = []
+  selectEquip: number = 0
+
+  // 生产过程id(开工信息id)
+  processId: number = 0
+  // 工序id
+  operationId: number = 0
+
+  dictCode: string = 'device_type'
 
   // 扫描设备弹框
   scanEquipController: CustomDialogController = new CustomDialogController({
     builder: ScanEquipDialog({
-      equipTypeName: this.clickTypeName
+      equipTypeName: this.clickTypeName,
+      processId: this.processId,
+      equipId: this.equipArray[this.selectEquip].id,
+      operationId: this.operationId,
     }),
     autoCancel: true,
     alignment: DialogAlignment.Center,
@@ -19,10 +30,26 @@ export struct EquipRecordView {
     customStyle: true,
   })
 
-  aboutToAppear() {
-    for (const record of this.recordArray) {
-      if (record.equipType === 1) {
-        record.equipTypeName = '高低温试验箱'
+  async aboutToAppear() {
+    this.equipArray = await JGRequest.post('/api/v1/process/equit/list', {
+      "operationId": this.operationId,
+      "processId": this.processId
+    })
+    if (this.equipArray && this.equipArray.length > 0) {
+      let dictList: DictValue[] = CommonConstants.DICT_DATA.get(this.dictCode);
+      if (!dictList || dictList.length <= 0) {
+        dictList = await JGRequest.get('/api/v1/sys/dictData/queryByType/' + this.dictCode, {})
+      }
+      // 封装设备类型名称 (数据字典)
+      if (dictList && dictList.length > 0) {
+        for (const equip of this.equipArray) {
+          for (const dict of dictList) {
+            if (equip.equitType === dict.dictValue) {
+              equip.equipTypeName = dict.dictLabel
+              break
+            }
+          }
+        }
       }
     }
   }
@@ -30,11 +57,11 @@ export struct EquipRecordView {
   build() {
     Column() {
       Grid() {
-        ForEach(this.recordArray, (item: EquipCheckRecord) => {
+        ForEach(this.equipArray, (item: EquipCheckRecord, index: number) => {
           GridItem() {
             Column({space: 10}) {
               Row() {
-                Text(item.equipTypeName)
+                Text(item.equitType)
                   .fontSize($r('app.float.process_card_middle_font_size'))
                   .fontColor($r('app.color.general_font_color'))
                   .opacity($r('app.float.general_font_opacity'))
@@ -50,7 +77,7 @@ export struct EquipRecordView {
                   .opacity($r('app.float.process_step_font_opacity'))
                   .fontWeight(FontWeight.Regular)
 
-                Text(item.checkStandard)
+                Text(item.accuracy)
                   .fontSize($r('app.float.process_card_small_font_size'))
                   .fontColor($r('app.color.general_font_color'))
                   .opacity($r('app.float.general_font_opacity'))
@@ -59,7 +86,7 @@ export struct EquipRecordView {
               .width('92%')
               .alignItems(HorizontalAlign.Start)
               Row() {
-                if (item.isExpired && item.isExpired === 1) {
+                if (!item.equitCode || item.equitCode.length <= 0) {
                   Text('点击扫描设备')
                     .fontSize($r('app.float.process_card_middle_font_size'))
                     .fontColor($r('app.color.general_font_white_color'))
@@ -68,17 +95,18 @@ export struct EquipRecordView {
                     .width('100%')
                     .textAlign(TextAlign.Center)
                     .onClick(()=> {
-                      this.clickTypeName = item.equipTypeName
+                      this.clickTypeName = item.equitType
+                      this.selectEquip = index
                       this.scanEquipController.open()
                     })
                 } else {
                   Column() {
-                    Text(item.equipName)
+                    Text(item.equitName)
                       .fontSize($r('app.float.process_card_small_font_size'))
                       .fontColor($r('app.color.general_font_color'))
                       .opacity($r('app.float.general_font_opacity'))
                       .fontWeight(FontWeight.Medium)
-                    Text(item.recordCode)
+                    Text(item.equitCode)
                       .fontSize($r('app.float.process_card_small_font_size'))
                       .fontColor($r('app.color.general_font_color'))
                       .opacity($r('app.float.process_step_font_opacity'))
@@ -92,7 +120,7 @@ export struct EquipRecordView {
                       .fontColor($r('app.color.general_font_color'))
                       .opacity($r('app.float.process_step_font_opacity'))
                       .fontWeight(FontWeight.Regular)
-                    Text(item.checkPeriod)
+                    Text(item.validDate)
                       .fontSize($r('app.float.process_card_small_font_size'))
                       .fontColor($r('app.color.general_font_color'))
                       .opacity($r('app.float.general_font_opacity'))
@@ -105,7 +133,7 @@ export struct EquipRecordView {
               .width('93%')
               .height('35%')
               .borderRadius($r('app.float.general_border_radius'))
-              .backgroundColor(item.isExpired === 1 ? $r('app.color.process_card_blue_color') : $r('app.color.process_card_grey_color'))
+              .backgroundColor((!item.equitCode || item.equitCode.length <= 0) ? $r('app.color.process_card_blue_color') : $r('app.color.process_card_grey_color'))
               .justifyContent(FlexAlign.Center)
             }
             .width('96%')
@@ -129,6 +157,14 @@ export struct EquipRecordView {
 @CustomDialog
 struct ScanEquipDialog {
   private equipTypeName: string
+
+  // 生产过程id(开工信息id)
+  processId: number
+  // 工序id
+  operationId: number
+  equipId: string
+  @State equipCode: string = ''
+
   controller?: CustomDialogController
   cancel: () => void = () => {}
   confirm: () => void = () => {}
@@ -161,7 +197,7 @@ struct ScanEquipDialog {
         .width('8%')
         .justifyContent(FlexAlign.End)
 
-        TextInput({ placeholder: '请扫描物料编码' })
+        TextInput({ placeholder: '请扫描物料编码', text: this.equipCode })
           .placeholderColor($r('app.color.text_input_placeholder_font_color'))
           .placeholderFont({size: $r('app.float.robot_set_font_size'), weight: FontWeight.Medium})
           .fontSize($r('app.float.robot_set_font_size'))
@@ -174,10 +210,15 @@ struct ScanEquipDialog {
           .borderRadius($r('app.float.robot_set_radius'))
           .backgroundColor($r('app.color.general_font_white_color'))
           .onChange((value: string) => {
-
+            this.equipCode = value
           })
           .onSubmit(() => {
-
+            JGRequest.post('/api/v1/process/equit/update', {
+              "equitCode": this.equipCode,
+              "processId": this.processId,
+              "id": this.equipId,
+              "operationId": this.operationId,
+            })
           })
       }
       .height('32%')
@@ -196,20 +237,45 @@ struct ScanEquipDialog {
 }
 
 class EquipCheckRecord {
+  // 创建时间
+  created?:	string
+  // 创建人
+  creator?:	string
+  // 删除标识
+  deleted?: number
+  // 部门ID
+  deptId?: string
+  // 修改时间
+  updated?:	string
+  // 上次修改人
+  updator?:	string
+  // 主键
+  id?: string
+  // 精度要求
+  accuracy?: string
+  // 设备编码
+  equitCode?: string
   // 设备id
-  equipId?: number
-  // 设备类型(1:高低温试验箱)
-  equipType?: number
-  // 设备类型名称
-  equipTypeName?: string
+  equitId?: string
   // 设备名称
-  equipName?: string
-  // 检定标准
-  checkStandard?: string
-  // 记录号
-  recordCode?: string
-  // 检定有效期
-  checkPeriod?: string
-  // 1:检查已过期 2:未过期
-  isExpired?: number
+  equitName?: string
+  // 设备类型
+  equitType?: string
+  // 订单id
+  orderId?: string
+  // 组织ID
+  orgId?: string
+  // 生产过程id
+  processId?: string
+  // 排序号
+  sortNum?: number
+  // 步骤id
+  stepInstanceId?: string
+  // 设备有效期
+  validDate?: string
+  // 工单id
+  workOrderId?: string
+
+  // 设备类型名称(查询数据字典)
+  equipTypeName?: string
 }

+ 8 - 3
entry/src/main/ets/view/processview/MultimediaCollectView.ets

@@ -12,7 +12,10 @@ export struct MultimediaCollectView {
   // 是否可选,默认不能选择,也不会出现删除的选项;长按某一张图片后才能选择
   @State canSelect: boolean = false
 
-  startWorkInfo: StartWorkInfo
+  // 生产过程id(开工信息id)
+  processId: number
+  // 工序id
+  operationId: number
 
   pageNo: number = 1
   pageSize: number = 10
@@ -24,7 +27,8 @@ export struct MultimediaCollectView {
     let res: PageModel<CollectData> = await JGRequest.post('/api/v1/process/media/page', {
       "pageNo": this.pageNo,
       "pageSize": this.pageSize,
-      "processId": this.startWorkInfo.id
+      "processId": this.processId,
+      "operationId": this.operationId,
     })
     if (res && res.records && res.records.length > 0) {
       this.collectImages = res.records
@@ -35,7 +39,8 @@ export struct MultimediaCollectView {
         res = await JGRequest.post('/api/v1/process/media/page', {
           "pageNo": this.pageNo,
           "pageSize": this.pageSize,
-          "processId": this.startWorkInfo.id
+          "processId": this.processId,
+          "operationId": this.operationId,
         })
         this.totalPages = res.totalPages
         this.pageNo++