예제 #1
0
 protected void Button77_Click(object sender, EventArgs e)
 {
     Div1.Visible      = false;
     GridView1.Visible = true;
     if (GridView1.Visible == true)
     {
         Button1.Visible   = true;
         Button4.Visible   = true;
         ListBox11.Visible = true;
         TextBox1.Visible  = true;
         Button5.Visible   = true;
     }
     Warehouse.TextBox_Clear te = new TextBox_Clear();
     te.clear(this.Div1);
     Response.Redirect(Request.Url.ToString());
     rg.Refresh("select * from Inin order by num", "inID", GridView1);
 }
예제 #2
0
        protected void Button66_Click(object sender, EventArgs e)
        {
            if (Button66.Text == "增加")
            {
                if (Image1.ImageUrl == "~/Image/对号.png" && Image2.ImageUrl == "~/Image/对号.png" && Image3.ImageUrl == "~/Image/对号.png" && Image4.ImageUrl == "~/Image/对号.png" && Image5.ImageUrl == "~/Image/对号.png" && Image6.ImageUrl == "~/Image/对号.png" && Image7.ImageUrl == "~/Image/对号.png" && Image8.ImageUrl == "~/Image/对号.png")
                {
                    Warehouse.Tools.queryV qq  = new Tools.queryV();
                    Model.Inin             add = new Model.Inin();
                    DAL.Query qu = new DAL.Query();
                    int       n  = qu.query("Inin");
                    add.Num         = n + 1;
                    add.InID        = TextBox11.Text;
                    add.PositionNum = TextBox9.Text;
                    add.GoodsNum    = TextBox12.Text;
                    add.InAmount    = double.Parse(TextBox2.Text);
                    add.V           = (Convert.ToDouble(tiqu.tiqu(TextBox2.Text)) * Convert.ToDouble(tiqu.tiqu(TextBox7.Text))).ToString();
                    add.BatchNum    = TextBox3.Text;
                    add.Date        = DateTime.Now;
                    add.UserId      = TextBox5.Text;
                    add.Remark      = TextBox6.Text;
                    bool xx = new DAL.IninDAO().addIn(add);
                    if (xx)
                    {
                        if ((Convert.ToInt32(new Warehouse.Tools.queryV().query("select count(*) from Amount where goodsNum='" + add.GoodsNum + "' and PositionNum ='" + add.PositionNum + "' ")) > 0) && (Convert.ToInt32(new Warehouse.Tools.queryV().query("select count(*) from Amount where Vp='" + (tiqu.tiqu(TextBox7.Text)).ToString() + "' "))) > 0)
                        {
                            Model.Amount addd = new Model.Amount();
                            addd.Num         = Convert.ToInt32(new Warehouse.Tools.queryV().query("select count(*) from Amount where 1=1 ")) + 1;
                            addd.GoodsNum    = add.GoodsNum;
                            addd.PositionNum = add.PositionNum;
                            addd.Vp          = (tiqu.tiqu(TextBox7.Text)).ToString();
                            addd.Amounts     = add.InAmount + Convert.ToDouble(new Warehouse.Tools.queryV().query("select amount from Amount where goodsNum='" + add.GoodsNum + "' and PositionNum ='" + add.PositionNum + "' "));
                            switch (new Warehouse.Tools.queryV().query("select goodsStyle from Goods where goodsNum='" + add.GoodsNum + "'").ToString())
                            {
                            case "固态": addd.AmountPer = "Kg"; break;

                            case "液态": addd.AmountPer = "L"; break;

                            case "气态": addd.AmountPer = "L"; break;

                            case "其他": addd.AmountPer = "Kg"; break;
                            }
                            addd.V = (Convert.ToDouble(new Warehouse.Tools.queryV().query("select V from Amount where goodsNum='" + add.GoodsNum + "' and PositionNum ='" + add.PositionNum + "' ")) + (Convert.ToDouble(TextBox2.Text) * Convert.ToDouble(tiqu.tiqu(TextBox7.Text)))).ToString();
                            new DAL.AmountDAO().updateAmount(addd);
                        }
                        else
                        {
                            Model.Amount addd = new Model.Amount();
                            addd.Num         = Convert.ToInt32(new Warehouse.Tools.queryV().query("select count(*) from Amount where 1=1 ")) + 1;
                            addd.GoodsNum    = add.GoodsNum;
                            addd.PositionNum = add.PositionNum;
                            addd.Amounts     = add.InAmount;
                            switch (new Warehouse.Tools.queryV().query("select goodsStyle from Goods where goodsNum='" + add.GoodsNum + "' ").ToString())
                            {
                            case "固态": addd.AmountPer = "Kg"; break;

                            case "液态": addd.AmountPer = "L"; break;

                            case "气态": addd.AmountPer = "L"; break;

                            case "其他": addd.AmountPer = "Kg"; break;
                            }
                            addd.Vp = (tiqu.tiqu(TextBox7.Text)).ToString();
                            addd.V  = (Convert.ToDouble(tiqu.tiqu(TextBox2.Text)) * Convert.ToDouble(tiqu.tiqu(TextBox7.Text))).ToString();
                            new DAL.AmountDAO().addAmount(addd);
                        }
                        Warehouse.Tools.update up = new Tools.update();
                        double xxxx1 = (tiqu.tiqu(TextBox7.Text) * (tiqu.tiqu(TextBox2.Text)));
                        double xxxx2 = tiqu.tiqu(qq.query("select Rest from Position where positionNum='" + TextBox9.Text + "' "));
                        string rest  = (xxxx2 - xxxx1).ToString();
                        up.updates("update Position set Rest='" + rest + "' where positionNum='" + TextBox9.Text + "' ");
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加成功!');", true);
                        Div1.Visible      = false;
                        GridView1.Visible = true;
                        if (GridView1.Visible == true)
                        {
                            Button1.Visible   = true;
                            Button4.Visible   = true;
                            ListBox11.Visible = true;
                            TextBox1.Visible  = true;
                            Button5.Visible   = true;
                        }
                        rg.Refresh("select * from Inin order by num", "inID", GridView1);
                        Warehouse.TextBox_Clear tx = new TextBox_Clear();
                        tx.clear(Div1);
                    }
                    else
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加失败!');", true);
                    }
                }
                else
                {
                    Response.Write("<script>window.location.href='#div_kkk'</script>");
                }
            }
            else if (Button66.Text == "确定")
            {
                Model.Inin add = new Model.Inin();
                add.InID        = TextBox11.Text;
                add.PositionNum = TextBox9.Text;
                add.GoodsNum    = TextBox12.Text;
                add.InAmount    = Int32.Parse(TextBox2.Text);
                add.BatchNum    = TextBox3.Text;
                add.Date        = DateTime.Now;
                add.UserId      = TextBox5.Text;
                add.Remark      = TextBox6.Text;
                bool xx = new DAL.IninDAO().updateIn(add);
                if (xx)
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('修改成功!');", true);
                    Div1.Visible      = false;
                    GridView1.Visible = true;
                    if (GridView1.Visible == true)
                    {
                        Button1.Visible   = true;
                        Button4.Visible   = true;
                        ListBox11.Visible = true;
                        TextBox1.Visible  = true;
                        Button5.Visible   = true;
                    }
                    rg.Refresh("select * from Inin order by num", "inID", GridView1);
                }
                else
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('修改失败!');", true);
                }
            }
        }