Ejemplo n.º 1
0
        private void DataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
            messageBoxCS.AppendFormat("{0} = {1}", "ColumnIndex", e.ColumnIndex);
            messageBoxCS.AppendLine();
            messageBoxCS.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex);
            messageBoxCS.AppendLine();
            MessageBox.Show(messageBoxCS.ToString(), "CellDoubleClick Event");

            if (e.ColumnIndex > -1 && e.RowIndex > -1)
            {
                proceedOrder order = new proceedOrder();

                order._EBELN = Convert.ToString(dataGridView1.Rows[e.RowIndex].Cells["מספר הזמנה"].Value);
                order._EBELP = Convert.ToString(dataGridView1.Rows[e.RowIndex].Cells["מספר פריט"].Value);
                //order._BSART = Convert.ToString(dataGridView1.Rows[e.RowIndex].Cells["סוג מסמך"].Value);
                order._MATNR = Convert.ToString(dataGridView1.Rows[e.RowIndex].Cells["מק'ט"].Value);
                order._MEINS = Convert.ToString(dataGridView1.Rows[e.RowIndex].Cells["יחידת מידה"].Value);
                order._MAKTX = Convert.ToString(dataGridView1.Rows[e.RowIndex].Cells["תיאור מק'ט"].Value);
                //order._ID_LGPBE = Convert.ToString(dataGridView1.Rows[e.RowIndex].Cells["מספר מגדל"].Value);
                order._LGORT = Convert.ToString(dataGridView1.Rows[e.RowIndex].Cells["מחסן מקבל"].Value);
                order._MENGE = Convert.ToString(dataGridView1.Rows[e.RowIndex].Cells["כמות לניפוק"].Value);

                order.ShowDialog();

            }
        }
Ejemplo n.º 2
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            int x = 0;
            int nextTray = 0;
            int currentTray = 0;

            simplelogfile.LogToFile("the user start working on order");

            for (int i = 0; i < dataGridViewWithItems.RowCount; i++)
            {
                if (OPERATE_MACHINE)
                {
                    ///need here to send all messages to the tower
                    string tray = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["TRAY"].Value);
                    int trayNo = Convert.ToInt16(tray);

                    int ret = OperateTower.instance().LUCall((start_lu_int + trayNo), machine_no_int, 1);

                    string s = String.Format("call tray {0} for machine {1}", (start_lu_int + trayNo), machine_no_int);

                    if (ret == 1)
                    {
                        //LU IN TABLE
                        //MessageBox.Show("need to check lu and LU Status", "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        string strerror = "error: order item LUCall" + s;

                        simplelogfile.LogToFile(strerror);
                    }
                    else
                    {
                        //LU NOT IN TABLE
                        string str = "success LUCall" + s;
                        simplelogfile.LogToFile(str);
                    }

                }

            }

            foreach (order _orderItem in LIST_ORDER) // Loop through List with foreach
            {

                proceedOrder order = new proceedOrder();

                //order._AEDAT = _orderItem._AEDAT;
                order._AXISX = _orderItem._AXISX;
                order._AXISY = _orderItem._AXISY;
                //order._BSART = _orderItem._BSART;
                order._EBELN = _orderItem._EBELN;
                order._EBELP = _orderItem._EBELP;
                //order._ERNAM = _orderItem._ERNAM;
                order._LGOBE = _orderItem._LGOBE;
                order._LGORT = _orderItem._LGORT;
                order._MAKTX = _orderItem._MAKTX;
                order._MATNR = _orderItem._MATNR;
                order._MEINS = _orderItem._MEINS;
                order._MENGE = _orderItem._MENGE;
                order._MENGE2 = _orderItem._MENGE2;
                order._MENGETextBox = _orderItem._MENGE2;
                order._TOWER = _orderItem._TOWER;
                order._TRAY = _orderItem._TRAY;
                //order._DONE = _orderItem._DONE;
                order._INBOX = _orderItem._INBOX;

                if (_orderItem._DONE == "OK")
                {

                    x++;
                    continue;

                }

                order.ShowDialog();

                if (order.DialogResult.Equals(DialogResult.OK))
                {
                       //dataGridViewWithItems.Rows[x].Cells["READY"].Value = "OK";

                    //dataGridViewWithItems.Rows[x].Cells["EBELN"].Style.BackColor =
                     //           System.Drawing.Color.Green;

                    dataGridViewWithItems.Rows[x].Cells["EBELP"].Style.BackColor = System.Drawing.Color.Yellow;
                    dataGridViewWithItems.Rows[x].Cells["MENGE2"].Style.BackColor = System.Drawing.Color.Yellow;
                    decimal y = Convert.ToDecimal(dataGridViewWithItems.Rows[x].Cells["MENGE2"].Value) - Convert.ToDecimal(order._MENGETextBox);
                    dataGridViewWithItems.Rows[x].Cells["MENGE2"].Value = y.ToString();

                    decimal inboxafter = Convert.ToDecimal(dataGridViewWithItems.Rows[x].Cells["LABST"].Value) - Convert.ToDecimal(order._MENGETextBox);
                    dataGridViewWithItems.Rows[x].Cells["LABST"].Value = inboxafter;

                     currentTray = Convert.ToInt16(_orderItem._TRAY);

                     int listsize = LIST_ORDER.Count();
                     order _orderItem1;

                     if (x < (listsize - 1))
                     {

                         _orderItem1 = LIST_ORDER[x + 1];
                         nextTray = Convert.ToInt16(_orderItem1._TRAY);
                     }
                     else
                     {
                         nextTray = -1; //end of list
                     }

                     if (currentTray != nextTray)
                     {

                         if (OPERATE_MACHINE)
                         {
                             int tray = Convert.ToInt16(currentTray);

                             string s = String.Format("call tray {0} for machine {1}", (start_lu_int + tray), machine_no_int);

                             int ret = OperateTower.instance().RemotePickingEnd((start_lu_int + tray), machine_no_int, 1);

                             if (ret == 1)
                             {
                                 //MessageBox.Show("need to check lu and LU Status", "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                 string strerror = "error: order item RemotePickingEnd" + s;

                                 simplelogfile.LogToFile(strerror);
                             }
                             else
                             {
                                 string str = "success RemotePickingEnd" + s;
                                 simplelogfile.LogToFile(str);

                             }
                         }

                     }

                     _orderItem._DONE = "OK";
                     _orderItem._MENGE2 = order._MENGETextBox;
                     x++;

                }

                if (order.DialogResult.Equals(DialogResult.Cancel))
                {

                    simplelogfile.LogToFile("cancel button ordewritem");

                    if (OPERATE_MACHINE)
                    {

                        int tray = Convert.ToInt16(order._TRAY);

                        string s = String.Format("call tray {0} for machine {1}", (start_lu_int + tray), machine_no_int);

                        int ret = OperateTower.instance().RemotePickingEnd((start_lu_int + tray), machine_no_int, 1);

                        if (ret == 1)
                        {
                            //MessageBox.Show("need to check lu and LU Status", "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            string strerror = "error: order item RemotePickingEnd" + s;

                            simplelogfile.LogToFile(strerror);
                        }
                        else
                        {
                            string str = "success RemotePickingEnd" + s;
                            simplelogfile.LogToFile(str);

                        }
                    }

                    break;
                }

            }

            simplelogfile.LogToFile("the user finsih working on order");
        }