//重置 protected void BtnResetMaterial_Click(object sender, EventArgs e) { TxtMaterialType.Text = ""; TxtMaterialName.Text = ""; TxtSpecificationModel.Text = ""; if (condSearch1 == "") { Grid_Material.Columns[4].Visible = true; Grid_Material.Columns[5].Visible = true; Grid_Material.Columns[6].Visible = false; cond1 = " and IMMBD_IsIQC=1"; LblGridMaterial.Text = "进料检验物料表"; } else if (condSearch1 == "all") { Grid_Material.Columns[4].Visible = false; Grid_Material.Columns[5].Visible = false; Grid_Material.Columns[6].Visible = true; cond1 = " and (IMMBD_IsIQC=0 or IMMBD_IsIQC is null) "; LblGridMaterial.Text = "非料检验物料表"; } BindGrid1(cond1); UpdatePanel_SearchMaterial.Update(); UpdatePanel_GridMaterial.Update(); }
static string edit2 = "", edit3 = "";//用于存储grid2、grid3编辑状态 #region 页面加载 //页面加载 protected void Page_Load(object sender, EventArgs e) { BindGrid1(cond1); string Role = Request.QueryString["state"].ToString(); if (!Page.IsPostBack) { cond1 = " and IMMBD_IsIQC=1"; BindGrid1(cond1); UpdatePanel_GridMaterial.Update(); LblGridMaterial.Text = "进料检验物料表"; Grid_Material.Columns[6].Visible = false; if (!((Session["UserRole"].ToString().Contains("进料检验检验项目维护")) || (Session["UserRole"].ToString().Contains("进料检验检验项目查看")))) { Response.Redirect("~/Default.aspx"); } } if (Role == "Item" && Session["UserRole"].ToString().Contains("进料检验检验项目维护")) { Title = "进料检验检验项目维护"; } else if (Role == "Item" && Session["UserRole"].ToString().Contains("进料检验检验项目查看")) { Title = "进料检验检验项目查看"; Grid_Material.Columns[5].Visible = false; Grid_Material.Columns[6].Visible = false; Btn_NewIQCItems.Visible = false; Grid_IQCItems.Columns[5].Visible = false; Grid_IQCItems.Columns[6].Visible = false; Btn_NewStandard.Visible = false; Grid_ItemsValue.Columns[4].Visible = false; Grid_ItemsValue.Columns[5].Visible = false; } }
//操作Gridview的命令行 protected void Grid_Risk_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Edt_RiskLevel") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_Risk.SelectedIndex = row.RowIndex; LblSearchCond.Text = "RiskAll"; LblGridMaterial.Text = "该风险等级下物料"; Panel_SearchMaterial.Visible = true; Panel_GridMaterial.Visible = true; GridViewRow gvr = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent)); //this.Grid_BDOrgSheet_1.Rows[gvr.RowIndex].BackColor = System.Drawing.Color.SkyBlue; //Session["index"] = gvr.RowIndex; idR = new Guid(e.CommandArgument.ToString()); BindGridMRisk(idR); TxtMaterialType.Text = ""; TextMaterialName.Text = ""; UpdatePanel_SearchMaterial.Update(); UpdatePanel_GridMaterial.Update(); } if (e.CommandName == "Delete_RiskLevel") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_Risk.SelectedIndex = row.RowIndex; Guid guid = new Guid(e.CommandArgument.ToString()); hSFBasicDataL.Delete_ExpSampleType(guid); BindGridviewRisk(BindcR); UpdatePanel_GridRisk.Update(); } }
//检索栏检索所有按钮 protected void BtnSearchRest_Click(object sender, EventArgs e) { LblGridMaterial.Text = "所有物料列表"; BindcM1 = TxtMaterialType.Text; BindcM2 = TextMaterialName.Text; LblSearchCond.Text = "All"; BindGridMAll(BindcM1, BindcM2); UpdatePanel_GridMaterial.Update(); }
//检索栏检索物料按钮 protected void BtnSearchMaterial_Click(object sender, EventArgs e) { LblGridMaterial.Text = "该风险等级所属物料列表"; BindcM1 = TxtMaterialType.Text; BindcM2 = TextMaterialName.Text; LblSearchCond.Text = "RiskCond"; BindGridMRiskF(idR, BindcM1, BindcM2); UpdatePanel_GridMaterial.Update(); }
//重置 protected void BtnResetMaterial_Click(object sender, EventArgs e) { TxtMaterialName.Text = ""; TxtMaterialCode.Text = ""; TxtSupplyName.Text = ""; TxtArriveTime1.Text = ""; TxtArriveTime2.Text = ""; string cond1 = ""; BindGrid1(cond1); UpdatePanel_SearchMaterial.Update(); UpdatePanel_GridMaterial.Update(); }
//取消按钮 protected void BtnCls_Material_Click(object sender, EventArgs e) { if (Panel_SearchMaterial.Visible) { Panel_SearchMaterial.Visible = false; UpdatePanel_SearchMaterial.Update(); } if (Panel_GridMaterial.Visible) { Panel_GridMaterial.Visible = false; UpdatePanel_GridMaterial.Update(); } }
//检索栏检索按钮 protected void BtnSearchMaterial_Click(object sender, EventArgs e) { if (Ddl_Au.SelectedValue == "0") { Grid_Material.Columns[4].Visible = true; Grid_Material.Columns[5].Visible = true; Grid_Material.Columns[6].Visible = false; condSearch1 = "";//以此变量存储物料检索栏是否处于检索所有的状态 LblGridMaterial.Text = "进料检验物料表"; cond1 = " and IMMBD_IsIQC=1"; if (TxtMaterialType.Text != "") { cond1 = cond1 + " and IMMT_MaterialType like '%'+ Ltrim(Rtrim('" + TxtMaterialType.Text + "'))+'%'"; } if (TxtMaterialName.Text != "") { cond1 = cond1 + " and IMMBD_MaterialName like '%'+ Ltrim(Rtrim('" + TxtMaterialName.Text + "'))+'%'"; } if (TxtSpecificationModel.Text != "") { cond1 = cond1 + " and IMMBD_SpecificationModel like '%'+ Ltrim(Rtrim('" + TxtSpecificationModel.Text + "'))+'%'"; } } else if (Ddl_Au.SelectedValue == "1") { Grid_Material.Columns[4].Visible = false; Grid_Material.Columns[5].Visible = false; Grid_Material.Columns[6].Visible = true; condSearch1 = "all";//以此变量存储物料检索栏是否处于检索所有的状态 LblGridMaterial.Text = "非进料检验物料表"; cond1 = " and (IMMBD_IsIQC=0 or IMMBD_IsIQC is null) "; if (TxtMaterialType.Text != "") { cond1 = cond1 + " and IMMT_MaterialType like '%'+ Ltrim(Rtrim('" + TxtMaterialType.Text + "'))+'%'"; } if (TxtMaterialName.Text != "") { cond1 = cond1 + " and IMMBD_MaterialName like '%'+ Ltrim(Rtrim('" + TxtMaterialName.Text + "'))+'%'"; } if (TxtSpecificationModel.Text != "") { cond1 = cond1 + " and IMMBD_SpecificationModel like '%'+ Ltrim(Rtrim('" + TxtSpecificationModel.Text + "'))+'%'"; } } BindGrid1(cond1); UpdatePanel_GridMaterial.Update(); }
//重置 protected void BtnResetMaterial_Click(object sender, EventArgs e) { TxtMaterialName.Text = ""; TxtMaterialCode.Text = ""; TxtSupplyName.Text = ""; TxtArriveTime1.Text = ""; TxtArriveTime2.Text = ""; //Ddl_Au.SelectedValue = "0"; if (Request.QueryString["state"].ToString() == "IQCAuMgtReview") { state = "all"; Label7.Text = "历史检验信息表"; Label30.Text = " and DT.IQCDT_Result is not null "; Grid_Material.Columns[14].Visible = false; Grid_Material.Columns[15].Visible = true; } else if (Request.QueryString["state"].ToString() == "IQCAuMgt") { if (Ddl_Au.SelectedValue == "0") { state = ""; Label30.Text = " and DT.IQCDT_Result='待审核' "; Label7.Text = "待审核物料信息表"; Grid_Material.Columns[14].Visible = true; Grid_Material.Columns[15].Visible = false; } else if (Ddl_Au.SelectedValue == "1") { state = "all"; Label30.Text = ""; Label7.Text = "历史检验信息表"; Grid_Material.Columns[14].Visible = false; Grid_Material.Columns[15].Visible = true; } //state = ""; //cond1 = " and DT.IQCDT_Result='待审核' "; //Label7.Text = "待审核物料信息表"; //Grid_Material.Columns[14].Visible = true; //Grid_Material.Columns[15].Visible = false; } BindGrid1(Label30.Text); UpdatePanel_SearchMaterial.Update(); UpdatePanel_GridMaterial.Update(); }
//驳回 protected void Btn_Submit_Refuse_Click(object sender, EventArgs e) { Guid id = id_IQCDT_ID; string op = Txt_AuAug.Text; iQCBasicDataL.Update_IQCDT_Refuse(id, op); BindGrid1(Label30.Text); UpdatePanel_GridMaterial.Update(); ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('驳回成功,并已通知检验员!')", true); Panel_AddWorkOrder.Visible = false; UpdatePanel_AddWorkOrder.Update(); string remind = "ERP系统消息:" + Session["UserName"].ToString() + "于" + DateTime.Now.ToString("F") + "驳回了批号为:" + Label37.Text.ToString() + "的入库检验单,请在进料检验查看页面中重新录入检验结果!"; string sErr = RTXhelper.Send(remind, "进料检验维护"); if (!string.IsNullOrEmpty(sErr)) { ScriptManager.RegisterClientScriptBlock(Page, GetType(), "alert", "alert('" + sErr + "')", true); } }
//重置 protected void BtnResetM_Click(object sender, EventArgs e) { TxtMaterialType.Text = ""; TextMaterialName.Text = ""; UpdatePanel_SearchMaterial.Update(); BindcM1 = BindcM2 = ""; if (LblSearchCond.Text == "RiskAll") { BindGridMRisk(idR); } else if (LblSearchCond.Text == "RiskCond") { BindGridMRiskF(idR, BindcM1, BindcM2); } else if (LblSearchCond.Text == "All") { BindGridMAll(BindcM1, BindcM2); } UpdatePanel_GridMaterial.Update(); }
protected void BtnSubmit1_Click(object sender, EventArgs e) { Guid id = new Guid(Label36.Text.ToString()); string result = Txt_CheckResult.SelectedValue.ToString(); string op = Txt_CheckSug.Text; string op1 = TextBox2.Text; iQCBasicDataL.Update_IQCDT_Result(id, result, op, op1); ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('提交成功!')", true); Panel_NewExpApp.Visible = false; UpdatePanel_NewExpApp.Update(); string remind = "ERP系统消息:" + Session["UserName"].ToString() + "于" + DateTime.Now.ToString("F") + "提交了新的入库检验单,请及时进行审核!"; string sErr = RTXhelper.Send(remind, "进料检验审核"); if (!string.IsNullOrEmpty(sErr)) { ScriptManager.RegisterClientScriptBlock(Page, GetType(), "alert", "alert('" + sErr + "')", true); } BindGrid1(Label30.Text); UpdatePanel_GridMaterial.Update(); }
//检索栏检索按钮 protected void BtnSearchMaterial_Click(object sender, EventArgs e) { string cond1 = ""; if (TextBox1.Text != "") { cond1 = cond1 + " AND IMISD_BatchNum like '%" + TextBox1.Text.ToString().Trim() + "%' "; } if (TxtMaterialName.Text != "") { cond1 = cond1 + " AND IMMBD_MaterialName like '%' + LTRIM(RTRIM('" + TxtMaterialName.Text + "')) + '%' "; } if (TxtMaterialCode.Text != "") { cond1 = cond1 + " AND IMMBD_SpecificationModel like '%' + LTRIM(RTRIM('" + TxtMaterialCode.Text + "')) + '%' "; } if (TxtSupplyName.Text != "") { cond1 = cond1 + " AND PMSI_SupplyName like '%' + LTRIM(RTRIM('" + TxtSupplyName.Text + "')) + '%' "; } if (TxtArriveTime1.Text == "" && TxtArriveTime2.Text != "") { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('请选择时间范围!')", true); return; } else if (TxtArriveTime1.Text != "" && TxtArriveTime2.Text == "") { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('请选择时间范围!')", true); return; } else if (TxtArriveTime1.Text != "" && TxtArriveTime2.Text != "") { cond1 = cond1 + " AND IMISM_InStoreTime BETWEEN '" + TxtArriveTime1.Text + "' AND '" + TxtArriveTime2.Text + "' "; } cond1l.Text = cond1; BindGrid1(cond1); UpdatePanel_GridMaterial.Update(); }
//操作Gridview的命令行 protected void Grid_Material_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Chs_Risk") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_Material.SelectedIndex = row.RowIndex; GridViewRow gvr = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent)); //this.Grid_BDOrgSheet_1.Rows[gvr.RowIndex].BackColor = System.Drawing.Color.SkyBlue; //Session["index"] = gvr.RowIndex; idM = new Guid(e.CommandArgument.ToString()); hSFReskLevelInfo.IMMBD_MaterialID = idM; hSFReskLevelInfo.HSFRL_RiskLevelID = idR; hSFBasicDataL.Insert_HSFReskLevel_M(hSFReskLevelInfo); BindGridMAll("", ""); UpdatePanel_GridMaterial.Update(); } if (e.CommandName == "Delete_Material") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_Material.SelectedIndex = row.RowIndex; Guid guid = new Guid(e.CommandArgument.ToString()); hSFBasicDataL.Delete_HSFReskLevel_M(guid); if (LblSearchCond.Text == "RiskAll") { BindGridMRisk(idR); } else if (LblSearchCond.Text == "RiskCond") { BindGridMRiskF(idR, BindcM1, BindcM2); } else if (LblSearchCond.Text == "All") { BindGridMAll(BindcM1, BindcM2); } UpdatePanel_GridMaterial.Update(); } }
//操作Gridview的命令行 protected void Grid_Material_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Edt_Item") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_Material.SelectedIndex = row.RowIndex; GridViewRow gvr = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent)); id2 = new Guid(e.CommandArgument.ToString()); BindGrid2(id2); Grid2Cond = "id";//用id表示grid2绑定id检索,用空表示grid2绑定模糊检索 TxtIQCItems.Text = ""; DdlstNeedValue.ClearSelection(); Panel_IQCItemsMgt.Visible = true; UpdatePanel_IQCItemsMgt.Update(); } if (e.CommandName == "Delete_Item") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_Material.SelectedIndex = row.RowIndex; Guid guid = new Guid(e.CommandArgument.ToString()); try { if (iQCBasicDataL.Delete_IMMaterialBasicData_IQC(guid) <= 0) { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('该物料不属于检验物料,无法删除!')", true); return; } //expTestL.Insert_ExpSampleType(expSampleType_ExpItems); } catch (Exception exc) { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('删除失败!" + exc + "')", true); } ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('删除成功!')", true); if (guid == id2)//如果点击的检验项目维护与所删除的是同一列,则关闭子级窗口 { TxtIQCItems.Text = ""; DdlstNeedValue.ClearSelection(); Panel_IQCItemsMgt.Visible = false; UpdatePanel_IQCItemsMgt.Update(); TxtStandard.Text = ""; TxtRemarks.Text = ""; Panel_SearchStandard.Visible = false; UpdatePanel_SearchStandard.Update(); } BindGrid1(cond1); UpdatePanel_GridMaterial.Update(); } if (e.CommandName == "Chs_Item") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_Material.SelectedIndex = row.RowIndex; Guid guid = new Guid(e.CommandArgument.ToString()); try { if (iQCBasicDataL.Insert_IMMaterialBasicData_IQC(guid) <= 0) { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('该物料已经属于检验物料!')", true); return; } //expTestL.Insert_ExpSampleType(expSampleType_ExpItems); } catch (Exception exc) { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('新增失败!" + exc + "')", true); } ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('新增成功!')", true); BindGrid1(cond1); UpdatePanel_GridMaterial.Update(); } }
//检索栏检索按钮 protected void BtnSearchMaterial_Click(object sender, EventArgs e) { string cond1 = Label30.Text; if (TextBox1.Text != "") { cond1 = cond1 + " AND IMMBD_SpecificationModel like '%' + LTRIM(RTRIM('" + TextBox1.Text + "')) + '%' "; } if (TxtMaterialName.Text != "") { cond1 = cond1 + " AND IMMBD_MaterialName like '%' + LTRIM(RTRIM('" + TxtMaterialName.Text + "')) + '%' "; } if (TxtMaterialCode.Text != "") { cond1 = cond1 + " AND IMISD_BatchNum like '%" + TxtMaterialCode.Text.ToString().Trim() + "%'"; } if (TxtSupplyName.Text != "") { cond1 = cond1 + " AND PMSI_SupplyName like '%' + LTRIM(RTRIM('" + TxtSupplyName.Text + "')) + '%' "; } if (TxtArriveTime1.Text == "" && TxtArriveTime2.Text != "") { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('请选择时间范围!')", true); return; } else if (TxtArriveTime1.Text != "" && TxtArriveTime2.Text == "") { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('请选择时间范围!')", true); return; } else if (TxtArriveTime1.Text != "" && TxtArriveTime2.Text != "") { cond1 = cond1 + " AND IMISM_InStoreTime BETWEEN '" + TxtArriveTime1.Text + "' AND '" + TxtArriveTime2.Text + "' "; } if (CheckBox1.Checked == true) { cond1 += " and DT.IQCDT_AResult='驳回'"; } //if (Request.QueryString["state"].ToString() == "IQCAuMgtReview") //{ // state = "all"; // Label7.Text = "历史检验信息表"; // cond1 = cond1 + " and DT.IQCDT_Result is not null "; //} //else if (Request.QueryString["state"].ToString() == "IQCAuMgt") //{ // if (Ddl_Au.SelectedValue == "0") // { // state = ""; // cond1 = cond1 + " and DT.IQCDT_Result='待审核' "; // Label7.Text = "待审核物料信息表"; // } // else if (Ddl_Au.SelectedValue == "1") // { // state = "all"; // Label7.Text = "历史检验信息表"; // } //} //if (state == "") //{ // Grid_Material.Columns[14].Visible = true; // Grid_Material.Columns[15].Visible = false; //} //else if (state == "all") //{ // Grid_Material.Columns[14].Visible = false; // Grid_Material.Columns[15].Visible = true; //} BindGrid1(cond1); UpdatePanel_GridMaterial.Update(); }
//提交按钮 protected void Btn_Submit_Add_Click(object sender, EventArgs e) { IQCBasicDataInfo IQC = new IQCBasicDataInfo(); IQC.IMISD_ID = id_IMISD; IQC.IMMBD_MaterialID = id_IMMBD_MaterialID; IQC.IQCDT_ID = id_IQCDT_ID; IQC.IQCDT_Auditor = Session["UserName"].ToString(); if (Ddl_AuRe.SelectedItem.ToString() == "请选择") { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } else { if (Ddl_AuRe.SelectedItem.ToString() == "降档") { if (Txt_Jiangdang.Text.Trim() == "") { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } } IQC.IQCDT_DownDetail = Txt_Jiangdang.Text.Trim(); IQC.IMIDS_QA = Ddl_AuRe.SelectedItem.ToString(); IQC.IQCDT_Result = Ddl_AuRe.SelectedItem.ToString(); IQC.IQCDT_AResult = Ddl_AuRe.SelectedItem.ToString(); } IQC.IQCDT_ASugg = Txt_AuAug.Text.Trim(); //if (this.Ddl_IsShengChan.SelectedItem.ToString() == "请选择") //{ // ScriptManager.RegisterClientScriptBlock(this.Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true); // return; //} //else //{ IQCBasicDataInfo iqc = new IQCBasicDataInfo(); //if (Ddl_IsShengChan.SelectedItem.ToString() == "是") // iqc.State = "1"; //else if (Ddl_IsShengChan.SelectedItem.ToString() == "否") iqc.State = "2"; iqc.IQCDT_ID = id_IQCDT_ID; iqc.WO_Level = DropDownList_Add_level.SelectedItem.ToString(); try { iQCBasicDataL.Update_WorkOrder_IQC(iqc); } catch (Exception) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('审核失败!')", true); return; } //} try { if (iQCBasicDataL.Update_IMInStoreDetail_IQCAU(IQC) <= 0) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('审核失败!')", true); return; } ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('审核成功!')", true); } catch (Exception) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('审核失败!')", true); return; } BindGrid1(Label30.Text); UpdatePanel_GridMaterial.Update(); Panel_AddWorkOrder.Visible = false; UpdatePanel_AddWorkOrder.Update(); }