public async Task <HttpRequestResult <PackingListViewInfoModel> > ReadingTransportAccessoryLanding(
     ReadingTransportAccessoryLandingModel model)
 {
     return(await PostAsyncReceiveData <PackingListViewInfoModel, ReadingTransportAccessoryLandingModel>(
                $"{ApiController}/reading-transport-accessory-landing", model));
 }
예제 #2
0
        private async Task ReadingTransportAccessoryLanding(ReadingTransportAccessoryLandingModel model)
        {
            var packingListViewInfo = await _landingService.ReadingTransportAccessoryLanding(model);

            if (packingListViewInfo.Response != null && packingListViewInfo.Response.Valid)
            {
                if (!string.IsNullOrEmpty(packingListViewInfo.Response.InformationMessage))
                {
                    await _notificationService.NotifyAsync(packingListViewInfo.Response.InformationMessage,
                                                           SoundEnum.Alert, "Informação");
                }

                Model.PackAmount  = packingListViewInfo.Response.PackAmount.ToString();
                Model.PackReading = packingListViewInfo.Response.PackAmountReading.ToString();
            }
            else if (packingListViewInfo.Response != null)
            {
                switch (packingListViewInfo.Response.ExceptionCode)
                {
                case ExceptionCodeEnum.VehicleNotBoardingLanding:
                case ExceptionCodeEnum.VehicleInLandingPaused:
                    if (await _notificationService.AskQuestionAsync(
                            packingListViewInfo.Response.ExceptionMessage + "\r\nDeseja iniciar desembarque?",
                            SoundEnum.Alert))
                    {
                        var startingLanding = await _landingService.StartingLanding(
                            new StartingLandingModel(Model.VehicleViewInfo.OperationalControlId, model.UnitLanding,
                                                     Model.VehicleViewInfo.TrafficScheduleDetailId, Model.TeamViewInfo.Code));

                        if (startingLanding.Response != null && startingLanding.Response.Valid)
                        {
                            Model.VehicleViewInfo.OperationalControlId =
                                startingLanding.Response.OperationalControlId;
                        }
                        else
                        {
                            await _notificationService.NotifyAsync(startingLanding.Response.ExceptionMessage,
                                                                   SoundEnum.Erros);
                        }
                    }
                    break;

                case ExceptionCodeEnum.PackRead:
                    if (await _notificationService.AskQuestionAsync(
                            packingListViewInfo.Response.ExceptionMessage +
                            "\r\nDeseja estornar o romaneio de acessório registrado na leitura atual?",
                            SoundEnum.Alert))
                    {
                        CallConfirmationRandomPopupPage(CancelPackingListTransportAccessoryLanding,
                                                        new CancelPackingListTransportAccessoryLandingModel(model.PackingListId,
                                                                                                            model.TrafficScheduleDetailId, model.PackingListTransportAccessoryCode,
                                                                                                            model.UnitLanding, model.MacAddress));
                    }
                    break;

                case ExceptionCodeEnum.SealWarning:
                    await _notificationService.NotifyAsync(packingListViewInfo.Response.ExceptionMessage, SoundEnum.Alert);

                    await NavigationService.NavigateAsync("MaintenanceSealsInputPage",
                                                          new NavigationParameters()
                    {
                        { "Title", "Solicitação" },
                        {
                            "MaintenanceSealsInputModel",
                            new MaintenanceSealsInputModel()
                            {
                                OnlyConference          = true,
                                PackingListAccessoryId  = packingListViewInfo.Response.TransportAccessoryId,
                                TransportAccessoryDoors = packingListViewInfo.Response.TransportAccessoryDoors
                            }
                        },
                        { "CallBackData", new Dictionary <string, object>()
                          {
                              { "Model", model }
                          } }
                    }
                                                          );

                    break;

                default:
                    await _notificationService.NotifyAsync(packingListViewInfo.Response.ExceptionMessage, SoundEnum.Erros);

                    if (!string.IsNullOrEmpty(packingListViewInfo.Response.InformationMessage))
                    {
                        await _notificationService.NotifyAsync(packingListViewInfo.Response.InformationMessage, SoundEnum.Alert);
                    }
                    break;
                }
            }
            else
            {
                await _notificationService.NotifyAsync("Não foi possivel completar a requisição.", SoundEnum.Erros);
            }
        }