dengrui vor 3 Monaten
Ursprung
Commit
dfa75bec06
2 geänderte Dateien mit 68 neuen und 24 gelöschten Zeilen
  1. 24 2
      entry/src/main/ets/view/CompleteSet.ets
  2. 44 22
      entry/src/main/ets/view/ManualWarehousing.ets

+ 24 - 2
entry/src/main/ets/view/CompleteSet.ets

@@ -114,13 +114,36 @@ export struct CompleteSet {
   // 通过RFID请求读取料箱的信息
   rfidTimer: number = -1
   @State preRfid: string = "" //记录上一次的rfid,如果变化了 就清空回库下面的列表
+  @State imgSrc:Resource = $r('app.media.drawer_inside')
+  //设置img图片路径
+  setImgSrc = ()=>{
+    if(this.drawerPositionStatus == 1 && this.materialGridStatus == 0){
+      this.imgSrc = $r('app.media.drawer_inside')
+
+    }else if(this.drawerPositionStatus == 0 && this.materialGridStatus == 0){
+      this.imgSrc = $r('app.media.drawer_outside')
+
+    }
+    else if(this.drawerPositionStatus === 1 && this.materialGridStatus === 1){
+      this.imgSrc = $r('app.media.D_W_inside')
+
+    }
+    else if(this.drawerPositionStatus === 0 && this.materialGridStatus === 1) {
+      this.imgSrc = $r('app.media.D_W_outside')
+
+    }
+
+  }
   @State private recentlyRecordObject: StationInfoModel = {}
   rfidInfoIntervalFun = async () => {
     let res: StationInfoModel = await StorageRequest.post("api/v1/wms/common/queryStationInfo", {
       stanCode: CommonConstants.STATION_CODE
     } as RequestParamModel)
     this.recentlyRecordObject = res
+    console.log('dyyinfo',JSON.stringify(res))
+    this.drawerPositionStatus = res.lock==null? 1: Number(res.lock)
 
+    this.setImgSrc()
     // 清空回库下面的数组逻辑
     if (this.preRfid && this.preRfid != this.recentlyRecordObject.rfid) {
       this.boxMaterials = []
@@ -679,8 +702,7 @@ export struct CompleteSet {
 
       Column() {
         Stack() {
-          Image(this.drawerPositionStatus === 1 && this.materialGridStatus === 0 ? $r('app.media.drawer_inside') : (this.drawerPositionStatus === 2 && this.materialGridStatus === 0 ? $r('app.media.drawer_outside') :
-            (this.drawerPositionStatus === 1 && this.materialGridStatus === 1 ? $r('app.media.D_W_inside') : $r('app.media.D_W_outside'))))
+          Image(this.imgSrc)
             .width(px2vp(608))
             .height(px2vp(220))
             .borderRadius(px2vp(16))

+ 44 - 22
entry/src/main/ets/view/ManualWarehousing.ets

@@ -53,6 +53,7 @@ export struct ManualWarehousing {
   @State index: number = 0
   @State batchCode: string = ''
   @State materialName: string = ''
+  @State imgSrc:Resource = $r('app.media.drawer_inside')
   //齐套料箱状态不可以点击:0,可以点击:1
   @State completeSetMaterialState: number = 0
   @State num: number = 0
@@ -68,6 +69,25 @@ export struct ManualWarehousing {
   @State BoxWeight: number = 20
   @State private recentlyRecordObject: StationInfoModel = {}
   currentTimer: number = -1;
+  //设置img图片路径
+  setImgSrc = ()=>{
+    if(this.drawerPositionStatus == 1 && this.materialGridStatus == 0){
+      this.imgSrc = $r('app.media.drawer_inside')
+
+    }else if(this.drawerPositionStatus == 0 && this.materialGridStatus == 0){
+      this.imgSrc = $r('app.media.drawer_outside')
+
+    }
+    else if(this.drawerPositionStatus === 1 && this.materialGridStatus === 1){
+      this.imgSrc = $r('app.media.D_W_inside')
+
+    }
+    else if(this.drawerPositionStatus === 0 && this.materialGridStatus === 1) {
+      this.imgSrc = $r('app.media.D_W_outside')
+
+    }
+
+  }
   //扫码请求
   ScanStorageCode = async (itemCode: string) => {
 
@@ -123,19 +143,22 @@ export struct ManualWarehousing {
     gridCount: 4,
     customStyle: true,
   })
+  //获取RFID信息
   locationRequest = async (): Promise<StationInfoModel> => {
     let res: StationInfoModel = await StorageRequest.post("api/v1/wms/common/queryStationInfo", {
       stanCode: CommonConstants.STATION_CODE
     } as RequestParamModel)
     this.recentlyRecordObject = res
-
     this.materialGridStatus = 0
     if (this.recentlyRecordObject && this.recentlyRecordObject.rfid) {
       this.materialGridStatus = 1
       this.BoxWeight = Number(this.recentlyRecordObject.weight)
       this.recentlyRecordObject.weight = this.recentlyRecordObject.weight + 'Kg'
-
     }
+
+    this.drawerPositionStatus = res.lock==null? 1: Number(res.lock)
+
+    this.setImgSrc()
     // 有数据 {"code":200,"message":"ok","data":{"RFID":"2024080613602207","UID":"992fa202530104e0","errCode":"0","ts":"1722568500"}}
     // 无数据 {"code":200,"message":"ok","data":{"RFID":"","UID":"0000000000000000","errCode":"0","ts":"1722568502"}}
     return this.recentlyRecordObject
@@ -253,26 +276,26 @@ export struct ManualWarehousing {
 
               // RFID的信息
               Column() {
-                Text('料箱重量')
-                  .textAlign(TextAlign.End)
-                  .width('48%')
-                  .height('20%')
-                  .fontWeight(FontWeight.Regular)
-                  .fontSize($r('app.float.fontSize_20'))
-                  .fontColor($r('app.color.process_nameplate_grey_color'))
-                  .focusable(true)
-                  .defaultFocus(true)
+                // Text('料箱重量')
+                //   .textAlign(TextAlign.End)
+                //   .width('48%')
+                //   .height('20%')
+                //   .fontWeight(FontWeight.Regular)
+                //   .fontSize($r('app.float.fontSize_20'))
+                //   .fontColor($r('app.color.process_nameplate_grey_color'))
+                //   .focusable(true)
+                //   .defaultFocus(true)
                 // Text(this.BoxWeight.toString() + 'Kg')
 
-                Text(this.recentlyRecordObject.weight)
-                  .textAlign(TextAlign.End)
-                  .width('48%')
-                  .height('25%')
-                  .fontWeight(FontWeight.Regular)
-                  .fontSize($r('app.float.fontSize_24'))
-                  .fontColor(this.BoxWeight <= 15 ? $r('app.color.black_90') : $r('app.color.brown_100'))
-
-                Blank()
+                // Text(this.recentlyRecordObject.weight)
+                //   .textAlign(TextAlign.End)
+                //   .width('48%')
+                //   .height('25%')
+                //   .fontWeight(FontWeight.Regular)
+                //   .fontSize($r('app.float.fontSize_24'))
+                //   .fontColor(this.BoxWeight <= 15 ? $r('app.color.black_90') : $r('app.color.brown_100'))
+                //
+                // Blank()
                 Text('料箱ID')
                   .textAlign(TextAlign.End)
                   .width('48%')
@@ -636,8 +659,7 @@ export struct ManualWarehousing {
 
       Column() {
         Stack() {
-          Image(this.drawerPositionStatus === 1 && this.materialGridStatus === 0 ? $r('app.media.drawer_inside') : (this.drawerPositionStatus === 2 && this.materialGridStatus === 0 ? $r('app.media.drawer_outside') :
-            (this.drawerPositionStatus === 1 && this.materialGridStatus === 1 ? $r('app.media.D_W_inside') : $r('app.media.D_W_outside'))))
+          Image(this.imgSrc)
             .width(px2vp(608))
             .height('100%')
             .borderRadius($r('app.float.borderRadius_16'))