/* * 工序齐套 * */ import { TimeAndTitle } from '../component/TimeAndTitle' import router from '@ohos.router' import { NavigationBar } from '../component/NavigationBar' import { OperationMaterialKitOneStep } from '../view/wms/OperationMaterialKitOneStep' import WorkOrderInfo from '../viewmodel/wms/WorkOrderInfo' import { OperationMaterialKitTwoStep } from '../view/wms/OperationMaterialKitTwoStep' import { OperationMaterialKitThreeStep } from '../view/wms/OperationMaterialKitThreeStep' import OperationInfo from '../viewmodel/wms/OperationInfo' import OperationItem from '../viewmodel/wms/OperationItem' import VehicleInfo from '../viewmodel/wms/VehicleInfo' 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 struct OperationMaterialKit { @State step: number = 1 // 选中的工单 @State workOrder: WorkOrderInfo = {} // 选中的工序 @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 { 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', { stanCode: CommonConstants.STATION_CODE, vehicleNo: res!.vehicleNo, houseNo: res!.houseNo } as RequestParamModel) promptAction.showToast({ message: "箱子正在运行中....", duration: 1800, bottom: '50%' }) } build() { Column() { // 顶部时间和菜单栏 Row(){ TimeAndTitle() } .width('100%') .height('3.4%') .alignItems(VerticalAlign.Bottom) .justifyContent(FlexAlign.End) // 工序齐套 Row() { Image($r('app.media.general_return')) .height($r('app.float.virtualSize_22_4')) .width($r('app.float.virtualSize_22_4')) .fillColor($r('app.color.FFFFFF')) Text('工序齐套') .fontSize($r('app.float.fontSize_12')) .fontColor($r('app.color.FFFFFF')) .fontWeight(FontWeight.Medium) } .width('94.8%') .height('5.2%') .alignItems(VerticalAlign.Center) .justifyContent(FlexAlign.Start) .onClick(()=> { router.back() }) // 当前齐套步骤和操作栏 Row() { Row().width('41%') Row() { ProcessFlow({ currentStep: this.step, firstStepTitle: "选择工单", secondStepTitle: "齐套装箱", thirdStepTitle: "齐套入库", }) } .height('80%') .width('18%') // .justifyContent(FlexAlign.SpaceBetween) .alignItems(VerticalAlign.Top) Blank() NavigationBar() .height('80%') .width('23%') } .height('13%') .width('100%') // 步骤详情 Column() { if (this.step === 1) { OperationMaterialKitOneStep({ workOrder: this.workOrder, selectOperations: this.selectOperations, operationItems: this.operationItems, }) } else if (this.step === 2) { OperationMaterialKitTwoStep({ workOrder: this.workOrder, selectOperations: this.selectOperations, operationItems: this.operationItems, }) } else { OperationMaterialKitThreeStep({ workOrder: this.workOrder, selectOperations: this.selectOperations, operationItems: this.operationItems, }) } } .height('71%') .width('94.8%') // 步骤切换按钮 Row() { Row () { Text('第一步') .fontSize($r('app.float.fontSize_9_6')) .fontColor($r('app.color.0A84FF')) .fontWeight(FontWeight.Medium) } .height('67%') .width('24.1%') .justifyContent(FlexAlign.Center) .backgroundColor($r('app.color.20FFFFFF')) .borderRadius($r('app.float.fontSize_6_4')) .opacity(this.step > 2 ? 1 : 0.3) .onClick(()=>{ this.step = 1 }) Row().width('1.2%') Row () { Text('上一步') .fontSize($r('app.float.fontSize_9_6')) .fontColor($r('app.color.0A84FF')) .fontWeight(FontWeight.Medium) } .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(()=>{ if (this.step > 1) { this.step -= 1 } }) Row().width('1.2%') Row () { Text('空箱出库') .fontSize($r('app.float.fontSize_9_6')) .fontColor($r('app.color.0A84FF')) .fontWeight(FontWeight.Medium) } .height('67%') .width('24.1%') .justifyContent(FlexAlign.Center) .backgroundColor($r('app.color.20FFFFFF')) .borderRadius($r('app.float.fontSize_6_4')) .opacity(this.step === 2 ? 1 : 0.3) .onClick(()=>{ this.callEmptyBoxFun() }) Row().width('1.2%') Row () { Text('下一步') .fontSize($r('app.float.fontSize_9_6')) .fontColor($r('app.color.0A84FF')) .fontWeight(FontWeight.Medium) } .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(()=>{ if (this.step < 3) { this.step += 1 } }) } .width('94.8%') .height('7.4%') .alignItems(VerticalAlign.Center) } .width('100%') .height('100%') .backgroundColor($r('app.color.000000')) } }