Browse Source

零星物料出库和步骤组件调整

hh 2 months ago
parent
commit
804e57cfde

+ 72 - 65
entry/src/main/ets/component/OrderMaterialsStorageView.ets

@@ -6,90 +6,97 @@ import WmsRequest from '../common/util/request/WmsRequest'
 import RequestParamModel from '../viewmodel/wms/RequestParamModel'
 @Component
 export struct ProcessFlow {
-  @Prop currentStep:number =0
-  @Prop firstStepTitle:string = ''
-  @Prop secondStepTitle:string = ''
-  @Prop thirdStepTitle:string = ''
+  @Prop currentStep: number =0
+  @Prop firstStepTitle: string = ''
+  @Prop secondStepTitle: string = ''
+  @Prop thirdStepTitle: string = ''
   build() {
     Row() {
-      // 步骤1
-      FlowStep({
-        stepNumber: 1,
-        title: this.firstStepTitle,
-        showConnector: true,
-        isChoose:this.currentStep === 1
-      })
-      // 步骤2
-      FlowStep({
-        stepNumber: 2,
-        title: this.secondStepTitle,
-        showConnector: this.thirdStepTitle!='',
-        isChoose:this.currentStep === 2
-      })
-      // 步骤3
-      if(this.thirdStepTitle!='')
-      {
-        FlowStep({
-          stepNumber: 3,
-          title: this.thirdStepTitle,
-          showConnector: false,
-          isChoose:this.currentStep === 3
-        })
+      Column({space: 5}) {
+        Stack() {
+          Circle()
+            .width($r('app.float.virtualSize_19_2'))
+            .height($r('app.float.virtualSize_19_2'))
+            .fill(this.currentStep === 1 ? $r('app.color.0A84FF') : $r('app.color.10FFFFFF'))
+          Text('1')
+            .fontSize($r('app.float.fontSize_12'))
+            .fontColor(this.currentStep === 1 ? $r('app.color.FFFFFF') : $r('app.color.60FFFFFF'))
+            .fontWeight(FontWeight.Medium)
+        }
+        .width($r('app.float.virtualSize_19_2'))
+        .height($r('app.float.virtualSize_19_2'))
+        Text(this.firstStepTitle)
+          .fontSize($r('app.float.fontSize_6_4'))
+          .fontColor(this.currentStep === 1 ? $r('app.color.FFFFFF') : $r('app.color.60FFFFFF'))
+          .fontWeight(FontWeight.Regular)
       }
-    }
-    .justifyContent(FlexAlign.Center)
-    .width('100%')
-  }
-}
-
-@Component
-struct FlowStep {
-  @Prop stepNumber: number
-  @Prop title: string
-  @Prop showConnector: boolean
-  @Prop isChoose : boolean
-  build() {
-    Row() {
-      Column() {
-        // 步骤圆圈
-        Column() {
-          Text(this.stepNumber.toString())
-            .fontColor(this.isChoose? $r('app.color.FFFFFF'):$r('app.color.60FFFFFF'))
-            .fontSize($r('app.float.fontSize_15_2'))
+      Divider()
+        .vertical(false)
+        .strokeWidth(1)
+        .layoutWeight(1)
+        .height($r('app.float.virtualSize_19_2'))
+        .color($r('app.color.15FFFFFF'))
+        .margin({
+          left: '-3%',
+          right: '-3%',// 向左延伸至圆心
+        })
+      Column({space: 5}) {
+        Stack() {
+          Circle()
+            .width($r('app.float.virtualSize_19_2'))
+            .height($r('app.float.virtualSize_19_2'))
+            .fill(this.currentStep === 2 ? $r('app.color.0A84FF') : $r('app.color.10FFFFFF'))
+          Text('2')
+            .fontSize($r('app.float.fontSize_12'))
+            .fontColor(this.currentStep === 2 ? $r('app.color.FFFFFF') : $r('app.color.60FFFFFF'))
+            .fontWeight(FontWeight.Medium)
         }
-        .width($r('app.float.virtualSize_23'))
-        .height($r('app.float.virtualSize_23'))
-        .borderRadius(20) // 圆形
-        .backgroundColor(this.isChoose? $r('app.color.0A84FF'):$r('app.color.20FFFFFF'))
-        .justifyContent(FlexAlign.Center)
-        .alignItems(HorizontalAlign.Center)
-
-        // 步骤文字
-        Text(this.title)
-          .fontColor(this.isChoose? $r('app.color.FFFFFF'):$r('app.color.60FFFFFF'))
-          .fontSize($r('app.float.fontSize_9_6'))
-          .margin({ top: 8 })
-
+        .width($r('app.float.virtualSize_19_2'))
+        .height($r('app.float.virtualSize_19_2'))
+        Text(this.secondStepTitle)
+          .fontSize($r('app.float.fontSize_6_4'))
+          .fontColor(this.currentStep === 2 ? $r('app.color.FFFFFF') : $r('app.color.60FFFFFF'))
+          .fontWeight(FontWeight.Regular)
       }
-      .justifyContent(FlexAlign.Center)
-      .alignItems(HorizontalAlign.Center)
-      if (this.showConnector) {
+      if (this.thirdStepTitle != '') {
         Divider()
           .vertical(false)
           .strokeWidth(1)
+          .layoutWeight(1)
+          .height($r('app.float.virtualSize_19_2'))
           .color($r('app.color.15FFFFFF'))
           .margin({
             left: '-3%',
             right: '-3%',// 向左延伸至圆心
             //
           })
-          .width('30%') // 自适
+        Column({space: 5}) {
+          Stack() {
+            Circle()
+              .width($r('app.float.virtualSize_19_2'))
+              .height($r('app.float.virtualSize_19_2'))
+              .fill(this.currentStep === 3 ? $r('app.color.0A84FF') : $r('app.color.10FFFFFF'))
+            Text('3')
+              .fontSize($r('app.float.fontSize_12'))
+              .fontColor(this.currentStep === 3 ? $r('app.color.FFFFFF') : $r('app.color.60FFFFFF'))
+              .fontWeight(FontWeight.Medium)
+          }
+          .width($r('app.float.virtualSize_19_2'))
+          .height($r('app.float.virtualSize_19_2'))
+          Text(this.thirdStepTitle)
+            .fontSize($r('app.float.fontSize_6_4'))
+            .fontColor(this.currentStep === 3 ? $r('app.color.FFFFFF') : $r('app.color.60FFFFFF'))
+            .fontWeight(FontWeight.Regular)
+        }
       }
     }
+    .height('100%')
+    .width('100%')
+    .justifyContent(FlexAlign.Center)
+    .alignItems(VerticalAlign.Top)
   }
 }
 
-
 @Component
 export struct OrderListComponent {
   private scrollerForList: Scroller = new Scroller()

File diff suppressed because it is too large
+ 531 - 426
entry/src/main/ets/pages/LittleMaterialOutBound.ets


+ 7 - 3
entry/src/main/ets/pages/LittleMaterialsStorage.ets

@@ -208,9 +208,13 @@ struct LittleMaterialsStorage{
               secondStepTitle:"绑定入库",
               thirdStepTitle:"",
             })
-          }.width('20%')
-          .margin({right:'20%'})
-          NavigationBar().width('20%')
+          }
+          .height('80%')
+          .width('11%')
+          Row().width('21.5%')
+          NavigationBar()
+            .height('80%')
+            .width('23%')
         }
         .width('100%')
         .height('4%')

+ 115 - 93
entry/src/main/ets/pages/OperationMaterialKit.ets

@@ -15,6 +15,9 @@ import WmsRequest from '../common/util/request/WmsRequest'
 import promptAction from '@ohos.promptAction'
 import RequestParamModel from '../viewmodel/wms/RequestParamModel'
 import CommonConstants from '../common/constants/CommonConstants'
+import RobotErrorHandleRequest from '../common/util/request/RobotErrorHandleRequest'
+import { ConfirmDialogParams, RgvInfo } from '../params/RobotsParam'
+import { CommonConfirmDialog, ProcessFlow, RemindDialog } from '../component/OrderMaterialsStorageView'
 
 @Entry
 @Component
@@ -27,9 +30,96 @@ struct OperationMaterialKit {
   @State selectOperations: OperationInfo[] = []
   // 选中工序需求的物料
   @State operationItems: OperationItem[] = []
+  // 抽屉称重(根据重量判断抽屉是否有料箱)
+  @StorageLink('materialBoxWeight') materialBoxWeight: number = 0
+  // 抽屉状态
+  @StorageLink('drawerPositionStatus') drawerPositionStatus: number = 1
+  @State reminds: string = '1'
+  commonDialogController: CustomDialogController | null = null;
+
+  remindController: CustomDialogController = new CustomDialogController({
+    builder: RemindDialog({
+      remind: this.reminds,}
+    ),
+    customStyle: true,
+    maskColor: 'rgba(0,0,0,0.6)',
+    //autoCancel:false
+  })
+
+  private showConfirmDialog(params: ConfirmDialogParams) {
+    if (this.commonDialogController) {
+      this.commonDialogController.close()
+    }
+    this.commonDialogController = new CustomDialogController({
+      builder: CommonConfirmDialog({
+        title: params.title || '提示',
+        message: params.message,
+        confirmText: params.confirmText || '确定',
+        cancelText: params.cancelText || '取消',
+        onConfirm: params.onConfirm
+      }),
+      cancel: () => console.log('用户取消操作'),
+      customStyle: true,
+      autoCancel:false,
+      maskColor: 'rgba(0,0,0,0.6)'
+    });
+    this.commonDialogController.open();
+  }
+
+  // 判断小车状态
+  async queryRgvInfo(): Promise<boolean> {
+    let res: RgvInfo = await RobotErrorHandleRequest.get('/api/v1/wcs/rgv/rgv1', {}) as RgvInfo;
+    if (res) {
+      if (res.status != '0' || res.x != res.rx || res.y != res.ry) {
+        return false;
+      }
+      return true; // 如果条件不满足,返回 true
+    }
+    return false; // 如果 res 为 null 或 undefined,返回 false
+  }
 
   // 空箱出库的方法
   callEmptyBoxFun = async () => {
+    //查询小车的状态
+    const rgvStatusNormal = await this.queryRgvInfo()
+    if(!rgvStatusNormal){
+      this.reminds = "小车状态异常或位置错误,请检查后重试"
+      this.remindController.open()
+      setTimeout(() => {
+        this.remindController.close()
+      }, 2000);
+      return
+    }
+    console.info("ssss"+this.drawerPositionStatus+"as")
+    if(this.drawerPositionStatus == 0)
+    {
+      this.reminds = "抽屉未缩回,请检查后重试"
+      this.remindController.open()
+      setTimeout(() => {
+        this.remindController.close()
+      }, 2000);
+      return
+    }
+
+    if(this.materialBoxWeight > 0)
+    {
+      this.reminds = "抽屉已有料箱,请检查后重试"
+      this.remindController.open()
+      setTimeout(() => {
+        this.remindController.close()
+      }, 2000);
+      return
+    }
+
+    //查询抽屉的状态
+    // this.showConfirmDialog({
+    //   title: '料箱出库',
+    //   message: `确定要空箱出库吗?`,
+    //   onConfirm: ()=> {
+    //
+    //   }
+    // });
+
     let res: VehicleInfo = await WmsRequest.post('/api/v1/stock/queryEmptyBox')
     console.log("hhtest", JSON.stringify(res), res?.vehicleNo)
     await WmsRequest.post('/api/v1/wmsOrder/outBox', {
@@ -51,7 +141,7 @@ struct OperationMaterialKit {
         TimeAndTitle()
       }
       .width('100%')
-      .height('3.5%')
+      .height('3.4%')
       .alignItems(VerticalAlign.Bottom)
       .justifyContent(FlexAlign.End)
 
@@ -61,10 +151,6 @@ struct OperationMaterialKit {
           .height($r('app.float.virtualSize_22_4'))
           .width($r('app.float.virtualSize_22_4'))
           .fillColor($r('app.color.FFFFFF'))
-          .onClick(()=> {
-            router.back()
-          })
-
         Text('工序齐套')
           .fontSize($r('app.float.fontSize_12'))
           .fontColor($r('app.color.FFFFFF'))
@@ -74,86 +160,20 @@ struct OperationMaterialKit {
       .height('5.2%')
       .alignItems(VerticalAlign.Center)
       .justifyContent(FlexAlign.Start)
+      .onClick(()=> {
+        router.back()
+      })
 
       // 当前齐套步骤和操作栏
       Row() {
         Row().width('41%')
         Row() {
-          Column({space: 5}) {
-            Stack() {
-              Circle()
-                .width($r('app.float.virtualSize_19_2'))
-                .height($r('app.float.virtualSize_19_2'))
-                .fill(this.step === 1 ? $r('app.color.0A84FF') : $r('app.color.10FFFFFF'))
-              Text('1')
-                .fontSize($r('app.float.fontSize_12'))
-                .fontColor(this.step === 1 ? $r('app.color.FFFFFF') : $r('app.color.60FFFFFF'))
-                .fontWeight(FontWeight.Medium)
-            }
-            .width($r('app.float.virtualSize_19_2'))
-            .height($r('app.float.virtualSize_19_2'))
-            Text('选择工序')
-              .fontSize($r('app.float.fontSize_6_4'))
-              .fontColor(this.step === 1 ? $r('app.color.FFFFFF') : $r('app.color.60FFFFFF'))
-              .fontWeight(FontWeight.Regular)
-          }
-          Divider()
-            .vertical(false)
-            .strokeWidth(1)
-            .layoutWeight(1)
-            .height($r('app.float.virtualSize_19_2'))
-            .color($r('app.color.15FFFFFF'))
-            .margin({
-              left: '-3%',
-              right: '-3%',// 向左延伸至圆心
-            })
-          Column({space: 5}) {
-            Stack() {
-              Circle()
-                .width($r('app.float.virtualSize_19_2'))
-                .height($r('app.float.virtualSize_19_2'))
-                .fill(this.step === 2 ? $r('app.color.0A84FF') : $r('app.color.10FFFFFF'))
-              Text('2')
-                .fontSize($r('app.float.fontSize_12'))
-                .fontColor(this.step === 2 ? $r('app.color.FFFFFF') : $r('app.color.60FFFFFF'))
-                .fontWeight(FontWeight.Medium)
-            }
-            .width($r('app.float.virtualSize_19_2'))
-            .height($r('app.float.virtualSize_19_2'))
-            Text('齐套装箱')
-              .fontSize($r('app.float.fontSize_6_4'))
-              .fontColor(this.step === 2 ? $r('app.color.FFFFFF') : $r('app.color.60FFFFFF'))
-              .fontWeight(FontWeight.Regular)
-          }
-          Divider()
-            .vertical(false)
-            .strokeWidth(1)
-            .layoutWeight(1)
-            .height($r('app.float.virtualSize_19_2'))
-            .color($r('app.color.15FFFFFF'))
-            .margin({
-              left: '-3%',
-              right: '-3%',// 向左延伸至圆心
-              //
-            })
-          Column({space: 5}) {
-            Stack() {
-              Circle()
-                .width($r('app.float.virtualSize_19_2'))
-                .height($r('app.float.virtualSize_19_2'))
-                .fill(this.step === 3 ? $r('app.color.0A84FF') : $r('app.color.10FFFFFF'))
-              Text('3')
-                .fontSize($r('app.float.fontSize_12'))
-                .fontColor(this.step === 3 ? $r('app.color.FFFFFF') : $r('app.color.60FFFFFF'))
-                .fontWeight(FontWeight.Medium)
-            }
-            .width($r('app.float.virtualSize_19_2'))
-            .height($r('app.float.virtualSize_19_2'))
-            Text('齐套入库')
-              .fontSize($r('app.float.fontSize_6_4'))
-              .fontColor(this.step === 3 ? $r('app.color.FFFFFF') : $r('app.color.60FFFFFF'))
-              .fontWeight(FontWeight.Regular)
-          }
+          ProcessFlow({
+            currentStep: this.step,
+            firstStepTitle: "选择工单",
+            secondStepTitle: "齐套装箱",
+            thirdStepTitle: "齐套入库",
+          })
         }
         .height('80%')
         .width('18%')
@@ -161,13 +181,11 @@ struct OperationMaterialKit {
         .alignItems(VerticalAlign.Top)
 
         Blank()
-        Row() {
-          NavigationBar()
-        }
-        .height('80%')
-        .width('30%')
+        NavigationBar()
+          .height('80%')
+          .width('23%')
       }
-      .height('14.2%')
+      .height('13%')
       .width('100%')
       // 步骤详情
       Column() {
@@ -201,7 +219,7 @@ struct OperationMaterialKit {
             .fontColor($r('app.color.0A84FF'))
             .fontWeight(FontWeight.Medium)
         }
-        .height('85%')
+        .height('67%')
         .width('24.1%')
         .justifyContent(FlexAlign.Center)
         .backgroundColor($r('app.color.20FFFFFF'))
@@ -217,14 +235,16 @@ struct OperationMaterialKit {
             .fontColor($r('app.color.0A84FF'))
             .fontWeight(FontWeight.Medium)
         }
-        .height('85%')
+        .height('67%')
         .width('24.1%')
         .justifyContent(FlexAlign.Center)
         .backgroundColor($r('app.color.20FFFFFF'))
         .borderRadius($r('app.float.fontSize_6_4'))
         .opacity(this.step > 1 ? 1 : 0.3)
         .onClick(()=>{
-          this.step -= 1
+          if (this.step > 1) {
+            this.step -= 1
+          }
         })
         Row().width('1.2%')
         Row () {
@@ -233,7 +253,7 @@ struct OperationMaterialKit {
             .fontColor($r('app.color.0A84FF'))
             .fontWeight(FontWeight.Medium)
         }
-        .height('85%')
+        .height('67%')
         .width('24.1%')
         .justifyContent(FlexAlign.Center)
         .backgroundColor($r('app.color.20FFFFFF'))
@@ -249,18 +269,20 @@ struct OperationMaterialKit {
             .fontColor($r('app.color.0A84FF'))
             .fontWeight(FontWeight.Medium)
         }
-        .height('85%')
+        .height('67%')
         .width('24.1%')
         .justifyContent(FlexAlign.Center)
         .backgroundColor($r('app.color.20FFFFFF'))
         .borderRadius($r('app.float.fontSize_6_4'))
         .opacity(this.step < 3 ? 1 : 0.3)
         .onClick(()=>{
-          this.step += 1
+          if (this.step < 3) {
+            this.step += 1
+          }
         })
       }
       .width('94.8%')
-      .height('6.1%')
+      .height('7.4%')
       .alignItems(VerticalAlign.Center)
     }
     .width('100%')

+ 2 - 1
entry/src/main/ets/pages/OrderMaterialsStorage.ets

@@ -57,7 +57,8 @@ struct orderMaterialsStorage {
               secondStepTitle:"调取料箱",
               thirdStepTitle:"绑定入库",
             })
-          }.width('20%')
+          }
+          .width('20%')
           .margin({right:'20%'})
           NavigationBar().width('20%')
         }

+ 4 - 0
entry/src/main/ets/view/wms/OperationMaterialKitOneStep.ets

@@ -121,6 +121,8 @@ export struct OperationMaterialKitOneStep {
               .borderRadius($r('app.float.virtualSize_6_4'))
               .justifyContent(FlexAlign.Start)
               .backgroundColor(this.selectWorkOrder === index ? $r('app.color.2030D158') : $r('app.color.20FFFFFF'))
+              .borderWidth(1)
+              .borderColor(this.selectWorkOrder === index ? $r('app.color.30D158') : $r('app.color.20FFFFFF'))
               .onClick(async ()=>{
                 if (this.selectWorkOrder === index) {
                   return
@@ -217,6 +219,8 @@ export struct OperationMaterialKitOneStep {
                         .height(48)
                         .padding({left: '6%'})
                         .backgroundColor(this.selectOperationIds.indexOf(operation.id) > -1 ? $r('app.color.2030D158') : $r('app.color.20FFFFFF'))
+                        .borderWidth(1)
+                        .borderColor(this.selectOperationIds.indexOf(operation.id) > -1 ? $r('app.color.30D158') : $r('app.color.20FFFFFF'))
                         .borderRadius($r('app.float.virtualSize_6_4'))
                         .onClick(async ()=>{
                           if (this.selectOperationIds.includes(operation.id)) {

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

@@ -10,7 +10,7 @@ export default class RequestParamModel {
   //储位类型
   houseType?: string;
   //储位编号
-  houseNo?:string
+  houseNo?: string
   //物料名称
   materialName?: string;
   //物料编号

+ 3 - 0
entry/src/main/resources/base/media/wms_search.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
+  <path d="m17.617 16.328 3.196 3.196a1 1 0 0 1-1.414 1.414L16.19 17.73a9.434 9.434 0 0 0 1.427-1.4ZM10.375 2a8.375 8.375 0 0 1 6.62 13.505l-.215.266a8.432 8.432 0 0 1-.325.364l-.136.14-.18.176-.134.124-.338.292-.187.147A8.375 8.375 0 1 1 10.375 2Zm0 2a6.375 6.375 0 1 0 0 12.75 6.375 6.375 0 0 0 0-12.75Z"/>
+</svg>