private void btnSearch_Click(object sender, EventArgs e)
 {
     SelectDate sd = new SelectDate();
     if (sd.ShowDialog() == DialogResult.Yes)
     {
         var DateStart = string.Empty;
         var DateEnd = string.Empty;
         if (chk8x8.Checked)
         {
             DateStart = sd.dtpStart.Value.ToString("yyyy-MM-dd 08:10:00");
             DateEnd = sd.dtpEnd.Value.AddDays(1).ToString("yyyy-MM-dd 08:10:00");
         }
         else
         {
             DateStart = sd.dtpStart.Value.ToString("yyyy-MM-dd 00:00:00");
             DateEnd = sd.dtpEnd.Value.ToString("yyyy-MM-dd 23:59:59");
         }
         dgvEwproject.DataSource = GetSQL.DrymcseRecordTime("FF", "補線機", DateStart, DateEnd);
         dgvEwproject.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
         dgvAOI.DataSource = GetSQL.AOIChkReportNO(DateStart, DateEnd);
         dgvAOI.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
         lblEwprojectCount.Text = "筆數:" + Convert.ToInt32(dgvEwproject.Rows.Count);
         lblAOICount.Text = "筆數:" + Convert.ToInt32(dgvAOI.Rows.Count);
     }
     else
     {
         sd.Dispose();
     }
 }
 private void btnSearch_Click(object sender, EventArgs e)
 {
     if (cboProcess.SelectedIndex < 0)
     {
         sysMessage.sysMsg("您尚未選擇要查詢的檢驗工序,請確認!", "訊息");
     }
     else
     {
         var process = cboProcess.Text;
         SelectDate sd = new SelectDate();
         if (sd.ShowDialog() == DialogResult.Yes)
         {
             var Start = string.Empty;
             var End = string.Empty;
             if (chk8x8.Checked)
             {
                 Start = sd.dtpStart.Value.ToString("yyyy-MM-dd 08:10:00");
                 End = Convert.ToDateTime(sd.dtpEnd.Value).AddDays(1).ToString("yyyy-MM-dd 08:10:00");
             }
             else
             {
                 Start = sd.dtpStart.Value.ToString("yyyy-MM-dd 00:00:00");
                 End = sd.dtpEnd.Value.ToString("yyyy-MM-dd 00:00:00");
             }
             #region T-SQL Select Columns and Filter Rule
             var select = new string[] {
                 "ID",
                 "PaperNum as '單號'",
                 "CONVERT(char(19),DateTime,120) as '申報時間'",
                 "PartNum as '料號'",
                 "Revision as '版序'",
                 "LotNum as '批號'",
                 "LayerId as '層別'",
                 "Process as '工序'",
                 "Qnty as '數量'",
                 "ChkQnty as '抽檢數'",
                 "NGQnty as '不良數'",
                 "Result as '判定'",
                 "Man as '人員'",
                 "Remark as '備註'" };
             var where = new string[] {
                 "DateTime between '" + Start + "' and '" + End + "'",
                 "Process='" +process+"'" };
             #endregion
             dgvMain.DataSource = GetSQL.SelectFormFilter("IPQCMain", select, where,"DateTime desc");
             dgvMain.Columns["ID"].Visible = false;
             dgvMain.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
         }
     }
 }
Esempio n. 3
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     SelectDate sd = new SelectDate();
     if (sd.ShowDialog() == DialogResult.Yes)
     {
         dgvMain.DataSource = GetSQL.Get乾膜AOI檢查日報紀錄(sd.dtpStart.Value.ToString("yyyy-MM-dd 00:00:00"),
             sd.dtpEnd.Value.ToString("yyyy-MM-dd 00:00:00"));
         dgvMain.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
         if (dgvMain.Rows.Count > 0)
         {
             dgvMain.Focus();
             dgvMain.CurrentCell = dgvMain[0, 0];
         }
     }
     else
     {
         sd.Dispose();
     }
 }