コード例 #1
0
ファイル: Scanner.cs プロジェクト: MisRydas/VirtualLibrary
        public void ScanBook(Image bookImage, ScannerDataProvider scannerData, User user)
        {
            scannerData.ResetData();

            try
            {
                BarcodeDecoder Scanner       = new BarcodeDecoder();
                Result         scannerResult = Scanner.Decode(new Bitmap(bookImage));

                scannerData.isbn = scannerResult.Text;

                if (scannerResult.Text.Length == 13)
                {
                    CheckISBN(scannerResult.Text, 13, scannerData, user);
                }
                else if (scannerResult.Text.Length == 10)
                {
                    CheckISBN(scannerResult.Text, 10, scannerData, user);
                }
                else
                {
                    scannerData.wrongCode = true;
                }
            }
            catch (MessagingToolkit.Barcode.NotFoundException)
            {
                scannerData.barcodeNotFound = true;
            }
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Scanner = new BarcodeDecoder();
            Result result = Scanner.Decode(new Bitmap(pictureBox1.Image));

            MessageBox.Show(result.Text);
        }
コード例 #3
0
        private void bunifuFlatButton1_Click(object sender, EventArgs e)
        {
            try
            {
                Scanner = new BarcodeDecoder();
                Result result = Scanner.Decode(new Bitmap(picBoxBarcode.Image));
                dataGridView1.ColumnCount     = 4;
                dataGridView1.Columns[0].Name = "ID";
                dataGridView1.Columns[1].Name = "Products";
                dataGridView1.Columns[2].Name = "Quantity";
                dataGridView1.Columns[3].Name = "Price";

                var     code        = unitofwork.ProductRepository.Get(filter: x => x.Barcode == result.Text);
                string  id          = "";
                string  productName = "";
                decimal price       = 0;
                var     qty         = Convert.ToDecimal(txtQty.Text);
                foreach (var item in code)
                {
                    id          = item.Id.ToString();
                    productName = item.Prod_Name;
                    price       = item.Price * qty;
                }
                decimal Total = Convert.ToDecimal(lblTotal.Text) + price;
                lblTotal.Text = Total.ToString();

                dataGridView1.Rows.Add(id, productName, qty, price);
            }
            catch (Exception)
            {
                MessageBox.Show("Error Occured, Product does not exist");
            }
        }
コード例 #4
0
        public string DecodeDeviceImage(Bitmap ImageBitmap)
        {
            BarcodeDecoder bd            = new BarcodeDecoder();
            Result         res           = bd.Decode(ImageBitmap);
            string         DecodedResult = res.Text;

            return(DecodedResult);
        }
コード例 #5
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            OpenFileDialog OD = new OpenFileDialog();

            OD.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            if (OD.ShowDialog() == DialogResult.OK)
            {
                pictureBox1.Load(OD.FileName);
            }
            BarcodeDecoder Scanner = new BarcodeDecoder();
            Result         result  = Scanner.Decode(new Bitmap(pictureBox1.Image));

            txtCodigoBarra.Text = result.Text;
        }
コード例 #6
0
        public IEnumerable <RecognitionResult> Recognize(IImage bitmap, ZoneConfiguration config)
        {
            var binaryBitmap = new BinaryBitmap(new HybridBinarizer(new BitmapSourceLuminanceSource(bitmap.ToGray().ToBitmapSource())));

            var recognizer = Task.Run(() => barcodeReader.Decode(binaryBitmap, new Dictionary <DecodeOptions, object>()))
                             .ToObservable();

            var result = recognizer
                         .Timeout(TimeSpan.FromSeconds(2))
                         .Catch <Result, TimeoutException>(arg => Observable.Return <Result>(null))
                         .Catch <Result, NotFoundException>(arg => Observable.Return <Result>(null));

            var text = result.ToTask().Result?.Text;

            yield return(new RecognitionResult(text, 1D));
        }
コード例 #7
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            OpenFileDialog OD = new OpenFileDialog();

            OD.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            if (OD.ShowDialog() == DialogResult.OK)
            {
                pictureBox2.Load(OD.FileName);
            }
            BarcodeDecoder Scanner = new BarcodeDecoder();
            Result         result  = Scanner.Decode(new Bitmap(pictureBox2.Image));

            lbDni.Text = result.Text;

            listaTarjetas        = cnx.listarTarjetas();
            btnRefrescar.Enabled = false;
            for (int i = 0; i < listaTarjetas.Count; i++)
            {
                if (listaTarjetas[i].Dni == lbDni.Text)
                {
                    upAll();
                    int mes = Convert.ToInt16(DateTime.Now.Month);
                    lbMail.Text     = listaTarjetas[i].Email;
                    txtCliente.Text = listaTarjetas[i].Email;
                    listaTratamientos.Clear();
                    listaTratamientos = cnx.listarTratamientos(listaTarjetas[i].Dni, mes);
                    tabControl1.Controls.Clear();
                    MedEncontrados.Clear();

                    for (int j = 0; j < listaTratamientos.Count; j++)
                    {
                        foreach (claseMedicamento med in listaMedicamento)
                        {
                            if (med.Nombre == listaTratamientos[j].Medicamento)
                            {
                                MedEncontrados.Add(med);
                            }
                        }
                    }
                    cargarTPV(MedEncontrados);
                }
            }
        }
コード例 #8
0
ファイル: formGestion.cs プロジェクト: CodeInBars/TPVFarmacia
        //Cargar codigo de un nuevo medicamento
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            claseMedicamento cm = new claseMedicamento();
            OpenFileDialog   OD = new OpenFileDialog();

            OD.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            if (OD.ShowDialog() == DialogResult.OK)
            {
                pictureBox1.Load(OD.FileName);
            }
            BarcodeDecoder Scanner = new BarcodeDecoder();
            Result         result  = Scanner.Decode(new Bitmap(pictureBox1.Image));

            lblScannerNumero.Text = result.Text;
            cm                  = cnx.buscarmedicamento(lblScannerNumero.Text);
            txtNombre.Text      = cm.Nombre;
            txtPrecio.Text      = Convert.ToString(cm.Precio);
            txtStockMin.Text    = Convert.ToString(cm.Stockminimo);
            txtStockActual.Text = Convert.ToString(cm.Stockactual);

            cnx.añadirMedicamento(cm);
        }
コード例 #9
0
        private void pictureBox3_Click(object sender, EventArgs e)
        {
            OpenFileDialog OD = new OpenFileDialog();

            OD.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            if (OD.ShowDialog() == DialogResult.OK)
            {
                pictureBox3.Load(OD.FileName);
            }
            BarcodeDecoder Scanner = new BarcodeDecoder();
            Result         result  = Scanner.Decode(new Bitmap(pictureBox3.Image));

            txtRecoje.Text = result.Text;

            if (txtRecoje.Text.Equals("3333"))
            {
                upAll();
            }
            else if (txtRecoje.Text.Equals("33943444"))
            {
                upAll();
            }
            else if (txtRecoje.Text.Equals("4444"))
            {
                upAll();
            }
            else
            {
                MessageBox.Show("Usuario no reconocido");
            }

            txtRecoje.Enabled   = false;
            txtRecoje.Visible   = false;
            pictureBox3.Enabled = false;
            pictureBox3.Visible = false;
        }
コード例 #10
0
        // ---

        private void camera_CaptureImageAvailable(object sender, ContentReadyEventArgs e)
        {
            capturing = false;

            Stream imageStream = (Stream)e.ImageStream;
            BarcodeDecoder barcodeDecoder = new BarcodeDecoder();

            Dictionary<DecodeOptions, object> decodingOptions =
                                new Dictionary<DecodeOptions, object>();
            List<BarcodeFormat> possibleFormats = new List<BarcodeFormat>(1);
            Result result;

            Dispatcher.BeginInvoke(
                () =>
                {

                    WriteableBitmap qrImage = new WriteableBitmap((int)camera.Resolution.Width, (int)camera.Resolution.Height);
                    imageStream.Position = 0;
                    qrImage.LoadJpeg(imageStream);

                    possibleFormats.Add(BarcodeFormat.QRCode);

                    decodingOptions.Add(
                        DecodeOptions.PossibleFormats,
                        possibleFormats);

                    try
                    {
                        result = barcodeDecoder.Decode(qrImage, decodingOptions);

                        resultText.Text = result.Text;
                        VerDonoButton.Visibility = System.Windows.Visibility.Visible;

                        foreach (var animal in PerfisControl.GetPerfilByEmail("*****@*****.**").Animais)
                        {
                            if (animal.Especie.Equals("Ovelha"))
                            {
                                LocalizacoesControl.InsertLocalizacao(new Localizacao()
                                {
                                    DataHora = DateTime.Now,
                                    Coordenada = new GeoCoordinate(-3.1243974, -59.9838239),
                                    AnimalId = animal.Id
                                });
                            }
                        }

                        //resultText.Text = "Animal identificado.";

                        //StkQRInfo.Visibility = Visibility.Visible;
                        //StkQRInfo.DataContext = new QRInfo(0);
                    }
                    catch (NotFoundException)
                    {
                        // this is expected if the image does not contain a valid
                        // code, Or is too distorted to read
                        resultText.Text = "Imagem não identificada. Aponte a câmera para o código QR na coleira do animal.";
                        VerDonoButton.Visibility = System.Windows.Visibility.Collapsed;
                    }
                    catch (Exception ex)
                    {
                        // something else went wrong, so alert the user
                        MessageBox.Show(
                            ex.Message,
                            "Erro ao decodificar a imagem",
                            MessageBoxButton.OK);
                    }
                }
            );
        }
コード例 #11
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (!working)//如果timer当前空闲  防止处理任务的时间大于轮循的时间
     {
         working = true;
         string        direc_pdf    = ConfigurationManager.AppSettings["PdfPath"];
         string        direc_upload = DateTime.Now.ToString("yyyy-MM-dd");
         string        barcode      = string.Empty;
         string        sql          = string.Empty;
         FtpHelper     ftp          = new FtpHelper(Uri, UserName, Password);
         DirectoryInfo dc           = new DirectoryInfo(direc_pdf);
         foreach (FileInfo file in dc.GetFiles("*.pdf", SearchOption.AllDirectories))
         {
             //1 对pdf文件进行条码识别
             if (!FileIsUsed(file.FullName))//如果文件未被占用
             {
                 try
                 {
                     guid = Guid.NewGuid().ToString(); //将文件重命名
                     file.MoveTo(direc_pdf + guid + ".pdf");
                     //将PDF文件的第一页转图片
                     ConvertPDF2Image(direc_pdf + guid + ".pdf", direc_img, guid + ".jpg", 1, 1, ImageFormat.Jpeg, Definition.Ten);
                     //在图片文件中读取条形码信息
                     BarcodeDecoder barcodeDecoder = new BarcodeDecoder();
                     if (File.Exists(direc_img + guid + ".jpg"))
                     {
                         System.Drawing.Bitmap image = new System.Drawing.Bitmap(direc_img + guid + ".jpg");
                         Dictionary <DecodeOptions, object> decodingOptions = new Dictionary <DecodeOptions, object>();
                         List <BarcodeFormat> possibleFormats = new List <BarcodeFormat>(10);
                         //possibleFormats.Add(BarcodeFormat.DataMatrix);
                         //possibleFormats.Add(BarcodeFormat.QRCode);
                         //possibleFormats.Add(BarcodeFormat.PDF417);
                         //possibleFormats.Add(BarcodeFormat.Aztec);
                         //possibleFormats.Add(BarcodeFormat.UPCE);
                         //possibleFormats.Add(BarcodeFormat.UPCA);
                         possibleFormats.Add(BarcodeFormat.Code128);
                         //possibleFormats.Add(BarcodeFormat.Code39);
                         //possibleFormats.Add(BarcodeFormat.ITF14);
                         //possibleFormats.Add(BarcodeFormat.EAN8);
                         possibleFormats.Add(BarcodeFormat.EAN13);
                         //possibleFormats.Add(BarcodeFormat.RSS14);
                         //possibleFormats.Add(BarcodeFormat.RSSExpanded);
                         //possibleFormats.Add(BarcodeFormat.Codabar);
                         //possibleFormats.Add(BarcodeFormat.MaxiCode);
                         decodingOptions.Add(DecodeOptions.TryHarder, true);
                         decodingOptions.Add(DecodeOptions.PossibleFormats, possibleFormats);
                         Result decodedResult = barcodeDecoder.Decode(image, decodingOptions);
                         while (decodedResult == null)
                         {
                             System.Threading.Thread.Sleep(500);
                         }
                         barcode = decodedResult.Text;
                     }
                 }
                 catch (Exception ex)
                 {
                     barcode = string.Empty;
                     working = false;
                 }
                 //上传文件
                 ftp.CreateDirectory(direc_upload, true);
                 bool res = ftp.UploadFile(direc_pdf + guid + ".pdf", @"\" + direc_upload + @"\" + guid + ".pdf");
                 //如果上传成功!插入数据库记录
                 if (res)
                 {
                     OracleConnection conn = new OracleConnection(ConfigurationManager.AppSettings["strconn"]);
                     conn.Open();
                     OracleCommand com = null;
                     if (!string.IsNullOrEmpty(barcode)) //如果条形码识别成功
                     {
                         sql = "select * from list_attachment where ordercode='" + barcode + "'";
                         com = new OracleCommand(sql, conn);
                         OracleDataAdapter da     = new OracleDataAdapter(com);
                         DataTable         dt_att = new DataTable();
                         da.Fill(dt_att);
                         if (dt_att.Rows.Count > 0)//如果该订单的文件已经存在 删除表记录和文件
                         {
                             sql = "delete from list_attachment where ordercode='" + barcode + "'";
                             com = new OracleCommand(sql, conn);
                             com.ExecuteNonQuery();
                             ftp.DeleteFile(dt_att.Rows[0]["FILEPATH"] + "");
                             //如果该文件曾经被复制到其他的订单号下
                             if (!string.IsNullOrEmpty(dt_att.Rows[0]["COPYORDERCODE"] + ""))
                             {
                                 sql = "select * from list_attachment where ordercode='" + dt_att.Rows[0]["COPYORDERCODE"] + "'";
                                 com = new OracleCommand(sql, conn);
                                 da  = new OracleDataAdapter(com);
                                 DataTable dt_gl = new DataTable();
                                 da.Fill(dt_gl);
                                 sql = "delete from list_attachment where ordercode='" + dt_att.Rows[0]["COPYORDERCODE"] + "'";
                                 com = new OracleCommand(sql, conn);
                                 com.ExecuteNonQuery();
                                 ftp.DeleteFile(dt_gl.Rows[0]["FILEPATH"] + "");
                             }
                         }
                     }
                     sql = @"insert into list_attachment (ID,FILEPATH,FILENAME,FILESIZE,ORDERCODE,CREATETIME,CREATEUSERID) 
                           VALUES (LIST_ATTACHMENT_ID.NEXTVAL,'{0}','{1}','{2}','{3}',sysdate,'{4}')";
                     sql = string.Format(sql, @"/" + direc_upload + @"/" + guid + ".pdf", guid + ".pdf", file.Length, barcode, this.label1.Text);
                     com = new OracleCommand(sql, conn);
                     com.ExecuteNonQuery();
                     if (!string.IsNullOrEmpty(barcode))
                     {
                         sql = "update list_order set FILERELATE='1' where code='" + barcode + "'";
                         com = new OracleCommand(sql, conn);
                         com.ExecuteNonQuery();
                     }
                     if (this.checkBox1.Checked)
                     {
                         //DJRI161100579 DJRE161100579 DJCI161100579 DJCE161100579  GJI161100553 GJE161100553
                         string newcode = string.Empty;
                         string preffix = barcode.Substring(0, 3);
                         if (preffix == "DJR" || preffix == "DJC" || preffix == "GJI" || preffix == "GJE")
                         {
                             if (barcode.IndexOf("I") > 0)
                             {
                                 newcode = barcode.Replace("I", "E");
                             }
                             if (barcode.IndexOf("E") > 0)
                             {
                                 newcode = barcode.Replace("E", "I");
                             }
                             string guid2 = Guid.NewGuid().ToString(); //复制并重命名文件
                             file.CopyTo(direc_pdf + guid2 + ".pdf");
                             sql = @"insert into list_attachment (ID,FILEPATH,FILENAME,FILESIZE,ORDERCODE,CREATETIME,CREATEUSERID,CREATENAME)
                             VALUES (LIST_ATTACHMENT_ID.NEXTVAL,'{0}','{1}','{2}','{3}',sysdate,'{4}','{5}')";
                             sql = string.Format(sql, @"/" + direc_upload + @"/" + guid2 + ".pdf", guid2 + ".pdf", file.Length, newcode, this.label1.Text, this.label2.Text);
                             com = new OracleCommand(sql, conn);
                             com.ExecuteNonQuery();
                             bool result = ftp.UploadFile(direc_pdf + guid2 + ".pdf", @"\" + direc_upload + @"\" + guid2 + ".pdf");
                             sql = "update list_attachment set copyordercode='" + newcode + "' where ordercode='" + barcode + "'";
                             com = new OracleCommand(sql, conn);
                             com.ExecuteNonQuery();
                             if (result)
                             {
                                 FileInfo fi_new = new FileInfo(direc_pdf + guid2 + ".pdf");
                                 fi_new.MoveTo(direc_img + guid2 + ".pdf");
                                 sql = "update list_order set FILERELATE='1' where code='" + newcode + "'";
                                 com = new OracleCommand(sql, conn);
                                 com.ExecuteNonQuery();
                             }
                         }
                     }
                     conn.Close();
                 }
                 //将文件搬移至已上传的目录
                 file.MoveTo(direc_img + guid + ".pdf");
             }
         }
         working = false;
     }
 }
コード例 #12
0
        // ---

        private void camera_CaptureImageAvailable(object sender, ContentReadyEventArgs e)
        {
            capturing = false;

            Stream imageStream = (Stream)e.ImageStream;
            BarcodeDecoder barcodeDecoder = new BarcodeDecoder();

            Dictionary<DecodeOptions, object> decodingOptions =
                                new Dictionary<DecodeOptions, object>();
            List<BarcodeFormat> possibleFormats = new List<BarcodeFormat>(1);
            Result result;

            Dispatcher.BeginInvoke(
                () =>
                {

                    WriteableBitmap qrImage = new WriteableBitmap((int)camera.Resolution.Width, (int)camera.Resolution.Height);
                    imageStream.Position = 0;
                    qrImage.LoadJpeg(imageStream);

                    possibleFormats.Add(BarcodeFormat.QRCode);

                    decodingOptions.Add(
                        DecodeOptions.PossibleFormats,
                        possibleFormats);

                    try
                    {
                        result = barcodeDecoder.Decode(qrImage, decodingOptions);

                        resultText.Text = result.Text;
                    }
                    catch (NotFoundException)
                    {
                        // this is expected if the image does not contain a valid
                        // code, Or is too distorted to read
                        resultText.Text = "<nothing to display>";
                    }
                    catch (Exception ex)
                    {
                        // something else went wrong, so alert the user
                        MessageBox.Show(
                            ex.Message,
                            "Error Decoding Image",
                            MessageBoxButton.OK);
                    }
                }
            );
        }
コード例 #13
0
 private void timer2_Tick(object sender, EventArgs e)
 {
     if (!working2)
     {
         working2 = true;
         if (db.KeyExists("recognizetask"))
         {
             string json = db.ListLeftPop("recognizetask");
             if (!string.IsNullOrEmpty(json))
             {
                 try
                 {
                     JObject jo = (JObject)JsonConvert.DeserializeObject(json);
                     //只有PDF文件才会进行条形码识别
                     sql = @"select t.* from list_attachment t where t.ordercode='" + jo.Value <string>("ordercode") + "' and upper(t.filesuffix)='PDF'";
                     DataTable dt = DBMgr.GetDataTable(sql);
                     if (dt.Rows.Count > 0)
                     {
                         guid = Guid.NewGuid().ToString();
                         ConvertPDF2Image(direc_pdf + dt.Rows[0]["FILENAME"], direc_img, guid, 1, 1, ImageFormat.Jpeg, Definition.Ten);
                         BarcodeDecoder barcodeDecoder = new BarcodeDecoder();
                         if (File.Exists(direc_img + guid + ".Jpeg"))
                         {
                             System.Drawing.Bitmap image = new System.Drawing.Bitmap(direc_img + guid + ".Jpeg");
                             Dictionary <DecodeOptions, object> decodingOptions = new Dictionary <DecodeOptions, object>();
                             List <BarcodeFormat> possibleFormats = new List <BarcodeFormat>(10);
                             //possibleFormats.Add(BarcodeFormat.DataMatrix);
                             //possibleFormats.Add(BarcodeFormat.QRCode);
                             //possibleFormats.Add(BarcodeFormat.PDF417);
                             //possibleFormats.Add(BarcodeFormat.Aztec);
                             //possibleFormats.Add(BarcodeFormat.UPCE);
                             //possibleFormats.Add(BarcodeFormat.UPCA);
                             possibleFormats.Add(BarcodeFormat.Code128);
                             //possibleFormats.Add(BarcodeFormat.Code39);
                             //possibleFormats.Add(BarcodeFormat.ITF14);
                             //possibleFormats.Add(BarcodeFormat.EAN8);
                             possibleFormats.Add(BarcodeFormat.EAN13);
                             //possibleFormats.Add(BarcodeFormat.RSS14);
                             //possibleFormats.Add(BarcodeFormat.RSSExpanded);
                             //possibleFormats.Add(BarcodeFormat.Codabar);
                             //possibleFormats.Add(BarcodeFormat.MaxiCode);
                             decodingOptions.Add(DecodeOptions.TryHarder, true);
                             decodingOptions.Add(DecodeOptions.PossibleFormats, possibleFormats);
                             Result decodedResult = barcodeDecoder.Decode(image, decodingOptions);
                             //while (decodedResult == null)
                             //{
                             //    System.Threading.Thread.Sleep(500);
                             //}
                             if (decodedResult != null)//有些PDF文件并无条形码
                             {
                                 barcode = decodedResult.Text;
                                 barconvert();//编码转换
                                 sql = "update list_order set cusno='" + barcode + "' where code='" + jo.Value <string>("ordercode") + "'";
                                 DBMgr.ExecuteNonQuery(sql);
                             }
                         }
                     }
                 }
                 catch (Exception ex)
                 {
                     this.button2.Text = ex.Message;
                     this.button2.Text = json + "识别条码失败!";
                     //db.ListRightPush("recognizetask", json);
                     working2 = false;
                 }
             }
         }
         working2 = false;
     }
 }
コード例 #14
0
ファイル: Form1.cs プロジェクト: radtek/ReadBarCode
        private void barcode_toolKit(fn_share fn_share, string filename)
        {
            string json = string.Empty; string sql = string.Empty;
            string guid = string.Empty; string decoded = string.Empty; string barcode = string.Empty;

            if (db.KeyExists("recognizetask"))
            {
                JObject jo = null;
                try
                {
                    json = db.ListLeftPop("recognizetask");
                    fn_share.systemLog(filename, "-------------------------------------------------------------\r\n");
                    if (!string.IsNullOrEmpty(json))
                    {
                        jo = (JObject)JsonConvert.DeserializeObject(json);
                        //只有PDF文件才会进行条形码识别
                        sql = @"select t.* from list_attachment t where t.ordercode='" + jo.Value <string>("ordercode") + "' and upper(t.filesuffix)='PDF'";
                        DataTable dt = DBMgr.GetDataTable(sql);
                        if (dt.Rows.Count > 0)
                        {
                            DateTime d1 = DateTime.Now;
                            guid = Guid.NewGuid().ToString();
                            ConvertPDF.pdfToPic(direc_pdf + dt.Rows[0]["FILENAME"], direc_img, guid, 1, 1, ImageFormat.Jpeg);//pdf转图片
                            string fileName = direc_img + guid + ".Jpeg";
                            fn_share.systemLog(filename, "=== ConvertToImage——" + (DateTime.Now - d1) + "\r\n");
                            if (File.Exists(fileName))
                            {
                                BarcodeDecoder barcodeDecoder = new BarcodeDecoder();
                                Image          primaryImage   = Image.FromFile(fileName);
                                Bitmap         pImg           = MakeGrayscale3((Bitmap)primaryImage);
                                Dictionary <DecodeOptions, object> decodingOptions = new Dictionary <DecodeOptions, object>();
                                List <BarcodeFormat> possibleFormats = new List <BarcodeFormat>(10);
                                possibleFormats.Add(BarcodeFormat.Code128);
                                possibleFormats.Add(BarcodeFormat.EAN13);
                                decodingOptions.Add(DecodeOptions.TryHarder, true);
                                decodingOptions.Add(DecodeOptions.PossibleFormats, possibleFormats);
                                DateTime d2            = DateTime.Now;
                                Result   decodedResult = barcodeDecoder.Decode(pImg, decodingOptions);
                                Console.WriteLine("解析时长:" + (DateTime.Now - d2));
                                //while (decodedResult == null)
                                //{
                                //    System.Threading.Thread.Sleep(500);
                                //}
                                if (decodedResult != null)//有些PDF文件并无条形码
                                {
                                    barcode = decodedResult.Text;
                                }
                                else
                                {
                                    barcode = "001";
                                }
                                sql = "update list_order set cusno='" + barcode + "' where code='" + jo.Value <string>("ordercode") + "'";
                                DBMgr.ExecuteNonQuery(sql);
                            }
                            fn_share.systemLog(filename, "=== " + jo.Value <string>("ordercode") + "——" + (DateTime.Now - d1) + "——" + barcode + "\r\n");
                        }
                    }
                }
                catch (Exception ex)
                {
                    //db.ListRightPush("recognizetask", json);
                    sql = "update list_order set cusno='002' where code='" + jo.Value <string>("ordercode") + "'";
                    DBMgr.ExecuteNonQuery(sql);
                    fn_share.systemLog(filename, jo.Value <string>("ordercode") + "  异常,识别条码失败:" + ex.Message + "\r\n");
                }
            }
        }