소스 검색

修改物料采集

hh 1 주 전
부모
커밋
ced11486c0

+ 9 - 9
entry/src/main/ets/common/constants/CommonConstants.ets

@@ -11,15 +11,15 @@ export default class CommonConstants {
   static PICTURE_URL_PREFIX: string = 'http://192.168.1.3:20001'
 
   // 当前登录用户相关信息
-  static USER_ID?: number
-  static USER_NAME: string = ''
-  static USER_AVATAR: string = ''
-  static STATION_NANE: string = ''
-  static DEPARTMENT_NANE: string = ''
-  static PRODUCT_NANE: string = ''
-  static STATION_ID: number
-  static STATION_CODE: string = ''
-  static STATION_IP: string = ''
+  // static USER_ID?: number
+  // static USER_NAME: string = ''
+  // static USER_AVATAR: string = ''
+  // static STATION_NANE: string = ''
+  // static DEPARTMENT_NANE: string = ''
+  // static PRODUCT_NANE: string = ''
+  // static STATION_ID: number
+  // static STATION_CODE: string = ''
+  // static STATION_IP: string = ''
   static stationDictValue: string = ''
 
   static MATERIAL_BOX_ID: string = ''

+ 2 - 2
entry/src/main/ets/common/util/request/ProcessRequest.ets

@@ -13,9 +13,9 @@ import { printError, printRequest, printResponse, handleRes } from './Helps';
 // jiaxiaoqiang:这里要改
 //const baseUrl = "http://192.168.1.3:11010/" //chuangke
 //const baseUrl = "http://192.168.1.174:8079"//huajing
-const baseUrl = "http://192.168.1.3:20010"//huajing
+// const baseUrl = "http://192.168.1.3:20010"//huajing
 // huhao本地
-// const baseUrl = "http://192.168.1.246:8079"
+const baseUrl = "http://192.168.1.246:8079"
 const DEBUG = true //
 
 // 创建实例

+ 52 - 13
entry/src/main/ets/pages/ProcessIndex.ets

@@ -15,6 +15,7 @@ import { SwitchingUserDialog } from '../view/SwitchingUserDialog';
 import OperationComponent from '../viewmodel/process/OperationComponent';
 import ProcessInfo from '../viewmodel/process/ProcessInfo';
 import { MaterialCollectView } from '../view/process/MaterialCollectView';
+import { WorkOrderPage } from '../viewmodel/WorkOrderPage';
 
 @Entry
 @Component
@@ -64,8 +65,40 @@ struct ProcessIndex {
   @Provide('currentStation') currentStation:string = ''
   @Provide('currentPLCode') currentPLCode:string = ''
   @Provide('currentOrgId') currentOrgId:number = 0
-  @Provide('currentStationId') currentStationId:string =''
-  @Provide('currentUserName') currentUserName :string =''
+  @Provide('currentStationId') @Watch('refreshWorkOrder') currentStationId: string = ''
+  @Provide('currentUserName') currentUserName: string =''
+
+  // 工位发生改变则可能需要重新选择工单
+  async refreshWorkOrder() {
+    if (!this.selectWorkOder || !this.selectWorkOder.workOrderCode) {
+      return
+    }
+    console.log('hhtest', '执行刷新------' +this.currentStationId)
+    let queryRes = await ProcessRequest.post('/api/v1/plan/workOrder/taskPage', {
+      stationId: this.currentStationId,
+      queryComplete: 0,
+    } as RequestParamModel) as WorkOrderPage;
+    this.workOrders = queryRes?.records??[]
+    if (this.workOrders) {
+      let clearFlag: boolean = true
+      for (const element of this.workOrders) {
+        console.log('hhtest', '工单编码-----------------' + element.workOrderCode)
+        if (element.workOrderCode! === this.selectWorkOder.workOrderCode) {
+          clearFlag = false
+          break
+        }
+      }
+      if (clearFlag) {
+        this.selectWorkOder = {}
+        this.selectOrderController.open()
+        console.log('hhtest', '选择工单被清空-----------------')
+      }
+    } else {
+      this.selectWorkOder = {}
+      this.selectOrderController.open()
+      console.log('hhtest', '选择工单被清空-----------------')
+    }
+  }
 
   // 选择工单弹窗控制器
   selectOrderController: CustomDialogController = new CustomDialogController({
@@ -74,7 +107,7 @@ struct ProcessIndex {
     }),
     autoCancel: true, // 点击遮罩关闭
     customStyle: true,
-    // alignment:DialogAlignment.Center,
+    alignment:DialogAlignment.Center,
     maskColor: 'rgba(0,0,0,0.8)',  // 黑色遮罩
   })
   // 选择工位和用户弹窗控制器
@@ -87,6 +120,7 @@ struct ProcessIndex {
     }),
     autoCancel: true, // 点击遮罩关闭
     customStyle: true,
+    alignment:DialogAlignment.Center,
     maskColor: 'rgba(0,0,0,0.8)',  // 黑色遮罩
   })
   //切换部门弹窗控制器
@@ -94,6 +128,7 @@ struct ProcessIndex {
     builder: SwitchingDeptDialog({}),
     autoCancel: true, // 点击遮罩关闭
     customStyle: true,
+    alignment:DialogAlignment.Center,
     maskColor: 'rgba(0,0,0,0.8)',  // 黑色遮罩
   })
   // 切换产线弹窗控制器
@@ -101,6 +136,7 @@ struct ProcessIndex {
     builder: SwitchingProductLineDialog({}),
     autoCancel: true, // 点击遮罩关闭
     customStyle: true,
+    alignment:DialogAlignment.Center,
     maskColor: 'rgba(0,0,0,0.8)',  // 黑色遮罩
   })
   // 切换工位弹窗控制器
@@ -108,6 +144,7 @@ struct ProcessIndex {
     builder: SwitchingStationDialog({}),
     autoCancel: true, // 点击遮罩关闭
     customStyle: true,
+    alignment:DialogAlignment.Center,
     maskColor: 'rgba(0,0,0,0.8)',  // 黑色遮罩
   })
   //切换用户弹窗控制器
@@ -115,6 +152,7 @@ struct ProcessIndex {
     builder: SwitchingUserDialog({}),
     autoCancel: true, // 点击遮罩关闭
     customStyle: true,
+    alignment:DialogAlignment.Center,
     maskColor: 'rgba(0,0,0,0.8)',  // 黑色遮罩
   })
   // 切换产品弹窗控制器
@@ -124,6 +162,7 @@ struct ProcessIndex {
     }),
     autoCancel: true, // 点击遮罩关闭
     customStyle: true,
+    alignment:DialogAlignment.Center,
     maskColor: 'rgba(0,0,0,0.8)',  // 黑色遮罩
   })
 
@@ -151,7 +190,7 @@ struct ProcessIndex {
 
   onQueryTask = async (currentStateList: Array<number>)=>{
     this.taskSeqArray = await ProcessRequest.post('/api/v1/plan/task/list', {
-      stationId: CommonConstants.STATION_ID.toString(),
+      stationId: this.currentStationId,
       workOrderCode: this.selectWorkOder.workOrderCode!,
       operationId: this.selectOperationId,
       stateList: currentStateList
@@ -161,14 +200,7 @@ struct ProcessIndex {
   async aboutToAppear() {
     if (!this.selectWorkOder || !this.selectWorkOder.workOrderCode) {
       this.selectOrderController.open()
-      // this.workOrders = await ProcessRequest.post('/api/v1/plan/workOrder/taskPage', {
-      //   //查询未完成的工单
-      //   queryComplete: 0,
-      //   pageNo: this.pageNo,
-      //   pageSize: this.pageSize
-      // } as RequestParamModel) as WorkOrderInfo[]
     }
-
   }
 
   build() {
@@ -218,7 +250,7 @@ struct ProcessIndex {
                   .fontWeight(FontWeight.Lighter)
                   .fontColor($r('app.color.FFFFFF'))
                   .fontSize($r('app.float.fontSize_12'))
-                Text(this.selectWorkOder.orderCode!)
+                Text(this.selectWorkOder.workOrderCode!)
                   .fontWeight(FontWeight.Bold)
                   .fontColor($r('app.color.FFFFFF'))
                   .fontSize($r('app.float.fontSize_16'))
@@ -357,7 +389,7 @@ struct ProcessIndex {
                       }
                     })
 
-                    if (index < this.selectWorkOder.ops!.length - 1) {
+                    if (index < (this.selectWorkOder?.ops && this.selectWorkOder?.ops?.length ? this.selectWorkOder?.ops!.length : 0) - 1) {
                       Row() {
                         Divider()
                           .vertical(true)
@@ -469,6 +501,13 @@ struct ProcessIndex {
                         return
                       }
                       this.opComponents = await ProcessRequest.get('/api/v1/op/compent/get/' + this.selectOperationId)
+                      if (this.opComponents) {
+                        for (const element of this.opComponents) {
+                          if (CommonConstants.OPERATION_COMPONENT_TYPE.has(element.compentType)) {
+                            element.compentType = CommonConstants.OPERATION_COMPONENT_TYPE.get(element.compentType)
+                          }
+                        }
+                      }
                     })
                 }
                 .width('65%')

+ 257 - 85
entry/src/main/ets/view/ModifyMaterialNumDialog.ets

@@ -1,15 +1,111 @@
 // 数量修改
+import ProcessRequest from '../common/util/request/ProcessRequest'
+import OperationItem from '../viewmodel/OperationItem'
+import ProcessMaterial from '../viewmodel/process/ProcessMaterial'
+import RequestParamModel from '../viewmodel/RequestParamModel'
+import promptAction from '@ohos.promptAction'
+
 @CustomDialog
 export struct ModifyMaterialNumDialog {
-  @Prop currentMaterialName :string = ''
-  @Prop currentMaterialNo :string = ''
-  @Prop currentBatchNo :string = ''
-  @Prop currentUnit :string = ''
-  @Link materialNum :number
-  @State addClick:number = 1
-  @State subClick:number = 1
+  @State materialName :string = ''
+  @State materialModel :string = ''
+  @State unit :string = ''
+  // 总需求数
+  @State needNum: number = 0
+  workOrderCode :string = ''
+  operationId :string = ''
+  processId :string = ''
+  // 新增时扫码搜索到的物料
+  scanMaterial: ProcessMaterial = {}
+  // 新增或者修改采集物料(1:新增 2:修改)
+  addOrModifyCollect: number = 1
+  @State collectMaterials: ProcessMaterial[] = [
+    {
+      batchNo:'dsfs',
+      materialCode:'Y11P1210ZJ10',
+      spec:'Y11P1210ZJ10',
+      materialName:'控制连接器插座',
+      needNum:6.0,
+      operationId:'679',
+      processId:'',
+      num:1.0,
+      unitDictValue: "只",
+      workOrderCode:'10.25.0022'
+    },{
+    batchNo:'32r4regrfd',
+    materialCode:'Y11P0804ZJ102',
+    spec:'Y11P0804ZJ102',
+    materialName:'电源连接器插座',
+    needNum:5.0,
+    operationId:'679',
+    processId:'',
+    num:0,
+    workOrderCode:'10.25.0022'
+  },
+    {
+      batchNo:'sdg',
+      materialCode:'Y11P1210ZJ10',
+      spec:'Y11P1210ZJ10',
+      materialName:'控制连接器插座',
+      needNum:6.0,
+      operationId:'679',
+      processId:'',
+      num:1.0,
+      workOrderCode:'10.25.0022'
+    }
+  ]
+  @State collectNumArray: number[] = []
+
   controller: CustomDialogController
   onConfirm: () => void = () => {}
+
+  async aboutToAppear() {
+    if (!this.scanMaterial) {
+      return
+    }
+    this.materialName = this.scanMaterial.materialName!
+    this.materialModel = this.scanMaterial.spec!
+    this.unit = this.scanMaterial.unitDictValue!
+    // 总需求数
+    this.needNum = this.scanMaterial.totalNum!
+    // 修改物料采集,则先查询采集历史
+    if (this.addOrModifyCollect === 2) {
+      let result: OperationItem[] = await ProcessRequest.post('/v1/process/itemRecord/itemInfo/list',{
+        itemCode: this.scanMaterial.materialCode!,
+        opId: this.operationId,
+        processId: this.processId
+      } as RequestParamModel)
+      if (result) {
+        for (let i = result.length - 1; i >= 0 ;i--) {
+          let material: ProcessMaterial = JSON.parse(JSON.stringify(result[i]))
+          material.materialName = result[i].itemName
+          material.materialCode = result[i].itemCode
+          material.spec = result[i].itemModel
+          material.workOrderCode = this.workOrderCode
+          this.collectMaterials.push(material)
+          this.collectNumArray.push(material.num ? material.num : 0)
+        }
+      }
+    } else {
+      if (this.scanMaterial) {
+        this.collectMaterials.push(this.scanMaterial)
+        let num: number = 0
+        // 如果需求数量小于扫码数量,则默认采集需求数量
+        if (this.scanMaterial.needNum! < this.scanMaterial.num!) {
+          num = this.needNum
+        } else {
+          num = this.scanMaterial.num!
+        }
+        this.collectNumArray.push(num)
+      }
+    }
+
+    // for (const element of this.collectMaterials) {
+    //   this.collectNumArray.push(element.num ? element.num : 0)
+    // }
+    console.log('hhtest', JSON.stringify(this.collectNumArray))
+  }
+
   build() {
     Column() {
       // 标题
@@ -17,94 +113,148 @@ export struct ModifyMaterialNumDialog {
         Text("数量")
           .fontColor($r('app.color.FFFFFF'))
           .fontSize($r('app.float.fontSize_30'))
-      }.height('25%')
+      }
+      .height($r('app.float.virtualSize_112'))
       .justifyContent(FlexAlign.Center)
       Column(){
-        Text(`物料名称:${this.currentMaterialName}`)
-          .fontColor($r('app.color.FFFFFF'))
-          .fontSize($r('app.float.fontSize_16'))
-          .fontWeight(FontWeight.Lighter)
-        Text(`型号:${this.currentMaterialNo}`)
+        Text(`物料名称:${this.materialName}`)
           .fontColor($r('app.color.FFFFFF'))
           .fontSize($r('app.float.fontSize_16'))
           .fontWeight(FontWeight.Lighter)
-        Text(`批次号:${this.currentBatchNo}`)
+        Text(`型号:${this.materialModel}`)
           .fontColor($r('app.color.FFFFFF'))
           .fontSize($r('app.float.fontSize_16'))
           .fontWeight(FontWeight.Lighter)
-        Text(`数量(${this.currentUnit})`)
-          .fontColor($r('app.color.FFFFFF'))
-          .fontSize($r('app.float.fontSize_16'))
-          .margin({top:'4%',bottom:"2%",left:'2%'})
-        Row(){
-          Row() {
-            Button({ type: ButtonType.Normal }) {
-              Image($r('app.media.process_material_subtraction'))
-                .width('50%')
-                .height('50%')
-                .objectFit(ImageFit.Contain)
-                .fillColor($r('app.color.FFFFFF'))
-            }
-            .width('100%')
-            .height('100%')
-            .backgroundColor($r('app.color.20FFFFFF'))
-            .borderRadius($r('app.float.virtualSize_16'))
-            .scale({ x: this.addClick, y: this.addClick })
-            .animation({
-              duration: 200,
-              curve: Curve.Linear
-            })
-            .onClick(() => {
-              this.addClick = 0.9;
-              setTimeout(() => {
-                this.addClick = 1;
-                this.materialNum--
-              }, 200);
-            })
-          }.width('22%')
-          Row(){
-            Text(String(this.materialNum))
-              .fontColor($r('app.color.FFFFFF'))
-              .fontSize($r('app.float.fontSize_38'))
-          }
-          .width('56%')
-          .justifyContent(FlexAlign.Center)
-          Row() {
-            Button({ type: ButtonType.Normal }) {
-              Image($r('app.media.process_material_add'))
-                .width('50%')
-                .height('50%')
-                .objectFit(ImageFit.Contain)
-                .fillColor($r('app.color.FFFFFF'))
-                .borderRadius($r('app.float.virtualSize_16'))
+      }
+      .height($r('app.float.virtualSize_62'))
+      .width('70.4%')
+      .justifyContent(FlexAlign.Start)
+      .alignItems(HorizontalAlign.Start)
+
+      Scroll() {
+        Flex({ wrap: FlexWrap.Wrap, direction: FlexDirection.Row, justifyContent: FlexAlign.Start, alignItems: ItemAlign.Start}) {
+          ForEach(this.collectMaterials, (item: ProcessMaterial, index: number) => {
+            Column({space: 5}) {
+              Row() {
+                Text('批次号:')
+                  .fontColor($r('app.color.FFFFFF'))
+                  .fontSize($r('app.float.fontSize_16'))
+                  .fontWeight(FontWeight.Lighter)
+                Text(item?.batchNo!)
+                  .fontColor($r('app.color.FFFFFF'))
+                  .fontSize($r('app.float.fontSize_16'))
+                  .fontWeight(FontWeight.Bold)
+              }
+              Row() {
+                Text(`数量(${this.unit})`)
+                  .fontColor($r('app.color.FFFFFF'))
+                  .fontSize($r('app.float.fontSize_16'))
+                  .fontWeight(FontWeight.Regular)
+                Blank()
+                if (this.addOrModifyCollect === 1) {
+                  Text('还需采集:')
+                    .fontColor($r('app.color.FFFFFF'))
+                    .fontSize($r('app.float.fontSize_16'))
+                    .fontWeight(FontWeight.Regular)
+                  Text(`还需采集:${this.scanMaterial?.needNum!}`)
+                    .fontColor($r('app.color.FFFFFF'))
+                    .fontSize($r('app.float.fontSize_16'))
+                    .fontWeight(FontWeight.Regular)
+                }
+              }
+              .width('100%')
+
+              Row(){
+                Row() {
+                  Button({ type: ButtonType.Normal }) {
+                    Image($r('app.media.process_material_subtraction'))
+                      .width('50%')
+                      .height('50%')
+                      .objectFit(ImageFit.Contain)
+                      .fillColor($r('app.color.FFFFFF'))
+                  }
+                  .width('100%')
+                  .height('100%')
+                  .backgroundColor($r('app.color.20FFFFFF'))
+                  .borderRadius($r('app.float.virtualSize_16'))
+                  .opacity(((this.addOrModifyCollect === 1 && this.collectNumArray[index] <= 1) || (this.addOrModifyCollect === 2 && this.collectNumArray[index] <= 0)) ? 0.3 : 1)
+                  .onClick(() => {
+                    if (this.collectNumArray[index] > 0) {
+                      this.collectNumArray[index]--
+                    } else {
+                      this.collectNumArray[index] = 0
+                    }
+                  })
+                }.width('22%')
+                Row(){
+                  TextInput({text: (this.collectNumArray.length > index ? this.collectNumArray[index].toString() : '0')})
+                    .fontSize($r('app.float.fontSize_38'))
+                    .fontWeight(FontWeight.Lighter)
+                    .fontColor($r('app.color.FFFFFF'))
+                    .textAlign(TextAlign.Center)
+                    .type(InputType.Number)
+                    .onChange((value: string) => {
+                      this.collectNumArray[index] = parseInt(value)
+                    })
+                }
+                .width('56%')
+                .justifyContent(FlexAlign.Center)
+                Row() {
+                  Button({ type: ButtonType.Normal }) {
+                    Image($r('app.media.process_material_add'))
+                      .width('50%')
+                      .height('50%')
+                      .objectFit(ImageFit.Contain)
+                      .fillColor($r('app.color.FFFFFF'))
+                      .borderRadius($r('app.float.virtualSize_16'))
+                  }
+                  .width('100%')
+                  .height('100%')
+                  .backgroundColor($r('app.color.20FFFFFF'))
+                  .borderRadius($r('app.float.virtualSize_16'))
+                  .opacity(((this.addOrModifyCollect === 1 && this.collectNumArray[index] >= this.scanMaterial?.needNum!) || (this.addOrModifyCollect === 2 && this.collectNumArray[index] >= this.needNum)) ? 0.3 : 1)
+                  .onClick(() => {
+                    if (this.addOrModifyCollect === 1) {
+                      if (this.collectNumArray[index] < this.scanMaterial?.needNum!) {
+                        this.collectNumArray[index]++
+                      } else {
+                        this.collectNumArray[index] = this.scanMaterial?.needNum!
+                      }
+                    } else {
+                      if (this.collectNumArray[index] < this.needNum!) {
+                        this.collectNumArray[index]++
+                      } else {
+                        this.collectNumArray[index] = this.needNum!
+                      }
+                    }
+                  })
+                }.width('22%')
+              }
+              .height($r('app.float.virtualSize_80'))
+              .width('100%')
+              .backgroundColor($r('app.color.10FFFFFF'))
+              .borderRadius($r('app.float.virtualSize_16'))
+              if (index < this.collectMaterials.length - 1) {
+                Row() {
+                  Divider()
+                    .vertical(false)
+                    .color($r('app.color.15FFFFFF'))
+                }
+                .justifyContent(FlexAlign.Center)
+                .width('100%')
+              }
             }
-            .width('100%')
-            .height('100%')
-            .backgroundColor($r('app.color.20FFFFFF'))
-            .borderRadius($r('app.float.virtualSize_16'))
-            .scale({ x: this.subClick, y: this.subClick })
-            .animation({
-              duration: 200,
-              curve: Curve.Linear
-            })
-            .onClick(() => {
-              this.subClick = 0.9;
-              setTimeout(() => {
-                this.subClick = 1;
-                this.materialNum++
-              }, 200);
-            })
-          }.width('22%')
+            .height($r('app.float.virtualSize_156'))
+            .alignItems(HorizontalAlign.Start)
+          })
         }
-        .height('22%')
         .width('100%')
-        .backgroundColor($r('app.color.10FFFFFF'))
-        .borderRadius($r('app.float.virtualSize_16'))
       }
-      .width('60%')
-      .justifyContent(FlexAlign.Start)
-      .alignItems(HorizontalAlign.Start)
-      .margin({bottom:"10%"})
+      .scrollable(ScrollDirection.Vertical) // 垂直滚动
+      .scrollBar(BarState.Auto)
+      .width('70.4%')
+      .layoutWeight(1)
+      .align(Alignment.Top)
 
       Column(){
         Divider()
@@ -133,14 +283,36 @@ export struct ModifyMaterialNumDialog {
           .width('50%')
           .onClick(() => {
             this.onConfirm();
+            if (this.addOrModifyCollect === 1) {
+              if (this.collectNumArray[0] > this.scanMaterial?.needNum!) {
+                promptAction.showToast({
+                  message: `采集数量超过需求数量,请检查...`,
+                  duration: 1500,
+                  bottom: 100
+                })
+              }
+            //   todo 调接口新增
+            } else {
+              let total: number = 0
+              for (const element of this.collectNumArray) {
+                total += element;
+              }
+              if (total > this.needNum) {
+                promptAction.showToast({
+                  message: `采集数量超过需求数量,请检查...`,
+                  duration: 1500,
+                  bottom: 100
+                })
+              }
+            //   todo 调修改接口
+            }
             this.controller.close();
           })
         }
       }
       .width('100%')
-      .height('16%')
+      .height($r('app.float.virtualSize_56'))
     }
-    .height('34%')
     .width('30%')
     .backgroundColor($r('app.color.2A2A2A'))
     .justifyContent(FlexAlign.End)

+ 5 - 1
entry/src/main/ets/view/SelectWorkOrderDialog.ets

@@ -13,6 +13,8 @@ export struct SelectWorkOrderDialog {
   //扫描的工单号
   @State scanOrderValue:string = ''
   @Link selectWorkOder: WorkOrderInfo
+  // 当前工位
+  @Consume('currentStationId') currentStationId: string
   controller: CustomDialogController
   onConfirm: () => void = () => {
   }
@@ -20,7 +22,9 @@ export struct SelectWorkOrderDialog {
   //加载所有工单
   loadWorkOrders = async () => {
     let queryRes = await ProcessRequest.post('/api/v1/plan/workOrder/taskPage', {
-      queryCode:this.scanOrderValue
+      queryCode:this.scanOrderValue,
+      queryComplete: 0,
+      stationId:this.currentStationId
     } as RequestParamModel) as WorkOrderPage;
     this.workOrderList = queryRes?.records??[]
     console.info("sssss"+JSON.stringify(queryRes))

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

@@ -298,7 +298,7 @@ export struct taskSeqItem{
         .textAlign(TextAlign.Start)
       Blank()
       if(this.selectedButtonIndex != 2) {
-        Text(`报工时间:${this.item.updated}`)
+        Text(this.item.state! === '2' ? `报工时间:${this.item.updated}` : '')
           .fontSize($r('app.float.fontSize_16'))
           .fontColor($r('app.color.60FFFFFF'))
           .fontWeight(FontWeight.Lighter)

+ 4 - 2
entry/src/main/ets/view/SwitchingStationViews.ets

@@ -101,8 +101,10 @@ export struct SwitchingStationDialog{
           .justifyContent(FlexAlign.Center)
           .width('50%')
           .onClick(() => {
-            this.currentStation = this.stationsList[this.selectStationIndex].name??""
-            this.currentStationId=this.stationsList[this.selectStationIndex].id??""
+            if (this.stationsList && this.selectStationIndex >=0 && this.stationsList[this.selectStationIndex]) {
+              this.currentStation = this.stationsList[this.selectStationIndex].name ?? ""
+              this.currentStationId = this.stationsList[this.selectStationIndex].id ?? ""
+            }
             this.controller.close();
           })
         }

+ 48 - 13
entry/src/main/ets/view/process/MaterialCollectView.ets

@@ -5,6 +5,7 @@ import ProcessMaterial from '../../viewmodel/process/ProcessMaterial'
 import RequestParamModel from '../../viewmodel/RequestParamModel'
 import WorkOrderInfo from '../../viewmodel/WorkOrderInfo'
 import promptAction from '@ohos.promptAction'
+import { ModifyMaterialNumDialog } from '../ModifyMaterialNumDialog'
 
 @Component
 export struct MaterialCollectView {
@@ -12,9 +13,13 @@ export struct MaterialCollectView {
   // 需要采集的工序物料
   @State itemArray: OperationItem[] = []
   // 总需求数
-  @State needNum: number = 100
+  @State needNum: number = 0
   // 实际数量(已采集数)
-  @State realNum: number = 46
+  @State realNum: number = 0
+  // 扫码查到物料信息
+  scanMaterial: ProcessMaterial = {}
+  // 新增或者修改采集物料(1:新增 2:修改)(采集物料数量修改弹窗使用)
+  addOrModifyCollect: number = 1
   // 扫码开工状态(0:未开工 1:已开工)
   @Link scanState: number
   // 当前流转卡号
@@ -26,14 +31,18 @@ export struct MaterialCollectView {
   // 扫码开工后的生产过程信息
   @Link process: ProcessInfo
 
-  // modifyMaterialNumDialogController: CustomDialogController = new CustomDialogController({
-  //   builder: ModifyMaterialNumDialog({
-  //
-  //   }),
-  //   autoCancel: true, // 点击遮罩关闭
-  //   customStyle: true,
-  //   maskColor: 'rgba(0,0,0,0.8)',  // 黑色遮罩
-  // })
+  modifyMaterialNumDialogController: CustomDialogController = new CustomDialogController({
+    builder: ModifyMaterialNumDialog({
+      scanMaterial: this.scanMaterial,
+      addOrModifyCollect: this.addOrModifyCollect,
+      operationId: this.selectOperationId!,
+      processId: this.process.id!,
+    }),
+    autoCancel: true, // 点击遮罩关闭
+    customStyle: true,
+    alignment: DialogAlignment.Center,
+    maskColor: 'rgba(0,0,0,0.8)',  // 黑色遮罩
+  })
 
   async aboutToAppear() {
     if (this.scanState === 1) {
@@ -50,10 +59,17 @@ export struct MaterialCollectView {
         pageNo: 1,
         pageSize: 999999} as RequestParamModel)
     }
-    for (const element of this.itemArray) {
-      this.needNum += element.needNum ? element.needNum : 0
-      this.realNum += element.realNum ? element.realNum : 0
+    if (this.itemArray) {
+      console.log('hhtest', '-----------')
+      console.log('hhtest', '-----------')
+      console.log('hhtest', '-----------')
+      for (const element of this.itemArray) {
+        console.log('hhtest', '-----------' + JSON.stringify(element))
+        this.needNum += element.needNum || 0
+        this.realNum += element.realNum || 0
+      }
     }
+
   }
   
   build() {
@@ -76,6 +92,13 @@ export struct MaterialCollectView {
             .fontColor($r('app.color.FFFFFF'))
             .enableKeyboardOnFocus(false)
             .onSubmit(async () => {
+              if (this.scanState === 0) {
+                promptAction.showToast({
+                  message: '工序未开工,请先开工',
+                  duration: 1500,
+                  bottom: 100
+                })
+              }
               let result: ProcessMaterial[] = await ProcessRequest.post('/api/v1/process/itemRecord/searchMaterial', {
               operationId: this.selectOperationId,
               processId: this.process.id!,
@@ -90,6 +113,7 @@ export struct MaterialCollectView {
                     bottom: 100
                   })
                 }
+                this.scanMaterial = result[0]
                 for (const element of result) {
                   element.operationId = this.selectOperationId
                   element.processId = this.process.id!
@@ -207,6 +231,17 @@ export struct MaterialCollectView {
             .borderRadius($r('app.float.virtualSize_16'))
             .backgroundColor($r('app.color.20FFFFFF'))
             .margin({ top: index > 2 ? '1%' : '0%', left: (index % 3) === 0 ? '0%' : '0.8%' })
+            .onClick(()=>{
+              this.scanMaterial = {
+                materialCode: item.itemCode!,
+                materialName: item.itemName!,
+                spec: item.itemModel!,
+                unitDictValue: item.unit!,
+                totalNum: item.needNum!,
+              }
+              this.addOrModifyCollect = 2
+              this.modifyMaterialNumDialogController.open()
+            })
           })
         }
         .width('100%')

+ 3 - 1
entry/src/main/ets/viewmodel/OperationItem.ets

@@ -28,4 +28,6 @@ export default class OperationItem {
   workOrderCode?: string;
   //序列号/批次号
   codeTypeStr?: string;
-}
+}
+
+

+ 4 - 0
entry/src/main/ets/viewmodel/RequestParamModel.ets

@@ -80,4 +80,8 @@ export default class RequestParamModel {
   vehicleOperationId?:string
   //扫描码
   scanCode?:string
+  //工序id
+  opId?:string
+  //物料编码
+  itemCode?:string
 }

+ 1 - 0
entry/src/main/ets/viewmodel/WorkOrderInfo.ets

@@ -67,6 +67,7 @@ export default class WorkOrderInfo {
   updated?: string
   // 齐套进度
   kitCompleteProgress?: number
+  // 工序信息
   ops?: OperationInfo[]
   //是否完成
   isCompleted?:boolean

+ 1 - 1
entry/src/main/ets/viewmodel/process/TaskSeqInfo.ets

@@ -1,7 +1,7 @@
 export default class TaskSeqVO {
   // 序列号
   seqNo?: string
-  // 序列号状态 0 正常 1 冻结
+  // 序列号状态 (-1:未下发 0:执行中 1:待执行 2:已完成 3:已报废)
   state?: string
   // 待进行
   currentTask?: string

+ 12 - 0
entry/src/main/resources/base/element/font.json

@@ -1,10 +1,18 @@
 {
   "float": [
     {
+      "name": "virtualSize_156",
+      "value": "93.6vp"
+    },
+    {
       "name": "virtualSize_112",
       "value": "67.2vp"
     },
     {
+      "name": "virtualSize_100",
+      "value": "60vp"
+    },
+    {
       "name": "virtualSize_80",
       "value": "48vp"
     },
@@ -13,6 +21,10 @@
       "value": "52.8vp"
     },
     {
+      "name": "virtualSize_62",
+      "value": "37.2vp"
+    },
+    {
       "name": "virtualSize_56",
       "value": "33.6vp"
     },