示例#1
0
 public void ProcessInventoryCount()
 {
     IsDetailsBusy = true;
     InventoryCountHelper.AddOrUpdate(SelectedInventoryCount);
     SaveChanges();
     StoredCallbackProcessor.StartAlohaSync(ignoreAsync: true);
     StoredCallbackProcessor.UpdateStock();
     InventoryCountHelper.Process(SelectedInventoryCount);
     RefreshItemSource();
 }
 public void ForceAlohaSync()
 {
     lock (Extensions.SyncLock)
     {
         BusyContent = string.Empty;
         AsyncHelper.DoAsync(() =>
         {
             IsRunningSync = true;
             StoredCallbackProcessor.StartAlohaSync(ignoreAsync: true);
             IsRunningSync = false;
         });
     }
 }
        public void RunEndOfDayAsync()
        {
            ProgressValue = 0;

            if (!WebApiClient.IsAvailableConnection)
            {
                BusyContent = "Error de Conneccion Intente nuevamente ..";
                return;
            }

            BusyContent           = "Ejectutando Validacion de Fin de Dia";
            IsLockedForEndOfDay   = IsRunningEndOfDay = true;
            EndOfDayNotifications = NotificationsManager.GetEndOfDayNotifications();
            IsRunningEndOfDay     = false;
            IsLoading             = true;
            if (EndOfDayNotifications.Any(n => n.NotificationName.ToLower() != "completo"))
            {
                var error = BusyContent = "Error Existen Validaciones Pendientes, Favor verificar";
                MessageBox.Show(error, "Fin de dia Error", MessageBoxButton.OK, MessageBoxImage.Error);
                IsLoading = IsLockedForEndOfDay = false;
                return;
            }

            BusyContent = "Sincronizando Productos Aloha...";
            StoredCallbackProcessor.StartAlohaSync(ignoreAsync: true);

            BusyContent = "Procesando Venta Pendiente...";
            var idVenta = (int)StoredCallbackProcessor.CallDataSet("SP_INV_VNT_PROCESAR").Tables[0].Rows[0].ItemArray.FirstOrDefault();

            if (idVenta <= 0)
            {
                MessageBox.Show("Error al procesar venta", "Fin de dia Error", MessageBoxButton.OK,
                                MessageBoxImage.Error);
                IsLoading = IsLockedForEndOfDay = false;
            }
            else
            {
                var sale = SalesHelper.Get(idVenta);

                //Asiganado las formas de pago para la venta por ALOHA
                var pagos = SalesHelper.GetiInvoicePayments(sale);
                sale.paymentsAloha = pagos;

                if (sale != null)
                {
                    BusyContent = "Sincronizando Venta...";
                    Synchronization.Synchronize(sale);
                    if (sale.StateL == LocalStatus.Procesado)
                    {
                        var token = TransactionLogHelper.ConfirmationLog();
                        BusyContent = "Proceso completado con exito, Codigo de verificacion " + token;
                        MessageBox.Show(BusyContent, "Finalizado", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                    else
                    {
                        BusyContent   = "Error al procesar venta, Verifique ..";
                        ProgressValue = 0;
                        MessageBox.Show(BusyContent, "Error Fin de Dia", MessageBoxButton.OK,
                                        MessageBoxImage.Error);
                        IsLoading = IsLockedForEndOfDay = false;
                    }
                }
                else
                {
                    BusyContent   = "Error al procesar venta, Verifique ..";
                    ProgressValue = 0;
                    MessageBox.Show(BusyContent, "Error Fin de Dia", MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                    IsLoading = IsLockedForEndOfDay = false;
                }
            }
            IsLoading = IsLockedForEndOfDay = false;
        }