示例#1
0
 public void OnClose(KeyEventArgs keyArgs)
 {
     if (ReflexTerminal.CheckIfConnected("Z"))
     {
         ReflexTerminal.CloseReflexTerminal();
     }
     Application.Current.Shutdown();
 }
示例#2
0
 public void Handle(LoginEvent message)
 {
     Login = message.Login?.ToUpper();
     ReflexTerminal.Login    = message.Login.ToUpper();
     ReflexTerminal.Password = message.Password;
     if (ReflexTerminal.TryToLogin())
     {
         //MessageBox.Show("Logged in!");
         _events.PublishOnUIThread(new LoginConfirmedEvent(true));
         //StartSTATask(ReflexLoginAndSetView);
         ReflexTerminal.GoFromLoginToSelectIpgByLocationAsync();
         ReflexTerminal.SetCorrectView();
     }
     this.Location  = SettingsFile.Location;
     this.PrinterIp = SettingsFile.PrinterIp;
     //ReflexTerminal.CloseReflexTerminal();
 }
示例#3
0
 public void Restart()
 {
     HdDataGridModel.CountedHd = null;
     HdDataGridModel.CountedHd = new HdModel(false);
     HdDataGridModel.Hds.Clear();
     ScanningState         = States.firstScanOfHd;
     InformationText       = "Scan HD to start splitting";
     ErrorLabelShowRunning = false;
     HdNumber        = string.Empty;
     Background      = new SolidColorBrush(Colors.Transparent);
     HdTaskIsRunning = false;
     SelectedTab     = 0;
     ReflexTerminal.GoToSelectIpgByLocation();
     ScannedBarcode = string.Empty;
     OnFocusRequested("ScannedBarcode");
     //RefreshTerminalSessionNames();
     //Loaded();
 }
示例#4
0
        private void ItemScan()
        {
            bool ItemNotFound = true;

            try
            {
                foreach (var Ipg in HdDataGridModel.CountedHd.ListOfIpgs)
                {
                    if (Ipg.Item == ScannedBarcode || Ipg.UpcCode == ScannedBarcode)
                    {
                        ScannedItem = ScannedBarcode;
                        //StartSTATask(ReflexScanItem);
                        ReflexTerminal.ItemScanned(ScannedItem);
                        ItemNotFound         = false;
                        IpgToCreate          = Ipg;
                        IndexOfIpgToMinusOne = HdDataGridModel.CountedHd.ListOfIpgs.IndexOf(Ipg);
                        Ipg.Highlight        = "LightGreen";
                        HdDataGridModel.CountedHd.ListOfIpgs.Refresh();
                        ScanningState   = States.newHdScan;
                        Background      = new SolidColorBrush(Colors.Transparent);
                        InformationText = $"Scan HD with Line {IpgToCreate.Line}.";
                        return;
                    }
                }

                if (ItemNotFound)
                {
                    Notify("This item does not belong to this HD.", Brushes.Red);

                    return;
                }
            }
            finally
            {
                ScannedBarcode = string.Empty;
            }
        }
示例#5
0
        private bool SearchForHd(string _hd)
        {
            bool ItemFounded = false;
            bool HdFounded   = false;

            // Look for hd in already opened ones.
            for (int i = 1; i < HdDataGridModel.Hds.Count; i++)
            {
                if (HdDataGridModel.Hds[i].HdNumber == _hd)
                {
                    // Check if Line is correct
                    if (CheckLineAndGrade())
                    {
                        if (HdDataGridModel.Hds[i].Line == IpgToCreate.Line)
                        {
                            foreach (var Ipg in HdDataGridModel.Hds[i].ListOfIpgs)
                            {
                                if (Ipg.Item == IpgToCreate.Item || Ipg.UpcCode == IpgToCreate.UpcCode)
                                {
                                    Ipg.Quantity++;
                                    ItemFounded    = true;
                                    HdForBreakdown = _hd;
                                    ReflexTerminal.ReflexIpgBreakdownToOldHd(HdForBreakdown);
                                    return(true);
                                }
                            }

                            if (!ItemFounded)
                            {
                                HdForBreakdown = _hd;
                                AddIpgToExistingHd(i);
                                ReflexTerminal.ReflexIpgBreakdownToOldHd(HdForBreakdown);
                                return(true);
                            }
                        }
                        else
                        {
                            Notify("This HD have wrong LINE!", Brushes.Red);
                            ScannedBarcode = String.Empty;
                            return(false);
                        }
                    }
                    else
                    {
                        foreach (var Ipg in HdDataGridModel.Hds[i].ListOfIpgs)
                        {
                            if (Ipg.Item == IpgToCreate.Item || Ipg.UpcCode == IpgToCreate.UpcCode)
                            {
                                Ipg.Quantity++;
                                ItemFounded    = true;
                                HdForBreakdown = _hd;
                                ReflexTerminal.ReflexIpgBreakdownToOldHd(HdForBreakdown);
                                return(true);
                            }
                        }

                        if (!ItemFounded)
                        {
                            HdForBreakdown = _hd;
                            AddIpgToExistingHd(i);
                            ReflexTerminal.ReflexIpgBreakdownToOldHd(HdForBreakdown);
                            return(true);
                        }
                    }
                }
            }

            if (!HdFounded)
            {
                var result = ScanHdToCheckLines(_hd);
                if (result == HdResult.hdCorrect || result == HdResult.hdUnknown)
                {
                    string IpgBreakdownResult = null;
                    if (result == HdResult.hdCorrect)
                    {
                        ReflexTerminal.ReflexIpgBreakdownToOldHd(_hd);
                    }
                    else
                    {
                        if (CheckLine)
                        {
                            ZebraModel.Print(IpgToCreate.Line.ToString());
                        }
                        IpgBreakdownResult = ReflexTerminal.ReflexIpgBreakdownToNewHd(_hd, Location);
                    }
                    if (IpgBreakdownResult != null)
                    {
                        Notify(IpgBreakdownResult, Brushes.Red);
                        return(false);
                    }
                    HdDataGridModel.Hds.Add(new HdModel(false)
                    {
                        Grade      = IpgToCreate.Grade,
                        Line       = IpgToCreate.Line,
                        HdNumber   = ScannedBarcode,
                        ListOfIpgs = new BindableCollection <IpgModel>(),
                        TabHeader  = $"{ScannedBarcode} - {IpgToCreate.Line.ToString()}"
                    });
                    //HdForBreakdown = _hd;
                    AddIpgToExistingHd(HdDataGridModel.Hds.Count - 1);

                    //StartSTATask(ReflexIpgBreakdownToNewHd);
                    QuantityMinusOne();
                    return(false);
                }
                else if (result == HdResult.differentLine)
                {
                    Notify("This HD have wrong LINE!", Brushes.Red);
                    ScannedBarcode = String.Empty;
                    return(false);
                }

                // Sprawdź ten HD w reflexie.
            }

            return(false);
        }
示例#6
0
 public void Confirm()
 {
     HdTaskIsRunning = true;
     ReflexTerminal.ConfirmHd(HdDataGridModel.Hds);
     Restart();
 }