public void databind() { string condition; string WO_Type = this.DropDownList_WO_Type.SelectedItem.Text.Trim() == "请选择" ? " and 1=1 " : " and WO_Type like '%" + this.DropDownList_WO_Type.SelectedItem.Text.Trim() + "%' "; string WO_People = this.TextBox_WO_People.Text.Trim() == "" ? " and 1=1 " : " and WO_People like '%" + this.TextBox_WO_People.Text.Trim() + "%' "; if ((this.TextBox_WO_Time1.Text != "" && this.TextBox_WO_Time2.Text == "") || (this.TextBox_WO_Time1.Text == "" && this.TextBox_WO_Time2.Text != "")) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "alert", "alert('请将随工单生成时间检索范围输入完整,请您再次核对!')", true); return; } string WO_Time = (this.TextBox_WO_Time1.Text.Trim() == "" && this.TextBox_WO_Time2.Text.Trim() == "") ? " and 1=1 " : " and WO_Time between ' " + this.TextBox_WO_Time1.Text.Trim() + "' and ' " + this.TextBox_WO_Time2.Text.Trim() + "'"; string WO_Num = this.TextBox_WO_Num.Text.Trim() == "" ? " and 1=1 " : " and WO_Num like '%" + this.TextBox_WO_Num.Text.Trim() + "%' "; string SMSO_ComOrderNum = this.TextBox_OrderNum.Text.Trim() == "" ? " and 1=1 " : " and SMSO_ComOrderNum like '%" + this.TextBox_OrderNum.Text.Trim() + "%' "; string WO_ProType = this.TextBox_WO_ProType.Text.Trim() == "" ? " and 1=1 " : " and WO_ProType like '%" + this.TextBox_WO_ProType.Text.Trim() + "%' "; string WO_ChipNum = this.TextBox_chipnum.Text.Trim() == "" ? " and 1=1 " : " and WO_PT_ChipType like '%" + this.TextBox_chipnum.Text.Trim() + "%' "; // string WO_Level = this.DropDownList_level.SelectedItem.Text.Trim() == "请选择" ? " and 1=1 " : " and WO_Level like '%" + this.DropDownList_level.SelectedItem.Text.Trim() + "%' "; string WO_State = this.DropDownList_WoState.SelectedItem.Text.Trim() == "请选择" ? " and 1=1 " : " and WO_State like '%" + this.DropDownList_WoState.SelectedItem.Text.Trim() + "%' "; string WO_SN = this.TextBox_WOSN.Text.Trim() == "" ? " and 1=1 " : " and WO_SN like '%" + this.TextBox_WOSN.Text.Trim() + "%' "; condition = WO_Type + WO_People + WO_Time + WO_Num + SMSO_ComOrderNum + WO_ProType + WO_ChipNum + WO_State + WO_SN; this.GridView_WOmain.DataSource = wol.S_WorkOrder(condition); this.GridView_WOmain.DataBind(); this.UpdatePanel_WOmain.Update(); Panel_basic.Visible = false; UpdatePanel_basic.Update(); }
protected void GridView_WOmain_PageIndexChanging(object sender, GridViewPageEventArgs e) //随工单主表分页 { GridView theGrid = sender as GridView; // refer to the GridView int newPageIndex = 0; GridView_WOmain.SelectedIndex = -1; if (-2 == e.NewPageIndex) { TextBox txtNewPageIndex = null; GridViewRow pagerRow = GridView_WOmain.BottomPagerRow; if (null != pagerRow) { txtNewPageIndex = (TextBox)pagerRow.FindControl("textbox"); } if (null != txtNewPageIndex && txtNewPageIndex.Text != "") { newPageIndex = int.Parse(txtNewPageIndex.Text) - 1; } } else { newPageIndex = e.NewPageIndex; } newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= GridView_WOmain.PageCount ? GridView_WOmain.PageCount - 1 : newPageIndex; GridView_WOmain.PageIndex = newPageIndex; this.GridView_WOmain.PageIndex = newPageIndex; databind(); this.TextBox_Series.Text = ""; this.TextBox_ProductName.Text = ""; this.Panel_Product_Search.Visible = false; this.Panel_Product.Visible = false; this.UpdatePanel_Product.Update(); TextBox_ComOrderNum.Text = ""; TextBox_CustOrder.Text = ""; Panel_SelectOrder.Visible = false; UpdatePanel_SelectOrder.Update(); Panel_basic.Visible = false; UpdatePanel_basic.Update(); TextBox_MBatch.Text = ""; Panel_MBatch.Visible = false; UpdatePanel_MBatch.Update(); Panel_Batch.Visible = false; UpdatePanel_Batch.Update(); }
protected void Btn_Close_ChooseBatch0_Click(object sender, EventArgs e) { Panel_basic.Visible = false; UpdatePanel_basic.Update(); TextBox_MBatch.Text = ""; Panel_MBatch.Visible = false; UpdatePanel_MBatch.Update(); Panel_Batch.Visible = false; UpdatePanel_Batch.Update(); }
protected void GridView_WOmain_RowCommand(object sender, GridViewCommandEventArgs e) //随工单主表行命令 { if (e.CommandName == "BasicInfo") //查看产品基础信息,包括BOM、工艺路线等 { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView_WOmain.SelectedIndex = row.RowIndex; GridView_WOmain.SelectedIndex = -1; string[] al = e.CommandArgument.ToString().Split(new char[] { ',' }); this.Label_WOID.Text = al[0]; string ptname = al[1]; Label_Type.Text = al[2]; if (al[2].Trim() == "检验") { this.GridView_Pr.DataSource = wol.S_WO_ProType_ProcessRoute(ptname, 1); this.GridView_Pr.DataBind(); // this.GridView_Pr.Columns[2].Visible = false; Label20.Text = "以下为检验随工单的工艺路线,与常规产品路线不同,蓝色表示需要认证的工序,认证合格后才能进行非蓝色工序"; } else { this.GridView_Pr.DataSource = wol.S_WO_ProType_ProcessRoute(ptname, 0); this.GridView_Pr.DataBind(); this.GridView_Pr.Columns[3].Visible = false; this.GridView_Pr.Columns[4].Visible = false; Label20.Text = ""; } this.Label_PT.Text = ptname; Panel_basic.Visible = true; this.GridView_bom.DataSource = wol.S_ProType_BOM(ptname); this.GridView_bom.DataBind(); DataSet ds1 = wol.S_ProType_TestParameter(ptname); DataView dv1 = ds1.Tables[0].DefaultView; foreach (DataRowView datav in dv1) { this.TextBox_TestParameter.Text = datav["PT_Parameters"].ToString().Trim(); } UpdatePanel_basic.Update(); //无关信息隐藏 this.TextBox_Series.Text = ""; this.TextBox_ProductName.Text = ""; this.Panel_Product_Search.Visible = false; this.Panel_Product.Visible = false; this.UpdatePanel_Product.Update(); Panel_MBatch.Visible = false; UpdatePanel_MBatch.Update(); Panel_Batch.Visible = false; UpdatePanel_Batch.Update(); } if (e.CommandName == "Deleted")//删除主表 { try { wol.D_WorkOrder(new Guid(e.CommandArgument.ToString().Trim())); } catch { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "alert", "alert('随工单失败,原因可能是由于已经制定了该随工单更进一步的信息!')", true); return; } // this.DropDownList_level.SelectedIndex = 0; this.DropDownList_WO_Type.SelectedIndex = 0; this.DropDownList_WoState.SelectedIndex = 0; this.TextBox_chipnum.Text = ""; this.TextBox_OrderNum.Text = ""; this.TextBox_WO_Num.Text = ""; this.TextBox_WO_People.Text = ""; this.TextBox_WO_ProType.Text = ""; this.TextBox_WO_Time1.Text = ""; this.TextBox_WO_Time2.Text = ""; this.TextBox_WOSN.Text = ""; Panel_basic.Visible = false; UpdatePanel_basic.Update(); Panel_MBatch.Visible = false; UpdatePanel_MBatch.Update(); Panel_Batch.Visible = false; UpdatePanel_Batch.Update(); string condition = " and 1=1"; this.GridView_WOmain.DataSource = wol.S_WorkOrder(condition); this.GridView_WOmain.DataBind(); this.UpdatePanel_WOmain.Update(); } if (e.CommandName == "materialsheet")//查看产品基础信息,包括BOM、工艺路线等 { string[] al = e.CommandArgument.ToString().Split(new char[] { ',' }); Response.Redirect("./materialsheet.aspx?WO_ID=" + al[0] + "&WO_Num=" + al[1] + "&SMSO_ComOrderNum=" + al[2] + "&WO_ProType=" + al[3] + "&WO_PNum=" + al[4] + "&WO_Level=" + al[5] + "&WO_Type=" + al[6] + "&WO_People=" + al[7] + "&WO_Time=" + al[8]); } if (e.CommandName == "editWorkWorder")//修改主表 { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView_WOmain.SelectedIndex = row.RowIndex; string[] al = e.CommandArgument.ToString().Split(new char[] { ',' }); this.Label_EditWOID.Text = al[0]; this.TextBox_EditNum.Text = al[1]; this.Label_EditWONum.Text = al[1]; this.Label_EditPTID.Text = al[6]; this.Label_EditOrderNum.Text = al[7]; this.TextBox_EditProType.Text = al[2]; this.TextBox_EditOrderNum.Text = al[3]; this.TextBox_EditNote.Text = al[4]; this.TextBox_EditSN.Text = al[5]; this.Panel_EditWorkOrder.Visible = true; this.UpdatePanel_EditWorkOrder.Update(); } if (e.CommandName == "printpreview")//打印 { string[] al = e.CommandArgument.ToString().Split(new char[] { ',' }); //if (al[5].Contains("SMSC")) //{ Response.Redirect("../ProductionProcess/SMSCWOPrint.aspx?" + "&WO_Num=" + al[1] + "&WO_Type=" + al[2] + "&SMSO_CusOrderNum=" + al[3] + "&SMSO_PlaceOrderTime=" + al[4] + "&WO_SN=" + al[6] + "&CB=" + al[7] + "&PS=" + al[5] + "&WO_ProType=" + al[8] ); //} //else //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "alert", "alert('系统试用阶段仅支持SMSC系统产品的打印!')", true); //} } }