Exemplo n.º 1
0
        public Page_GoodRedacting(Good locGoodItem, ObservableCollection<Good> locLv_Goods, Document locDocument)
        {
            GoodItemRef = locGoodItem;
            RefLv_Goods = locLv_Goods;
            refDocument = locDocument;
            for (int cur = 0; cur < locGoodItem.Count; cur++)
            {
                GoodItem[cur] = locGoodItem[cur];
            }

            StackLayout stack = new StackLayout
            {
                BackgroundColor = (Color)App.Current.Resources["backColor"],
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            CommonProcs CP = new CommonProcs();

            //========== GoodName
            if (CP.GetProperty("ext_GoodListView_GoodName_IsVivsible") == "True")
            {
                AddCluster(stack, "ТМЦ: ", new ItemsRequestStructure { Intent = "Good", VarName = "nGood", Metadata = GoodItem.Metadata });
            }

            //========== Description
            if (CP.GetProperty("ext_GoodListView_GoodDescription_IsVivsible") == "True")
            {
                AddCluster(stack, "Хар-ка: ", new ItemsRequestStructure { Intent = "GoodDescription", Metadata = GoodItem.mGoodDescription, VarName = "nGoodDescription", ParentMetadata = GoodItem.Metadata });
            }
            //========== S/N
            if (CP.GetProperty("ext_GoodListView_GoodSerial_IsVivsible") == "True")
            {
                AddCluster(stack, "С/Н: ", new ItemsRequestStructure { Intent = "Serial", Metadata = GoodItem.mSerial, VarName = "nSerial", ParentMetadata = GoodItem.Metadata });
            }
            //========== UnitName
            if (CP.GetProperty("ext_GoodListView_UnitName_IsVivsible") == "True")
            {
                AddCluster(stack, "Ед.: ", new ItemsRequestStructure { Intent = "Unit", Metadata = GoodItem.mUnit, VarName = "nUnit", ParentMetadata = GoodItem.Metadata });
            }
            //========== Quality
            if (CP.GetProperty("ext_GoodListView_GoodQuality_IsVivsible") == "True")
            {
                AddCluster(stack, "Кач-во: ", new ItemsRequestStructure { Intent = "Quality", VarName = "nQuality", Metadata = GoodItem.mQuality });
            }
            //========== Amount
            if (CP.GetProperty("ext_GoodListView_GoodAmount_IsVivsible") == "True")
            {
                AddCluster(stack, "Кол.: ", new ItemsRequestStructure { Intent = "Amount", VarName = "Amount" });
            }
            //========== AmountAquired
            if (CP.GetProperty("ext_GoodListView_GoodAmountAquired_IsVivsible") == "True")
            {
                AddCluster(stack, "Набрано: ", new ItemsRequestStructure { Intent = "AmountAquired", VarName = "AmountAquired" });
            }
            //========== Value0
            if (CP.GetProperty("ext_GoodListView_Value0_IsVivsible") == "True")
            {
                AddCluster(stack, "Д/З_0: ", new ItemsRequestStructure { Intent = "Value0", VarName = "Value0" });
            }
            //========== Value1
            if (CP.GetProperty("ext_GoodListView_Value1_IsVivsible") == "true")
            {
                AddCluster(stack, "Д/З_1: ", new ItemsRequestStructure { Intent = "Value1", VarName = "Value1" });
            }
            //========== Value2
            if (CP.GetProperty("ext_GoodListView_Value2_IsVivsible") == "True")
            {
                AddCluster(stack, "Д/З_2: ", new ItemsRequestStructure { Intent = "Value2", VarName = "Value2" });
            }

            Xamarin.Forms.Label l = new Xamarin.Forms.Label
            {
                BackgroundColor = (Color)App.Current.Resources["backColor"],
                TextColor = Color.Cyan,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment = TextAlignment.Center,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.End,
                FontSize = 14,
                Text = "Штрих-коды товара:"
            };

            stack.Children.Add(l);

            ListView lv_barcodes = new ListView
            {
                ItemsSource = os_barcodes,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.End,
                BackgroundColor = (Color)App.Current.Resources["backColor"],
                ItemTemplate = new DataTemplate(() =>
                {
                    StackLayout s = new StackLayout
                    {
                        BackgroundColor = (Color)App.Current.Resources["textColor"],
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        //VerticalOptions = LayoutOptions.FillAndExpand,
                    };

                    l = new Xamarin.Forms.Label
                    {
                        BackgroundColor = (Color)App.Current.Resources["backColor"],
                        TextColor = Color.LightYellow,
                        HorizontalTextAlignment = TextAlignment.Start,
                        VerticalTextAlignment = TextAlignment.Center,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions = LayoutOptions.FillAndExpand,
                        FontSize = 14,
                    };

                    s.Children.Add(l);

                    l.SetBinding(Xamarin.Forms.Label.TextProperty, "Barcode");

                    return new ViewCell { View = s };
                })

            };

            lv_barcodes.ItemSelected += Lv_barcodes_ItemSelected;

            stack.Children.Add(lv_barcodes);

            Button B;
            if (new CommonProcs().GetProperty("ext_ScanHardWare") == "1")
            {
                B = new Button
                {
                    Text = "Сканировать",
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions = LayoutOptions.End
                };
                B.Clicked += Scan_Clicked;
                stack.Children.Add(B);
            }

            B = new Button
            {
                Text = "Удалить",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.End,

            };

            B.Clicked += B_Clicked_Delete;

            stack.Children.Add(B);

            B = new Button
            {
                Text = "Ok",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.End
            };
            B.Clicked += Ok_Clicked;

            stack.Children.Add(B);

            this.Content = stack;

        }
Exemplo n.º 2
0
        public ItemList(Good reflocGood, string locFilter, ItemsRequestStructure locParent, ContentPage locContext, string locMode)
        {
            refGood = reflocGood;
            Filter  = locFilter;
            Parent  = locParent;
            Context = locContext;
            Mode    = locMode;

            StackLayout stack = new StackLayout
            {
                BackgroundColor   = (Color)App.Current.Resources["backColor"],
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            //1.Get Element list from server (if this is a good, then fill additional info, like serial, description, Units)


            switch (locMode)
            {
            case "RequestServerForItems":
                Title = "Найденные объекты";
                Device.BeginInvokeOnMainThread(MethodInvoker);
                break;

            case "DisplayItemListForSelection":
                Title = "Выберите 1 из дублей ШК";
                break;

            case "OnlyDisplayItemList":
                Title = "Товары по отбору";
                break;

            default:
                break;
            }


            lv_Items.Add(new TablePart
            {
                Value0 = "Good",
                Value1 = "Unit",
                Value3 = "Description",
                Value5 = "Serial",
                Value7 = "Quality",
            });

            //2.Build page layout
            ListView lv_Main = new ListView
            {
                ItemsSource  = lv_Items,
                ItemTemplate = new DataTemplate(() =>

                {
                    Grid G = new Grid
                    {
                        ColumnSpacing     = 1,
                        BackgroundColor   = (Color)App.Current.Resources["textColor"],
                        VerticalOptions   = LayoutOptions.FillAndExpand,
                        ColumnDefinitions =
                        {
                            //new ColumnDefinition { Width = new GridLength(4, GridUnitType.Star) },
                            //new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                            //new ColumnDefinition { Width = new GridLength(3, GridUnitType.Star) },
                            //new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                            //new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },

                            new ColumnDefinition {
                                Width = new GridLength(1, GridUnitType.Star)
                            },
                        },
                        RowDefinitions =
                        {
                            new RowDefinition {
                                Height = new GridLength(42, GridUnitType.Absolute)
                            }
                        },
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    };

                    //======== Field 0

                    Xamarin.Forms.Label l = new Xamarin.Forms.Label
                    {
                        BackgroundColor   = (Color)App.Current.Resources["backColor"],
                        TextColor         = (Color)App.Current.Resources["textColor"],
                        FontSize          = 13,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions   = LayoutOptions.FillAndExpand,
                    };

                    TapGestureRecognizer tgr = new TapGestureRecognizer
                    {
                        NumberOfTapsRequired = 1,
                        CommandParameter     = lv_Items.Count - 1
                    };
                    tgr.Tapped += Tgr_Tapped;

                    l.GestureRecognizers.Add(tgr);

                    l.SetBinding(Xamarin.Forms.Label.TextProperty, "Value0");
                    //f.Content = l;
                    G.Children.Add(l, 0, 0);


                    ////======== Field 1

                    //Label l1 = new Label
                    //{
                    //    BackgroundColor = (Color)App.Current.Resources["backColor"],
                    //    TextColor = (Color)App.Current.Resources["textColor"],
                    //    FontSize = 10,
                    //    HorizontalOptions = LayoutOptions.FillAndExpand,
                    //    VerticalOptions = LayoutOptions.FillAndExpand,

                    //};
                    //l1.SetBinding(Label.TextProperty, "Value1");

                    //TapGestureRecognizer tgr1 = new TapGestureRecognizer
                    //{
                    //    NumberOfTapsRequired = 1,
                    //    CommandParameter = lv_Items.Count - 1
                    //};
                    //tgr1.Tapped += Tgr_Tapped;

                    //l.GestureRecognizers.Add(tgr1);

                    ////f1.Content = l1;
                    //G.Children.Add(l1, 1, 0);

                    ////======== Field 2

                    //Label l2 = new Label
                    //{
                    //    BackgroundColor = (Color)App.Current.Resources["backColor"],
                    //    TextColor = (Color)App.Current.Resources["textColor"],
                    //    FontSize = 10,
                    //    HorizontalOptions = LayoutOptions.FillAndExpand,
                    //    VerticalOptions = LayoutOptions.FillAndExpand,

                    //};
                    //l2.SetBinding(Label.TextProperty, "Value3");
                    //TapGestureRecognizer tgr2 = new TapGestureRecognizer
                    //{
                    //    NumberOfTapsRequired = 1,
                    //    CommandParameter = lv_Items.Count - 1
                    //};
                    //tgr2.Tapped += Tgr_Tapped;

                    //l.GestureRecognizers.Add(tgr2);

                    ////f2.Content = l2;
                    //G.Children.Add(l2, 2, 0);

                    ////======== Field 3

                    //Label l3 = new Label
                    //{
                    //    BackgroundColor = (Color)App.Current.Resources["backColor"],
                    //    TextColor = (Color)App.Current.Resources["textColor"],
                    //    FontSize = 10,
                    //    HorizontalOptions = LayoutOptions.FillAndExpand,
                    //    VerticalOptions = LayoutOptions.FillAndExpand,

                    //};
                    //l3.SetBinding(Label.TextProperty, "Value5");
                    //TapGestureRecognizer tgr3 = new TapGestureRecognizer
                    //{
                    //    NumberOfTapsRequired = 1,
                    //    CommandParameter = lv_Items.Count - 1
                    //};
                    //tgr3.Tapped += Tgr_Tapped;

                    //l.GestureRecognizers.Add(tgr3);
                    ////f3.Content = l3;
                    //G.Children.Add(l3, 3, 0);

                    ////======== Field 4

                    //Label l4 = new Label
                    //{
                    //    BackgroundColor = (Color)App.Current.Resources["backColor"],
                    //    TextColor = (Color)App.Current.Resources["textColor"],
                    //    FontSize = 10,
                    //    HorizontalOptions = LayoutOptions.FillAndExpand,
                    //    VerticalOptions = LayoutOptions.FillAndExpand,
                    //};

                    //TapGestureRecognizer tgr4 = new TapGestureRecognizer
                    //{
                    //    NumberOfTapsRequired = 1,
                    //    CommandParameter = lv_Items.Count - 1
                    //};
                    //tgr4.Tapped += Tgr_Tapped;

                    //l4.GestureRecognizers.Add(tgr4);

                    //l4.SetBinding(Label.TextProperty, "Value7");
                    ////f4.Content = l4;
                    //G.Children.Add(l4, 4, 0);


                    StackLayout s = new StackLayout
                    {
                        Orientation     = StackOrientation.Vertical,
                        BackgroundColor = (Color)App.Current.Resources["textColor"],
                        VerticalOptions = LayoutOptions.FillAndExpand
                    };
                    s.Children.Add(G);

                    return(new ViewCell {
                        View = s
                    });
                })
            };

            stack.Children.Add(lv_Main);
            Content = stack;
        }
Exemplo n.º 3
0
        public Page_EnterValue(Good locGood, ContentPage locPage, ItemsRequestStructure locParent, string locMode)
        {
            Mode       = locMode;
            ParentPage = locPage;
            Parent     = locParent;
            refGood    = locGood;
            switch (Mode)
            {
            case "Filter":
                Title = "Введите фильтр/сканируйте ШК";
                break;

            case "EnterAmount":
                Title  = "Введите число";
                Filter = refGood.AmountAquired == "0" ? "" : refGood.AmountAquired;
                break;

            case "Enlight":
                Title = "Введите строку поиска";
                break;

            default:
                break;
            }

            StackLayout stack = new StackLayout
            {
                BackgroundColor   = (Color)App.Current.Resources["backColor"],
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BindingContext    = this
            };

            StackLayout StackVertical = new StackLayout
            {
                BackgroundColor   = (Color)App.Current.Resources["backColor"],
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Horizontal,
                BindingContext    = this
            };

            Entry E = new Entry
            {
                BackgroundColor   = Color.Gray,
                TextColor         = (Color)App.Current.Resources["textColor"],
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BindingContext    = this
            };

            E.SetBinding(Entry.TextProperty, "Filter");
            //E.Focus();

            StackVertical.Children.Add(E);

            if (AppGlobals.refMicrophoneFeature)
            {
                Image I1 = new Image
                {
                    Source            = "VoiceRec.PNG",
                    HorizontalOptions = LayoutOptions.End
                };

                TapGestureRecognizer tgr = new TapGestureRecognizer
                {
                    NumberOfTapsRequired = 1
                };
                tgr.Tapped += Tgr__Image1_Tapped;
                I1.GestureRecognizers.Add(tgr);
                StackVertical.Children.Add(I1);
            }

            //stack.Children.Add(E);
            stack.Children.Add(StackVertical);

            Button B;

            if (Mode == "Filter")
            {
                if (new CommonProcs().GetProperty("ext_ScanHardWare") == "1")
                {
                    B = new Button
                    {
                        Text = "Сканировать",
                    };
                    B.Clicked += Сканировать_Clicked;
                    stack.Children.Add(B);
                }
            }

            B = new Button
            {
                Text = "Ok"
            };
            B.Clicked += Ok_Clicked;
            stack.Children.Add(B);

            Content = stack;
        }