浏览代码

扫码流水号切换工单

hh 3 周之前
父节点
当前提交
afa60ca141

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

@@ -50,7 +50,7 @@ export default class CommonConstants {
     ['jingu', '7'],
     // ['tiaoshipipei', '8'],
     ['mingpaibangding', '9'],
-    ['gongxubiaodan', '10'],
+    ['operationExcel', '10'],
     ['zidongceshi', '11'],
     ['shebeiqueren', '12'],
   ]);

+ 65 - 22
entry/src/main/ets/pages/ProcessIndex.ets

@@ -6,12 +6,12 @@ import ProcessRequest from '../common/util/request/ProcessRequest';
 import RequestParamModel from '../viewmodel/RequestParamModel';
 import OperationInfo from '../viewmodel/process/OperationInfo';
 import { SelectWorkOrderDialog } from '../view/SelectWorkOrderDialog';
-import { SwitchingProductDialog, taskSeqItem } from '../view/SwitchingProductDialog';
+import { SwitchProductDialog, taskSeqItem } from '../view/SwitchProductDialog';
 import TaskSeqVO from '../viewmodel/process/TaskSeqInfo';
 import promptAction from '@ohos.promptAction';
 import { LoginInfoDialog } from '../view/LoginInfoDialog';
-import { SwitchingDeptDialog, SwitchingProductLineDialog, SwitchingStationDialog } from '../view/SwitchingStationViews';
-import { SwitchingUserDialog } from '../view/SwitchingUserDialog';
+import { SwitchDeptDialog, SwitchProductLineDialog, SwitchStationDialog } from '../view/SwitchStationDialog';
+import { SwitchUserDialog } from '../view/SwitchUserDialog';
 import OperationComponent from '../viewmodel/process/OperationComponent';
 import ProcessInfo from '../viewmodel/process/ProcessInfo';
 import { MaterialCollectView } from '../view/process/MaterialCollectView';
@@ -46,6 +46,7 @@ import TimeUtil from '../common/util/TimeUtil';
 import ProcessDeviceDailyCheck from '../viewmodel/process/ProcessDeviceDailyCheck';
 import { DeviceCheckView } from '../view/process/DeviceCheckView';
 import { ReportWorkHourRateDialog } from '../view/ReportWorkHourRateDialog';
+import { ConfirmDialog } from '../view/ConfirmDialog';
 
 // 声明接受参数的类型
 interface Params {
@@ -115,6 +116,8 @@ struct ProcessIndex {
   @State isConnected: boolean = false
   // 当前订单扫码流水号数量
   @State scanSeqNos: number = 0
+  //所有流水号
+  allTaskSeq: TaskSeqVO[] = []
 
   private scrollerList: Scroller = new Scroller()
 
@@ -140,6 +143,8 @@ struct ProcessIndex {
     let queryRes = await ProcessRequest.post('/api/v1/plan/workOrder/taskPage2', {
       stationId: this.currentStationId,
       queryComplete: 0,
+      pageNo: 1,
+      pageSize: 99999,
     } as RequestParamModel) as WorkOrderPage;
     this.workOrders = queryRes?.records??[]
     if (this.workOrders) {
@@ -257,11 +262,12 @@ struct ProcessIndex {
     this.process = {}
     this.opComponents = []
     this.taskSeqArray = []
-    this.handleAllClick()
+    // this.handleAllClick()
   }
 
   handleAllClick():void {
     this.onQueryTask([])
+    this.allTaskSeq = this.taskSeqArray
   }
 
   handleReportedClick():void{
@@ -719,19 +725,30 @@ struct ProcessIndex {
                         }
                         // 流转卡号是否有效
                         let seqNoFlag = false
-                        for (const element of this.taskSeqArray) {
+                        for (const element of this.allTaskSeq) {
                           if (element.seqNo === this.scanCode) {
                             seqNoFlag = true
                             break;
                           }
                         }
                         if (!seqNoFlag) {
-                          promptAction.showToast({
-                            message: `${this.scanCode}不是有效的流水号`,
-                            duration: 1500,
-                            bottom: 100
-                          })
-                          this.scanCode = ''
+                          let queryRes = await ProcessRequest.post('/api/v1/plan/workOrder/taskPage2', {
+                            stationId: this.currentStationId,
+                            seqNo: this.scanCode,
+                            queryComplete: 0,
+                          } as RequestParamModel) as WorkOrderPage;
+                          this.workOrders = queryRes?.records ?? []
+                          if (this.workOrders && this.workOrders.length > 0) {
+                            this.switchWorkOrderController.open()
+                          } else {
+                            promptAction.showToast({
+                              message: `${this.scanCode}不是有效的流水号`,
+                              duration: 1500,
+                              bottom: 100
+                            })
+                            this.scanCode = ''
+                            return
+                          }
                           return
                         }
                         // 查询工序组件
@@ -1149,9 +1166,9 @@ struct ProcessIndex {
       scanState: this.scanState,
       opComponents: this.opComponents,
       selectComponentType: this.selectComponentType,
-      searchDept:()=>{this.SwitchingDeptController.open()},
-      searchStation:()=>{this.SwitchingStationController.open()},
-      searchProductLine:()=>{this.SwitchingProductLineController.open()},
+      searchDept:()=>{this.SwitchDeptController.open()},
+      searchStation:()=>{this.SwitchStationController.open()},
+      searchProductLine:()=>{this.SwitchProductLineController.open()},
     }),
     autoCancel: true, // 点击遮罩关闭
     customStyle: true,
@@ -1159,8 +1176,8 @@ struct ProcessIndex {
     maskColor: 'rgba(0,0,0,0.8)',  // 黑色遮罩
   })
   //切换部门弹窗控制器
-  SwitchingDeptController: CustomDialogController = new CustomDialogController({
-    builder: SwitchingDeptDialog({}),
+  SwitchDeptController: CustomDialogController = new CustomDialogController({
+    builder: SwitchDeptDialog({}),
     autoCancel: true, // 点击遮罩关闭
     customStyle: true,
     alignment:DialogAlignment.Center,
@@ -1328,16 +1345,16 @@ struct ProcessIndex {
     maskColor: 'rgba(0,0,0,0.8)',
   })
   // 切换产线弹窗控制器
-  SwitchingProductLineController: CustomDialogController = new CustomDialogController({
-    builder: SwitchingProductLineDialog({}),
+  SwitchProductLineController: CustomDialogController = new CustomDialogController({
+    builder: SwitchProductLineDialog({}),
     autoCancel: true, // 点击遮罩关闭
     customStyle: true,
     alignment:DialogAlignment.Center,
     maskColor: 'rgba(0,0,0,0.8)',  // 黑色遮罩
   })
   // 切换工位弹窗控制器
-  SwitchingStationController: CustomDialogController = new CustomDialogController({
-    builder: SwitchingStationDialog({}),
+  SwitchStationController: CustomDialogController = new CustomDialogController({
+    builder: SwitchStationDialog({}),
     autoCancel: true, // 点击遮罩关闭
     customStyle: true,
     alignment:DialogAlignment.Center,
@@ -1345,15 +1362,37 @@ struct ProcessIndex {
   })
   //切换用户弹窗控制器
   switchingUserController: CustomDialogController = new CustomDialogController({
-    builder: SwitchingUserDialog({}),
+    builder: SwitchUserDialog({}),
     autoCancel: true, // 点击遮罩关闭
     customStyle: true,
     alignment:DialogAlignment.Center,
     maskColor: 'rgba(0,0,0,0.8)',  // 黑色遮罩
   })
+  // 产品不属于当前工单时,切换工单确认弹窗控制器
+  switchWorkOrderController: CustomDialogController = new CustomDialogController({
+    builder: ConfirmDialog({
+      title: '切换工单确认',
+      message: '扫描的流水号不属于本工单,是否切换工单?',
+      onConfirm: ()=> {
+        this.selectWorkOder = this.workOrders[0]
+        this.selectOperationId = ''
+        this.seqNo = this.scanCode
+        this.seqList = []
+        this.scanState = 0
+        this.process = {}
+        this.opComponents = []
+        this.taskSeqArray = []
+        this.switchingProductDialogController.close()
+      },
+    }),
+    autoCancel: true,
+    alignment: DialogAlignment.Center,
+    // gridCount: 3,
+    customStyle: true,
+  })
   // 切换产品弹窗控制器
   switchingProductDialogController: CustomDialogController = new CustomDialogController({
-    builder: SwitchingProductDialog({
+    builder: SwitchProductDialog({
       scanState: this.scanState,
       process: this.process,
       scanSeqValue: this.scanCode,
@@ -1362,6 +1401,10 @@ struct ProcessIndex {
       opComponents: this.opComponents,
       seqNo: this.seqNo,
       scanSeqNos: this.scanSeqNos,
+      workOrders: this.workOrders,
+      switchWorkOrderConfirm: ()=>{
+        this.switchWorkOrderController.open()
+      },
     }),
     autoCancel: true, // 点击遮罩关闭
     customStyle: true,

+ 6 - 2
entry/src/main/ets/view/SelectWorkOrderDialog.ets

@@ -24,7 +24,9 @@ export struct SelectWorkOrderDialog {
     let queryRes = await ProcessRequest.post('/api/v1/plan/workOrder/taskPage2', {
       queryCode:this.scanOrderValue,
       queryComplete: 0,
-      stationId:this.currentStationId
+      stationId:this.currentStationId,
+      pageNo: 1,
+      pageSize: 99999,
     } as RequestParamModel) as WorkOrderPage;
     this.workOrderList = queryRes?.records??[]
   };
@@ -64,7 +66,9 @@ export struct SelectWorkOrderDialog {
           .enableKeyboardOnFocus(false)
           .onSubmit(async () => {
             let queryRes = await ProcessRequest.post('/api/v1/plan/workOrder/taskPage2', {
-              queryCode:this.scanOrderValue
+              queryCode:this.scanOrderValue,
+              pageNo: 1,
+              pageSize: 99999,
             } as RequestParamModel) as WorkOrderPage;
             this.workOrderList = queryRes?.records??[]
           })

+ 51 - 32
entry/src/main/ets/view/SwitchingProductDialog.ets

@@ -1,4 +1,3 @@
-//切换产品
 import CommonConstants from '../common/constants/CommonConstants'
 import preferencesUtil from '../common/util/PerferencesUtil'
 import ProcessRequest from '../common/util/request/ProcessRequest'
@@ -7,15 +6,19 @@ import ProcessInfo from '../viewmodel/process/ProcessInfo'
 import TaskSeqVO from '../viewmodel/process/TaskSeqInfo'
 import RequestParamModel from '../viewmodel/RequestParamModel'
 import WorkOrderInfo from '../viewmodel/WorkOrderInfo'
+import { WorkOrderPage } from '../viewmodel/WorkOrderPage'
 import promptAction from '@ohos.promptAction'
 
+//切换产品
 @CustomDialog
-export struct SwitchingProductDialog{
+export struct SwitchProductDialog {
   private scrollerList: Scroller = new Scroller()
   //查询报工
   @State queryTaskSeq: TaskSeqVO[] = []
   //选中的工单
   @Link selectWorkOder: WorkOrderInfo
+  //工单集合
+  @Link workOrders: WorkOrderInfo[]
   //当前工序号
   @Link currentOperationId: string
   //当前工位
@@ -38,6 +41,8 @@ export struct SwitchingProductDialog{
   @Link seqNo: string
   // 当前订单扫码流水号数量
   @Link scanSeqNos: number
+  //所有流水号
+  allTaskSeq: TaskSeqVO[] = []
 
   controller: CustomDialogController
   onQueryTask = async (currentStateList: Array<number>): Promise<number> => {
@@ -51,6 +56,9 @@ export struct SwitchingProductDialog{
     return res.length
   }
 
+  //扫码流水号不属于当前工单,确认是否切换工单弹窗
+  switchWorkOrderConfirm: () => void = () => {}
+
   onSwitchProduct=async ()=> {
     if (!this.selectWorkOder.workOrderCode || !this.currentStationId) {
       return
@@ -79,6 +87,7 @@ export struct SwitchingProductDialog{
 
   handleAllClick():void {
     this.onQueryTask([])
+    this.allTaskSeq = this.queryTaskSeq
   }
 
   handleReportedClick():void{
@@ -246,27 +255,27 @@ export struct SwitchingProductDialog{
              .fontSize($r('app.float.fontSize_16'))
              .fontColor($r('app.color.FFFFFF'))
              .enableKeyboardOnFocus(false)
-             .onSubmit(() => {
-               // 流转卡号是否有效
-               let seqNoFlag = false
-               for (const element of this.queryTaskSeq) {
-                 if (element.seqNo === this.scanSeqValue) {
-                   seqNoFlag = true
-                   break;
-                 }
-               }
-               if (!seqNoFlag) {
-                 promptAction.showToast({
-                   message: `${this.scanSeqValue}不是有效的流水号`,
-                   duration: 1500,
-                   bottom: 100
-                 })
-                 this.scanSeqValue = ''
-                 return
-               }
-               // this.seqNo = this.scanSeqValue
-               // this.controller.close();
-             })
+             // .onSubmit(() => {
+             //   // 流转卡号是否有效
+             //   let seqNoFlag = false
+             //   for (const element of this.allTaskSeq) {
+             //     if (element.seqNo === this.scanSeqValue) {
+             //       seqNoFlag = true
+             //       break;
+             //     }
+             //   }
+             //   if (!seqNoFlag) {
+             //     promptAction.showToast({
+             //       message: `${this.scanSeqValue}不是有效的流水号`,
+             //       duration: 1500,
+             //       bottom: 100
+             //     })
+             //     this.scanSeqValue = ''
+             //     return
+             //   }
+             //   // this.seqNo = this.scanSeqValue
+             //   // this.controller.close();
+             // })
              .onChange((value: string) => {
                this.scanSeqValue = value;
              })
@@ -315,19 +324,30 @@ export struct SwitchingProductDialog{
           .onClick(async () => {
             // 流转卡号是否有效
             let seqNoFlag = false
-            for (const element of this.queryTaskSeq) {
+            for (const element of this.allTaskSeq) {
               if (element.seqNo === this.scanSeqValue) {
                 seqNoFlag = true
                 break;
               }
             }
             if (!seqNoFlag) {
-              promptAction.showToast({
-                message: `${this.scanSeqValue}不是有效的流水号`,
-                duration: 1500,
-                bottom: 100
-              })
-              this.scanSeqValue = ''
+              let queryRes = await ProcessRequest.post('/api/v1/plan/workOrder/taskPage2', {
+                stationId: this.currentStationId,
+                seqNo: this.scanSeqValue,
+                queryComplete: 0,
+              } as RequestParamModel) as WorkOrderPage;
+              this.workOrders = queryRes?.records ?? []
+              if (this.workOrders && this.workOrders.length > 0) {
+                this.switchWorkOrderConfirm()
+              } else {
+                promptAction.showToast({
+                  message: `${this.scanSeqValue}不是有效的流水号`,
+                  duration: 1500,
+                  bottom: 100
+                })
+                this.scanSeqValue = ''
+                return
+              }
               return
             }
             this.scanState = 0
@@ -406,5 +426,4 @@ export struct taskSeqItem{
       }, 200);
     })
   }
-}
-
+}

+ 29 - 31
entry/src/main/ets/view/SwitchingStationViews.ets

@@ -1,11 +1,9 @@
 import ProcessRequest from '../common/util/request/ProcessRequest'
-import { MessageInfo, MessagePage } from '../viewmodel/MessageInfo'
-import TaskSeqVO from '../viewmodel/process/TaskSeqInfo'
 import { DeptInfo, ProductionLine, WorkstationInfo } from '../viewmodel/UserInfo'
 import RequestParamModel from '../viewmodel/RequestParamModel'
 
 @CustomDialog
-export struct SwitchingStationDialog{
+export struct SwitchStationDialog {
   private scrollerList: Scroller = new Scroller()
   //当前工位
   @Consume('currentStation') currentStation:string
@@ -43,33 +41,33 @@ export struct SwitchingStationDialog{
       .justifyContent(FlexAlign.Center)
 
       Column(){
-            List({space:10,scroller:this.scrollerList}) {
-              ForEach(this.stationsList, (item:WorkstationInfo,index) => {
-                ListItem() {
-                    Column(){
-                      Text(item.name)
-                        .fontSize($r('app.float.fontSize_24'))
-                        .fontColor($r('app.color.FFFFFF'))
-                    }  .backgroundColor(index === this.selectStationIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF'))
-                    .borderRadius($r('app.float.virtualSize_16'))
-                    .padding(8)
-                    .width('100%')
-                    .height('12%')
-                    .alignItems(HorizontalAlign.Center)
-                    .justifyContent(FlexAlign.Center)
-                    .border({
-                      width: index === this.selectStationIndex ? 2 : 0,
-                      color: index === this.selectStationIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF')
-                    })
-                    .onClick(() => {
-                      this.onSelectStation(index)
-                    })
-                }
-              })
+        List({space:10,scroller:this.scrollerList}) {
+          ForEach(this.stationsList, (item:WorkstationInfo,index) => {
+            ListItem() {
+                Column(){
+                  Text(item.name)
+                    .fontSize($r('app.float.fontSize_24'))
+                    .fontColor($r('app.color.FFFFFF'))
+                }  .backgroundColor(index === this.selectStationIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF'))
+                .borderRadius($r('app.float.virtualSize_16'))
+                .padding(8)
+                .width('100%')
+                .height('12%')
+                .alignItems(HorizontalAlign.Center)
+                .justifyContent(FlexAlign.Center)
+                .border({
+                  width: index === this.selectStationIndex ? 2 : 0,
+                  color: index === this.selectStationIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF')
+                })
+                .onClick(() => {
+                  this.onSelectStation(index)
+                })
             }
-            .width('70%')
-            .height('100%')
-          }
+          })
+        }
+        .width('70%')
+        .height('100%')
+      }
       .justifyContent(FlexAlign.SpaceEvenly)
       .width('100%')
       .height('81%')
@@ -125,7 +123,7 @@ export struct SwitchingStationDialog{
 }
 
 @CustomDialog
-export struct SwitchingProductLineDialog{
+export struct SwitchProductLineDialog{
   private scrollerList: Scroller = new Scroller()
   //当前产线
   @Consume('currentProductLine') currentProductLine:string
@@ -239,7 +237,7 @@ export struct SwitchingProductLineDialog{
 }
 
 @CustomDialog
-export struct SwitchingDeptDialog{
+export struct SwitchDeptDialog{
   private scrollerList: Scroller = new Scroller()
   //当前部门
   @Consume('currentDept') currentDept:string

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

@@ -5,7 +5,7 @@ import RequestParamModel from '../viewmodel/RequestParamModel'
 import { UserInfo } from '../viewmodel/UserInfo'
 
 @CustomDialog
-export struct SwitchingUserDialog {
+export struct SwitchUserDialog {
   //当前用户
   @Consume('currentUserName') currentUserName: string
   @State userName: string = ''

+ 2 - 1
entry/src/main/ets/view/process/SelfInspectView.ets

@@ -106,6 +106,7 @@ export struct SelfInspectView {
                     Toggle({ type: ToggleType.Switch, isOn: item.result === '1' ? true : false })
                       .selectedColor($r('app.color.30D158'))
                       .switchPointColor($r('app.color.FFFFFF'))
+                      .enabled(this.scanState === 1 ? true : false)
                       .onChange(async (isOn: boolean) => {
                         this.selectCheck = index
                         if (this.scanState === 0) {
@@ -149,7 +150,7 @@ export struct SelfInspectView {
                 .alignItems(HorizontalAlign.Start)
               }
               .borderRadius($r('app.float.virtualSize_16'))
-              .backgroundColor(this.selectCheck === index ? $r('app.color.2030D158') : $r('app.color.10FFFFFF'))
+              .backgroundColor(this.selectCheck === index && this.scanState === 1 ? $r('app.color.2030D158') : $r('app.color.10FFFFFF'))
               .width('100%')
               .onClick(()=>{
                 this.selectCheck = index