Exemplo n.º 1
0
    protected void Button4_Click(object sender, EventArgs e)
    {
        int lnindex = ((GridViewRow)((Button)sender).NamingContainer).RowIndex;
        //int num = 0;
        string  part     = "";
        string  wlmc     = "";
        string  ggxh     = "";
        string  unit     = "";
        string  comp     = "";
        int     sftnum   = 0;
        decimal quantity = 0;
        string  loc      = "";

        part     = GridView1.Rows[lnindex].Cells[0].Text.ToString();
        wlmc     = GridView1.Rows[lnindex].Cells[1].Text.ToString();
        ggxh     = GridView1.Rows[lnindex].Cells[2].Text.ToString();
        unit     = GridView1.Rows[lnindex].Cells[3].Text.ToString();
        comp     = GridView1.Rows[lnindex].Cells[5].Text.ToString();
        sftnum   = int.Parse(GridView1.Rows[lnindex].Cells[6].Text.ToString());
        quantity = decimal.Parse(GridView1.Rows[lnindex].Cells[4].Text.ToString());
        loc      = GridView1.Rows[lnindex].Cells[7].Text.ToString();
        Car Car = new Car();

        if (quantity == 0)
        {
            Response.Write("<script>javascript:alert('库存数量为0,无法领料!')</script>");
            return;
        }
        int i = Car.ADD_TOCar(1, "", part, wlmc, ggxh, "", "", "", unit, 1, Session["UserLoginName"].ToString(), comp, sftnum, "", "", "", "", "", quantity, loc, "", "", DropDownList2.SelectedValue);

        if (i >= 1)
        {
            Response.Write("<script>javascript:alert('加入领料车成功!')</script>");
            //((Image)this.GridView1.Rows[lnindex].FindControl("Image1")).Visible = true;
        }
    }
Exemplo n.º 2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (ddlposition.SelectedValue == "" || drop_lycp.SelectedItem.Text == "")
        {
            Response.Write("<script>javascript:alert('领用位置和产品必须选择!')</script>");
            return;
        }
        string group_part = "";
        string part       = "";
        string desc1      = "";
        string desc2      = "";
        string ljh        = "";
        string unit       = "";
        string comp       = Getcomp().Rows[0][1].ToString();
        int    sftnum     = 0;
        int    quantity   = 0;
        string bb         = "";
        string gxh        = "";
        bool   flag       = false;
        string loc        = "";
        //string lycp = txt_lycp.Text.ToString();
        string lycp = drop_lycp.SelectedItem.Text;

        ljh = txt_ljh.Text.ToString();
        string pgixmh   = "";
        string position = ddlposition.SelectedValue;
        string yjlyrq   = txtyjly_date.Text;
        string type     = DropDownList1.SelectedValue;
        string yfxm     = txt_yfxm.Text;
        string status   = txt_status.Text;
        string dept     = Getcomp().Rows[0][0].ToString();
        //lycp = txt_lycp_tz.Text != "" ? txt_lycp_tz.Text : lycp;
        string tz_ljh = "";

        if (txt_lycp_tz.Text != "")
        {
            lycp = txt_lycp_tz.Text;
            //StringBuilder sql = new StringBuilder();
            //sql.Append(" SELECT TOP 1 pt_desc1,PT_STATUS,pt_prod_line FROM qad_pt_mstr WHERE  pt_prod_line LIKE '3%'   ");
            //sql.Append(" and pt_part = '" + txt_lycp_tz.Text.TrimEnd() + "' AND pt_prod_line IN ( select cpline from [paperless_yfxm] )");
            //DataSet ds = SQLHelper.reDs(sql.ToString());
            string strsql = "select A.*,pt_status,PT.pt_desc1 from (";
            strsql += "    select '" + lycp + "' as pt_part,'" + comp + "' AS domain,* from [dbo].[paperless_yfxm]  WHERE cpline=(select pt_prod_line from Qad_pt_mstr where pt_part ='" + lycp + "' and domain='" + comp + "' ))A";
            strsql += "    join Qad_pt_mstr pt on a.pt_part=pt.pt_part and a.domain=pt.domain";
            //DataTable dt = SQLHelper.reDs(strsql).Tables[0];
            DataSet ds = SQLHelper.reDs(strsql.ToString());
            if (ds.Tables[0].Rows.Count > 0)
            {
                tz_ljh = ds.Tables[0].Rows[0][6].ToString();
                status = ds.Tables[0].Rows[0][5].ToString();
                // yfxm = ds.Tables[0].Rows[0][3].ToString();
                if ((dept.Contains("工程") || dept.Contains("压铸技术部")) && status.ToUpper() == "SAMPLE" && comp == "200")
                {
                    yfxm = ds.Tables[0].Rows[0][3].ToString();
                }
                else
                {
                    yfxm = "";
                }
            }
            else
            {
                Response.Write("<script>javascript:alert('请填写正确项目号!')</script>");
                return;
            }
        }
        DataTable dt = (DataTable)Session["dt"];

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            group_part = txt_lycp_tz.Text != ""?"": dt.Rows[i]["pt_group_part"].ToString();
            part       = dt.Rows[i]["pt_part"].ToString();
            desc1      = dt.Rows[i]["pt_desc1"].ToString();
            desc2      = dt.Rows[i]["pt_desc2"].ToString();
            ljh        = tz_ljh != ""?tz_ljh: dt.Rows[i]["LJH"].ToString();
            unit       = dt.Rows[i]["pt_um"].ToString();
            comp       = dt.Rows[i]["pt_domain"].ToString();
            sftnum     = int.Parse(dt.Rows[i]["pt_sfty_stk"].ToString());
            quantity   = int.Parse(dt.Rows[i]["ld_qty_oh"].ToString());
            bb         = dt.Rows[i]["bb"].ToString();
            gxh        = dt.Rows[i]["xzgxh"].ToString();
            loc        = dt.Rows[i]["loc"].ToString().Replace("&nbsp;", "");
            int j = Car.ADD_TOCar(1, group_part, part, desc1, desc2, ljh, gxh, "", unit, 1, Session["UserLoginName"].ToString(), comp, sftnum, lycp.ToUpper(), type, position, bb, yjlyrq, quantity, loc, yfxm, status, "4010");
            flag = true;
        }
        if (flag)
        {
            Response.Write("<script>javascript:alert('加入领料车成功,请至领料车查看!')</script>");
            StringBuilder scriptString = new StringBuilder();
            scriptString.Append("<script language = javascript>");
            //scriptString.Append("window.opener.refresh();");

            //scriptString.Append(" window.focus();");
            //scriptString.Append(" window.opener=null;");
            scriptString.Append(" window.close(); ");

            scriptString.Append("</" + "script>");
            Response.Write(scriptString.ToString());
        }
    }