Esempio n. 1
0
        public XuatKhoLinhKien()
        {
            InitializeComponent();

            //Initialize event
            hDcd = new DecodeHandle(DecodeDeviceCap.Exists | DecodeDeviceCap.Barcode);
            DecodeRequest reqType = (DecodeRequest)1 | DecodeRequest.PostRecurring;

            dcdEvent          = new DecodeEvent(hDcd, reqType, this);
            dcdEvent.Scanned += new DecodeScanned(dcdEvent_Scanned);
        }
Esempio n. 2
0
 private void initEventScan()
 {
     try
     {
         hDcd = new DecodeHandle(DecodeDeviceCap.Exists | DecodeDeviceCap.Barcode);
         DecodeRequest reqType = (DecodeRequest)1 | DecodeRequest.PostRecurring;
         dcdEvent          = new DecodeEvent(hDcd, reqType, this);
         dcdEvent.Scanned += new DecodeScanned(dcdEvent_Scanned);
     }
     catch { }
 }
Esempio n. 3
0
        public CapNhatViTriThanhPham()
        {
            InitializeComponent();
            hDcd = new DecodeHandle(DecodeDeviceCap.Exists | DecodeDeviceCap.Barcode);

            // Initialize event
            DecodeRequest reqType = (DecodeRequest)1 | DecodeRequest.PostRecurring;

            dcdEvent = new DecodeEvent(hDcd, reqType, this);

            dcdEvent.Scanned += new DecodeScanned(dcdEvent_Scanned);

            dgListCuon.DataSource = dtTemThungThanhPham;
        }
Esempio n. 4
0
        public XuatKhoLinhKienFree()
        {
            InitializeComponent();
            btnListID.Enabled = false;

            //Initialize event
            try
            {
                hDcd = new DecodeHandle(DecodeDeviceCap.Exists | DecodeDeviceCap.Barcode);
                DecodeRequest reqType = (DecodeRequest)1 | DecodeRequest.PostRecurring;
                dcdEvent          = new DecodeEvent(hDcd, reqType, this);
                dcdEvent.Scanned += new DecodeScanned(dcdEvent_Scanned);
            }
            catch { }
        }
        public InventoryAdjustment()
        {
            InitializeComponent();

            //Initialize event
            try
            {
                hDcd = new DecodeHandle(DecodeDeviceCap.Exists | DecodeDeviceCap.Barcode);
                DecodeRequest reqType = (DecodeRequest)1 | DecodeRequest.PostRecurring;
                dcdEvent          = new DecodeEvent(hDcd, reqType, this);
                dcdEvent.Scanned += new DecodeScanned(dcdEvent_Scanned);
            }
            catch { }

            btnScan.Enabled = false;
            dtList.Rows.Clear();
        }
        public override bool Initialize()
        {
            hDcd = new DecodeHandle(DecodeDeviceCap.Exists | DecodeDeviceCap.Barcode);
            Datalogic.API.DecodeRequest reqType = (DecodeRequest)1 | DecodeRequest.PostRecurring;


            // Initialize all events possible
            dcdEvent = new DecodeEvent(hDcd, reqType);
            //dcdEvent = new DecodeEvent(hDcd, reqType, this);
            //  dcdEvent.ScanPress += new DecodeScanPress(dcdEvent_ScanPress);
            //  dcdEvent.ScanStart += new DecodeScanStart(dcdEvent_ScanStart);
            dcdEvent.Scanned += new DecodeScanned(symbolReader_ReadNotify);
            //  dcdEvent.TimeOut += new DecodeTimeOut(dcdEvent_TimeOut);
            // dcdEvent.ScanStop += new DecodeScanStop(dcdEvent_ScanStop);
            dcdEvent.ScanRelease += new DecodeScanRelease(symbolReader_ReadNotify);

            return(true);
        }
        private void btnScan_Click(object sender, EventArgs e)
        {
            try
            {
                if (dcdEvent.IsListening)
                {
                    dcdEvent.StopScanListener();
                }
            }
            catch { }
            try
            {
                if (hDcd != null)
                {
                    hDcd.Dispose();
                }
            }
            catch { }

            InventoryAdjustmentScan frmInventoryAdjustmentScan = new InventoryAdjustmentScan();

            frmInventoryAdjustmentScan.ListSpace = this.ListSpace;
            //frmInventoryAdjustmentScan.ListDetail = this.ListDetail;
            frmInventoryAdjustmentScan.Adjustment = this._Adjustment;
            frmInventoryAdjustmentScan.ShowDialog();

            this.ListSpace = frmInventoryAdjustmentScan.ListSpace;

            //Initialize event
            try
            {
                hDcd = new DecodeHandle(DecodeDeviceCap.Exists | DecodeDeviceCap.Barcode);
                DecodeRequest reqType = (DecodeRequest)1 | DecodeRequest.PostRecurring;
                dcdEvent          = new DecodeEvent(hDcd, reqType, this);
                dcdEvent.Scanned += new DecodeScanned(dcdEvent_Scanned);
            }
            catch (Exception ex) { }
        }
Esempio n. 8
0
        private void showDetails(object sender, EventArgs e)
        {
            int    selectedIndex = this.ordersList.SelectedIndex;
            Order  item          = (Order)this.ordersList.SelectedItem;
            string id            = item.id;

            this.order_id = int.Parse(id);
            Console.Error.WriteLine("Selected id " + id);
            string url          = ArchiDox.Properties.Resources.orderDetailsURL;
            string postData     = "order_id=" + id;
            string orderDetails = this.SendData("POST", url, postData);

            Console.Error.WriteLine("Order details:" + orderDetails);
            Console.Error.Flush();


            if (orderDetails.Length > 0 && this.listLoaded == true)
            {
                try
                {
                    JsonResponseOrderDetailsResult responseObj = JsonConvert.DeserializeObject <JsonResponseOrderDetailsResult>(orderDetails);
                    if (responseObj.status == "OK")
                    {
                        try
                        {
                            if (responseObj.content.Count > 0)
                            {
                                this.scan = false;
                                DialogResult dresult = MessageBox.Show("To zamówienie zostanie podjęte do realizacji", "Podjąć zamówienie ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

                                if (dresult == DialogResult.Yes)
                                {
                                    string confirm_url     = ArchiDox.Properties.Resources.orderConfirmURL;
                                    string confirmPostData = "order_id=" + id;
                                    string confirmResult   = this.SendData("POST", confirm_url, confirmPostData);

                                    try
                                    {
                                        JsonResponseConfirmOrder confirmResponseObj = JsonConvert.DeserializeObject <JsonResponseConfirmOrder>(confirmResult);

                                        if (confirmResponseObj.status == "OK")
                                        {
                                            Console.Error.WriteLine("Zamówienie {0} zostało potwierdzone", id);
                                            orderDetailsList.DataSource    = responseObj.content;
                                            orderDetailsList.DisplayMember = "display_name";
                                            orderDetailsList.ValueMember   = "id";
                                            orderDetailsList.Visible       = true;
                                            ordersList.Visible             = false;
                                            code.Visible = true;
                                            try
                                            {
                                                hDcd    = new DecodeHandle(DecodeDeviceCap.Exists | DecodeDeviceCap.Barcode);
                                                reqType = (DecodeRequest)1 | DecodeRequest.PostRecurring;
                                                reqID   = hDcd.PostRequestMsgEx(reqType, wndMsg, Constants.WM_SCANNED, Constants.WM_TIMEOUT);
                                                Console.Error.WriteLine("Barcode decoder found");
                                                code.GotFocus += new System.EventHandler(this.scanCode);
                                                hDcd.SoftTrigger(DecodeInputType.Barcode, 5000);
                                                Console.Error.Flush();
                                            }
                                            catch (DecodeException)
                                            {
                                                Console.Error.WriteLine("Barcode decoder not found");
                                                Console.Error.Flush();
                                            }
                                            catch (Exception ee)
                                            {
                                                Console.Error.WriteLine("Barcode reader problem");
                                                Console.Error.WriteLine(ee.Message);
                                                Console.Error.WriteLine(ee.StackTrace);
                                                Console.Error.Flush();
                                            }
                                        }
                                        else
                                        {
                                            Console.Error.WriteLine(confirmResponseObj.error);
                                            Console.Error.Flush();
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.Error.WriteLine(ex.Message);
                                        Console.Error.WriteLine(ex.StackTrace);
                                        Console.Error.Flush();
                                    }
                                }
                                else if (dresult == DialogResult.No)
                                {
                                    Console.Error.Flush();
                                }
                            }
                            else if (responseObj.scan == true)
                            {
                                this.scan = true;
                                DialogResult dresult = MessageBox.Show("To zamówienie zostanie podjęte do realizacji i oczekuje skanowania nowych pudeł", "Podjąć zamówienie ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

                                if (dresult == DialogResult.Yes)
                                {
                                    string confirm_url     = ArchiDox.Properties.Resources.orderConfirmURL;
                                    string confirmPostData = "order_id=" + id;
                                    string confirmResult   = this.SendData("POST", confirm_url, confirmPostData);
                                    try
                                    {
                                        JsonResponseConfirmOrder confirmResponseObj = JsonConvert.DeserializeObject <JsonResponseConfirmOrder>(confirmResult);

                                        if (confirmResponseObj.status == "OK")
                                        {
                                            Console.Error.WriteLine("Zamówienie {0} zostało potwierdzone", id);
                                            orderDetailsList.Visible = true;
                                            ordersList.Visible       = false;
                                            code.Visible             = true;
                                            try
                                            {
                                                hDcd    = new DecodeHandle(DecodeDeviceCap.Exists | DecodeDeviceCap.Barcode);
                                                reqType = (DecodeRequest)1 | DecodeRequest.PostRecurring;
                                                reqID   = hDcd.PostRequestMsgEx(reqType, wndMsg, Constants.WM_SCANNED, Constants.WM_TIMEOUT);
                                                Console.Error.WriteLine("Barcode decoder found");
                                                code.GotFocus += new System.EventHandler(this.scanCode);
                                                hDcd.SoftTrigger(DecodeInputType.Barcode, 5000);
                                                Console.Error.Flush();
                                            }
                                            catch (DecodeException)
                                            {
                                                Console.Error.WriteLine("Barcode decoder not found");
                                                Console.Error.Flush();
                                            }
                                            catch (Exception ee)
                                            {
                                                Console.Error.WriteLine("Barcode reader problem");
                                                Console.Error.WriteLine(ee.Message);
                                                Console.Error.WriteLine(ee.StackTrace);
                                                Console.Error.Flush();
                                            }
                                        }
                                        else
                                        {
                                            Console.Error.WriteLine(confirmResponseObj.error);
                                            Console.Error.Flush();
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.Error.WriteLine(ex.Message);
                                        Console.Error.WriteLine(ex.StackTrace);
                                        Console.Error.Flush();
                                    }
                                }
                                else
                                {
                                    Console.Error.Flush();
                                }
                            }

                            Console.Error.Flush();
                        }
                        catch (Exception ex)
                        {
                            Console.Error.WriteLine(ex.Message);
                            Console.Error.WriteLine(ex.StackTrace);
                            throw;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine(ex.Message);
                    Console.Error.WriteLine(ex.StackTrace);
                    throw;
                }
            }
        }
Esempio n. 9
0
        private void refreshDetails(object sender, EventArgs e)
        {
            order_backButton.Visible    = true;
            order_refreshButton.Visible = true;
            order_goButton.Visible      = true;

            backButton.Visible    = false;
            refreshButton.Visible = false;
            goButton.Visible      = false;
            finishButton.Visible  = false;

            int    selectedIndex = this.ordersList.SelectedIndex;
            Order  item          = (Order)this.ordersList.SelectedItem;
            string id            = item.id;

            this.order_id = int.Parse(id);
            Console.Error.WriteLine("Selected id " + id);
            string url          = ArchiDox.Properties.Resources.orderDetailsURL;
            string postData     = "order_id=" + id;
            string orderDetails = Global.SendData("POST", url, postData);

            Console.Error.WriteLine("Order details:" + orderDetails);
            Console.Error.Flush();


            if (orderDetails.Length > 0 && this.listLoaded == true)
            {
                try
                {
                    JsonResponseOrderDetailsResult responseObj = JsonConvert.DeserializeObject <JsonResponseOrderDetailsResult>(orderDetails);
                    if (responseObj.status == "OK")
                    {
                        try
                        {
                            if (responseObj.content.Count > 0 && responseObj.scan == false)
                            {
                                this.scan = false;
                                orderDetailsList.DataSource    = responseObj.content;
                                orderDetailsList.DisplayMember = "display_name";
                                orderDetailsList.ValueMember   = "id";
                                orderDetailsList.Visible       = true;
                                ordersList.Visible             = false;
                                code.Visible         = true;
                                finishButton.Visible = false;
                            }

                            else if (responseObj.scan == true)
                            {
                                orderDetailsList.Items.Clear();

                                this.scan = true;

                                orderDetailsList.Visible     = true;
                                ordersList.Visible           = false;
                                code.Visible                 = true;
                                order_refreshButton.Size     = new Size(123, 41);
                                order_refreshButton.Location = new Point(173, 499);
                                finishButton.Visible         = true;

                                try
                                {
                                    hDcd    = new DecodeHandle(DecodeDeviceCap.Exists | DecodeDeviceCap.Barcode);
                                    reqType = (DecodeRequest)1 | DecodeRequest.PostRecurring;
                                    reqID   = hDcd.PostRequestMsgEx(reqType, wndMsg, Constants.WM_SCANNED, Constants.WM_TIMEOUT);
                                    Console.Error.WriteLine("Barcode decoder found");
                                    code.GotFocus += new System.EventHandler(this.scanCode);
                                    hDcd.SoftTrigger(DecodeInputType.Barcode, 5000);
                                    Console.Error.Flush();
                                }
                                catch (Exception)
                                {
                                    Console.Error.WriteLine("Barcode decoder not found");
                                    Console.Error.Flush();
                                }
                            }

                            Console.Error.Flush();
                        }
                        catch (Exception ex)
                        {
                            Console.Error.WriteLine(ex.Message);
                            Console.Error.WriteLine(ex.StackTrace);
                            throw;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine(ex.Message);
                    Console.Error.WriteLine(ex.StackTrace);
                    throw;
                }
            }
        }