Exemplo n.º 1
0
        public void FillCustomdatagrid(int VornIndex)
        {
            QM_AllData.temp   = VornIndex;
            datagridRowNumber = 0;

            WebRfr_QM_Process.Yfw0Return[] WS_QM_Return = new UlkerTouchScreen.WebRfr_QM_Process.Yfw0Return[0];
            //txb leri doldur
            try
            {
                WS_QM_GetDetail.Url = Utility.GetWSUrl("Y_FW0_QM_PROSES");
                Cursor.Current      = Cursors.WaitCursor;
                //ERDEM
                //String DesiredTime = txbSaat.Text + ":" + txbDakika.Text + ":" + CurrentSecond;

                string DesiredTime = "";
                string date        = "";
                try
                {
                    DesiredTime = dt_usert1.Value.ToString().Substring(11, 5) + ":00";
                    //ERDEM
                    date = dateTimePicker1.Value.ToString("yyyy-MM-dd");
                }
                catch (Exception ex)
                {
                }

                if (QM_AllData.E_Kontrol_Noktasi != "")
                {
                    WS_QM_GetDetail.YFw0QmProsesGetDetail(ref QM_AllData.WS_QM_HeaderDOLU, ref WS_QM_Return,
                                                          QM_AllData.CHKZorunlu, QM_AllData.TKontrolNoktasi[QM_AllData.kontrolNoktasiSecilenIndex].Insppoint,
                                                          QM_AllData.SecilenKontrolNo, QM_AllData.CHKOnceki, DesiredTime, QM_AllData.CHKSonraki, date,
                                                          QM_AllData.QM_IslemListesiDOLU[VornIndex].Vorglfnr, Login.AllD.wspassword,
                                                          Login.AllD.wssession, ref QM_AllData.QM_KarakteristikDOLU, Login.AllD.wsusercode,
                                                          Login.AllD.wsuserno);
                }
                else
                {
                    HataAlincaDur = false;
                    WS_QM_GetDetail.YFw0QmProsesGetDetail(ref QM_AllData.WS_QM_HeaderDOLU, ref WS_QM_Return,
                                                          QM_AllData.CHKZorunlu, "", QM_AllData.SecilenKontrolNo, QM_AllData.CHKOnceki, DesiredTime,
                                                          QM_AllData.CHKSonraki, date, QM_AllData.QM_IslemListesiDOLU[VornIndex].Vorglfnr, Login.AllD.wspassword,
                                                          Login.AllD.wssession, ref QM_AllData.QM_KarakteristikDOLU, Login.AllD.wsusercode,
                                                          Login.AllD.wsuserno);
                }
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;
                HataAlincaDur  = true;
                MessageBox.Show("Hata RFC:YFw0QmProsesGetDetail " + ex.Message);
                return;
            }
            //if (QM_AllData.QM_KarakteristikDOLU.Length == 0)
            //{
            //    //MessageBox.Show("Bu Tarih/Saate Sonuç Girişi Yapılamaz.", "Hata");
            //    return;
            //}
            try
            {
                Cursor.Current = Cursors.Default;
                if (WS_QM_Return[0].RcCheck == "E")
                {
                    if (HataGoster)
                    {
                        MessageBox.Show(WS_QM_Return[0].RcText, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        HataGoster = false;
                        //datagridview icin
                        //dateTimePicker1.Value = DateTime.Parse(dataGridView1[4, 0].Value.ToString());
                        dateTimePicker1.Value = DateTime.Parse(QM_AllData.SAPDate);
                    }
                }
                else
                {
                    String ICON  = "";
                    int    index = 0;
                    if (dataGridView1.Rows.Count > 0)
                    {
                        if (QM_AllData.QM_KarakteristikDOLU.Length == 0)
                        {
                            //dateTimePicker1.Value = DateTime.Parse(eskitarih.ToString("dd-MM-yyyy"));
                            //dt_usert1.Value = DateTime.Parse(eskisaat);
                            //MessageBox.Show("Bu Tarih/Saate Sonuç Girişi Yapılamaz.", "Hata");
                            label9.Visible = true;
                            //return;
                        }
                        else
                        {
                            label9.Visible = false;
                        }
                    }

                    for (int i = dataGridView1.Rows.Count - 1; i != -1; i--)
                    {
                        dataGridView1.Rows.RemoveAt(i);
                    }
                    imagelist = new string[QM_AllData.QM_KarakteristikDOLU.Length];
                    foreach (WebRfr_QM_Process.ZqmTesisproses002 rows in QM_AllData.QM_KarakteristikDOLU)
                    {
                        dataGridView1.Rows.Add();
                        ICON = QM_AllData.QM_KarakteristikDOLU[index].Stat;
                        if (ICON == "1")
                        {
                            imagelist[index] = "x";
                            try
                            {
                                dataGridView1[0, index].Value = Image.FromFile("red.jpg");
                                goto resimEkleyemezseDevamEt;
                            }
                            catch (Exception)
                            {
                                goto resimEkleyemezseDevamEt;
                            }
                        }
                        else if (ICON == "2")
                        {
                            imagelist[index] = "!";
                            try
                            {
                                dataGridView1[0, index].Value = Image.FromFile("unlem.jpg");
                                goto resimEkleyemezseDevamEt;
                            }
                            catch (Exception)
                            {
                                goto resimEkleyemezseDevamEt;
                            }
                        }
                        else
                        {
                            imagelist[index] = "o";
                            try
                            {
                                dataGridView1[0, index].Value = Image.FromFile("onay.jpg");
                                goto resimEkleyemezseDevamEt;
                            }
                            catch (Exception)
                            {
                                goto resimEkleyemezseDevamEt;
                            }
                        }

resimEkleyemezseDevamEt:                                          //yukarıdaki resim alanlarını ekleyemediği zaman patlıyordu daha sonra detaylı bakacağım. -mcy 19.04.2017
                        if (QM_AllData.UretimYeriWerks == "0271") //3.5.2017 -mcy
                        {
                            //DateTime PartiSaati = Convert.ToDateTime(QM_AllData.SecilenPartiSaati);
                            //if ((PartiSaati.Hour >= 0) && (PartiSaati.Hour < 8))
                            if ((DateTime.Now.Hour >= 0) && (DateTime.Now.Hour < 8))
                            {
                                DateTime d    = Convert.ToDateTime(QM_AllData.QM_KarakteristikDOLU[index].Pastrterm);
                                string   yil  = d.ToString().Substring(6, 4);
                                string   ay   = d.ToString().Substring(3, 2);
                                string   gun  = d.AddDays(-1).ToString().Substring(0, 2);
                                string   date = gun + "-" + ay + "-" + yil;
                                dataGridView1[1, index].Value = QM_AllData.QM_KarakteristikDOLU[index].Kurxtext;
                                dataGridView1[2, index].Value = QM_AllData.QM_KarakteristikDOLU[index].Time.ToString().Substring(0, 5);
                                dataGridView1[3, index].Value = QM_AllData.QM_KarakteristikDOLU[index].Deger.ToString().Trim();
                                dataGridView1[4, index].Value = date;
                            }
                            else
                            {
                                string year  = QM_AllData.QM_KarakteristikDOLU[index].Pastrterm.Substring(0, 4);
                                string month = QM_AllData.QM_KarakteristikDOLU[index].Pastrterm.Substring(5, 2);
                                string day   = QM_AllData.QM_KarakteristikDOLU[index].Pastrterm.Substring(8, 2);
                                string date  = day + "-" + month + "-" + year;
                                dataGridView1[1, index].Value = QM_AllData.QM_KarakteristikDOLU[index].Kurxtext;
                                dataGridView1[2, index].Value = QM_AllData.QM_KarakteristikDOLU[index].Time.ToString().Substring(0, 5);
                                dataGridView1[3, index].Value = QM_AllData.QM_KarakteristikDOLU[index].Deger.ToString().Trim();
                                dataGridView1[4, index].Value = date;
                            }
                        }
                        else
                        {
                            string year  = QM_AllData.QM_KarakteristikDOLU[index].Pastrterm.Substring(0, 4);
                            string month = QM_AllData.QM_KarakteristikDOLU[index].Pastrterm.Substring(5, 2);
                            string day   = QM_AllData.QM_KarakteristikDOLU[index].Pastrterm.Substring(8, 2);
                            string date  = day + "-" + month + "-" + year;
                            dataGridView1[1, index].Value = QM_AllData.QM_KarakteristikDOLU[index].Kurxtext;
                            dataGridView1[2, index].Value = QM_AllData.QM_KarakteristikDOLU[index].Time.ToString().Substring(0, 5);
                            dataGridView1[3, index].Value = QM_AllData.QM_KarakteristikDOLU[index].Deger.ToString().Trim();
                            dataGridView1[4, index].Value = date;
                        }

                        if (QM_AllData.QM_KarakteristikDOLU[index].Nortip == "X")
                        {
                            DataGridViewCellStyle renk = new DataGridViewCellStyle();
                            renk.BackColor = Color.Red;
                            dataGridView1.Rows[index].DefaultCellStyle = renk;
                        }

                        datagridRowNumber++;
                        index++;
                    }
                    ;
                    Cursor.Current = Cursors.Default;
                    if (dataGridView1.Rows.Count == 0)
                    {
                        btnDevam.Enabled = false;
                    }
                    else
                    {
                        btnDevam.Enabled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "HATA!", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                MessageBoxDefaultButton.Button1);
                return;
            }
        }
Exemplo n.º 2
0
        public void Filldatagrid(int VornIndex)
        {
            ////////////
            //////////
            datagridRowNumber = 0;
            QM_AllData.temp   = VornIndex;
            //ERDEM
            String DesiredTime = dt_usert1.Value.ToString().Substring(11, 5) + ":00";

            //ERDEM
            QM_AllData.DesiredTime = DesiredTime;
            WebRfr_QM_Process.Yfw0Return[] WS_QM_Return = new UlkerTouchScreen.WebRfr_QM_Process.Yfw0Return[0];
            string date = dateTimePicker1.Value.ToString("yyyy-MM-dd");

            //txb leri doldur
            if (QM_AllData.TKontrolNoktasi.Length == 0) //kontrol partisinin kontrol noktasi yoksa
            {
                WebRfr_QM_Process.ZqmTesisproses021 nullKontrolNoktasi = new WebRfr_QM_Process.ZqmTesisproses021();
                QM_AllData.TKontrolNoktasi    = new WebRfr_QM_Process.ZqmTesisproses021[1];
                QM_AllData.TKontrolNoktasi[0] = nullKontrolNoktasi;
            }
            try
            {
                string SAAT = DateTime.Now.ToString("HH:mm:ss");
                Cursor.Current = Cursors.WaitCursor;
                if (QM_AllData.E_Kontrol_Noktasi != "")
                {
                    WS_QM_GetDetail.YFw0QmProsesGetDetail(ref QM_AllData.WS_QM_HeaderDOLU, ref WS_QM_Return,
                                                          QM_AllData.CHKZorunlu, QM_AllData.TKontrolNoktasi[QM_AllData.kontrolNoktasiSecilenIndex].Insppoint,
                                                          QM_AllData.SecilenKontrolNo, QM_AllData.CHKOnceki, DesiredTime, QM_AllData.CHKSonraki, date,
                                                          QM_AllData.QM_IslemListesiDOLU[VornIndex].Vorglfnr, Login.AllD.wspassword,
                                                          Login.AllD.wssession, ref QM_AllData.QM_KarakteristikDOLU, Login.AllD.wsusercode,
                                                          Login.AllD.wsuserno);
                }
                else
                {
                    WS_QM_GetDetail.YFw0QmProsesGetDetail(ref QM_AllData.WS_QM_HeaderDOLU, ref WS_QM_Return,
                                                          QM_AllData.CHKZorunlu, "", QM_AllData.SecilenKontrolNo, QM_AllData.CHKOnceki, DesiredTime, QM_AllData.CHKSonraki, date,
                                                          QM_AllData.QM_IslemListesiDOLU[VornIndex].Vorglfnr, Login.AllD.wspassword,
                                                          Login.AllD.wssession, ref QM_AllData.QM_KarakteristikDOLU, Login.AllD.wsusercode,
                                                          Login.AllD.wsuserno);
                }
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show(ex.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
                return;
            }
            if (WS_QM_Return[0].RcCheck == "E")
            {
                if (HataGoster)
                {
                    MessageBox.Show(WS_QM_Return[0].RcText, "Hata", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    HataGoster = false;
                    //dateTimePicker1.Value = DateTime.Parse(dataGridView1[4, 0].Value.ToString());
                    dateTimePicker1.Value = DateTime.Parse(QM_AllData.SAPDate);
                }
            }
            else
            {
                //datagrid i Dolduruyo
                for (int i = dataGridView1.Rows.Count - 1; i != -1; i--)
                {
                    dataGridView1.Rows.RemoveAt(i);
                }


                int index = 0;
                imagelist = new string[QM_AllData.QM_KarakteristikDOLU.Length];
                foreach (WebRfr_QM_Process.ZqmTesisproses002 rows in QM_AllData.QM_KarakteristikDOLU)
                {
                    dataGridView1.Rows.Add();
                    String ICON = QM_AllData.QM_KarakteristikDOLU[index].Stat;
                    if (ICON == "1")
                    {
                        imagelist[index] = "x";
                        try
                        {
                            dataGridView1[0, index].Value = Image.FromFile("red.jpg");
                            goto resimEklerkenCatlamadanDevamEt;
                        }
                        catch (Exception)
                        {
                            goto resimEklerkenCatlamadanDevamEt;
                        }
                    }
                    else if (ICON == "2")
                    {
                        imagelist[index] = "!";
                        try
                        {
                            dataGridView1[0, index].Value = Image.FromFile("unlem.jpg");
                            goto resimEklerkenCatlamadanDevamEt;
                        }
                        catch (Exception)
                        {
                            goto resimEklerkenCatlamadanDevamEt;
                        }
                    }
                    else
                    {
                        imagelist[index] = "o";
                        try
                        {
                            dataGridView1[0, index].Value = Image.FromFile("onay.jpg");
                            goto resimEklerkenCatlamadanDevamEt;
                        }
                        catch (Exception)
                        {
                            goto resimEklerkenCatlamadanDevamEt;
                        }
                    }

resimEklerkenCatlamadanDevamEt:
                    string year = QM_AllData.QM_KarakteristikDOLU[index].Pastrterm.Substring(0, 4);
                    string month         = QM_AllData.QM_KarakteristikDOLU[index].Pastrterm.Substring(5, 2);
                    string day           = QM_AllData.QM_KarakteristikDOLU[index].Pastrterm.Substring(8, 2);
                    string formatteddate = day + "-" + month + "-" + year;

                    dataGridView1[1, index].Value = QM_AllData.QM_KarakteristikDOLU[index].Kurxtext;
                    dataGridView1[2, index].Value = QM_AllData.QM_KarakteristikDOLU[index].Time.ToString().Substring(0, 5);
                    dataGridView1[3, index].Value = QM_AllData.QM_KarakteristikDOLU[index].Deger.ToString().Trim();
                    dataGridView1[4, index].Value = formatteddate;

                    if (QM_AllData.QM_KarakteristikDOLU[index].Nortip == "X")
                    {
                        DataGridViewCellStyle renk = new DataGridViewCellStyle();
                        renk.BackColor = Color.Red;
                        dataGridView1.Rows[index].DefaultCellStyle = renk;
                    }

                    datagridRowNumber++;
                    index++;
                }
                ;

                Cursor.Current = Cursors.Default;
                if (dataGridView1.Rows.Count == 0)
                {
                    btnDevam.Enabled = false;
                }
                else
                {
                    btnDevam.Enabled = true;
                }
            }
        }