123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292 |
- /*
- * 工序齐套
- * */
- 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<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', {
- 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'))
- }
- }
|