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"; } }
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 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 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 = ""; } }
protected void Button66_Click(object sender, EventArgs e) { Model.Outout add = new Model.Outout(); 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(); DAL.Query quu = new DAL.Query(); int n = quu.query("Outout"); add.Num = n + 1; add.OuID = TextBox11.Text; add.GoodsNum = TextBox12.Text; add.PositionNum = TextBox9.Text; add.OutAmount = Convert.ToDouble(TextBox2.Text); add.BatchNum = TextBox3.Text; add.Date = Convert.ToDateTime(TextBox4.Text); add.UserId = qu.query("select staffNum from Staff where staffName='" + TextBox5.Text + "'"); add.Remark = TextBox6.Text; bool xx = new DAL.OutoutDAO().addOut(add); if (xx) { Model.Amount update = new Model.Amount(); update.Amounts = Convert.ToDouble(Session["max"].ToString()) - Convert.ToDouble(add.OutAmount); double d = Convert.ToDouble(Session["V"].ToString()) / Convert.ToDouble(Session["max"].ToString()); update.V = (update.Amounts * d).ToString(); update.GoodsNum = TextBox12.Text; update.PositionNum = TextBox9.Text; update.Vp = d.ToString(); bool yy = new DAL.AmountDAO().update(update); if (yy) { double rest = Convert.ToDouble(qu.query("select Rest from Position where positionNum='" + TextBox9.Text + "'")); Model.Position Update = new Model.Position(); Update.Rest = (rest + d * add.OutAmount).ToString(); Update.PositionNum = TextBox9.Text; bool cc = new DAL.PositionDAO().update(Update); } ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加成功!');window.location.href='出库登记.aspx'", true); } } } }
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 Button9_Click(object sender, EventArgs e) { switch (Button9.Text) { case "增加": { Warehouse.Tools.apartV ap = new Tools.apartV(); Warehouse.Tools.queryV qu = new Tools.queryV(); double xxx = new Warehouse.Tools.chestSum().Sum(ListBox2.SelectedItem.Value); double yy = Convert.ToDouble(quu.tiqu(new Warehouse.Tools.queryV().query("select M from Room where roomNum='" + ListBox2.SelectedItem.Value + "'"))) * Convert.ToDouble(quu.tiqu(new Warehouse.Tools.queryV().query("select Height from Room where roomNum='" + ListBox2.SelectedItem.Value + "'"))); if (yy - xxx >= Convert.ToDouble(quu.tiqu(TextBox12.Text)) * Convert.ToDouble(quu.tiqu(TextBox2.Text))) { if (Image1.ImageUrl == "~/Image/对号.png" && Image2.ImageUrl == "~/Image/对号.png" && Image3.ImageUrl == "~/Image/对号.png" && Image4.ImageUrl == "~/Image/对号.png" && Image5.ImageUrl == "~/Image/对号.png") { try { Model.Chest add = new Model.Chest(); DAL.Query nn = new DAL.Query(); int n = nn.query("chest"); add.Num = (n + 1).ToString(); add.ChestNum = TextBox10.Text; add.ChestName = TextBox11.Text; add.M = quu.tiqu(TextBox12.Text).ToString(); add.Height = quu.tiqu(TextBox2.Text).ToString(); add.RoomNum = TextBox13.Text; add.Remark = TextBox14.Text; add.CreateTime = DateTime.Now; add.UpdateTime = DateTime.Now; bool xx = new DAL.ChestDAO().addChest(add); if (xx == true) { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加成功!');", true); Div1.Visible = false; GridView1.Visible = true; rg.Refresh("select * from Chest order by num", "chestNum", GridView1); if (GridView1.Visible == true) { Button1.Visible = true; Button4.Visible = true; Button5.Visible = true; ListBox1.Visible = true; TextBox1.Visible = true; } else if (GridView1.Visible == false) { Button1.Visible = false; Button4.Visible = false; Button5.Visible = false; ListBox1.Visible = false; TextBox1.Visible = false; Div1.Visible = true; } } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加失败!');", true); } } catch { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加失败!');", true); } } else { Response.Write("<script>window.location.href='#div_kkk'</script>"); } } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('可放位置不足,请选择其他房间或总体积小于" + (yy - xxx).ToString() + "!');", true); } } break; case "确定": { Button btn = sender as Button; Model.Chest update = new Chest(); update.ChestNum = TextBox10.Text; update.ChestName = TextBox11.Text; update.M = quu.tiqu(TextBox12.Text).ToString(); update.Height = quu.tiqu(TextBox2.Text).ToString(); update.RoomNum = TextBox13.Text; update.Remark = TextBox14.Text; update.CreateTime = Convert.ToDateTime(TextBox15.Text); update.UpdateTime = DateTime.Now; bool xx = new DAL.ChestDAO().updateChest(update); if (xx && (Image1.ImageUrl == "~/Image/对号.png" && Image2.ImageUrl == "~/Image/对号.png" && Image3.ImageUrl == "~/Image/对号.png" && Image4.ImageUrl == "~/Image/对号.png" && Image5.ImageUrl == "~/Image/对号.png")) { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('修改成功!');", true); Div1.Visible = false; GridView1.Visible = true; rg.Refresh("select * from Chest order by num", "chestNum", GridView1); if (GridView1.Visible == true) { Button1.Visible = true; Button4.Visible = true; Button5.Visible = true; ListBox1.Visible = true; TextBox1.Visible = true; } else if (GridView1.Visible == false) { Button1.Visible = false; Button4.Visible = false; Button5.Visible = false; ListBox1.Visible = false; TextBox1.Visible = false; Div1.Visible = true; } } 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); } } }