public async Task <HttpRequestResult <PackingListViewInfoModel> > ReadingPackLanding(ReadingPackLandingModel model) { return(await PostAsyncReceiveData <PackingListViewInfoModel, ReadingPackLandingModel>( $"{ApiController}/reading-pack-landing", model)); }
private async Task ReadingPackLanding(ReadingPackLandingModel model) { var readingPackLanding = await _landingService.ReadingPackLanding(model); if (readingPackLanding.Response != null && readingPackLanding.Response.Valid) { Model.VehicleViewInfo.OperationalControlId = readingPackLanding.Response.OperationalControlId; Model.PackAmount = readingPackLanding.Response.PackAmount.ToString(); Model.PackReading = readingPackLanding.Response.PackAmountReading.ToString(); } else if (readingPackLanding.Response != null) { switch (readingPackLanding.Response.ExceptionCode) { case ExceptionCodeEnum.VehicleNotBoardingLanding: case ExceptionCodeEnum.VehicleInLandingPaused: if (!await _notificationService.AskQuestionAsync( $"{readingPackLanding.Response?.ExceptionMessage}\r\nDeseja iniciar desembarque?", SoundEnum.Alert)) { var startingLanding = await _landingService.StartingLanding(new StartingLandingModel( Model.VehicleViewInfo.OperationalControlId, _userService.User.Unit.Id, Model.VehicleViewInfo.TrafficScheduleDetailId, Model.Team)); if (startingLanding.Response != null && startingLanding.Response.Valid) { Model.VehicleViewInfo.OperationalControlId = startingLanding.Response.OperationalControlId; } else { await _notificationService.NotifyAsync(startingLanding.Response?.ExceptionMessage ?? "Não houve resposta da API."); } } break; case ExceptionCodeEnum.PackRead: if (await _notificationService.AskQuestionAsync( $"{readingPackLanding.Response?.ExceptionMessage}\r\nDeseja estornar o volume registrado na leitura atual?", SoundEnum.Alert)) { CallConfirmationRandomPopupPage(CancelPackLanding, new CancelPackLandingModel(model.PackingListId, model.TrafficScheduleDetailId, model.BarCode, model.UnitLanding, model.MacAddress)); } else if (await _notificationService.AskQuestionAsync( $"{readingPackLanding.Response?.ExceptionMessage}\r\nDeseja estornar todo o CTRC do volume registrado na leitura atual?", SoundEnum.Alert)) { CallConfirmationRandomPopupPage(CancelBillOfLadingLanding, new CancelBillOfLadingLandingModel(model.PackingListId, model.TrafficScheduleDetailId, model.UnitLanding, model.BarCode, model.MacAddress)); } break; case ExceptionCodeEnum.PackNotLoading: await _notificationService.NotifyAsync(readingPackLanding.Response.ExceptionMessage, SoundEnum.Alert); await ReadingPackLanding(new ReadingPackLandingModel(model.TrafficScheduleDetailId, model.TeamId, model.PackingListId, model.UnitLanding, model.BarCode, model.MacAddress, true)); break; default: var msg = readingPackLanding.Response?.ExceptionMessage ?? readingPackLanding.Error.ErrorDescription; if (!string.IsNullOrEmpty(msg)) { await _notificationService.NotifyAsync(msg, SoundEnum.Erros); } break; } } else { await _notificationService.NotifyAsync("Não foi possivel completar a requisição.", SoundEnum.Erros); } }