protected void Button200_Click(object sender, EventArgs e)
        {
            Model.Position delete = new Model.Position();
            int            x      = Convert.ToInt32(Session["e"]);

            delete.PositionNum = GridView1.Rows[x].Cells[1].Text;
            Warehouse.Tools.queryV qu = new Tools.queryV();
            Warehouse.Tools.apartV qp = new Tools.apartV();
            string chestNum           = qu.query("select chestNum from Position where PositionNum='" + delete.PositionNum + "' ");
            string positionM          = qu.query("select M from Position where PositionNum='" + delete.PositionNum + "' ");
            string M  = qu.query("select M from Chest where chestNum='" + chestNum + "' ");
            bool   yy = new DAL.PositionDAO().deletePositionByNum(delete.PositionNum);

            if (yy)
            {
                Warehouse.Tools.updateChestM up = new Tools.updateChestM();
                double bb = (Convert.ToDouble(qp.apart(M)) + Convert.ToDouble(qp.apart(positionM)));
                up.update((bb.ToString() + "平方米"), chestNum);
                ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('删除成功!');", true);
                ideas.Style["display"] = "none";
                pg.Refresh("select num,positionNum,chestNum,roomNum,positionTypeId,goodsTypes,M,remark from Position", "positionNum", GridView1);
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('删除失败!');", true);
                ideas.Style["display"] = "none";
            }
        }
Beispiel #2
0
        protected void TextBox333_TextChanged(object sender, EventArgs e)
        {
            Warehouse.Tools.queryV qu = new Tools.queryV();
            int a = Convert.ToInt32(qu.query("select count(*) from Chest where roomNum='" + TextBox13.Text + "'"));

            Warehouse.Tools.toos1 to = new Tools.toos1();
            int M = Convert.ToInt32(qu.query("select M from Room where roomNum='" + TextBox13.Text + "'"));
            int m = to.query(TextBox13.Text);
            int c = Convert.ToInt32(quu.tiqu(TextBox12.Text));

            if (c < M - m)
            {
                Image3.Visible  = true;
                Image3.ImageUrl = "~/Image/对号.png";
                Label1.Visible  = false;
                TextBox12.Text  = TextBox12.Text + "m²";
                this.TextBox2.Focus();
            }
            else
            {
                Image3.Visible  = true;
                Image3.ImageUrl = "~/Image/对号.png";
                Label1.Visible  = false;
                TextBox12.Text  = (M - m).ToString();
                TextBox12.Text  = TextBox12.Text + "m²";
                this.TextBox12.Focus();
            }
        }
 protected void TextBox12_TextChanged(object sender, EventArgs e)
 {
     TextBox9.Text  = "";
     Image2.Visible = false;
     Warehouse.Tools.queryV qu = new Tools.queryV();
     if (Convert.ToInt32(qu.query("select count(*) from Goods where goodsName='" + TextBox12.Text + "'")) == 0)
     {
         if (TextBox12.Text == "")
         {
             Image3.Visible  = true;
             Image3.ImageUrl = "~/Image/错号.png";
         }
         else
         {
             Image3.Visible  = true;
             Image3.ImageUrl = "~/Image/对号.png";
         }
     }
     else
     {
         Image3.Visible  = true;
         Image3.ImageUrl = "~/Image/错号.png";
         ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('没有此物品信息,请重新输入或前往添加该物品!');", true);
         TextBox12.Text = "";
     }
 }
        protected void Button9_Click(object sender, EventArgs e)
        {
            TextBox9.Text   = ListBox5.SelectedItem.Value;
            Image2.Visible  = true;
            Image2.ImageUrl = "~/Image/对号.png";
            Warehouse.Tools.queryV qu = new Tools.queryV();
            string m  = qu.query("select count(*) from Goods where goodsTypeNum='" + TextBox9.Text + "'");
            string mm = (Convert.ToInt32(m) + 1).ToString();

            if (mm.Length == 1)
            {
                mm = "000" + mm;
            }
            else if (mm.Length == 2)
            {
                mm = "00" + mm;
            }
            else if (mm.Length == 3)
            {
                mm = "0" + mm;
            }
            TextBox11.Text  = TextBox9.Text + mm;
            Image1.Visible  = true;
            Image1.ImageUrl = "~/Image/对号.png";
        }
 protected void TextBox12_TextChanged(object sender, EventArgs e)
 {
     Warehouse.Tools.queryV qu = new Tools.queryV();
     if (Convert.ToInt32(qu.query("select count(*) from Goods where goodsName='" + TextBox12.Text + "'")) == 0)
     {
         if (TextBox12.Text == "")
         {
             Image3.Visible  = true;
             Image3.ImageUrl = "~/Image/错号.png";
             Label3.Visible  = true;
         }
         else
         {
             Image3.Visible  = true;
             Image3.ImageUrl = "~/Image/对号.png";
             Label3.Visible  = false;
         }
     }
     else
     {
         Image3.Visible  = true;
         Image3.ImageUrl = "~/Image/错号.png";
         Label3.Visible  = true;
         Label3.Text     = "您的物品名称已存在,请重新输入";
         TextBox12.Text  = "";
     }
 }
Beispiel #6
0
        protected void TextBox334_TextChanged(object sender, EventArgs e)
        {
            Warehouse.Tools.queryV qu = new Tools.queryV();
            int M = Convert.ToInt32(qu.query("select Height from Room where roomNum='" + TextBox13.Text + "'"));
            int c = Convert.ToInt32(quu.tiqu(TextBox2.Text));

            if (c < M)
            {
                Image6.Visible  = true;
                Image6.ImageUrl = "~/Image/对号.png";
                Label7.Visible  = false;
                TextBox2.Text   = TextBox2.Text + "m";
            }
            else
            {
                Image6.Visible  = true;
                Image6.ImageUrl = "~/Image/对号.png";
                Label7.Visible  = false;
                TextBox2.Text   = (M).ToString();
                TextBox2.Text   = TextBox2.Text + "m";
            }
        }
        protected void Button6_Click(object sender, EventArgs e)
        {
            switch (Button6.Text)
            {
            case "增加":
            {
                Warehouse.Tools.queryV    qu  = new Tools.queryV();
                Warehouse.Tools.apartV    ap  = new Tools.apartV();
                Warehouse.Tools.tiqushuzi quu = new Tools.tiqushuzi();
                string L = qu.query("select length from PositionType where PositionTypeId='" + TextBox7.Text + "'  ");
                string W = qu.query("select width from PositionType where PositionTypeId='" + TextBox7.Text + "'  ");
                string H = qu.query("select height from PositionType where PositionTypeId='" + TextBox7.Text + "'  ");
                double a = double.Parse(qu.query("select M from Chest where chestNum='" + TextBox2.Text + "'"));
                double b = double.Parse(qu.query("select Height from Chest where chestNum='" + TextBox2.Text + "'"));
                double c = a * b - new Warehouse.Tools.positionSum().Sum(TextBox2.Text);
                if ((quu.tiqu(L) * quu.tiqu(W) * (quu.tiqu(H)) < c))
                {
                    try
                    {
                        DAL.Query      nn  = new DAL.Query();
                        int            n   = nn.query("position");
                        string         nnn = "";
                        Model.Position add = new Model.Position();
                        add.Num            = (n + 1).ToString();
                        add.PositionNum    = TextBox1.Text;
                        add.ChestNum       = TextBox2.Text;
                        add.RoomNum        = TextBox3.Text;
                        add.PositiontypeId = TextBox7.Text;
                        add.M      = (Convert.ToDouble(ap.apart(L)) * Convert.ToDouble(ap.apart(W))).ToString();
                        add.Height = (Convert.ToDouble(ap.apart(H))).ToString();
                        Warehouse.Tools.tiqushuzi tiqu = new Tools.tiqushuzi();
                        add.Rest = (tiqu.tiqu(add.M) * tiqu.tiqu(add.Height)).ToString();
                        for (int i = 0; i < ListBox3.Items.Count; i++)
                        {
                            if (nnn == "")
                            {
                                nnn += ListBox3.Items[i].Text;
                            }
                            else
                            {
                                nnn += "、" + ListBox3.Items[i].Text;
                            }
                        }
                        add.GoodsTypes = nnn;
                        add.Remark     = TextBox6.Text;
                        add.CreateTime = DateTime.Now;
                        add.UpdateTime = DateTime.Now;
                        bool xx = new DAL.PositionDAO().addPosition(add);
                        //if (xx == true)
                        //{
                        //    double kk = Convert.ToDouble(ap.apart(qu.query("select M from Chest where chestNum='" + TextBox2.Text + "' "))) - (Convert.ToDouble(ap.apart(L)) * Convert.ToDouble(ap.apart(W)));
                        //    Warehouse.Tools.updateChestM up = new Tools.updateChestM();
                        //    up.update(kk + "m²", TextBox2.Text);
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加成功!');window.location.href='管理库位.aspx'", true);
                        //}
                    }
                    catch
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加失败!');", true);
                    }
                }
                else
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加失败,最大体积为" + (a * b - new Warehouse.Tools.positionSum().Sum(TextBox1.Text)) + "!');", true);
                }
            }
            break;

            case "确定":
            {
                Button         btn    = sender as Button;
                Model.Position update = new Model.Position();
                update.PositionNum    = TextBox1.Text;
                update.ChestNum       = TextBox2.Text;
                update.RoomNum        = TextBox3.Text;
                update.PositiontypeId = TextBox7.Text;
                string nnn = "";
                for (int bbb = 0; bbb < ListBox3.Items.Count; bbb++)
                {
                    if (nnn == "")
                    {
                        nnn += ListBox3.Items[bbb].Text;
                    }
                    else
                    {
                        nnn += "、" + ListBox3.Items[bbb].Text;
                    }
                }
                update.GoodsTypes = nnn;
                update.Remark     = TextBox6.Text;
                update.UpdateTime = DateTime.Now;
                bool xx = new DAL.PositionDAO().updatePosition(update);
                if (xx)
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('修改成功!');", true);
                    pg.Refresh("select num,positionNum,chestNum,roomNum,positionTypeId,goodsTypes,M,remark from Position", "positionNum", GridView1);
                }
                else
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('修改失败!');", true);
                }
            }
            break;
            }
        }
        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);
                }
            }
        }