소스 검색

记录项相关接口对接

hh 1 년 전
부모
커밋
9cb08f1d9e

+ 9 - 6
entry/src/main/ets/common/component/AddAndSubtractComp.ets

@@ -9,9 +9,10 @@ export struct AddAndSubtractComp {
   // 输入值上限、下限
   upperLimit: number
   lowerLimit: number
-  // 点击加、减事件调用的方法
+  // 点击加、减事件调用的方法,及输入修改调用的方法
   addFunction: Function
   subFunction: Function
+  editFunction: Function
 
   build() {
     Row() {
@@ -56,17 +57,19 @@ export struct AddAndSubtractComp {
               if (this.obj) {
                 this.obj[this.editPropertyName] = this.inputNum
               }
-              return
             } else if (this.upperLimit && num > this.upperLimit) {
               this.inputNum = this.upperLimit
               if (this.obj) {
                 this.obj[this.editPropertyName] = this.inputNum
               }
-              return
+            } else {
+              this.inputNum = num
+              if (this.obj) {
+                this.obj[this.editPropertyName] = this.inputNum
+              }
             }
-            this.inputNum = num
-            if (this.obj) {
-              this.obj[this.editPropertyName] = this.inputNum
+            if (this.editFunction) {
+              this.editFunction()
             }
           })
       }

+ 0 - 17
entry/src/main/ets/model/processmodel/ProcessData.ets

@@ -1,17 +0,0 @@
-/*
- * 工序数据类
- * */
-export default class ProcessData {
-  // 主键id
-  id: number;
-  // 序号
-  sortNum: number;
-  // 工序名称
-  processName: string;
-  // 订单id
-  orderId: number
-  // 已完成数
-  completedQuantity:number;
-  // 工序状态 (1:已完成 2:未完成)
-  processState?: number = 2;
-}

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

@@ -408,9 +408,12 @@ struct ProcessHome {
               .onClick(async ()=>{
                 // todo 应该对接扫码枪,扫描到序列号,然后处理以下逻辑
                 let res: StartWorkInfo = await JGRequest.post("/api/v1/process/info/scan", {
-                  "operationId": this.processes[this.selectProcess].operationId,
-                  "qrCode": "20240402000054",
-                  "workOrderCode": this.orderArray[this.selectOrder].workOrderCode
+                  // "operationId": this.processes[this.selectProcess].operationId,
+                  // "qrCode": "20240402000054",
+                  // "workOrderCode": this.orderArray[this.selectOrder].workOrderCode
+                  "operationId": 20,
+                  "qrCode": "20240408000011",
+                  "workOrderCode": "GD2404080001"
                 })
 
                 router.pushUrl({

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

@@ -33,7 +33,6 @@ struct ProcessStepPage {
   startWorkInfo: StartWorkInfo = {materialCode: 'BL000001', materialName:'数据链处理机板硬件(国产化)', seqNo: '20240402000054'}
   @State process: ProcessData = {operationId: 129, completeNum:'101',operationCode:'32434', operationSort:1, operationName: '物流采集'}
 
-  // @State product: ProductInfo = CommonConstants.PRODUCT_DATA
   @State productSteps: ProcessStep[] = []
 
   private stepImages: Resource[] = CommonConstants.STEP_IMAGES
@@ -216,7 +215,10 @@ struct ProcessStepPage {
                 process: $process,
               })
             } else if (this.productSteps[this.selectStep].compentType === 2) {
-              RecordItemView()
+              RecordItemView({
+                operationId: this.process.operationId,
+                processId: this.startWorkInfo.id
+              })
             } else if (this.productSteps[this.selectStep].compentType === 3) {
               MultimediaCollectView()
             } else if (this.productSteps[this.selectStep].compentType === 4) {

+ 79 - 33
entry/src/main/ets/view/processview/RecordItemView.ets

@@ -1,19 +1,21 @@
 import { AddAndSubtractComp } from '../../common/component/AddAndSubtractComp'
+import JGRequest from '../../common/util/request/Request'
 
 @Component
 export struct RecordItemView {
-  @State recordArray: RecordItem[] = [
-    {unit: 'cm', standardValue: 10, upperLimit: 100, lowerLimit: 5, actualValue: 0},
-    {unit: 'cm', standardValue: 10, upperLimit: 10.3, lowerLimit: 9.8, actualValue: 0},
-    {unit: 'cm', standardValue: 10, upperLimit: 10.3, lowerLimit: 9.8, actualValue: 0},
-    {unit: 'cm', standardValue: 10, upperLimit: 10.3, lowerLimit: 9.8, actualValue: 0},
-    {unit: 'cm', standardValue: 10, upperLimit: 10.3, lowerLimit: 9.8, actualValue: 0},
-    {unit: 'cm', standardValue: 10, upperLimit: 10.3, lowerLimit: 9.8, actualValue: 0},
-    {unit: 'cm', standardValue: 10, upperLimit: 10.3, lowerLimit: 9.8, actualValue: 0},
-  ]
+  @State recordArray: RecordItem[] = []
 
-  // todo 查询数据
-  aboutToAppear() {
+  // 生产过程id(开工信息id)
+  processId: number
+  // 工序id
+  operationId: number
+
+  async aboutToAppear() {
+    this.recordArray = await JGRequest.post("/api/v1/process/opRecord/list", {
+      // todo 参数修改
+      "operationId": 129,
+      "processId": 1
+    })
   }
 
   build() {
@@ -34,17 +36,17 @@ export struct RecordItemView {
                   .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'))
@@ -64,30 +66,35 @@ export struct RecordItemView {
                   .fontWeight(FontWeight.Regular)
                 Row() {
                   AddAndSubtractComp({
-                    inputNum: item.actualValue,
+                    inputNum: item.realValue,
                     obj: item,
-                    editPropertyName: 'actualValue',
-                    upperLimit: item.upperLimit,
-                    lowerLimit: item.lowerLimit,
+                    editPropertyName: 'realValue',
+                    upperLimit: item.upper,
+                    lowerLimit: item.lower,
                     addFunction: ()=>{
-                      item.actualValue++
+                      item.realValue++
                       this.recordArray[index] = {
                         unit: item.unit,
-                        standardValue: item.standardValue,
-                        upperLimit: item.upperLimit,
-                        lowerLimit: item.lowerLimit,
-                        actualValue: item.actualValue
+                        standard: item.standard,
+                        upper: item.upper,
+                        lower: item.lower,
+                        realValue: item.realValue
                       }
+                      this.updateRealValue(index)
                     },
                     subFunction: ()=>{
-                      item.actualValue--
+                      item.realValue--
                       this.recordArray[index] = {
                         unit: item.unit,
-                        standardValue: item.standardValue,
-                        upperLimit: item.upperLimit,
-                        lowerLimit: item.lowerLimit,
-                        actualValue: item.actualValue
+                        standard: item.standard,
+                        upper: item.upper,
+                        lower: item.lower,
+                        realValue: item.realValue
                       }
+                      this.updateRealValue(index)
+                    },
+                    editFunction: ()=>{
+                      this.updateRealValue(index)
                     }
                   })
                 }
@@ -115,12 +122,51 @@ export struct RecordItemView {
     .width('100%')
     .height('100%')
   }
+
+  updateRealValue(index: number) {
+    JGRequest.post('/api/v1/process/opRecord/update', {
+      "id": this.recordArray[index].id,
+      "realValue": this.recordArray[index].realValue,
+    })
+  }
 }
 
+
 class RecordItem {
-  unit: string
-  standardValue: number
-  upperLimit: number
-  lowerLimit: number
-  public actualValue: number
+  // 创建时间
+  created?: string
+  // 创建人
+  creator?: string
+  // 删除标识
+  deleted?: number
+  // 部门ID
+  deptId?: string
+  // 主键id
+  id?: number
+  // 下限值
+  lower?: number
+  // 工序记录项id
+  operationRecordId?: string
+  // 组织ID
+  orgId?: string
+  // 生产过程id
+  processId?: string
+  // 实际值
+  realValue?: number
+  // 排序号
+  sortNum?: number
+  // 标准值
+  standard?: number
+  // 步骤id
+  stepInstanceId?: string
+  // 记录项内容
+  thName?: string
+  // 单位
+  unit?: string
+  // 修改时间
+  updated?: string
+  // 上次修改人
+  updator?: string
+  // 上限值
+  upper?: number
 }

+ 1 - 1
entry/src/main/ets/viewmodel/StartWorkInfo.ets

@@ -13,7 +13,7 @@ export default class StartWorkInfo {
   // 部门ID
   deptId?: string
   // 主键
-  id?: string
+  id?: number
   // 物料编码
   materialCode?: string
   // 物料型号