private void LoginBtn_Click(object sender, EventArgs e) { //UserName.Text = "manou"; //UserPassword.Text = "123456QAS"; string MessageReturn = string.Empty; if (UserName.Text != "" && UserPassword.Text != "") { bool isLogin = false; TranstechClient TraCl = new TranstechClient(); try { TraCl.Open(); isLogin = TraCl.ZMM_TRANSTECH_AUTHENTICATION(UserName.Text, UserPassword.Text, ref MessageReturn, client_type); if (!isLogin)//Check for an error throw new Exception(MessageReturn); } catch (Exception Ex) { MessageBox.Show("שם המשתמש או הססמה שגויים!", "שגיאה", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { TraCl.Close(); } if (isLogin) { ResultText = UserName.Text; ResultPassword = UserPassword.Text; this.DialogResult = DialogResult.OK; this.Close(); } } else { MessageBox.Show("אנא מלא את שם המשתמש והססמה!", "מידע חסר",MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void update_Click(object sender, EventArgs e) { simplelogfile.LogToFile("update button orderitemsform "); int subrc = 0; //check how many entries there are in the list. int listsize = 0; foreach (order _orderItem in LIST_ORDER) // Loop through List with foreach { if (_orderItem._DONE == "OK") listsize++; } TranstechClient Client = new TranstechClient(); try { V_MIGO[] Migo = new V_MIGO[listsize]; int counter = 0; foreach (order _orderItem in LIST_ORDER) // Loop through List with foreach { if (_orderItem._DONE == "OK") { //decimal menge = Convert.ToDecimal(_orderItem._MENGE2); //if (menge != 0) //{ V_MIGO Migo_line = new V_MIGO(); //_orderItem._MENGE2 = "2"; Migo_line.MATERIAL = _orderItem._MATNR; Migo_line.PO_ITEM = _orderItem._EBELP; Migo_line.PO_NUMBER = _orderItem._EBELN; Migo_line.ENTRY_QNT = Convert.ToDecimal(_orderItem._MENGE2); Migo_line.STGE_LOC = _orderItem._LGORT; Migo[counter] = Migo_line; counter++; //} } } Client.Open(); DateTime EndDate = DateTime.Now; V_BAPIRETURN[] Bapireturn = new V_BAPIRETURN[0]; string MigoNumber = Client.ZMM_TRANSTECH_MIGO(LOGIN_NAME, LOGIN_PASSWORD, Migo, ref Bapireturn, "", EndDate.ToString("yyyy-MM-dd"), EndDate.ToString("yyyy-MM-dd"), "Test rub", ref subrc, ref MessageReturn, CLIENT_TYPE); string xxx = MigoNumber; //Label.Text = MigoNumber; //if (!String.IsNullOrEmpty(MessageReturn)) // Label.Text = MessageReturn; string s = String.Format("create MIGO subrc : {0} MigoNumber: {1} ", (subrc), MigoNumber); simplelogfile.LogToFile(s); dictionary.Clear(); if (subrc == 4)//Check for an error { string text = ": הנפקת טובין נכשלה "; //MessageBox.Show(text, "Message", MessageBoxButtons.OK); //MessageBox.Show(text, "Message", MessageBoxButtons.OK); MyMessageBox.ShowBox(text, "Message"); foreach (V_BAPIRETURN BapiLine in Bapireturn) { errorValues error = new errorValues(); int row = BapiLine.ROW - 1; error._MESSAGE = BapiLine.MESSAGE; error._TYPE = BapiLine.TYPE; error._ROW = dataGridViewWithItems.Rows[row].Cells["EBELP"].Value.ToString(); dictionary.Add(error._ROW, error); } //Refreash(sender, e); for (int i = 0; i < dataGridViewWithItems.RowCount; i++) { string ebelp = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["EBELP"].Value); if (dictionary.ContainsKey(ebelp)) { errorValues getError = dictionary[ebelp]; dataGridViewWithItems.Rows[i].Cells["MESSAGE"].Value = getError._MESSAGE; dataGridViewWithItems.Rows[i].Cells["TYPE"].Value = getError._TYPE; dataGridViewWithItems.Rows[i].Cells["TYPE"].Style.BackColor = System.Drawing.Color.Red; } } } else if (subrc == 0) { string text = "הנפקת טובין בוצעה בהצלחה . מספר: " + MigoNumber ; //MessageBox.Show(text, "Message", MessageBoxButtons.OK); MyMessageBox.ShowBox(text, "Message"); Refreash(sender, e); } } catch (Exception Ex) { MessageBox.Show(Ex.Message); } finally { Client.Close(); } sendToMachineAccordingStatus(); }
private void Refreash(object sender, EventArgs e) { int subrc = 0; TranstechClient Client = new TranstechClient(); try { Client.Open(); Po = Client.ZMM_TRANSTECH_GET_PO(LOGIN_NAME, LOGIN_PASSWORD, ((TranstechlTower)Enum.Parse(typeof(TranstechlTower), TOWER_STRING)), (TranstechlFields)Enum.Parse(typeof(TranstechlFields), "EBELN"), ORDER_NUMBER, ref subrc, ref MessageReturn, CLIENT_TYPE); //Session.Add("Po", Po); dataGridViewWithItems.DataSource = Po; if (!once) { DataGridViewColumn col1 = new DataGridViewTextBoxColumn(); col1.DataPropertyName = "ID_TYPE"; col1.HeaderText = " שגיאה"; col1.Name = "TYPE"; dataGridViewWithItems.Columns.Add(col1); DataGridViewColumn col2 = new DataGridViewTextBoxColumn(); col2.DataPropertyName = "ID_MESSAGE"; col2.HeaderText = "הודעת השגיאה"; col2.Name = "MESSAGE"; dataGridViewWithItems.Columns.Add(col2); once = true; } if (subrc == 4)//Check for an error throw new Exception(MessageReturn); dataGridViewWithItems.Columns["BSART"].Visible = false; dataGridViewWithItems.Columns["ERNAM"].Visible = false; //dataGridViewWithItems.Columns["TOWER"].Visible = false; //dataGridViewWithItems.Columns["TOWER"].Visible = false; dataGridViewWithItems.Columns["AEDAT"].DisplayIndex = 0; dataGridViewWithItems.Columns["EBELN"].DisplayIndex = 1; dataGridViewWithItems.Columns["EBELP"].DisplayIndex = 2; dataGridViewWithItems.Columns["LGOBE"].DisplayIndex = 3; dataGridViewWithItems.Columns["LGORT"].DisplayIndex = 4; dataGridViewWithItems.Columns["MATNR"].DisplayIndex = 5; dataGridViewWithItems.Columns["MAKTX"].DisplayIndex = 6; dataGridViewWithItems.Columns["MENGE"].DisplayIndex = 7; dataGridViewWithItems.Columns["MEINS"].DisplayIndex = 8; dataGridViewWithItems.Columns["AXISY"].DisplayIndex = 9; dataGridViewWithItems.Columns["AXISX"].DisplayIndex = 10; dataGridViewWithItems.Columns["TRAY"].DisplayIndex = 11; dataGridViewWithItems.Columns["TOWER"].DisplayIndex = 12; dataGridViewWithItems.Columns["MENGE2"].DisplayIndex = 13; dataGridViewWithItems.Columns["LABST"].DisplayIndex = 14; for (int i = 0; i < dataGridViewWithItems.RowCount; i++) { dataGridViewWithItems.Rows[i].Cells["TYPE"].Value = ""; dataGridViewWithItems.Rows[i].Cells["MESSAGE"].Value =""; } //GridView.DataBind(); //Response.Write(MessageReturn); } catch (Exception Ex) { MessageBox.Show(Ex.Message); } finally { //Client.Close(); } ////////////////////////////////////// dt_items.AcceptChanges(); dataGridViewWithItems.AutoResizeColumns(); LIST_ORDER.RemoveRange(0, LIST_ORDER.Count()); /////////////////////////////////////////////////////////////// if (dataGridViewWithItems.RowCount ==0) { this.DialogResult = DialogResult.Cancel; this.Close(); } for (int i = 0; i < dataGridViewWithItems.RowCount; i++) { order orderItem = new order(); string orderNum = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["EBELN"].Value); orderItem._EBELN = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["EBELN"].Value); //order number orderItem._AEDAT = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["AEDAT"].Value); orderItem._AXISX = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["AXISX"].Value); orderItem._AXISY = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["AXISY"].Value); orderItem._BSART = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["BSART"].Value); orderItem._EBELN = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["EBELN"].Value); orderItem._EBELP = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["EBELP"].Value); orderItem._ERNAM = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["ERNAM"].Value); orderItem._LGOBE = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["LGOBE"].Value); orderItem._LGORT = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["LGORT"].Value); orderItem._MAKTX = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["MAKTX"].Value); orderItem._MATNR = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["MATNR"].Value); orderItem._MEINS = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["MEINS"].Value); orderItem._MENGE = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["MENGE"].Value); orderItem._MENGE2 = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["MENGE2"].Value); orderItem._TOWER = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["TOWER"].Value); orderItem._TRAY = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["TRAY"].Value); orderItem._INBOX = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["LABST"].Value); LIST_ORDER.Add(orderItem); } ///////////////////////////////////////////////////////////// }