hh 1 тиждень тому
батько
коміт
dceece8d0f

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

@@ -13,8 +13,8 @@ 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.246:8079" // huhao本地
+//  const baseUrl = "http://192.168.1.3:20010"//huajing
+const baseUrl = "http://192.168.1.246:8079" // huhao本地
 const DEBUG = true //
 
 // 创建实例

+ 26 - 2
entry/src/main/ets/pages/ProcessIndex.ets

@@ -32,6 +32,8 @@ import { UnqualifiedReportDialog } from '../view/UnqualifiedReportDialog';
 import { SelfInspectView } from '../view/process/SelfInspectView';
 import { SpecialInspectionDialog } from '../view/SpecialInspectionDialog';
 import { MultiMediaCollect } from '../view/process/MultiMediaCollect';
+import { BarcodeAssociationDialog } from '../view/BarcodeAssociationDialog';
+import WorkOrderSeq from '../viewmodel/WorkOrderSeq';
 
 @Entry
 @Component
@@ -74,6 +76,8 @@ struct ProcessIndex {
   @State process: ProcessInfo = {}
   // 扫码开工状态(0:未开工 1:已开工)
   @State scanState: number = 0
+  // 工单下流转卡号列表
+  @State seqList: WorkOrderSeq[] = []
 
   private scrollerList: Scroller = new Scroller()
 
@@ -154,6 +158,7 @@ struct ProcessIndex {
     alignment:DialogAlignment.Center,
     maskColor: 'rgba(0,0,0,0.8)',  // 黑色遮罩
   })
+  // 工序报工-报工数量弹窗
   ReportWorkNumController: CustomDialogController = new CustomDialogController({
     builder: ReportWorkNumDialog({
       userName: this.reportList[this.currentReportNumIndex].userName,
@@ -170,6 +175,7 @@ struct ProcessIndex {
     alignment:DialogAlignment.Center,
     maskColor: 'rgba(0,0,0,0.8)',
   })
+  // 工序报工-不良品报工弹窗
   UnqualifiedReportController: CustomDialogController = new CustomDialogController({
     builder: UnqualifiedReportDialog({
       userName: this.reportList[this.currentUnqualifiedIndex].userName,
@@ -186,6 +192,8 @@ struct ProcessIndex {
     alignment:DialogAlignment.Center,
     maskColor: 'rgba(0,0,0,0.8)',
   })
+
+  // 工序报工-添加参与人员
   JoinPersonNameController: CustomDialogController = new CustomDialogController({
     builder: JoinPersonNameDialog({
       reportList:this.reportList,
@@ -213,6 +221,7 @@ struct ProcessIndex {
     alignment:DialogAlignment.Center,
     maskColor: 'rgba(0,0,0,0.8)',
   })
+  // 工序报工弹窗
   ProcessReportingController: CustomDialogController = new CustomDialogController({
     builder: ProcessReportingDialog({
       onSelectReporter:(index:number)=>{
@@ -310,10 +319,26 @@ struct ProcessIndex {
     maskColor: 'rgba(0,0,0,0.8)',  // 黑色遮罩
   })
 
+  // 条码关联弹窗控制器
+  barcodeAssociationController: CustomDialogController = new CustomDialogController({
+    builder: BarcodeAssociationDialog({
+      workOrderCode: this.selectWorkOder?.workOrderCode!,
+      seqList: this.seqList
+    }),
+    autoCancel: true, // 点击遮罩关闭
+    customStyle: true,
+    alignment:DialogAlignment.Center,
+    maskColor: 'rgba(0,0,0,0.8)',  // 黑色遮罩
+  })
+
   // 辅助功能弹窗控制器
   auxiliaryOperationController: CustomDialogController = new CustomDialogController({
     builder: AuxiliaryOperationDialog({
-
+      workOrderCode: this.selectWorkOder?.workOrderCode!,
+      seqList: this.seqList,
+      openBarcodeAssociationDialog: ()=>{
+        this.barcodeAssociationController.open()
+      }
     }),
     autoCancel: true, // 点击遮罩关闭
     customStyle: true,
@@ -321,7 +346,6 @@ struct ProcessIndex {
     maskColor: 'rgba(0,0,0,0.8)',  // 黑色遮罩
   })
 
-
   handleAllClick():void {
     if (!this.selectWorkOder.workOrderCode || !this.currentUserName || !this.currentStationId) {
       return

+ 59 - 6
entry/src/main/ets/view/AuxiliaryOperationDialog.ets

@@ -1,12 +1,52 @@
+import ProcessRequest from '../common/util/request/ProcessRequest'
+import RequestParamModel from '../viewmodel/RequestParamModel'
+import WorkOrderSeq from '../viewmodel/WorkOrderSeq'
+import { BarcodeAssociationDialog } from './BarcodeAssociationDialog'
+import promptAction from '@ohos.promptAction'
+
 @CustomDialog
 export struct AuxiliaryOperationDialog {
-
+  // 工单编号
+  workOrderCode: string = ''
+  @Link @Watch('getBarcodeStatistics') seqList: WorkOrderSeq[]
   controller: CustomDialogController
 
   // 提前下线数量
   @State earlyOfflineNum: number = 50
   // 委外审核数量
   @State outsourcedAuditNum: number = 120
+  // 条码关联中的统计
+  @State barcodeStatistics: string = ''
+  // 打开条码关联弹窗
+  openBarcodeAssociationDialog?: () => void = () => {}
+
+  // 获取条码关联中的统计
+  getBarcodeStatistics() {
+    if (this.seqList) {
+      let supportingCodeNum = 0
+      let nameplateNoNum = 0
+      for (const element of this.seqList) {
+        if (element.supportingCode) {
+          supportingCodeNum++
+        }
+        if (element.nameplateNo) {
+          nameplateNoNum++
+        }
+      }
+      this.barcodeStatistics = this.seqList.length + '/' + supportingCodeNum + '/' + nameplateNoNum
+    } else {
+      this.barcodeStatistics = ''
+    }
+  }
+
+  async aboutToAppear() {
+    if (this.workOrderCode) {
+      this.seqList = await ProcessRequest.post('/api/v1/plan/seq/list', {
+        workOrderCode: this.workOrderCode
+      } as RequestParamModel)
+    }
+    this.getBarcodeStatistics()
+  }
 
   build() {
     Stack() {
@@ -46,6 +86,7 @@ export struct AuxiliaryOperationDialog {
             .alignItems(HorizontalAlign.Start)
             // 常用功能
             Row() {
+              // 零星叫料
               Stack() {
                 Image($r("app.media.process_sporadic_call_material"))
                   .width('100%')
@@ -67,7 +108,7 @@ export struct AuxiliaryOperationDialog {
               .height('100%')
               .width('19.3%')
               .alignContent(Alignment.Top)
-
+              // 仓储操作
               Stack() {
                 Image($r("app.media.process_storage_operation"))
                   .width('100%')
@@ -89,7 +130,7 @@ export struct AuxiliaryOperationDialog {
               .height('100%')
               .width('19.3%')
               .alignContent(Alignment.Top)
-
+              // 条码关联
               Stack() {
                 Image($r("app.media.process_barcode_linkage"))
                   .width('100%')
@@ -112,7 +153,7 @@ export struct AuxiliaryOperationDialog {
                   .height('61.3%')
                   .justifyContent(FlexAlign.End)
                   Column() {
-                    Text('200/100/20')
+                    Text(this.barcodeStatistics)
                       .fontColor($r('app.color.FFFFFF'))
                       .fontSize($r('app.float.fontSize_30'))
                       .fontWeight(FontWeight.Medium)
@@ -126,7 +167,19 @@ export struct AuxiliaryOperationDialog {
               .height('100%')
               .width('19.3%')
               .alignContent(Alignment.Top)
-
+              .onClick(()=>{
+                if (!this.workOrderCode) {
+                  promptAction.showToast({
+                    message: '请选择工单!',
+                    duration: 2000
+                  });
+                  return;
+                }
+                if (this.openBarcodeAssociationDialog) {
+                  this.openBarcodeAssociationDialog()
+                }
+              })
+              // 图纸资料
               Stack() {
                 Image($r("app.media.process_drawing"))
                   .width('100%')
@@ -163,7 +216,7 @@ export struct AuxiliaryOperationDialog {
               .height('100%')
               .width('19.3%')
               .alignContent(Alignment.Top)
-
+              // 撤销报工
               Stack() {
                 Image($r("app.media.process_drawing"))
                   .width('100%')

+ 61 - 96
entry/src/main/ets/view/BarcodeAssociationDialog.ets

@@ -1,88 +1,42 @@
 //条码关联
-import TaskSeqVO from '../viewmodel/process/TaskSeqInfo'
+import ProcessRequest from '../common/util/request/ProcessRequest'
+import promptAction from '@ohos.promptAction'
+import RequestParamModel from '../viewmodel/RequestParamModel'
+import WorkOrderSeq from '../viewmodel/WorkOrderSeq'
+
 @CustomDialog
 export struct BarcodeAssociationDialog {
   private scrollerMaterial: Scroller = new Scroller()
+  // 工单编号
+  workOrderCode: string = ''
   //0:序列号排序,1:铭牌号排序 -1:默认
   @State currentClick:number = -1
-  @State originalBarcodeList: BarcodeInfo[] = [];
-  @State BarcodeList: BarcodeInfo[] = [
-    {
-      streamNumber: "SN20231001-001",
-      serialNumber: "",
-      nameplateNumber: ""
-    },
-    {
-      streamNumber: "SN20231002-002",
-      serialNumber: "SR987654321",
-      nameplateNumber: "NP-XYZ-2023-002"
-    },
-    {
-      streamNumber: "SN20231003-003",
-      serialNumber: "SR456789123",
-      nameplateNumber: "NP-DEF-2023-003"
-    },
-    {
-      streamNumber: "SN20231004-004",
-      serialNumber: "SR789123456",
-      nameplateNumber: "NP-GHI-2023-004"
-    },
-    {
-      streamNumber: "SN20231001-001",
-      serialNumber: "",
-      nameplateNumber: ""
-    },
-    {
-      streamNumber: "SN20231001-001",
-      serialNumber: "SN20231006-006",
-      nameplateNumber: ""
-    },
-    {
-      streamNumber: "SN20231005-005",
-      serialNumber: "SR321654987",
-      nameplateNumber: "NP-JKL-2023-005"
-    },
-    {
-      streamNumber: "SN20231006-006",
-      serialNumber: "",
-      nameplateNumber: "SN20231006-006"
-    },
-    {
-      streamNumber: "SN20231007-007",
-      serialNumber: "SR147258369",
-      nameplateNumber: "NP-PQR-2023-007"
-    },
-    {
-      streamNumber: "SN20231008-008",
-      serialNumber: "",
-      nameplateNumber: "NP-STU-2023-008"
-    },
-    {
-      streamNumber: "SN20231009-009",
-      serialNumber: "",
-      nameplateNumber: ""
-    },
-    {
-      streamNumber: "SN20231010-010",
-      serialNumber: "SR852963741",
-      nameplateNumber: ""
-    }
-  ];
+  // 工单下流转卡号列表
+  @Link seqList: WorkOrderSeq[]
   controller: CustomDialogController
-  onConfirm: () => void = () => {
+  onConfirm: () => void = async () => {
+     await ProcessRequest.post('/api/v1/plan/seq/bindCode', this.seqList)
+     // 重新刷新
+     this.seqList = await ProcessRequest.post('/api/v1/plan/seq/list', {
+       workOrderCode: this.workOrderCode
+     } as RequestParamModel)
   }
 
   //序列号排序,没有的在前面
   onSerialNumberClick() {
     if (this.currentClick === 0) {
-      this.BarcodeList = [...this.originalBarcodeList];
+       this.seqList.sort((a, b) => {
+         const aStream = a.seqNo ?? "";
+         const bStream = b.seqNo ?? "";
+         return aStream.localeCompare(bStream);
+       })
       this.currentClick = -1;
     } else {
-      this.BarcodeList.sort((a, b) => {
-        const aSerial = a.serialNumber ?? "";
-        const bSerial = b.serialNumber ?? "";
-        const aStream = a.streamNumber ?? "";
-        const bStream = b.streamNumber ?? "";
+      this.seqList.sort((a, b) => {
+        const aSerial = a.supportingCode ?? "";
+        const bSerial = b.supportingCode ?? "";
+        const aStream = a.seqNo ?? "";
+        const bStream = b.seqNo ?? "";
 
         if (!aSerial && !bSerial) {
           return aStream.localeCompare(bStream);
@@ -91,23 +45,30 @@ export struct BarcodeAssociationDialog {
         } else if (!bSerial) {
           return 1;
         } else {
-          return aStream.localeCompare(bStream);
+          return aSerial.localeCompare(bSerial);
         }
       });
       this.currentClick = 0;
+      for (const element of this.seqList) {
+        console.log('hhtest', JSON.stringify(element))
+      }
     }
   }
   //铭牌号排序,没有的在前面
   onNameplateClick() {
     if (this.currentClick === 1) {
-      this.BarcodeList = [...this.originalBarcodeList];
+      this.seqList.sort((a, b) => {
+        const aStream = a.seqNo ?? "";
+        const bStream = b.seqNo ?? "";
+        return aStream.localeCompare(bStream);
+      })
       this.currentClick = -1;
     } else {
-      this.BarcodeList.sort((a, b) => {
-        const aNameplate = a.nameplateNumber ?? "";
-        const bNameplate = b.nameplateNumber ?? "";
-        const aStream = a.streamNumber ?? "";
-        const bStream = b.streamNumber ?? "";
+      this.seqList.sort((a, b) => {
+        const aNameplate = a.nameplateNo ?? "";
+        const bNameplate = b.nameplateNo ?? "";
+        const aStream = a.seqNo ?? "";
+        const bStream = b.seqNo ?? "";
 
         if (!aNameplate && !bNameplate) {
           return aStream.localeCompare(bStream);
@@ -116,15 +77,19 @@ export struct BarcodeAssociationDialog {
         } else if (!bNameplate) {
           return 1;
         } else {
-          return aStream.localeCompare(bStream);
+          return aNameplate.localeCompare(bNameplate);
         }
       });
       this.currentClick = 1;
     }
   }
 
-  aboutToAppear(): void {
-    this.originalBarcodeList = [...this.BarcodeList];
+  async aboutToAppear() {
+    if (!this.seqList && this.workOrderCode) {
+      this.seqList = await ProcessRequest.post('/api/v1/plan/seq/list', {
+        workOrderCode: this.workOrderCode
+      } as RequestParamModel)
+    }
   }
 
   build() {
@@ -136,7 +101,7 @@ export struct BarcodeAssociationDialog {
       }.height('8%')
       .width('100%')
       .justifyContent(FlexAlign.Center)
-
+      // 表头和排序操作
       Row() {
         Row(){
           Text(`流水号`)
@@ -179,22 +144,20 @@ export struct BarcodeAssociationDialog {
       .justifyContent(FlexAlign.End)
       .margin({left:'2%',right:'2%',top:'1%'})
 
-
-
       Divider()
         .vertical(false)
         .strokeWidth(1)
         .color($r('app.color.15FFFFFF'))
         .margin({ top: '1%' ,bottom:'2%',left:'2%',right:'2%'})
-
+      // 绑定区
       Row(){
         Column(){
-          List({scroller:this.scrollerMaterial}) {
-            ForEach(this.BarcodeList, (item:BarcodeInfo) => {
+          List({space: 5, scroller:this.scrollerMaterial}) {
+            ForEach(this.seqList, (item: WorkOrderSeq, index: number) => {
               ListItem() {
                 Row() {
                   Row(){
-                    Text(item.streamNumber)
+                    Text(item.seqNo)
                       .fontSize($r('app.float.fontSize_16'))
                       .fontColor($r('app.color.FFFFFF'))
                   }
@@ -206,11 +169,15 @@ export struct BarcodeAssociationDialog {
                       .height($r('app.float.virtualSize_24'))
                       .fillColor($r('app.color.FFFFFF'))
                       .margin({left:'4%'})
-                    TextInput({text:item.serialNumber,placeholder:item.serialNumber})
+                    TextInput({text: item.supportingCode, placeholder: item.supportingCode})
                       .fontSize($r('app.float.fontSize_16'))
                       .fontColor($r('app.color.FFFFFF'))
+                      .enableKeyboardOnFocus(false)
                       .width('90%')
                       .textAlign(TextAlign.Start)
+                      .onChange((value: string) =>{
+                        item.supportingCode = value
+                      })
                   }
                   .backgroundColor($r('app.color.000000'))
                   .borderRadius($r('app.float.virtualSize_16'))
@@ -223,11 +190,15 @@ export struct BarcodeAssociationDialog {
                       .height($r('app.float.virtualSize_24'))
                       .fillColor($r('app.color.FFFFFF'))
                       .margin({left:'4%'})
-                    TextInput({text:item.nameplateNumber,placeholder:item.nameplateNumber})
+                    TextInput({text: item.nameplateNo, placeholder: item.nameplateNo})
                       .fontSize($r('app.float.fontSize_16'))
                       .fontColor($r('app.color.FFFFFF'))
+                      .enableKeyboardOnFocus(false)
                       .width('90%')
                       .textAlign(TextAlign.Start)
+                      .onChange((value: string) =>{
+                        item.nameplateNo = value
+                      })
                   }
                   .backgroundColor($r('app.color.000000'))
                   .borderRadius($r('app.float.virtualSize_16'))
@@ -294,10 +265,4 @@ export struct BarcodeAssociationDialog {
     .borderWidth(1)
     .borderRadius($r('app.float.virtualSize_16'))
   }
-}
-
-interface BarcodeInfo{
-  streamNumber?:string,
-  serialNumber?:string,
-  nameplateNumber?:string,
 }

+ 2 - 2
entry/src/main/ets/viewmodel/WorkOrderPage.ets

@@ -2,7 +2,7 @@ import WorkOrderInfo from './WorkOrderInfo'
 
 export interface WorkOrderPage {
 
-  records?:WorkOrderInfo[]
+  records?: WorkOrderInfo[]
   pageNo?: number,
-  pageSize?:number,
+  pageSize?: number,
 }

+ 13 - 0
entry/src/main/ets/viewmodel/WorkOrderSeq.ets

@@ -0,0 +1,13 @@
+// 工单序列信息
+export default class WorkOrderSeq {
+  // 主键id
+  id?: string
+  // 流转卡号
+  seqNo?: string
+  // 序列号
+  supportingCode?: string
+  // 铭牌号
+  nameplateNo?: string
+  // 工单编码
+  workOrderCode?: string
+}