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 Button4_Click(object sender, EventArgs e) { bool xx = new DAL.PositionDAO().deleteAllPositions(); if (xx) { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('删除成功!');", true); pg.Refresh("select num,positionNum,chestNum,roomNum,positionTypeId,NgoodsTypes,remark from Position", "positionNum", GridView1); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('删除失败!');", true); } }
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 GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "editt") { pr.Refresh("goodsTypeNum", "goodsTypeName", "Goodstype", ListBox2); Button5.Text = "获取种类"; Button14.Visible = false; int xy = Convert.ToInt32(e.CommandArgument); Div1.Style["display"] = "inline"; Button6.Text = "确定"; GridView1.Visible = false; if (GridView1.Visible == true) { Button1.Visible = true; Button4.Visible = true; Button10.Visible = true; ListBox1.Visible = true; TextBox5.Visible = true; } else if (GridView1.Visible == false) { Button1.Visible = false; Button4.Visible = false; Button10.Visible = false; ListBox1.Visible = false; TextBox5.Visible = false; } TextBox1.Text = GridView1.Rows[xy].Cells[1].Text; Model.Position pos = new DAL.PositionDAO().getPositionByNum(GridView1.Rows[xy].Cells[1].Text); TextBox2.Text = pos.ChestNum; TextBox3.Text = pos.RoomNum; string xx = pos.CreateTime.ToString(); string yy = pos.UpdateTime.ToString(); StringBuilder sb1 = new StringBuilder(); StringBuilder sb2 = new StringBuilder(); foreach (char x in xx) { if (Convert.ToInt32(x) != 32) { sb1.Append(x); } else if (Convert.ToInt32(x) == 32) { break; } } foreach (char x in yy) { if (Convert.ToInt32(x) != 32) { sb2.Append(x); } else if (Convert.ToInt32(x) == 32) { break; } } StringBuilder sb3 = new StringBuilder(); int m = 0; foreach (char ff in pos.GoodsTypes) { if (Convert.ToInt32(ff) == 12289) { m = m + 1; } } m = m + 1; for (int c = 0; c < m; c++) { foreach (char ff in pos.GoodsTypes) { if (Convert.ToInt32(ff) != 96) { sb3.Append(ff); } if (Convert.ToInt32(ff) == 96) { break; } } if (c + 1 == m) { string vbn = pos.GoodsTypes.Substring(0, 6); ListBox3.Items.Add(vbn); sb3.Clear(); } else { string vbnn = pos.GoodsTypes.Substring(0, 6); pos.GoodsTypes = pos.GoodsTypes.Substring(7, pos.GoodsTypes.Length - 7); ListBox3.Items.Add(vbnn); sb3.Clear(); } } TextBox6.Text = pos.Remark; TextBox7.Text = pos.PositiontypeId; TextBox8.Text = sb1.ToString(); TextBox9.Text = sb2.ToString(); TextBox1.ReadOnly = true; } if (e.CommandName == "deletee") { ideas.Style["display"] = "inline"; int x = Convert.ToInt32(e.CommandArgument); Session["e"] = x; } }
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; } }