Exemple #1
0
        private void dcdEvent_Scanned(object sender, DecodeEventArgs e)
        {
            CodeId cID     = CodeId.NoData;
            string dcdData = string.Empty;

            // Obtain the string and code id.
            try
            {
                dcdData = hDcd.ReadString(e.RequestID, ref cID);

                //quet tem cuon
                if (dangQuet == 0)
                {
                    temCuon = new TemCuon(dcdData);

                    if (temCuon.IdCuon == null)
                    {
                        MessageBox.Show("Hay quet vao tem cuon", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    }
                    else
                    {
                        //load thong tin tem cuon
                        lblVnptPN.Text       = temCuon.VnptPn;
                        lblPhieuNhapKho.Text = temCuon.SoPhieuNhapKho;
                        lblSoDonHang.Text    = temCuon.SoDonHang;
                        lblNgayNhapKho.Text  = temCuon.NgayNhapKho;
                        lblSoLuong.Text      = temCuon.SoLuong;
                        lblIdCuon.Text       = temCuon.IdCuon;
                        dangQuet             = 1;
                    }
                }


                //Quet tem vitri
                else if (dangQuet == 1)
                {
                    temViTri = new TemVitri(dcdData);

                    if (temViTri.ID == 0 || temViTri.ID == null)
                    {
                        MessageBox.Show("Hay quet vao tem vi tri", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    }
                    else
                    {
                        //load thong tin tem cuon
                        lblViTri.Text    = temViTri.ID + "-" + temViTri.Ten;
                        dangQuet         = 2;
                        btnSave.Enabled  = true;
                        btnReset.Enabled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace);
                MessageBox.Show("Co loi xay ra, hay quet lai tu dau", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                ResetForm();
            }
        }
Exemple #2
0
        private void dcdEvent_Scanned(object sender, DecodeEventArgs e)
        {
            CodeId cID     = CodeId.NoData;
            string dcdData = string.Empty;

            dcdData = hDcd.ReadString(e.RequestID, ref cID);

            ScanCode(dcdData);
        }
        private void symbolReader_ReadNotify(object sender, DecodeEventArgs e)
        {
            CodeId cID     = CodeId.NoData;
            string dcdData = string.Empty;

            dcdData = hDcd.ReadString(e.RequestID, ref cID);

            // Raise the scan event to the caller (with data)
            OnBarcodeScan(new BarcodeScannerEventArgs(dcdData.Replace("\r", "")));
        }
Exemple #4
0
        private void dcdEvent_Scanned(object sender, DecodeEventArgs e)
        {
            CodeId cID     = CodeId.NoData;
            string dcdData = string.Empty;

            dcdData = hDcd.ReadString(e.RequestID, ref cID);
            //dcdData = "PN:KBUAA7SK0000048M*SPNK:PART-IMP-17*SDH:VNPT/TECH-BO-04/2017-97*NNK:2017-04-28*ID:0000207503*SL:1000.000000*TYPE:1*";

            ScanCode(dcdData);
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (CodeId != 0)
            {
                hash ^= CodeId.GetHashCode();
            }
            if (Type != 0)
            {
                hash ^= Type.GetHashCode();
            }
            hash ^= operateCard_.GetHashCode();
            return(hash);
        }
        public void SetDcdText(int msgReqID)
        {
            CodeId cID     = CodeId.NoData;
            string dcdData = "";

            try
            {
                dcdData = hDcd.ReadString(msgReqID, ref cID);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("String read error: " + ex.Message);
                Console.Error.Flush();
                return;
            }
        }
        /// <summary>
        /// Event that fires when a PSC scanner has performed a scan.
        /// </summary>
        private void dcdEvent_Scanned(object sender, DcdEventArgs e)
        {
            nCodeID  = CodeId.NoData;
            sBarCode = string.Empty;

            // Obtain the string and code id.
            try
            {
                sBarCode = hPSC.ReadString(e.RequestID, ref nCodeID);
            }
            catch (Exception)
            {
                //MessageBox.Show("Error reading string!");
            }

            OnBarcodeScan(new BarcodeScannerEventArgs((BCId)nCodeID, sBarCode));
            return;
        }
        public void SetDcdText(int msgReqID)
        {
            CodeId cID     = CodeId.NoData;
            string dcdData = "";

            try
            {
                dcdData = hDcd.ReadString(msgReqID, ref cID);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("String read error: " + ex.Message);
                Console.Error.Flush();
                return;
            }

            this.position.Text = Regex.Replace(dcdData, "[^a-zA-Z0-9_.]+", "", RegexOptions.Compiled);
        }
Exemple #9
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (CodeId != 0)
            {
                hash ^= CodeId.GetHashCode();
            }
            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (AdminName.Length != 0)
            {
                hash ^= AdminName.GetHashCode();
            }
            if (AdminId != 0UL)
            {
                hash ^= AdminId.GetHashCode();
            }
            if (AdminTel.Length != 0)
            {
                hash ^= AdminTel.GetHashCode();
            }
            if (ClubGold != 0L)
            {
                hash ^= ClubGold.GetHashCode();
            }
            hash ^= playerGuid_.GetHashCode();
            hash ^= playerList_.GetHashCode();
            hash ^= applicationList_.GetHashCode();
            if (CreatePower != 0)
            {
                hash ^= CreatePower.GetHashCode();
            }
            hash ^= adminList_.GetHashCode();
            if (HasCreatePower != false)
            {
                hash ^= HasCreatePower.GetHashCode();
            }
            return(hash);
        }
        /// <summary>
        /// This method will be called when the DcdEvent is invoked.
        /// </summary>
        private void dcdEvent_Scanned(object sender, DcdEventArgs e)
        {
            if (App.ignoreScan || App.ScanHandler == null)
            {
                return;
            }
            CodeId cID     = CodeId.NoData;
            string dcdData = string.Empty;

            // Obtain the string and code id.
            try
            {
                dcdData = hDcd.ReadString(e.RequestID, ref cID);
                lock (scanQueue.SyncRoot)
                {
                    scanQueue.Enqueue(new ScanData(cID.ToString(), dcdData));
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
        }
Exemple #11
0
        public void SetDcdText(int msgReqID)
        {
            CodeId cID     = CodeId.NoData;
            string dcdData = "";

            try
            {
                dcdData = hDcd.ReadString(msgReqID, ref cID);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("String read error: " + ex.Message);
                Console.Error.Flush();
                return;
            }

            this.code.Text = Regex.Replace(dcdData, "[^a-zA-Z0-9_.]+", "", RegexOptions.Compiled);

            List <Box> ordDL = (List <Box>)orderDetailsList.DataSource;

            if (this.scan == false && ordDL.Count() > 0)
            {
                int idx = -1;

                foreach (Box box in ordDL)
                {
                    if (box.id == this.code.Text)
                    {
                        Console.Error.WriteLine(box);
                        Console.Error.WriteLine(ordDL.Count());

                        idx = ordDL.IndexOf(box);

                        ordDL.RemoveAt(idx);
                        Console.Error.WriteLine(ordDL.Count());
                        Console.Error.WriteLine("Indeks:" + idx);
                        Console.Error.WriteLine("Znaleziono pudło {0}", box.id);
                        Console.Error.Flush();
                        break;
                    }
                }
                orderDetailsList.DataSource    = null;
                orderDetailsList.DataSource    = ordDL;
                orderDetailsList.DisplayMember = "display_name";
                orderDetailsList.ValueMember   = "id";
                orderDetailsList.Refresh();
            }
            if (this.scan == false && orderDetailsList.Items.Count == 0)
            {
                string complete_url     = ArchiDox.Properties.Resources.orderCompleteURL;
                string completePostData = "order_id=" + this.order_id;
                string completeResult   = this.SendData("POST", complete_url, completePostData);
                try
                {
                    JsonResponseConfirmOrder completeResponseObj = JsonConvert.DeserializeObject <JsonResponseConfirmOrder>(completeResult);

                    if (completeResponseObj.status == "OK")
                    {
                        DialogResult dresult = MessageBox.Show("To zamówienie zostało skompletowane", "Zamówienie skompletowane", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);

                        if (dresult == DialogResult.OK)
                        {
                            refreshOrderList();
                        }
                        Console.Error.WriteLine("Zamówienie {0} zostało skompletowane", this.order_id);
                        Console.Error.Flush();
                    }
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("Zamówienie {0} zostało skompletowane ale nie udało się go potwierdzić", this.order_id);
                    Console.Error.Flush();
                }
            }
            else if (this.scan == true)
            {
                try
                {
                    if (addOrderBox(this.order_id, this.code.Text))
                    {
                        Console.Error.WriteLine("Pudło {0} dodano do zamówienia " + this.order_id, this.code.Text);
                        Console.Error.Flush();
                    }
                    else
                    {
                        Console.Error.WriteLine("Pudło {0} nie zostałe dodane do zamówienia " + this.order_id, this.code.Text);
                        Console.Error.Flush();
                    }
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("Pudło {0} nie zostałe dodane do zamówienia " + this.order_id, this.code.Text);
                    Console.Error.Flush();
                }
            }
        }
Exemple #12
0
        private void dcdEvent_Scanned(object sender, DecodeEventArgs e)
        {
            CodeId cID     = CodeId.NoData;
            string dcdData = string.Empty;

            TemVitri temVitriTMP = null;

            // Obtain the string and code id.
            try
            {
                dcdData = hDcd.ReadString(e.RequestID, ref cID);


                temVitriTMP = new TemVitri(dcdData);

                if (temVitriTMP.ID != 0 && temVitriTMP.ID != null)
                {
                    dangQuet = 0;
                }
                else
                {
                    temThungThanhPham = new TemThungThanhPham(dcdData);
                    dangQuet          = 1;
                }



                //quet tem Vitri
                if (dangQuet == 0)
                {
                    if (temVitriTMP.ID == 0 || temVitriTMP.ID == null)
                    {
                        MessageBox.Show("Ma vach khong hop le", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    }
                    else
                    {
                        if (temViTri != null)
                        {
                            if (temViTri.ID != temVitriTMP.ID)
                            {
                                MessageBox.Show("Bạn phải xóa vị trí cũ trước khi quét vị trí mới", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                            }
                        }
                        else
                        {
                            temViTri = temVitriTMP;

                            //load thong tin vi tri
                            lblViTri.Text       = temViTri.ID + "-" + temViTri.Ten;
                            btnXoaVitri.Enabled = true;
                            dangQuet            = 1;

                            lblStartMsgVitri.Visible = false;

                            if (dtTemThungThanhPham.Rows.Count > 0)
                            {
                                btnSave.Enabled  = true;
                                btnReset.Enabled = true;
                            }
                        }
                    }
                }
                //Quet tem Cuon
                else if (dangQuet == 1 || dangQuet == 2)
                {
                    dgListCuon.Visible = true;
                    //temCuon = new TemCuon(dcdData);
                    lblStartMsgLinhKien.Visible = false;
                    if (temThungThanhPham.IdThung == null)
                    {
                        MessageBox.Show("Ma vach khong hop le", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    }
                    else
                    {
                        //check exist in the added list
                        TemThungThanhPham tmp = listTemThungThanhPham.Find(x => x.IdThung == temThungThanhPham.IdThung);
                        if (tmp == null)
                        {
                            listTemThungThanhPham.Add(temThungThanhPham);

                            updateGridLayout();

                            dangQuet = 2;

                            lblStartMsgLinhKien.Visible = false;
                            SoKien++;

                            if (temViTri != null)
                            {
                                btnSave.Enabled  = true;
                                btnReset.Enabled = true;
                            }
                        }
                        else
                        {
                            MessageBox.Show("Thùng này đã được quét", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageBox.Show("Co loi xay ra, hay quet lai tu dau", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }