cjb il y a 1 jour
Parent
commit
7db3086279

+ 16 - 8
entry/src/main/ets/common/util/mqtt.ets

@@ -74,17 +74,25 @@ class MqttManager {
         valueJson?.d?.find(item => item.tag === 'Barcode2Data3')?.value as number,
         valueJson?.d?.find(item => item.tag === 'Barcode2Data4')?.value as number
       );
-      //抽屉外的RFID
-      const rfidStringOut = decodeRfidString(
-        valueJson?.d?.find(item => item.tag === 'RFID3Data1')?.value as number,
-        valueJson?.d?.find(item => item.tag === 'RFID3Data2')?.value as number,
-        valueJson?.d?.find(item => item.tag === 'RFID3Data3')?.value as number,
-        valueJson?.d?.find(item => item.tag === 'RFID3Data4')?.value as number
+      // //抽屉外的RFID
+      // const rfidStringOut = decodeRfidString(
+      //   valueJson?.d?.find(item => item.tag === 'RFID1Data1')?.value as number,
+      //   valueJson?.d?.find(item => item.tag === 'RFID1Data2')?.value as number,
+      //   valueJson?.d?.find(item => item.tag === 'RFID1Data3')?.value as number,
+      //   valueJson?.d?.find(item => item.tag === 'RFID1Data4')?.value as number
+      // );
+      //桌子上的RFID
+      const rfidStringDesk = decodeRfidString(
+        valueJson?.d?.find(item => item.tag === 'RFID2Data1')?.value as number,
+        valueJson?.d?.find(item => item.tag === 'RFID2Data2')?.value as number,
+        valueJson?.d?.find(item => item.tag === 'RFID2Data3')?.value as number,
+        valueJson?.d?.find(item => item.tag === 'RFID2Data4')?.value as number
       );
       AppStorage.SetOrCreate<number>('drawerPositionStatus', station2Set);
       AppStorage.SetOrCreate<number>('materialBoxWeight', station2Weight);
-      AppStorage.SetOrCreate<string>('materialBoxID', rfidStringIn);
-      AppStorage.SetOrCreate<string>('materialBoxRfid', rfidStringOut);
+      AppStorage.SetOrCreate<string>('materialBoxInRfid', rfidStringIn);
+      AppStorage.SetOrCreate<string>('materialBoxDeskRfid', rfidStringDesk);
+      // AppStorage.SetOrCreate<string>('materialBoxOutRfid', rfidStringOut);
 
     } catch (e) {
       console.error("MQTT消息处理异常:", e);

+ 7 - 5
entry/src/main/ets/component/InBoundView.ets

@@ -33,8 +33,10 @@ export struct InBoundView {
   @StorageLink('materialBoxWeight') materialBoxWeight: number =0;
   //全局变量 抽屉状态
   @StorageLink('drawerPositionStatus') drawerPositionStatus: number=1 ;
-  //全局变量 料箱ID
-  @StorageLink('materialBoxID') materialBoxID: string = '';
+  //全局变量 抽屉内料箱ID
+  @StorageLink('materialBoxInRfid') materialBoxInRfid: string = '';
+  // //全局变量 抽屉外料箱ID
+  // @StorageLink('materialBoxOutRfid') materialBoxOutRfid: string = '';
   //@State materialBoxID:string = ''
 
   //提示弹窗
@@ -75,7 +77,7 @@ export struct InBoundView {
     let res: MaterialBoxInfo[] = await WmsRequest.post("/api/v1/wmsOrder/inBox", {
       houseNo:'1',
       stanCode:CommonConstants.STATION_CODE,
-      vehicleCode:this.materialBoxID,
+      vehicleCode:this.materialBoxInRfid,
       detailsList: this.boxMaterials
     } as RequestParamModel)
     console.log('testTag', 'aaaaaaaa1' + JSON.stringify(res));
@@ -155,7 +157,7 @@ export struct InBoundView {
                 .height('30%')
                 .fillColor($r('app.color.30D158'))
 
-              Text(this.materialBoxID)
+              Text(this.materialBoxInRfid)
                 .margin({ left: 10 })
                 .fontSize($r('app.float.fontSize_38'))
                 .fontColor($r('app.color.30D158')) // 绿色文字
@@ -304,7 +306,7 @@ export struct InBoundView {
 
         this.showConfirmDialog({
           title: '入库确认',
-          message: `确定要${this.materialBoxID}料箱入库吗?`,
+          message: `确定要${this.materialBoxInRfid}料箱入库吗?`,
           onConfirm: () => {
             this.Warehousing();
           }

+ 9 - 9
entry/src/main/ets/component/OrderMaterialsStorageView.ets

@@ -167,9 +167,9 @@ export struct OrderListComponent {
               .margin({ top: 6 })
               .alignItems(HorizontalAlign.Start)
             }.backgroundColor(index === this.selectedIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF')) // 选中状态加深
-            .borderRadius($r('app.float.virtualSize_24'))
+            .borderRadius($r('app.float.virtualSize_16'))
             .padding(13)
-            .border({width:2,color:index === this.selectedIndex ? $r('app.color.2030D158'):$r('app.color.20FFFFFF')})
+            .border({width:1,color:index === this.selectedIndex ? $r('app.color.2030D158'):$r('app.color.20FFFFFF')})
             .onClick(() => {
               this.onSelect(index)
               this.queryDemandMaterial(this.selectWorkOrder.workOrderCode)
@@ -233,7 +233,7 @@ export struct SingleOrder {
         .color($r('app.color.15FFFFFF'))
         .margin({top:'2%'})
     }//.backgroundColor(index === this.selectedIndex ? $r('app.color.30D158') : $r('app.color.20FFFFFF')) // 选中状态加深
-    .borderRadius($r('app.float.virtualSize_24'))
+    .borderRadius($r('app.float.virtualSize_16'))
     .padding(13)
 
   }
@@ -325,12 +325,12 @@ export struct BoxGrid {
               .alignItems(HorizontalAlign.Start)
             }
             .backgroundColor(index === this.selectedMaterialIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF')) // 选中状态加深
-            .borderRadius($r('app.float.virtualSize_24'))
+            .borderRadius($r('app.float.virtualSize_16'))
             .padding(8)
             .height(this.isQueryEmpty?'50%':'25%')
             .border({
-              width: 2,
-              color: index === this.selectedMaterialIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF')
+              width: 1,
+              color: index === this.selectedMaterialIndex ? $r('app.color.2030D158') :$r('app.color.20FFFFFF')
             })
             .onClick(() => {
               this.onSelectMaterial(index)
@@ -391,11 +391,11 @@ export struct BoxGrid {
             }
           }
           .backgroundColor(index === this.selectedEmptyIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF')) // 选中状态加深
-          .borderRadius($r('app.float.virtualSize_24'))
+          .borderRadius($r('app.float.virtualSize_16'))
           .padding(8)
           .height(this.isQueryMaterial?'50%':'25%')
           .border({
-            width: 2,
+            width: 1,
             color: index === this.selectedEmptyIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF')
           })
           .onClick(() => {
@@ -523,7 +523,7 @@ export struct MaterialListComponent {
               }.width('10%')
             }
             .backgroundColor($r('app.color.20FFFFFF')) // 选中状态加深
-            .borderRadius($r('app.float.virtualSize_24'))
+            .borderRadius($r('app.float.virtualSize_16'))
             .padding(13)
           }
         })

+ 8 - 8
entry/src/main/ets/component/WarehousingStaticsView.ets

@@ -81,7 +81,7 @@ struct StaticOrderItem{
       .margin({ top: 6 })
       .alignItems(HorizontalAlign.Start)
     }.backgroundColor(this.scaleValue===0.9 ? $r('app.color.2030D158') : $r('app.color.20FFFFFF'))
-    .borderRadius($r('app.float.virtualSize_24'))
+    .borderRadius($r('app.float.virtualSize_16'))
     .padding(13)
 
     .scale({ x: this.scaleValue, y: this.scaleValue })
@@ -182,13 +182,13 @@ struct OrderMaterialDialog {
               Row()
                 .width(`${this.inBoundRation}%`)
                 .height('100%')
-                .borderRadius($r('app.float.virtualSize_24'))
+                .borderRadius($r('app.float.virtualSize_16'))
                 .linearGradient({
                   angle: 90,
                   colors: [[$r('app.color.1050FF'), 0.0], [$r('app.color.73C3FF'), 1]]
                 })
             }.height('10%').width('100%').backgroundColor($r('app.color.10FFFFFF'))
-            .borderRadius($r('app.float.virtualSize_24'))
+            .borderRadius($r('app.float.virtualSize_16'))
             Row(){
               Text('物料出库比例')
                 .width('80%')
@@ -204,7 +204,7 @@ struct OrderMaterialDialog {
               Row()
                 .width(`${this.outBoundRation}%`)
                 .height('100%')
-                .borderRadius($r('app.float.virtualSize_24'))
+                .borderRadius($r('app.float.virtualSize_16'))
                 .linearGradient({
                   angle: 90,
                   colors: [[$r('app.color.1050FF'), 0.0], [$r('app.color.73C3FF'), 1]]
@@ -213,13 +213,13 @@ struct OrderMaterialDialog {
             .height('10%')
             .width('100%')
             .backgroundColor($r('app.color.10FFFFFF'))
-            .borderRadius($r('app.float.virtualSize_24'))
+            .borderRadius($r('app.float.virtualSize_16'))
           }
           .width('20%')
           .alignItems(HorizontalAlign.Start)
         }.width('100%')
       }.backgroundColor( $r('app.color.20FFFFFF'))
-      .borderRadius($r('app.float.virtualSize_24'))
+      .borderRadius($r('app.float.virtualSize_16'))
       .padding({left:30,right:10,top:10,bottom:5})
       .height('14%')
       .width('95%')
@@ -387,7 +387,7 @@ struct StaticMaterialItem{
       .margin({ top: 6 })
       .alignItems(HorizontalAlign.Start)
     }.backgroundColor(this.scaleValue===0.9 ? $r('app.color.2030D158') : $r('app.color.20FFFFFF'))
-    .borderRadius($r('app.float.virtualSize_24'))
+    .borderRadius($r('app.float.virtualSize_16'))
     .padding(13)
     //.border({width:2,color:$r('app.color.20FFFFFF')})
     .scale({ x: this.scaleValue, y: this.scaleValue })
@@ -488,7 +488,7 @@ struct MaterialBoxDialog {
               .alignItems(HorizontalAlign.Start)
             }
             .backgroundColor(index === this.selectedMaterialIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF')) // 选中状态加深
-            .borderRadius($r('app.float.virtualSize_24'))
+            .borderRadius($r('app.float.virtualSize_16'))
             .padding(8)
             .border({
               width: 2,

+ 9 - 9
entry/src/main/ets/pages/EmptyBoxStorage.ets

@@ -33,7 +33,7 @@ struct emptyBoxStorage {
   //表示对当前读取rfid状态
   //no_box:没有rfid new_manual_box:手动新生成rfid existing_box:已经存在的rfid new_rfid_box:读取的新rfid
   @State currentStatus: 'no_box' | 'new_manual_box' | 'existing_box' |'new_rfid_box'= 'no_box';
-  @StorageLink('materialBoxRfid') @Watch('onMaterialBoxRfidChange') materialBoxRfid: string = '';
+  @StorageLink('materialBoxDeskRfid') @Watch('onMaterialBoxRfidChange') materialBoxDeskRfid: string = '';
 
   commonDialogController: CustomDialogController | null = null;
   private showConfirmDialog(params: ConfirmDialogParams) {
@@ -93,9 +93,9 @@ struct emptyBoxStorage {
     let res: MaterialBoxInfo[] = await WmsRequest.post("/api/v1/wms/vehicle/add", {
       capacity:100,
       category:'0',
-      code:this.isManualGenerating?this.manualGeneratedId:this.materialBoxRfid,
+      code:this.isManualGenerating?this.manualGeneratedId:this.materialBoxDeskRfid,
       name: `料箱${getBoxNumber(
-        this.isManualGenerating ? this.manualGeneratedId : this.materialBoxRfid
+        this.isManualGenerating ? this.manualGeneratedId : this.materialBoxDeskRfid
       )}`,
       propertyCode:'',
       universal:0
@@ -106,13 +106,13 @@ struct emptyBoxStorage {
       this.filterMaterialBoxes();
     });
     //添加后更新料箱rfid显示
-    await this.checkRfidStatus(this.materialBoxRfid ?? '');
+    await this.checkRfidStatus(this.materialBoxDeskRfid ?? '');
   }
 
   onMaterialBoxRfidChange() {
     //如果是手动生成rfid直接返回
     if(this.isManualGenerating) return
-    this.checkRfidStatus(this.materialBoxRfid ?? '');
+    this.checkRfidStatus(this.materialBoxDeskRfid ?? '');
   }
 
   //检查从读卡器传来的rfid值
@@ -138,7 +138,7 @@ struct emptyBoxStorage {
       this.filterMaterialBoxes();
     });
     setTimeout(() => {
-      this.checkRfidStatus(this.materialBoxRfid);
+      this.checkRfidStatus(this.materialBoxDeskRfid);
     }, 500);
   }
 
@@ -202,13 +202,13 @@ struct emptyBoxStorage {
                 .margin({top:'3%'})
               Row(){
                 Stack() {
-                  Image(this.materialBoxRfid != ''? $r('app.media.identified_material_box'):$r('app.media.not_identified_material_box'))
+                  Image(this.materialBoxDeskRfid != ''? $r('app.media.identified_material_box'):$r('app.media.not_identified_material_box'))
                     .width('100%')
                     .height('100%')
                     .borderRadius($r('app.float.virtualSize_16'))
                     .objectFit(ImageFit.Contain)
                   Column(){
-                    Text(this.isManualGenerating ? this.manualGeneratedId : this.materialBoxRfid)
+                    Text(this.isManualGenerating ? this.manualGeneratedId : this.materialBoxDeskRfid)
                       .fontSize($r('app.float.fontSize_48'))
                       .fontColor($r('app.color.FFFFFF'))
                     Text(this.remindText)
@@ -369,7 +369,7 @@ struct emptyBoxStorage {
                   this.writeButtonClick = 1;
                   this.showConfirmDialog({
                     title: '确认添加',
-                    message: `确定要添加新料箱${this.materialBoxRfid}吗?`,
+                    message: `确定要添加新料箱${this.materialBoxDeskRfid}吗?`,
                     onConfirm: ()=> {
                       this.onConfirmAdd()
                     }

+ 2 - 2
entry/src/main/ets/pages/IntelligentWarehousingStatics.ets

@@ -185,7 +185,7 @@ struct IntelligentWarehousingStatics {
               .height('45%')
               .width('90%')
               .backgroundColor($r('app.color.10FFFFFF'))
-              .borderRadius($r('app.float.virtualSize_24'))
+              .borderRadius($r('app.float.virtualSize_16'))
               Column(){
                 Column(){
                   Text("存取频率")
@@ -206,7 +206,7 @@ struct IntelligentWarehousingStatics {
               .height('45%')
               .width('90%')
               .backgroundColor($r('app.color.10FFFFFF'))
-              .borderRadius($r('app.float.virtualSize_24'))
+              .borderRadius($r('app.float.virtualSize_16'))
           }.justifyContent(FlexAlign.SpaceEvenly).margin({top:'5%'})
           .height('100%')
           .width('30%')

+ 33 - 2
entry/src/main/ets/pages/Menu.ets

@@ -14,6 +14,8 @@ import {UserInfo} from '../viewmodel/wms/UserInfo'
 import UserAuthModel from '../common/util/UserAuthModel';
 import DictInfo from '../viewmodel/DictInfo'
 import connection from '@ohos.net.connection';
+import { ConfirmDialogParams } from '../viewmodel/wms/ConfirmDialogParam'
+import { CommonConfirmDialog } from '../component/OrderMaterialsStorageView'
 
 const TAG: string = 'MENU'
 @Entry
@@ -24,7 +26,30 @@ struct menu {
   @State outBoundOrders: BoundOrder[]=[]
   @State loginName: string = 'admin'
   @State password: string = '123456'
-@State isConnected:boolean=false
+  @State isConnected:boolean=false
+
+  commonDialogController: CustomDialogController | null = null;
+  private showConfirmDialog(params: ConfirmDialogParams) {
+    if (this.commonDialogController) {
+      this.commonDialogController.close()
+    }
+
+    this.commonDialogController = new CustomDialogController({
+      builder: CommonConfirmDialog({
+        title: params.title || '提示',
+        message: params.message,
+        confirmText: params.confirmText || '确定',
+        cancelText: params.cancelText || '取消',
+        onConfirm: params.onConfirm
+      }),
+      cancel: () => console.log('用户取消操作'),
+      customStyle: true,
+      autoCancel:false,
+      maskColor: 'rgba(0,0,0,0.6)'
+    });
+
+    this.commonDialogController.open();
+  }
 
   loadOrders = async (type: number, targetArray: BoundOrder[]) => {
     const pages = await WmsRequest.post('/api/v1/wmsOrder/page', { type } as RequestParamModel) as PageRes;
@@ -181,7 +206,13 @@ struct menu {
         .justifyContent(FlexAlign.Start)
         .margin({left:'2%'})
         .onClick(()=> {
-          router.back()
+          this.showConfirmDialog({
+            title: '退出',
+            message: `确定退出到桌面吗?`,
+            onConfirm: ()=> {
+              router.back()
+            }
+          });
         })
         Row(){
           NavigationBar().width('20%')

+ 2 - 1
entry/src/main/ets/pages/OrderMaterialsStorage.ets

@@ -89,7 +89,8 @@ struct orderMaterialsStorage {
           OrderMaterialStorageThirdStep({
             scanMaterialList:this.scanMaterialList,
             currentStep:this.currentStep,
-            materialData:this.materialData
+            materialData:this.materialData,
+            selectWorkOrder:this.selectWorkOrder
           })
         }
       }

+ 1 - 1
entry/src/main/ets/view/wms/CallMaterialNotification.ets

@@ -60,7 +60,7 @@ struct MaterialNotificationItem{
       }.width('15%')
     }
     .backgroundColor(this.scaleValue===0.9 ? $r('app.color.2030D158') : $r('app.color.20FFFFFF')) // 选中状态加深
-    .borderRadius($r('app.float.virtualSize_24'))
+    .borderRadius($r('app.float.virtualSize_16'))
     .padding(10)
     .scale({ x: this.scaleValue, y: this.scaleValue })
     .animation({

+ 2 - 2
entry/src/main/ets/view/wms/OrderMaterialStorageSecondStep.ets

@@ -14,8 +14,8 @@ import MaterialInfo from '../../viewmodel/wms/MaterialInfo'
 
 @Component
 export struct OrderMaterialStorageSecondStep {
-  @Prop  selectWorkOrder:WorkOrderInfo = {}
-  @Link currentStep: number
+  @Link  selectWorkOrder:WorkOrderInfo
+  @Link  currentStep: number
   @State scanCodeValue:string = ''
   @State selectedMaterialBox: MaterialBoxInfo = {};
   @State outBoundButtonClick :number = 1

+ 2 - 1
entry/src/main/ets/view/wms/OrderMaterialStorageThirdStep.ets

@@ -10,6 +10,7 @@ import MaterialInfo from '../../viewmodel/wms/MaterialInfo'
 const TAG = 'OrderInbound';
 @Component
 export struct OrderMaterialStorageThirdStep {
+  @Prop  selectWorkOrder:WorkOrderInfo
   @Prop materialData:WorkOrderMaterialInfo[]=[]
   //物料数量
   @State materialNum:number= 0
@@ -95,7 +96,7 @@ export struct OrderMaterialStorageThirdStep {
               Text("扫码录入")
                 .fontColor($r('app.color.FFFFFF'))
                 .fontSize($r('app.float.fontSize_38'))
-              Text('电机生产订单DWS123331223332(电路板-SDASDASFSADASD)')
+              Text(`${this.selectWorkOrder.orderName}(${this.selectWorkOrder.orderCode})`)
                 .fontColor($r('app.color.FFFFFF'))
                 .fontSize($r('app.float.fontSize_16'))
             }.height('100%').width('65%').alignItems(HorizontalAlign.Start).justifyContent(FlexAlign.Center)