Bladeren bron

机器人添加&&齐套工位更改

dengrui 3 maanden geleden
bovenliggende
commit
e7ef38a1ab

+ 25 - 5
entry/src/main/ets/common/constants/CommonConstants.ets

@@ -31,24 +31,44 @@ export default class CommonConstants {
   static readonly ROBOTS: RobotInfo[] = [
     {
       id: 1,
-      robotCode: 'rgv2',
+      robotCode: 'rgv1',
       storageId: 1,
       robotType: 2,
       robotToward: 2,
-      x: 3,
-      y: 2,
+      x: 1,
+      y: 1,
       lastSelfCheck: '2024/02/16 11:11:34'
     } as RobotInfo,
     {
       id: 2,
-      robotCode: 'rgv3',
+      robotCode: 'rgv2',
       storageId: 1,
       robotType: 2,
       robotToward: 1,
-      x: 1,
+      x: 2,
       y: 2,
       lastSelfCheck: '2024/02/16 10:56:34'
     } as RobotInfo,
+    {
+      id: 3,
+      robotCode: 'rgv3',
+      storageId: 1,
+      robotType: 2,
+      robotToward: 1,
+      x: 3,
+      y: 3,
+      lastSelfCheck: '2024/02/16 10:56:34'
+    } as RobotInfo,
+    {
+      id: 4,
+      robotCode: 'rgv4',
+      storageId: 1,
+      robotType: 2,
+      robotToward: 1,
+      x: 4,
+      y: 4,
+      lastSelfCheck: '2024/02/16 10:56:34'
+    } as RobotInfo,
   ]
   // 工步展示图
   static readonly STEP_IMAGES: Resource[] = [

+ 59 - 0
entry/src/main/ets/common/util/request/StorageRequestInstance.ets

@@ -410,6 +410,65 @@ export interface Materialpositionclass {
   materials?: MaterialInformationModel[]
 }
 
+/////物料位置
+export interface Materialpositionclass1 {
+  vehicleCode?: string
+  //批次号
+  batchCode?: string;
+
+  ///完成数量
+  completedNum?: number
+  //已经占用箱数
+  useNum?: number
+  //空箱数
+  emptyBoxNum?: string
+  //可用箱数
+  canUsedNum?: string
+  //总容量箱数
+  allNum?: number
+  //仓储类型
+  type?: string
+  //批次号
+
+  coordinate?: string
+  //创建时间
+  created?: string
+  //
+  creator?: string
+  //仓库编码
+  houseNo?: string
+  deptId?: string
+  houseType?: string
+  //主键
+  id?: string
+  locationNo?: string
+  //	物料名称
+  materialName?: string
+  //物料编码
+  materialNo?: string
+  //出入库数量
+  num?: number
+  orgId?: string
+  planNo?: string
+  position?: string
+  //	序列号
+  seqNo?: string
+  // 状态;1-待处理;2-处理中;3-处理异常;4-已完成
+  state?: number
+  //	库存数量
+  stockNum?: string
+  //出入库任务单号
+  taskNo?: string
+  unit?: string
+  updated?: string
+  //任务名称
+  taskName?: string
+  updator?: string
+  vehicleNo?: string
+  pageNo?: number
+  pageSize?: number
+  materials?: MaterialInformationModel[]
+}
 // const Materialposition = async() : Promise< Materialpositionclass[]> => {
 //   let obj: Materialpositionclass[] = []
 //   let res:Materialpositionclass = await StorageRequest.post("/api/v3/stock/list", {

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

@@ -3,6 +3,7 @@ import JGRequest from '../common/util/request/Request'
 import StorageRequest from '../common/util/request/StorageRequest'
 import OrderInfo from '../model/OrderInfo'
 import { Materialpositionclass, Tasklist } from './IntelligentWarehousingOutbound'
+import { Materialpositionclass1} from '../common/util/request/StorageRequestInstance'
 import MaterialInfo from '../viewmodel/MaterialInfo'
 import PageModel from '../viewmodel/PageModel'
 import ProcessData from '../viewmodel/ProcessData'
@@ -13,7 +14,7 @@ import { MaterialInformationModel } from '../model/MaterialInformation'
 import promptAction from '@ohos.promptAction'
 import CommonConstants from '../common/constants/CommonConstants'
 import { StationInfoModel } from '../model/StorageSpace'
-
+import { SureToDoDialog } from '../common/component/SureToDoDialog'
 
 export interface stat3 {
   statNo?: string
@@ -29,6 +30,98 @@ export interface stat3 {
 @Entry
 @Component
 export struct CompleteSet {
+  @State private MaterialInfoArray: Array<Materialpositionclass1> = []
+  @State materialInfoName: string = 'aaa'
+  @State private positionInfoList: Array<MaterialInformationModel> = []
+  currentBoxStationModel: Materialpositionclass1 = {}
+
+  goingToLookDetail = async (m: Materialpositionclass1) => {
+    console.log('dyy',JSON.stringify(m))
+    this.currentBoxStationModel = m
+    this.positionInfoList = m?.materials ?? []
+    this.infoListController.open()
+  }
+  goingToOut = (m: Materialpositionclass1) => {
+    this.currentBoxStationModel = m
+    this.infoDialogController.open()
+  }
+  materialInfoController: CustomDialogController = new CustomDialogController({
+    builder: MaterailInfoDialog({
+      Materialposition: this.MaterialInfoArray,
+      materialName:this.materialInfoName,
+      lookDetail: this.goingToLookDetail,
+      goToOut: this.goingToOut,
+    }),
+    alignment: DialogAlignment.Center,
+    customStyle: true,
+    autoCancel: false,
+  })
+  dialogCancel = () => {
+    this.currentBoxStationModel = {}
+    this.infoDialogController.close()
+    this.infoListController.close()
+  }
+  dialogSure = async () => {
+    // let res: outBoxClass = await StorageRequest.post("/api/v1/wmsOrder/outBox", {
+    //   houseNo: this.currentBoxStationModel?.houseNo ?? "",
+    //   vehicleNo: this.currentBoxStationModel?.vehicleNo ?? this.currentBoxStationModel.vehicleCode ?? "",
+    //   stanCode: CommonConstants.STATION_CODE
+    // } as RequestParamModel)
+
+    // this.outBox = res
+
+    promptAction.showToast({
+      message: "任务进行中,请等待....",
+      duration: 1800,
+      bottom: '50%'
+    })
+    this.infoDialogController.close()
+    this.materialLocationController.close()
+
+  }
+  infoDialogController: CustomDialogController = new CustomDialogController({
+    builder: SureToDoDialog(
+      {
+        cancel: this.dialogCancel,
+        confirm: this.dialogSure,
+        title: "出库确认",
+        info: '确认出库当前料箱吗?'
+      }
+    ),
+    alignment: DialogAlignment.Center,
+    customStyle: true,
+    autoCancel: false,
+  })
+  infoListController: CustomDialogController = new CustomDialogController({
+    builder: LocationInfoListDialog(
+      {
+        closeDialog: this.dialogCancel,
+        materials: this.positionInfoList
+      }
+    ),
+    alignment: DialogAlignment.Center,
+    customStyle: true,
+    autoCancel: false,
+  })
+
+  //请求物料位置
+  MaterialpositionHttp = async (code :string,name:string) => {
+    let res: Materialpositionclass1[] = await StorageRequest.post("/api/v1/process/vehicleOperation/stockMaterials", {
+      label: code,
+    } as RequestParamModel)
+    this.MaterialInfoArray = res
+    if(this.MaterialInfoArray.length>0){
+      this.materialInfoName = name
+      this.materialInfoController.open()
+    }else{
+      promptAction.showToast({
+        message: "无库存",
+        duration: 1800,
+        bottom: '50%'
+      })
+    }
+
+  }
   //任务单id
   @State orderId: string = ''
   //齐套料箱重量
@@ -647,6 +740,15 @@ export struct CompleteSet {
                     .alignItems(HorizontalAlign.Start)
                     .justifyContent(FlexAlign.Center)
 
+                    Column(){
+                      Button("库存详情").margin("4vp")
+                        .onClick(() => {
+                          this.MaterialpositionHttp(item.materialCode,item.materialName)
+                        })
+                    }.width('20%')
+                    .height('100')
+                    .justifyContent(FlexAlign.Center)
+                    .alignItems(HorizontalAlign.Center)
 
                     // if (item.completeNum! === item.totalMaterial!) {
                     //   Column() {
@@ -1418,6 +1520,224 @@ struct scanningMaterialBox {
     .backgroundColor($r('app.color.process_divider_white_color'))
   }
 }
+// 物料位置(物料在哪些料箱里面)
+@CustomDialog
+struct LocationInfoListDialog {
+  @Link materials: MaterialInformationModel[]
+  scroller: Scroller = new Scroller()
+  Controller: CustomDialogController
+  closeDialog: () => void = () => {
+  }
+
+  build() {
+    Stack() {
+      Column() {
+        Grid(this.scroller) {
+          ForEach(this.materials, (item: MaterialInformationModel, index: number) => {
+            GridItem() {
+              Column() {
+                Row() {
+                  Text(item?.materialName)
+                    .fontSize($r('app.float.fontSize_24'))
+                    .fontWeight(FontWeight.Regular)
+                    .fontColor($r('app.color.black_90'))
+                    .margin({ right: 15 })
+                  Row() {
+                    Text(item.num?.toString())
+                      .fontSize($r('app.float.fontSize_38'))
+                      .fontWeight(FontWeight.Bold)
+                      .fontColor($r('app.color.black_90'))
+                    Text(item.unit)
+                      .fontSize($r('app.float.fontSize_24'))
+                      .fontWeight(FontWeight.Regular)
+                      .fontColor($r('app.color.black_60'))
+                  }
+                }
+                .justifyContent(FlexAlign.SpaceBetween)
+                .width('100%')
+
+                Text(item.materialNo)
+                  .fontSize($r('app.float.fontSize_24'))
+                  .fontWeight(FontWeight.Regular)
+                  .fontColor($r('app.color.black_60'))
+                  .width('100%')
+                Text(item.spec)
+                  .fontSize($r('app.float.fontSize_24'))
+                  .fontWeight(FontWeight.Regular)
+                  .fontColor($r('app.color.black_60'))
+                  .width('100%')
+
+              }
+              .width('100%')
+              .alignItems(HorizontalAlign.Start)
+              .justifyContent(FlexAlign.Center)
+              .padding({ left: 8, right: 10 })
+              .height('60')
+
+            }
+            .padding({ left: 5, bottom: 8 })
+            .borderRadius(5)
+            .border({ width: 2, color: Color.Gray })
+          })
+        }
+        .padding(10)
+        .columnsTemplate('1fr')
+        .columnsGap(10)
+        .rowsGap(10)
+        .width('100%')
+        .height('100%')
+      }
+      .width('100%')
+      .height('100%')
+    }
+    .width('60%')
+    .height('80%')
+    .backgroundColor($r('app.color.page_general_background'))
+    .borderRadius(20)
+    .onClick(() => {
+      this.closeDialog()
+    })
+  }
+}
+
+
+
+//库存详情弹窗
+@CustomDialog
+struct MaterailInfoDialog {
+  @Link Materialposition: Materialpositionclass1[]
+  scroller: Scroller = new Scroller()
+  @Link materialName: string
+  Controller: CustomDialogController
+  lookDetail: (m: Materialpositionclass1) => void = () => {
+  }
+  goToOut: (m: Materialpositionclass1) => void = () => {
+  }
+  build() {
+    Stack() {
+      Column() {
+
+      }
+      .width('100%')
+      .height('100%')
+      .blur(30)
+      .backgroundColor('#4d000000')
+
+      Column() {
+        Row() {
+          Row() {
+            Image($r('app.media.back_white'))
+              .width(px2vp(64))
+              .height(px2vp(64))
+              .onClick(() => {
+                this.Controller?.close()
+              })
+          }
+          .width('5%')
+          .padding({ left: 10 })
+
+          Row() {
+            Text(this.materialName && this.materialName.length > 0 ? this.materialName : '')
+              .fontSize($r('app.float.fontSize_38'))
+              .fontWeight(FontWeight.Medium)
+              .fontColor($r('app.color.process_divider_white_color'))
+              .width('100%')
+              .height('100%')
+              .textAlign(TextAlign.Center)
+          }
+          .width('90%')
+          .justifyContent(FlexAlign.Center)
+
+          Row() {
+          }.width('5%')
+        }
+        .width('100%')
+        .height('15%')
+        .padding({ top: 8 })
+
+        Grid(this.scroller) {
+          ForEach(this.Materialposition, (item: Materialpositionclass1, index: number) => {
+            GridItem() {
+              Row() {
+                Column() {
+                  Text(item.vehicleCode)
+                    .fontSize($r('app.float.fontSize_24'))
+                    .fontWeight(FontWeight.Regular)
+                    .fontColor($r('app.color.black_60'))
+                    .width('100%')
+
+                  Text("坐标: " + item?.coordinate)
+                    .fontSize($r('app.float.fontSize_24'))
+                    .fontWeight(FontWeight.Regular)
+                    .fontColor($r('app.color.black_90'))
+                    .margin({ right: 15 })
+
+                  Text("层数: " + item.position)
+                    .fontSize($r('app.float.fontSize_24'))
+                    .fontWeight(FontWeight.Regular)
+                    .fontColor($r('app.color.black_90'))
+                    .margin({ right: 15 })
+                }
+                .width('60%')
+                .alignItems(HorizontalAlign.Start)
+                .justifyContent(FlexAlign.Center)
+                .height('100%')
+
+                Row() {
+                  Text("详情")
+                    .fontSize($r('app.float.fontSize_24'))
+                    .fontWeight(FontWeight.Regular)
+                    .fontColor($r('app.color.white_100'))
+                    .backgroundColor($r('app.color.blue_100'))
+                    .height(40)
+                    .textAlign(TextAlign.Center)
+                    .borderRadius(10)
+                    .width(60)
+                    .onClick(() => {
+                      this.lookDetail(item)
+                    })
+
+                  // Text("出库")
+                  //   .fontSize($r('app.float.fontSize_24'))
+                  //   .fontWeight(FontWeight.Regular)
+                  //   .fontColor($r('app.color.white_100'))
+                  //   .margin({ left: 15 })
+                  //   .backgroundColor($r('app.color.warn_1'))
+                  //   .height(40)
+                  //   .textAlign(TextAlign.Center)
+                  //   .borderRadius(10)
+                  //   .width(60)
+                  //   .onClick(() => {
+                  //     this.goToOut(item)
+                  //   })
+                }
+                .width('40%')
+                .justifyContent(FlexAlign.End)
+                .height('100%')
+              }
+              .padding(5)
+              .borderRadius(10)
+              .height('12%')
+              .width('100%')
+              .backgroundColor($r('app.color.robot_set_card_white'))
+            }
+            .padding({ left: 5 })
+          })
+        }
+        .padding(10)
+        .columnsTemplate('1fr 1fr 1fr')
+        .columnsGap(10)
+        .rowsGap(10)
+        .width('100%')
+        .height('85%')
+      }
+      .width('100%')
+      .height('100%')
+    }
+    .width('100%')
+    .height('100%')
+  }
+}
 
 // 物料详情弹窗(序列号)
 @CustomDialog