Example #1
0
        public static PMPAudit ExecuteReturnAuditQuery(string connectionString, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
        {
            SqlCommand cmd = new SqlCommand();

            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                PrepareCommand(cmd, conn, null, cmdType, cmdText, commandParameters);
                int      val = cmd.ExecuteNonQuery();
                PMPAudit au  = new PMPAudit();
                au.PMP_MFDepSignSuggestion1 = commandParameters[1].Value.ToString();
                au.PMP_MFDepSignMan1        = commandParameters[2].Value.ToString();
                au.PMP_MFDepSignTime1       = commandParameters[3].Value.ToString();
                au.PMP_MFDepSignResult1     = commandParameters[4].Value.ToString();
                au.PMP_MBossSignSuggestion1 = commandParameters[5].Value.ToString();
                au.PMP_MBossSignMan1        = commandParameters[6].Value.ToString();
                au.PMP_MBossSignTime1       = commandParameters[7].Value.ToString();
                au.PMP_MBossSignResult1     = commandParameters[8].Value.ToString();
                au.PMP_MPDepSignSuggestion1 = commandParameters[9].Value.ToString();
                au.PMP_MPDepSignMan1        = commandParameters[10].Value.ToString();
                au.PMP_MPDepSignTime1       = commandParameters[11].Value.ToString();
                au.PMP_MPDepSignResult1     = commandParameters[12].Value.ToString();


                return(au);
            }
        }
Example #2
0
    public PMPAudit getAudit()
    {
        PMPAudit au = new PMPAudit();

        au.PMP_MBossSignMan1        = PMP_MBossSignMan1;
        au.PMP_MBossSignResult1     = PMP_MBossSignResult1;
        au.PMP_MBossSignSuggestion1 = PMP_MBossSignSuggestion1;
        au.PMP_MBossSignTime1       = PMP_MBossSignTime1;
        au.PMP_MFDepSignMan1        = PMP_MFDepSignMan1;
        au.PMP_MFDepSignResult1     = PMP_MFDepSignResult1;
        au.PMP_MFDepSignSuggestion1 = PMP_MFDepSignSuggestion1;
        au.PMP_MFDepSignTime1       = PMP_MFDepSignTime1;
        au.PMP_MPDepSignMan1        = PMP_MPDepSignMan1;
        au.PMP_MPDepSignResult1     = PMP_MPDepSignResult1;
        au.PMP_MPDepSignSuggestion1 = PMP_MPDepSignSuggestion1;
        au.PMP_MPDepSignTime1       = PMP_MPDepSignTime1;
        return(au);
    }
Example #3
0
    public PMPAudit Query_Audit(Guid id)
    {
        SqlParameter[] para =
        {
            new SqlParameter("@PMP_ID",                  SqlDbType.UniqueIdentifier),
            new SqlParameter("@PMP_MFDepSignSuggestion", SqlDbType.VarChar,           400),
            new SqlParameter("@PMP_MFDepSignMan",        SqlDbType.VarChar,            20),
            new SqlParameter("@PMP_MFDepSignTime",       SqlDbType.DateTime),
            new SqlParameter("@PMP_MFDepSignResult",     SqlDbType.VarChar,            20),
            new SqlParameter("@PMP_MBossSignSuggestion", SqlDbType.VarChar,           400),
            new SqlParameter("@PMP_MBossSignMan",        SqlDbType.VarChar,            20),
            new SqlParameter("@PMP_MBossSignTime",       SqlDbType.DateTime),
            new SqlParameter("@PMP_MBossSignResult",     SqlDbType.VarChar,            20),
            new SqlParameter("@PMP_MPDepSignSuggestion", SqlDbType.VarChar,           400),
            new SqlParameter("@PMP_MPDepSignMan",        SqlDbType.VarChar,            20),
            new SqlParameter("@PMP_MPDepSignTime",       SqlDbType.DateTime),
            new SqlParameter("@PMP_MPDepSignResult",     SqlDbType.VarChar, 20)
        };
        para[0].Value      = id;
        para[1].Direction  = ParameterDirection.Output;
        para[2].Direction  = ParameterDirection.Output;
        para[3].Direction  = ParameterDirection.Output;
        para[4].Direction  = ParameterDirection.Output;
        para[5].Direction  = ParameterDirection.Output;
        para[6].Direction  = ParameterDirection.Output;
        para[7].Direction  = ParameterDirection.Output;
        para[8].Direction  = ParameterDirection.Output;
        para[9].Direction  = ParameterDirection.Output;
        para[10].Direction = ParameterDirection.Output;
        para[11].Direction = ParameterDirection.Output;
        para[12].Direction = ParameterDirection.Output;
        PMPAudit au = SqlHelper.ExecuteReturnAuditQuery(SqlHelper.ConnectionStringLocalTransaction,
                                                        CommandType.StoredProcedure, "Proc_S_PMPAudit", para);

        return(au);
    }
Example #4
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Details")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            if (row.Cells[9].Text == "已建立")
            {
                GridView1.SelectedIndex = row.RowIndex;
                Button4.Visible         = false;
                Panel3.Visible          = true;
                Guid pmpid = new Guid(e.CommandArgument.ToString());
                Label14.Text         = pmpid.ToString();
                GridView2.DataSource = mp.Query_MPlanDetail(pmpid);
                //GridView1.DataSource = mp.Query_MPlan(syear, smonth, state,Convert.ToInt32(Linenum.Text));
                GridView2.DataBind();
                Label10.Text = "查看";
                Label11.Text = row.Cells[2].Text;
                Label12.Text = row.Cells[3].Text;

                Panel4.Visible  = false;
                Panel5.Visible  = false;
                Panel6.Visible  = false;
                Panel7.Visible  = false;
                Panel31.Visible = false;
                GridView2.Columns[12].Visible = false;

                GridView2.SelectedIndex = -1;
            }
            else
            {
                GridView1.SelectedIndex = row.RowIndex;
                Button4.Visible         = false;
                Panel3.Visible          = true;
                Guid pmpid = new Guid(e.CommandArgument.ToString());
                Label14.Text         = pmpid.ToString();
                GridView2.DataSource = mp.Query_MPlanDetailFlash(pmpid);
                //GridView1.DataSource = mp.Query_MPlan(syear, smonth, state,Convert.ToInt32(Linenum.Text));
                GridView2.DataBind();
                Label10.Text = "查看";
                Label11.Text = row.Cells[2].Text;
                Label12.Text = row.Cells[3].Text;

                Panel4.Visible  = false;
                Panel5.Visible  = false;
                Panel6.Visible  = false;
                Panel7.Visible  = false;
                Panel31.Visible = false;
                GridView2.Columns[12].Visible = false;

                GridView2.SelectedIndex = -1;
            }
        }
        if (e.CommandName == "Make")
        {
            Panel31.Visible = true;
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridView1.SelectedIndex = row.RowIndex;
            if (row.Cells[9].Text == "未建立")
            {
                Label10.Text    = "制定";
                Label11.Text    = row.Cells[2].Text;
                Label12.Text    = row.Cells[3].Text;
                Panel3.Visible  = true;
                Salesid         = new Guid(e.CommandArgument.ToString());
                Label13.Text    = Salesid.ToString();
                Button4.Visible = true;
                TextBox6.Text   = "";
                TextBox7.Text   = "";
                string add;
                if (Label10.Text == "制定")
                {
                    add = "否";
                }
                else
                {
                    add = "是";
                }
                Panel4.Visible = false;
                Panel5.Visible = false;
                Panel6.Visible = false;
                Panel7.Visible = false;
                int    year     = int.Parse(Label11.Text);
                int    month    = int.Parse(Label12.Text);
                string man      = Session["UserName"].ToString();
                string makedate = DateTime.Now.ToString("yyyy-MM-dd");
                GridView2.Columns[11].Visible = true;
                GridView2.Columns[10].Visible = true;
                Guid sid   = new Guid(Label13.Text);
                Guid pmpid = mp.Insert_PMP(sid, year, month, man, makedate, null, null, add, Convert.ToInt32(Linenum.Text));
                Label14.Text = pmpid.ToString();
                mp.UpdatePlanState(pmpid);

                GridView2.DataSource = mp.Query_MPlanDetail(new Guid(Label14.Text));
                GridView2.DataBind();
                GridView1.DataSource = mp.Query_MPlan(syear, smonth, state, Convert.ToInt32(Linenum.Text));
                GridView1.DataBind();
                GridView2.SelectedIndex = -1;
            }
            else
            {
                GridView2.Columns[11].Visible = true;
                GridView2.Columns[12].Visible = true;
                Button4.Visible = false;
                Panel3.Visible  = true;
                Guid pmpid = new Guid(row.Cells[1].Text);
                Label14.Text         = pmpid.ToString();
                GridView2.DataSource = mp.Query_MPlanDetail(pmpid);
                GridView2.DataBind();
                Label10.Text    = "查看";
                Label11.Text    = row.Cells[2].Text;
                Label12.Text    = row.Cells[3].Text;
                Panel4.Visible  = false;
                Panel5.Visible  = false;
                Panel6.Visible  = false;
                Panel7.Visible  = false;
                Panel31.Visible = false;

                Button4.Visible = true;
                Panel31.Visible = true;


                GridView2.SelectedIndex = -1;
            }
        }
        if (e.CommandName == "Audit")
        {
            GridView2.Columns[8].Visible = false;
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridView1.SelectedIndex = row.RowIndex;
            Panel3.Visible          = true;
            MMPid = new Guid(e.CommandArgument.ToString());

            GridView2.DataSource = mp.Query_MPlanDetail(MMPid);
            GridView2.DataBind();
            GridView1.DataSource = mp.Query_MPlan(syear, smonth, state, Convert.ToInt32(Linenum.Text));
            Panel3.Visible       = false;
            Panel32.Visible      = false;
            Panel4.Visible       = false;
            Panel5.Enabled       = false;
            Panel6.Enabled       = false;
            Panel7.Enabled       = false;
            Button4.Visible      = false;
            if (Session["UserRole"].ToString().Contains("材料月计划审核生产部"))
            {
                Panel5.Enabled = true;
            }
            if (Session["UserRole"].ToString().Contains("材料月计划审核财务部"))
            {
                Panel6.Enabled = true;
            }
            if (Session["UserRole"].ToString().Contains("材料月计划审核副总"))
            {
                Panel7.Enabled = true;
            }
            Panel5.Visible = true;
            Panel6.Visible = true;
            Panel7.Visible = true;
            Label11.Text   = row.Cells[2].Text;
            Label12.Text   = row.Cells[3].Text;
            PMPAudit au = new PMPAudit();
            au          = mp.Query_Audit(MMPid);
            Label1.Text = au.PMP_MPDepSignMan1.ToString();
            Label2.Text = au.PMP_MPDepSignTime1.ToString();
            if (Label2.Text != "")
            {
                Label2.Text = Convert.ToDateTime(Label2.Text).ToString("yyyy-MM-dd HH:mm");
            }

            TextBox3.Text = au.PMP_MPDepSignSuggestion1.ToString();
            Label3.Text   = au.PMP_MPDepSignResult1.ToString();
            Label4.Text   = au.PMP_MFDepSignMan1.ToString();
            Label5.Text   = au.PMP_MFDepSignTime1.ToString();
            if (Label5.Text != "")
            {
                Label5.Text = Convert.ToDateTime(Label5.Text).ToString("yyyy-MM-dd HH:mm");
            }

            Label6.Text   = au.PMP_MFDepSignResult1.ToString();
            TextBox4.Text = au.PMP_MFDepSignSuggestion1.ToString();
            Label7.Text   = au.PMP_MBossSignMan1.ToString();
            Label8.Text   = au.PMP_MBossSignTime1.ToString();
            if (Label8.Text != "")
            {
                Label8.Text = Convert.ToDateTime(Label8.Text).ToString("yyyy-MM-dd HH:mm");
            }
            Label9.Text   = au.PMP_MBossSignResult1.ToString();
            TextBox5.Text = au.PMP_MBossSignSuggestion1.ToString();
            if (Label3.Text == "")
            {
                Label3.Text      = "尚未会签";
                P1.Visible       = true;
                TextBox3.Enabled = true;
            }
            else
            {
                TextBox3.Enabled = false;
                P1.Visible       = false;
            }
            if (Label3.Text == "审核驳回")
            {
                Label3.ForeColor = Color.FromName("#f64a80");
            }
            if (Label3.Text == "审核通过")
            {
                Label3.ForeColor = Color.FromName("#34b2e1");
            }

            if (Label6.Text == "")
            {
                Label6.Text      = "尚未会签";
                P2.Visible       = true;
                TextBox4.Enabled = true;
            }
            else
            {
                TextBox4.Enabled = false;
                P2.Visible       = false;
            }
            if (Label6.Text == "审核驳回")
            {
                Label6.ForeColor = Color.FromName("#f64a80");
            }
            if (Label6.Text == "审核通过")
            {
                Label6.ForeColor = Color.FromName("#34b2e1");
            }
            if (Label9.Text == "")
            {
                Label9.Text      = "尚未会签";
                P3.Visible       = true;
                TextBox5.Enabled = true;
            }
            else
            {
                TextBox5.Enabled = false;
                P3.Visible       = false;
            }
            if (Label9.Text == "审核驳回")
            {
                Label9.ForeColor = Color.FromName("#f64a80");
            }
            if (Label9.Text == "审核通过")
            {
                Label9.ForeColor = Color.FromName("#34b2e1");
            }
        }
        if (e.CommandName == "Bonus")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;

            int check = mp.CheckAddAvailable(int.Parse(row.Cells[2].Text), int.Parse(row.Cells[3].Text));
            if (check < 1)
            {
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('现在不需要新增材料月计划,所有生产计划都已分配材料!')", true);
            }
            else
            {
                Panel4.Visible          = false;
                Panel5.Visible          = false;
                Panel6.Visible          = false;
                Panel7.Visible          = false;
                GridView2.SelectedIndex = -1;


                Panel31.Visible = true;

                GridView1.SelectedIndex = -1;

                Label10.Text                 = "新增";
                Label11.Text                 = row.Cells[2].Text;
                Label12.Text                 = row.Cells[3].Text;
                Panel3.Visible               = true;
                Salesid                      = new Guid(e.CommandArgument.ToString());
                GridView1.DataSource         = mp.Query_MPlan(syear, smonth, state, Convert.ToInt32(Linenum.Text));
                GridView2.Columns[7].Visible = true;
                GridView2.Columns[8].Visible = true;
                Label13.Text                 = Salesid.ToString();
                Button4.Visible              = true;
                TextBox6.Text                = "";
                TextBox7.Text                = "";


                string add = "是";

                Panel4.Visible = false;
                Panel5.Visible = false;
                Panel6.Visible = false;
                Panel7.Visible = false;
                int    year     = int.Parse(Label11.Text);
                int    month    = int.Parse(Label12.Text);
                string man      = Session["UserName"].ToString();
                string makedate = DateTime.Now.ToString("yyyy-MM-dd");

                Guid sid   = new Guid(Label13.Text);
                Guid pmpid = mp.Insert_PMP_add(sid, year, month, man, makedate, null, null, add, Convert.ToInt32(Linenum.Text));

                Label14.Text         = pmpid.ToString();
                GridView2.DataSource = mp.Query_MPlanDetail(new Guid(Label14.Text));
                GridView2.DataBind();
                GridView1.DataSource = mp.Query_MPlan(syear, smonth, state, Convert.ToInt32(Linenum.Text));
                GridView1.DataBind();
                GridView2.SelectedIndex = -1;
                mp.UpdatePlanState_New(pmpid);
            }
        }
    }