【开源免费】二维码批量识别-未来之窗——C#-仙盟创梦IDE
二维码批量识别工具,借助先进图像识别技术,能快速准确读取大量二维码信息。适用于物流与供应链管理,如库存盘点和货物追踪;可用于资产管理,像固定资产盘点与设备巡检;还能助力数据收集与市场调研,比如问卷调查与活动签到。它能将识别信息导出为 Excel 等常见表格,表格结构清晰,方便用户对海量二维码数据高效采集、整理与分析,大幅提升工作效率。
一、工具概述
二维码批量识别工具是一款专门设计用于高效处理大量二维码的软件应用。它利用先进的图像识别技术,能够快速准确地读取众多二维码所包含的信息,并将这些信息按照用户需求进行整理和导出,极大地提高了数据采集和处理的效率。
二、主要用途
(一)物流与供应链管理
- 库存盘点:在仓库管理中,货物通常贴有包含产品信息(如名称、规格、批次、生产日期等)的二维码标签。通过二维码批量识别工具,工作人员只需使用扫码设备快速扫描仓库内的货物二维码,即可瞬间获取所有货物信息,并自动生成库存清单。这不仅节省了大量手动记录的时间,还避免了人工录入可能产生的错误,确保库存数据的准确性。
- 货物追踪:从货物的生产下线到最终送达客户手中,每个环节都可以通过二维码进行标识。在运输过程中,物流人员可以使用该工具在各个节点批量扫描货物二维码,实时更新货物的位置和状态信息。这样,企业管理者和客户都能够随时了解货物的运输进度,提高物流透明度,便于及时处理可能出现的问题,如延误、丢失等。
(二)资产管理
- 固定资产管理:对于企业或机构的固定资产,如办公设备、电子仪器、家具等,为每件资产贴上二维码标签,记录资产编号、购置日期、使用部门、使用人等详细信息。利用二维码批量识别工具,管理人员可以定期对资产进行快速盘点,轻松掌握资产的分布、使用状况,及时发现闲置或丢失的资产,优化资产配置,提高资产利用率。
- 设备巡检:在工业生产、电力设施、通信基站等领域,需要对大量设备进行定期巡检以确保其正常运行。通过为设备附上二维码,巡检人员使用工具批量扫描设备二维码,不仅能快速获取设备的基本信息和历史巡检记录,还可以实时录入本次巡检的结果(如设备运行参数、是否存在故障等)。这些数据能够及时反馈到管理系统,方便管理人员对设备进行状态评估和维护决策。
(三)数据收集与市场调研
- 问卷调查:在市场调研、学术研究等场景中,可将问卷链接生成二维码印刷在问卷上或通过线上渠道发布。受访者通过扫描二维码填写问卷。收集问卷时,使用二维码批量识别工具可以快速获取所有问卷的反馈信息,并将其整理成结构化的数据表格。这样大大简化了数据收集和整理的流程,使研究人员能够更快速地进行数据分析,得出有价值的结论。
- 活动签到:在各类会议、培训、展会等活动中,为参会人员发送包含个人信息的二维码电子邀请函。活动现场,工作人员使用批量识别工具快速扫描二维码完成签到,同时自动记录签到时间等信息。这些数据可导出为表格,方便活动组织者统计参会人数、分析参会人员的来源和行为等,为后续活动策划提供参考。
三、导出表格功能
该工具支持将识别出的二维码信息导出为常见的表格格式,如 Excel 表格。导出的表格具有清晰的结构,每一行对应一个二维码的信息,每一列代表不同的信息字段(如二维码类型、内容、扫描时间等)。用户可以根据实际需求对表格进行进一步的编辑、分析和处理,例如筛选特定信息、进行数据排序、计算统计数据等。通过这种方式,二维码批量识别工具不仅实现了信息的快速采集,还为后续的数据管理和决策提供了便利。
核心源码
namespace CyberWin.Work.Trade.Net.Ynwlzc.QrBatch
{public class Form1 : Form{private IContainer components;private Button btn_打开图片;private PictureBox barCodeImg;private Button btn_读取二维码;private TextBox ContentTxt;private FolderBrowserDialog folderBrowserDialog1;private DataGridView dgv_fileqr;private Button btn_浏览文件夹;private TextBox txt_folder;private Button btn_savebatch;private Button btn_batch_解码;private Button btn_列举文件;private DataGridViewTextBoxColumn FileName;private DataGridViewTextBoxColumn QR;private DataGridViewTextBoxColumn status;private DataGridViewTextBoxColumn FileFullPath;private Button button1;private Button button_读取二维码TH;protected override void Dispose(bool disposing){if (disposing && this.components != null)this.components.Dispose();base.Dispose(disposing);}private void InitializeComponent(){this.btn_打开图片 = new Button();this.barCodeImg = new PictureBox();this.btn_读取二维码 = new Button();this.ContentTxt = new TextBox();this.folderBrowserDialog1 = new FolderBrowserDialog();this.dgv_fileqr = new DataGridView();this.FileName = new DataGridViewTextBoxColumn();this.QR = new DataGridViewTextBoxColumn();this.status = new DataGridViewTextBoxColumn();this.FileFullPath = new DataGridViewTextBoxColumn();this.btn_浏览文件夹 = new Button();this.txt_folder = new TextBox();this.btn_savebatch = new Button();this.btn_batch_解码 = new Button();this.btn_列举文件 = new Button();this.button1 = new Button();this.button_读取二维码TH = new Button();((ISupportInitialize) this.barCodeImg).BeginInit();((ISupportInitialize) this.dgv_fileqr).BeginInit();this.SuspendLayout();this.btn_打开图片.Location = new Point(869, 32);this.btn_打开图片.Name = "btn_打开图片";this.btn_打开图片.Size = new Size(87, 32);this.btn_打开图片.TabIndex = 0;this.btn_打开图片.Text = "打开图片";this.btn_打开图片.UseVisualStyleBackColor = true;this.btn_打开图片.Click += new EventHandler(this.btn_打开图片_Click);this.barCodeImg.Location = new Point(511, 56);this.barCodeImg.Name = "barCodeImg";this.barCodeImg.Size = new Size(302, 273);this.barCodeImg.SizeMode = PictureBoxSizeMode.Zoom;this.barCodeImg.TabIndex = 1;this.barCodeImg.TabStop = false;this.btn_读取二维码.Location = new Point(869, 70);this.btn_读取二维码.Name = "btn_读取二维码";this.btn_读取二维码.Size = new Size(87, 30);this.btn_读取二维码.TabIndex = 2;this.btn_读取二维码.Text = "读取二维码";this.btn_读取二维码.UseVisualStyleBackColor = true;this.btn_读取二维码.Click += new EventHandler(this.btn_读取二维码_Click);this.ContentTxt.Location = new Point(12, 349);this.ContentTxt.Name = "ContentTxt";this.ContentTxt.Size = new Size(536, 21);this.ContentTxt.TabIndex = 3;this.dgv_fileqr.AllowUserToAddRows = false;this.dgv_fileqr.AllowUserToDeleteRows = false;this.dgv_fileqr.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;this.dgv_fileqr.Columns.AddRange((DataGridViewColumn) this.FileName, (DataGridViewColumn) this.QR, (DataGridViewColumn) this.status, (DataGridViewColumn) this.FileFullPath);this.dgv_fileqr.Location = new Point(12, 32);this.dgv_fileqr.Name = "dgv_fileqr";this.dgv_fileqr.ReadOnly = true;this.dgv_fileqr.RowTemplate.Height = 23;this.dgv_fileqr.SelectionMode = DataGridViewSelectionMode.FullRowSelect;this.dgv_fileqr.Size = new Size(493, 311);this.dgv_fileqr.TabIndex = 4;this.FileName.HeaderText = "文件名";this.FileName.Name = "FileName";this.FileName.ReadOnly = true;this.QR.HeaderText = "二维码";this.QR.Name = "QR";this.QR.ReadOnly = true;this.status.HeaderText = "状态";this.status.Name = "status";this.status.ReadOnly = true;this.FileFullPath.HeaderText = "文件路径";this.FileFullPath.Name = "FileFullPath";this.FileFullPath.ReadOnly = true;this.btn_浏览文件夹.Location = new Point(403, 3);this.btn_浏览文件夹.Name = "btn_浏览文件夹";this.btn_浏览文件夹.Size = new Size(75, 23);this.btn_浏览文件夹.TabIndex = 5;this.btn_浏览文件夹.Text = "浏览文件夹";this.btn_浏览文件夹.UseVisualStyleBackColor = true;this.btn_浏览文件夹.Click += new EventHandler(this.btn_浏览文件夹_Click);this.txt_folder.Location = new Point(12, 3);this.txt_folder.Name = "txt_folder";this.txt_folder.Size = new Size(379, 21);this.txt_folder.TabIndex = 6;this.btn_savebatch.Location = new Point(690, 3);this.btn_savebatch.Name = "btn_savebatch";this.btn_savebatch.Size = new Size(114, 21);this.btn_savebatch.TabIndex = 7;this.btn_savebatch.Text = "导出结果";this.btn_savebatch.UseVisualStyleBackColor = true;this.btn_savebatch.Click += new EventHandler(this.btn_savebatch_Click);this.btn_batch_解码.Location = new Point(565, 3);this.btn_batch_解码.Name = "btn_batch_解码";this.btn_batch_解码.Size = new Size(119, 21);this.btn_batch_解码.TabIndex = 8;this.btn_batch_解码.Text = "批量读取二维码";this.btn_batch_解码.UseVisualStyleBackColor = true;this.btn_batch_解码.Click += new EventHandler(this.btn_batch_解码_Click);this.btn_列举文件.Location = new Point(484, 3);this.btn_列举文件.Name = "btn_列举文件";this.btn_列举文件.Size = new Size(75, 23);this.btn_列举文件.TabIndex = 9;this.btn_列举文件.Text = "列举文件";this.btn_列举文件.UseVisualStyleBackColor = true;this.btn_列举文件.Click += new EventHandler(this.btn_列举文件_Click);this.button1.Location = new Point(869, 106);this.button1.Name = "button1";this.button1.Size = new Size(87, 30);this.button1.TabIndex = 10;this.button1.Text = "裁剪";this.button1.UseVisualStyleBackColor = true;this.button1.Click += new EventHandler(this.button1_Click);this.button_读取二维码TH.Location = new Point(869, 151);this.button_读取二维码TH.Name = "button_读取二维码TH";this.button_读取二维码TH.Size = new Size(87, 30);this.button_读取二维码TH.TabIndex = 11;this.button_读取二维码TH.Text = "读取二维码TH";this.button_读取二维码TH.UseVisualStyleBackColor = true;this.button_读取二维码TH.Click += new EventHandler(this.button_读取二维码TH_Click);this.AutoScaleDimensions = new SizeF(6f, 12f);this.AutoScaleMode = AutoScaleMode.Font;this.ClientSize = new Size(1000, 377);this.Controls.Add((Control) this.button_读取二维码TH);this.Controls.Add((Control) this.button1);this.Controls.Add((Control) this.btn_列举文件);this.Controls.Add((Control) this.btn_batch_解码);this.Controls.Add((Control) this.btn_savebatch);this.Controls.Add((Control) this.txt_folder);this.Controls.Add((Control) this.btn_浏览文件夹);this.Controls.Add((Control) this.dgv_fileqr);this.Controls.Add((Control) this.ContentTxt);this.Controls.Add((Control) this.btn_读取二维码);this.Controls.Add((Control) this.barCodeImg);this.Controls.Add((Control) this.btn_打开图片);this.Name = nameof (Form1);this.Text = "未来之窗二维码批量识别工具";((ISupportInitialize) this.barCodeImg).EndInit();((ISupportInitialize) this.dgv_fileqr).EndInit();this.ResumeLayout(false);this.PerformLayout();}public Form1() => this.InitializeComponent();private void btn_打开图片_Click(object sender, EventArgs e){OpenFileDialog openFileDialog = new OpenFileDialog();openFileDialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;openFileDialog.Filter = "图形文件(*.jpg)|*.jpg";if (openFileDialog.ShowDialog() != DialogResult.OK)return;this.barCodeImg.Image = Image.FromFile(openFileDialog.FileName);}private void btn_读取二维码_Click(object sender, EventArgs e){DecodingOptions decodingOptions = new DecodingOptions();decodingOptions.PossibleFormats = (IList<BarcodeFormat>) new List<BarcodeFormat>(){BarcodeFormat.QR_CODE};BarcodeReader barcodeReader = new BarcodeReader();barcodeReader.Options = decodingOptions;Result result = barcodeReader.Decode(this.barCodeImg.Image as Bitmap);if (result == null){this.ContentTxt.Text = "读取失败";int num = (int) MessageBox.Show("读取失败");}else{this.ContentTxt.Text = result.Text;int num = (int) MessageBox.Show("读取成功,内容:" + result.Text);}}private void btn_浏览文件夹_Click(object sender, EventArgs e){if (this.folderBrowserDialog1.ShowDialog() != DialogResult.OK)return;this.txt_folder.Text = this.folderBrowserDialog1.SelectedPath;}private void ListPicFromFolder(string path){foreach (FileSystemInfo fileSystemInfo in new DirectoryInfo(path).GetFileSystemInfos()){if (fileSystemInfo is FileInfo){FileInfo fileInfo = (FileInfo) fileSystemInfo;Console.WriteLine(Path.GetDirectoryName(fileInfo.FullName));string extension = Path.GetExtension(fileInfo.FullName);string withoutExtension = Path.GetFileNameWithoutExtension(fileInfo.FullName);if (extension == ".jpg")this.addFiletodata(withoutExtension, fileInfo.FullName);}}}private void addFiletodata(string filname, string FileFullPath) => this.dgv_fileqr.Rows.Add((object) filname, (object) "", (object) "0", (object) FileFullPath);private void btn_列举文件_Click(object sender, EventArgs e) => this.ListPicFromFolder(this.txt_folder.Text);private void btn_savebatch_Click(object sender, EventArgs e){SaveFileDialog saveFileDialog = new SaveFileDialog();saveFileDialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;saveFileDialog.Filter = "未来之窗 Excel 文件(*.xls)|*.xls";if (saveFileDialog.ShowDialog() != DialogResult.OK)return;CL_HTML.导出_DataGridView_ToHtmlExcel(this.dgv_fileqr, saveFileDialog.FileName, "未来之窗二维码导出");}private void btn_batch_解码_Click(object sender, EventArgs e){if (this.dgv_fileqr.Rows.Count < 1)return;string str = "1";foreach (DataGridViewRow row in (IEnumerable) this.dgv_fileqr.Rows){string filename = row.Cells["FileFullPath"].Value.ToString();if (filename.Length > 5){string qr = this._parseQr(filename);row.Cells["QR"].Value = (object) qr;}row.Cells["status"].Value = (object) str;}}public string _parseQr(string filename){this.barCodeImg.Image = Image.FromFile(filename);DecodingOptions decodingOptions = new DecodingOptions();decodingOptions.PossibleFormats = (IList<BarcodeFormat>) new List<BarcodeFormat>(){BarcodeFormat.QR_CODE};BarcodeReader barcodeReader = new BarcodeReader();barcodeReader.Options = decodingOptions;Result result = barcodeReader.Decode(this.barCodeImg.Image as Bitmap);string str;if (result == null){this.ContentTxt.Text = "读取失败";str = "读取失败";}else{this.ContentTxt.Text = result.Text;str = result.Text;}return str;}private void button1_Click(object sender, EventArgs e) => this.barCodeImg.Image = (Image) Form1.Cut(new Bitmap(this.barCodeImg.Image), 272, 692, 570, 570);public static Bitmap Cut(Bitmap b){if (b == null)return (Bitmap) null;int x = b.Width * 3 / 4;int y = 0;int width = b.Width / 4;int height = b.Height / 4;try{Bitmap bitmap = new Bitmap(width, height, PixelFormat.Format24bppRgb);Graphics graphics = Graphics.FromImage((Image) bitmap);graphics.DrawImage((Image) b, new Rectangle(0, 0, width, height), new Rectangle(x, y, width, height), GraphicsUnit.Pixel);graphics.Dispose();return bitmap;}catch{return (Bitmap) null;}}public static Bitmap Cut(Bitmap b, int StartX, int StartY, int iWidth, int iHeight){if (b == null)return (Bitmap) null;int width = b.Width;int height = b.Height;if (StartX >= width || StartY >= height)return (Bitmap) null;if (StartX + iWidth > width)iWidth = width - StartX;if (StartY + iHeight > height)iHeight = height - StartY;try{Bitmap bitmap = new Bitmap(iWidth, iHeight, PixelFormat.Format24bppRgb);Graphics graphics = Graphics.FromImage((Image) bitmap);graphics.DrawImage((Image) b, new Rectangle(0, 0, iWidth, iHeight), new Rectangle(StartX, StartY, iWidth, iHeight), GraphicsUnit.Pixel);graphics.Dispose();return bitmap;}catch{return (Bitmap) null;}}private void button_读取二维码TH_Click(object sender, EventArgs e) => this.ContentTxt.Text = new QRCodeDecoder().decode((QRCodeImage) new QRCodeBitmapImage(new Bitmap(this.barCodeImg.Image)));}
源码demo 开源
https://download.csdn.net/download/cybersnow/90746505https://download.csdn.net/download/cybersnow/90746505
二维码批量识别: 二维码批量识别工具,借助先进图像识别技术,能快速准确读取大量二维码信息。适用于物流与供应链管理,如库存盘点和货物追踪;可用于资产管理,像固定资产盘点与设备巡检;还能助力数据收集与市场调研,比如问卷调查与活动签到。它能将识别信息导出为 Excel 等常见表格,表格结构清晰,方便用户对海量二维码数据高效采集、整理与分析,大幅提升工作效率https://gitee.com/cybersnow/yberWin_Work_Trade_Net_Ynwlzc_QrBatch