//两个关闭是按钮,一行数据上青天; protected void BtnSubmit_Click(object sender, EventArgs e) { Panel_Standard.Visible = false; UpdatePanel_Standard.Update(); Panel_NewExpApp.Visible = false; UpdatePanel_NewExpApp.Update(); }
//获取要在gridview中显示的字段的sql //public string getListSql(string tbName) //{ // string sqlStr = ""; // string temp = ""; // DataSet ds = common.RunQuery("select * from tb_listfield where cname='" + tbName + "' order by cindex"); // if (ds.Tables.Count > 0) // { // foreach (DataRow row in ds.Tables[0].Rows) // { // temp += row["cfield"].ToString() + ","; // } // } // if (temp != "") // { // temp = temp.Substring(0, temp.Length - 1);//去掉最后一个逗号 // sqlStr = "select " + temp + " from " + tbName; // } // return sqlStr; //} //public void setBind(string sql, string tbName) //{ // DataTable dt = getDataTable(sql); //获得数据源 // string headerText = ""; // var gv = e.Row.Cells[11].FindControl("gridviewc") as GridView; // gvshow.DataSource = dt;//设置数据源 // //遍历数据源所有的列,并绑定到gridview // for (int i = 0; i < dt.Columns.Count; i++) // { // BoundField bc = new BoundField(); // bc.DataField = dt.Columns[i].ColumnName.ToString(); // headerText = dt.Columns[i].Caption.ToString(); // //替换表头文字 // DataSet hDs = common.RunQuery("select top 1 * from tb_listfield where cname='" + tbName + "' and cfield='" + headerText + "'"); // if (hDs.Tables.Count > 0) // { // if (hDs.Tables[0].Rows.Count > 0) // { // headerText = hDs.Tables[0].Rows[0]["cheadertext"].ToString(); // } // } // bc.HeaderText = headerText; // bc.ItemStyle.HorizontalAlign = HorizontalAlign.Center;//居中对齐 // gvshow.Columns.Add(bc); // } // //添加编辑列 // CommandField cf = new CommandField();//命令字段 // cf.ButtonType = ButtonType.Link;//超链接样式的按钮 // cf.ShowEditButton = true;//显示编辑按钮 // cf.CausesValidation = false;//引发数据验证为false // cf.HeaderText = "编辑"; // cf.ItemStyle.HorizontalAlign = HorizontalAlign.Center; // gvshow.Columns.Add(cf);//添加编辑按钮到gridview // //添加删除列 // CommandField cf2 = new CommandField(); // cf2.ButtonType = ButtonType.Link; // cf2.ShowDeleteButton = true;//显示删除按钮 // cf2.CausesValidation = false; // cf2.HeaderText = "删除"; // cf2.ItemStyle.HorizontalAlign = HorizontalAlign.Center; // gvshow.Columns.Add(cf2); // //添加包复选框的模板列 // TemplateField tf = new TemplateField(); // tf.ItemTemplate = new MyTemplate("", DataControlRowType.DataRow); // //tf.HeaderText = "选择"; // tf.HeaderTemplate = new MyTemplate("", DataControlRowType.Header); // tf.ItemStyle.HorizontalAlign = HorizontalAlign.Center; // gvshow.Columns.Add(tf); // gvshow.DataBind(); // form1.Controls.Add(gvshow); //} protected void BindQAItem() { Guid id = new Guid(Label32.Text.ToString()); GridView2.DataSource = iQCBasicDataL.Search_WorkOrder(id); GridView2.DataBind(); UpdatePanel_NewExpApp.Update(); }
//取消按钮 protected void BtnClose_Click(object sender, EventArgs e) { TxtNewNum.Text = ""; TxtNewNote.Text = ""; Panel_Standard.Visible = false; UpdatePanel_Standard.Update(); Panel_NewExpApp.Visible = false; UpdatePanel_NewExpApp.Update(); }
//待审核按钮 protected void BtnSubmit_Click(object sender, EventArgs e) { IQCBasicDataInfo IQC = new IQCBasicDataInfo(); IQC.IMISD_ID = id_IMISD; IQC.IMMBD_MaterialID = id_IMMBD_MaterialID; IQC.IMIDS_QA = ""; IQC.IQCDT_Result = "待审核"; string op = TextBox2.Text; if (TxtNewNum.Text == "") { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } else { int m1; if (int.TryParse(TxtNewNum.Text.Trim(), out m1)) { IQC.IQCDT_Input = m1; } else { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('投入数请输入整数!')", true); return; } } IQC.IQCDT_TestPer = Session["UserName"].ToString(); IQC.IQCDT_Description = TxtNewNote.Text.Trim(); IQC.State = "0"; try { if (iQCBasicDataL.Update_IMInStoreDetail_IQC(IQC, op) <= 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; } TxtNewNum.Text = ""; TxtNewNote.Text = ""; Panel_Standard.Visible = false; UpdatePanel_Standard.Update(); Panel_NewExpApp.Visible = false; UpdatePanel_NewExpApp.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 BtnTijiao_Click(object sender, EventArgs e) { IQCBasicDataInfo IQC = new IQCBasicDataInfo(); IQC.IMISD_ID = id_IMISD; IQC.IMMBD_MaterialID = id_IMMBD_MaterialID; IQC.IMIDS_QA = ""; IQC.IQCDT_Result = "待审核"; if (TxtNewNum.Text == "" || Ddl_AuRe.SelectedValue == "请选择") { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } else { if (TxtActualNum.Text != "" && TxtNewNum.Text != "") { decimal come = Convert.ToDecimal(TxtActualNum.Text.ToString()); decimal chou = Convert.ToDecimal(TxtNewNum.Text.ToString()); if (chou > come) { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('抽检数量大于到货数量,此操作违法,请注意单位!')", true); return; } } } //else //{ // int m1; // if (int.TryParse(TxtNewNum.Text.Trim(), out m1)) // IQC.IQCDT_Input = m1; // else // { // ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('投入数请输入整数!')", true); // return; // } //} IQC.IQCDT_Input = Convert.ToDecimal(TxtNewNum.Text.ToString()); IQC.IQCDT_TestPer = Session["UserName"].ToString(); IQC.IQCDT_Description = TxtNewNote.Text.Trim(); IQC.State = Ddl_AuRe.SelectedValue.ToString(); Guid id = new Guid(Label31.Text); Guid inID = new Guid(Label32.Text.ToString()); Guid immaterialID = new Guid(Label33.Text); string op = TextBox2.Text; try { if (iQCBasicDataL.Update_IMInStoreDetail_IQC(IQC, op) <= 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; } TxtNewNum.Text = ""; TxtNewNote.Text = ""; Panel_Standard.Visible = false; UpdatePanel_Standard.Update(); 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); } }
//操作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(); } }