Procházet zdrojové kódy

零星叫料;齐套叫料修改

hh před 2 týdny
rodič
revize
89b5b0835b

+ 3 - 4
entry/src/main/ets/common/util/Mqtt.ets

@@ -1,5 +1,5 @@
 import { MqttAsync, MqttClient, MqttClientOptions, MqttConnectOptions,MqttQos, MqttMessage, MqttPublishOptions } from '@ohos/mqtt';
-import CommonConstants from '../../Common/constants/CommonConstants';
+import CommonConstants, { DeviceType } from '../constants/CommonConstants';
 import AntiWristStrap from '../../viewmodel/device/AntiWristStrap';
 import CardReader from '../../viewmodel/device/CardReader';
 import ElectricScrewdriver from '../../viewmodel/device/ElectricScrewdriver';
@@ -8,7 +8,6 @@ import Lighting from '../../viewmodel/device/Lighting';
 import TempHumiditySensor from '../../viewmodel/device/TempHumiditySensor';
 import ThreeColourLight from '../../viewmodel/device/ThreeColourLight';
 import WeldFumeExtractor from '../../viewmodel/device/WeldFumeExtractor';
-import BusinessConstant, { DeviceType } from '../constants/CommonConstants'
 
 const TAG = 'hhtest';
 
@@ -99,8 +98,8 @@ class MqttManager {
         let device6: Lighting = { lighting: 0, OnlineStatus: 0 }
         let device7: TempHumiditySensor = { Temperature: 0, Humidity: 0, OnlineStatus: 0 }
         for (const element of valueJson.d) {
-          if (BusinessConstant.attrMap.has(element.tag)) {
-            let deviceType: string = BusinessConstant.attrMap.get(element.tag) ?? '';
+          if (CommonConstants.attrMap.has(element.tag)) {
+            let deviceType: string = CommonConstants.attrMap.get(element.tag) ?? '';
             switch (deviceType) {
               case DeviceType.ThreeColourLight:
                 if (element.tag! === 'LedRed') {

+ 68 - 17
entry/src/main/ets/pages/ProcessIndex.ets

@@ -47,6 +47,7 @@ import ProcessDeviceDailyCheck from '../viewmodel/process/ProcessDeviceDailyChec
 import { DeviceCheckView } from '../view/process/DeviceCheckView';
 import { ReportWorkHourRateDialog } from '../view/ReportWorkHourRateDialog';
 import { ConfirmDialog } from '../view/ConfirmDialog';
+import VehicleInfo from '../viewmodel/VehicleInfo';
 
 // 声明接受参数的类型
 interface Params {
@@ -116,6 +117,8 @@ struct ProcessIndex {
   @State isConnected: boolean = false
   // 当前订单扫码流水号数量
   @State scanSeqNos: number = 0
+  //工序载具列表
+  @State processVehicleList: VehicleInfo[] = []
   //所有流水号
   allTaskSeq: TaskSeqVO[] = []
 
@@ -267,7 +270,6 @@ struct ProcessIndex {
 
   handleAllClick():void {
     this.onQueryTask([])
-    this.allTaskSeq = this.taskSeqArray
   }
 
   handleReportedClick():void{
@@ -288,8 +290,20 @@ struct ProcessIndex {
       operationId: this.selectOperationId,
       stateList: currentStateList
     } as RequestParamModel) as TaskSeqVO[];
+    if (currentStateList.length <= 0) {
+      this.allTaskSeq = this.taskSeqArray
+    }
   }
 
+  //加载工序所有载具
+  loadProcessVehicle = async () => {
+    let res = await ProcessRequest.post('/api/v1/process/vehicleOperation/list', {
+      workOrderCode:this.selectWorkOder.workOrderCode!,
+      operationId: this.selectOperationId
+    } as RequestParamModel) as OperationInfo;
+    this.processVehicleList = res.processVehicleList ?? []
+  };
+
   connectMQTT = async ()=> {
     const clientOptions: MqttClientOptions = {
       url: 'mqtt://192.168.1.3:1883',   // 替换实际IP
@@ -914,26 +928,61 @@ struct ProcessIndex {
             })
 
             Row().width('1.5%')
-            Row({ space: 4 }) {
-              Image($r('app.media.process_complete_reception'))
-                .width($r('app.float.virtualSize_24'))
-                .height($r('app.float.virtualSize_24'))
-                .fillColor($r('app.color.0A84FF'))
-              Text('齐套接收')
-                .fontColor($r('app.color.0A84FF'))
-                .fontSize($r('app.float.fontSize_24'))
-                .fontWeight(FontWeight.Medium)
+            Row() {
+              Stack() {
+                Row() {
+                  Circle()
+                    .width($r('app.float.virtualSize_12'))
+                    .height($r('app.float.virtualSize_12'))
+                    .fill($r('app.color.FF453A'))
+                    .opacity(this.processVehicleList.length > 0 ? 1 : 0)
+                }
+                .width('11.5%')
+                .height('39%')
+                .justifyContent(FlexAlign.Start)
+                .alignItems(VerticalAlign.Bottom)
+
+                Row({ space: 4 }) {
+                  Image($r('app.media.process_complete_reception'))
+                    .width($r('app.float.virtualSize_24'))
+                    .height($r('app.float.virtualSize_24'))
+                    .fillColor($r('app.color.0A84FF'))
+                  Text('齐套接收')
+                    .fontColor($r('app.color.0A84FF'))
+                    .fontSize($r('app.float.fontSize_24'))
+                    .fontWeight(FontWeight.Medium)
+                }
+                .width('100%')
+                .height('100%')
+                .justifyContent(FlexAlign.Center)
+                .backgroundColor($r('app.color.20FFFFFF'))
+                .borderRadius($r('app.float.fontSize_16'))
+              }
+              .width('100%')
+              .height('100%')
+              .alignContent(Alignment.TopEnd)
             }
             .width('10%')
             .height('58.3%')
-            .justifyContent(FlexAlign.Center)
-            .backgroundColor($r('app.color.20FFFFFF'))
-            .borderRadius($r('app.float.fontSize_16'))
-            .onClick(() => {
-              if (!this.selectWorkOder.workOrderCode) {
+            .onClick(async () => {
+              if (!this.selectWorkOder.workOrderCode || !this.selectOperationId) {
                 return
               }
-              this.completeReceiveController.open()
+              this.loadProcessVehicle()
+              if (this.processVehicleList.length > 0) {
+                this.completeReceiveController.open()
+                return
+              }
+              // 没有齐套物料,则发送叫料消息
+              let result: string = await ProcessRequest.post('/api/v1/process/vehicleOperation/materialOut', {
+                workOrderCode: this.selectWorkOder.workOrderCode!,
+                operationId: this.selectOperationId,
+                stationId: this.currentStationId
+              } as RequestParamModel)
+              promptAction.showToast({
+                message: result,
+                duration: 1500,
+              })
             })
 
             Blank()
@@ -1034,6 +1083,7 @@ struct ProcessIndex {
               }
               if (this.scanState === 0) {
                 this.scanState = 1
+                this.loadProcessVehicle()
                 // this.scanCodeToStartWork()
               } else if (this.scanState === 1) {
                 this.reportTimeBasedController.open()
@@ -1425,7 +1475,8 @@ struct ProcessIndex {
   completeReceiveController: CustomDialogController = new CustomDialogController({
     builder: CompleteReceiveDialog({
       currentWorkOrderCode: this.selectWorkOder.workOrderCode!,
-      currentOperationId: this.selectOperationId
+      currentOperationId: this.selectOperationId,
+      processVehicleList: this.processVehicleList,
     }),
     autoCancel: true, // 点击遮罩关闭
     customStyle: true,

+ 11 - 11
entry/src/main/ets/view/CompleteReceiveDialog.ets

@@ -10,7 +10,7 @@ export struct CompleteReceiveDialog {
   private scrollerMaterial: Scroller = new Scroller()
   private scrollerVehicle: Scroller = new Scroller()
   //工序载具列表
-  @State processVehicleList: VehicleInfo[] = []
+  @Link processVehicleList: VehicleInfo[]
   //当前工单号
   currentWorkOrderCode:string = ''
   //当前工序号
@@ -25,13 +25,13 @@ export struct CompleteReceiveDialog {
   onConfirm: () => void = () => {}
 
   //加载工序所有载具
-  loadProcessVehicle = async () => {
-    let res = await ProcessRequest.post('/api/v1/process/vehicleOperation/list', {
-      workOrderCode:this.currentWorkOrderCode,
-      operationId:this.currentOperationId
-    } as RequestParamModel) as OperationInfo;
-    this.processVehicleList = res.processVehicleList??[]
-  };
+  // loadProcessVehicle = async () => {
+  //   let res = await ProcessRequest.post('/api/v1/process/vehicleOperation/list', {
+  //     workOrderCode:this.currentWorkOrderCode,
+  //     operationId:this.currentOperationId
+  //   } as RequestParamModel) as OperationInfo;
+  //   this.processVehicleList = res.processVehicleList??[]
+  // };
 
   //加载载具物料信息
   loadVehicleMaterial = async () => {
@@ -52,9 +52,9 @@ export struct CompleteReceiveDialog {
     this.selectedVehicleIndex = index
   }
 
-  aboutToAppear(): void {
-    this.loadProcessVehicle();
-  }
+  // aboutToAppear(): void {
+  //   this.loadProcessVehicle();
+  // }
 
   build() {
     Column() {

+ 3 - 0
entry/src/main/ets/view/LittleMaterialRequestDialog.ets

@@ -21,6 +21,8 @@ export struct LittleMaterialRequestDialog {
   @State queryMaterialName: string = ''
   //物料map(名称,数量)
   @State materialNumMap: Record<string, number> = {};
+  // 当前工位id
+  @Consume('currentStationId') currentStationId: string
 
   callMaterials: MaterialInfo[]=[]
   // 扫码开工后的生产过程信息
@@ -81,6 +83,7 @@ export struct LittleMaterialRequestDialog {
       materials: this.callMaterials,
       processId: this.process?.id!,
       workOrderCode: this.selectWorkOder?.workOrderCode!,
+      stationId: this.currentStationId,
     } as ProcessCallMaterial);
     this.selectedIndexes = []
     this.selectMaterials = []

+ 3 - 1
entry/src/main/ets/view/SwitchProductDialog.ets

@@ -53,6 +53,9 @@ export struct SwitchProductDialog {
       stateList:currentStateList
     } as RequestParamModel) as TaskSeqVO[];
     this.queryTaskSeq = res
+    if (currentStateList.length <= 0) {
+      this.allTaskSeq = this.queryTaskSeq
+    }
     return res.length
   }
 
@@ -87,7 +90,6 @@ export struct SwitchProductDialog {
 
   handleAllClick():void {
     this.onQueryTask([])
-    this.allTaskSeq = this.queryTaskSeq
   }
 
   handleReportedClick():void{

+ 2 - 0
entry/src/main/ets/viewmodel/process/ProcessCallMaterial.ets

@@ -6,6 +6,8 @@ export default class ProcessCallMaterial {
   materials?: MaterialInfo[]
   // 生产id
   processId?: string
+  // 工位id
+  stationId?: string
   // 工单code
   workOrderCode?: string
 }