Browse Source

修改物料采集布局

hh 1 month ago
parent
commit
05ff683a1f

+ 1 - 1
entry/src/main/ets/pages/ProcessIndex.ets

@@ -22,7 +22,7 @@ struct ProcessIndex {
   // 工单列表
   @State workOrders: WorkOrderInfo[] = []
   // 选中工单
-  @State selectWorkOder: WorkOrderInfo = {}
+  @State selectWorkOder: WorkOrderInfo = {workOrderCode:'32'}
   // 工位通知数量
   @State noticeNum: number = 100
   // 扫描或手动输入的流水/序列/铭牌号

+ 190 - 12
entry/src/main/ets/view/process/MaterialCollectView.ets

@@ -8,7 +8,164 @@ import WorkOrderInfo from '../../viewmodel/WorkOrderInfo'
 export struct MaterialCollectView {
   @State scanCode: string = ''
   // 需要采集的工序物料
-  @State itemArray: OperationItem[] = []
+  @State itemArray: OperationItem[] = [
+    {
+      batchNo:'',
+      itemCode:'Y11P-1210ZJ10',
+      itemModel:'Y11P-1210ZJ10',
+      itemName:'控制连接器插座',
+      needNum:6.0,
+      operationId:'679',
+      processId:'',
+      realNum:1.0,
+      workOrderCode:'10.25.0022'
+    },{
+      batchNo:'',
+      itemCode:'Y11P-0804ZJ10-2',
+      itemModel:'Y11P-0804ZJ10-2',
+      itemName:'电源连接器插座',
+      needNum:5.0,
+      operationId:'679',
+      processId:'',
+      workOrderCode:'10.25.0022'
+    },
+    {
+      batchNo:'',
+      itemCode:'Y11P-1210ZJ10',
+      itemModel:'Y11P-1210ZJ10',
+      itemName:'控制连接器插座',
+      needNum:6.0,
+      operationId:'679',
+      processId:'',
+      realNum:1.0,
+      workOrderCode:'10.25.0022'
+    },{
+    batchNo:'',
+    itemCode:'Y11P-0804ZJ10-2',
+    itemModel:'Y11P-0804ZJ10-2',
+    itemName:'电源连接器插座',
+    needNum:5.0,
+    operationId:'679',
+    processId:'',
+    workOrderCode:'10.25.0022'
+  },{
+    batchNo:'',
+    itemCode:'Y11P-1210ZJ10',
+    itemModel:'Y11P-1210ZJ10',
+    itemName:'控制连接器插座',
+    needNum:6.0,
+    operationId:'679',
+    processId:'',
+    realNum:1.0,
+    workOrderCode:'10.25.0022'
+  },{
+    batchNo:'',
+    itemCode:'Y11P-0804ZJ10-2',
+    itemModel:'Y11P-0804ZJ10-2',
+    itemName:'电源连接器插座',
+    needNum:5.0,
+    operationId:'679',
+    processId:'',
+    workOrderCode:'10.25.0022'
+  },{
+    batchNo:'',
+    itemCode:'Y11P-1210ZJ10',
+    itemModel:'Y11P-1210ZJ10',
+    itemName:'控制连接器插座',
+    needNum:6.0,
+    operationId:'679',
+    processId:'',
+    realNum:1.0,
+    workOrderCode:'10.25.0022'
+  },{
+    batchNo:'',
+    itemCode:'Y11P-0804ZJ10-2',
+    itemModel:'Y11P-0804ZJ10-2',
+    itemName:'电源连接器插座',
+    needNum:5.0,
+    operationId:'679',
+    processId:'',
+    workOrderCode:'10.25.0022'
+  },{
+    batchNo:'',
+    itemCode:'Y11P-1210ZJ10',
+    itemModel:'Y11P-1210ZJ10',
+    itemName:'控制连接器插座',
+    needNum:6.0,
+    operationId:'679',
+    processId:'',
+    realNum:1.0,
+    workOrderCode:'10.25.0022'
+  },{
+    batchNo:'',
+    itemCode:'Y11P-0804ZJ10-2',
+    itemModel:'Y11P-0804ZJ10-2',
+    itemName:'电源连接器插座',
+    needNum:5.0,
+    operationId:'679',
+    processId:'',
+    workOrderCode:'10.25.0022'
+  },{
+    batchNo:'',
+    itemCode:'Y11P-1210ZJ10',
+    itemModel:'Y11P-1210ZJ10',
+    itemName:'控制连接器插座',
+    needNum:6.0,
+    operationId:'679',
+    processId:'',
+    realNum:1.0,
+    workOrderCode:'10.25.0022'
+  },{
+    batchNo:'',
+    itemCode:'Y11P-0804ZJ10-2',
+    itemModel:'Y11P-0804ZJ10-2',
+    itemName:'电源连接器插座',
+    needNum:5.0,
+    operationId:'679',
+    processId:'',
+    workOrderCode:'10.25.0022'
+  },{
+    batchNo:'',
+    itemCode:'Y11P-1210ZJ10',
+    itemModel:'Y11P-1210ZJ10',
+    itemName:'控制连接器插座',
+    needNum:6.0,
+    operationId:'679',
+    processId:'',
+    realNum:5.0,
+    workOrderCode:'10.25.0022'
+  },{
+    batchNo:'',
+    itemCode:'Y11P-0804ZJ10-2',
+    itemModel:'Y11P-0804ZJ10-2',
+    itemName:'电源连接器插座',
+    needNum:5.0,
+    realNum:5.0,
+    operationId:'679',
+    processId:'',
+    workOrderCode:'10.25.0022'
+  },{
+    batchNo:'',
+    itemCode:'Y11P-1210ZJ10',
+    itemModel:'Y11P-1210ZJ10',
+    itemName:'控制连接器插座',
+    needNum:6.0,
+    operationId:'679',
+    processId:'',
+    realNum:5.0,
+    workOrderCode:'10.25.0022'
+  },{
+    batchNo:'',
+    itemCode:'Y11P-0804ZJ10-2',
+    itemModel:'Y11P-0804ZJ10-2',
+    itemName:'电源连接器插座',
+    needNum:5.0,
+    realNum:5.0,
+    operationId:'679',
+    processId:'',
+    workOrderCode:'10.25.0022'
+  },
+  ]
   // 总需求数
   @State needNum: number = 100
   // 实际数量(已采集数)
@@ -40,8 +197,8 @@ export struct MaterialCollectView {
         pageSize: 999999} as RequestParamModel)
     }
     for (const element of this.itemArray) {
-      this.needNum += element.needNum!
-      this.realNum += element.realNum!
+      this.needNum += element.needNum ? element.needNum : 0
+      this.realNum += element.realNum ? element.needNum : 0
     }
   }
   
@@ -81,11 +238,25 @@ export struct MaterialCollectView {
             .fontColor($r('app.color.FFFFFF'))
             .fontSize($r('app.float.fontSize_16'))
             .fontWeight(FontWeight.Regular)
-          Progress({ value: this.realNum, total: this.needNum, type: ProgressType.Linear })
-            .width('100%')
-            .color($r('app.color.0A84FF'))
-            .backgroundColor($r('app.color.15FFFFFF'))
-            .borderRadius($r('app.float.virtualSize_32'))
+          // Progress({ value: this.realNum, total: this.needNum, type: ProgressType.Linear })
+          //   .width('100%')
+          //   .color($r('app.color.0A84FF'))
+          //   .backgroundColor($r('app.color.15FFFFFF'))
+          //   .borderRadius($r('app.float.virtualSize_32'))
+          Row() {
+            Row()
+              .width(((this.realNum * 100)/ this.needNum).toFixed(2) + '%')
+              .height('100%')
+              .borderRadius($r('app.float.virtualSize_24'))
+              .linearGradient({
+                angle: 90,
+                colors: [[$r('app.color.1050FF'), 0.0], [$r('app.color.73C3FF'), 1]]
+              })
+          }
+          .height('30%')
+          .width('100%')
+          .backgroundColor($r('app.color.10FFFFFF'))
+          .borderRadius($r('app.float.virtualSize_24'))
         }
         .width('13.1%')
         .height('31.3%')
@@ -97,7 +268,7 @@ export struct MaterialCollectView {
       .justifyContent(FlexAlign.SpaceBetween)
       // 动态排列容器
       Scroll() {
-        Flex({ wrap: FlexWrap.Wrap, direction: FlexDirection.Column, justifyContent: FlexAlign.Start, alignItems: ItemAlign.Start}) {
+        Flex({ wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start, alignItems: ItemAlign.Start}) {
           ForEach(this.itemArray, (item: OperationItem, index: number) => {
             Column() {
               Row() {
@@ -106,22 +277,29 @@ export struct MaterialCollectView {
                     .fontSize($r('app.float.fontSize_24'))
                     .fontWeight(FontWeight.Medium)
                     .fontColor($r('app.color.FFFFFF'))
+                    .maxLines(1)
                   Text(item.itemCode!)
                     .fontSize($r('app.float.fontSize_12'))
                     .fontWeight(FontWeight.Lighter)
                     .fontColor($r('app.color.FFFFFF'))
+                    .maxLines(1)
                 }
                 .width('45.5%')
                 .height('100%')
                 .justifyContent(FlexAlign.Center)
+                .alignItems(HorizontalAlign.Start)
                 Row() {
-                  Image($r('app.media.process_complete_test'))
-                    .height('100%')
-                    .width('45.5%')
+                  if (item.realNum! >= item.needNum!) {
+                    Image($r('app.media.process_complete_test'))
+                      .height('100%')
+                      .width('45.5%')
+                      .objectFit(ImageFit.Fill)
+                  }
                 }
                 .width('50%')
                 .height('100%')
                 .alignItems(VerticalAlign.Top)
+                .justifyContent(FlexAlign.End)
               }
               .height('45.8%')
               .width('100%')

+ 10 - 4
entry/src/main/ets/viewmodel/OperationItem.ets

@@ -10,14 +10,20 @@ export default class OperationItem {
   itemModel?: string;
   // 所需数量
   num?: number;
-  // 实际数量(生产过程-已采集数量)
-  realNum?: number;
-  // 需求数量(生产过程)
-  needNum?: number;
   // 单位
   unit?: string;
   // 齐套数量
   kitNum?: number;
   // 入库数量
   storageNum?: number;
+  // 实际数量(生产过程-已采集数量)
+  realNum?: number;
+  // 需求数量(生产过程)
+  needNum?: number;
+  // 批次号(生产过程)
+  batchNo?: string;
+  // 生产过程id(生产过程)
+  processId?: string;
+  // 工单编码(生产过程)
+  workOrderCode?: string;
 }