예제 #1
0
 public void FillObjectsList(InputStructure IS, ItemList Page_IL, ItemsRequestStructure locParent)
 {
     Page_IL.lv_Items.Clear();
     foreach (TablePart TP in IS.Table0)
     {
         Page_IL.lv_Items.Add(new TablePart
         {
             Metadata = TP.Metadata,
             UID      = TP.UID,
             Value0   = TP.Value0,
             Value1   = TP.Value1,
             Value2   = TP.Value2,
             Value3   = TP.Value3,
             Value4   = TP.Value4,
             Value5   = TP.Value5,
             Value6   = TP.Value6,
             Value7   = TP.Value7,
             Value8   = TP.Value8,
             Value9   = TP.Value9,
             Value10  = TP.Value10,
             Value11  = TP.Value11,
             Value12  = TP.Value12,
             Value13  = TP.Value13,
             Value14  = TP.Value14,
             Value15  = TP.Value15,
             Value16  = TP.Value16,
             Value17  = TP.Value17,
             Value18  = TP.Value18,
             Value19  = TP.Value19,
         });
     }
 }
예제 #2
0
 public void FilGoodsList(InputStructure IS, Page_GoodsList Context)
 {
     //Context.lv_Goods = new ObservableCollection<Good>();
     Context.lv_Goods.Clear();
     foreach (TablePart TP in IS.Table0)
     {
         Context.lv_Goods.Add(new Good
         {
             Metadata           = TP.Metadata,
             nGood              = TP.Value0,
             uidGood            = TP.UID,
             nUnit              = TP.Value1,
             uidUnit            = TP.Value2,
             nGoodDescription   = TP.Value3,
             uidGoodDescription = TP.Value4,
             nSerial            = TP.Value5,
             uidSerial          = TP.Value6,
             nQuality           = TP.Value7,
             uidQuality         = TP.Value8,
             Amount             = TP.Value9,
             AmountAquired      = TP.Value10,
             Value0             = TP.Value11,
             Value1             = TP.Value12,
             Value2             = TP.Value13,
             mUnit              = TP.Value14,
             mGoodDescription   = TP.Value15,
             mSerial            = TP.Value16,
             mQuality           = TP.Value17,
             StringID           = TP.Value18,
             Barcode            = TP.Value19
         });
     }
 }
예제 #3
0
 public void FillDocumentsList(InputStructure IS, MainPage Context)
 {
     Context.lv_Documents.Clear();
     foreach (TablePart TP in IS.Table0)
     {
         Context.lv_Documents.Add(new Document {
             Metadata = TP.Metadata,
             UID      = TP.UID,
             Number   = TP.Value0,
             Date     = TP.Value1,
             Value0   = TP.Value2,
             Value1   = TP.Value3,
             Value2   = TP.Value4
         });
     }
 }
예제 #4
0
        public void ReplaceObjectInGoodRedactingPage(InputStructure IS)
        {
            foreach (TablePart TP in IS.Table0)
            {
                //((Page_GoodRedacting)Context).GoodItem = new Good();

                ((Page_GoodRedacting)Context).GoodItem.Metadata = TP.Metadata;
                ((Page_GoodRedacting)Context).GoodItem.uidGood  = TP.UID;
                ((Page_GoodRedacting)Context).GoodItem.nGood    = TP.Value0;

                ((Page_GoodRedacting)Context).GoodItem.uidUnit = TP.Value1;
                ((Page_GoodRedacting)Context).GoodItem.nUnit   = TP.Value2;
                ((Page_GoodRedacting)Context).GoodItem.mUnit   = TP.Value3;

                ((Page_GoodRedacting)Context).GoodItem.uidGoodDescription = TP.Value4;
                ((Page_GoodRedacting)Context).GoodItem.nGoodDescription   = TP.Value5;
                ((Page_GoodRedacting)Context).GoodItem.mGoodDescription   = TP.Value6;

                ((Page_GoodRedacting)Context).GoodItem.uidSerial = TP.Value7;
                ((Page_GoodRedacting)Context).GoodItem.nSerial   = TP.Value8;
                ((Page_GoodRedacting)Context).GoodItem.mSerial   = TP.Value9;

                ((Page_GoodRedacting)Context).GoodItem.uidQuality = TP.Value10;
                ((Page_GoodRedacting)Context).GoodItem.nQuality   = TP.Value11;
                ((Page_GoodRedacting)Context).GoodItem.mQuality   = TP.Value12;

                ((Page_GoodRedacting)Context).GoodItem.Barcode = TP.Value19;
                ((Page_GoodRedacting)Context).os_barcodes.Clear();
                foreach (string BC in TP.Value19)
                {
                    ((Page_GoodRedacting)Context).os_barcodes.Add(new BarcodeItem {
                        Barcode = BC
                    });
                }
            }
        }
예제 #5
0
        public async void BarcodeScanned(string Barcode, string ScanPurpose)
        {
            refCurrentPageContext = (ContentPage)AppGlobals.refCurrentPageContext;
            if (refCurrentPageContext.GetType() == typeof(Page_GoodsList))       //Наборка товаров
            {
                ObservableCollection <Good> FoundedGoods = new ObservableCollection <Good>();

                foreach (Good g in ((Page_GoodsList)refCurrentPageContext).lv_Goods)
                {
                    foreach (string BC in g.Barcode)
                    {
                        if (Barcode == BC)
                        {
                            FoundedGoods.Add(g);
                            break;
                        }
                    }
                }
                if (FoundedGoods.Count == 0)
                {
                    await refCurrentPageContext.DisplayAlert("штрихкод не найден!", "", "OK");
                }
                else if (FoundedGoods.Count == 1)
                {
                    await refCurrentPageContext.Navigation.PushAsync(new Page_EnterValue(FoundedGoods[0], refCurrentPageContext, null, "EnterAmount"));
                }
                else
                {
                    ItemList IL = new ItemList(null, null, null, refCurrentPageContext, "DisplayItemListForSelection");
                    foreach (Good g in FoundedGoods)
                    {
                        IL.lv_Items.Add(new TablePart {
                            Metadata = g.Metadata, UID = g.uidGood, Value0 = g.nGood
                        });
                    }

                    await refCurrentPageContext.Navigation.PushAsync(IL);
                }
            }
            if (refCurrentPageContext.GetType() == typeof(Page_GoodRedacting))       //Добавление ШК
            {
                object CheckForBKUniquness;
                App.Current.Properties.TryGetValue("ext_TabSel_Other_CheckForBarcodeUniqueness", out CheckForBKUniquness);

                if ((bool)CheckForBKUniquness)
                {
                    //Поищем на стороне ИБ
                    Exchange       EE          = new Exchange(refCurrentPageContext);
                    InputStructure BarcodeList = await EE.GetGoodListWithBarcode(Barcode);


                    //Поищем здесь
                    List <TablePart> tmpList = new List <TablePart>();
                    foreach (Good locGood in AppGlobals.refPage_GoodList.lv_Goods)
                    {
                        bool boolAllreadyAtList = false;
                        foreach (TablePart tp in BarcodeList.Table0)
                        {
                            if (tp.UID == locGood.uidGood)
                            {
                                boolAllreadyAtList = true;
                                break;
                            }
                            ;
                        }
                        if (boolAllreadyAtList)
                        {
                            continue;
                        }

                        foreach (string locBC in locGood.Barcode)
                        {
                            if (Barcode == locBC)
                            {
                                //BarcodeList.Table0.Add(new TablePart { Metadata = locGood.Metadata, UID = locGood.uidGood, Value0 = locGood.nGood });
                                tmpList.Add(new TablePart {
                                    Metadata = locGood.Metadata, UID = locGood.uidGood, Value0 = locGood.nGood
                                });
                                break;
                            }
                        }
                    }

                    foreach (TablePart locTP in tmpList)
                    {
                        BarcodeList.Table0.Add(new TablePart {
                            Metadata = locTP.Metadata, UID = locTP.UID, Value0 = locTP.Value0
                        });
                    }

                    if (BarcodeList.Table0.Count > 0)
                    {
                        var Answer = await((Page_GoodRedacting)refCurrentPageContext).DisplayAlert("Scan Bee", "Штрихкод не уникален по базе данных! Показать список совпадений?", "Да", "Нет");
                        if (Answer)
                        {
                            ItemList IL = new ItemList(null, null, null, refCurrentPageContext, "OnlyDisplayItemList");
                            foreach (TablePart tp in BarcodeList.Table0)
                            {
                                IL.lv_Items.Add(new TablePart {
                                    Metadata = tp.Metadata, UID = tp.UID, Value0 = tp.Value0
                                });
                            }

                            await refCurrentPageContext.Navigation.PushAsync(IL);
                        }
                        return;
                    }
                }

                Page_GoodRedacting Page_GoodRedacting = (Page_GoodRedacting)refCurrentPageContext;

                bool BarcodesIsEqual = false;
                foreach (string BC in Page_GoodRedacting.GoodItem.Barcode)
                {
                    if (BC == Barcode)
                    {
                        BarcodesIsEqual = true;
                        break;
                    }
                }

                if (!BarcodesIsEqual)
                {
                    string[] NewString = new string[Page_GoodRedacting.GoodItem.Barcode.Length + 1];

                    int counter = 0;
                    foreach (string BC in Page_GoodRedacting.GoodItem.Barcode)
                    {
                        NewString[counter] = BC;
                        counter++;
                    }
                    ;
                    NewString[NewString.Length - 1]     = Barcode;
                    Page_GoodRedacting.GoodItem.Barcode = NewString;

                    Page_GoodRedacting.os_barcodes.Clear();
                    foreach (string BC in Page_GoodRedacting.GoodItem.Barcode)
                    {
                        Page_GoodRedacting.os_barcodes.Add(new BarcodeItem {
                            Barcode = BC
                        });
                    }
                    Page_GoodRedacting.DisplayAlert("Штрихкод добавлен", "", "Ok");
                }
                else
                {
                    Page_GoodRedacting.DisplayAlert("ScanBee", "Штрихкод уже в списке!", "", "Ok");
                };
            }

            if (refCurrentPageContext.GetType() == typeof(Page_EnterValue))          //Поиск товара по ШК
            {
                await((Page_EnterValue)refCurrentPageContext).Navigation.PopAsync(); //ждем, пока в стеке верхняя не будет страница Page_GoodRedacting, потом дергаем сервер
                Exchange EE = new Exchange((Page_GoodRedacting)AppGlobals.refCurrentPageContext);
                await EE.GetGoodByBarcode(Barcode);
            }
            if (refCurrentPageContext.GetType() == typeof(Page_Settings))                //Загрузка настроек по qr-коду
            {
                if (ScanPurpose == "SettingsBarcodeScan")
                {
                    try
                    {
                        string Json = new DataCompression().Extract(Barcode);
                        Settings_From_QRCode SFQ = new JsonSerialization().deserializeJSON <Settings_From_QRCode>(Json);
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            foreach (KeyValuePair <string, object> kv in ((Page_Settings)refCurrentPageContext).Parameters)
                            {
                                if (((Page_Settings)refCurrentPageContext).Parameters[kv.Key] != null)
                                {
                                    //if (((Page_Settings)refCurrentPageContext).Parameters[kv.Key].GetType() == typeof(string))
                                    //{
                                    ((Page_Settings)refCurrentPageContext).Parameters[kv.Key] = SFQ[kv.Key.Replace("ext_", "")];
                                    //}
                                    //if (((Page_Settings)refCurrentPageContext).Parameters[kv.Key].GetType() == typeof(int))
                                    //{
                                    //    ((Page_Settings)refCurrentPageContext).Parameters[kv.Key] = SFQ[kv.Key.Replace("ext_", "")];
                                    //}
                                    //if (((Page_Settings)refCurrentPageContext).Parameters[kv.Key].GetType() == typeof(bool))
                                    //{
                                    //    ((Page_Settings)refCurrentPageContext).Parameters[kv.Key] = SFQ[kv.Key.Replace("ext_", "")];
                                    //}
                                }
                            }
                        });
                    }
                    catch
                    {
                        ((Page)refCurrentPageContext).DisplayAlert("Не удалось распознать входную структуру настроек!", "", "OK");
                    };
                }
            }
        }