protected void Edit_Grid() { int j; ComLibrary com = new ComLibrary(); DataTable dt = (DataTable)ViewState["gdvDetail"]; if (dt.Columns["SELECT"] == null) { dt.Columns.Add("SELECT"); } gdvDetail.DataSource = dt; gdvDetail.DataBind(); for (int i = 0; i < gdvDetail.Rows.Count; i++) { j = gdvDetail.Rows[i].DataItemIndex; if (dt.Rows[j]["SELECT"].ToString() != "") { ((CheckBox)gdvDetail.Rows[i].FindControl("chkSEL")).Checked = com.IntToBool(com.StringToInt(dt.Rows[j]["SELECT"].ToString())); } } }
protected void cmdPrint_Click(object sender, EventArgs e) { // // 製造指示表リスト発行 // ComLibrary com = new ComLibrary(); Message msg = new Message(g_user_id, g_lang); MfgBom mbom = new MfgBom(g_user_id, g_lang); DataTable dt = (DataTable)(ViewState["gdvDetail"]); if (dt == null) { return; } bool print_flag = false; //int seqno = 0; //Print Data DataTable prtDt = new DataTable(); //SubReport Data //DataTable prtDtTotal = new DataTable(); // 対象の行を探す for (int i = 0; i < dt.Rows.Count; i++) { if (com.IntToBool(com.StringToInt(dt.Rows[i]["SELECT"].ToString()))) { //印刷マーク print_flag = true; //seqno++; // Testing prtDt.Columns.Add(new DataColumn("FE_CRANK_ONLINE_NO")); prtDt.Columns.Add(new DataColumn("PRODUCTION_DATE")); prtDt.Columns.Add(new DataColumn("SHIFT")); prtDt.Columns.Add(new DataColumn("MODEL")); prtDt.Columns.Add(new DataColumn("LOTNO_ZOZAI")); prtDt.Columns.Add(new DataColumn("DIE_NO")); prtDt.Columns.Add(new DataColumn("ONLINE_DATE")); prtDt.Columns.Add(new DataColumn("ONLINE_STAMPING")); prtDt.Columns.Add(new DataColumn("REMARK")); DataRow dr = prtDt.NewRow(); dr["FE_CRANK_ONLINE_NO"] = "CRON-20180101-0001"; dr["PRODUCTION_DATE"] = "2018-04-23 00:00:00.000"; dr["SHIFT"] = "X"; dr["MODEL"] = "55A"; dr["LOTNO_ZOZAI"] = "P50203N7"; dr["DIE_NO"] = "99"; dr["ONLINE_DATE"] = "100"; dr["ONLINE_STAMPING"] = "H-0746"; dr["REMARK"] = ""; prtDt.Rows.Add(dr); // Actual Codes // データ検索 //WIPJo jo = new WIPJo(g_user_id, g_lang); //jo.job_order_no = dt.Rows[i]["Online_No"].ToString(); //jo.item_no = dt.Rows[i]["Part_No"].ToString(); //DataSet ds = jo.Get_OnRptDetail(); //if (ds == null) //{ // lblMsg.Text = jo.strErr; // lblMsg.ForeColor = Color.Red; // return; //} //prtDt = ds.Tables[0]; } } if (print_flag == false) { lblMsg.Text = msg.GetMessage("PRINT_DATA_NOT_EXIST_ERR"); lblMsg.ForeColor = Color.Red; return; } ReportClass Rpt = null; Rpt = new HondaTraceabilitySystem.Common.Report.FeOnline(); string ReportName = "MfgJOList"; try { //Rpt.Subreports["SubReport"].SetDataSource(prtDtTotal); Rpt.SetDataSource(prtDt); Rpt.SetParameterValue("H_TITLE", "INSPECTION SHEET(SEMICONDUCTOR"); PdfRtfWordFormatOptions pdfFormatOpts = new PdfRtfWordFormatOptions(); DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions(); // exportOpts; ExportOptions exportOpts = Rpt.ExportOptions; exportOpts.ExportDestinationType = ExportDestinationType.DiskFile; exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat; exportOpts.FormatOptions = pdfFormatOpts; string tmpFilenm = ReportName + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf"; diskOpts.DiskFileName = Server.MapPath(WebConfigurationManager.ConnectionStrings["ReportOutDir"].ConnectionString + tmpFilenm); exportOpts.DestinationOptions = diskOpts; //print Rpt.Export(); Type cstype = this.GetType(); this.Page.ClientScript.RegisterClientScriptBlock(cstype, "a", @"<script>window.open('" + WebConfigurationManager.ConnectionStrings["ReportOutDir"].ConnectionString + tmpFilenm + "', '" + ReportName + "', 'status,resizable=yes');</script>"); } catch (Exception ex) { string strErr = ex.ToString(); lblMsg.Text = ex.ToString(); return; } lblMsg.Text = msg.GetMessage("NORMAL_PRINT"); lblMsg.ForeColor = Color.Blue; }
protected void cmdPrint_Click(object sender, EventArgs e) { // // 製造指示表リスト発行 // ComLibrary com = new ComLibrary(); Message msg = new Message(g_user_id, g_lang); //MfgBom mbom = new MfgBom(g_user_id, g_lang); String h_period_from = "PERIOD FROM : "; String h_period_to = " TO : "; DataTable dt = (DataTable)(ViewState["gdvDetail"]); if (dt == null) { return; } bool print_flag = false; int seqno = 0; //Print Data DataTable prtDt = new DataTable(); //SubReport Data //DataTable prtDtTotal = new DataTable(); prtDt.Columns.Add(new DataColumn("FE_CRANK_OFFLINE")); prtDt.Columns.Add(new DataColumn("PRODUCT_DATE")); prtDt.Columns.Add(new DataColumn("MODEL")); prtDt.Columns.Add(new DataColumn("PROD_LOTNO")); prtDt.Columns.Add(new DataColumn("ONLINE_LOTNO")); prtDt.Columns.Add(new DataColumn("P1")); prtDt.Columns.Add(new DataColumn("P2")); prtDt.Columns.Add(new DataColumn("P3")); prtDt.Columns.Add(new DataColumn("P4")); prtDt.Columns.Add(new DataColumn("P5")); prtDt.Columns.Add(new DataColumn("P6")); prtDt.Columns.Add(new DataColumn("P7")); prtDt.Columns.Add(new DataColumn("P8")); prtDt.Columns.Add(new DataColumn("P9")); // 対象の行を探す for (int i = 0; i < dt.Rows.Count; i++) { if (com.IntToBool(com.StringToInt(dt.Rows[i]["SELECT"].ToString()))) { //印刷マーク print_flag = true; if (seqno == 0) { h_period_from = "PERIOD FROM : " + dt.Rows[i]["PRODUCT_DATE"].ToString(); } seqno++; DataRow dr = prtDt.NewRow(); dr["FE_CRANK_OFFLINE"] = dt.Rows[i]["OFFLINE_NO"].ToString(); dr["PRODUCT_DATE"] = dt.Rows[i]["PRODUCT_DATE"]; dr["MODEL"] = dt.Rows[i]["MODEL"].ToString(); dr["PROD_LOTNO"] = dt.Rows[i]["LOTNO"].ToString(); dr["ONLINE_LOTNO"] = dt.Rows[i]["ONLINE_LOTNO"].ToString(); dr["P1"] = dt.Rows[i]["RESULT1"]; dr["P2"] = dt.Rows[i]["RESULT2"]; dr["P3"] = dt.Rows[i]["RESULT3"]; dr["P4"] = dt.Rows[i]["RESULT4"]; dr["P5"] = dt.Rows[i]["RESULT5"]; dr["P6"] = dt.Rows[i]["RESULT_4P"]; dr["P7"] = dt.Rows[i]["RESULT_3P"]; dr["P8"] = dt.Rows[i]["RESULT_2P"]; dr["P9"] = dt.Rows[i]["RESULT_1P"]; prtDt.Rows.Add(dr); h_period_to = " TO : " + dt.Rows[i]["PRODUCT_DATE"].ToString(); } } if (print_flag == false) { lblMsg.Text = msg.GetMessage("PRINT_DATA_NOT_EXIST_ERR"); lblMsg.ForeColor = Color.Red; return; } ReportClass Rpt = null; Rpt = new HondaTraceabilitySystem.Common.Report.FeOffline(); string ReportName = "FeOffProd"; try { //Rpt.Subreports["SubReport"].SetDataSource(prtDtTotal); Rpt.SetDataSource(prtDt); Rpt.SetParameterValue("H_TITLE", "HATC-M P-EGD Production Sheet Control"); Rpt.SetParameterValue("H_DATA_TYPE", "DATA TYPE : OFF LINE"); Rpt.SetParameterValue("H_TYPE", "TYPE :"); Rpt.SetParameterValue("H_DEPT", "DEPT. : FE-P"); if (ddlPROCESS.SelectedValue == "Crank Shaft") { Rpt.SetParameterValue("H_PART_NAME", "PART NAME : CRANK F/G"); Rpt.SetParameterValue("H_LINE", "LINE : CRANK LINE"); Rpt.SetParameterValue("H_PLC", "BEARING CODE"); } else { Rpt.SetParameterValue("H_PART_NAME", "PART NAME : CONNROD F/G"); Rpt.SetParameterValue("H_LINE", "LINE : CONNROD LINE"); Rpt.SetParameterValue("H_PLC", "DIE WEIGHT"); } Rpt.SetParameterValue("H_PERIOD_FROM", h_period_from); Rpt.SetParameterValue("H_PERIOD_TO", h_period_to); PdfRtfWordFormatOptions pdfFormatOpts = new PdfRtfWordFormatOptions(); DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions(); // exportOpts; ExportOptions exportOpts = Rpt.ExportOptions; exportOpts.ExportDestinationType = ExportDestinationType.DiskFile; exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat; exportOpts.FormatOptions = pdfFormatOpts; string tmpFilenm = ReportName + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf"; diskOpts.DiskFileName = Server.MapPath(WebConfigurationManager.ConnectionStrings["ReportOutDir"].ConnectionString + tmpFilenm); exportOpts.DestinationOptions = diskOpts; //print Rpt.Export(); Type cstype = this.GetType(); this.Page.ClientScript.RegisterClientScriptBlock(cstype, "a", @"<script>window.open('" + WebConfigurationManager.ConnectionStrings["ReportOutDir"].ConnectionString + tmpFilenm + "', '" + ReportName + "', 'status,resizable=yes');</script>"); } catch (Exception ex) { string strErr = ex.ToString(); lblMsg.Text = ex.ToString(); return; } lblMsg.Text = msg.GetMessage("NORMAL_PRINT"); lblMsg.ForeColor = Color.Blue; }
// // 初期画面編集 // protected void Init_Proc() { //Auth_Proc();//ADD BY UBIQ-LIU 2010/8/4 //dt用于扩充gridview行列 DataTable dt = new DataTable(); Message msg = new Message(g_user_id, g_lang); for (int i = 0; i < 16; i++) { if (dt.Columns.Count == 0) { dt.Columns.Add("co1"); dt.Columns.Add("co2"); dt.Columns.Add("co3"); dt.Columns.Add("co4"); dt.Columns.Add("co5"); } if (dt.Rows.Count < 16) { dt.Rows.Add(); } } dgvCalendarF.DataSource = dt; dgvCalendarF.DataBind(); dgvCalendarA.DataSource = dt; dgvCalendarA.DataBind(); ComLibrary com = new ComLibrary(); // Calendarマスタを検索 IMClass.Calendar cal = new IMClass.Calendar(g_user_id, g_lang); cal.calendar_id = "00"; cal.calendar_cym = Convert.ToInt32(ddlYear.Text + ddlMonth.Text); DataSet ds = cal.GetCalendarMonthlyDetail(); if (ds == null) { lblMsg.Text = cal.strErr; lblMsg.ForeColor = Color.Red; return; } if (ds.Tables[0].Rows.Count != 0) { //前半月 for (int i = 0; i < dgvCalendarF.Rows.Count; i++) { dgvCalendarF.Rows[i].Cells[0].Text = ds.Tables[0].Rows[i]["Calendar_date"].ToString().Substring(6, 2); switch (ds.Tables[0].Rows[i]["Day_of_week"].ToString()) { case "1": dgvCalendarF.Rows[i].Cells[1].Text = ViewState["weekday1"].ToString(); break; case "2": dgvCalendarF.Rows[i].Cells[1].Text = ViewState["weekday2"].ToString(); break; case "3": dgvCalendarF.Rows[i].Cells[1].Text = ViewState["weekday3"].ToString(); break; case "4": dgvCalendarF.Rows[i].Cells[1].Text = ViewState["weekday4"].ToString(); break; case "5": dgvCalendarF.Rows[i].Cells[1].Text = ViewState["weekday5"].ToString(); break; case "6": dgvCalendarF.Rows[i].Cells[1].Text = ViewState["weekday6"].ToString(); break; case "7": dgvCalendarF.Rows[i].Cells[1].Text = ViewState["weekday7"].ToString(); break; } ((CheckBox)dgvCalendarF.Rows[i].FindControl("ckbh1")).Checked = com.IntToBool(com.StringToInt(ds.Tables[0].Rows[i]["HOLIDAY_FLAG"].ToString())); //((CheckBox)dgvCalendarF.Rows[i].FindControl("ckbp1")).Checked = com.IntToBool(com.StringToInt(ds.Tables[0].Rows[i]["PO_RLS_FLAG"].ToString())); ((CheckBox)dgvCalendarF.Rows[i].FindControl("ckbp1")).Checked = com.IntToBool(com.StringToInt(ds.Tables[0].Rows[i]["PROCESS_FLAG"].ToString())); //if (com.StringToDouble(ds.Tables[0].Rows[i]["STD_WORKING_HOUR"].ToString()) != 0) //{ // ((TextBox)dgvCalendarF.Rows[i].FindControl("txtWHour1")).Text = ds.Tables[0].Rows[i]["STD_WORKING_HOUR"].ToString(); //} if (com.StringToDouble(ds.Tables[0].Rows[i]["STD_WORKING"].ToString()) != 0) { ((TextBox)dgvCalendarF.Rows[i].FindControl("txtWHour1")).Text = ds.Tables[0].Rows[i]["STD_WORKING"].ToString(); } //else //{ // ((TextBox)dgvCalendarF.Rows[i].FindControl("txtWHour1")).Text = ""; //} } dgvCalendarF.Rows[15].Visible = false; //后半月 for (int i = 0; i < dgvCalendarA.Rows.Count; i++) { if (i < DateTime.DaysInMonth(Convert.ToInt16(ddlYear.Text), Convert.ToInt16(ddlMonth.Text)) - 15) { dgvCalendarA.Rows[i].Cells[0].Text = ds.Tables[0].Rows[i + 15]["Calendar_date"].ToString().Substring(6, 2); switch (ds.Tables[0].Rows[i + 15]["Day_of_week"].ToString()) { case "1": dgvCalendarA.Rows[i].Cells[1].Text = ViewState["weekday1"].ToString(); break; case "2": dgvCalendarA.Rows[i].Cells[1].Text = ViewState["weekday2"].ToString(); break; case "3": dgvCalendarA.Rows[i].Cells[1].Text = ViewState["weekday3"].ToString(); break; case "4": dgvCalendarA.Rows[i].Cells[1].Text = ViewState["weekday4"].ToString(); break; case "5": dgvCalendarA.Rows[i].Cells[1].Text = ViewState["weekday5"].ToString(); break; case "6": dgvCalendarA.Rows[i].Cells[1].Text = ViewState["weekday6"].ToString(); break; case "7": dgvCalendarA.Rows[i].Cells[1].Text = ViewState["weekday7"].ToString(); break; } ((CheckBox)dgvCalendarA.Rows[i].FindControl("ckbh2")).Checked = com.IntToBool(com.StringToInt(ds.Tables[0].Rows[i + 15]["HOLIDAY_FLAG"].ToString())); //((CheckBox)dgvCalendarA.Rows[i].FindControl("ckbp2")).Checked = com.IntToBool(com.StringToInt(ds.Tables[0].Rows[i + 15]["PO_RLS_FLAG"].ToString())); ((CheckBox)dgvCalendarA.Rows[i].FindControl("ckbp2")).Checked = com.IntToBool(com.StringToInt(ds.Tables[0].Rows[i + 15]["PROCESS_FLAG"].ToString())); //if (com.StringToDouble(ds.Tables[0].Rows[i + 15]["STD_WORKING_HOUR"].ToString()) != 0) //{ // ((TextBox)dgvCalendarA.Rows[i].FindControl("txtWHour2")).Text = ds.Tables[0].Rows[i + 15]["STD_WORKING_HOUR"].ToString(); //} if (com.StringToDouble(ds.Tables[0].Rows[i + 15]["STD_WORKING"].ToString()) != 0) { ((TextBox)dgvCalendarA.Rows[i].FindControl("txtWHour2")).Text = ds.Tables[0].Rows[i + 15]["STD_WORKING"].ToString(); } //else //set text = "" then the text well change to 0.00 //{ // ((TextBox)dgvCalendarA.Rows[i].FindControl("txtWHour2")).Text = ""; //} } else { dgvCalendarA.Rows[i].Visible = false; } } //cmdUpdate.Enabled = true;//DEL BY UBIQ-LIU 2010/8/4 //switch (g_lang) //{ // case 1: // //cmdDisp.ImageUrl = "../../Contents/Image/BackGround/btn-ind1-1.jpg"; // cmdUpdate.ImageUrl = "../../Contents/Image/BackGround/btn-update1-1.jpg"; // break; // case 2: // //cmdDisp.ImageUrl = "../../Contents/Image/BackGround/btn-ind1-2.jpg"; // cmdUpdate.ImageUrl = "../../Contents/Image/BackGround/btn-update1-2.jpg"; // break; // case 3: // //cmdDisp.ImageUrl = "../../Contents/Image/BackGround/btn-ind1-3.jpg"; // cmdUpdate.ImageUrl = "../../Contents/Image/BackGround/btn-update1-3.jpg"; // break; // case 4: // //cmdDisp.ImageUrl = "../../Contents/Image/BackGround/btn-ind1-4.jpg"; // cmdUpdate.ImageUrl = "../../Contents/Image/BackGround/btn-update1-4.jpg"; // break; //} } else { lblMsg.Text = msg.GetMessage("NOT_EXIST_ERR"); lblMsg.ForeColor = Color.Red; return; } }