コード例 #1
0
ファイル: BOM.aspx.cs プロジェクト: qimengcheng/xi
    protected void GridView3_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Modify")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridView3.SelectedIndex = row.RowIndex;
            Guid bdid = new Guid(e.CommandArgument.ToString());
            Label32.Text   = Label4.Text;
            Label34.Text   = row.Cells[12].Text;
            Label35.Text   = row.Cells[3].Text;
            Label36.Text   = row.Cells[1].Text;
            Label37.Text   = row.Cells[2].Text;
            Label38.Text   = row.Cells[11].Text;
            Label33.Text   = bdid.ToString();
            TextBox14.Text = row.Cells[4].Text;
            TextBox15.Text = row.Cells[5].Text;
            DropDownList3.Items.Clear();
            FuseText.Visible      = false;
            DropDownList4.Visible = false;
            SqlDataReader myReader = bom.Query_MUnit(new Guid(Label38.Text));
            UnitCheck.Visible = true;
            while (myReader.Read())
            {
                DropDownList3.Items.Add(new ListItem(myReader["UnitName"].ToString(), myReader["UnitID"].ToString()));//增加Item
            }

            DropDownList3.SelectedIndex = DropDownList3.Items.IndexOf(DropDownList3.Items.FindByText(row.Cells[6].Text));
            TextBox17.Text = row.Cells[9].Text;
            try
            {
                Guid CraID = bom.Query_PBCID(row.Cells[3].Text);
                Label34.Text = CraID.ToString();
                Label35.Text = row.Cells[3].Text;
            }
            catch
            {
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('工序名有重复,请手动选择工序!')", true);
            }

            Label31.Text    = "修改";
            Panel41.Visible = true;
            Panel5.Visible  = false;
            Panel51.Visible = false;
            Panel52.Visible = false;
            Panel53.Visible = false;
            Panel6.Visible  = false;
            Panel8.Visible  = false;
            UpdatePanel8.Update();
            UpdatePanel6.Update();
            UpdatePanel5.Update();
            UpdatePanel4.Update();
        }
        if (e.CommandName == "AddMate")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridView3.SelectedIndex = row.RowIndex;
            Guid bdid = new Guid(e.CommandArgument.ToString());
            Label33.Text                = bdid.ToString();
            Label34.Text                = row.Cells[12].Text;
            Label35.Text                = row.Cells[3].Text;
            Label36.Text                = "请选择物料";
            Label37.Text                = "请选择物料";
            TextBox14.Text              = "";
            TextBox15.Text              = "";
            TextBox17.Text              = "";
            TextBox21.Text              = row.Cells[1].Text;
            FuseText.Visible            = true;
            DropDownList4.Visible       = true;
            DropDownList4.SelectedIndex = DropDownList4.Items.IndexOf(DropDownList4.Items.FindByText("否"));
            DropDownList4.Enabled       = true;
            DropDownList3.SelectedIndex = DropDownList3.Items.IndexOf(DropDownList3.Items.FindByText(row.Cells[6].Text));

            Label31.Text    = "新增可替用物料";
            Panel41.Visible = true;
            Panel5.Visible  = false;
            Panel51.Visible = false;
            Panel52.Visible = false;
            Panel53.Visible = false;
            Panel6.Visible  = false;
            Panel8.Visible  = false;
            UpdatePanel8.Update();
            UpdatePanel6.Update();
            UpdatePanel5.Update();
            UpdatePanel4.Update();
        }
        if (e.CommandName == "AddFuse")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridView3.SelectedIndex     = row.RowIndex;
            FuseText.Visible            = true;
            DropDownList4.Visible       = true;
            DropDownList4.SelectedIndex = DropDownList4.Items.IndexOf(DropDownList4.Items.FindByText("是"));
            DropDownList4.Enabled       = false;

            Guid bdid = new Guid(e.CommandArgument.ToString());
            Label33.Text   = bdid.ToString();
            Label34.Text   = row.Cells[12].Text;
            Label35.Text   = row.Cells[3].Text;
            Label36.Text   = "请选择物料";
            Label37.Text   = "请选择物料";
            TextBox14.Text = "";
            TextBox15.Text = "";
            TextBox17.Text = "";
            TextBox21.Text = row.Cells[1].Text;
            FuseID.Text    = row.Cells[14].ToolTip;
            MateID.Text    = row.Cells[19].Text;
            DropDownList3.SelectedIndex = DropDownList3.Items.IndexOf(DropDownList3.Items.FindByText(row.Cells[6].Text));

            Label31.Text = "新增组合物料成员";

            Panel41.Visible = true;
            Panel5.Visible  = false;
            Panel51.Visible = false;
            Panel52.Visible = false;
            Panel53.Visible = false;
            Panel6.Visible  = false;
            Panel8.Visible  = false;
            UpdatePanel8.Update();
            UpdatePanel6.Update();
            UpdatePanel5.Update();
            UpdatePanel4.Update();
        }
        if (e.CommandName == "Delete")
        {
            Guid id = new Guid(e.CommandArgument.ToString());
            bom.Delete_BOMDetail(id);
            Guid BOM_ID = new Guid(Label3.Text);
            GridView3.DataSource = bom.Query_BOMDetail(BOM_ID);
            GridView3.DataBind();
            Panel41.Visible = false;
            Panel5.Visible  = false;
            Panel51.Visible = false;
            Panel6.Visible  = false;
            Panel8.Visible  = false;
            UpdatePanel8.Update();
            UpdatePanel6.Update();
            UpdatePanel5.Update();
            UpdatePanel4.Update();
        }
        if (e.CommandName == "AddPercent")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridView3.SelectedIndex = row.RowIndex;
            Panel8.Visible          = true;
            GridView8.DataSource    = bom.Query_MatePercent(new Guid(e.CommandArgument.ToString()));
            GridView8.DataBind();
            Panel41.Visible = false;
            Panel5.Visible  = false;
            Panel51.Visible = false;
            Panel52.Visible = false;
            Panel53.Visible = false;
            Panel6.Visible  = false;
            UpdatePanel6.Update();
            UpdatePanel5.Update();
            UpdatePanel4.Update();
            UpdatePanel8.Update();
        }
        if (e.CommandName == "history")
        {
            GridView10.DataSource = bom.Query_BOMDetailHistory(new Guid(e.CommandArgument.ToString()));
            GridView10.DataBind();
            Panel10.Visible = true;
            UpdatePanel10.Update();
        }
    }