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); }
public void PrintLabel() { var line = HdDataGridModel.Hds[SelectedTab].Line.ToString(); ZebraModel.Print(line); }