瀏覽代碼

消息多次弹框导致崩溃修改。

jiaxiaoqiang 9 月之前
父節點
當前提交
8d2da58e78

+ 3 - 0
README.md

@@ -0,0 +1,3 @@
+EquipmentRequest的baseurl是登录后返回的IP决定的。
+Request.ts里面有 baseUrl
+StorageRequest.ts 里面有baseUrl。

+ 32 - 19
entry/src/main/ets/common/component/TitleStateComp.ets

@@ -15,6 +15,7 @@ import Want from '@ohos.app.ability.Want'
 import socketService, { MessageInfoModel } from '../util/SocketService'
 import JGRequest from '../util/request/Request'
 import RequestParamModel from '../../viewmodel/RequestParamModel'
+import promptAction from '@ohos.promptAction'
 
 /*
  * 顶部状态栏
@@ -63,22 +64,25 @@ export struct TitleStateComp {
     let res: MessageInfoModel = await JGRequest.post("/api/v1/sys/message/userMessage", {
       pageNo: 1,
       pageSize: 30,
+      readState: 0,
     } as RequestParamModel)
     this.messageInfoList = res.records ?? []
-    console.log("WebSocketDemo list", JSON.stringify(this.messageInfoList))
-    this.noticeDialogController.open()
+    // console.log("WebSocketDemo list", JSON.stringify(this.messageInfoList))
+    if (!this.isMessageDCOpened && this.messageInfoList.length) {
+      this.openMessageDC()
+    }
   }
 
   aboutToAppear(): void {
     ////生产操作
-    task().then((res: taskclass) => {
-      console.log("on page show11", res.bugNum, res.completeNum, res.kittingNum, res.planNum
-      )
-      this.bugNum = res.bugNum
-      this.completeNum = res.completeNum
-      this.kittingNum = res.kittingNum
-      this.planNum = res.planNum
-    })
+    // task().then((res: taskclass) => {
+    //   console.log("on page show11", res.bugNum, res.completeNum, res.kittingNum, res.planNum
+    //   )
+    //   this.bugNum = res.bugNum
+    //   this.completeNum = res.completeNum
+    //   this.kittingNum = res.kittingNum
+    //   this.planNum = res.planNum
+    // })
 
     this.creatWebsocket()
   }
@@ -99,9 +103,19 @@ export struct TitleStateComp {
     alignment: DialogAlignment.Center,
     customStyle: true,
     cancel: () => {
+      this.isMessageDCOpened = false
       this.isClick = !this.isClick
     }
   })
+  @State isMessageDCOpened: boolean = false
+  openMessageDC = () => {
+    this.noticeDialogController.open()
+    this.isMessageDCOpened = true
+  }
+  closeMessageDC = () => {
+    this.noticeDialogController.close()
+    this.isMessageDCOpened = false
+  }
 
   build() {
     Stack() {
@@ -129,14 +143,14 @@ export struct TitleStateComp {
         .padding({ left: px2vp(24) })
 
         Column() {
-          Text(TimeUtil.getCurrentDate())
-            .fontColor($r('app.color.general_font_color'))
-            .fontSize($r('app.float.fontSize_14'))
-            .fontWeight(FontWeight.Regular)
-          TextClock({ timeZoneOffset: -8, controller: this.controller })
-            .format('HH:mm:ss')
-            .fontSize($r('app.float.fontSize_20'))
-            .fontWeight(FontWeight.Bold)
+          // Text(TimeUtil.getCurrentDate())
+          //   .fontColor($r('app.color.general_font_color'))
+          //   .fontSize($r('app.float.fontSize_14'))
+          //   .fontWeight(FontWeight.Regular)
+          // TextClock({ timeZoneOffset: -8, controller: this.controller })
+          //   .format('HH:mm:ss')
+          //   .fontSize($r('app.float.fontSize_20'))
+          //   .fontWeight(FontWeight.Bold)
         }
         .height('100%')
         .width('6%')
@@ -171,7 +185,6 @@ export struct TitleStateComp {
             //  // url:"pages/OutboundStation"
             // })
             this.getMessageList()
-
           })
 
           Row() {

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

@@ -12,7 +12,6 @@ import { printError, printRequest, printResponse, handleRes } from './Helps';
 
 // const baseUrl = "http://10.88.20.188:8079/"
 const baseUrl = "http://10.88.11.200:8079/"
-const DEBUG = true //
 
 // 创建实例
 const JGRequest = axios.create(

+ 6 - 22
entry/src/main/ets/pages/LoginPage.ets

@@ -117,7 +117,7 @@ struct LoginPage {
         CommonConstants.STATION_IP = user.stationIp!
       }
       if (CommonConstants.AUTH_TOKEN && CommonConstants.AUTH_TOKEN.length > 0) {
-        if (CommonConstants.stationDictValue === '6') {
+        if (CommonConstants.stationDictValue === '5') {
           router.pushUrl({
             url: 'pages/Warehousing',
             params: {
@@ -126,7 +126,7 @@ struct LoginPage {
               stationId: CommonConstants.STATION_NANE as WorkstationInfo
             }
           })
-        } else if (CommonConstants.stationDictValue === '5') {
+        } else if (CommonConstants.stationDictValue === '6') {
           router.pushUrl({
             url: 'pages/OutboundStation',
             params: {
@@ -135,11 +135,8 @@ struct LoginPage {
               stationId: CommonConstants.STATION_NANE as WorkstationInfo
             }
           })
-        } else {
-          router.pushUrl({
-            url: 'pages/process/ProcessHome',
-          })
         }
+
       }
     }
   }
@@ -368,16 +365,6 @@ struct LoginPage {
         .alignItems(HorizontalAlign.Center)
         .justifyContent(FlexAlign.Start)
         .onClick(async () => {
-          //todo
-          // 没有网的时候直接进去
-          //  router.pushUrl({
-          //    url:'pages/OutboundStation',
-          //    params: {
-          //      userName:CommonConstants.USER_NAME as UserInfo,
-          //      avatar:CommonConstants.USER_AVATAR as UserInfo,
-          //      stationId:CommonConstants.STATION_NANE as WorkstationInfo
-          //    }
-          //  })
 
           console.log("tesTag1" + '+++++++++++++++' + this.workstation.stationDictValue)
           if (this.loginName && this.loginName.length > 0 && this.password && this.password.length > 0) {
@@ -427,7 +414,7 @@ struct LoginPage {
             }
             CommonConstants.LOGIN_OUT = false
 
-            if (this.workstation.stationDictValue === '6') {
+            if (this.workstation.stationDictValue === '5') {
               router.pushUrl({
                 url: 'pages/OutboundStation',
                 params: {
@@ -436,7 +423,7 @@ struct LoginPage {
                   stationId: CommonConstants.STATION_NANE as WorkstationInfo
                 }
               })
-            } else if (this.workstation.stationDictValue === '5') {
+            } else if (this.workstation.stationDictValue === '6') {
               router.pushUrl({
                 url: 'pages/Warehousing',
                 params: {
@@ -445,11 +432,8 @@ struct LoginPage {
                   stationId: CommonConstants.STATION_NANE as WorkstationInfo
                 }
               })
-            } else {
-              router.pushUrl({
-                url: 'pages/process/ProcessHome',
-              })
             }
+
           }
         })
       }

+ 3 - 3
entry/src/main/ets/pages/RfidAllocation.ets

@@ -117,8 +117,8 @@ export struct RfidAllocation {
 
   build() {
     Column() {
-      Stack({ alignContent: Alignment.Start }) {
-        TitleStateComp({ isHomePage: this.isHomePage, })
+      Stack({ alignContent: Alignment.TopStart }) {
+        // TitleStateComp({ isHomePage: this.isHomePage, })
         Row() {
           Image($r('app.media.return'))
             .width(px2vp(56))
@@ -132,7 +132,7 @@ export struct RfidAllocation {
         .height('8%')
         .padding({ left: px2vp(24) })
         .backgroundColor($r('app.color.title_bar_background'))
-      }
+      }.width('100%')
 
       Row() {
         Column() {

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

@@ -267,7 +267,8 @@ export struct CompleteSet {
       houseNo: '1',
       stanCode: CommonConstants.STATION_CODE,
       vehicleCode: this.recentlyRecordObject.rfid,
-      detailsList: this.boxMaterials
+      detailsList: this.boxMaterials,
+      wcsType: "kitting",
     } as RequestParamModel)
 
     promptAction.showToast({

+ 126 - 94
entry/src/main/ets/view/IntelligentWarehousingGo.ets

@@ -5,6 +5,9 @@ import { MaterialInformationModel } from '../model/MaterialInformation';
 import RequestParamModel from '../viewmodel/RequestParamModel';
 import EquipmentRequest from '../common/util/request/EquipmentRequest';
 import { boxMaterialClass } from './CompleteSet';
+import { StationInfoModel } from '../model/StorageSpace';
+import CommonConstants from '../common/constants/CommonConstants';
+import JGRequest from '../common/util/request/Request';
 
 export interface exchangeClass {
   exchangeNumber?: number
@@ -112,6 +115,50 @@ export struct IntelligentWarehousingGo {
     console.log('testTag', '扫码成功1!' + obj.batchCode)
     return obj
   }
+  // 通过RFID请求读取料箱的信息
+  rfidTimer: number = -1
+  @State preRfid: string = "" //记录上一次的rfid,如果变化了 就清空列表
+  @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
+
+    if (this.preRfid && this.preRfid != this.recentlyRecordObject.rfid) {
+      this.MaterialInformation = []
+    }
+    this.preRfid = this.recentlyRecordObject.rfid ?? ""
+
+    if (this.recentlyRecordObject && this.recentlyRecordObject.rfid) {
+      this.weight = Number(res.weight)
+      this.recentlyRecordObject.weight = this.recentlyRecordObject.weight + 'Kg'
+      this.MaterialInformation = await JGRequest.get(`/api/v1/plan/requisition/queryVehicleInfo/${this.recentlyRecordObject.rfid}`)
+
+    }
+  }
+  @State statusByAuto: number = 0 //0关闭 1开启
+  getAutoStatus = async () => {
+    this.statusByAuto = await JGRequest.get("/api/v1/wms/common/autoInBoxInfo")
+    console.log("ddddddddddddddddddd", this.statusByAuto)
+  }
+  setStatusByNumber = async (s: number) => {
+    await JGRequest.get(`/api/v1/wms/common/autoInBox/${s}`)
+    this.getAutoStatus()
+  }
+
+  async aboutToAppear() {
+    this.rfidTimer = setInterval(() => {
+      this.rfidInfoIntervalFun()
+    }, 2000)
+
+    this.getAutoStatus()
+
+  }
+
+  aboutToDisappear(): void {
+    clearInterval(this.rfidTimer)
+  }
 
   build() {
     Row() {
@@ -159,7 +206,7 @@ export struct IntelligentWarehousingGo {
                 .fontWeight(FontWeight.Regular)
                 .fontSize($r('app.float.fontSize_20'))
                 .fontColor($r('app.color.black_60'))
-              Text(this.materialBox === 1 || this.materialBox === 2 ? this.materialBoxId : '-')
+              Text(this.recentlyRecordObject.rfid)
                 .height('50%')
                 .fontWeight(FontWeight.Regular)
                 .fontSize($r('app.float.fontSize_20'))
@@ -176,16 +223,16 @@ export struct IntelligentWarehousingGo {
           .padding({ left: px2vp(30) })
 
           Column() {
-            Text('入库任务单')
-              .height('50%')
-              .fontWeight(FontWeight.Regular)
-              .fontSize($r('app.float.fontSize_20'))
-              .fontColor($r('app.color.black_60'))
-            Text(this.materialBox === 1 || this.materialBox === 2 ? this.taskSheetId : '-')
-              .height('50%')
-              .fontWeight(FontWeight.Regular)
-              .fontSize($r('app.float.fontSize_20'))
-              .fontColor($r('app.color.black_100'))
+            // Text('入库任务单')
+            //   .height('50%')
+            //   .fontWeight(FontWeight.Regular)
+            //   .fontSize($r('app.float.fontSize_20'))
+            //   .fontColor($r('app.color.black_60'))
+            // Text(this.materialBox === 1 || this.materialBox === 2 ? this.taskSheetId : '-')
+            //   .height('50%')
+            //   .fontWeight(FontWeight.Regular)
+            //   .fontSize($r('app.float.fontSize_20'))
+            //   .fontColor($r('app.color.black_100'))
           }
           .width('100%')
           .height('30%')
@@ -199,14 +246,11 @@ export struct IntelligentWarehousingGo {
               .fontSize($r('app.float.fontSize_20'))
               .fontColor($r('app.color.black_60'))
             Blank()
-            Text(this.materialBox === 1 || this.materialBox === 2 ? this.weight.toString() : '-')
+            Text(this.recentlyRecordObject.weight)
               .fontSize(px2vp(48))
               .fontWeight(FontWeight.Bold)
               .fontColor(this.weight >= 15 ? $r('app.color.brown_100') : $r('app.color.green_100'))
-            Text('Kg')
-              .fontWeight(FontWeight.Regular)
-              .fontSize($r('app.float.fontSize_20'))
-              .fontColor($r('app.color.black_60'))
+
           }
           .padding({ right: px2vp(50), left: px2vp(30) })
           .width('100%')
@@ -232,38 +276,26 @@ export struct IntelligentWarehousingGo {
         .justifyContent(FlexAlign.Center)
 
         Row() {
-          if (this.weight !== 0 && this.weight <= 15) {
-            Button('停止自动入库', { type: ButtonType.Normal, stateEffect: true })
+          if (this.statusByAuto === 1) {
+            Button('停止', { type: ButtonType.Normal, stateEffect: true })
               .width('100%')
               .height('90%')
               .borderRadius(px2vp(50))
               .backgroundColor($r('app.color.brown_100'))
               .onClick(() => {
-                this.automaticWarehousing = 1
+                this.setStatusByNumber(0)
 
               })
-          } else if (this.weight == 0 || this.weight > 15 || this.contraband === 1) {
-            Button('启动自动入库', { type: ButtonType.Normal, stateEffect: true })
+          } else {
+            Button('启动', { type: ButtonType.Normal, stateEffect: true })
               .width('100%')
               .height('90%')
               .borderRadius(px2vp(50))
-              .opacity(0.2)
               .backgroundColor($r('app.color.blue_100'))
               .onClick(() => {
-                this.automaticWarehousing = 0
-
+                this.setStatusByNumber(1)
               })
           }
-          // else if (this.weight!==0&&this.weight<=15){
-          //   Button('启动自动入库', { type: ButtonType.Normal, stateEffect: true })
-          //     .width('100%')
-          //     .height('90%')
-          //     .borderRadius(px2vp(50))
-          //     .backgroundColor($r('app.color.blue_100'))
-          //
-          // }
-
-
         }
         .width('100%')
         .height('10%')
@@ -273,58 +305,58 @@ export struct IntelligentWarehousingGo {
       .margin({ right: px2vp(24) })
 
       Column() {
-        Row() {
-          Image($r('app.media.shaoma'))
-            .width(px2vp(32))
-            .height(px2vp(32))
-          Row() {
-            TextInput({ text: this.materialNo,
-              placeholder: '请点击扫码或者输入物料编码',
-              controller: this.textcontroller })
-              .width('92%')
-              .placeholderFont({ size: $r('app.float.fontSize_24') })
-              .height('100%')
-              .fontWeight(FontWeight.Medium)
-              .fontSize($r('app.float.fontSize_24'))
-              .backgroundColor("#ffff")
-              .borderRadius(21)
-              .onSubmit(() => {
-                //执行什么操作
-                if (this.automaticWarehousing === 1) {
-                  this.materialBox = 1
-                  console.log('testAge' + '请求参数' + this.materialNo)
-                  this.ScanStorageCode(this.materialNo).then((obj: MaterialInformationModel) => {
-                    this.MaterialInformation.push(obj)
-                  })
-                }
-
-              })
-              .onChange((value: string) => {
-                //  this.itemCode=value
-              })
-          }.width('80%')
-          .padding({ left: 10 })
-
-          Image($r('app.media.search'))
-            .width(px2vp(32))
-            .height(px2vp(32))
-            .onClick(async () => {
-              if (this.automaticWarehousing === 1) {
-                this.materialBox = 1
-                console.log('testAge' + '请求参数' + this.materialNo)
-                this.ScanStorageCode(this.materialNo).then((obj: MaterialInformationModel) => {
-                  this.MaterialInformation.push(obj)
-                })
-              }
-
-            })
-        }
-        .border({ width: 0.1 })
-        .borderRadius(40)
-        .width(px2vp(608))
-        .height(px2vp(80))
-        .backgroundColor('#fff')
-        .justifyContent(FlexAlign.Center)
+        // Row() {
+        //   Image($r('app.media.shaoma'))
+        //     .width(px2vp(32))
+        //     .height(px2vp(32))
+        //   Row() {
+        //     TextInput({ text: this.materialNo,
+        //       placeholder: '请点击扫码或者输入物料编码',
+        //       controller: this.textcontroller })
+        //       .width('92%')
+        //       .placeholderFont({ size: $r('app.float.fontSize_24') })
+        //       .height('100%')
+        //       .fontWeight(FontWeight.Medium)
+        //       .fontSize($r('app.float.fontSize_24'))
+        //       .backgroundColor("#ffff")
+        //       .borderRadius(21)
+        //       .onSubmit(() => {
+        //         //执行什么操作
+        //         if (this.automaticWarehousing === 1) {
+        //           this.materialBox = 1
+        //           console.log('testAge' + '请求参数' + this.materialNo)
+        //           this.ScanStorageCode(this.materialNo).then((obj: MaterialInformationModel) => {
+        //             this.MaterialInformation.push(obj)
+        //           })
+        //         }
+        //
+        //       })
+        //       .onChange((value: string) => {
+        //         //  this.itemCode=value
+        //       })
+        //   }.width('80%')
+        //   .padding({ left: 10 })
+        //
+        //   Image($r('app.media.search'))
+        //     .width(px2vp(32))
+        //     .height(px2vp(32))
+        //     .onClick(async () => {
+        //       if (this.automaticWarehousing === 1) {
+        //         this.materialBox = 1
+        //         console.log('testAge' + '请求参数' + this.materialNo)
+        //         this.ScanStorageCode(this.materialNo).then((obj: MaterialInformationModel) => {
+        //           this.MaterialInformation.push(obj)
+        //         })
+        //       }
+        //
+        //     })
+        // }
+        // .border({ width: 0.1 })
+        // .borderRadius(40)
+        // .width(px2vp(608))
+        // .height(px2vp(80))
+        // .backgroundColor('#fff')
+        // .justifyContent(FlexAlign.Center)
 
         Column() {
           List() {
@@ -400,13 +432,13 @@ export struct IntelligentWarehousingGo {
                 .backgroundColor('#fff')
                 .onClick(() => {
                   //  this.exchangeIndex=exchangeIndex!
-                  this.index = index
-                  this.batchCode = item.batchCode!
-                  this.materialName = item.materialName!
-                  this.materialNo = item.materialNo!
-                  this.num = item.num!
-                  this.seqNo = item.seqNo!
-                  this.spec = item.spec!
+                  // this.index = index
+                  // this.batchCode = item.batchCode!
+                  // this.materialName = item.materialName!
+                  // this.materialNo = item.materialNo!
+                  // this.num = item.num!
+                  // this.seqNo = item.seqNo!
+                  // this.spec = item.spec!
                   //if (item.exchangeNumber===null){
                   // this.MaterialInformation[index].exchangeNumber=0
 
@@ -437,7 +469,7 @@ export struct IntelligentWarehousingGo {
                   //    seqNo: item.seqNo!,
                   //    spec: item.spec!,
                   //  }
-                  this.materialDetailsController.open()
+                  // this.materialDetailsController.open()
                 })
               }
               .swipeAction({ end: this.itemEnd(index) })

+ 63 - 63
entry/src/main/ets/view/Statistics.ets

@@ -617,74 +617,74 @@ export struct Statistics {
 
             }
             .width(px2vp(608))
-            .height(px2vp(420))
+            .height('100%')
             .padding(px2vp(10))
             .backgroundColor('#ffff')
             .borderRadius(px2vp(16))
             .margin({ bottom: px2vp(24) })
 
-            Column() {
-              Row() {
-                Text('退料单')
-                  .fontSize($r('app.float.fontSize_24'))
-                  .fontWeight(FontWeight.Medium)
-                  .fontColor('#e6000000')
-              }.width('100%')
-              .height('15%')
-              .padding({ left: px2vp(30) })
-
-              Grid(this.scroller) {
-                ForEach(this.detailsList, (item: records, index) => {
-                  GridItem() {
-                    Column() {
-                      Row() {
-                        Text(item.materialName)
-                          .fontSize('19px')
-                          .width('70%')
-                        Blank()
-                        Text(item.num?.toString() + '/' + item.allNum?.toString())
-                          .width('20%')
-                          .fontSize('19px')
-                      }.width('100%')
-                      .height('50%')
-
-                      Blank()
-                      Progress({ value: 10, type: ProgressType.Linear }).width('100%')
-                        .height('50%')
-                        .style({ strokeWidth: 20 })
-
-                    }
-                    .width('100%')
-                    .height('20%')
-                    .backgroundColor(index % 2 === 0 ? "#ffff" : "#F5F5F5")
-
-                  }
-                })
-              }
-              .columnsTemplate('1fr')
-              .columnsGap(10)
-              .rowsGap(10)
-              .onScrollIndex((first: number) => {
-                console.info(first.toString())
-              })
-              .width('90%')
-              .height('80%')
-
-              Row() {
-                Image($r('app.media.jiaobiao'))
-                  .width('27px')
-                  .height('27px')
-
-              }.width('100%')
-              .height('5%')
-              .justifyContent(FlexAlign.End)
-
-            }
-            .width(px2vp(608))
-            .height(px2vp(420))
-            .padding(px2vp(10))
-            .borderRadius(px2vp(16))
-            .backgroundColor('#ffff')
+            // Column() {
+            //   Row() {
+            //     Text('退料单')
+            //       .fontSize($r('app.float.fontSize_24'))
+            //       .fontWeight(FontWeight.Medium)
+            //       .fontColor('#e6000000')
+            //   }.width('100%')
+            //   .height('15%')
+            //   .padding({ left: px2vp(30) })
+            //
+            //   Grid(this.scroller) {
+            //     ForEach(this.detailsList, (item: records, index) => {
+            //       GridItem() {
+            //         Column() {
+            //           Row() {
+            //             Text(item.materialName)
+            //               .fontSize('19px')
+            //               .width('70%')
+            //             Blank()
+            //             Text(item.num?.toString() + '/' + item.allNum?.toString())
+            //               .width('20%')
+            //               .fontSize('19px')
+            //           }.width('100%')
+            //           .height('50%')
+            //
+            //           Blank()
+            //           Progress({ value: 10, type: ProgressType.Linear }).width('100%')
+            //             .height('50%')
+            //             .style({ strokeWidth: 20 })
+            //
+            //         }
+            //         .width('100%')
+            //         .height('20%')
+            //         .backgroundColor(index % 2 === 0 ? "#ffff" : "#F5F5F5")
+            //
+            //       }
+            //     })
+            //   }
+            //   .columnsTemplate('1fr')
+            //   .columnsGap(10)
+            //   .rowsGap(10)
+            //   .onScrollIndex((first: number) => {
+            //     console.info(first.toString())
+            //   })
+            //   .width('90%')
+            //   .height('80%')
+            //
+            //   Row() {
+            //     Image($r('app.media.jiaobiao'))
+            //       .width('27px')
+            //       .height('27px')
+            //
+            //   }.width('100%')
+            //   .height('5%')
+            //   .justifyContent(FlexAlign.End)
+            //
+            // }
+            // .width(px2vp(608))
+            // .height(px2vp(420))
+            // .padding(px2vp(10))
+            // .borderRadius(px2vp(16))
+            // .backgroundColor('#ffff')
 
           }.width(px2vp(608))
           .height('100%')

+ 2 - 0
entry/src/main/ets/viewmodel/RequestParamModel.ets

@@ -61,4 +61,6 @@ export default class RequestParamModel {
   state?: number
   orderId?: string
   processVehicleMaterialList?: MaterialInformationModel[]
+  wcsType?: string
+  readState?: number
 }