private void UpdateUIState() { bool itemSelected = _barcodesListView.SelectedItems.Count > 0; _deleteButton.Enabled = itemSelected; _zoomToButton.Enabled = itemSelected; #if LEADTOOLS_V20_OR_LATER _aamvaButton.Enabled = false; if (_rasterImage != null) { PageBarcodes pageBarcodes = _documentBarcodes.Pages[_rasterImage.Page - 1]; if (pageBarcodes.SelectedIndex > -1) { BarcodeData data = pageBarcodes.Barcodes[pageBarcodes.SelectedIndex]; if (data.Symbology == BarcodeSymbology.PDF417) { AAMVAID id = BarcodeData.ParseAAMVAData(data.GetData(), false); if (id != null) { _aamvaButton.Enabled = true; id.Dispose(); } } } } #endif // #if LEADTOOLS_V20_OR_LATER }
private void BindBarcodeDataToForm(BarcodeData data) { txtName.Text = data.Name; txtAddress.Text = data.Address; txtPost.Text = data.Post; txtAmount.Text = data.Amount.ToString(); txtReceiving.Text = data.Receiving.ToString(); txtNotes.Text = data.Notes.IndexOf('|') >= 0? data.Notes.Remove(0, data.Notes.IndexOf('|') + 1):data.Notes; txtDepartment.Text = data.Department; IList <AdditionItem> additionsItems = AddidtionsList.GetAll(data.Additions); int zone = (data.Additions >> 16); if (zone > 0) { ddlZone.Enabled = true; ddlZone.SelectedValue = (zone & 3).ToString(); } cbAdditions.DataSource = additionsItems; cbAdditions.DataTextField = "Label"; cbAdditions.DataValueField = "FlagValue"; cbAdditions.DataBind(); foreach (AdditionItem item in additionsItems) { ListItem li = cbAdditions.Items.FindByValue(item.FlagValue.ToString()); if (li != null) { li.Selected = item.Checked; } } }
public byte[] GetDataMatrixWithAddressAsPdf(BarcodeData data, string[] addressLines) { Dictionary <string, string> configData = new EsodaConfigParametersDAO().GetConfig(); int height = 297; int.TryParse(configData["printPageHeight"], out height); int width = 210; int.TryParse(configData["printPageWidth"], out width); int left = 0; int.TryParse(configData["codePosLeft"], out left); int top = 0; int.TryParse(configData["codePosTop"], out top); _tool.DataToEncode = data; _tool.PDFDocumentWidth = width; _tool.PDFDocumentHeight = height; return(_tool.GetPDFWithBarcodeAndAddress(top, left, addressLines)); }
private void generatePreview(BarcodeData data) { IDataMatrixService service = new DataMatrixService(); byte[] imgContent = service.GetDataMatrix(data, ImageFormat.Png); imgPreview.Src = string.Format("data:image/png;base64,{0}", Convert.ToBase64String(imgContent)); }
protected void btnGenerate_click(object sender, EventArgs e) { int docID = CoreObject.GetId(Request); BarcodeData newData = GetBarcodeDataFromForm(); newData.SentBy = Membership.GetUser().Comment; //documentID temporary in notes! newData.Notes = docID.ToString() + "|" + newData.Notes; XmlSerializer serializer = new XmlSerializer(typeof(BarcodeData)); if (Button1.CommandName == "Cancel") { newData.SendDate = null; } using (Stream ms = new MemoryStream()) { serializer.Serialize(ms, newData); ms.Seek(0, SeekOrigin.Begin); XmlReader xr = XmlReader.Create(ms); IDataMatrixService service = new DataMatrixService(); new DocumentDAO().SetDataMatrix(docID, (Guid)Membership.GetUser().ProviderUserKey, xr); Response.Redirect(Request.Url.AbsoluteUri, true); } }
private void _okButton_Click(object sender, EventArgs e) { // Set all the options to the engine BarcodeWriteOptions[] defaultOptions = _barcodeEngine.Writer.GetAllDefaultOptions(); foreach (SymbologyGroup group in _groupsListBox.Items) { foreach (BarcodeWriteOptions defaultOption in defaultOptions) { if (defaultOption.GetType() == group.WriteOptions.GetType()) { group.WriteOptions.CopyTo(defaultOption); } } } _selectedGroupIndex = _groupsListBox.SelectedIndex; _selectedSymbology = (BarcodeSymbology)_availableSymbologyListBox.SelectedItem; BarcodeData data = _dataPropertyGrid.SelectedObject as BarcodeData; if (!_writeBarcodeDelegate(data)) { DialogResult = DialogResult.None; } }
private void readBarcodesButton_Click(object sender, EventArgs e) { if (theImage == null) { loadImageButton_Click(sender, e); } try { // Read all the barcodes // The first parameter is the image from which to read the barcodes. // The second parameter is the search rectangle. Pass an empty rectangle to search the entire image. // The third parameter is the maximum number of barcodes to read. Pass 0 for all found in the image. // The last parameter is an array of the BarcodeSymbology that we are interested in finding. Pass null (or Nothing) // to find all available barcodes found in the image and supported by the current license. BarcodeData[] dataArray = barcodeEngineInstance.Reader.ReadBarcodes(theImage, LeadRect.Empty, 0, null); StringBuilder sb = new StringBuilder(); sb.AppendFormat("{0} barcode(s) found", dataArray.Length); sb.AppendLine(); for (int i = 0; i < dataArray.Length; i++) { BarcodeData data = dataArray[i]; sb.AppendFormat("Symbology: {0}, Location: {1}, Data: {2}", data.Symbology.ToString(), data.Bounds.ToString(), data.Value); sb.AppendLine(); } } catch (Exception ex) { } }
public frmInputBarcode() { InitializeComponent(); Entity = new BarcodeData(); AddBinding("Barcode", txtBarcode, eNumberFormat.Decimal); }
private void onAnotherStickerScan(BarcodeData barcodeData) { //if (barcodeData.StickerId == currentBarcodeData.PreviousStickerCode // && !currentBarcodeData.Cell.Empty) // { // notifyCellUpdated(); // return; // } barcodeData.ReadStickerInfo(); if (!barcodeData.LocatedInCell) { showPalletCellNotFountMessage(); return; } if (barcodeData.StickerId == currentBarcodeData.PreviousStickerCode && !currentBarcodeData.Cell.Empty && barcodeData.Cell.Id == currentBarcodeData.Cell.Id) { notifyCellUpdated(); return; } if (!string.Format(@"Розмістити у комірці ""{0}"" після палети № {1}", barcodeData.Cell.Description, barcodeData.StickerId).Ask()) { return; } this.currentBarcodeData.Cell.CopyFrom(barcodeData.Cell); this.currentBarcodeData.PreviousStickerCode = barcodeData.StickerId; notifyCellUpdated(); }
private void scanNextPalletOnBarcode(string barcode) { if (!barcode.IsSticker()) { return; } var barcodeData = barcode.ToBarcodeData(); if (processedPallets.ContainsKey(barcodeData.StickerId)) { "Ця палета вже була оброблена".ShowMessage(); return; } if (!barcodeData.ReadStickerInfo()) { return; } startBarcodeData = barcodeData; finalBarcodeData = barcodeData.GetCopy(); ShowControls(palletEditControls); updateStickerData(); }
private void proceed() { factPickingData.TotalUnitsQuantity = unitsCount + packsCount * factPickingData.UnitsPerBox; var palletNotEmptyNow = totalUnitsQuantityOnPallet != factPickingData.TotalUnitsQuantity; if (palletNotEmptyNow) { factPickingData.LinersAmount = linersCount; } pickingTaskData.Tray.CopyFrom(factPickingData.Tray); pickingTaskData.Liner.CopyFrom(factPickingData.Liner); pickingTaskData.LinersAmount = factPickingData.LinersAmount; var resultWriter = new TableMovementWriter(pickingTaskData, factPickingData); resultWriter.SetStartCell(factPickingData.Cell); int _sameWareNextTaskLineNumber; var success = Program.AramisSystem.WritePickingResult(documentId, currentLineNumber, resultWriter.Table, factPickingData.Party.Id, out _sameWareNextTaskLineNumber); if (success) { factPickingData = null; this.sameWareNextTaskLineNumber = _sameWareNextTaskLineNumber; startPalletChoosing(0, 0); } else if (lastQueryIsSuccessfull) { "Нема доступу до документу".Warning(); } }
private void TryAddFloater(ImageViewerItem item) { PDF417BarcodeData barcodeData = (PDF417BarcodeData)BarcodeData.CreateDefaultBarcodeData(BarcodeSymbology.PDF417); barcodeData.SetData(_data); _engine.Writer.CalculateBarcodeDataBounds(LeadRect.Empty, item.Image.XResolution, item.Image.YResolution, barcodeData, _writeOptions); if (barcodeData.Rect.Width <= item.Image.Width && barcodeData.Rect.Height <= item.Image.Height) { _bigEnoughForBarcode = true; this.ImageViewer.Cursor = System.Windows.Forms.Cursors.Default; RasterImage floaterImage = RasterImage.Create(barcodeData.Rect.Width, barcodeData.Rect.Height, 32, Math.Max(item.Image.XResolution, item.Image.YResolution), RasterColor.Create(0, 255, 255, 255)); _engine.Writer.WriteBarcode(floaterImage, barcodeData, _writeOptions); item.Floater = floaterImage; item.FloaterOpacity = 0.5; } else { this.ImageViewer.Cursor = System.Windows.Forms.Cursors.No; _bigEnoughForBarcode = false; } }
private string GetNewPdfFileName(string pdfFileName, BarcodeData barcodes, int pageStart, int pageEnd) { string str = _directoryData.SplitPdfName; pdfFileName = Path.GetFileNameWithoutExtension(pdfFileName); if (barcodes != null) { string codeVal = barcodes.Value; str = str.Replace("{barcode}", "{" + codeVal + "}"); } else { str = str.Replace("{barcode}", "{#ERROR}"); } int unixtimestamp = (int)Math.Truncate((DateTime.Now.ToUniversalTime().Subtract(new DateTime(1970, 1, 1))).TotalSeconds); str = str.Replace("{timestamp}", "{" + unixtimestamp.ToString() + "}"); str = str.Replace("{basename}", "{" + pdfFileName + "}"); str = str.Replace("{startpage}", "{" + pageStart.ToString() + "}"); str = str.Replace("{endpage}", "{" + pageEnd.ToString() + "}"); str = str.Replace("{pages}", "{" + (pageEnd - pageStart).ToString() + "}"); str = str.Replace("}{", ""); str = str.Replace("{", ""); str = str.Replace("}", ""); str = Path.Combine(_directoryData.FolderOutput, str); str += ".pdf"; return(str); }
static void Main(string[] args) { String fileToConvert = @"FILE PATH HERE"; RasterSupport.SetLicense(@"C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC", System.IO.File.ReadAllText(@"C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC.KEY")); using (RasterCodecs codecs = new RasterCodecs()) { using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false)) { ocrEngine.Startup(null, null, null, @"C:\LEADTOOLS 20\Bin\Common\OcrLEADRuntime"); using (IOcrPage ocrPage = ocrEngine.CreatePage(ocrEngine.RasterCodecsInstance.Load(fileToConvert, 1), OcrImageSharingMode.AutoDispose)) { ocrPage.AutoZone(null); ocrPage.Recognize(null); string recognizedCharacters = ocrPage.GetText(-1); BarcodeEngine engine = new BarcodeEngine(); int resolution = 300; using (RasterImage image = RasterImage.Create((int)(8.5 * resolution), (int)(11.0 * resolution), 1, resolution, RasterColor.FromKnownColor(RasterKnownColor.White))) { BarcodeWriter writer = engine.Writer; QRBarcodeData data = BarcodeData.CreateDefaultBarcodeData(BarcodeSymbology.QR) as QRBarcodeData; data.Bounds = new LeadRect(0, 0, image.ImageWidth, image.ImageHeight); QRBarcodeWriteOptions writeOptions = writer.GetDefaultOptions(data.Symbology) as QRBarcodeWriteOptions; writeOptions.XModule = 30; writeOptions.HorizontalAlignment = BarcodeAlignment.Near; writeOptions.VerticalAlignment = BarcodeAlignment.Near; data.Value = recognizedCharacters; writer.CalculateBarcodeDataBounds(new LeadRect(0, 0, image.ImageWidth, image.ImageHeight), image.XResolution, image.YResolution, data, writeOptions); Console.WriteLine("{0} by {1} pixels", data.Bounds.Width, data.Bounds.Height); writer.WriteBarcode(image, data, writeOptions); CropCommand cmd = new CropCommand(new LeadRect(0, 0, data.Bounds.Width, data.Bounds.Height)); cmd.Run(image); codecs.Save(image, "QR.tif", RasterImageFormat.CcittGroup4, 1); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { var process = new Process(); process.StartInfo = new ProcessStartInfo("QR.tif") { UseShellExecute = true }; process.Start(); } Console.WriteLine(); } } } } }
private void startScanNextPallet() { currentBarcodeData = null; ShowControls(scanNextPalletControls); palletEditControls.cellLabel.SetFontColor(MobileFontColors.Disable); cellDefined = false; updateFinishCellText(); }
private void showLinersControls(BarcodeData barcodeData) { var controlsVisible = barcodeData.Liner.Id != Program.Consts.WoodLinerId && barcodeData.LinersAmount > 0; quantityEditControls.linersCountTextBox.Visible = controlsVisible; quantityEditControls.linersLabel.Visible = controlsVisible; quantityEditControls.linersCountTextBox.Text = controlsVisible ? string.Empty : barcodeData.LinersAmount.ToString(); }
//public static byte[] CreateBarcode( string value, int resolution, int Width, int Height, bool Save2File,bool usingMemory, ref string ErrMsg) //{ // byte[] arrImg; // BarcodeEngine barEngine; // try // { // RasterImage theImage = RasterImage.Create((int)(8.5 * resolution), (int)(11.0 * resolution), 1, resolution, RasterColor.FromKnownColor(RasterKnownColor.White)); // // Unlock barcode support. // // Note that this is a sample key, which will not work in your toolkit // BarcodeEngine.Startup(BarcodeMajorTypeFlags.Barcodes1d); // BarcodeEngine.Startup(BarcodeMajorTypeFlags.BarcodesPdfWrite); // BarcodeEngine.Startup(BarcodeMajorTypeFlags.BarcodesDatamatrixWrite); // BarcodeEngine.Startup(BarcodeMajorTypeFlags.BarcodesQrWrite); // // Initialize barcodes // barEngine = new BarcodeEngine(); // BarcodeData data = new BarcodeData(); // LeadRect rc = new LeadRect(0, 0, Width, Height); // data.Unit = BarcodeUnit.ScanlinesPerPixels; // data.Location = rc; // data.SearchType = BarcodeSearchTypeFlags.DatamatrixDefault; // string[] barcodeText; // barcodeText = new string[1]; // barcodeText[0] = value; // data.Data = BarcodeData.ConvertFromStringArray(barcodeText); // BarcodeColor barColor = new BarcodeColor(); // barColor.BarColor = RasterColor.FromKnownColor(RasterKnownColor.Black); // barColor.SpaceColor = RasterColor.FromKnownColor(RasterKnownColor.White); // Barcode1d bar1d = new Barcode1d(); // BarcodeWritePdf barPDF = new BarcodeWritePdf(); // BarcodeWriteDatamatrix barDM = new BarcodeWriteDatamatrix(); // bar1d.StandardFlags = Barcode1dStandardFlags.Barcode1dCode128EncodeA; // barDM.Justify = BarcodeJustifyFlags.Right; // barDM.FileIdHigh = 0; // barDM.FileIdLow = 0; // barDM.GroupNumber = 0; // barDM.GroupTotal = 0; // barDM.XModule = 0; // BarcodeWriteQr barQR = new BarcodeWriteQr(); // string barcodeFileName = AppDomain.CurrentDomain.BaseDirectory + @"\barcode.tif"; // barEngine.Write(theImage, data, barColor, BarcodeWriteFlags.UseColors | BarcodeWriteFlags.Transparent | BarcodeWriteFlags.DisableCompression, bar1d, barPDF, barDM, barQR, LeadRect.Empty); // if (usingMemory) // { // using (MemoryStream _stream = new MemoryStream()) // { // using (RasterCodecs _Codecs = new RasterCodecs()) // { // _Codecs.Save(theImage, _stream, RasterImageFormat.Tif, theImage.BitsPerPixel); // arrImg = _stream.ToArray(); // if (Save2File) // { // _Codecs.Save(theImage, barcodeFileName, RasterImageFormat.Tif, theImage.BitsPerPixel); // } // } // } // } // else // { // using (RasterCodecs _Codecs = new RasterCodecs()) // { // _Codecs.Save(theImage, barcodeFileName, RasterImageFormat.Tif, theImage.BitsPerPixel); // arrImg = System.IO.File.ReadAllBytes(barcodeFileName); // } // } // } // catch (Exception ex) // { // ErrMsg = ex.Message; // return null; // } // return arrImg; //} public static byte[] CreateBarcode(BarcodeSymbology _BarcodeSymbology, string value, int resolution, int Width, int Height, bool Save2File, bool usingMemory, ref string ErrMsg) { ErrMsg = ""; BarcodeEngine barcodeEngineInstance = new BarcodeEngine(); RasterImage theImage = RasterImage.Create((int)(8.5 * resolution), (int)(11.0 * resolution), 1, resolution, RasterColor.FromKnownColor(RasterKnownColor.White)); // Create a UPC A barcode BarcodeData data = new BarcodeData(); data.Symbology = _BarcodeSymbology; data.Value = value; data.Bounds = new LogicalRectangle(10, 10, Width, Height, LogicalUnit.Pixel); // Setup the options to enable error checking and show the text on the bottom of the barcode OneDBarcodeWriteOptions options = new OneDBarcodeWriteOptions(); options.EnableErrorCheck = true; options.TextPosition = BarcodeOutputTextPosition.None;// OneDBarcodeTextPosition.Default; byte[] arrImg; try { string barcodeFileName = AppDomain.CurrentDomain.BaseDirectory + @"\barcode.tif"; // Write the barcode barcodeEngineInstance.Writer.WriteBarcode(theImage, data, options); if (usingMemory) { using (MemoryStream _stream = new MemoryStream()) { using (RasterCodecs _Codecs = new RasterCodecs()) { _Codecs.Save(theImage, _stream, RasterImageFormat.Tif, theImage.BitsPerPixel); arrImg = _stream.ToArray(); if (Save2File) { _Codecs.Save(theImage, barcodeFileName, RasterImageFormat.Tif, theImage.BitsPerPixel); } } } } else { using (RasterCodecs _Codecs = new RasterCodecs()) { _Codecs.Save(theImage, barcodeFileName, RasterImageFormat.Tif, theImage.BitsPerPixel); arrImg = System.IO.File.ReadAllBytes(barcodeFileName); } } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); ErrMsg = ex.Message; return(null); } return(arrImg); }
/// <summary> /// ɨÃè /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks></remarks> private void btnBOOKSN_BarcodeScanned(object sender, BarcodeData e) { if (string.IsNullOrEmpty(e.ErrorInfo)) { if (e.Barcode.Length > 0) { txtBOOKSNID.Text = e.Barcode; } } }
public void TestHouseOfFrazer() { BarcodeData data = null; HouseOfFrazerBarcodeConfig cfg = new HouseOfFrazerBarcodeConfig(); if (cfg.ParseBarcode("39236318582620123638", ref data)) { Debug.Write("OK"); } }
/// <summary> /// 扫码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks></remarks> private void btnNB_CODE_BarcodeScanned(object sender, BarcodeData e) { if (string.IsNullOrEmpty(e.ErrorInfo)) { if (e.Barcode.Length > 0) { txtNB_EQNO.Text = e.Barcode; } } }
private void barcodeButton1_BarcodeScanned(object sender, BarcodeData e) { if (e.Barcode.Length > 0) { if (e.Barcode.ToUpper().StartsWith("HTTP")) { this.RedirectUrl("", e.Barcode); } } this.label1.Text = e.Barcode; }
public static BarcodeView CreateBarcode(string Filename) { using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) { tx.Create(); // assemble the barcode URL BarcodeData data = new BarcodeData() { Barcode = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Home/ViewDocument?document=" + Filename }; // load the barcode template tx.Load(HttpContext.Current.Server.MapPath("~/App_Data/barcode.tx"), TXTextControl.StreamType.InternalUnicodeFormat); MailMerge mm = new MailMerge() { TextComponent = tx }; // merge the barcode mm.MergeObject(data); BarcodeView view = new BarcodeView() { Url = data.Barcode }; // create an return the barcode image foreach (TXTextControl.DataVisualization.BarcodeFrame barcode in tx.Barcodes) { byte[] imageArray; MemoryStream ms = new MemoryStream(); ((TXTextControl.Barcode.TXBarcodeControl)barcode.Barcode).SaveImage( ms, System.Drawing.Imaging.ImageFormat.Png); imageArray = new byte[ms.Length]; ms.Seek(0, System.IO.SeekOrigin.Begin); ms.Read(imageArray, 0, (int)ms.Length); view.Image = "data:image/png;base64," + Convert.ToBase64String(imageArray); return(view); } return(null); } }
private void tryCheckNewSticker(BarcodeData barcodeData) { if (newStickerId != barcodeData.StickerId) { if ("Удалить новую этикетку?".Ask()) { newStickerId = 0; updateScanPalletLabelText(); } return; } startCellIdentification(); }
/// <summary> /// Called by MainForm and internally whenever the document barcodes are updated /// </summary> public void Populate() { _barcodesListView.Items.Clear(); if (_documentBarcodes != null && _rasterImage != null) { PageBarcodes pageBarcodes = _documentBarcodes.Pages[_rasterImage.Page - 1]; foreach (BarcodeData data in pageBarcodes.Barcodes) { ListViewItem item = new ListViewItem(); item.Text = BarcodeEngine.GetSymbologyFriendlyName(data.Symbology); LeadRect rc = data.Bounds; item.SubItems.Add(string.Format("{0}, {1}, {2}, {3}", rc.Left, rc.Top, rc.Right, rc.Bottom)); string value = data.Value; if (!string.IsNullOrEmpty(value)) { // Parse the QR barcodes for ECI data string eciData = null; if (data.Symbology == BarcodeSymbology.QR || data.Symbology == BarcodeSymbology.MicroQR) { eciData = BarcodeData.ParseECIData(data.GetData()); } if (!string.IsNullOrEmpty(eciData)) { item.SubItems.Add(eciData); } else { item.SubItems.Add(value); } } else { item.SubItems.Add("<NO DATA>"); } _barcodesListView.Items.Add(item); } if (pageBarcodes.SelectedIndex != -1) { _barcodesListView.Items[pageBarcodes.SelectedIndex].Selected = true; _barcodesListView.EnsureVisible(pageBarcodes.SelectedIndex); } } UpdateUIState(); }
private void HandleData(ReaderData data) { if (Scanned != null) { var barcodeData = new BarcodeData { Text = data.Text, BarcodeType = (BarcodeTypes)data.Type }; Scanned.Invoke(this, new ScannedDataEventArgs(new[] { barcodeData })); } scannerStatus = ScannerStatus.Opened; }
private void _availableSymbologyListBox_SelectedIndexChanged(object sender, EventArgs e) { BarcodeSymbology symbology = (BarcodeSymbology)_availableSymbologyListBox.SelectedItem; BarcodeData oldData = _dataPropertyGrid.SelectedObject as BarcodeData; BarcodeData newData = BarcodeData.CreateDefaultBarcodeData(symbology); // Get the old data bounds and set it into the new barcode if (oldData != null) { newData.Bounds = oldData.Bounds; } _dataPropertyGrid.SelectedObject = newData; UpdateUIState(); }
private bool GetBarcodePosition(BarcodeData barcodeData) { if (BarcodeMap.AllBarcode.ContainsKey(barcodeData.ID)) { barcodeData.MapPosition = BarcodeMap.AllBarcode[barcodeData.ID].Position; barcodeData.LineId = BarcodeMap.AllBarcode[barcodeData.ID].BarcodeLineID; barcodeData.Type = BarcodeMap.AllBarcode[barcodeData.ID].Type; return(true); } else { return(false); } }
private void acceptWare(BarcodeData barcodeData) { barcodeData.ReadStickerInfo(); var itIsNewPallet = barcodeData.StickerId == newStickerId; if (!itIsNewPallet) { if (barcodeData.Nomenclature.Id != currentWare.Id) { string.Format("Продукция в паллете другая: {0}", barcodeData.Nomenclature.Description).ShowMessage(); return; } if (barcodeData.Party.Id != currentParty.Id) { string.Format("Дата производства в паллете другая: {0}", barcodeData.Party.Description) .ShowMessage(); return; } if (barcodeData.Liner.Id > 0 && barcodeData.Liner.Id != currentLiner.Id && !currentLiner.Empty) { string.Format("В указанной паллете используются другой вид прокладок: {0}", barcodeData.Liner.Description) .ShowMessage(); return; } if (!barcodeData.LocatedInCell) { "Паллеты нет на остатках".ShowMessage(); return; } currentCell = barcodeData.Cell; } if (acceptanceId == 0 && !Program.AramisSystem.CreateNewAcceptance(out acceptanceId)) { notifyUserIfConnectionIsBroken(); return; } if (!Program.AramisSystem.WriteStickerFact(acceptanceId, barcodeData.StickerId, false, currentCell.Id, previousStickerId, 0, currentLiner.Id, returnWareControls.LinersCountTextBox.GetNumber(), returnWareControls.PacksCountTextBox.GetNumber(), returnWareControls.UnitsCountTextBox.GetNumber())) { return; } startNewIdentification(); }
/// <summary> /// 바코드 검출 시 발생하는 콜백 함수입니다. /// </summary> /// <param name="barcodeData"></param> private void OnBarcodeDetected(BarcodeData barcodeData) { // 지연 시간 동안 바코드 스캔 결과를 전달하지 않음 var ts = DateTime.Now.TimeOfDay - _preDetectionDt.TimeOfDay; if (ts.TotalMilliseconds < Element.DelayBetweenDetections) { return; } _preDetectionDt = DateTime.Now; Element?.OnBarcodeDetected(barcodeData); }
private void DrawBarcodeData(Graphics g, RasterImage image, BarcodeData data, StringFormat sf, Brush brush, Pen pen) { LeadRect rect = data.Bounds; LeadRectD rc = new LeadRectD(rect.X, rect.Y, rect.Width, rect.Height); string line = BarcodeEngine.GetSymbologyFriendlyName(data.Symbology); if (FourPoints && data.Symbology != BarcodeSymbology.Aztec && data.Symbology != BarcodeSymbology.Maxi && data.Symbology != BarcodeSymbology.MicroQR) { LeadPointD[] pointsL = new LeadPointD[4]; Point[] points = new Point[4]; pointsL[0].X = ((int)rc.Left & 0xffff); pointsL[0].Y = ((int)rc.Left >> 16); pointsL[1].X = ((int)rc.Top & 0xffff); pointsL[1].Y = ((int)rc.Top >> 16); pointsL[2].X = ((int)rc.Width & 0xffff); pointsL[2].Y = ((int)rc.Width >> 16); pointsL[3].X = ((int)rc.Height & 0xffff); pointsL[3].Y = ((int)rc.Height >> 16); _rasterImageViewer.ImageTransform.TransformPoints(pointsL); for (int i = 0; i < 4; i++) { points[i].X = (int)pointsL[i].X; points[i].Y = (int)pointsL[i].Y; } g.DrawPolygon(pen, points); SizeF size = g.MeasureString(line, Font, points[2].X - points[0].X, sf); rc.Width = (int)size.Width + 1; rc.Height = (int)size.Height + 1; g.FillRectangle(brush, points[0].X, points[0].Y, (int)rc.Width, (int)rc.Height); g.DrawString(line, Font, Brushes.White, new RectangleF(points[0].X, points[0].Y, (int)rc.Width, (int)rc.Height), sf); } else { rc = _rasterImageViewer.ImageTransform.TransformRect(rc); rc.Inflate(3, 3); if (rc.Width < 10 || rc.Height < 10) { return; } g.DrawRectangle(pen, (int)rc.X, (int)rc.Y, (int)rc.Width, (int)rc.Height); SizeF size = g.MeasureString(line, Font, (int)rc.Width, sf); rc.Width = (int)size.Width + 1; rc.Height = (int)size.Height + 1; g.FillRectangle(brush, (int)rc.X, (int)rc.Y, (int)rc.Width, (int)rc.Height); g.DrawString(line, Font, Brushes.White, new RectangleF((int)rc.X, (int)rc.Y, (int)rc.Width, (int)rc.Height), sf); } }
public VisionData() { BarcodeScanResult = new BarcodeData(); LargeBoxScanResult = new LargeBoxScanData(); }