Esempio n. 1
0
        private void QR_BarcodeRead(object sender, BarcodeReadEventArgs barcodeReaderEvent)
        {
            if (barcodeReaderEvent == null)
            {
                return;
            }
            try
            {
                string resultData = barcodeReaderEvent.strDataBuffer.Trim();

                switch (this.ActiveInputBox.Name)
                {
                case "txtLOADING_NO":
                    this.ClearDataOnScreen();
                    //do some method
                    this.txtLOADING_NO.Text = resultData;
                    this.GetLoadingDetail(resultData);
                    break;

                case "txtPALLET_NO":
                    this.txtPALLET_NO.Text = resultData;
                    this.GetUpdatePallet(this.txtLOADING_NO.Text, resultData);
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                base.ShowErrorBox(ex.Message, "Exception");
            }
        }
Esempio n. 2
0
        void bcr_BarcodeReadEUShip(object sender, BarcodeReadEventArgs bre)
        {
            try
            {
                string EU = bre.strDataBuffer;

                ///Тут Алгоритм разбора что мы все-таки считали
                ///Для начала считаем по-умолчанию что считываем мы только ЕУ и пишем алгоритм
                ///Открытия формы

                if (EU.IndexOf("MX") == 0)
                {//
                    return;
                }


                ///Надем ЕУ в табилице и сигнализируем и иначе тоже сигназизируем
                ///
                bool find = false;
                for (int i = 0; i < _tblEU.Rows.Count; i++)
                {
                    string l = _tblEU.Rows[i]["Label"].ToString();
                    if (l == EU)
                    {
                        find = true;
                        _tblEU.Rows[i]["Select"] = "1";

                        //Добавляем УЕ в список
                        WebReference.Relmuch EUT = new WebReference.Relmuch();
                        EUT.LABEL         = EU;
                        EUT.CODEAUTOMATIC = 5;
                        listEU.Add(EUT);
                        break;
                    }
                }

                int v = OpenNETCF.Media.SystemSound.GetVolume();
                OpenNETCF.Media.SystemSound.SetVolume(100);
                if (find)
                {
                    Thread.Sleep(500);
                    OpenNETCF.Media.SystemSounds.Beep.Play();
                    SetColorBackGround(StatusScan.Ok);
                }
                else
                {
                    Thread.Sleep(500);
                    OpenNETCF.Media.SystemSounds.Beep.Play();
                    Thread.Sleep(100);
                    OpenNETCF.Media.SystemSounds.Beep.Play();
                    SetColorBackGround(StatusScan.Fail);
                }
                OpenNETCF.Media.SystemSound.SetVolume(v);
            }
            catch (Exception exp)
            {
                CLog.WriteException("EUShip.cs", "bcr_BarcodeReadEUShip", exp.Message);
                //MessageBox.Show(exp.Message);
            }
        }
Esempio n. 3
0
        void bcr_BarcodeRead(object sender, BarcodeReadEventArgs bre)
        {
            string BarcodeScanned = "";
            try
            {
                BarcodeScanned = bre.strDataBuffer;
                
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
            if (BarcodeScanned.Replace("]C1", "") != "" && ScanRunning)
            {
                SaveLine(BarcodeScanned.Replace("]C1", ""), ExpireMonths);
                scanned_lbl.Text = ScannedNo.ToString() + " flasker scannet!";
            }
            if (BarcodeScanned != "" && !ScanRunning && ArticleNo_tb.Focused)
            {
                ArticleNo_tb.Text = BarcodeScanned;
            }
            if (BarcodeScanned != "" && !ScanRunning && batchno_text.Focused)
            {
                batchno_text.Text = BarcodeScanned;
            }

        }
Esempio n. 4
0
        void bcr_BarcodeRead(object sender, BarcodeReadEventArgs bre)
        {
            try
            {
                string EU = bre.strDataBuffer;
                LabelEU = EU;
                ///Тут Алгоритм разбора что мы все-таки считали
                ///Для начала считаем по-умолчанию что считываем мы только ЕУ и пишем алгоритм
                ///Открытия формы

                labelLabel.BeginInvoke(new Action(() =>
                {
                    labelLabel.Text = "Label: " + EU;
                }));



                //GetDataEU(EU);
                GetDataEUSqlLite(EU);
            }
            catch (Exception exp)
            {
                CLog.WriteException("DataScales.cs", "bcr_BarcodeRead", exp.Message);
                //MessageBox.Show(exp.Message);
            }
        }
Esempio n. 5
0
        private void QR_BarcodeRead(object sender, BarcodeReadEventArgs barcodeReaderEvent)
        {
            if (barcodeReaderEvent == null)
            {
                return;
            }
            try
            {
                string resultData = barcodeReaderEvent.strDataBuffer.Trim();

                switch (this.ActiveInputBox.Name)
                {
                case "txt01RT_NO":
                    this.ClearDataOnScreen();
                    this.txt01RT_NO.Text = resultData;
                    this.GetFGReturnInfo(resultData);
                    break;

                case "txtSERIAL_NO":
                    this.txtSERIAL_NO.Text = resultData;
                    this.GetProductCardDetail(this.txt01RT_NO.Text, resultData);
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                base.ShowErrorBox(ex.Message, "Exception");
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 扫描事件
        /// </summary>
        /// <param name="obj"></param>
        void scanner_OnScannerReaderEvent(object obj, BarcodeReadEventArgs args)//扫描事件响应函数,返回扫描到条码相关信息
        {
            try
            {
                if (this.InvokeRequired)
                {
                    Action <object, BarcodeReadEventArgs> fun = new Action <object, BarcodeReadEventArgs>(scanner_OnScannerReaderEvent);
                    this.Invoke(fun, new object[] { obj, args });
                }
                else
                {
                    if (string.IsNullOrEmpty(args.strDataBuffer) || args.strDataBuffer.Length == 0)
                    {
                        this.lblTip.Text = "扫描的条码错误";
                        Audio.SoundTip(0);//错误提示音
                        return;
                    }

                    SymbologyOptions.SymbologyType t = (SymbologyOptions.SymbologyType)args.SymbologyDetail;
                    ScanOptFun(args.strDataBuffer, t);//扫描的执行方法
                }
            }
            catch (Exception ex)
            {
                this.lblTip.Text = "扫描失败";
                CLog.WriteErrLog("[Frmbatch.ScanEvent]" + ex.Message);
            }
        }
Esempio n. 7
0
        void m_BCreader_BarcodeRead(object sender, BarcodeReadEventArgs bre)
        {
            string sBarcode;
            int    iSymID = bre.Symbology;

            sBarcode = bre.strDataBuffer;
            //remove unneeded chars
            sBarcode = sBarcode.Replace(" ", "");
            sBarcode = sBarcode.Replace("-", "");
            //test the barcode
            if (!VWGTLTAG.CheckBarCode(sBarcode))
            {
                Add2List(VWGTLTAG.LastError);
                ChangeStatus(eStatus.BarCodeErr);
                return;
            }
            //store data
            sFilter     = sBarcode.Substring(0, 4);
            sSupplierID = sBarcode.Substring(4, 9);
            sItemNumber = sBarcode.Substring(13, 9);
            System.Diagnostics.Debug.WriteLine("Barcode Data:\nFilter: " + sFilter + "\nSupplierID: " + sSupplierID + "\nItemNumber: " + sItemNumber);

            //set the barcode data
            ChangeStatus(eStatus.ReadTag);
            txtBarcodeData.Text = sBarcode;
            txtTagID.Text       = "";
            txtTagData.Text     = "";
            txtTagDataStr.Text  = "";
        }
Esempio n. 8
0
        private void QR_BarcodeRead(object sender, BarcodeReadEventArgs barcodeReaderEvent)
        {
            if (barcodeReaderEvent == null)
            {
                return;
            }
            if (this.ActiveInputBox == null)
            {
                return;
            }

            try
            {
                string resultData = barcodeReaderEvent.strDataBuffer.Trim();


                switch (this.ActiveInputBox.Name)
                {
                case "txt01SERIAL_NO":
                    //  this.ActiveInputBox = null;

                    this.txt01SERIAL_NO.Text = resultData;
                    this.MatStock(resultData);
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 9
0
        private void QR_BarcodeRead(object sender, BarcodeReadEventArgs barcodeReaderEvent)
        {
            if (barcodeReaderEvent == null)
            {
                return;
            }
            try
            {
                string resultData = barcodeReaderEvent.strDataBuffer.Trim();


                switch (this.ActiveInputBox.Name)
                {
                case "txt01JOB_NO":
                    this.JOB_NO           = resultData;
                    this.txt01JOB_NO.Text = resultData;

                    this.GetJobLotList();
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 10
0
 static void onBarcodeRead(BarcodeReadEventArgs a)
 {
     if (onBarcodeReadEvent != null)
     {
         myLog.doLog("onBarcodeRead");
         BarcodeReadEventArgs args = a; //local copy
         onBarcodeReadEvent(a);
     }
 }
        protected virtual void OnBarcode1Read(BarcodeReadEventArgs e)
        {
            EventHandler <BarcodeReadEventArgs> handler = Barcode1Read;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Esempio n. 12
0
        void bcr_BarcodeRead(object sender, BarcodeReadEventArgs bre)
        {
            try{
                //Barcode Read Event Handling
                String scannedCode = bre.strDataBuffer;

                foreach (Barcode barcode in barcodeArray)
                {
                    if (barcode.code.Equals(scannedCode))
                    {
                        int targetId = barcode.targetId;
                        int type     = barcode.type;

                        if (type == 1)
                        {
                            //Person
                            for (int i = 0; i < personArray.Length; i++)
                            {
                                if (personArray[i].id == targetId)
                                {
                                    Person   person = personArray[i];
                                    Person[] temp   = new Person[personInListArray.Length];
                                    for (int j = 0; j < personInListArray.Length; j++)
                                    {
                                        temp[j] = personInListArray[j];
                                    }
                                    temp[temp.Length - 1] = person;
                                    personInListArray     = temp;
                                    return;
                                }
                            }
                        }
                        else if (type == 2)
                        {
                            //Product
                            for (int i = 0; i < productArray.Length; i++)
                            {
                                if (productArray[i].id == targetId)
                                {
                                    Product product = productArray[i];
                                    Person  person  = personInListArray[(personBox.SelectedIndex)];

                                    buy(person, product);
                                    return;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
        }
        /// <summary>
        /// eventhandler for a recognized barcode
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="bre">data about the barcode that has been read</param>
        void bcr_BarcodeRead(object sender, BarcodeReadEventArgs bre)
        {
            addLog("bcr_BarcodeRead...");
            // ###### changed to provide also 2D barcodes ##########
            //int iSym = bre.SymbologyDetail;
            //addLog("bcr_BarcodeRead: setting vars");
            //if (barcodeID.is2Dcode(iSym))
            //    _BarcodeText = "2D Code gescannt";
            //else

            //lock (lockBarcodeData)
            //{
            //    //_BarcodeText = Encoding.UTF8.GetString(bre.DataBuffer, 0, bre.BytesInBuffer);
            //    _BarcodeText = bre.strDataBuffer;
            //    _IsSuccess = true;
            //}
            //direct call!
            addLog("bcr_BarcodeRead calling ScanIsReady()");
            ScanIsReady(bre.strDataBuffer, true);
            //changeText( _BarcodeText);

            //ScanReady(this, new Hasci.TestApp.DeviceControlContracts.BarcodeEventArgs(_BarcodeText, true));
#if TESTMODE
            if (testcodes[testCodePos] == _BarcodeText)
            {
                addLog("testcode '" + testcodes[testCodePos] + "' match found");
                testGoodReadCount++;
                _IsSuccess = true;
            }
            else
            {
                addLog("barcode does not match: current='" + testcodes[testCodePos] + "' scanned='" + _BarcodeText + "'");
                _IsSuccess = false;
            }

            testBarcodeReadCount++;
            addLog("testBarcodeReadCount=" + testBarcodeReadCount.ToString());
            addLog("testGoodReadCount=" + testGoodReadCount.ToString());
            testCodePos++;
            if (testCodePos >= testCodeCount)
            {
                testCodePos = 0;
            }
            addLog("testCodePos=" + testCodePos.ToString());
#else
            lock (lockBarcodeData)
            {
                _IsSuccess = true;
            }
#endif

            //addLog("bcr_BarcodeRead calling ScanIsReady()");
            //ScanIsReady();
            addLog("...bcr_BarcodeRead end.");
        }
Esempio n. 14
0
        private void OnBarcodeRead(object sender, BarcodeReadEventArgs bre)
        {
            scannedData[0] = bre.strDataBuffer;

            if (Scanned != null)
            {
                Scanned.Invoke(this, new ScannedDataEventArgs(scannedData));
            }

            reader.ScannerOn = false;
            scannerStatus    = ScannerStatus.Opened;
        }
        //~frmProductFinish()
        //{
        //    //remove event handle
        //    BarReader.Instance.BarReader.BarcodeRead -= new BarcodeReadEventHandler(this.TextBox_BarcodeRead);
        //    BarReader.Instance.BarReader.ThreadedRead(false);

        //}

        #region "Method Member"

        private void QR_BarcodeRead(object sender, BarcodeReadEventArgs barcodeReaderEvent)
        {
            if (barcodeReaderEvent == null)
            {
                return;
            }
            try
            {
                string resultData = barcodeReaderEvent.strDataBuffer.Trim();


                switch (this.ActiveInputBox.Name)
                {
                case "txtMC_NO":
                    //do some method
                    this.txtMC_NO.Text = resultData;
                    bool isValid = this.CheckExistMachine(resultData);
                    if (isValid)
                    {
                        this.txtMC_NO.ReadOnly = true;
                        this.txtSERIAL_NO.Focus();
                    }
                    else
                    {
                        base.ShowWarningBox(string.Format("{0}\n\"{1}\"", ResourceManager.Instance.GetString("ERR_NO_DATA_FOUND"), resultData),
                                            ResourceManager.Instance.GetString("TITLE_PLEASE_CHECK"));
                        this.txtMC_NO.Text = string.Empty;
                        this.txtMC_NO.Focus();
                    }
                    break;

                case "txtSERIAL_NO":
                    this.txtSERIAL_NO.Text = resultData;
                    this.GetProductCardDetailOri(resultData);
                    break;

                case "txtSERIAL_NO_NEW":
                    this.txtSERIAL_NO_NEW.Text = resultData;
                    this.GetProductCardDetail(resultData);
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                base.ShowErrorBox(ex.Message, "Exception");
            }
        }
Esempio n. 16
0
        void bcr_BarcodeRead(object sender, BarcodeReadEventArgs bre)
        {
            try
            {
                string EU = bre.strDataBuffer;
                // this.txtText.Text += Environment.NewLine +  EU;
                this.txtLength.Text = EU;//bre.SymbologyDetail.ToString();

                //А вот тут вот напишем код который будет высылать все в БД
                //SendScanEU(EU);
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
        }
Esempio n. 17
0
        /// <summary>
        /// eventhandler for a recognized barcode
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="bre">data about the barcode that has been read</param>
        void bcr_BarcodeRead(object sender, BarcodeReadEventArgs bre)
        {
            addLog("bcr_BarcodeRead...");
#if RANDOMBADSCANS
            if (rc.getRandom())
            {
                bre.BytesInBuffer = 0;
            }
#endif
            //direct call!
            addLog("bcr_BarcodeRead calling ScanIsReady()");
            if (bre.BytesInBuffer == 0) //is this a bad scan?
            {
                ScanIsReady(_sErrorText, false);
            }
            else
            {
                ScanIsReady(bre.strDataBuffer, true);
            }
#if TESTMODE
            if (testcodes[testCodePos] == _BarcodeText)
            {
                addLog("testcode '" + testcodes[testCodePos] + "' match found");
                testGoodReadCount++;
                _IsSuccess = true;
            }
            else
            {
                addLog("barcode does not match: current='" + testcodes[testCodePos] + "' scanned='" + _BarcodeText + "'");
                _IsSuccess = false;
            }

            testBarcodeReadCount++;
            addLog("testBarcodeReadCount=" + testBarcodeReadCount.ToString());
            addLog("testGoodReadCount=" + testGoodReadCount.ToString());
            testCodePos++;
            if (testCodePos >= testCodeCount)
            {
                testCodePos = 0;
            }
            addLog("testCodePos=" + testCodePos.ToString());
#else
#endif
            //addLog("bcr_BarcodeRead calling ScanIsReady()");
            //ScanIsReady();
            addLog("...bcr_BarcodeRead end.");
        }
Esempio n. 18
0
        /// <summary>
        /// eventhandler for a recognized barcode
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="bre">data about the barcode that has been read</param>
        void bcr_BarcodeRead(object sender, BarcodeReadEventArgs bre)
        {
            addLog("bcr_BarcodeRead...");
            // ###### changed to provide also 2D barcodes ##########
            //int iSym = bre.SymbologyDetail;
            //addLog("bcr_BarcodeRead: setting vars");
            //if (barcodeID.is2Dcode(iSym))
            //    _BarcodeText = "2D Code gescannt";
            //else
            _BarcodeText = Encoding.UTF8.GetString(bre.DataBuffer, 0, bre.BytesInBuffer);
            changeText(_BarcodeText);
            _IsSuccess = true;

            addLog("bcr_BarcodeRead calling ScanIsReady()");
            ScanIsReady();
            addLog("...bcr_BarcodeRead end.");
        }
Esempio n. 19
0
        /// <summary>
        /// 扫描事件
        /// </summary>
        /// <param name="obj"></param>
        void scanner_OnScannerReaderEvent(object obj, BarcodeReadEventArgs args)//扫描事件响应函数,返回扫描到条码相关信息
        {
            try
            {
                if (this.InvokeRequired)
                {
                    Action <object, BarcodeReadEventArgs> fun = new Action <object, BarcodeReadEventArgs>(scanner_OnScannerReaderEvent);
                    this.Invoke(fun, new object[] { obj, args });
                }
                else
                {
                    this.lblTip.Text = "";
                    if (Opt.FeatureCodeList == null || Opt.FeatureCodeList.Count < 1)
                    {
                        this.lblTip.Text = "加载数据失败";
                        Audio.SoundTip(0);//错误提示音
                        return;
                    }
                    string barcode = "";
                    if (string.IsNullOrEmpty(args.strDataBuffer) || args.strDataBuffer.Length == 0)
                    {
                        this.lblTip.Text = "请重新扫描";
                        Audio.SoundTip(0);//错误提示音
                        return;
                    }

                    barcode = args.strDataBuffer;

                    if (IsHjScan)
                    {
                        //合件扫描
                        this.ValidateHj(barcode);
                    }
                    else
                    {
                        //零件扫描
                        SymbologyOptions.SymbologyType t = (SymbologyOptions.SymbologyType)args.SymbologyDetail;
                        ScanValidate(barcode, t);
                    }
                }
            }
            catch (Exception ex)
            {
                CLog.WriteErrLog(ex.Message);
            }
        }
Esempio n. 20
0
        private void QR_BarcodeRead(object sender, BarcodeReadEventArgs barcodeReaderEvent)
        {
            if (barcodeReaderEvent == null)
            {
                return;
            }
            try
            {
                string resultData = barcodeReaderEvent.strDataBuffer.Trim();

                this.txtSERIAL_NO.Text = resultData;
                this.GetUpdateProductCardDetail(resultData);
            }
            catch (Exception ex)
            {
                base.ShowErrorBox(ex.Message, "Exception");
            }
        }
        void formReadBarcode_Barcode2Read(object sender, BarcodeReadEventArgs e)
        {
            if (BarcodeScanner2TemplateRunning)
            {
                BarcodeScanner2Template               = e.Code;
                TextBlockTemplate2.Text               = BarcodeScanner2Template;
                RibbonButtonSetTemplate2.IsEnabled    = true;
                BarcodeScanner2TemplateRunning        = false;
                RibbonButtonCancleTemplate2.IsEnabled = false;
                RibbonButtonStart2.IsEnabled          = true;
            }

            if (BarcodeScanner2Running)
            {
                Barcode2Counter += 1;
                CorrectBarcodeScanCounter2++;

                string barcode2 = e.Code;

                Lib.BarcodeReader reader = new BarcodeReader();
                reader.Number  = Barcode2Counter;
                reader.Barcode = barcode2;
                ReadStatus readStatus = ReadStatus.Blank;

                if (barcode2 == BarcodeScanner2Template)
                {
                    readStatus = ReadStatus.OK;
                }

                if (barcode2 != BarcodeScanner2Template)
                {
                    readStatus    = ReadStatus.Mismatch;
                    reader.Number = Barcode2Counter - 1;


                    StopMachine2Motor();
                    StopBarcodeReader2();
                }
                reader.Status = readStatus;
                reader.Date   = DateTime.Now;

                BarcodeReader2Collection.Insert(0, reader);
            }
        }
Esempio n. 22
0
        private void reader_BarcodeRead(object sender, BarcodeReadEventArgs bre)
        {
            try
            {
                _reader.ScannerEnable = false;

                if (Scan != null)
                {
                    ScanEventArgs args = new ScanEventArgs();
                    args.Data = bre.strDataBuffer;

                    Scan(this, args);
                }
            }
            finally
            {
                _reader.ScannerEnable = true;
            }
        }
Esempio n. 23
0
        /// <summary>
        /// eventhandler for a recognized barcode
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="bre">data about the barcode that has been read</param>
        void bcr_BarcodeRead(object sender, BarcodeReadEventArgs bre)
        {
#if USEWAITLOOP
            lock (lockScanningObject){
#endif
            BarcodeScanned = true;
            addLog("bcr_BarcodeRead...");
            //direct call!
            addLog("bcr_BarcodeRead calling ScanIsReady()");
            ScanIsReady(bre.strDataBuffer, true);
#if USEWAITLOOP
        }    //end lock
#endif
#if TESTMODE
            if (testcodes[testCodePos] == _BarcodeText)
            {
                addLog("testcode '" + testcodes[testCodePos] + "' match found");
                testGoodReadCount++;
                _IsSuccess = true;
            }
            else
            {
                addLog("barcode does not match: current='" + testcodes[testCodePos] + "' scanned='" + _BarcodeText + "'");
                _IsSuccess = false;
            }

            testBarcodeReadCount++;
            addLog("testBarcodeReadCount=" + testBarcodeReadCount.ToString());
            addLog("testGoodReadCount=" + testGoodReadCount.ToString());
            testCodePos++;
            if (testCodePos >= testCodeCount)
            {
                testCodePos = 0;
            }
            addLog("testCodePos=" + testCodePos.ToString());
#else
#endif
            //addLog("bcr_BarcodeRead calling ScanIsReady()");
            //ScanIsReady();
            addLog("...bcr_BarcodeRead end.");
        }
Esempio n. 24
0
        private void QR_BarcodeRead(object sender, BarcodeReadEventArgs barcodeReaderEvent)
        {
            string result = string.Empty;

            if (barcodeReaderEvent == null)
            {
                return;
            }
            try
            {
                //user id
                this.txtScanUserID.Text = barcodeReaderEvent.strDataBuffer;

                this.txtScanUserID.SelectionStart = barcodeReaderEvent.strDataBuffer.Length;
                this._USER_ID = barcodeReaderEvent.strDataBuffer.Trim();

                DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 25
0
 /// <summary>
 /// 扫描事件
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="args"></param>
 void scanner_OnScannerReaderEvent(object obj, BarcodeReadEventArgs args)
 {
     try
     {
         if (this.InvokeRequired)
         {
             Action <object, BarcodeReadEventArgs> fun = new Action <object, BarcodeReadEventArgs>(scanner_OnScannerReaderEvent);
             this.Invoke(fun, new object[] { obj, args });
         }
         else
         {
             if (Opt.FeatureCodeList == null || Opt.FeatureCodeList.Count < 1)
             {
                 this.Tip("加载数据失败");
                 Audio.SoundTip(0);//错误提示音
                 return;
             }
             if (string.IsNullOrEmpty(args.strDataBuffer) || args.strDataBuffer.Length == 0)
             {
                 this.Tip("扫描的条码错误");
                 Audio.SoundTip(0);//错误提示音
                 return;
             }
             if (this.IsOK && this.IsHjScan)
             {
                 watch.Reset();
                 watch.Start();
             }
             doCommonScan(args.strDataBuffer);
         }
     }
     catch (Exception ex)
     {
         this.Tip("扫描失败");//提示
         CLog.WriteErrLog("[FrmScan.ScanEvent]" + ex.Message);
     }
 }
        /// <summary>
        /// eventhandler for a recognized barcode
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="bre">data about the barcode that has been read</param>
        void bcr_BarcodeRead(object sender, BarcodeReadEventArgs bre)
        {
            addLog("bcr_BarcodeRead...");
            // ###### changed to provide also 2D barcodes ##########
            //int iSym = bre.SymbologyDetail;
            //addLog("bcr_BarcodeRead: setting vars");
            //if (barcodeID.is2Dcode(iSym))
            //    _BarcodeText = "2D Code gescannt";
            //else

            //lock (lockBarcodeData)
            //{
            //    //_BarcodeText = Encoding.UTF8.GetString(bre.DataBuffer, 0, bre.BytesInBuffer);
            //    _BarcodeText = bre.strDataBuffer;
            //    _IsSuccess = true;
            //}
            //direct call!
            addLog("bcr_BarcodeRead calling ScanIsReady()");
            ScanIsReady(bre.strDataBuffer, true);
            //changeText( _BarcodeText);

            //ScanReady(this, new Hasci.TestApp.DeviceControlContracts.BarcodeEventArgs(_BarcodeText, true));
#if TESTMODE
            if (testcodes[testCodePos] == _BarcodeText)
            {
                addLog("testcode '" + testcodes[testCodePos] + "' match found");
                testGoodReadCount++;
                _IsSuccess = true;
            }
            else
            {
                addLog("barcode does not match: current='" + testcodes[testCodePos] + "' scanned='" + _BarcodeText + "'");
                _IsSuccess = false;
            }

            testBarcodeReadCount++;
            addLog("testBarcodeReadCount=" + testBarcodeReadCount.ToString());
            addLog("testGoodReadCount=" + testGoodReadCount.ToString());
            testCodePos++;
            if(testCodePos>=testCodeCount)
                testCodePos=0;
            addLog("testCodePos=" + testCodePos.ToString());
#else
            lock (lockBarcodeData)
            {
                _IsSuccess = true;
            }
#endif

            //addLog("bcr_BarcodeRead calling ScanIsReady()");
            //ScanIsReady();
            addLog("...bcr_BarcodeRead end.");
        }
Esempio n. 27
0
        void bcr_BarcodeRead(object sender, BarcodeReadEventArgs bre)
        {
            if (_WareHousePost != null)
            {//не обрабатываем ничего
                if (_WareHousePost.FormActive)
                {
                    return;
                }
            }

            try
            {
                string EU = bre.strDataBuffer;

                ///Тут Алгоритм разбора что мы все-таки считали
                ///Для начала считаем по-умолчанию что считываем мы только ЕУ и пишем алгоритм
                ///Открытия формы


                //Это открытие фрормы ЭкшенЕУ, тут так же пилим для размещения форму

                if (EU.IndexOf("MX") == 0)
                {//Это место хранения
                 // bcr.BarcodeRead -= new BarcodeReadEventHandler(bcr_BarcodeRead);



                    //Возвращаем обработку события этого делать тут не стоит
                    //bcr.BarcodeRead += new BarcodeReadEventHandler(bcr_BarcodeRead);

                    if (_WareHousePost == null)
                    {
                        _WareHousePost = new WarehousePost(bcr, EU, ListScanOperation.MXSet);
                        _WareHousePost.Show();
                    }

                    else
                    {
                        _WareHousePost.Close();
                        // UIEU.Dispose();
                        _WareHousePost = new WarehousePost(bcr, EU, ListScanOperation.MXSet);
                        _WareHousePost.Show();
                    }
                }
                else if (EU.IndexOf("S") == 0)
                {//Это вагонная карта, обработчик будет потом
                }

                else
                {
                    if (UIEU == null)
                    {
                        UIEU = new EU_Action(bcr, EU);
                        UIEU.Show();
                    }

                    else
                    {
                        UIEU.Close();
                        UIEU.Dispose();
                        UIEU = new EU_Action(bcr, EU);
                        UIEU.Show();
                    }
                }

                textBoxScan.BeginInvoke(new Action(() =>
                {
                    textBoxScan.Text = EU;
                }));
            }
            catch (Exception exp)
            {
                CLog.WriteException("StartMenu.cs", "bcr_BarcodeRead", exp.Message);
                //MessageBox.Show(exp.Message);
            }
        }
Esempio n. 28
0
 private void OnBarcodeRead(object sender, BarcodeReadEventArgs e)
 {
     Client.OnBarcode(e.strDataBuffer);
 }
        /// <summary>
        /// eventhandler for a recognized barcode
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="bre">data about the barcode that has been read</param>
        void bcr_BarcodeRead(object sender, BarcodeReadEventArgs bre)
        {
            addLog("bcr_BarcodeRead...");
#if RANDOMBADSCANS
            if(rc.getRandom())
                bre.BytesInBuffer = 0;
#endif
            //direct call!
            addLog("bcr_BarcodeRead calling ScanIsReady()");
            if (bre.BytesInBuffer == 0) //is this a bad scan?
                ScanIsReady(_sErrorText, false);
            else
                ScanIsReady(bre.strDataBuffer, true);
#if TESTMODE
            if (testcodes[testCodePos] == _BarcodeText)
            {
                addLog("testcode '" + testcodes[testCodePos] + "' match found");
                testGoodReadCount++;
                _IsSuccess = true;
            }
            else
            {
                addLog("barcode does not match: current='" + testcodes[testCodePos] + "' scanned='" + _BarcodeText + "'");
                _IsSuccess = false;
            }

            testBarcodeReadCount++;
            addLog("testBarcodeReadCount=" + testBarcodeReadCount.ToString());
            addLog("testGoodReadCount=" + testGoodReadCount.ToString());
            testCodePos++;
            if(testCodePos>=testCodeCount)
                testCodePos=0;
            addLog("testCodePos=" + testCodePos.ToString());
#else
#endif
            //addLog("bcr_BarcodeRead calling ScanIsReady()");
            //ScanIsReady();
            addLog("...bcr_BarcodeRead end.");
        }
Esempio n. 30
0
 /// <summary>
 /// called by barcode reader object on successful barcode read
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="bre"></param>
 void bcr_BarcodeRead(object sender, BarcodeReadEventArgs bre)
 {
     addLog("bcr_BarcodeRead...\r\nchange timer to off");
     //stop timer
     timer1.Change(Timeout.Infinite, m_iTimeout);
     //prepare data
     DecodeEventArgs dea = new DecodeEventArgs(bre.strDataBuffer);
     //fire event handler
     doDecode(dea);
     addLog("bcr_BarcodeRead end");
 }
Esempio n. 31
0
        private void HandleData(object sender, BarcodeReadEventArgs bre)
        {
            BarcodeScanLabel.Text = bre.strDataBuffer;

        }
        /// <summary>
        /// eventhandler for a recognized barcode
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="bre">data about the barcode that has been read</param>
        void bcr_BarcodeRead(object sender, BarcodeReadEventArgs bre)
        {
            addLog("bcr_BarcodeRead...");
            // ###### changed to provide also 2D barcodes ##########
            //int iSym = bre.SymbologyDetail;
            //addLog("bcr_BarcodeRead: setting vars");
            //if (barcodeID.is2Dcode(iSym))
            //    _BarcodeText = "2D Code gescannt";
            //else
                _BarcodeText = Encoding.UTF8.GetString(bre.DataBuffer, 0, bre.BytesInBuffer);
            changeText( _BarcodeText);
            _IsSuccess = true;

            addLog("bcr_BarcodeRead calling ScanIsReady()");
            ScanIsReady();
            addLog("...bcr_BarcodeRead end.");
        }
Esempio n. 33
0
        void bcr_BarcodeReadInventTaskMX(object sender, BarcodeReadEventArgs bre)
        {
            try
            {
                string EU = bre.strDataBuffer;
                if (EU.IndexOf("MX") == 0)
                {//Это место хранения
                    //bcr.BarcodeRead -= new BarcodeReadEventHandler(bcr_BarcodeRead);
                    //А тперь проверим на соответсвие списку по ведомости
                    bool GoScan = false;
                    if (_tblTask != null)
                    {
                        for (int ii = 0; ii < _tblTask.Rows.Count; ii++)
                        {
                            if (_tblTask.Rows[ii]["MX_LABEL"].ToString().ToUpper() == EU)
                            {
                                GoScan = true;
                            }
                        }
                    }

                    if (GoScan)
                    {
                        switch (ScanOperation)
                        {
                        case ListScanOperation.InventoryTask:
                        {
                            //Если операция Перемещение то нужно что то сделать...!!!!

                            if (_WareHousePost == null)
                            {
                                _WareHousePost         = new WarehousePost(bcr, EU, ScanOperation, 5);
                                _WareHousePost.SETRZDN = SelectRZDN;
                                _WareHousePost.Show();
                            }

                            else
                            {
                                if (_WareHousePost.FormActive)
                                {
                                }
                                else
                                {
                                    _WareHousePost.Close();
                                    // UIEU.Dispose();
                                    _WareHousePost         = new WarehousePost(bcr, EU, ScanOperation, 5);
                                    _WareHousePost.SETRZDN = SelectRZDN;
                                    _WareHousePost.Show();
                                }
                            }

                            break;
                        }
                        }
                    }
                }
                else
                {
                }
            }

            catch (Exception exp)
            {
                CLog.WriteException("InventTaskMX.cs", "bcr_BarcodeReadInventTaskMX", exp.Message);
                //MessageBox.Show(exp.Message);
            }
        }
Esempio n. 34
0
        void bcr_BarcodeReadScanWareHouse(object sender, BarcodeReadEventArgs bre)
        {
            try
            {
                string EU = bre.strDataBuffer;
                //заюзаем новую дичь, в зависимости от кода операции будем использовать ту или иную дичь

                switch (ScanOperation)
                {
                case ListScanOperation.MXView:
                {
                    if (EU.IndexOf("MX") == 0)
                    {        //
                        if (_view == null)
                        {
                            _view = new WareHouseView(EU);
                            _view.Show();
                        }
                        else
                        {
                            _view.Close();
                            // _scan.Dispose();
                            _view = new WareHouseView(EU);
                            _view.Show();
                        }
                    }
                    break;
                }

                case ListScanOperation.EUShip:
                {
                    if (EU.IndexOf("S") == 0)
                    {        //Это вагонная карта
                        ///TN = "S0001500000106002016";
                        if (_ship == null)
                        {
                            _ship = new EUShip(bcr, EU);
                            _ship.Show();
                        }
                        else
                        {
                            if (_ship.FormActive)
                            {
                                return;
                            }

                            _ship.Close();
                            // _scan.Dispose();
                            _ship = new EUShip(bcr, EU);
                            _ship.Show();
                        }
                    }
                    break;
                }
                }
            }
            catch (Exception exp)
            {
                CLog.WriteException("ScanWareHouse.cs", "bcr_BarcodeReadScanWareHouse", exp.Message);
                //MessageBox.Show(exp.Message);
            }
        }
Esempio n. 35
0
        void bcr_BarcodeRead(object sender, BarcodeReadEventArgs bre)
        {
            try
            {
                string EU = bre.strDataBuffer;

                if (EU.IndexOf("MX") == 0)
                {//Это место хранения
                 //bcr.BarcodeRead -= new BarcodeReadEventHandler(bcr_BarcodeRead);

                    switch (ScanOperation)
                    {
                    case ListScanOperation.MXSet:
                    {
                        //Если операция размещение то нужно что то сделать...!!!!

                        if (_WareHousePost == null)
                        {
                            _WareHousePost = new WarehousePost(bcr, EU, ScanOperation, 5);
                            _WareHousePost.Show();
                        }

                        else
                        {
                            if (_WareHousePost.FormActive)
                            {
                            }
                            else
                            {
                                _WareHousePost.Close();
                                // UIEU.Dispose();
                                _WareHousePost = new WarehousePost(bcr, EU, ScanOperation, 5);
                                _WareHousePost.Show();
                            }
                        }

                        break;
                    }

                    case ListScanOperation.EUTaskMove:
                    {
                        //Если операция Перемещение то нужно что то сделать...!!!!

                        if (_WareHousePost == null)
                        {
                            _WareHousePost = new WarehousePost(bcr, EU, ScanOperation, 5);
                            _WareHousePost.Show();
                        }

                        else
                        {
                            if (_WareHousePost.FormActive)
                            {
                            }
                            else
                            {
                                _WareHousePost.Close();
                                // UIEU.Dispose();
                                _WareHousePost = new WarehousePost(bcr, EU, ScanOperation, 5);
                                _WareHousePost.Show();
                            }
                        }

                        break;
                    }
                    }


                    //Возвращаем обработку события этого делать тут не стоит
                    //bcr.BarcodeRead += new BarcodeReadEventHandler(bcr_BarcodeRead);
                }
                else
                {
                }
            }
            catch (Exception exp)
            {
                CLog.WriteException("WarehouseSel.cs", "bcr_BarcodeRead", exp.Message);
                //MessageBox.Show(exp.Message);
            }
        }
Esempio n. 36
0
        void bcr_BarcodeReadQueueTaskEU(object sender, BarcodeReadEventArgs bre)
        {
            try
            {
                string EU = bre.strDataBuffer;
                LabelEU = EU;
                ///Тут Алгоритм разбора что мы все-таки считали
                ///Для начала считаем по-умолчанию что считываем мы только ЕУ и пишем алгоритм
                ///Открытия формы

                if (EU.IndexOf("MX") == 0)
                {//
                    //labelStatus.BeginInvoke(new Action(() =>
                    //{
                    //    labelStatus.Text = "Считано место хранения: " + EU;
                    //}));
                    return;
                }

                //labelStatus.BeginInvoke(new Action(() =>
                //{
                //    labelStatus.Text = "Label: " + EU;
                //}));

                //MessageBox.Show(EU);

                // GetDataEU(EU);


                //Проверим есть ли данная ЕУ в списке
                if (ValidateList.CheckEUByListType(listEU, LabelEU))
                {
                    //ЕУ уже в списке
                    Sound.PlaySoundWarning();
                    //Vibration.PlayVibration(2000);
                    return;
                }


                dataGridEu.BeginInvoke(new Action(() =>
                {
                    dataGridEu.BackColor = Color.White;
                }));

                //Тут делаем таблицу и выводим инфу
                DataRow row1 = _tblEU.NewRow();
                row1["Label"] = EU;

                Double WEIGHT_EU = 0;
                //WebReference.WebSDataBrCode BrServer = new WebReference.WebSDataBrCode();
                //BrServer.SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Soap12;
                //BrServer.Url = set.AdressAppServer;
                //DataTable result = BrServer.EU_GetData(EU);

                string MarkaEU = "";
                using (SQLiteConnection connection = new SQLiteConnection())
                {
                    ;//(SQLiteConnection)factory.CreateConnection();
                    connection.ConnectionString = "Data Source = " + SqLiteDB.pathDBFull_EU;
                    SQLiteCommand command = new SQLiteCommand(connection);
                    SQLiteCommand insert  = new SQLiteCommand("select * from EU e WHERE e.RELMUCH_LABEL = '" + EU + "';", connection);
                    connection.Open();
                    SQLiteDataReader reader = insert.ExecuteReader();

                    while (reader.Read())
                    {
                        //Запроск К БД
                        MarkaEU = _getReaderByName(reader, "MARKA_NAME");
                        string sWEIGHT_EU = _getReaderByName(reader, "RELMUCH_VES");

                        row1["УЕ"]     = _getReaderByName(reader, "RPRT_NOM");
                        row1["Марка"]  = MarkaEU;
                        row1["Размер"] = _getReaderByName(reader, "RELMUCH_THICKNESS") + "х" + _getReaderByName(reader, "RELMUCH_WIDTH");
                        row1["Вес"]    = sWEIGHT_EU;
                        // row1["S"] = "";

                        /*
                         * CREATE TABLE [EU] (
                         *          [RELMUCH_LABEL] char(20) NOT NULL,
                         *          [RELMUCH_PRM] char(20),
                         *          [RELMUCH_VES] char(20),
                         *          [RELMUCH_FVES] char(20),
                         *          [RELMUCH_WIDTH] char(20),
                         *          [RELMUCH_THICKNESS] char(20),
                         *          [RPRT_NOM] char(20),
                         *          [RPRTTYP_NAME] char(20),
                         *          [RPRT_TOL] char(20),
                         *          [RPRT_SHRN] char(20),
                         *          [RPRT_PLVNOM] char(20),
                         *          [MARKA_NAME] char(20),
                         *          [MARKA_GOST] char(20),
                         *          [FACT_STORAGE_CODE] char(20),
                         *          [TEHUZ_LABEL] char(20),
                         *          [FACT_PLACE_NAME] char(20),
                         *          [INTRV_TMBEG] char(20))
                         * */
                        try
                        {
                            WEIGHT_EU = Double.Parse(sWEIGHT_EU);
                        }
                        catch (Exception) { }
                    }
                    reader.Close();
                    connection.Close();

                    command.Dispose();
                    insert.Dispose();
                    reader.Dispose();
                }

                //MarkaEU = MarkaEU.ToUpper()
                ////Тут введем проверку на Марку b и потом что то еще
                if (MarkaEU.ToUpper() == MarkaRZDN.ToUpper())
                {
                    ScanWeigth -= WEIGHT_EU;
                    _tblEU.Rows.Add(row1);

                    WebReference.Relmuch EUT = new WebReference.Relmuch();
                    EUT.LABEL         = EU;
                    EUT.CODEAUTOMATIC = 5;
                    listEU.Add(EUT);
                }
                else if (MarkaRZDNList.IndexOf(MarkaEU.ToUpper()) != -1)
                {
                    //вкошмарим поиск
                    ScanWeigth -= WEIGHT_EU;
                    _tblEU.Rows.Add(row1);

                    WebReference.Relmuch EUT = new WebReference.Relmuch();
                    EUT.LABEL         = EU;
                    EUT.CODEAUTOMATIC = 5;
                    listEU.Add(EUT);
                }
                else
                {
                    OpenNETCF.Media.SystemSounds.Beep.Play();
                    Thread.Sleep(100);
                    OpenNETCF.Media.SystemSounds.Beep.Play();
                }

                dataGridEu.BeginInvoke(new Action(() =>
                {
                    dataGridEu.DataSource = _tblEU;
                }));

                labelCountScan.BeginInvoke(new Action(() =>
                {
                    labelCountScan.Text = listEU.Count.ToString();
                }));

                labelMX.BeginInvoke(new Action(() =>
                {
                    //Вычитаем и обновляем тонны
                    labelMX.Text = "Осталось: " + Math.Round(ScanWeigth, 2).ToString() + " т.";
                    if (ScanWeigth <= 0)
                    {
                        labelMX.ForeColor = Color.White;
                    }
                    else
                    {
                        labelMX.ForeColor = Color.Tomato;
                    }
                }));
            }
            catch (Exception exp)
            {
                CLog.WriteException("WarehousePost.cs", "bcr_BarcodeRead", exp.Message);
                //MessageBox.Show(exp.Message);
            }
        }
        /// <summary>
        /// eventhandler for a recognized barcode
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="bre">data about the barcode that has been read</param>
        void bcr_BarcodeRead(object sender, BarcodeReadEventArgs bre)
        {
#if USEWAITLOOP
            lock(lockScanningObject){
#endif
            BarcodeScanned = true;
            addLog("bcr_BarcodeRead...");
            //direct call!
            addLog("bcr_BarcodeRead calling ScanIsReady()");
            ScanIsReady(bre.strDataBuffer, true);
#if USEWAITLOOP
            }//end lock
#endif
#if TESTMODE
            if (testcodes[testCodePos] == _BarcodeText)
            {
                addLog("testcode '" + testcodes[testCodePos] + "' match found");
                testGoodReadCount++;
                _IsSuccess = true;
            }
            else
            {
                addLog("barcode does not match: current='" + testcodes[testCodePos] + "' scanned='" + _BarcodeText + "'");
                _IsSuccess = false;
            }

            testBarcodeReadCount++;
            addLog("testBarcodeReadCount=" + testBarcodeReadCount.ToString());
            addLog("testGoodReadCount=" + testGoodReadCount.ToString());
            testCodePos++;
            if(testCodePos>=testCodeCount)
                testCodePos=0;
            addLog("testCodePos=" + testCodePos.ToString());
#else
#endif
            //addLog("bcr_BarcodeRead calling ScanIsReady()");
            //ScanIsReady();
            addLog("...bcr_BarcodeRead end.");
        }
Esempio n. 38
0
 private static void OnBarcodeRead(object sender, BarcodeReadEventArgs e)
 {
 }