1
0
فهرست منبع

rfid接口统一修改为调用java后端。预齐套的手动出库功能接口联调。

jiaxiaoqiang 8 ماه پیش
والد
کامیت
ea93f88bf0

+ 3 - 2
entry/src/main/ets/common/util/request/StorageRequestInstance.ets

@@ -239,10 +239,11 @@ const BufferHopper= async() : Promise<BufferHopperclass[]> => {
   return obj
 }
 ///当前库存请求
-const testPost = async() : Promise<StorageStatusList[]> => {
+const testPost = async(search?: string) : Promise<StorageStatusList[]> => {
   let obj: StorageStatusList[] = []
    let res:StorageStatusList = await StorageRequest.post("/api/v1/stock/list", {
-     houseType:1
+     houseType:1,
+     materialCode: search ?? "",
      }as RequestParamModel)
   console.log('testTag', '&&&&&&&&&&&&' + JSON.stringify(res))
   obj = JSON.parse(JSON.stringify(res))

+ 8 - 7
entry/src/main/ets/common/util/request/helps.ets

@@ -1,4 +1,4 @@
-import  {InternalAxiosRequestConfig, AxiosResponse, AxiosError} from "@ohos/axios"
+import { InternalAxiosRequestConfig, AxiosResponse, AxiosError } from "@ohos/axios"
 import promptAction from '@ohos.promptAction'
 
 // 是否在控制台打印某项log
@@ -61,25 +61,26 @@ const printError = (error: AxiosError) => {
   }
   promptAction.showToast({
     message: error.message ?? "请求出错",
-    duration: 1300,
+    duration: 1500,
     bottom: 100
   })
 }
 
 
 // 处理返回数据
-const handleRes = (response: AxiosResponse) : [boolean, string] =>  {
+const handleRes = (response: AxiosResponse): [boolean, string] => {
   let isSuccess = true
   let msg = ""
 
   if (response.status === 200) { //判断返回状态是否为200
-    if (String( response.data?.code) === "200") { //判断数据的code是否为200,有可能是500的服务器错误
+    if (String(response.data?.code) === "200") { //判断数据的code是否为200,有可能是500的服务器错误
       isSuccess = true
       msg = `请求数据成功`
     }
     else {
       isSuccess = false
-      msg = `${response.data?.code}: ${response.data?.msg ?? "服务器错误"}`
+      // msg = `${response.data?.code}: ${response.data?.msg ?? "服务器错误"}`
+      msg = `${response.data?.msg ?? "服务器错误"}`
     }
   }
   else {
@@ -90,7 +91,7 @@ const handleRes = (response: AxiosResponse) : [boolean, string] =>  {
   if (!isSuccess) {
     promptAction.showToast({
       message: msg,
-      duration: 1300,
+      duration: 1500,
       bottom: 100
     })
 
@@ -104,4 +105,4 @@ const handleRes = (response: AxiosResponse) : [boolean, string] =>  {
 }
 
 
-export {printRequest, printResponse, printError, handleRes}
+export { printRequest, printResponse, printError, handleRes }

+ 24 - 2
entry/src/main/ets/model/StorageSpace.ets

@@ -13,7 +13,7 @@ export default class StorageSpace {
   // 启用状态(1:启用 2:禁用)
   enableState?: number
   // 仓储类型(多个用逗号隔开)(1:电子元器件 2:电路板 3:结构件 4:辅助材料)
-  storageType?: string|undefined
+  storageType?: string | undefined
   // 容量(单位:层)
   capacity?: number
   // 能否途经(1:启用 2:禁用)
@@ -24,4 +24,26 @@ export default class StorageSpace {
   parkType?: number
   // 已用容量(单位:层)
   usedCapacity?: number
-}
+}
+
+
+export class EmptyBoxInfoModel {
+  coordinate?: string;
+  houseNo?: string;
+  list?: Record<string, string>[];
+  locationNo?: string;
+  orderId?: string;
+  orderType?: string;
+  vehicleId?: string;
+  vehicleName?: string;
+  vehicleNo?: string;
+}
+
+export class StationInfoModel {
+  io?: number;
+  lock?: number;
+  lockStr?: string;
+  rfid?: string;
+  statNo?: string;
+  weight?: null;
+}

+ 179 - 144
entry/src/main/ets/pages/RfidAllocation.ets

@@ -6,123 +6,133 @@ import { WorkstationInfo } from './LoginPage';
 import CommonConstants from '../common/constants/CommonConstants';
 import EquipmentRequest from '../common/util/request/EquipmentRequest';
 import RequestParamModel from '../viewmodel/RequestParamModel';
+import { StationInfoModel } from '../model/StorageSpace';
 
 @Entry
 @CustomDialog
-export struct RfidAllocation{
+export struct RfidAllocation {
   //todo 读写器编号
-  @State ReadingWriting:string='SGHRI3LR48500'
+  @State ReadingWriting: string = 'SGHRI3LR48500'
   //写入rfid
-  @State InRfid:string=''
+  @State InRfid: string = ''
   @State workstation: WorkstationInfo = {}
   //新建料箱最后两位
-  @State newBox:number=0
+  @State newBox: number = 0
   //点击选择
-  @State onclick:number=-1
+  @State onclick: number = -1
   //打印机在线状态
-  @State onlineStatus:number=0
+  @State onlineStatus: number = 0
   //RFID在线状态
-  @State RfidOnlineStatus:number=0
+  @State RfidOnlineStatus: number = 0
   //箱子编码
-  @State boxCode:string=''
+  @State boxCode: string = ''
   //扫码控制器
   textcontroller: TextInputController = new TextInputController()
   //新建料箱list
-  @State private scanStorageList:Array<ScanStorageclass>=[]
-  @State isHomePage:boolean=false
+  @State private scanStorageList: Array<ScanStorageclass> = []
+  @State isHomePage: boolean = false
   RfidController?: CustomDialogController;
   //料箱容量
-  @State capacity:string='9999'
+  @State capacity: string = '9999'
   //料箱类别
-  @State category:string='0'
+  @State category: string = '0'
   //载具编号
-  @State code:string=''
+  @State code: string = ''
   //载具名称
-  @State name:string=''
+  @State name: string = ''
   //资产编号
-  @State propertyCode:string='YXJ-4610'
+  @State propertyCode: string = 'YXJ-4610'
   //时间
-  @State coding:string=''
+  @State coding: string = ''
   //料箱创建日期
-  @State MaterialBoxData:string=''
+  @State MaterialBoxData: string = ''
   //料箱创建时间
-  @State MaterialBoxTime:string=''
+  @State MaterialBoxTime: string = ''
   //新建料箱表
-  @State private  newMaterial:Array<newMaterialBoxList>=[]
-  @State private  newMaterialBin:Array<newMaterialBin>=[]
+  @State private newMaterial: Array<newMaterialBoxList> = []
+  @State private newMaterialBin: Array<newMaterialBin> = []
   //读取到的rfid信息
-  @State private  httpRfid:RfidClass={}
+  @State private httpRfid: RfidClass = {}
   //获取rfid
-  RfidHttp= async() : Promise<RfidClass> => {
+  @State private recentlyRecordObject: StationInfoModel = {}
+  RfidHttp = async (): Promise<RfidClass> => {
     //todo SGHRI3LR48500设备编号,从后端数据获取,暂时写死
-    let res:RfidClass = await EquipmentRequest.get("/api/v1/device/data/recentlyRecord/SGHRI3LR48500", {})
-    this.httpRfid=res
-    this.RfidOnlineStatus=1
-    console.log('textTag', 'rfid请求结果' +JSON.stringify(res)
+    let res: RfidClass = await EquipmentRequest.get("/api/v1/device/data/recentlyRecord/SGHRI3LR48500", {})
+
+    // let result: StationInfoModel = await StorageRequest.post("api/v1/wms/common/queryStationInfo", {
+    //   stanCode: CommonConstants.STATION_CODE
+    // } as RequestParamModel)
+    // this.recentlyRecordObject = result
+
+    this.httpRfid = res
+    this.RfidOnlineStatus = 1
+    console.log('textTag', 'rfid请求结果' + JSON.stringify(res)
     );
     return res
   }
   //写入rfid
-  InRfidHttp= async() : Promise<InRfidClass> => {
+  InRfidHttp = async (): Promise<InRfidClass> => {
     //todo SGHRI3LR48500设备编号,从后端数据获取,暂时写死
-    let res:InRfidClass = await EquipmentRequest.post("/api/v1/device/setup", {
-      deviceNo:this.ReadingWriting,
-      data:{
-        rfid0:this.InRfid
+    let res: InRfidClass = await EquipmentRequest.post("/api/v1/device/setup", {
+      deviceNo: this.ReadingWriting,
+      data: {
+        rfid0: this.InRfid
       }
-    }as RequestParamModel)
-    console.log('textTag', 'rfid写入结果' +JSON.stringify(res)
+    } as RequestParamModel)
+    console.log('textTag', 'rfid写入结果' + JSON.stringify(res)
     );
     return res
   }
-aboutToAppear(): void {
-  setInterval(async () => {
-    this.RfidHttp().then((res:RfidClass)=> {
 
-      console.log('textTag', '-------rfid获取信息' + JSON.stringify(res))
-    })
-     }, 5000);
+  aboutToAppear(): void {
+    setInterval(async () => {
+      this.RfidHttp().then((res: RfidClass) => {
 
+        console.log('textTag', '-------rfid获取信息' + JSON.stringify(res))
+      })
+    }, 5000);
 
 
-}
+  }
+
   //后端料箱绑定
-  newMaterialBox = async() : Promise<newMaterialBoxList> => {
-  let obj: newMaterialBoxList = {}
-  let res:newMaterialBoxList = await StorageRequest.post("/api/v1/wms/vehicle/add", {
-    capacity: '9999',
-    category:'0',
-    code: this.coding,
-    name:this.coding,
-    propertyCode: this.coding,
-    universal: '0'
-  }as newMaterialBoxList)
-  console.log('testTag', 'Tasklist成功' + JSON.stringify(res))
-  obj = JSON.parse(JSON.stringify(res))
-  console.log('testTag', 'aaaaaaaa' +JSON.stringify(obj));
-  return obj
-}
+  newMaterialBox = async (): Promise<newMaterialBoxList> => {
+    let obj: newMaterialBoxList = {}
+    let res: newMaterialBoxList = await StorageRequest.post("/api/v1/wms/vehicle/add", {
+      capacity: '9999',
+      category: '0',
+      code: this.coding,
+      name: this.coding,
+      propertyCode: this.coding,
+      universal: '0'
+    } as newMaterialBoxList)
+    console.log('testTag', 'Tasklist成功' + JSON.stringify(res))
+    obj = JSON.parse(JSON.stringify(res))
+    console.log('testTag', 'aaaaaaaa' + JSON.stringify(obj));
+    return obj
+  }
+
   build() {
-    Column(){
-      Stack({ alignContent: Alignment.Start }){
-        TitleStateComp({ isHomePage: this.isHomePage,})
-        Row(){
+    Column() {
+      Stack({ alignContent: Alignment.Start }) {
+        TitleStateComp({ isHomePage: this.isHomePage, })
+        Row() {
           Image($r('app.media.return'))
             .width(px2vp(56))
             .height(px2vp(56))
-            .onClick(()=>{
-              if ( CommonConstants.stationDictValue=== '5') {
+            .onClick(() => {
+              if (CommonConstants.stationDictValue === '5') {
                 router.pushUrl({
-                url:'pages/Warehousing'
+                  url: 'pages/Warehousing'
                 })
-              }else if ( CommonConstants.stationDictValue=== '6'){
+              } else if (CommonConstants.stationDictValue === '6') {
                 router.pushUrl({
-                  url:'pages/OutboundStation',
+                  url: 'pages/OutboundStation',
                 })
               }
               else {
                 router.pushUrl({
-                  url:'pages/process/ProcessHome',
+                  url: 'pages/process/ProcessHome',
                 })
               }
 
@@ -130,15 +140,15 @@ aboutToAppear(): void {
 
         }.width('20%')
         .height('8%')
-        .padding({left:px2vp(24)})
+        .padding({ left: px2vp(24) })
         .backgroundColor($r('app.color.title_bar_background'))
       }
 
-      Row(){
-        Column(){
-          Column(){
-            Column(){
-              Text('已有料盒'+"["+this.newMaterialBin.length.toString()+']')
+      Row() {
+        Column() {
+          Column() {
+            Column() {
+              Text('已有料盒' + "[" + this.newMaterialBin.length.toString() + ']')
                 .fontSize($r('app.float.fontSize_30'))
                 .fontWeight(FontWeight.Medium)
                 .fontColor($r('app.color.black_90'))
@@ -149,7 +159,8 @@ aboutToAppear(): void {
             .width('100%')
             .height(px2vp(80))
             .alignItems(HorizontalAlign.Start)
-            Row(){
+
+            Row() {
               Button('新建料箱')
                 .width(px2vp(292))
                 .height(px2vp(80))
@@ -157,39 +168,45 @@ aboutToAppear(): void {
                 .fontWeight(FontWeight.Medium)
                 .fontColor($r('app.color.process_divider_white_color'))
                 .backgroundColor($r('app.color.blue_100'))
-                .onClick(()=>{
+                .onClick(() => {
                   this.newBox++
                   //日期时间
                   let dateTime = new Date()
                   let coding = dateTime.getFullYear() + (dateTime.getMonth() + 1).toString().padStart(2, '0')
-                    +  (dateTime.getDate().toString().padStart(2, '0')) +
-                  (dateTime.getHours()).toString().padStart(2, '0')+(dateTime.getMinutes() + 1).toString().padStart(2, '0')
-                    +(dateTime.getSeconds() ).toString().padStart(2, '0')+(this.newBox<10?0:'')+this.newBox
-                  this.coding=coding
-                  let data=dateTime.getFullYear() +'-'+ (dateTime.getMonth() + 1).toString().padStart(2, '0')
-                    +'-'+  (dateTime.getDate().toString().padStart(2, '0'))
-                  this.MaterialBoxData=data
-                  let time=dateTime.getHours() +':'+ (dateTime.getMinutes() + 1).toString().padStart(2, '0')
-                    +':'+  (dateTime.getSeconds().toString().padStart(2, '0'))
-                  this.MaterialBoxTime=time
+                    + (dateTime.getDate().toString().padStart(2, '0')) +
+                  (dateTime.getHours()).toString().padStart(2, '0') + (dateTime.getMinutes() + 1).toString()
+                    .padStart(2, '0')
+                    + (dateTime.getSeconds()).toString().padStart(2, '0') + (this.newBox < 10 ? 0 : '') + this.newBox
+                  this.coding = coding
+                  let data = dateTime.getFullYear() + '-' + (dateTime.getMonth() + 1).toString().padStart(2, '0')
+                    + '-' + (dateTime.getDate().toString().padStart(2, '0'))
+                  this.MaterialBoxData = data
+                  let time = dateTime.getHours() + ':' + (dateTime.getMinutes() + 1).toString().padStart(2, '0')
+                    + ':' + (dateTime.getSeconds().toString().padStart(2, '0'))
+                  this.MaterialBoxTime = time
 
                   //todo 后台接口完善后要放开注释
                   // this.newMaterialBox().then((res:newMaterialBoxList)=>{
                   //   this.newMaterial.push(res)
                   // })
 
-                  let obj:newMaterialBin={MaterialBoxData:this.MaterialBoxData,MaterialBoxTime:this.MaterialBoxTime,coding:this.coding }
+                  let obj: newMaterialBin = {
+                    MaterialBoxData: this.MaterialBoxData,
+                    MaterialBoxTime: this.MaterialBoxTime,
+                    coding: this.coding
+                  }
                   this.newMaterialBin.unshift(obj)
                 })
               Blank()
-              Row(){
+              Row() {
                 Image($r('app.media.shaoma'))
                   .width(px2vp(32))
                   .height(px2vp(32))
-                  .margin({left:$r('app.float.fontSize_30')})
-                TextInput({ text:this.boxCode,
+                  .margin({ left: $r('app.float.fontSize_30') })
+                TextInput({ text: this.boxCode,
                   placeholder: '请点击扫码或者输入物料编码',
-                  controller: this.textcontroller }).width('92%')
+                  controller: this.textcontroller })
+                  .width('92%')
                   .height('100%')
                   .width(px2vp(450))
                   .fontWeight(FontWeight.Medium)
@@ -202,7 +219,7 @@ aboutToAppear(): void {
                 Image($r('app.media.search'))
                   .width(px2vp(32))
                   .height(px2vp(32))
-                  .margin({right:$r('app.float.fontSize_30')})
+                  .margin({ right: $r('app.float.fontSize_30') })
 
               }
               .width(px2vp(608))
@@ -211,20 +228,20 @@ aboutToAppear(): void {
               .alignItems(VerticalAlign.Center)
               .backgroundColor($r('app.color.process_divider_white_color'))
             }
-            .margin({right:$r('app.float.Margins_24')})
+            .margin({ right: $r('app.float.Margins_24') })
             .width('100%')
             .height(px2vp(80))
           }
           .width('100%')
           .height(px2vp(160))
-          .margin({right:$r('app.float.Margins_24'),bottom:px2vp(20)})
+          .margin({ right: $r('app.float.Margins_24'), bottom: px2vp(20) })
 
 
-          Column(){
-            List(){
-              ForEach(this.newMaterialBin,(item:newMaterialBin,index:number)=>{
-                ListItem(){
-                  Column(){
+          Column() {
+            List() {
+              ForEach(this.newMaterialBin, (item: newMaterialBin, index: number) => {
+                ListItem() {
+                  Column() {
                     Text(item.coding)
                       .fontSize($r('app.float.fontSize_24'))
                       .fontWeight(FontWeight.Medium)
@@ -232,8 +249,8 @@ aboutToAppear(): void {
                       .width('100%')
                       .height('40%')
 
-                    Row(){
-                      Text(item.MaterialBoxData+'  '+item.MaterialBoxTime)
+                    Row() {
+                      Text(item.MaterialBoxData + '  ' + item.MaterialBoxTime)
                         .fontSize($r('app.float.fontSize_20'))
                         .fontWeight(FontWeight.Medium)
                         .fontColor($r('app.color.black_60'))
@@ -247,17 +264,17 @@ aboutToAppear(): void {
                   .justifyContent(FlexAlign.Center)
                   .width(px2vp(608))
                   .height(px2vp(88))
-                  .margin({right:$r('app.float.Margins_24'),bottom:$r('app.float.topMargins_20')})
-                  .padding({left:$r('app.float.leftMargins_30') })
-                  .backgroundColor(this.onclick===index?$r('app.color.blue_100'):$r('app.color.process_divider_white_color'))
+                  .margin({ right: $r('app.float.Margins_24'), bottom: $r('app.float.topMargins_20') })
+                  .padding({ left: $r('app.float.leftMargins_30') })
+                  .backgroundColor(this.onclick === index ? $r('app.color.blue_100') : $r('app.color.process_divider_white_color'))
                   .borderRadius(px2vp(16))
-                  .onClick(()=>{
-                    this.onclick=index
-                    this.InRfid=item.coding!
+                  .onClick(() => {
+                    this.onclick = index
+                    this.InRfid = item.coding!
 
                   })
                 }
-                .margin({right:$r('app.float.Margins_24')})
+                .margin({ right: $r('app.float.Margins_24') })
               })
 
             }
@@ -269,10 +286,11 @@ aboutToAppear(): void {
         .height('100%')
         .borderRadius($r('app.float.borderRadius_16'))
         .alignItems(HorizontalAlign.Start)
+
         //.margin({right:$r('app.float.Margins_24')})
 
-        Column(){
-          Column(){
+        Column() {
+          Column() {
             Text('条码打印')
               .fontSize($r('app.float.fontSize_30'))
               .fontWeight(FontWeight.Medium)
@@ -280,9 +298,9 @@ aboutToAppear(): void {
               .textAlign(TextAlign.Start)
               .width('100%')
               .height('15%')
-              .margin({left:$r('app.float.leftMargins_30')})
-            Column(){
-              Row({space:10}){
+              .margin({ left: $r('app.float.leftMargins_30') })
+            Column() {
+              Row({ space: 10 }) {
                 Text('打印机状态')
                   .fontSize($r('app.float.fontSize_20'))
                   .fontWeight(FontWeight.Medium)
@@ -290,7 +308,7 @@ aboutToAppear(): void {
                   .textAlign(TextAlign.End)
                   .width('40%')
                   .height('100%')
-                if (this.onlineStatus===0){
+                if (this.onlineStatus === 0) {
                   Text().width(px2vp(12))
                     .height(px2vp(12))
                     .borderRadius(px2vp(50))
@@ -302,7 +320,7 @@ aboutToAppear(): void {
                     .textAlign(TextAlign.Start)
                     .width('35%')
                     .height('100%')
-                }else if (this.onlineStatus===1) {
+                } else if (this.onlineStatus === 1) {
 
                   Text().width('5%')
                     .height('30%')
@@ -320,7 +338,8 @@ aboutToAppear(): void {
               }
               .width('100%')
               .height('30%')
-              Row({space:10}){
+
+              Row({ space: 10 }) {
                 Text('打印机RFID编号')
                   .fontSize($r('app.float.fontSize_20'))
                   .fontWeight(FontWeight.Medium)
@@ -340,6 +359,7 @@ aboutToAppear(): void {
             .height('60%')
             .justifyContent(FlexAlign.Center)
             .alignItems(HorizontalAlign.Center)
+
             Blank()
             Button('打印条码')
               .fontColor($r('app.color.process_divider_white_color'))
@@ -348,14 +368,16 @@ aboutToAppear(): void {
               .backgroundColor($r('app.color.blue_100'))
               .width(px2vp(292))
               .height(px2vp(80))
-              .margin({bottom:$r('app.float.topMargins_20')})
+              .margin({ bottom: $r('app.float.topMargins_20') })
 
-          }.width('100%')
+          }
+          .width('100%')
           .height('49%')
           .borderRadius(px2vp(16))
           .backgroundColor($r('app.color.white_E3E5E7'))
-          .margin({bottom:$r('app.float.topMargins_20')})
-          Column(){
+          .margin({ bottom: $r('app.float.topMargins_20') })
+
+          Column() {
             Text('写入RFID')
               .fontSize($r('app.float.fontSize_30'))
               .fontWeight(FontWeight.Medium)
@@ -363,9 +385,9 @@ aboutToAppear(): void {
               .textAlign(TextAlign.Start)
               .width('100%')
               .height('15%')
-              .margin({left:$r('app.float.leftMargins_30')})
-            Column(){
-              Row({space:10}){
+              .margin({ left: $r('app.float.leftMargins_30') })
+            Column() {
+              Row({ space: 10 }) {
                 Text('RFID状态')
                   .fontSize($r('app.float.fontSize_20'))
                   .fontWeight(FontWeight.Medium)
@@ -373,7 +395,7 @@ aboutToAppear(): void {
                   .textAlign(TextAlign.End)
                   .width('40%')
                   .height('100%')
-                if (this.RfidOnlineStatus===1){
+                if (this.RfidOnlineStatus === 1) {
                   Text().width(px2vp(12))
                     .height(px2vp(12))
                     .borderRadius(px2vp(50))
@@ -385,7 +407,7 @@ aboutToAppear(): void {
                     .textAlign(TextAlign.Start)
                     .width('35%')
                     .height('100%')
-                }else if (this.RfidOnlineStatus===0){
+                } else if (this.RfidOnlineStatus === 0) {
 
                   Text().width('5%')
                     .height('30%')
@@ -403,7 +425,8 @@ aboutToAppear(): void {
               }
               .width('100%')
               .height('30%')
-              Row({space:10}){
+
+              Row({ space: 10 }) {
                 Text('当前RFID编号')
                   .fontSize($r('app.float.fontSize_20'))
                   .fontWeight(FontWeight.Medium)
@@ -419,7 +442,8 @@ aboutToAppear(): void {
               }
               .width('100%')
               .height('30%')
-              Row({space:10}){
+
+              Row({ space: 10 }) {
                 Text('写入RFID编号')
                   .fontSize($r('app.float.fontSize_20'))
                   .fontWeight(FontWeight.Medium)
@@ -439,6 +463,7 @@ aboutToAppear(): void {
             .height('60%')
             .justifyContent(FlexAlign.Center)
             .alignItems(HorizontalAlign.Center)
+
             Blank()
             Button('写入RFID')
               .fontColor($r('app.color.process_divider_white_color'))
@@ -447,9 +472,9 @@ aboutToAppear(): void {
               .backgroundColor($r('app.color.blue_100'))
               .width(px2vp(292))
               .height(px2vp(80))
-              .margin({bottom:$r('app.float.topMargins_20')})
-              .onClick(()=>{
-                this.InRfidHttp().then((res:InRfidClass)=> {
+              .margin({ bottom: $r('app.float.topMargins_20') })
+              .onClick(() => {
+                this.InRfidHttp().then((res: InRfidClass) => {
                   console.log('textTag', '-------rfid写入信息' + JSON.stringify(res))
                 })
               })
@@ -465,14 +490,20 @@ aboutToAppear(): void {
       }.width('100%')
       .height('92%')
       .justifyContent(FlexAlign.Center)
-      .padding({left:$r('app.float.Margins_24'),right:$r('app.float.Margins_24'),top:$r('app.float.topMargins_20'),bottom:$r('app.float.topMargins_20')})
+      .padding({
+        left: $r('app.float.Margins_24'),
+        right: $r('app.float.Margins_24'),
+        top: $r('app.float.topMargins_20'),
+        bottom: $r('app.float.topMargins_20')
+      })
 
     }.width('100%')
     .height('100%')
     .backgroundColor($r('app.color.white_f1f3f5'))
   }
 }
-export interface  newMaterialBoxList{
+
+export interface newMaterialBoxList {
   capacity?: string
   category?: string
   code?: string
@@ -480,24 +511,28 @@ export interface  newMaterialBoxList{
   propertyCode?: string
   universal?: string
 }
-export interface newMaterialBin{
-  MaterialBoxData?:string
-  MaterialBoxTime?:string
-  coding?:string
+
+export interface newMaterialBin {
+  MaterialBoxData?: string
+  MaterialBoxTime?: string
+  coding?: string
 }
 
-export interface RfidClass{
-  data?:datalass
+export interface RfidClass {
+  data?: datalass
 }
-export interface datalass{
-  RFID?:string
-  UID?:string
-  errCode?:string
+
+export interface datalass {
+  RFID?: string
+  UID?: string
+  errCode?: string
 }
-export interface InRfidClass{
-  deviceNo?:string
-  data?:InDataClass
+
+export interface InRfidClass {
+  deviceNo?: string
+  data?: InDataClass
 }
-export interface InDataClass{
-  rfid0?:string
+
+export interface InDataClass {
+  rfid0?: string
 }

+ 273 - 250
entry/src/main/ets/pages/WarehouseMap.ets

@@ -1,83 +1,85 @@
 import EquipmentRequest from '../common/util/request/EquipmentRequest'
 import StorageRequest from '../common/util/request/StorageRequest'
 import RequestParamModel from '../viewmodel/RequestParamModel'
-export class  routerClass{
-  xRoute?:number
-  YRoute?:number
+
+export class routerClass {
+  xRoute?: number
+  YRoute?: number
 }
-export class  routerHttp{
-  XCoordinateIn?:number
-  YCoordinateIn?:number
+
+export class routerHttp {
+  XCoordinateIn?: number
+  YCoordinateIn?: number
 }
 
 @Entry
 @Component
 export struct WarehouseMap {
   //车的位置请求返回数据
-  @State CarPosition: Array<carPositionClass> =[]
-  @State rgvNo:string='rgv1'
-  @State route:routerClass[]=[
-    {xRoute:10,YRoute:9},
-  {xRoute:10,YRoute:9},
-{xRoute:10,YRoute:10},
-{xRoute:9,YRoute:10},
-{xRoute:8,YRoute:10},
+  @State CarPosition: Array<carPositionClass> = []
+  @State rgvNo: string = 'rgv1'
+  @State route: routerClass[] = [
+    { xRoute: 10, YRoute: 9 },
+    { xRoute: 10, YRoute: 9 },
+    { xRoute: 10, YRoute: 10 },
+    { xRoute: 9, YRoute: 10 },
+    { xRoute: 8, YRoute: 10 },
   ]
-  @State routeIndex:number=0
+  @State routeIndex: number = 0
   //路径开关
-  @State routeIndexSwitch:number=0
+  @State routeIndexSwitch: number = 0
   //选择层数颜色
-  @State selectColor:number=-1
+  @State selectColor: number = -1
   //调入svg
-  @State enterSvg:number=0
+  @State enterSvg: number = 0
   //调出svg
-  @State outSvg:number=0
-  @State selectSvg:number=0
+  @State outSvg: number = 0
+  @State selectSvg: number = 0
   //车坐标
-  @State carYCoordinate:number=10
-  @State carXCoordinate:number=10
-  @State carYCoordinate1:number=8
-  @State carXCoordinate1:number=9
+  @State carYCoordinate: number = 10
+  @State carXCoordinate: number = 10
+  @State carYCoordinate1: number = 8
+  @State carXCoordinate1: number = 8
   //调入xy坐标
-  @State YCoordinateIn:number=0
-  @State XCoordinateIn:number=0
+  @State YCoordinateIn: number = 0
+  @State XCoordinateIn: number = 0
   //调出xy坐标
-  @State YCoordinate:number=0
-  @State XCoordinate:number=0
+  @State YCoordinate: number = 0
+  @State XCoordinate: number = 0
   //调入格子
-  @State SelectEnter:number=0
+  @State SelectEnter: number = 0
   //调出格子
-  @State SelectOut:number=0
-  @State boxNumber:number=0
-  @State JobHopping:number=0
+  @State SelectOut: number = 0
+  @State boxNumber: number = 0
+  @State JobHopping: number = 0
   scroller: Scroller = new Scroller()
   //选择的第几层
-  @State selectStorey:number=-1
+  @State selectStorey: number = -1
   //选调出格子有多少层
-  @State storeyNumber:number=-1
-  @State private  storey:number[]=[6,5,4,3,2,1]
- @State private  YAxis:number[]=[1,2,3,4,5,6,7,8,9,10,11,12,13]
-  @State private  XAxis:number[]=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]
-  @State private  XYxis:number[][]=[
-  [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,6,0,6,6],
-  [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,6,0,6,6],
-  [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0,-1,-1,-1,-1,-1,-1,-1,-1],
-  [-1,-1,-1,-1,-1,-1,-1,0,0,0,6,6,6,0,6,6,0,-1,-1,-1,-1,-1,-1,-1,-1],
-  [-1,-1,-1,-1,-1,-1,-1,0,6,0,6,5,6,0,6,6,0,-1,-1,-1,-1,-1,-1,-1,-1],
-  [-1,-1,-1,-1,-1,6,6,6,6,6,6,6,6,6,6,6,0,-1,-1,-1,-1,-1,-1,-1,-1],
-  [-1,-1,-1,-1,-1,6,6,6,6,6,6,6,6,6,6,6,0,-1,-1,-1,-1,-1,-1,-1,-1],
-  [-1,0,0,0,0,6,6,6,6,6,6,3,6,6,6,6,0,-1,-1,-1,-1,-1,-1,-1,-1],
-  [-1,-1,-1,-1,-1,6,6,6,6,6,6,6,6,6,6,6,0,-1,-1,-1,-1,-1,-1,-1,-1],
-  [-1,-1,-1,-1,-1,6,6,6,6,5,6,6,6,6,6,6,0,-1,-1,-1,-1,-1,-1,-1,-1],
-  [0,0,0,-1,-1,6,6,6,2,6,6,6,6,3,6,6,0,-1,-1,-1,-1,-1,-1,-1,-1],
-  [0,0,0,0,0,6,6,6,6,6,6,6,6,6,4,6,0,-1,-1,-1,-1,-1,-1,-1,-1],
-    [0,0,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]
+  @State storeyNumber: number = -1
+  @State private storey: number[] = [6, 5, 4, 3, 2, 1]
+  @State private YAxis: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
+  @State private XAxis: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
+  @State private XYxis: number[][] = [
+    [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 6, 0, 6, 6],
+    [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 6, 0, 6, 6],
+    [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1],
+    [-1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 6, 6, 6, 0, 6, 6, 0, -1, -1, -1, -1, -1, -1, -1, -1],
+    [-1, -1, -1, -1, -1, -1, -1, 0, 6, 0, 6, 5, 6, 0, 6, 6, 0, -1, -1, -1, -1, -1, -1, -1, -1],
+    [-1, -1, -1, -1, -1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, -1, -1, -1, -1, -1, -1, -1, -1],
+    [-1, -1, -1, -1, -1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, -1, -1, -1, -1, -1, -1, -1, -1],
+    [-1, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 3, 6, 6, 6, 6, 0, -1, -1, -1, -1, -1, -1, -1, -1],
+    [-1, -1, -1, -1, -1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, -1, -1, -1, -1, -1, -1, -1, -1],
+    [-1, -1, -1, -1, -1, 6, 6, 6, 6, 5, 6, 6, 6, 6, 6, 6, 0, -1, -1, -1, -1, -1, -1, -1, -1],
+    [0, 0, 0, -1, -1, 6, 6, 6, 2, 6, 6, 6, 6, 3, 6, 6, 0, -1, -1, -1, -1, -1, -1, -1, -1],
+    [0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 6, 0, -1, -1, -1, -1, -1, -1, -1, -1],
+    [0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
   ]
-  @State yNum:number[]=[1,2,3,4,5,6,7,8,9,10,11,12,13]
+  @State yNum: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
   //提示弹窗
   promptsController: CustomDialogController = new CustomDialogController({
-    builder:prompt({
-      JobHopping:this.JobHopping
+    builder: prompt({
+      JobHopping: this.JobHopping
 
     }),
     alignment: DialogAlignment.Center,
@@ -85,91 +87,99 @@ export struct WarehouseMap {
     customStyle: true,
   })
   //硬件调仓操作
-  AdjustmentHttp= async() : Promise<Adjustment[]> => {
-    let res:Adjustment[] = await EquipmentRequest.post("/api/v1/wcs/box/movMultiple",
+  AdjustmentHttp = async (): Promise<Adjustment[]> => {
+    let res: Adjustment[] = await EquipmentRequest.post("/api/v1/wcs/box/movMultiple",
       //todo 坐标加1,二维数组索引从零开始
       {
         //目标位置
-        dest:(this.XCoordinateIn+1)+'-'+(this.YCoordinateIn+1),
+        dest: (this.XCoordinateIn + 1) + '-' + (this.YCoordinateIn + 1),
         //移动位置
-        src:(this.XCoordinate+1)+'-'+(this.YCoordinate+1),
+        src: (this.XCoordinate + 1) + '-' + (this.YCoordinate + 1),
         //todo 数量暂时写死1
-        num:"1"
-    }as RequestParamModel)
+        num: "1"
+      } as RequestParamModel)
     //
-    console.log('textTag', 'post请求结果' +JSON.stringify(res)
+    console.log('textTag', 'post请求结果' + JSON.stringify(res)
     );
     return res
   }
-  Adjustment= async() : Promise<Adjustment[]> => {
-    let res:Adjustment[] = await EquipmentRequest.get("/api/v1/wcs/rgvs/",
+  Adjustment = async (): Promise<Adjustment[]> => {
+    let res: Adjustment[] = await EquipmentRequest.get("/api/v1/wcs/rgvs/",
       {
         // destx:this.XCoordinateIn,
         // destY:this.YCoordinateIn,
         // rgvNo:'rgvNo1'
       })
-    console.log('textTag', 'get请求结果' +JSON.stringify(res));
+    console.log('textTag', 'get请求结果' + JSON.stringify(res));
     return res
   }
   //请求车的位置
-  CarPositionHttp= async() : Promise<carPositionClass> => {
-  let res: carPositionClass= await EquipmentRequest.get("/api/v1/wcs/rgv/" + this.rgvNo, {
-  }) as carPositionClass
-    if (res!==undefined&&res.data!==undefined){
-      this.carYCoordinate=res.data.y!
-      this.carXCoordinate=res.data.x!
+  CarPositionHttp = async (): Promise<carPositionClass> => {
+    let res: carPositionClass = await EquipmentRequest.get("/api/v1/wcs/rgv/" + this.rgvNo, {}) as carPositionClass
+    if (res !== undefined && res.data !== undefined) {
+      this.carYCoordinate = res.data.y!
+      this.carXCoordinate = res.data.x!
     }
     console.log('textTag', '----------' + JSON.stringify(res));
-    console.log('textTag', '----------' + JSON.stringify(this.carYCoordinate));
-    console.log('textTag', '----------' + JSON.stringify(this.carXCoordinate));
-  return res
+    return res
+  }
+  // 获取仓库坐标信息,x和y轴的信息
+  getStorageXYData = async () => {
+    let result: number[][] = await StorageRequest.post("/api/v1/wms/position/lineInfo/")
+
+    this.XYxis = result
+    console.log("---", JSON.stringify(result))
+
   }
+
   aboutToAppear(): void {
-    this.CarPositionHttp().then((res:carPositionClass)=> {
+    this.getStorageXYData()
+    this.CarPositionHttp().then((res: carPositionClass) => {
 
       console.log('textTag', '-------car现在的位置执行情况结果 cccccc11' + JSON.stringify(res))
     })
 
   }
+
   build() {
     Row() {
-      Column(){
-        Button(this.JobHopping===0?'启动调仓':'停止调仓', { type: ButtonType.Normal, stateEffect: true })
+      Column() {
+        Button(this.JobHopping == 0 ? '启动调仓' : '停止调仓', { type: ButtonType.Normal, stateEffect: true })
           .borderRadius(8)
           .borderRadius(px2vp(76))
-          .backgroundColor(this.JobHopping===0?$r('app.color.blue_100'):$r('app.color.red_100'))
+          .backgroundColor(this.JobHopping == 0 ? $r('app.color.blue_100') : $r('app.color.red_100'))
           .width(px2vp(292))
           .height(px2vp(80))
-          .onClick(()=>{
-            if (this.JobHopping===0) {
+          .onClick(() => {
+            if (this.JobHopping == 0) {
               this.promptsController.open()
-            }else  if (this.JobHopping===1) {
-              this.JobHopping=0
+            } else if (this.JobHopping == 1) {
+              this.JobHopping = 0
             }
           })
         Blank()
-        if (this.storeyNumber!==-1){
+        if (this.storeyNumber !== -1) {
           Text('层数')
             .fontSize($r('app.float.fontSize_24'))
             .fontWeight(FontWeight.Medium)
             .textAlign(TextAlign.Center)
             .width(px2vp(292))
             .height(px2vp(80))
-          List({space:px2vp(20)}){
-            ForEach(this.storey, (item:number,index:number) => {
-              ListItem(){
+          List({ space: px2vp(20) }) {
+            ForEach(this.storey, (item: number, index: number) => {
+              ListItem() {
                 Text(item.toString())
                   .width(px2vp(291))
                   .height(px2vp(80))
                   .fontColor($r('app.color.black_100'))
                   .textAlign(TextAlign.Center)
-                  .border({width:px2vp(1)})
-                  .backgroundColor((index===(this.selectStorey-1))?$r('app.color.red_100'):index>=(6-this.storeyNumber)?$r('app.color.green_100'):$r('app.color.white_f1f3f5'))
+                  .border({ width: px2vp(1) })
+                  .backgroundColor((index == (this.selectStorey - 1)) ? $r('app.color.red_100') : index >= (6 - this.storeyNumber) ? $r('app.color.green_100') : $r('app.color.white_f1f3f5'))
                   .borderRadius(px2vp(16))
-                  .onClick(()=>{
-                    if (index>=(6-this.storeyNumber)) {
-                      this.selectStorey=index+1
-                      console.log('textTag'+'选择第几层的料箱'+this.selectStorey)
+                  .onClick(() => {
+                    if (index >= (6 - this.storeyNumber)) {
+                      this.selectStorey = index + 1
+                      console.log('textTag' + '选择第几层的料箱' + this.selectStorey)
                     }
                   })
               }
@@ -182,11 +192,11 @@ export struct WarehouseMap {
 
       }.width(px2vp(292))
       .height(px2vp(800))
-      .margin({right:px2vp(24)})
+      .margin({ right: px2vp(24) })
 
       Column() {
-        Row(){
-          Column(){
+        Row() {
+          Column() {
             Text('y')
               .width(px2vp(25))
               .height(px2vp(25))
@@ -196,7 +206,8 @@ export struct WarehouseMap {
           .width(px2vp(25))
           .height(px2vp(55))
           .justifyContent(FlexAlign.End)
-          Column(){
+
+          Column() {
             Text('x')
               .width(px2vp(25))
               .height(px2vp(25))
@@ -209,9 +220,10 @@ export struct WarehouseMap {
         }
         .width(px2vp(50))
         .height(px2vp(55))
-        List({space:px2vp(1)}){
-          ForEach(this.YAxis, (item:number,index:number) => {
-            ListItem(){
+
+        List({ space: px2vp(1) }) {
+          ForEach(this.YAxis, (item: number, index: number) => {
+            ListItem() {
               Text(item.toString())
                 .width(px2vp(55))
                 .height(px2vp(55))
@@ -227,11 +239,12 @@ export struct WarehouseMap {
       }
       .width(px2vp(60))
       .height(px2vp(800))
-      Scroll(this.scroller){
-        Column(){
-          List({space:px2vp(1)}){
-            ForEach(this.XAxis, (item:number,index:number) => {
-              ListItem(){
+
+      Scroll(this.scroller) {
+        Column() {
+          List({ space: px2vp(1) }) {
+            ForEach(this.XAxis, (item: number, index: number) => {
+              ListItem() {
                 Text(item.toString())
                   .width(px2vp(55))
                   .height(px2vp(55))
@@ -243,50 +256,50 @@ export struct WarehouseMap {
           }
           .listDirection(Axis.Horizontal)
           .scrollBar(BarState.Off)
-          .width(px2vp(2000))
+          .width(px2vp(1620))
           .height(px2vp(55))
-          List({space:px2vp(1)}) {
-            ForEach(this.XYxis, (y: number[],index1:number) => {
+
+          List({ space: px2vp(1) }) {
+            ForEach(this.XYxis, (y: number[], index1: number) => {
               ListItem() {
-                List({space:px2vp(1)}) {
-                  ForEach(y, (x: number,index2:number) => {
+                List({ space: px2vp(1) }) {
+                  ForEach(y, (x: number, index2: number) => {
                     ListItem() {
-                      if (x>=0) {
-                        Stack(){
-                          Text(x===0?'':x.toString())
+                      if (x >= 0) {
+                        Stack() {
+                          Text(x == 999 ? '' : x.toString())
                             .width(px2vp(55))
                             .height(px2vp(55))
                             .fontColor($r('app.color.blue_100'))
                             .textAlign(TextAlign.Center)
-                            .border({width:px2vp(1),color:'#7DC8EA'})
-                            .backgroundColor(((index1===4
-                              &&index2===7)||(index1===3&&index2===7)||(index1===3&&index2===9)||(index1===4&&index2===9)||(index1===4&&index2===13)||(index1===3&&index2===13))?'#E84026 ':x===0?$r('app.color.white_f1f3f5'):(this.SelectOut===1||this.SelectEnter===1)?$r('app.color.green_100'):'')
-                          if (this.routeIndexSwitch===1){
+                            .border({ width: px2vp(1), color: '#7DC8EA' })
+                            .backgroundColor(x == 999 ? '#E84026 ' : x == 0 ? $r('app.color.white_f1f3f5') : (this.SelectOut == 1 || this.SelectEnter == 1) ? $r('app.color.green_100') : '')
+                          if (this.routeIndexSwitch == 1) {
                             //for (let num = 0; num < this.route.length; num++) {
-                              Text()
-                                .width(px2vp(55))
-                                .height(px2vp(55))
-                                .fontColor($r('app.color.black_100'))
-                                .textAlign(TextAlign.Center)
-                              //  .backgroundColor((index1===this.route[this.routeIndex].YRoute&&index2===this.route[this.routeIndex].xRoute)?$r('app.color.green_100'):'')
-                           // }
+                            Text()
+                              .width(px2vp(55))
+                              .height(px2vp(55))
+                              .fontColor($r('app.color.black_100'))
+                              .textAlign(TextAlign.Center)
+                            //  .backgroundColor((index1==this.route[this.routeIndex].YRoute&&index2==this.route[this.routeIndex].xRoute)?$r('app.color.green_100'):'')
+                            // }
 
                           }
 
-                          Row(){
-                            Image((index1===this.carYCoordinate&&index2===this.carXCoordinate)?$r('app.media.robot_top'):(index1===this.carYCoordinate&&index2===this.carXCoordinate+1)?$r("app.media.robot_arm"):(index1===this.carYCoordinate1&&index2===this.carXCoordinate1)?$r('app.media.car_top'):(index1===this.carYCoordinate1&&index2===this.carXCoordinate1-1)?$r('app.media.car_bottom'):'')
+                          Row() {
+                            Image((index1 == this.carYCoordinate && index2 == this.carXCoordinate) ? $r('app.media.robot_top') : (index1 == this.carYCoordinate && index2 == this.carXCoordinate + 1) ? $r("app.media.robot_arm") : (index1 == this.carYCoordinate1 && index2 == this.carXCoordinate1) ? $r('app.media.car_top') : (index1 == this.carYCoordinate1 && index2 == this.carXCoordinate1 - 1) ? $r('app.media.car_bottom') : '')
                               .width(px2vp(55))
                               .height(px2vp(55))
-                              .margin({right:px2vp(55)})
-                              .onClick(()=>{
-                                if (x!==-1&&this.SelectOut===1) {
-                                  this.YCoordinate=index1
-                                  this.XCoordinate=index2
-                                  this.SelectOut=2
-                                  this.SelectEnter=3
-                                  this.outSvg=1
-                                  this.storeyNumber=x
-                                  console.log('textTag'+'调出坐标'+ this.XCoordinate+this.YCoordinate)
+                              .margin({ right: px2vp(55) })
+                              .onClick(() => {
+                                if (x != -1 && this.SelectOut == 1) {
+                                  this.YCoordinate = index1
+                                  this.XCoordinate = index2
+                                  this.SelectOut = 2
+                                  this.SelectEnter = 3
+                                  this.outSvg = 1
+                                  this.storeyNumber = x
+                                  console.log('textTag' + '调出坐标' + this.XCoordinate + this.YCoordinate)
                                 }
                               })
                           }
@@ -294,29 +307,29 @@ export struct WarehouseMap {
                           .width(px2vp(55))
                           .height(px2vp(55))
 
-                          if ((this.outSvg===1)){
-                            Image(((index1===this.YCoordinate&&index2===this.XCoordinate))?$r('app.media.Retrieve_grid'):'')
+                          if ((this.outSvg == 1)) {
+                            Image(((index1 == this.YCoordinate && index2 == this.XCoordinate)) ? $r('app.media.Retrieve_grid') : '')
                               .width(px2vp(55))
                               .height(px2vp(55))
-                              .onClick(()=>{
-                                if (x!==-1&&this.SelectEnter===1&&this.SelectOut===2){
-                                  this.YCoordinateIn=index1
-                                  this.XCoordinateIn=index2
-                                  this.SelectEnter=2
-                                  this.enterSvg=1
-                                  console.log('textTag'+'调入坐标' +this.XCoordinateIn+this.YCoordinateIn)
+                              .onClick(() => {
+                                if (x !== -1 && this.SelectEnter == 1 && this.SelectOut == 2) {
+                                  this.YCoordinateIn = index1
+                                  this.XCoordinateIn = index2
+                                  this.SelectEnter = 2
+                                  this.enterSvg = 1
+                                  console.log('textTag' + '调入坐标' + this.XCoordinateIn + this.YCoordinateIn)
                                 }
                               })
                           }
-                          if (this.enterSvg===1){
-                            Image((((index1===this.YCoordinateIn&&index2===this.XCoordinateIn)))?$r('app.media.Transfer_grid'):'')
+                          if (this.enterSvg == 1) {
+                            Image((((index1 == this.YCoordinateIn && index2 == this.XCoordinateIn))) ? $r('app.media.Transfer_grid') : '')
                               .width(px2vp(55))
                               .height(px2vp(55))
 
                           }
                         }
 
-                      }else {
+                      } else {
                         Text()
                           .width(px2vp(55))
                           .height(px2vp(55))
@@ -331,18 +344,17 @@ export struct WarehouseMap {
             })
           }
           .scrollBar(BarState.Off)
-        }.width(px2vp(2000))
+        }.width(px2vp(1620))
         .height(px2vp(800))
 
-
       }
-      .width(px2vp(1020))
+      .width(px2vp(1620))
       .height(px2vp(800))
       .scrollable(ScrollDirection.Horizontal) // 滚动方向纵向
-      if (this.JobHopping===1){
-        Column(){
-          Column(){
-            Row(){
+      if (this.JobHopping == 1) {
+        Column() {
+          Column() {
+            Row() {
               Text('调出料格')
                 .fontWeight(FontWeight.Medium)
                 .fontColor($r('app.color.black_100'))
@@ -352,32 +364,34 @@ export struct WarehouseMap {
             }
 
             Blank()
-            Button(this.SelectOut===2?'取消选择':'选调出料格', { type: ButtonType.Normal, stateEffect: true })
+            Button(this.SelectOut == 2 ? '取消选择' : '选调出料格', { type: ButtonType.Normal, stateEffect: true })
               .borderRadius(8)
-              .backgroundColor(this.SelectOut===2?$r('app.color.red_100'):$r('app.color.blue_100'))
+              .backgroundColor(this.SelectOut == 2 ? $r('app.color.red_100') : $r('app.color.blue_100'))
               .width(px2vp(292))
               .borderRadius(px2vp(76))
               .height(px2vp(80))
-              .onClick(()=>{
-                if (this.SelectOut===0||this.SelectOut===2) {
-                  this.SelectOut=1
-                  this.YCoordinate=0
-                  this.XCoordinate=0
-                  this.outSvg=0
-                  this.enterSvg=0
+              .onClick(() => {
+                if (this.SelectOut == 0 || this.SelectOut == 2) {
+                  this.SelectOut = 1
+                  this.YCoordinate = 0
+                  this.XCoordinate = 0
+                  this.outSvg = 0
+                  this.enterSvg = 0
                 }
-                console.log('textTag'+'-----'+this.SelectOut)
+                console.log('textTag' + '-----' + this.SelectOut)
               })
             Blank()
 
-          }.width(px2vp(450))
+          }
+          .width(px2vp(450))
           .height(px2vp(188))
           .padding(px2vp(20))
           .alignItems(HorizontalAlign.Center)
           .borderRadius(px2vp(16))
           .backgroundColor($r('app.color.black_10'))
-          .margin({bottom:px2vp(48)})
-          Column(){
+          .margin({ bottom: px2vp(48) })
+
+          Column() {
             Text('调入料格')
               .fontWeight(FontWeight.Medium)
               .fontColor($r('app.color.black_100'))
@@ -385,41 +399,43 @@ export struct WarehouseMap {
               .width(px2vp(410))
               .textAlign(TextAlign.Start)
             Blank()
-            Button(this.SelectEnter===2?'取消选择':'选调入料格', { type: ButtonType.Normal, stateEffect: true })
+            Button(this.SelectEnter == 2 ? '取消选择' : '选调入料格', { type: ButtonType.Normal, stateEffect: true })
               .borderRadius(8)
-              .backgroundColor(this.SelectEnter===3?$r('app.color.blue_100'):this.SelectEnter===2?$r('app.color.red_100'):$r('app.color.blue_20'))
+              .backgroundColor(this.SelectEnter == 3 ? $r('app.color.blue_100') : this.SelectEnter == 2 ? $r('app.color.red_100') : $r('app.color.blue_20'))
               .width(px2vp(292))
               .height(px2vp(80))
               .borderRadius(px2vp(76))
-              .onClick(()=>{
-                if (this.SelectEnter===3) {
-                  this.SelectEnter=1
-                  console.log('textTag'+'-----'+this.SelectEnter)
-                }else if (this.SelectEnter===2){
-                  this.SelectEnter=1
+              .onClick(() => {
+                if (this.SelectEnter == 3) {
+                  this.SelectEnter = 1
+                  console.log('textTag' + '-----' + this.SelectEnter)
+                } else if (this.SelectEnter == 2) {
+                  this.SelectEnter = 1
                   //this.outSvg=0
-                  this.enterSvg=0
-                  this.XCoordinateIn=0
-                  this.YCoordinateIn=0
+                  this.enterSvg = 0
+                  this.XCoordinateIn = 0
+                  this.YCoordinateIn = 0
                 }
               })
             Blank()
 
-          }.width(px2vp(450))
+          }
+          .width(px2vp(450))
           .height(px2vp(188))
           .padding(px2vp(20))
           .alignItems(HorizontalAlign.Center)
           .borderRadius(px2vp(16))
           .backgroundColor($r('app.color.black_10'))
-          .margin({bottom:px2vp(48)})
-          Column(){
+          .margin({ bottom: px2vp(48) })
+
+          Column() {
             Text('调箱数量')
               .fontWeight(FontWeight.Medium)
               .fontColor($r('app.color.black_100'))
               .fontSize($r('app.float.fontSize_24'))
               .width(px2vp(410))
               .textAlign(TextAlign.Start)
-            Row(){
+            Row() {
               Text('调动箱数')
                 .fontWeight(FontWeight.Regular)
                 .fontColor($r('app.color.black_60'))
@@ -432,117 +448,122 @@ export struct WarehouseMap {
                 .fontSize($r('app.float.fontSize_20'))
                 .width(px2vp(150))
                 .textAlign(TextAlign.End)
-              }.width(px2vp(300))
-              .height(px2vp(30))
+            }.width(px2vp(300))
+            .height(px2vp(30))
+
             Blank()
-           Row(){
-             Image($r('app.media.add_disabled'))
-               .width(px2vp(50))
-               .height(px2vp(50))
-               .onClick(()=>{
-                 if (this.boxNumber<6) {
-                   this.boxNumber++
-                 }
-
-               })
-             Text(this.boxNumber.toString())
-               .fontWeight(FontWeight.Medium)
-               .fontColor($r('app.color.black_100'))
-               .fontSize($r('app.float.fontSize_24'))
-               .width(px2vp(80))
-               .textAlign(TextAlign.Center)
-
-             Image($r('app.media.subtract_disabled'))
-               .width(px2vp(50))
-               .height(px2vp(50))
-               .onClick(()=>{
-                 if (this.boxNumber>0) {
-                   this.boxNumber--
-                 }
-
-               })
-           }.width(px2vp(450))
-           .height(px2vp(80))
-           .justifyContent(FlexAlign.Center)
+            Row() {
+              Image($r('app.media.add_disabled'))
+                .width(px2vp(50))
+                .height(px2vp(50))
+                .onClick(() => {
+                  if (this.boxNumber < 6) {
+                    this.boxNumber++
+                  }
+
+                })
+              Text(this.boxNumber.toString())
+                .fontWeight(FontWeight.Medium)
+                .fontColor($r('app.color.black_100'))
+                .fontSize($r('app.float.fontSize_24'))
+                .width(px2vp(80))
+                .textAlign(TextAlign.Center)
+
+              Image($r('app.media.subtract_disabled'))
+                .width(px2vp(50))
+                .height(px2vp(50))
+                .onClick(() => {
+                  if (this.boxNumber > 0) {
+                    this.boxNumber--
+                  }
+
+                })
+            }.width(px2vp(450))
+            .height(px2vp(80))
+            .justifyContent(FlexAlign.Center)
+
             Blank()
 
-          }.width(px2vp(450))
+          }
+          .width(px2vp(450))
           .height(px2vp(188))
           .padding(px2vp(20))
           .alignItems(HorizontalAlign.Center)
           .borderRadius(px2vp(16))
           .backgroundColor($r('app.color.black_10'))
-          .margin({bottom:px2vp(48)})
+          .margin({ bottom: px2vp(48) })
+
           Button('确认调仓', { type: ButtonType.Normal, stateEffect: true })
             .borderRadius(8)
-            .backgroundColor(this.SelectEnter===2?$r('app.color.blue_100'):$r('app.color.blue_20'))
+            .backgroundColor(this.SelectEnter == 2 ? $r('app.color.blue_100') : $r('app.color.blue_20'))
             .width(px2vp(292))
             .height(px2vp(80))
             .borderRadius(px2vp(76))
-            .onClick(()=>{
+            .onClick(() => {
               // this.Adjustment().then((res:Adjustment[])=> {
               //   console.log('textTag', '-------执行情况结果 cccccc11' + JSON.stringify(res))
               // })
               for (let index = 0; index < this.route.length; index++) {
                 this.routeIndex = index
               }
-              this.routeIndexSwitch=1
-              this.enterSvg=0
-              this.SelectEnter=0
-              this.SelectOut=0
-              this.storeyNumber=-1
-              this.outSvg=0
-                this.AdjustmentHttp().then((res:Adjustment[])=> {
-                  console.log('textTag', '-------执行情况结果 cccccc111111' + JSON.stringify(res))
-                })
+              this.routeIndexSwitch = 1
+              this.enterSvg = 0
+              this.SelectEnter = 0
+              this.SelectOut = 0
+              this.storeyNumber = -1
+              this.outSvg = 0
+              this.AdjustmentHttp().then((res: Adjustment[]) => {
+                console.log('textTag', '-------执行情况结果 cccccc111111' + JSON.stringify(res))
+              })
 
 
             })
 
 
-
         }.width(px2vp(450))
         .height(px2vp(800))
-        .margin({left:px2vp(24)})
-      }else if (this.JobHopping===1){
+        .margin({ left: px2vp(24) })
+      } else if (this.JobHopping == 1) {
 
       }
 
     }
     .width(px2vp(1920))
     .height(px2vp(800))
-    .padding({left:px2vp(24),right:px2vp(24)})
-    .margin({top:px2vp(20)})
+    .padding({ left: px2vp(24), right: px2vp(24) })
+    .margin({ top: px2vp(20) })
   }
 }
+
 @CustomDialog
   ///无批次号物料详情弹窗
 struct prompt {
-  @Link JobHopping:number
+  @Link JobHopping: number
   controller: CustomDialogController
+
   build() {
-    Column({space:px2vp(50)}){
+    Column({ space: px2vp(50) }) {
       Text('调仓确认')
         .fontSize($r('app.float.fontSize_50'))
         .fontWeight(FontWeight.Medium)
         .fontColor($r('app.color.black_100'))
         .textAlign(TextAlign.Center)
         .width(px2vp(400))
-        .margin({top:px2vp(30)})
+        .margin({ top: px2vp(30) })
       Text('启动调仓后,其他工位将无法叫料,是否开始?')
         .fontSize($r('app.float.fontSize_24'))
         .fontWeight(FontWeight.Medium)
         .fontColor($r('app.color.black_100'))
         .textAlign(TextAlign.Center)
         .width(px2vp(400))
-      Row(){
+      Row() {
         Button('取消', { type: ButtonType.Normal, stateEffect: true })
           .borderRadius(8)
           .backgroundColor($r('app.color.blue_100'))
           .width(px2vp(252))
           .height(px2vp(69))
           .borderRadius(px2vp(76))
-          .onClick(()=>{
+          .onClick(() => {
             this.controller.close()
           })
         Blank()
@@ -552,12 +573,12 @@ struct prompt {
           .width(px2vp(252))
           .height(px2vp(69))
           .borderRadius(px2vp(76))
-          .onClick(()=>{
-            this.JobHopping=1
+          .onClick(() => {
+            this.JobHopping = 1
             this.controller.close()
           })
       }.width(px2vp(600))
-      .padding({left:px2vp(30),right:px2vp(30)})
+      .padding({ left: px2vp(30), right: px2vp(30) })
 
     }.width(px2vp(800))
     .height(px2vp(400))
@@ -565,20 +586,22 @@ struct prompt {
     .borderRadius(16)
   }
 }
-export class
-Adjustment{
-  destx?:string
-  code?:string
-  msg?:string
-  cmdId?:string
-  state?:string
+
+export class Adjustment {
+  destx?: string
+  code?: string
+  msg?: string
+  cmdId?: string
+  state?: string
 }
-export class carPositionClass{
-  code?:string
-  message?:string
-  data?:dataClass
+
+export class carPositionClass {
+  code?: string
+  message?: string
+  data?: dataClass
 }
-export class dataClass{
+
+export class dataClass {
   x?: number
   y?: number
 }

+ 125 - 111
entry/src/main/ets/pages/Warehousing.ets

@@ -11,76 +11,77 @@ import { ScanStorageclass } from './Storage'
 
 @Entry
 @Component
-struct Warehousing{
+struct Warehousing {
   @State private controlList: Array<controlClass> = []
   //工序id
-  @State orderId:string=''
+  @State orderId: string = ''
   //自动入库开关
-  @State automaticWarehousing:number=0
+  @State automaticWarehousing: number = 0
   //有无违禁品
-  @State contraband:number=0
+  @State contraband: number = 0
   //料箱等级(类型)
-  @State vehicleLevel:string=''
+  @State vehicleLevel: string = ''
   //暂时固定的料箱编码
-  @State binCode:string=''
+  @State binCode: string = ''
   //重量
-  @State weight:number=0
+  @State weight: number = 0
   ///料箱状态
-  @State materialBox:number=0
+  @State materialBox: number = 0
   //取料箱中物料信息
   @State private boxMaterials: Array<boxMaterialClass> = []
   //定义物料信息
-  @State private MaterialInformation:Array<MaterialInformationList>=[]
-  @State private entranceWaiting:Array<stat1>=[]
+  @State private MaterialInformation: Array<MaterialInformationList> = []
+  @State private entranceWaiting: Array<stat1> = []
   //后端控制系统料箱出库
-  controlHttp = async() :Promise<controlClass[]>  => {
-    let res:controlClass[]= await StorageRequest.post("/api/v1/wms/common/receiveResult",{
+  controlHttp = async (): Promise<controlClass[]> => {
+    let res: controlClass[] = await StorageRequest.post("/api/v1/wms/common/receiveResult", {
       //任务单号id
-      orderId:this.orderId,
-      state:1
-    }as RequestParamModel)
-    console.log('testTag', 'aaaaaaaa1' +JSON.stringify(res));
-    this.controlList=res
+      orderId: this.orderId,
+      state: 1
+    } as RequestParamModel)
+    console.log('testTag', 'aaaaaaaa1' + JSON.stringify(res));
+    this.controlList = res
     return res
   }
   //硬件stat1位置接口
-  locationRequest=async() : Promise<stat1> =>{
-    let res:stat1 = await EquipmentRequest.get("api/v1/wcs/stat/stat1")
-    console.log('testTag1'+'-------------'+JSON.stringify(res))
+  locationRequest = async (): Promise<stat1> => {
+    let res: stat1 = await EquipmentRequest.get("api/v1/wcs/stat/stat1")
+    console.log('testTag1' + '-------------' + JSON.stringify(res))
     return res
   }
   //todo
   //暂时扫的是库存里的料箱编码信息
   //查询取出料箱里面的物料信息
-  boxMaterialHttp= async() : Promise<MaterialInformationList[]> => {
-    let res:MaterialInformationList[] = await StorageRequest.post("/api/v1/stock/list",{
+  boxMaterialHttp = async (): Promise<MaterialInformationList[]> => {
+    let res: MaterialInformationList[] = await StorageRequest.post("/api/v1/stock/list", {
       //todo 读取RFId的料箱编码,要根据硬件读到的改
-      vehicleCode:this.binCode
-    }as RequestParamModel)
-    console.log('testTag', 'aaaaaaaa2' +JSON.stringify(res));
-    this.MaterialInformation=res
+      vehicleCode: this.binCode
+    } as RequestParamModel)
+    console.log('testTag', 'aaaaaaaa2' + JSON.stringify(res));
+    this.MaterialInformation = res
     return res
   }
   //硬件请求入库操作
-  warehousingHttp= async() : Promise<boxMaterialClass> => {
-    let res:boxMaterialClass = await StorageRequest.post("/api/v1/wcs/stockin",{
-      boxNo:this.entranceWaiting[0].rfid!,
-      position:"stat2",
-      mtype:this.vehicleLevel
-    }as RequestParamModel)
-    console.log('testTag1', '----------' +JSON.stringify(res));
+  warehousingHttp = async (): Promise<boxMaterialClass> => {
+    let res: boxMaterialClass = await StorageRequest.post("/api/v1/wcs/stockin", {
+      boxNo: this.entranceWaiting[0].rfid!,
+      position: "stat2",
+      mtype: this.vehicleLevel
+    } as RequestParamModel)
+    console.log('testTag1', '----------' + JSON.stringify(res));
     return res
   }
   //后端入库操作
-  Warehousing=async() : Promise<boxMaterialClass[]> => {
-    let res:boxMaterialClass[]= await StorageRequest.post("/api/v1/wmsOrder/inBox",{
-      houseNo:'1',
-      vehicleCode:this.entranceWaiting[0].rfid!,
-      detailsList:this.boxMaterials
-    }as RequestParamModel)
-    console.log('testTag', 'aaaaaaaa1' +JSON.stringify(res));
+  Warehousing = async (): Promise<boxMaterialClass[]> => {
+    let res: boxMaterialClass[] = await StorageRequest.post("/api/v1/wmsOrder/inBox", {
+      houseNo: '1',
+      vehicleCode: this.entranceWaiting[0].rfid!,
+      detailsList: this.boxMaterials
+    } as RequestParamModel)
+    console.log('testTag', 'aaaaaaaa1' + JSON.stringify(res));
     return res
   }
+
   //todo。暂时关闭
   //打开页面0.5s请求一次硬件,当io(有无料箱)和weight(重量)发送变化时执行改变数据,同时通过RFID请求读取料箱里面物料信息
   async aboutToAppear() {
@@ -150,61 +151,63 @@ struct Warehousing{
     //   }
     // }, 500);
   }
+
   //料箱里的物料
-  @State private scanStorageList:Array<ScanStorageclass>=[]
-  @State isHomePage:boolean=false
-//0:主动入库,1:手动入库,2:统计按钮
-  @State inboundButton:number=0
+  @State private scanStorageList: Array<ScanStorageclass> = []
+  @State isHomePage: boolean = false
+  //0:主动入库,1:手动入库,2:统计按钮
+  @State inboundButton: number = 0
   //仓储和其他仓储点击按钮变色
-  @State warehouseButton:number=0
+  @State warehouseButton: number = 0
   //RFID卡读取失败弹窗
   RfidCarController: CustomDialogController = new CustomDialogController({
-    builder:RfidCar({
-
-    }),
+    builder: RfidCar({}),
     alignment: DialogAlignment.Center,
     gridCount: 4,
     customStyle: true,
   })
+
   build() {
-    Column(){
-      TitleStateComp({ isHomePage: this.isHomePage,})
-      Column(){
-        Row(){
-            Row(){
-              Text('智能仓储')
-                .textAlign(TextAlign.Center)
-                .borderRadius(px2vp(16))
-                .width('292px')
-                .height('80px')
-                .fontWeight(FontWeight.Medium)
-                .fontSize(px2vp(24))
-                .fontColor(this.warehouseButton===0?$r('app.color.black_90'):$r('app.color.black_60'))
-                .backgroundColor(this.warehouseButton===0?$r('app.color.process_divider_white_color'):'')
-                .onClick(()=>{
-                  this.warehouseButton=0
-                })
-              Blank()
-              Text('其他仓储')
-                .textAlign(TextAlign.Center)
-                .borderRadius(px2vp(16))
-                .width('292px')
-                .height('80px')
-                .fontWeight(FontWeight.Medium)
-                .fontSize(px2vp(24))
-                .fontColor(this.warehouseButton===1?$r('app.color.black_90'):$r('app.color.black_60'))
-                .backgroundColor(this.warehouseButton===1?$r('app.color.process_divider_white_color'):'')
-                .onClick(()=>{
-                  this.warehouseButton=1
-                })
+    Column() {
+      TitleStateComp({ isHomePage: this.isHomePage, })
+      Column() {
+        Row() {
+          Row() {
+            Text('智能仓储')
+              .textAlign(TextAlign.Center)
+              .borderRadius(px2vp(16))
+              .width('292px')
+              .height('80px')
+              .fontWeight(FontWeight.Medium)
+              .fontSize(px2vp(24))
+              .fontColor(this.warehouseButton === 0 ? $r('app.color.black_90') : $r('app.color.black_60'))
+              .backgroundColor(this.warehouseButton === 0 ? $r('app.color.process_divider_white_color') : '')
+              .onClick(() => {
+                this.warehouseButton = 0
+              })
+            Blank()
+            Text('其他仓储')
+              .textAlign(TextAlign.Center)
+              .borderRadius(px2vp(16))
+              .width('292px')
+              .height('80px')
+              .fontWeight(FontWeight.Medium)
+              .fontSize(px2vp(24))
+              .fontColor(this.warehouseButton === 1 ? $r('app.color.black_90') : $r('app.color.black_60'))
+              .backgroundColor(this.warehouseButton === 1 ? $r('app.color.process_divider_white_color') : '')
+              .onClick(() => {
+                this.warehouseButton = 1
+              })
 
 
-            }.width(px2vp(608))
-            .borderRadius(px2vp(15))
-            .height(px2vp(80))
-            .backgroundColor($r('app.color.black_10'))
-            .margin({right:px2vp(24)})
-           Row(){
+          }
+          .width(px2vp(608))
+          .borderRadius(px2vp(15))
+          .height(px2vp(80))
+          .backgroundColor($r('app.color.black_10'))
+          .margin({ right: px2vp(24) })
+
+          Row() {
             Text('自动入库')
               .textAlign(TextAlign.Center)
               .borderRadius(px2vp(16))
@@ -212,10 +215,10 @@ struct Warehousing{
               .height('100%')
               .fontWeight(FontWeight.Medium)
               .fontSize(px2vp(24))
-              .fontColor(this.inboundButton===0?$r('app.color.black_90'):$r('app.color.black_60'))
-              .backgroundColor(this.inboundButton===0?$r('app.color.process_divider_white_color'):'')
-              .onClick(()=>{
-                this.inboundButton=0
+              .fontColor(this.inboundButton === 0 ? $r('app.color.black_90') : $r('app.color.black_60'))
+              .backgroundColor(this.inboundButton === 0 ? $r('app.color.process_divider_white_color') : '')
+              .onClick(() => {
+                this.inboundButton = 0
               })
             Blank()
             Text('手动入库')
@@ -225,10 +228,10 @@ struct Warehousing{
               .height('100%')
               .fontWeight(FontWeight.Medium)
               .fontSize(px2fp(24))
-              .fontColor(this.inboundButton===1?$r('app.color.black_90'):$r('app.color.black_60'))
-              .backgroundColor(this.inboundButton===1?$r('app.color.process_divider_white_color'):'')
-              .onClick(()=>{
-                this.inboundButton=1
+              .fontColor(this.inboundButton === 1 ? $r('app.color.black_90') : $r('app.color.black_60'))
+              .backgroundColor(this.inboundButton === 1 ? $r('app.color.process_divider_white_color') : '')
+              .onClick(() => {
+                this.inboundButton = 1
               })
             Blank()
             Text('统计')
@@ -238,10 +241,10 @@ struct Warehousing{
               .height('100%')
               .fontWeight(FontWeight.Medium)
               .fontSize(px2vp(24))
-              .fontColor(this.inboundButton===2?$r('app.color.black_90'):$r('app.color.black_60'))
-              .backgroundColor(this.inboundButton===2?$r('app.color.process_divider_white_color'):'')
-              .onClick(()=>{
-                this.inboundButton=2
+              .fontColor(this.inboundButton === 2 ? $r('app.color.black_90') : $r('app.color.black_60'))
+              .backgroundColor(this.inboundButton === 2 ? $r('app.color.process_divider_white_color') : '')
+              .onClick(() => {
+                this.inboundButton = 2
               })
           }.width(px2vp(923))
           .borderRadius(px2vp(15))
@@ -249,22 +252,30 @@ struct Warehousing{
           .backgroundColor($r('app.color.black_10'))
         }.width('100%')
         .height('8%')
-        .padding({left:px2vp(24),right:px2vp(24)})
-        if (this.inboundButton===0&&this.warehouseButton===0){
+        .padding({ left: px2vp(24), right: px2vp(24) })
+
+        if (this.inboundButton === 0 && this.warehouseButton === 0) {
           //自动入库
-          IntelligentWarehousingGo({scanStorageList:this.scanStorageList,entranceWaiting:this.entranceWaiting,
+          IntelligentWarehousingGo({
+            scanStorageList: this.scanStorageList,
+            entranceWaiting: this.entranceWaiting,
             ///料箱状态
-           materialBox:this.materialBox,weight:this.weight,binCode:this.binCode,
-       MaterialInformation:this.MaterialInformation,vehicleLevel:this.vehicleLevel,
-            contraband:this.contraband,automaticWarehousing:this.automaticWarehousing,
-            boxMaterials:this.boxMaterials})
-        }else if (this.inboundButton===2&&this.warehouseButton===0){
+            materialBox: this.materialBox,
+            weight: this.weight,
+            binCode: this.binCode,
+            MaterialInformation: this.MaterialInformation,
+            vehicleLevel: this.vehicleLevel,
+            contraband: this.contraband,
+            automaticWarehousing: this.automaticWarehousing,
+            boxMaterials: this.boxMaterials
+          })
+        } else if (this.inboundButton === 2 && this.warehouseButton === 0) {
           //统计
-          Column(){
+          Column() {
             Statistics()
           }.width('100%')
           .height('92%')
-        }else if (this.inboundButton===1&&this.warehouseButton===0) {
+        } else if (this.inboundButton === 1 && this.warehouseButton === 0) {
           //手动入库
           ManualWarehousing()
         }
@@ -276,12 +287,14 @@ struct Warehousing{
     .backgroundColor($r('app.color.title_bar_background'))
   }
 }
+
 //RFID读取失败弹窗
 @CustomDialog
-struct RfidCar{
+struct RfidCar {
   controller: CustomDialogController
+
   build() {
-    Column(){
+    Column() {
       Text('RFID读取失败')
         .fontWeight(FontWeight.Medium)
         .fontSize($r('app.float.fontSize_50'))
@@ -295,13 +308,14 @@ struct RfidCar{
         .height(px2vp(70))
         .borderRadius(px2vp(75))
         .fontSize($r('app.float.fontSize_20'))
-        .onClick(()=>{
+        .onClick(() => {
           this.controller.close()
         })
 
-    }.width(px2vp(924))
+    }
+    .width(px2vp(924))
     .height(px2vp(536))
-    .padding({top:px2vp(60),bottom:px2vp(60)})
+    .padding({ top: px2vp(60), bottom: px2vp(60) })
     .borderRadius($r('app.float.borderRadius_16'))
     .backgroundColor($r('app.color.white_100'))
   }

+ 52 - 34
entry/src/main/ets/pages/process/ProcessHome.ets

@@ -19,12 +19,10 @@ struct ProcessHome {
   @State selectProcess: number = 0
   // 扫描到的序列号
   @State seqNo: string = '6030100001261-20240515-8'
-
   // 统计——当前订单
   @State planNum?: number = 0
   @State completeNum?: number = 0
   @State bugNum?: number = 0
-
   private orderPageNo: number = 1
   private orderPageSize: number = 10
   @State orderTotalCount?: number = 0
@@ -33,10 +31,10 @@ struct ProcessHome {
   async aboutToAppear() {
     // 查询订单数据
     let res = await this.queryOrderList()
-    if (res.totalCount===undefined) {
+    if (res.totalCount === undefined) {
       return
     }
-    if (res.totalPages===undefined) {
+    if (res.totalPages === undefined) {
       return
     }
     this.orderTotalCount = res.totalCount
@@ -67,7 +65,7 @@ struct ProcessHome {
 
   build() {
     Column() {
-      TitleStateComp( )
+      TitleStateComp()
       Row() {
         // 订单展示
         Column() {
@@ -79,8 +77,8 @@ struct ProcessHome {
           .height('8%')
           .justifyContent(FlexAlign.Start)
 
-          List({space: 10}) {
-            ForEach(this.orderArray, (item: OrderInfo, index: number)=>{
+          List({ space: 10 }) {
+            ForEach(this.orderArray, (item: OrderInfo, index: number) => {
               ListItem() {
                 Column() {
                   Row() {
@@ -142,10 +140,12 @@ struct ProcessHome {
 
                   // 当前订单统计信息
                   Row() {
-                    Row() {}
+                    Row() {
+                    }
                     .width('5%')
+
                     Column() {
-                      Text(item.planNum ? (item.planNum | 0) + ''  : '')
+                      Text(item.planNum ? (item.planNum | 0) + '' : '')
                         .fontSize($r('app.float.fontSize_38'))
                         .fontWeight(FontWeight.Bold)
                         .fontColor(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
@@ -156,15 +156,19 @@ struct ProcessHome {
                         .fontColor(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
                         .opacity($r('app.float.card_font_default_opacity'))
                     }
-                    Row(){}
+
+                    Row() {
+                    }
                     .width('4%')
+
                     Divider()
                       .vertical(true)
                       .color(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
                       .strokeWidth('1px')
                       .opacity(this.selectOrder === index ? 0.2 : 1)
                       .height('60%')
-                    Row(){}
+                    Row() {
+                    }
                     .width('4%')
 
                     Column() {
@@ -187,7 +191,10 @@ struct ProcessHome {
                         .textAlign(TextAlign.Center)
                         .fontSize($r('app.float.fontSize_20'))
                         .fontColor($r('app.color.general_font_white_color'))
-                        .borderRadius({topLeft: $r('app.float.general_border_radius'), bottomRight: $r('app.float.general_border_radius')})
+                        .borderRadius({
+                          topLeft: $r('app.float.general_border_radius'),
+                          bottomRight: $r('app.float.general_border_radius')
+                        })
                         .backgroundColor((item.workOrderState && item.workOrderState === '4' ? $r('app.color.order_producing_state_background') : (item.workOrderState && item.workOrderState === '6' ? $r('app.color.order_finished_state_background') : $r('app.color.order_wait_state_background'))))
                         .width($r('app.float.order_state_width'))
                         .height($r('app.float.order_state_height'))
@@ -224,7 +231,7 @@ struct ProcessHome {
           .scrollBar(BarState.Off)
           // 未完成订单大于10条,触底再去查询
           .onReachEnd(async () => {
-            if (!this.orderTotalPages || this.orderTotalPages <= 1){
+            if (!this.orderTotalPages || this.orderTotalPages <= 1) {
               return
             }
             if (this.orderPageNo >= this.orderTotalPages) {
@@ -247,7 +254,7 @@ struct ProcessHome {
           .width('100%')
           .height('8%')
 
-          List({space:px2vp(5)}) {
+          List({ space: px2vp(5) }) {
             ForEach(this.processes, (item: ProcessData, index: number) => {
               ListItem() {
                 Column() {
@@ -257,7 +264,11 @@ struct ProcessHome {
                       .height(px2vp(88))
                       .textAlign(TextAlign.Center)
                       .borderRadius(px2vp(500))
-                      .border({ width: 2, color: this.selectProcess === index ? Color.White : Color.Black, style: BorderStyle.Solid })
+                      .border({
+                        width: 2,
+                        color: this.selectProcess === index ? Color.White : Color.Black,
+                        style: BorderStyle.Solid
+                      })
 
                     Text(item.operationName)
                       .fontSize($r('app.float.fontSize_24'))
@@ -301,7 +312,7 @@ struct ProcessHome {
                     // })
                   })
 
-                  if (index < (this.processes?.length ? this.processes?.length! - 1: 0)) {
+                  if (index < (this.processes?.length ? this.processes?.length! - 1 : 0)) {
                     Row() {
                       Divider()
                         .vertical(true)
@@ -349,6 +360,7 @@ struct ProcessHome {
               }
               .width('85%')
               .height('22%')
+
               Row() {
                 OrderStatisticsComp({
                   planNum: $planNum,
@@ -373,11 +385,15 @@ struct ProcessHome {
               .height('22%')
               .justifyContent(FlexAlign.Start)
 
-              OperateCard({operateName: '物料流转', operateImage:$r("app.media.material_circulation"), clickEvent: ()=>{
-                router.pushUrl({
-                  url: 'pages/process/MaterialCirculationPage',
-                })
-              }})
+              OperateCard({
+                operateName: '物料流转',
+                operateImage: $r("app.media.material_circulation"),
+                clickEvent: () => {
+                  router.pushUrl({
+                    url: 'pages/process/MaterialCirculationPage',
+                  })
+                }
+              })
               // Row() {
               //   Row() {
               //     Text('取暂存料')
@@ -407,8 +423,8 @@ struct ProcessHome {
               // .width('90%')
               // .alignItems(VerticalAlign.Top)
               // .justifyContent(FlexAlign.Center)
-              OperateCard({operateName: '生产履历', operateImage:$r("app.media.product_history"), clickEvent: ()=>{
-              }})
+              OperateCard({ operateName: '生产履历', operateImage: $r("app.media.product_history"), clickEvent: () => {
+              } })
             }
             .height('100%')
             .layoutWeight(1)
@@ -430,6 +446,7 @@ struct ProcessHome {
           .width('80%')
           .height('25%')
           .justifyContent(FlexAlign.Center)
+
           Row() {
             Row() {
               Row() {
@@ -438,6 +455,7 @@ struct ProcessHome {
               }
               .width('8%')
               .justifyContent(FlexAlign.End)
+
               // .onClick(async ()=>{
               //   // todo 应该对接扫码枪,扫描到序列号,然后处理以下逻辑
               //   let res: StartWorkInfo = await JGRequest.post("/api/v1/process/info/scan", {
@@ -480,11 +498,11 @@ struct ProcessHome {
                 .enableKeyboardOnFocus(false)
                 .borderRadius($r('app.float.robot_set_radius'))
                 .backgroundColor($r('app.color.general_font_white_color'))
-                .onClick(()=>{
+                .onClick(() => {
                   router.pushUrl({
                     url: 'pages/process/ProcessStepPage',
                     params: {
-                     // startWorkInfo: res,
+                      // startWorkInfo: res,
                       processInfo: this.processes[this.selectProcess],
                       processes: this.processes,
                     }
@@ -493,7 +511,7 @@ struct ProcessHome {
                 .onChange((value: string) => {
                   this.seqNo = value
                 })
-                .onSubmit(async ()=>{
+                .onSubmit(async () => {
                   let res: StartWorkInfo = await JGRequest.post("/api/v1/process/info/scan", {
                     operationId: Number.parseInt((this.processes && this.processes[this.selectProcess] && this.processes[this.selectProcess].operationId ? this.processes[this.selectProcess].operationId : '0')),
                     qrCode: this.seqNo ? this.seqNo : '',
@@ -531,11 +549,11 @@ struct ProcessHome {
     .height('100%')
     .width('100%')
   }
-
 }
 
 // 统一的标题文字样式
-@Extend(Text) function titleFont(){
+@Extend(Text)
+function titleFont() {
   .fontSize($r('app.float.fontSize_38'))
   .fontWeight(FontWeight.Medium)
   .fontColor($r('app.color.general_font_color'))
@@ -544,8 +562,8 @@ struct ProcessHome {
 
 @Component
 struct OperateCard {
-  startWorkInfo:undefined | StartWorkInfo={}
-  operateName: string =''
+  startWorkInfo: undefined | StartWorkInfo = {}
+  operateName: string = ''
   operateImage?: Resource
   clickEvent?: Function
   controller: web_webview.WebviewController = new web_webview.WebviewController();
@@ -567,12 +585,12 @@ struct OperateCard {
       .backgroundColor($r('app.color.general_card_background_color'))
       .borderRadius($r('app.float.general_border_radius'))
       .justifyContent(FlexAlign.SpaceBetween)
-      .padding({left: 12, right: 12})
-      .onClick(()=>{
+      .padding({ left: 12, right: 12 })
+      .onClick(() => {
         router.pushUrl({
-          url:"pages/process/MaterialCirculation"
+          url: "pages/process/MaterialCirculation"
         })
-       })
+      })
     }
     .height('25%')
     .width('90%')

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 679 - 534
entry/src/main/ets/view/CompleteSet.ets


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 430 - 267
entry/src/main/ets/view/ManualOutbound.ets


+ 66 - 87
entry/src/main/ets/view/ManualWarehousing.ets

@@ -5,6 +5,8 @@ import RequestParamModel from '../viewmodel/RequestParamModel'
 import { Materialpositionclass, ScanStorageclass } from './IntelligentWarehousingOutbound'
 import CommonConstants from '../common/constants/CommonConstants'
 import promptAction from '@ohos.promptAction'
+import { EmptyBoxInfoModel, StationInfoModel } from '../model/StorageSpace'
+import { outBoxClass } from './CompleteSet'
 
 export interface stat2 {
   statNo?: string
@@ -17,6 +19,7 @@ export interface stat2 {
   ts?: string
   RFID?: string
   UID?: string
+  kg?: number
 
 }
 
@@ -64,9 +67,7 @@ export struct ManualWarehousing {
   textController: TextInputController = new TextInputController()
   //齐套料箱重量
   @State BoxWeight: number = 20
-  //硬件数据
-  @State private entranceWaiting: Array<stat2> = []
-  @State private recentlyRecordObject: stat2 = {}
+  @State private recentlyRecordObject: StationInfoModel = {}
   currentTimer: number = -1;
   //扫码请求
   ScanStorageCode = async (itemCode: string) => {
@@ -123,12 +124,14 @@ export struct ManualWarehousing {
     gridCount: 4,
     customStyle: true,
   })
-  locationRequest = async (): Promise<stat2> => {
-    let res: Record<string, string> = await EquipmentRequest.get("api/v1/device/data/recentlyRecord/SGHRI3LR48500") //获取读写器(编号SGHRI3LR48500)上RFID标签数据(字符串)
-    console.log('testTag1' + '-------------' + JSON.stringify(res))
-    this.recentlyRecordObject = res.data as stat2
+  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) {
+    if (this.recentlyRecordObject && this.recentlyRecordObject.rfid) {
       this.materialGridStatus = 1
     }
     // 有数据 {"code":200,"message":"ok","data":{"RFID":"2024080613602207","UID":"992fa202530104e0","errCode":"0","ts":"1722568500"}}
@@ -140,7 +143,7 @@ export struct ManualWarehousing {
     let res: MaterialInformationList[] = await StorageRequest.post("/api/v1/wmsOrder/inBox", {
       houseNo: '1',
       stanCode: CommonConstants.STATION_CODE,
-      vehicleCode: this.recentlyRecordObject.RFID,
+      vehicleCode: this.recentlyRecordObject.rfid,
       detailsList: this.boxMaterials
     } as RequestParamModel)
     console.log('testTag', 'aaaaaaaa1' + JSON.stringify(res));
@@ -159,8 +162,8 @@ export struct ManualWarehousing {
   //硬件请求入库操作
   warehousingHttp = async (): Promise<MaterialInformationList> => {
     let res: MaterialInformationList = await StorageRequest.post("/api/v1/wcs/stockin", {
-      boxNo: this.entranceWaiting[0].rfid!,
-      position: "stat2",
+      boxNo: this.recentlyRecordObject.rfid,
+      position: CommonConstants.STATION_CODE,
       mtype: this.vehicleLevel
     } as RequestParamModel)
     console.log('testTag1', '----------' + JSON.stringify(res));
@@ -176,46 +179,29 @@ export struct ManualWarehousing {
     this.MaterialInformation = res
     return res
   }
+  callEmptyBoxFun = async () => {
+    this.emptyBox = 1 //表明正在取的进度
+    let res: EmptyBoxInfoModel = await StorageRequest.post("/api/v1/stock/queryEmptyBox")
+    console.log("QQQ", JSON.stringify(res), res?.vehicleNo)
+    let outRes: outBoxClass = await StorageRequest.post("/api/v1/wmsOrder/outBox", {
+      stanCode: CommonConstants.STATION_CODE,
+      vehicleNo: res!.vehicleNo,
+      houseNo: res!.houseNo
+    } as RequestParamModel)
+    promptAction.showToast({
+      message: "箱子正在运行中....",
+      duration: 1800,
+      bottom: '50%'
+    })
+
+    console.log("QQQ", JSON.stringify(outRes), outRes?.orderId)
+
+  }
 
   //打开页面0.5s请求一次硬件,当io(有无料箱)和weight(重量)发送变化时执行改变数据,同时通过RFID请求读取料箱里面物料信息
   async aboutToAppear() {
     this.currentTimer = setInterval(async () => {
-      console.log('testTag1' + '-------------')
-      this.locationRequest().then((res: stat2) => {
-        this.entranceWaiting.push(res)
-        console.log('testTag1' + '-------------' + JSON.stringify(res))
-        //    右侧取料箱和入库的赋值
-
-
-      })
-
-
-      //todo 测试料箱有的时候
-      //this.materialGridStatus=1
-      // if (this.entranceWaiting.length > 0 && Number(this.entranceWaiting[0].io)!==this.materialGridStatus) {
-      //
-      //   //this.materialGridStatus=Number(this.entranceWaiting[0].io)
-      //   console.log('testTag1'+'返回1表示有料箱,0无'+this.entranceWaiting[0].io)
-      //   //todo 通过rfid获得料箱编码
-      //  // this.materialNo="ZJ-JG013"
-      //   this.materialNo=this.entranceWaiting[0].rfid!
-      //
-      //   console.log('testTag1'+this.materialBox)
-      //   // 料箱来了执行请求获得料箱里面物料信息
-      //   this.boxMaterialHttp().then((res :MaterialInformationList[]) => {
-      //     console.log('testTag', 'result cccccc22'+JSON.stringify(res))
-      //     if (res && res.length > 0) {
-      //       this.MaterialInformation = res
-      //       this.vehicleLevel=res[0].vehicleLevel!
-      //     }
-      //   })
-      //   if (this.entranceWaiting[0].rfid!.length>0) {
-      //     this.drawerPositionStatus=1
-      //     //RFID长度等于零,但是有料箱说明RFID读取失败
-      //   }else if (this.entranceWaiting[0].rfid!.length===0&&Number(this.entranceWaiting[0].io)===1){
-      //     this.RfidCarController.open()
-      //   }
-      // }
+      this.locationRequest()
     }, 1000);
   }
 
@@ -257,7 +243,8 @@ export struct ManualWarehousing {
                   .fontColor($r('app.color.process_nameplate_grey_color'))
                   .focusable(true)
                   .defaultFocus(true)
-                Text(this.BoxWeight.toString() + 'Kg')
+                // Text(this.BoxWeight.toString() + 'Kg')
+                Text(this.recentlyRecordObject.weight ?? "" + "Kg")
                   .textAlign(TextAlign.End)
                   .width('48%')
                   .height('25%')
@@ -272,7 +259,9 @@ export struct ManualWarehousing {
                   .fontWeight(FontWeight.Regular)
                   .fontSize($r('app.float.fontSize_20'))
                   .fontColor($r('app.color.process_nameplate_grey_color'))
-                Text(this.recentlyRecordObject.RFID)
+                  .focusable(true)
+                  .defaultFocus(false)
+                Text(this.recentlyRecordObject.rfid)
                   .textAlign(TextAlign.End)
                   .width('100%')
                   .height('25%')
@@ -627,7 +616,7 @@ export struct ManualWarehousing {
               .fontSize($r('app.float.fontSize_24'))
               .fontColor($r('app.color.black_90'))
             Blank()
-            Text('出库料箱ID')
+            Text('料箱ID')
               .textAlign(TextAlign.End)
               .width('48%')
               .height('20%')
@@ -652,16 +641,6 @@ export struct ManualWarehousing {
         .height('30%')
         .borderRadius($r('app.float.borderRadius_16'))
 
-        //todo 暂时用于触发入库和取空箱的切换,更具硬件接口更改
-        // .onClick(()=>{
-        //   if (this.materialGridStatus===0) {
-        //     this.materialGridStatus=1
-        //     this.emptyBox=0
-        //   }else if (this.materialGridStatus===1){
-        //     this.materialGridStatus=0
-        //   }
-        //
-        // })
         Button(this.materialGridStatus === 1 ? '入库' : '取空箱')
           .fontSize($r('app.float.fontSize_24'))
           .fontColor($r('app.color.general_font_white_color'))
@@ -672,39 +651,39 @@ export struct ManualWarehousing {
             (this.drawerPositionStatus === 1 && this.materialGridStatus === 0 ? $r('app.color.blue_100') : $r('app.color.blue_20'))))
           .onClick(() => {
             if (this.materialGridStatus === 0) {
-              this.emptyBox = 1
+              this.callEmptyBoxFun()
             }
             if (this.materialGridStatus === 1) {
               this.Warehousing()
             }
 
           })
-        if (this.emptyBox === 1) {
-
-          Column() {
-            Text('正在取空箱,当前进度1/' + this.callBoxNum + '...')
-              .textAlign(TextAlign.Center)
-              .borderRadius(px2vp(16))
-              .width('100%')
-              .height('25%')
-              .fontWeight(FontWeight.Bold)
-              .fontSize($r('app.float.fontSize_24'))
-              .fontColor($r('app.color.black_90'))
-            Text(this.materialGridStatus === 1 ? '请取出料箱' : this.drawerPositionStatus === 2 && this.materialGridStatus === 0 ? '请将料格推入' : '')
-              .textAlign(TextAlign.Center)
-              .borderRadius(px2vp(16))
-              .width('100%')
-              .height('25%')
-              .fontWeight(FontWeight.Bold)
-              .fontSize($r('app.float.fontSize_24'))
-              .fontColor($r('app.color.black_90'))
-
-          }
-          .width('100%')
-          .height('60%')
-          .justifyContent(FlexAlign.Center)
-
-        }
+        // if (this.emptyBox === 1) {
+        //
+        //   Column() {
+        //     Text('正在取空箱,当前进度1/' + this.callBoxNum + '...')
+        //       .textAlign(TextAlign.Center)
+        //       .borderRadius(px2vp(16))
+        //       .width('100%')
+        //       .height('25%')
+        //       .fontWeight(FontWeight.Bold)
+        //       .fontSize($r('app.float.fontSize_24'))
+        //       .fontColor($r('app.color.black_90'))
+        //     Text(this.materialGridStatus === 1 ? '请取出料箱' : this.drawerPositionStatus === 2 && this.materialGridStatus === 0 ? '请将料格推入' : '')
+        //       .textAlign(TextAlign.Center)
+        //       .borderRadius(px2vp(16))
+        //       .width('100%')
+        //       .height('25%')
+        //       .fontWeight(FontWeight.Bold)
+        //       .fontSize($r('app.float.fontSize_24'))
+        //       .fontColor($r('app.color.black_90'))
+        //
+        //   }
+        //   .width('100%')
+        //   .height('60%')
+        //   .justifyContent(FlexAlign.Center)
+        //
+        // }
 
 
       }.width(px2vp(608))

+ 4 - 1
entry/src/main/ets/viewmodel/RequestParamModel.ets

@@ -1,4 +1,5 @@
 //通用请求后台参数
+import { MaterialInformationList } from '../model/MaterialInformation'
 import { InDataClass } from '../pages/RfidAllocation'
 import { detailsListvlass } from '../view/IntelligentWarehousingOutbound'
 import MaterialInfo from './MaterialInfo'
@@ -22,7 +23,7 @@ export default class RequestParamModel {
   materialNo?:string
   vehicleNo?:string
   materialCode?:string
-  operationId?:number
+  operationId?:number|string
   qrCode?:string
   workOrderCode?:string
   pageNo?:number
@@ -59,4 +60,6 @@ export default class RequestParamModel {
   creator?: string
   state?:number
   orderId?:string
+  processVehicleMaterialList?:MaterialInformationList[]
+
 }