Forráskód Böngészése

修改空箱入库

cjb 2 hete
szülő
commit
98b34af73a

+ 7 - 5
entry/src/main/ets/common/util/mqtt.ets

@@ -77,14 +77,15 @@ class MqttManager {
       );
       //抽屉外的RFID
       const rfidStringOut = 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
+        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
       );
       AppStorage.SetOrCreate<number>('drawerPositionStatus', station2Set);
       AppStorage.SetOrCreate<number>('materialBoxWeight', station2Weight);
       AppStorage.SetOrCreate<string>('materialBoxID', rfidStringIn);
+      AppStorage.SetOrCreate<string>('materialBoxRfid', rfidStringOut);
 
     } catch (e) {
       console.error("MQTT消息处理异常:", e);
@@ -197,7 +198,8 @@ export interface MQTTReceiveData {
 
 
 function decodeRegister(regValue: number | undefined): string {
-  if (regValue === undefined) return ''; // 处理undefined
+  if (regValue === undefined || regValue === 0) return '';
+  //if (regValue === undefined) return ''; // 处理undefined
 
   // 确保是16位无符号整数
   const value = regValue & 0xFFFF;

+ 1 - 1
entry/src/main/ets/common/util/request/WmsRequest.ets

@@ -13,7 +13,7 @@ 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.3:8079"//huajing
 // const baseUrl = "http://192.168.1.4:8079/" //chuangke
 const DEBUG = true //
 

+ 0 - 2
entry/src/main/ets/component/InBoundView.ets

@@ -72,7 +72,6 @@ export struct InBoundView {
   }
   //入库命令
   Warehousing = async () => {
-    console.info("sssss"+this.materialBoxID)
     let res: MaterialBoxInfo[] = await WmsRequest.post("/api/v1/wmsOrder/inBox", {
       houseNo:'1',
       stanCode:CommonConstants.STATION_CODE,
@@ -282,7 +281,6 @@ export struct InBoundView {
         setTimeout(() => {
           this.InboundButtonClick = 1; // 0.2秒后恢复
         }, 200);
-        console.info('sssss'+JSON.stringify(this.boxMaterials))
         if(this.drawerPositionStatus == 0)
         {
           this.reminds = "抽屉未缩回,请检查后重试"

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

@@ -96,8 +96,8 @@ export struct NavigationBar {
     Row() {
       // 带数字标记的通知图标
       Image($r('app.media.navigation_statistics'))
-        .width($r('app.float.virtualSize_48'))
-        .height($r('app.float.virtualSize_48'))
+        .width($r('app.float.virtualSize_56'))
+        .height($r('app.float.virtualSize_56'))
         .fillColor($r('app.color.FFFFFF'))
         .onClick(()=>{
           router.pushUrl({
@@ -113,22 +113,22 @@ export struct NavigationBar {
         }
       }) {
         Image($r('app.media.navigation_notifications')) // 通知图标
-          .width($r('app.float.virtualSize_48'))
-          .height($r('app.float.virtualSize_48'))
+          .width($r('app.float.virtualSize_56'))
+          .height($r('app.float.virtualSize_56'))
           .fillColor($r('app.color.FFFFFF'))
       }.onClick(()=>{
         this.NotificationDialogController.open()
       })
       Image($r('app.media.navigation_logs'))
-        .width($r('app.float.virtualSize_48'))
-        .height($r('app.float.virtualSize_48'))
+        .width($r('app.float.virtualSize_56'))
+        .height($r('app.float.virtualSize_56'))
         .fillColor($r('app.color.FFFFFF'))
         .onClick(()=>{
           this.WarehousingLogController.open()
         })
       Image($r('app.media.navigation_rgv_control'))
-        .width($r('app.float.virtualSize_48'))
-        .height($r('app.float.virtualSize_48'))
+        .width($r('app.float.virtualSize_56'))
+        .height($r('app.float.virtualSize_56'))
         .fillColor($r('app.color.FFFFFF'))
         .onClick(()=>{
           router.pushUrl({

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

@@ -434,7 +434,7 @@ export struct MaterialList {
                   .fontColor($r('app.color.FFFFFF'))
                   .width('90%')
                   .textAlign(TextAlign.Start)
-                Text(`${item.storageNum}/${item.num}`)
+                Text(`${item.storageNum}/${item.num}${item.unit}`)
                   .fontSize($r('app.float.fontSize_30'))
                   .fontColor($r('app.color.FFFFFF'))
                   .width('10%')

+ 13 - 0
entry/src/main/ets/component/TimeAndTitle.ets

@@ -1,6 +1,19 @@
 import TimeUtil from "../common/util/TimeUtil"
 @Component
 export struct TimeAndTitle {
+  @State currentTime: string = TimeUtil.getHourAndMinute(); // 响应式时间数据
+  private timerID: number | undefined; // 定时器ID
+  aboutToAppear() {
+    this.timerID = setInterval(() => {
+      this.currentTime = TimeUtil.getHourAndMinute(); // 每秒更新
+    }, 1000);
+  }
+  aboutToDisappear() {
+    if (this.timerID) {
+      clearInterval(this.timerID);
+    }
+  }
+
   build() {
     Row() {
       Row(){

+ 3 - 1
entry/src/main/ets/component/WarehousingStaticsView.ets

@@ -539,7 +539,6 @@ export struct LineChart {
   private settings: RenderingContextSettings = new RenderingContextSettings(true)
   private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
 
-  // 图表数据
   @Link  frequencyData: number[]
   private readonly months: string[] = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
 
@@ -547,6 +546,9 @@ export struct LineChart {
   private readonly chartWidth: number = 400
   private readonly chartHeight: number = 250
   private readonly chartPadding: number = 30
+  async aboutToAppear() {
+    console.info('Monthly Data'+this.frequencyData[4])
+  }
 
   build() {
     Column() {

+ 235 - 90
entry/src/main/ets/pages/EmptyBoxStorage.ets

@@ -5,21 +5,156 @@ import {NavigationBar} from '../component/NavigationBar'
 import {TimeAndTitle} from "../component/TimeAndTitle"
 import {InBoundView} from '../component/InBoundView'
 import router from '@ohos.router';
-import WorkOrderInfo from '../viewmodel/wms/WorkOrderInfo'
 import MaterialInfo from '../viewmodel/wms/MaterialInfo';
+import WmsRequest from '../common/util/request/WmsRequest'
+import MaterialBoxInfo from '../viewmodel/wms/MaterialBoxInfo';
+import RequestParamModel from '../viewmodel/wms/RequestParamModel';
+import {CommonConfirmDialog}from "../component/OrderMaterialsStorageView"
+import {ConfirmDialogParams} from "../viewmodel/wms/ConfirmDialogParam"
 
 @Entry
 @Component
 struct emptyBoxStorage {
-  @State materialBoxID: string = 'LX-00010';
-  @State isMaterialBoxExist: Boolean = true;
-  @State isPrinterOnline: Boolean = true;
-  @State isRfidOnline: Boolean = true;
+  private scrollerForList: Scroller = new Scroller()
   @State generateButtonClick :number = 1
-  @State printButtonClick :number = 1
   @State writeButtonClick :number = 1
   @State materialNum: number=0
   @State scanMaterialList: MaterialInfo[] = []
+  @State existMaterialBoxesID:string[] = []
+  @State queryMaterialBoxID:string = ''
+  @State filteredMaterialBoxes: string[] = []; // 过滤后的料箱
+  @State remindText :string =''
+  //是否允许确认添加
+  @State isAllowedAdd : boolean = false
+  //手动生成的料箱rfid
+  @State manualGeneratedId: string = '';
+  //是否手动生成的
+  @State isManualGenerating:boolean = false;
+  //表示对当前读取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 = '';
+
+  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();
+  }
+
+  //加载所有料箱载具
+  loadMaterialBoxes = async () => {
+    try {
+      let res: MaterialBoxInfo[] = await WmsRequest.post("/api/v1/wms/vehicle/list", {} as RequestParamModel);
+
+      this.existMaterialBoxesID = [
+        ...res.map(item => item.code).filter(Boolean) as string[]
+      ];
+      console.log('Loaded material boxes:', this.existMaterialBoxesID);
+    } catch (error) {
+      console.error('Failed to load material boxes:', error);
+    }
+  }
+
+  //copy一份载具列表用于筛选过滤
+  filterMaterialBoxes = () => {
+    if (!this.queryMaterialBoxID?.trim()) {
+      this.filteredMaterialBoxes = [...this.existMaterialBoxesID];
+    } else {
+      const searchTerm = this.queryMaterialBoxID.toLowerCase();
+      this.filteredMaterialBoxes = this.existMaterialBoxesID.filter(id =>
+      id.toLowerCase().includes(searchTerm)
+      );
+    }
+  }
+  //确认添加
+  onConfirmAdd=async()=>{
+    let res: MaterialBoxInfo[] = await WmsRequest.post("/api/v1/wms/vehicle/add", {
+      capacity:100,
+      category:'0',
+      code:this.isManualGenerating?this.manualGeneratedId:this.materialBoxRfid,
+      name: this.isManualGenerating
+        ? `料箱${this.manualGeneratedId.split('-')[1]}`
+        : this.materialBoxRfid.split('-')[1],
+      propertyCode:'',
+      universal:0
+    } as RequestParamModel);
+    this.isManualGenerating=false;
+    //添加后加载新列表
+    this.loadMaterialBoxes().then(() => {
+      this.filterMaterialBoxes();
+    });
+    //添加后更新料箱rfid显示
+    this.checkRfidStatus(this.materialBoxRfid ?? '');
+  }
+
+  onMaterialBoxRfidChange() {
+    //如果是手动生成rfid直接返回
+    if(this.isManualGenerating) return
+    this.checkRfidStatus(this.materialBoxRfid ?? '');
+  }
+
+  //检查从读卡器传来的rfid值
+  private checkRfidStatus(rfidValue: string) {
+    if (!rfidValue || rfidValue.trim() === '') {
+      this.currentStatus = 'no_box';
+      this.remindText = "";
+      this.isAllowedAdd = false;
+    } else if (this.existMaterialBoxesID.includes(rfidValue)) {
+      this.currentStatus = 'existing_box';
+      this.remindText = "当前为已有料箱";
+      this.isAllowedAdd = false;
+    } else {
+      this.currentStatus = 'new_rfid_box';
+      this.remindText = "新料箱编号请添加";
+      this.isAllowedAdd = true;
+    }
+  }
+
+
+  aboutToAppear(): void {
+    this.loadMaterialBoxes().then(() => {
+      this.filterMaterialBoxes();
+    });
+    setTimeout(() => {
+      this.checkRfidStatus(this.materialBoxRfid);
+    }, 500);
+  }
+
+  createMaterialBoxesID = () => {
+    if (!this.existMaterialBoxesID || this.existMaterialBoxesID.length === 0) {
+      this.manualGeneratedId = "LX-00001";
+    } else {
+      const maxNumber = Math.max(...this.existMaterialBoxesID.map(code => {
+        const numPart = code.split('-')[1];
+        return parseInt(numPart) || 0;
+      }), 0);
+      this.manualGeneratedId = `LX-${(maxNumber + 1).toString().padStart(5, '0')}`;
+    }
+
+    this.isManualGenerating = true;
+    this.currentStatus = 'new_manual_box';
+    this.remindText = "已生成新料箱编号请添加";
+    this.isAllowedAdd = true;
+  }
+
+
   build() {
     Row() {
       Column() {
@@ -62,30 +197,28 @@ struct emptyBoxStorage {
                 .margin({top:'3%'})
               Row(){
                 Stack() {
-                  Image(this.isMaterialBoxExist? $r('app.media.identified_material_box'):$r('app.media.not_identified_material_box'))
+                  Image(this.currentStatus === 'new_rfid_box'? $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)
-                  Text("LX-00010")
-                    .fontSize($r('app.float.fontSize_48'))
-                    .fontColor($r('app.color.FFFFFF'))
-                    .position({
-                      x: '38%',
-                      y: '80%',
-                    })
-                  Text("已生成新编号")
-                    .fontSize($r('app.float.fontSize_12'))
-                    .fontColor($r('app.color.60FFFFFF'))
-                    .position({
-                      x: '45%',
-                      y: '87%',
-                    })
+                  Column(){
+                    Text(this.isManualGenerating ? this.manualGeneratedId : this.materialBoxRfid)
+                      .fontSize($r('app.float.fontSize_48'))
+                      .fontColor($r('app.color.FFFFFF'))
+                    Text(this.remindText)
+                      .fontSize($r('app.float.fontSize_12'))
+                      .fontColor($r('app.color.60FFFFFF'))
+                  }.alignItems(HorizontalAlign.Center)
+                  .height('20%')
+                  .margin({top:'77%'})
+                  .justifyContent(FlexAlign.Center)
                 }
               }
               .margin({top:'3%'})
               .height('75%')
               .width('100%')
+              .justifyContent(FlexAlign.Start)
               Button({type:ButtonType.Normal}) {
                 Row() {
                   Image($r('app.media.material_qr_code'))
@@ -100,9 +233,14 @@ struct emptyBoxStorage {
                 .justifyContent(FlexAlign.Center)
               }
               .margin({top:'10%'})
-              .width('35%')
+              .width('40%')
               .height('6%')
-              .backgroundColor($r('app.color.20FFFFFF'))
+              .enabled(this.currentStatus === 'no_box')
+              .backgroundColor(
+                this.currentStatus === 'no_box'
+                  ? $r('app.color.20FFFFFF')
+                  : $r('app.color.10FFFFFF')
+              )
               .borderRadius($r('app.float.virtualSize_16'))
               .scale({ x: this.generateButtonClick, y: this.generateButtonClick })
               .animation({
@@ -113,6 +251,13 @@ struct emptyBoxStorage {
                 this.generateButtonClick = 0.9;
                 setTimeout(() => {
                   this.generateButtonClick = 1;
+                  this.showConfirmDialog({
+                    title: '生成料箱编码',
+                    message: `确定要生成新料箱编码吗?`,
+                    onConfirm: ()=> {
+                      this.createMaterialBoxesID();
+                    }
+                  });
                 }, 200);
               })
             }
@@ -124,93 +269,86 @@ struct emptyBoxStorage {
               .height($r('app.float.virtualSize_48'))
               .fillColor($r('app.color.FFFFFF'))
             Column(){
-              Text("打印条码")
+              Text("料箱编码列表")
                 .fontColor($r('app.color.FFFFFF'))
                 .fontSize($r('app.float.fontSize_38'))
                 .margin({top:'3%'})
-              Column(){
-                Image(this.isPrinterOnline? $r('app.media.printer_online'):$r('app.media.printer_offline'))
-                  .width('100%')
-                  .height('40%')
-                  .borderRadius($r('app.float.virtualSize_16'))
-                  .objectFit(ImageFit.Contain)
-                Button({type:ButtonType.Normal}) {
-                  Row() {
-                    Image($r('app.media.material_qr_code'))
-                      .width('15%')
-                      .height('50%')
-                      .margin({ right: 8 })
-                      .fillColor($r('app.color.0A84FF'))
-                    Text("打印编号")
-                      .fontSize($r('app.float.fontSize_30'))
-                      .fontColor($r('app.color.0A84FF'))
-                  }
-                  .justifyContent(FlexAlign.Center)
+              Row() {
+                TextInput({ text:this.queryMaterialBoxID,placeholder: '输入料箱编码' })
+                  .type(InputType.Normal)
+                  .placeholderFont({ size: $r('app.float.fontSize_30') })
+                  .placeholderColor($r('app.color.30FFFFFF'))
+                  .fontSize($r('app.float.fontSize_30'))
+                  .fontColor($r('app.color.FFFFFF'))
+                  .enableKeyboardOnFocus(false)
+                  .width('84%')
+                  .onChange((value: string) => {
+                    this.queryMaterialBoxID = value;
+                    this.filterMaterialBoxes(); // 实时触发过滤
+                  })
+                Row() {
+                  Image($r('app.media.wms_search'))
+                    .width($r('app.float.virtualSize_48'))
+                    .height($r('app.float.virtualSize_48'))
+                    .fillColor($r('app.color.0A84FF'))
                 }
-                .margin({top:'6%'})
-                .width('35%')
-                .height('8%')
-                .backgroundColor($r('app.color.20FFFFFF'))
+                .width('16%')
+                .height('100%')
+                .justifyContent(FlexAlign.Center)
                 .borderRadius($r('app.float.virtualSize_16'))
-                .scale({ x: this.printButtonClick, y: this.printButtonClick })
-                .animation({
-                  duration: 200,
-                  curve: Curve.Linear
-                })
-                .onClick(() => {
-                  this.printButtonClick = 0.9;
-                  setTimeout(() => {
-                    this.printButtonClick = 1;
-                  }, 200);
+                .backgroundColor($r('app.color.20FFFFFF'))
+              }
+              .height('6%')
+              .width('75%')
+              .borderRadius($r('app.float.virtualSize_16'))
+              .backgroundColor($r('app.color.000000'))
+              .margin({top:'5%'})
+
+              List({scroller:this.scrollerForList}) {
+                ForEach(this.filteredMaterialBoxes, (item:string) => {
+                  ListItem() {
+                    Column() {
+                      Text(item)
+                        .fontSize($r('app.float.fontSize_30'))
+                        .fontColor($r('app.color.FFFFFF'))
+                        .width('90%')
+                        .textAlign(TextAlign.Start)
+                    }.width('100%')
+                    .alignItems(HorizontalAlign.Start)
+                    .justifyContent(FlexAlign.SpaceEvenly)
+                    .height('10%')
+                  }
                 })
-                Divider()
-                  .margin({top:'3%'})
-                  .vertical(false)
-                  .strokeWidth(1)
-                  .color($r('app.color.15FFFFFF'))
-                  .width('100%')
-                Text("写入磁卡")
-                  .fontColor($r('app.color.FFFFFF'))
-                  .fontSize($r('app.float.fontSize_38'))
-                  .margin({top:'3%'})
-                Image(this.isRfidOnline? $r('app.media.rfid_online'):$r('app.media.rfid_offline'))
-                  .width('100%')
-                  .height('40%')
-                  .margin({top:'1%'})
-                  .borderRadius($r('app.float.virtualSize_16'))
-                  .objectFit(ImageFit.Contain)
               }
-              .height('75%')
-              .width('100%')
-              .justifyContent(FlexAlign.Start)
-              Row(){
-                Text("当前编号:")
-                  .fontColor($r('app.color.FFFFFF'))
-                  .fontSize($r('app.float.fontSize_24'))
-                  .margin({top:'3%'})
-                Text("LX-00010")
-                  .fontColor($r('app.color.0A84FF'))
-                  .fontSize($r('app.float.fontSize_24'))
-                  .margin({top:'3%'})
-              }.height('5%')
-              .margin({top:'2%'})
+              .width('80%')
+              .height('70%')
+              .divider({
+                strokeWidth: 1,
+                color: $r('app.color.20FFFFFF')
+              })
+
               Button({type:ButtonType.Normal}) {
                 Row() {
-                  Image($r('app.media.material_qr_code'))
+                  Image($r('app.media.wms_confirm_add'))
                     .width('15%')
                     .height('45%')
                     .margin({ right: 8 })
                     .fillColor($r('app.color.0A84FF'))
-                  Text("写入磁卡")
+                  Text("确认添加")
                     .fontSize($r('app.float.fontSize_30'))
                     .fontColor($r('app.color.0A84FF'))
                 }
                 .justifyContent(FlexAlign.Center)
               }
-              .margin({top:'3%'})
+              .margin({top:'7%'})
               .width('35%')
               .height('6%')
-              .backgroundColor($r('app.color.20FFFFFF'))
+              .enabled(this.isAllowedAdd)
+              .backgroundColor(
+                this.isAllowedAdd
+                  ? $r('app.color.20FFFFFF')
+                  : $r('app.color.10FFFFFF')
+              )
               .borderRadius($r('app.float.virtualSize_16'))
               .scale({ x: this.writeButtonClick, y: this.writeButtonClick })
               .animation({
@@ -221,6 +359,13 @@ struct emptyBoxStorage {
                 this.writeButtonClick = 0.9;
                 setTimeout(() => {
                   this.writeButtonClick = 1;
+                  this.showConfirmDialog({
+                    title: '确认添加',
+                    message: `确定要添加新料箱${this.materialBoxRfid}吗?`,
+                    onConfirm: ()=> {
+                      this.onConfirmAdd()
+                    }
+                  });
                 }, 200);
               })
             }

+ 26 - 20
entry/src/main/ets/pages/IntelligentWarehousingStatics.ets

@@ -26,19 +26,18 @@ struct IntelligentWarehousingStatics {
   @State currentStock:MaterialInfo[] = []
   @State frequency: FrequencyClass = {}
   @State frequencyData: number[] = []
+  @State isFrequencyLoaded: boolean = false; // 新增状态标记
 
 
 
   loadMaterialBoxes = async ()=>{
     let res: MaterialBoxInfo[] = await WmsRequest.post("/api/v1/stock/groupList", {
-      materialName: "空盒",
+      materialNo: "-",
     } as RequestParamModel);
     this.emptyBoxesNum = res.length;
-    console.info( "qqqqq"+JSON.stringify(res))
     res = await WmsRequest.post("/api/v1/stock/groupList", {
     } as RequestParamModel);
     this.currentBoxesNum = res.length;
-    console.info( "qqqqq"+JSON.stringify(res))
   }
 
   loadStockList= async ()=>{
@@ -52,6 +51,7 @@ struct IntelligentWarehousingStatics {
   loadBoundFrequency= async ()=> {
     try {
       // 1. 获取数据
+      this.isFrequencyLoaded = false;
       this.frequency = await WmsRequest.get('/api/v1/wmsOrder/inOutTimes/1') as FrequencyClass;
       console.info('Monthly Data'+JSON.stringify(this.frequency))
 
@@ -68,8 +68,10 @@ struct IntelligentWarehousingStatics {
           }
         });
         this.frequencyData = monthlyData; // 例如: [0, 0, 0, 0, 102, 0, 0, 0, 0, 0, 0, 0]
+        this.isFrequencyLoaded = true;
       }
     } catch (error) {
+      this.isFrequencyLoaded = true;
       console.error('Failed to load frequency data:', error);
     }
   }
@@ -80,10 +82,10 @@ struct IntelligentWarehousingStatics {
     } as RequestParamModel) as WorkOrderInfo[]
   }
    async aboutToAppear() {
+     this.loadBoundFrequency();
      this.loadMaterialBoxes();
      this.loadWorkOrders();
      this.loadStockList();
-     this.loadBoundFrequency();
    }
 
 
@@ -192,12 +194,13 @@ struct IntelligentWarehousingStatics {
                   }
                 .height('15%')
                 .justifyContent(FlexAlign.Center)
-
-                LineChart({
-                  frequencyData:this.frequencyData
-                })
-                  .width('80%')
-                  .height('80%')
+                if(this.isFrequencyLoaded){
+                  LineChart({
+                    frequencyData:this.frequencyData
+                  })
+                    .width('80%')
+                    .height('80%')
+                }
 
               }
               .height('45%')
@@ -232,28 +235,31 @@ struct IntelligentWarehousingStatics {
             }.height('10%').justifyContent(FlexAlign.Center)
 
             Row() {
-              // 左侧二维码图标
-              Image($r('app.media.material_qr_code'))
-                .width($r('app.float.virtualSize_32'))
-                .height($r('app.float.virtualSize_32'))
-                .fillColor($r('app.color.FFFFFF'))
-                .margin({ left: '2%' })
-              // 扫码输入框
-              TextInput({ text:this.inputMaterialName,placeholder: '请扫描物料编码' })
+              TextInput({ text:this.inputMaterialName,placeholder: '录入物料名称' })
                 .type(InputType.Normal)
                 .placeholderFont({ size: $r('app.float.fontSize_30') })
                 .placeholderColor($r('app.color.30FFFFFF'))
                 .fontSize($r('app.float.fontSize_30'))
                 .fontColor($r('app.color.FFFFFF'))
                 .enableKeyboardOnFocus(false)
+                .width('84%')
                 .onSubmit(() => {
                   this.loadStockList()
                 })
                 .onChange((value: string) => {
                   this.inputMaterialName = value
                 })
-
-
+              Row() {
+                Image($r('app.media.wms_search'))
+                  .width($r('app.float.virtualSize_48'))
+                  .height($r('app.float.virtualSize_48'))
+                  .fillColor($r('app.color.0A84FF'))
+              }
+              .width('16%')
+              .height('100%')
+              .justifyContent(FlexAlign.Center)
+              .borderRadius($r('app.float.virtualSize_16'))
+              .backgroundColor($r('app.color.20FFFFFF'))
             }
             .height('8%')
             .width('80%')

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

@@ -395,7 +395,7 @@ struct LittleMaterialsStorage{
                 //查询小车的状态
                 const rgvStatusNormal = await this.queryRgvInfo()
                 if(!rgvStatusNormal){
-                  this.reminds = "小车状态异常或位置错误,请检查后重试"
+                  this.reminds = "小车状态错误"
                   this.remindController.open()
                   setTimeout(() => {
                     this.remindController.close()

+ 3 - 1
entry/src/main/ets/view/wms/OrderMaterialStorageFirstStep.ets

@@ -53,7 +53,9 @@ export struct OrderMaterialStorageFirstStep {
               .fontSize($r('app.float.fontSize_38'))
           }.height('10%')
           Row() {
-            MaterialList({ MaterialData: this.materialData })
+            MaterialList({
+              MaterialData: this.materialData
+            })
               .width('100%')
               .height('100%')
           }.width('95%').height('90%')

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

@@ -68,7 +68,7 @@ export struct OrderMaterialStorageSecondStep {
   //暂时取空箱
   getEmptyBox = async () => {
     let res: MaterialBoxInfo[] = await WmsRequest.post("/api/v1/stock/groupList", {
-      materialName: "空盒",
+      materialNo: "-",
     } as RequestParamModel);
     this.emptyBoxes = res;
     console.info( "qqqqq"+JSON.stringify(res))
@@ -324,7 +324,7 @@ export struct OrderMaterialStorageSecondStep {
           //查询小车的状态
           const rgvStatusNormal = await this.queryRgvInfo()
           if(!rgvStatusNormal){
-            this.reminds = "小车状态异常或位置错误,请检查后重试"
+            this.reminds = "小车状态错误"
             this.remindController.open()
             setTimeout(() => {
               this.remindController.close()

+ 16 - 6
entry/src/main/ets/view/wms/OrderMaterialStorageThirdStep.ets

@@ -37,7 +37,8 @@ export struct OrderMaterialStorageThirdStep {
     try{
       this.scanCodeValue = ""
       let res: MaterialInfo = await WmsRequest.post("/api/v1/process/circulation/material", {
-        label: `BM${itemCode};18*18*1-6;SL50;20240111` //"#gys022#sc022#100#20220929#31"
+        label: `BM${itemCode};18*18*1-6;SL6;20240111` //"#gys022#sc022#100#20220929#31"
+        //label: `BMWET-H3PO4;18*18*1-6;SL${itemCode};;20240111`
       } as RequestParamModel)
 
       // 验证1:检查是否已在扫描列表中
@@ -54,12 +55,20 @@ export struct OrderMaterialStorageThirdStep {
         return
       }
       // 验证2:检查是否在允许的物料数据中
-      const isValidMaterial = this.materialData.some(
-        item => item.itemCode === res.materialCode
-      );
-      if (!isValidMaterial) {
+      const material = this.materialData.find(item => item.itemCode === res.materialCode);
+      if (!material) {
         console.warn(`物料 ${res.materialCode} 不在工单物料清单中`);
-        this.reminds = "物料不在清单中!";
+        this.reminds = "物料不在计划清单中!";
+        this.remindController.open();
+        setTimeout(() => {
+          this.remindController.close();
+        }, 2000);
+        return;
+      }
+     //验证3:检查扫码录入物料数量是否超过工单计划数量
+      if ((material.num ?? 0) < (res.num ?? 0)+(material.storageNum ?? 0)){
+        console.warn(`物料 ${res.materialCode} 扫码数量大于计划数量`);
+        this.reminds = "物料扫码数量超过计划数量!";
         this.remindController.open();
         setTimeout(() => {
           this.remindController.close();
@@ -76,6 +85,7 @@ export struct OrderMaterialStorageThirdStep {
     }
   }
 
+
   build() {
     Column(){
       Row(){

+ 2 - 0
entry/src/main/ets/viewmodel/wms/MaterialBoxInfo.ets

@@ -43,4 +43,6 @@ export default class MaterialBoxInfo {
   num?: number;
   // 单位
   unit?: string;
+  //料箱载具编号
+  code?:string
 }

+ 12 - 0
entry/src/main/ets/viewmodel/wms/RequestParamModel.ets

@@ -43,4 +43,16 @@ export default class RequestParamModel {
   operationId?: number | string
   // 工序绑定载具物料参数
   processVehicleMaterialList?: MaterialInfo[]
+  //载具容量
+  capacity?:number
+  //载具类别
+  category?: string;
+  //载具编号
+  code?: string;
+  //载具名称
+  name?: string;
+  //资产编号
+  propertyCode?: string;
+  //载具通用性
+  universal?: number;
 }

+ 12 - 8
entry/src/main/resources/base/element/font_size.json

@@ -2,31 +2,35 @@
   "float": [
     {
       "name": "fontSize_70",
-      "value": "42fp"
+      "value": "50.4fp"
     },
     {
       "name": "fontSize_48",
-      "value": "28.8fp"
+      "value": "34.56fp"
     },
     {
       "name": "fontSize_38",
-      "value": "22.8fp"
+      "value": "27.36fp"
     },
     {
       "name": "fontSize_30",
-      "value": "18fp"
+      "value": "21.6fp"
     },
     {
       "name": "fontSize_24",
-      "value": "14.4fp"
+      "value": "17.28fp"
     },
     {
       "name": "fontSize_16",
-      "value": "9.6fp"
+      "value": "11.52fp"
+    },
+    {
+      "name": "fontSize_18",
+      "value": "12.96fp"
     },
     {
       "name": "fontSize_12",
-      "value": "7.2fp"
+      "value": "8.64fp"
     }
   ]
-}
+}