Ejemplo n.º 1
0
        public rfidCheckArticles(string number, ReaderMethod readerTransfered, string refPedido)
        {
            InitializeComponent();
            this.ControlBox        = false;
            reader                 = readerTransfered;
            label3.Text            = refPedido;
            reader.AnalyCallback   = AnalyData;
            reader.ReceiveCallback = ReceiveData;
            reader.SendCallback    = SendData;
            // Cargar con datos de la bbdd
            numPedido = number;
            //Initialize mysql connection
            connection  = new MySqlConnection(ConnectionString);
            connection2 = new MySqlConnection(ConnectionString2);
            //Get all items in datatable
            DTItems = GetAllItems();

            //Fill grid with items
            dataGridView1.DataSource            = DTItems;
            dataGridView1.Columns[0].HeaderText = "ID";
            dataGridView1.Columns[1].HeaderText = "REFERENCIA";
            dataGridView1.Columns[2].HeaderText = "DESCRIPCION";
            dataGridView1.Columns[3].HeaderText = "CANTIDAD";
            dataGridView1.ClearSelection();
            refreshQuantityGridInBoxes();
            btRealTimeInventory_Click();
        }
Ejemplo n.º 2
0
        private void frmMySqlSample_Load(object sender, EventArgs e)
        {
            //Initialize mysql connection
            connection             = new MySqlConnection(ConnectionString);
            reader                 = new Reader.ReaderMethod();
            reader.AnalyCallback   = AnalyData;
            reader.ReceiveCallback = ReceiveData;
            reader.SendCallback    = SendData;
            //Get all items in datatable
            DTItems = GetAllItems();

            //Fill grid with items
            dataGridView1.DataSource            = DTItems;
            dataGridView1.Columns[0].HeaderText = "ID";
            dataGridView1.Columns[1].HeaderText = "REFERENCIA";
            dataGridView1.Columns[2].HeaderText = "FECHA";
            dataGridView1.Columns[3].HeaderText = "ARTICULOS";
            string[] ports = SerialPort.GetPortNames();
            if (Properties.Settings.Default.portCOM == "")
            {
                btnSave.Enabled = false;
            }
            else
            {
                comboBox1.Text = Properties.Settings.Default.portCOM;
            }
            foreach (string portAvailable in ports)
            {
                comboBox1.Items.Add(portAvailable);
            }

            DateTime fechaHoy = DateTime.Now;
            DateTime horaMax  = Convert.ToDateTime("16:00:00");
            DateTime fechaMax = new DateTime(fechaHoy.Year, fechaHoy.Month, fechaHoy.Day, horaMax.Hour, horaMax.Minute, horaMax.Second);

            for (int h = 0; h < dataGridView1.Rows.Count; h++)
            {
                DateTime fechaPedido = Convert.ToDateTime(dataGridView1[2, h].Value);
                DateTime.Now.ToString("h:mm:ss tt");
                if (DateTime.Compare(fechaPedido, fechaMax) < 0)
                {
                    // Do Today
                    dataGridView1.Rows[h].DefaultCellStyle.BackColor = Color.FromArgb(255, 255, 0);
                }
                else
                {
                    // Dont do today
                    dataGridView1.Rows[h].DefaultCellStyle.BackColor = Color.FromArgb(153, 255, 104);
                }
            }
            dataGridView1.ClearSelection();
        }
Ejemplo n.º 3
0
        private static void StartToRead()
        {
            try
            {
                timerInventory          = new System.Timers.Timer();
                timerInventory.Interval = 50;
                timerInventory.Elapsed += new ElapsedEventHandler(timerInventory_Tick);

                DeviceAntennaCount = 4;
                reader             = new Reader.ReaderMethod();
                DeviceSerialPort   = 2;

                reader.AnalyCallback = AnalyData;
                Connect();

                new System.Threading.Thread(new System.Threading.ThreadStart(DetectPosition)).Start();
            }
            catch (Exception ex)
            {
                Logger(ex.Message);
            }
        }