//翻页 protected void Grid_ETTestItem_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView theGrid = sender as GridView; // refer to the GridView int newPageIndex = 0; if (-2 == e.NewPageIndex) { TextBox txtNewPageIndex = null; GridViewRow pagerRow = Grid_ETTestItem.BottomPagerRow; if (null != pagerRow) { txtNewPageIndex = (TextBox)pagerRow.FindControl("textbox"); // refer to the TextBox with the NewPageIndex value } if (null != txtNewPageIndex && txtNewPageIndex.Text != "") { newPageIndex = int.Parse(txtNewPageIndex.Text) - 1; // get the NewPageIndex } } else { newPageIndex = e.NewPageIndex; } BindGridview(Bindc1, Bindc2, Bindc3); newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= Grid_ETTestItem.PageCount ? Grid_ETTestItem.PageCount - 1 : newPageIndex; Grid_ETTestItem.PageIndex = newPageIndex; Grid_ETTestItem.PageIndex = newPageIndex; Grid_ETTestItem.DataBind(); }
//绑定实验申请Gridview,用于刷新GridView private void BindGridview(string condition1, string condition2, string condition3) { Grid_ETTestItem.DataSource = expTestL.Search_ExpItems_Gridview(condition1, condition2, condition3); Grid_ETTestItem.DataBind(); }
//操作Gridview的命令行 protected void Grid_Material_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "New_CertMessage") { Label28.Text = e.CommandArgument.ToString(); GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_Material.SelectedIndex = row.RowIndex; GridViewRow gvr = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent)); Label29.Text = "入库单号:" + Grid_Material.Rows[gvr.RowIndex].Cells[2].Text.ToString().Trim() + " 检验物料:" + Grid_Material.Rows[gvr.RowIndex].Cells[4].Text.ToString().Trim() + Grid_Material.Rows[gvr.RowIndex].Cells[6].Text.ToString().Trim() + " 批号:" + Grid_Material.Rows[gvr.RowIndex].Cells[7].Text.ToString().Trim() + " 供货单位:" + Grid_Material.Rows[gvr.RowIndex].Cells[8].Text.ToString().Trim() + " 于" + Grid_Material.Rows[gvr.RowIndex].Cells[11].Text.ToString().Trim() + "入库,共" + Grid_Material.Rows[gvr.RowIndex].Cells[9].Text.ToString().Trim() + Grid_Material.Rows[gvr.RowIndex].Cells[10].Text.ToString().Trim(); id2 = new Guid(e.CommandArgument.ToString()); Panel_AddWorkOrder.Visible = true; TextBox_AddPT.Text = ""; TextBox_Add_PNum.Text = ""; //TextBox_Add_ChipNum.Text = ""; TextBox_AddNote.Text = ""; UpdatePanel_AddWorkOrder.Update(); } if (e.CommandName == "View_CertDetail") { //string[] al = e.CommandArgument.ToString().Split(new char[] { ',' }); //Response.Redirect("../ProductionProcess/WorkOrderCheck.aspx?WO_Type=检验"); //Response.Write("<script>window.open(\''../ProductionProcess/WorkOrderCheck.aspx?IMISD_ID=" + al[0] + "\'')</script>"); //Response.Write("<script>window.open(\''../ProductionProcess/WorkOrderCheck.aspx?IMISD_ID="+al[0]+"\'',\''_blank\'')</script>"); label_GridPageState.Text = e.CommandArgument.ToString(); Panel_WOmain.Visible = true; databind_main(); } if (e.CommandName == "New_Test") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_Material.SelectedIndex = row.RowIndex; Panel_NewExpApp.Visible = true; string[] al = e.CommandArgument.ToString().Split(new char[] { ',' }); string cond = " and IMISD_ID='" + al[0] + "'"; Label31.Text = Convert.ToString(Guid.NewGuid()); Label32.Text = al[0]; Label33.Text = al[2]; UpdatePanel_NewExpApp.Update(); id_IMISD = new Guid(al[0]); id_IMMBD_MaterialID = new Guid(al[2]); LblExpApp.Text = "新增 " + al[1] + " 检验单"; try { Guid id1 = new Guid(al[0]); Guid id2 = new Guid(al[2]); iQCBasicDataL.Insert_IQCDetailTable(id1, id2); } catch (Exception) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('检验单新增失败!')", true); return; } string cond1 = " and DT.IMISD_ID='" + al[0] + "' and DT.IQCDT_Result='待审核' "; //IQCBasicDataInfo IQC1 = iQCBasicDataL.Search_IMInStoreDetail_ViewAu(cond1)[0]; DataSet ds = iQCBasicDataL.Search_IMInStoreDetail_Au(cond1); DataTable dt = ds.Tables[0]; if (dt.Rows.Count != 0) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('该物料检验单正在审核,不能继续检验!')", true); return; } IQCBasicDataInfo IQC = iQCBasicDataL.Search_IMInStoreDetail_New(cond)[0]; TxtNewMaterialType.Text = IQC.IMMT_MaterialType; TxtNewMaterialName.Text = IQC.IMMBD_MaterialName; TxtNewMode.Text = IQC.IMMBD_SpecificationModel; TxtNewMaterialCode.Text = IQC.IMMBD_MaterialCode; TxtNewSupplyName.Text = IQC.PMSI_SupplyName; TxtActualNum.Text = Convert.ToString(IQC.IMIDS_ActualArrNum); TxtNewUnit.Text = IQC.UnitName; TxtNewArrivalTime.Text = Convert.ToString(IQC.IMISM_InStoreTime); Grid_ETTestItem.DataSource = iQCBasicDataL.Search_IQCItemsTable(IQC.IMMBD_MaterialID); Grid_ETTestItem.DataBind(); Guid id = new Guid(Label32.Text.ToString()); GridView2.DataSource = iQCBasicDataL.Search_WorkOrder(id); GridView2.DataBind(); //GridView2.Visible = true; //BindQAItem(); UpdatePanel_NewExpApp.Update(); } }
//操作Gridview的命令行 protected void Grid_Material_RowCommand(object sender, GridViewCommandEventArgs e) { //查看检验结果 if (e.CommandName == "View_CertDetail") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Txt_CheckResult.Enabled = false; Txt_CheckSug.Enabled = false; TextBox2.Enabled = false; Grid_Material.SelectedIndex = row.RowIndex; Panel_NewExpApp.Visible = true; string[] al = e.CommandArgument.ToString().Split(new char[] { ',' }); string cond = " and DT.IMISD_ID='" + al[0] + "'"; id_IMISD = new Guid(al[0]); Label32.Text = al[0]; id_IMMBD_MaterialID = new Guid(al[2]); LblExpApp.Text = al[1] + " 检验结果"; IQCBasicDataInfo IQC = iQCBasicDataL.Search_IMInStoreDetail_ViewAu(cond)[0];//超出索引????原来此处grid略有不同 TxtNewMaterialType.Text = IQC.IMMT_MaterialType; TxtNewMaterialName.Text = IQC.IMMBD_MaterialName; TxtNewMode.Text = IQC.IMMBD_SpecificationModel; TxtNewMaterialCode.Text = IQC.IMMBD_MaterialCode; TxtNewSupplyName.Text = IQC.PMSI_SupplyName; TxtActualNum.Text = Convert.ToString(IQC.IMIDS_ActualArrNum); TxtNewUnit.Text = IQC.UnitName; TxtNewArrivalTime.Text = Convert.ToString(IQC.IMISM_InStoreTime); TextBox2.Text = IQC.OP; Guid guid = new Guid(al[3]); IQCBasicDataInfo iqc = iQCBasicDataL.Search_IQCDetailTable(guid)[0]; TxtNewNum.Text = Convert.ToString(iqc.IQCDT_Input); TxtTestPerson.Text = iqc.IQCDT_TestPer; Txt_CheckTime.Text = Convert.ToString(iqc.IQCDT_TestTime); Txt_CheckResult.SelectedValue = Grid_Material.DataKeys[row.RowIndex]["IQCDT_ProResult"].ToString(); Txt_CheckSug.Text = iqc.IQCDT_Description; Grid_ETTestItem.DataSource = iQCBasicDataL.Search_IQCItemsTable(IQC.IMMBD_MaterialID); Grid_ETTestItem.DataBind(); GridView2.DataSource = iQCBasicDataL.Search_WorkOrder(id_IMISD); GridView2.DataBind(); UpdatePanel_NewExpApp.Update(); } //审核 if (e.CommandName == "New_Test") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Label33.Text = Grid_Material.Rows[row.RowIndex].Cells[8].ToString(); Label37.Text = Grid_Material.Rows[row.RowIndex].Cells[8].ToString(); Ddl_IsShengChan.Enabled = true; Label28.Visible = false; Ddl_IsShengChan.SelectedValue = "2"; Ddl_IsShengChan.Enabled = false; DropDownList_Add_level.Enabled = true; Txt_AuTime.Enabled = true; Ddl_AuRe.Enabled = true; Txt_AuAug.Enabled = true; Txt_Jiangdang.Enabled = true; Button_Submit_Add.Visible = true; Panel_AddWorkOrder.Visible = true; Label3.Visible = false; Txt_AuTime.Visible = false; Label25.Visible = false; Txt_AuPer.Visible = false; string[] al = e.CommandArgument.ToString().Split(new char[] { ',' }); Lbl_Check.Text = al[1] + " 检验结果审核"; id_IMISD = new Guid(al[0]); id_IMMBD_MaterialID = new Guid(al[2]); id_IQCDT_ID = new Guid(al[3]); Txt_AuPer.Text = ""; Txt_AuAug.Text = ""; Txt_Jiangdang.Text = ""; Ddl_AuRe.SelectedValue = Grid_Material.DataKeys[row.RowIndex]["IQCDT_ProResult"].ToString(); UpdatePanel_AddWorkOrder.Update(); } //审核查看 if (e.CommandName == "View_Au") { Label25.Visible = true; Txt_AuPer.Visible = true; Txt_AuPer.Enabled = false; Txt_AuTime.Enabled = false; Ddl_IsShengChan.Enabled = false; DropDownList_Add_level.Enabled = false; Ddl_AuRe.Enabled = false; Txt_AuAug.Enabled = false; Txt_Jiangdang.Enabled = false; Button_Submit_Add.Visible = false; string[] al = e.CommandArgument.ToString().Split(new char[] { ',' }); id_IMISD = new Guid(al[0]); id_IMMBD_MaterialID = new Guid(al[2]); id_IQCDT_ID = new Guid(al[3]); IQCBasicDataInfo iqc = new IQCBasicDataInfo(); try { iqc = iQCBasicDataL.Search_IQCDetailTable_Au(id_IQCDT_ID)[0]; } catch (Exception) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('该项尚未审核或不需要审核!')", true); return; } if (iqc.IQCDT_Auditor != "") { Panel_AddWorkOrder.Visible = true; Label3.Visible = true; Txt_AuTime.Visible = true; Lbl_Check.Text = al[1] + " 审核查看"; Txt_AuPer.Text = iqc.IQCDT_Auditor; Txt_AuTime.Text = Convert.ToString(iqc.IQCDT_ATime); Txt_AuAug.Text = iqc.IQCDT_ASugg; Txt_Jiangdang.Text = iqc.IQCDT_DownDetail; BindDdl_AuRe(iqc.IQCDT_AResult, iqc.IQCDT_DownDetail); BindDdl_IsShengChan(iqc.WO_IsShengchan); UpdatePanel_AddWorkOrder.Update(); } else { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('该项尚未审核或不需要审核!')", true); return; } } if (e.CommandName == "Rin") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_Material.SelectedIndex = row.RowIndex; if (Grid_Material.Rows[row.RowIndex].Cells[17].Text.ToString().Trim() != "驳回") { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('此检验单没有被驳回,不需要重新录入检验结果!')", true); return; } Panel_NewExpApp.Visible = true; string[] al = e.CommandArgument.ToString().Split(new char[] { ',' }); string cond = " and DT.IMISD_ID='" + al[0] + "'"; id_IMISD = new Guid(al[0]); Label32.Text = al[0]; id_IMMBD_MaterialID = new Guid(al[2]); LblExpApp.Text = al[1] + " 检验结果"; Label36.Text = al[3]; IQCBasicDataInfo IQC = iQCBasicDataL.Search_IMInStoreDetail_ViewAu(cond)[0];//超出索引????原来此处grid略有不同 TxtNewMaterialType.Text = IQC.IMMT_MaterialType; TxtNewMaterialName.Text = IQC.IMMBD_MaterialName; TxtNewMode.Text = IQC.IMMBD_SpecificationModel; TxtNewMaterialCode.Text = IQC.IMMBD_MaterialCode; TxtNewSupplyName.Text = IQC.PMSI_SupplyName; TxtActualNum.Text = Convert.ToString(IQC.IMIDS_ActualArrNum); TxtNewUnit.Text = IQC.UnitName; TxtNewArrivalTime.Text = Convert.ToString(IQC.IMISM_InStoreTime); TextBox2.Text = IQC.OP; Guid guid = new Guid(al[3]); IQCBasicDataInfo iqc = iQCBasicDataL.Search_IQCDetailTable(guid)[0]; TxtNewNum.Text = Convert.ToString(iqc.IQCDT_Input); TxtTestPerson.Text = iqc.IQCDT_TestPer; Txt_CheckTime.Text = Convert.ToString(iqc.IQCDT_TestTime); Txt_CheckResult.Text = Grid_Material.DataKeys[row.RowIndex]["IQCDT_ProResult"].ToString(); Txt_CheckSug.Text = iqc.IQCDT_Description; Grid_ETTestItem.DataSource = iQCBasicDataL.Search_IQCItemsTable(IQC.IMMBD_MaterialID); Grid_ETTestItem.DataBind(); GridView2.DataSource = iQCBasicDataL.Search_WorkOrder(id_IMISD); GridView2.DataBind(); Txt_CheckSug.Enabled = true; TextBox2.Enabled = true; Txt_CheckResult.Enabled = true; UpdatePanel_NewExpApp.Update(); } }