jiaxiaoqiang преди 7 месеца
родител
ревизия
4a26db5056

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

@@ -11,7 +11,8 @@ import CommonConstants from '../../constants/CommonConstants';
 import { printError, printRequest, printResponse, handleRes } from './Helps';
 
 // const baseUrl = "http://10.88.20.188:8079/"
-const baseUrl = "http://10.88.11.200:8079/"
+// const baseUrl = "http://10.88.11.200:8079/"
+const baseUrl = "http://192.168.101.4:8079/"
 
 // 创建实例
 const JGRequest = axios.create(

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

@@ -10,7 +10,8 @@ import CommonConstants from '../../constants/CommonConstants';
 import { printError, printRequest, printResponse, handleRes } from './Helps';
 
 // const baseUrl = "http://10.88.20.188:8079/"
-const baseUrl = "http://10.88.11.200:8079/"
+// const baseUrl = "http://10.88.11.200:8079/"
+const baseUrl = "http://192.168.101.4:8079/"
 const DEBUG = true //
 
 // 创建实例

+ 110 - 112
entry/src/main/ets/view/CompleteSet.ets

@@ -81,7 +81,9 @@ export struct CompleteSet {
   //点击扫描料箱切换成齐套料箱编码
   @State clickScan: number = 0
   //物料列表
+  @State scanCodeMIndex: number = 2 //齐套料箱扫码后对应的最左侧的index
   @State materialArray: MaterialInfo[] = []
+  materialController: Scroller = new Scroller()
   // 中间输入框绑定的值
   @State scanCodeValue: string = ""
   //工单分页查询相关参数
@@ -140,7 +142,7 @@ export struct CompleteSet {
   @State private MaterialInformation: Array<MaterialInformationModel> = []
   ScanStorageCode = async (itemCode: string) => {
 
-    this.scanCodeValue = ""
+    this.scanCodeValue = "BM51264341413217;SL9;PHthi5558;"
     let res: MaterialInformationModel = await StorageRequest.post("/api/v1/process/circulation/material", {
       label: itemCode //"#gys022#sc022#100#20220929#31"
     } as MaterialInformationModel)
@@ -148,6 +150,24 @@ export struct CompleteSet {
     //let res = await StorageRequest.get("/api/v3/stock/selectSafeList/1")
     // {"batchCode":"BM47111400130447;SL5","codeType":"BATCH","materialCode":"47111400130447","materialName":"穿心电容","num":5,"spec":"G CT52-4-1-2C1-63V-103-M","unitDictLabel":"个","unitDictValue":"个"}
     let obj: MaterialInformationModel = JSON.parse(JSON.stringify(res))
+    // 判断扫描完成后返回的物料码是否是当前需要齐套的物料
+    let hasCode: boolean = false
+    for (let i = 0; i < this.materialArray.length; i++) {
+      if (obj.materialCode == this.materialArray[i].materialCode) {
+        hasCode = true
+        this.scanCodeMIndex = i
+        break
+      }
+    }
+    if (!hasCode) {
+      promptAction.showToast({
+        message: "不是当前工序中的物料",
+        bottom: "50%",
+        duration: 2000
+      })
+      return
+    }
+    this.materialController.scrollToIndex(this.scanCodeMIndex)
 
 
     // 扫码完成之后,如果数组中有对应的值,就添加数量否则就push
@@ -250,6 +270,7 @@ export struct CompleteSet {
         // if (res.records) {
         //
         // }
+        this.scanCodeMIndex = -1
         this.materialArray = res.records ?? []
         this.textController.stopEditing()
       }
@@ -484,6 +505,8 @@ export struct CompleteSet {
                   this.currentWorkOrderCode = item.workOrderCode ?? ""
                   this.orderId = item.taskId!
                   if (item?.workOrderCode && item.workOrderCode.length > 0) {
+                    this.selectProcessController.open()
+                    this.selectOrder = index
                     this.processes = await StorageRequest.get("/api/v1/process/vehicleOperation/operation/" + item.workOrderCode, {
                     })
                   }
@@ -491,8 +514,7 @@ export struct CompleteSet {
                   //   this.selectProcess = {}
                   //   this.processes = []
                   // }
-                  this.selectProcessController.open()
-                  this.selectOrder = index
+
                 })
                 .width(px2vp(608))
                 .padding(8)
@@ -568,10 +590,10 @@ export struct CompleteSet {
           }
           .width('100%')
           .height('10%')
-          .margin({ bottom: px2vp(20) })
+          .margin({ bottom: "2%" })
 
           Column() {
-            List({ space: 5 }) {
+            List({ space: 3, scroller: this.materialController }) {
               ForEach(this.materialArray, (item: MaterialInfo, index: number) => {
                 ListItem() {
                   Row() {
@@ -581,25 +603,26 @@ export struct CompleteSet {
                         .fontWeight(FontWeight.Medium)
                         .fontColor($r('app.color.black_90'))
                         .width('100%')
-                        .height('20%')
+
                       Text(item.materialCode)
                         .fontWeight(FontWeight.Regular)
                         .fontSize($r('app.float.fontSize_20'))
                         .fontColor($r('app.color.black_60'))
                         .width('100%')
-                        .height('20%')
-                      Blank()
+
+
                       Text(item.completeNum?.toString() + '/' + item.totalMaterial?.toString())
                         .fontSize($r('app.float.fontSize_24'))
                         .fontColor($r('app.color.black_90'))
                         .fontWeight(FontWeight.Bold)
                         .width('100%')
-                        .height('20%')
+                        .margin({ top: 8 })
+
                       Text('已拣/总需')
                         .fontSize($r('app.float.fontSize_20'))
                         .fontColor($r('app.color.black_60'))
                         .width('100%')
-                        .height('20%')
+
 
                     }
                     .width('70%')
@@ -607,32 +630,29 @@ export struct CompleteSet {
                     .borderRadius(px2vp(16))
                     .alignItems(HorizontalAlign.Start)
                     .justifyContent(FlexAlign.Center)
-                    .height('100%')
-
-                    if (item.completeNum! === item.totalMaterial!) {
-                      Column() {
-                        Image($r('app.media.collect_completed'))
-                          .width(px2vp(80))
-                          .height(px2vp(80))
-                          .borderRadius(px2vp(16))
-                      }
-                      .justifyContent(FlexAlign.Start)
-                      .width('30%')
-                      .height('100%')
-                      .borderRadius(px2vp(16))
-                    }
+
+
+                    // if (item.completeNum! === item.totalMaterial!) {
+                    //   Column() {
+                    //     Image($r('app.media.collect_completed'))
+                    //       .width(px2vp(80))
+                    //       .height(px2vp(80))
+                    //       .borderRadius(px2vp(16))
+                    //   }
+                    //   .justifyContent(FlexAlign.Start)
+                    //   .width('30%')
+                    //
+                    //   .borderRadius(px2vp(16))
+                    // }
+
                   }
-                  .padding(10)
+                  .border({ width: this.scanCodeMIndex === index ? 3 : 0, color: $r("app.color.warn_1") })
+                  .padding(8)
                   .borderRadius(10)
                   .margin(px2vp(8))
-                  .height('25%')
-                  .width(px2vp(608))
+                  .width('98%')
                   .onClick(async () => {
-
-
                     this.Materialposition(item)
-
-
                   })
                   .backgroundColor(item.completeNum! >= item.totalMaterial! ?
                   $r('app.color.green_100') : $r('app.color.robot_set_card_white'))
@@ -654,10 +674,11 @@ export struct CompleteSet {
               this.materialArray = this.materialArray?.concat(res.records as MaterialInfo[])
             })
           }
-          .width(px2vp(608))
-          .height('91%')
+          .width('100%')
+          .height('88%')
           .borderRadius($r('app.float.borderRadius_16'))
-        }.width(px2vp(608))
+        }
+        .width(px2vp(608))
         .height(px2vp(900))
         .borderRadius($r('app.float.borderRadius_16'))
       }
@@ -860,6 +881,7 @@ export struct CompleteSet {
             .width('92%')
             .height('100%')
             .width('80%')
+            .defaultFocus(false)
             .fontWeight(FontWeight.Medium)
             .fontSize('32px')
             .backgroundColor("#ffff")
@@ -875,6 +897,7 @@ export struct CompleteSet {
             .height(px2vp(32))
             .onClick(async () => {
               this.ScanStorageCode(this.scanCodeValue)
+              this.textController.stopEditing()
             })
 
         }
@@ -892,95 +915,70 @@ export struct CompleteSet {
               ListItem() {
                 Row() {
                   Column() {
-                    Column() {
-                      Row().height('23%')
-                      Text(item.materialName)
-                        .fontSize($r('app.float.fontSize_24'))
-                        .fontColor($r('app.color.general_font_color'))
-                        .fontWeight(FontWeight.Medium)
-                        .opacity($r('app.float.general_font_opacity'))
-                      Text(item.batchNo)
-                        .fontSize($r('app.float.fontSize_20'))
-                        .fontColor($r('app.color.process_nameplate_grey_color'))
-                        .fontWeight(FontWeight.Medium)
-                      Text(item.materialCode)
-                        .fontSize($r('app.float.fontSize_20'))
-                        .fontColor($r('app.color.process_nameplate_grey_color'))
-                        .fontWeight(FontWeight.Medium)
-                      Text(item.spec)
+                    Text(item.materialName)
+                      .fontSize($r('app.float.fontSize_24'))
+                      .fontColor($r('app.color.general_font_color'))
+                      .fontWeight(FontWeight.Medium)
+                      .opacity($r('app.float.general_font_opacity'))
+                    Text(item.batchNo)
+                      .fontSize($r('app.float.fontSize_20'))
+                      .fontColor($r('app.color.process_nameplate_grey_color'))
+                      .fontWeight(FontWeight.Medium)
+                    Text(item.materialCode)
+                      .fontSize($r('app.float.fontSize_20'))
+                      .fontColor($r('app.color.process_nameplate_grey_color'))
+                      .fontWeight(FontWeight.Medium)
+                    Text(item.spec)
+                      .fontSize($r('app.float.fontSize_20'))
+                      .fontColor($r('app.color.process_nameplate_grey_color'))
+                      .fontWeight(FontWeight.Medium)
+                    Row() {
+                      // 可以更改数量的输入框
+                      TextInput({ text: item.num?.toString() })
+                        .fontSize(14)
+                        .fontWeight(FontWeight.Bold)
+                        .fontColor($r('app.color.general_font_color'))// .opacity($r('app.float.general_font_opacity'))
+                        .height(30)
+                        .width(120)
+                        .type(InputType.Number)
+                        .defaultFocus(false)
+                        .textAlign(TextAlign.Start)
+                        .borderRadius(0)
+                        .border({ width: 0.4 })
+                        .onChange((value) => {
+                          item.num = Number(value)
+                        })
+                      Text(item.unitDictLabel ?? "个")
                         .fontSize($r('app.float.fontSize_20'))
                         .fontColor($r('app.color.process_nameplate_grey_color'))
                         .fontWeight(FontWeight.Medium)
                     }
-                    .height('50%')
-                    .width('90%')
-                    .alignItems(HorizontalAlign.Start)
-
-                    Column() {
-                      Row() {
-                        // 可以更改数量的输入框
-                        TextInput({ text: item.num?.toString() })
-                          .fontSize(14)
-                          .fontWeight(FontWeight.Bold)
-                          .fontColor($r('app.color.general_font_color'))// .opacity($r('app.float.general_font_opacity'))
-                          .height(30)
-                          .width(120)
-                          .type(InputType.Number)
-                          .defaultFocus(false)
-                          .textAlign(TextAlign.Start)
-                          .borderRadius(0)
-                          .border({ width: 0.4 })
-                          .onChange((value) => {
-                            item.num = Number(value)
-                          })
-                        Text(item.unitDictLabel ?? "个")
-                          .fontSize($r('app.float.fontSize_20'))
-                          .fontColor($r('app.color.process_nameplate_grey_color'))
-                          .fontWeight(FontWeight.Medium)
-                      }
-                      .width('90%')
-                      .justifyContent(FlexAlign.End)
-
-                      // Blank()
-                      // Row() {
-                      //   Image($r('app.media.subscript_space'))
-                      //     .height($r('app.float.card_subscript_new_size'))
-                      //     .width($r('app.float.card_subscript_new_size'))
-                      // }
-                      .alignItems(VerticalAlign.Bottom)
-                      .justifyContent(FlexAlign.End)
-                      .width('100%')
-                    }
-                    .height('50%')
-                    .width('100%')
-
+                    .justifyContent(FlexAlign.End)
+                    .width("100%")
+                  }
+                  .width("100%")
+                  .alignItems(HorizontalAlign.Start)
 
-                    // 删除按钮
-                    Row() {
-                      Image($r("app.media.reduce")).width(25).height(5)
-                    }
-                    .width(30)
-                    .height(30)
-                    .position({ x: '90%', y: 5 })
-                    .alignItems(VerticalAlign.Center)
-                    .justifyContent(FlexAlign.Center)
-                    .onClick(() => {
-                      this.MaterialInformation.splice(index, 1)
-                    })
+                  // 删除按钮
+                  Row() {
+                    Image($r("app.media.reduce")).width(25).height(5)
                   }
-                  .width('100%')
-                  .borderRadius($r('app.float.general_border_radius'))
-                  .alignItems(HorizontalAlign.Center)
+                  .width(30)
+                  .height(30)
+                  .position({ x: '90%', y: 3 })
+                  .alignItems(VerticalAlign.Center)
                   .justifyContent(FlexAlign.Center)
-                  .height('100%')
+                  .onClick(() => {
+                    this.MaterialInformation.splice(index, 1)
+                  })
+
                 }
+                .width("100%")
                 .borderRadius(10)
-                .height('30%')
                 .margin({ top: 5 })
-                .onClick(() => {
+                .padding(8)
+                .backgroundColor($r('app.color.robot_set_card_white'))
 
-                })
-                .backgroundColor(this.onclick === index ? $r('app.color.robot_set_card_blue') : $r('app.color.robot_set_card_white'))
               }
             })
           }