Пример #1
0
        public async Task <Unit> UpdateStatus(ReestrObject reestr)
        {
            LastReestrValue = reestr;
            await CalculateReminder(reestr.Recipe);

            return(Unit.Default);
        }
Пример #2
0
        public async Task <Unit> CalculateReminder(Recipe recipe)
        {
            if (_isInitial)
            {
                var last = await _reestrDataService.GetLastReestr(recipe.Id, DateTime.Now);

                if (last != null)
                {
                    LastReestrValue = new ReestrObject(last);
                }
                _isInitial = false;
            }
            var reminder = await _barrelStorageDataService.GetBarrelStorageRemainderByRecipe(recipe.Id);

            RecipeReminder.Remainder       = reminder;
            RecipeReminder.RecipeShortName = recipe.ShortName;
            if (reminder < 10000)
            {
                RecipeReminder.IsCritical = true;
            }
            else
            {
                RecipeReminder.IsCritical = false;
            }
            return(Unit.Default);
        }
Пример #3
0
 private void ExecuteEditViewCommand(ReestrObject reestr)
 {
     _dialogNavigationService.ShowDialog <ReestrEditViewModel, Reestr>(reestr.BuildOut(), callback =>
     {
         if (callback.IsSuccess)
         {
             var result = callback.Value;
             Task.Run(async() =>
             {
                 await _reestrDataService.UpdateReestr(result);
             }).ContinueWith(x =>
             {
                 if (x.Status == TaskStatus.RanToCompletion)
                 {
                     var r         = ReestrsCollection.FirstOrDefault(z => z.Id == reestr.Id);
                     r.ReestrState = result.ReestrState;
                     r.Customer    = result.Customer;
                     r.CustomerId  = result.CustomerId;
                     r.Net         = result.Net;
                     r.Note        = result.Note;
                 }
             });
         }
     });
 }
Пример #4
0
 private void InsertToCollection(ReestrObject reestr)
 {
     if (reestr != null)
     {
         ReestrsCollection.Add(reestr);
         _isValueDroppedToMinimum = false;
         ExecutePrintViewCommand(reestr);
         MessageBus.Current.SendMessage(new ReestredAddedEvent {
             Reestr = reestr
         });
     }
 }
Пример #5
0
        private void ExecutePrintViewCommand(ReestrObject reestr)
        {
            var printViewType = (PrintViewType)Enum.Parse(typeof(PrintViewType), SelectedPrintViewType.ToString());

            if (printViewType == PrintViewType.NoPrint)
            {
                return;
            }
            var printInitialize = PrintPreviewFactory.GetPrintView(printViewType);

            FlowDocument flowDoc = printInitialize.InitializeFlow(reestr);

            PrintHelper.Prints(flowDoc, reestr.PackingDate.ToString("dd.MM.yyyy"));
        }
Пример #6
0
 public FlowDocument InitializeFlow(ReestrObject reestr)
 {
     NameRu.Text         = reestr.Recipe.LongNameRu;
     NameKz.Text         = reestr.Recipe.LongNameKz;
     BatchNumber.Text    = reestr.BatchNumber;
     Brix.Text           = reestr.Recipe.Brix.ToString();
     BarrelNumber.Text   = reestr.BarrelNumber.ToString();
     ProductionDate.Text = reestr.BarrelStorage.ProductionDate.ToString("dd.MM.yyyy");
     BeforeDate.Text     = reestr.BarrelStorage.ProductionDate.AddYears(2).ToString("dd.MM.yyyy");
     //  PackingDate.Text = reestr.PackingDate.ToString("HH:mm:ss dd.MM.yyyy");
     StorageCondition.Text       = reestr.Recipe.StorageCondition;
     TranportationCondition.Text = reestr.Recipe.TransportationCondition;
     Net.Text         = reestr.Net.ToString();
     Brutto.Text      = (reestr.TareBarrelWithLid + reestr.Net).ToString();
     Carbo.Text       = reestr.Recipe.Carbohydrates.ToString();
     VitaminC.Text    = reestr.Recipe.VitaminC.ToString();
     EnergyBalue.Text = reestr.Recipe.EnergyValue.ToString();
     DryContent.Text  = reestr.Recipe.DryContent.ToString();
     return(this.FD);
 }
        public FlowDocument InitializeFlow(ReestrObject reestr)
        {
            NameRu.Text         = reestr.Recipe.LongNameRu;
            NameKz.Text         = reestr.Recipe.LongNameKz;
            BatchNumber.Text    = reestr.BatchNumber;
            Brix.Text           = reestr.Recipe.Brix.ToString();
            BarrelNumber.Text   = reestr.BarrelNumber.ToString();
            ProductionDate.Text = reestr.BarrelStorage.ProductionDate.ToString("dd.MM.yyyy");
            BeforeDate.Text     = reestr.BarrelStorage.ProductionDate.AddYears(2).ToString("dd.MM.yyyy");
            //  PackingDate.Text = reestr.PackingDate.ToString("HH:mm:ss dd.MM.yyyy");
            StorageCondition.Text       = reestr.Recipe.StorageCondition;
            TranportationCondition.Text = reestr.Recipe.TransportationCondition;
            Net.Text               = reestr.Net.ToString();
            Brutto.Text            = (reestr.TareBarrelWithLid + reestr.Net).ToString();
            CustomerShortName.Text = reestr.Customer.ShortName;
            AddressRu.Text         = reestr.Customer.AddressRu;
            AddressKz.Text         = reestr.Customer.AddressKz;

            return(this.FD);
        }
Пример #8
0
        public FlowDocument InitializeFlow(ReestrObject reestr)
        {
            for (int i = 0; i < 5; i++)
            {
                var p = new Paragraph()
                {
                    LineHeight = 1
                };
                p.Inlines.Add(new Run {
                    Text = "Импортер/Aлушы:", FontSize = 12.5, FontWeight = FontWeight.FromOpenTypeWeight(750), FontFamily = new FontFamily("Arial")
                });
                p.Inlines.Add(new Run {
                    Text = reestr.Customer.ShortName, FontSize = 12.5, FontWeight = FontWeight.FromOpenTypeWeight(750), FontFamily = new FontFamily("Arial")
                });

                var p2 = new Paragraph {
                    LineHeight = 1
                };
                p2.Inlines.Add(new Run {
                    Text = reestr.Customer.AddressRu, FontSize = 12.5, FontWeight = FontWeight.FromOpenTypeWeight(750), FontFamily = new FontFamily("Arial")
                });
                var p3 = new Paragraph {
                    LineHeight = 2
                };
                p3.Inlines.Add(new Run {
                    Text = reestr.Customer.AddressKz, FontSize = 12.5, FontWeight = FontWeight.FromOpenTypeWeight(750), FontFamily = new FontFamily("Arial")
                });
                FD.Blocks.Add(p);
                FD.Blocks.Add(p2);
                FD.Blocks.Add(p3);
                if (i != 5)
                {
                    FD.Blocks.Add(new Paragraph {
                        LineHeight = 1
                    });
                }
            }

            return(FD);
        }