Browse Source

调仓修改

dengrui 3 months ago
parent
commit
5fc6f37bf8
1 changed files with 39 additions and 18 deletions
  1. 39 18
      entry/src/main/ets/pages/WarehouseMap.ets

+ 39 - 18
entry/src/main/ets/pages/WarehouseMap.ets

@@ -22,6 +22,10 @@ export class Adjustment {
   state?: string
 }
 
+export class boxItem {
+  boxNo?: string
+  position?: string
+}
 export class carPositionClass {
   code?: string
   message?: string
@@ -84,6 +88,8 @@ export struct WarehouseMap {
   //调出xy坐标
   @State YCoordinate: number = 0
   @State XCoordinate: number = 0
+  //点击的料格详情
+  @State boxInfo:boxItem[] = []
   //调入格子
   @State SelectEnter: number = ChooseStatus.Normal
   //调出格子
@@ -136,6 +142,19 @@ export struct WarehouseMap {
 
     return res
   }
+  getBoxNo = (num:number) :string =>{
+    const res:boxItem [] = this.boxInfo.filter(item=> item.position==num.toString())
+    if(res.length>0){
+      return res[0].boxNo as string
+    }else{
+      return ''
+    }
+  }
+  //获取当前选择料格详情
+  getBoxInfos = async(y:string,x:string)=>{
+    let res: boxItem[] = await StorageRequest.get("/api/v1/wms/position/lineStockDetails/"+x+'-'+y)
+    this.boxInfo=res;
+  }
   // 获取仓库坐标信息,x和y轴的信息
   getStorageXYData = async () => {
     let result: number[][] = await StorageRequest.post("/api/v1/wms/position/lineInfo/")
@@ -214,12 +233,12 @@ export struct WarehouseMap {
           List({ space: px2vp(20) }) {
             ForEach(this.storey, (item: number, index: number) => {
               ListItem() {
-                Text(item.toString())
+                Text(this.getBoxNo(item))
                   .width(px2vp(291))
                   .height(px2vp(80))
                   .fontColor($r('app.color.black_100'))
                   .textAlign(TextAlign.Center)
-                  .border({ width: px2vp(1) })
+                  .border({ width: this.getBoxNo(item)? px2vp(1) : 0 })
                   .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(() => {
@@ -325,7 +344,8 @@ export struct WarehouseMap {
                             if (Number(x) > 0) {
                               Text(x.toString())
                                 .commonSquare().backgroundColor($r('app.color.green_100'))
-                                .onClick(() => {
+                                .onClick(async () => {
+                                  await this.getBoxInfos(index1.toString(),index2.toString())
                                   this.YCoordinate = index1
                                   this.XCoordinate = index2
                                   this.SelectOut = ChooseStatus.Chosen
@@ -498,20 +518,20 @@ export struct WarehouseMap {
           .backgroundColor($r('app.color.black_10'))
           .margin({ bottom: px2vp(48) })
 
-          Column() {
-            Text('调箱数量' + this.boxNumber)
-              .fontWeight(FontWeight.Medium)
-              .fontColor($r('app.color.black_100'))
-              .fontSize($r('app.float.fontSize_24'))
-              .width(px2vp(410))
-              .textAlign(TextAlign.Start)
-          }
-          .width(px2vp(450))
-          .padding(px2vp(20))
-          .alignItems(HorizontalAlign.Center)
-          .borderRadius(px2vp(16))
-          .backgroundColor($r('app.color.black_10'))
-          .margin({ bottom: px2vp(48) })
+          // Column() {
+          //   Text('调箱数量' + this.boxNumber)
+          //     .fontWeight(FontWeight.Medium)
+          //     .fontColor($r('app.color.black_100'))
+          //     .fontSize($r('app.float.fontSize_24'))
+          //     .width(px2vp(410))
+          //     .textAlign(TextAlign.Start)
+          // }
+          // .width(px2vp(450))
+          // .padding(px2vp(20))
+          // .alignItems(HorizontalAlign.Center)
+          // .borderRadius(px2vp(16))
+          // .backgroundColor($r('app.color.black_10'))
+          // .margin({ bottom: px2vp(48) })
 
           Button('确认调仓', { type: ButtonType.Normal, stateEffect: true }).choiceBtnSty()
             .backgroundColor((this.SelectEnter == ChooseStatus.Chosen && this.SelectOut == ChooseStatus.Chosen) ? $r('app.color.blue_100') : $r('app.color.blue_20'))
@@ -553,7 +573,8 @@ export struct WarehouseMap {
     await StorageRequest.post("/api/v1/wms/common/changePosition", {
       src: `${this.XCoordinate + 1}-${this.YCoordinate + 1}`,
       dest: `${this.XCoordinateIn + 1}-${this.YCoordinateIn + 1}`,
-      num: this.boxNumber
+      num: this.boxNumber,
+      boxNo:this.boxInfo[6 - this.selectStorey].boxNo
     } as RequestParamModel)
 
     this.resetData()