DataTable GenerateStatusIndex() { string status ; this.lblTitle.Text = "RCP Status Index"; if (Request["status"] == null) status = ""; else status = Request["status"].ToString().Trim(); DateTime start_times, stop_times; start_times = Convert.ToDateTime(Request["starttimes"]); stop_times = Convert.ToDateTime(Request["stoptimes"]); AmidaEntities db = new AmidaEntities(); var q = from n in db.tblEQHistory select n;/*join m in db.tblEQ on n.eq_id equals m.eqi_id select new { n.eq_id, n.start_time, n.stop_time, n.IsFinish, n.status, m.eq_area, m.eq_type, m.eq_tester }; */ if (status.Trim() != "") q = q.Where(n => n.status == status); // q = q.Where(n => n.start_time >= starttimes && n.stop_time <= stoptimes && n.IsFinish == true); q = q.Where(n => !(n.start_time < start_times && n.stop_time < start_times || n.start_time > stop_times && n.stop_time > stop_times) || n.start_time <= start_times && n.stop_time == null); var q1 = from n in q join m in db.tblEQ on n.eq_id equals m.eqi_id select new RptSchema.rptStatusDetail() { Status = n.status, Area = m.eq_area, eqid = n.eq_id, EQ_Tester = m.eq_tester, EQ_Type = m.eq_prober, starttimes = (n.start_time < start_times) ? start_times : n.start_time, stoptimes = (n.stop_time == null || n.stop_time > stop_times) ? stop_times : n.stop_time }; var q2 = from n in q1.ToList() group n by new { n.eqid, n.Status, n.EQ_Tester, n.EQ_Type, n.Area } into g select new RptSchema.rptRCPStatusIndex() { EqID = g.Key.eqid, Area = g.Key.Area, Status = g.Key.Status, EQ_Type = g.Key.EQ_Type, TesterType = g.Key.EQ_Tester, TotalTime = g.Sum(p => p.TotalHours) }; DataSet.rptRCPStatusIndexDataTable table = new DataSet.rptRCPStatusIndexDataTable(); foreach (RptSchema.rptRCPStatusIndex n in q2) { DataSet.rptRCPStatusIndexRow row = table.NewrptRCPStatusIndexRow(); row.Area = n.Area; row.Status = n.Status; row.TotalTime = n.TotalTime; row.EQID = n.EqID; row.EQType = n.EQ_Type; row.TesterType = n.TesterType; table.AddrptRCPStatusIndexRow(row); } return table; }
protected void Page_Load(object sender, EventArgs e) { //System.Configuration.Configuration rootWebConfig = // System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/slAmidaConsole.Web"); // Label1.Text= System.Web.Configuration.WebConfigurationManager.ConnectionStrings["AmidaConnectionString"].ConnectionString; if (Request["PCID"] == null || Request["PCID"]=="" ) { //Response.Write("ProbecardWorkSheet?PCID=ProcardID to query"); //Response.End(); //Response.End(); this.dvTable.InnerText = ""; return; } string PCID=Request["PCID"].ToString().Trim(); this.Label1.Text = ConvertPCID(PCID); slAmidaConsole.Web.AmidaEntities db = new AmidaEntities(); var q = (from n in db.tblEQHistory where n.probe_card_id == PCID && (n.status=="Verify" || n.status=="Product") select new ProcardWorkLog() { Lot_ID = n.lot_id, Num_Tested_Wafer = n.tested_num_wafer, Wafer_ID_OUT=n.wafer_id_out, Wafer_ID_IN=n.wafer_id_in, OD_OUT = n.over_drive_out, OD_IN = n.over_drive_in, Operator = n.@operator, RCP = n.eq_id, TimeStamp = n.start_time, TPS="", NeedleBody =null, NeedleLength=null, NeedleStatus="", status=n.status, Comment="", recipe=n.recipe, Is_pc_rec_tbl = false }).Union( from n1 in db.PC_Rec_tbl where n1.PC_ID == PCID select new ProcardWorkLog() { Lot_ID = "", Num_Tested_Wafer = 0, Wafer_ID_OUT = "", Wafer_ID_IN = "", OD_OUT =null, OD_IN = null, Operator =n1.Modifier, RCP = "", TimeStamp = n1.PC_rec_time, TPS="", NeedleBody=n1.Current_length_of_needle_body, NeedleLength = n1.Currentmax_tip_size, NeedleStatus= n1.PC_status, status="", Comment=n1.PC_comment, recipe="", Is_pc_rec_tbl=true }).OrderBy(k=>k.TimeStamp); string html="<table id=\"tblProbecardWorkSheet\"><thead><tr>"; html += " <th>TimeStamp</th><th>Lot_ID</th><th>Wafer_ID_In</th><th>Wafer_ID_Out</th><th>T/V</th><th>PCS</th><th>RCP</th><th>recipe</th><th>OD_In</th><th>OD_Out</th><th>Operator</th><th>針身</th><th>針點</th><th>卡況</th><th >備註</th>"; html += "</th></thead>"; // Response.Write("<table id=\"tblProbecardWorkSheet\"</table>"); // Response.Flush(); html += "<tbody>"; int tested_wafer_acc_num = 0; foreach (ProcardWorkLog log in q) { if(log.T_V=="T") tested_wafer_acc_num += (int)(log.Num_Tested_Wafer==null?0:log.Num_Tested_Wafer); if (log.NeedleStatus != null && log.NeedleStatus.StartsWith("PE")) html += "<tr style=\"color:red\">"; else html += "<tr>"; html +="<td>"+ ((log.TimeStamp == null) ? "" : ((DateTime)log.TimeStamp).ToString("yyyy-MM-dd HH:mm:ss"))+"</td>"; html+="<td>"+(log.Lot_ID==null?"":log.Lot_ID.ToString())+"</td>" ; html+="<td>"+( log.Wafer_ID_IN == null ? "" : log.Wafer_ID_IN.ToString() )+"</td>"; html += "<td>" + (log.Wafer_ID_OUT == null ? "" : log.Wafer_ID_OUT.ToString()) + "</td>"; // html += "<td>" + (log.status == null ? "" : log.status.ToString()) + "</td>"; html += "<td>" + log.T_V + "</td>"; html += "<td>" + tested_wafer_acc_num + "</td>"; // (log.Num_Tested_Wafer == null ? "" : log.Num_Tested_Wafer.ToString()) + "</td>"; html+= "<td>"+(log.RCP == null ? "" : log.RCP.ToString() )+"</td>"; html += "<td>" + (log.recipe == null ? "" : log.recipe.ToString()) + "</td>"; html+= "<td>"+( log.OD_IN == null ? "" : log.OD_IN.ToString() )+"</td>"; html += "<td>" + (log.OD_OUT == null ? "" : log.OD_OUT.ToString()) + "</td>"; html+= "<td>"+( log.Operator == null ? "" : log.Operator.ToString() )+"</td>"; html += "<td>" + (log.NeedleBody == null ? "" : string.Format("{0:0.00}", log.NeedleBody)) + "</td>"; html+= "<td>"+( log.NeedleLength == null ? "" : string.Format("{0:0.00}",log.NeedleLength ))+"</td>"; html += "<td>" + (log.NeedleStatus == null ? "" : log.NeedleStatus.ToString()) + "</td>"; html += "<td>" + (log.Comment == null ? "" : log.Comment.ToString()) + "</td>"; html += "</tr>"; // , // new TableCell(){Text=}, // new TableCell(){Text=}, // new TableCell(){Text=}, // new TableCell(){Text=}, // new TableCell(){Text=}, // new TableCell(){Text=} //}); // this.tblProcardWorkSheet.Rows.Add(row); } html += "</tbody>"; html += "</table>"; this.dvTable.InnerHtml = html; }