private void BindGridView() { string ckid = DropDownList1.SelectedValue.ToString(); if (ckid.ToString() == null || ckid.ToString() == "") { ckid = ""; DataSet ds = HWinfo.GetList(ckid); if (ds != null) { this.GridView1.DataSource = ds; this.GridView1.DataBind(); } } else { DataSet ds = HWinfo.GetList(ckid); if (ds != null) { this.GridView1.DataSource = ds; this.GridView1.DataBind(); } } HWinfo hwinfo = new HWinfo(); hwcount = hwinfo.GetSumId(ckid); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { try { string ckInof = (string)e.CommandArgument; if (e.CommandName == "imgBtnDelete") { string[] ckInfors = ckInof.Split('|'); HWinfo hwinfo = new HWinfo(); hwinfo.Delete(ckInfors[1], ckInfors[0]); BindGridView(); this.PrintfError("货位删除成功!"); } } catch { this.PrintfError("数据操作有误!"); return; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string store = ""; string sRow = ""; string sCol = ""; string tRow = ""; string tCol = ""; if (!string.IsNullOrEmpty(Request["STORE"])) { store = Request["STORE"]; } if (!string.IsNullOrEmpty(Request["SROW"])) { sRow = Request["SROW"]; } if (!string.IsNullOrEmpty(Request["TROW"])) { tRow = Request["TROW"]; } if (!string.IsNullOrEmpty(Request["SCOL"])) { sCol = Request["SCOL"]; } if (!string.IsNullOrEmpty(Request["TCOL"])) { tCol = Request["TCOL"]; } if (!string.IsNullOrEmpty(store) && !string.IsNullOrEmpty(sRow) && !string.IsNullOrEmpty(tRow) && !string.IsNullOrEmpty(sCol) && !string.IsNullOrEmpty(tCol)) { if (tRow == "0" || tCol == "0") { DataTable dt = new DataTable(); dt.Columns.Add("HWID"); DataRow row = dt.NewRow(); row["HWID"] = store.Trim() + string.Format("{0:d02}", Convert.ToInt32(sRow)) + string.Format("{0:d02}", Convert.ToInt32(sCol)); //string midString = CreateImage(row,false); string midString = BarTable(row, false); Response.Write(colHeaders + midString + colFooder); } else { try { DataSet ds = HWinfo.GetHWID(store, sRow, tRow, sCol, tCol); if (ds != null) { StringBuilder sbResponse = new StringBuilder(); sbResponse.Append(colHeaders); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (i == ds.Tables[0].Rows.Count - 1) { //sbResponse.Append(CreateImage(ds.Tables[0].Rows[i], false)); sbResponse.Append(BarTable(ds.Tables[0].Rows[i], false)); } else { //sbResponse.Append(CreateImage(ds.Tables[0].Rows[i], true)); sbResponse.Append(BarTable(ds.Tables[0].Rows[i], true)); } } sbResponse.Append(colFooder); Response.Write(sbResponse.ToString()); } else { this.WriteClientJava("window.alert('不存在要打印的货位信息');"); return; } } catch { this.PrintfError("数据访问错误,请重试!"); } } } } }
protected void imgBtnSumbit_Click(object sender, ImageClickEventArgs e) { try { string ckid = this.ckdropdown.SelectedValue.ToString(); if (ckid.ToString() == null || ckid.ToString() == "") { BindGridView(); this.PrintfError("请选则仓库!"); return; } if (Rrfsdrop.SelectedValue.ToString() == "单个录入") { if (HWrow1.Text.Trim().ToString() == "" || HWrow1.Text.Trim().ToString() == null) { BindGridView(); this.PrintfError("请输入货位行号!(1-99)"); return; } if (HWrow1.Text.Length > 2 || !IsNumberic(HWrow1.Text.ToString()) || HWrow1.Text == "0" || HWrow1.Text == "00") { BindGridView(); this.PrintfError("请正确输入货位行号!(1-99)"); return; } if (HWcolumn1.Text.Trim().ToString() == "" || HWcolumn1.Text.Trim().ToString() == null) { BindGridView(); this.PrintfError("请输入货位列号!(1-99)"); return; } if (HWcolumn1.Text.Length > 2 || !IsNumberic(HWcolumn1.Text.ToString()) || HWcolumn1.Text == "0" || HWcolumn1.Text == "00") { BindGridView(); this.PrintfError("请正确输入货位列号!(1-99)"); return; } } if (Rrfsdrop.SelectedValue.ToString() == "成批录入") { if (HWminrow.Text.Trim().ToString() == "" || HWminrow.Text.Trim().ToString() == null) { BindGridView(); this.PrintfError("请输入最小行号!(1-99)"); return; } if (HWmaxrow.Text.Trim().ToString() == "" || HWmaxrow.Text.Trim().ToString() == null) { BindGridView(); this.PrintfError("请输入最大行号!(1-99)"); return; } if (HWmincolumn.Text.Trim().ToString() == "" || HWmincolumn.Text.Trim().ToString() == null) { BindGridView(); this.PrintfError("请输入最小列号!(1-99)"); return; } if (HWmaxcolumn.Text.Trim().ToString() == "" || HWmaxcolumn.Text.Trim().ToString() == null) { BindGridView(); this.PrintfError("请输入最大列号!(1-99)"); return; } if (HWminrow.Text.Length > 2 || !IsNumberic(HWminrow.Text.Trim().ToString()) || HWmaxrow.Text.Length > 2 || !IsNumberic(HWmaxrow.Text.Trim()) || HWmaxcolumn.Text.Length > 2 || !IsNumberic(HWmaxcolumn.Text.Trim()) || HWmincolumn.Text.Length > 2 || !IsNumberic(HWmincolumn.Text.Trim())) { BindGridView(); this.PrintfError("请正确输入行号列号!(1-99)"); return; } if (Convert.ToInt16(HWmaxcolumn.Text.Trim().ToString()) < Convert.ToInt16(HWmincolumn.Text.Trim())) { BindGridView(); this.PrintfError("最大列号<最小列号!(1-99)"); return; } if (Convert.ToInt16(HWmaxrow.Text.Trim().ToString()) < Convert.ToInt16(HWminrow.Text.Trim().ToString())) { BindGridView(); this.PrintfError("最大行号<最小行号!(1-99)"); return; } } //新建单个录入货位 if (Rrfsdrop.SelectedValue.ToString() == "单个录入") { if (HWrow1.Text.Trim().ToString().Length == 1) { row1 = "0" + HWrow1.Text.Trim().ToString(); } else { row1 = HWrow1.Text.Trim().ToString(); } if (HWcolumn1.Text.Trim().ToString().Length == 1) { column1 = "0" + HWcolumn1.Text.Trim().ToString(); } else { column1 = HWcolumn1.Text.Trim().ToString(); } hwid = ckdropdown.SelectedValue.ToString() + row1.ToString() + column1.ToString(); HWinfo hwinfo = new HWinfo(ckdropdown.SelectedValue.ToString(), hwid, Convert.ToInt16(column1.ToString()), Convert.ToInt16(row1.ToString()), HWmemo.Text.Trim().ToString()); if (hwinfo.Exists(hwid)) { BindGridView(); this.PrintfError("该货位编码已存在!"); return; } hwinfo.Add(); BindGridView(); } //新建成批录入货位 if (Rrfsdrop.SelectedValue.ToString() == "成批录入") { for (int i = Convert.ToInt16(HWminrow.Text.Trim().ToString()); i <= Convert.ToInt16(HWmaxrow.Text.Trim().ToString()); i++) { for (int j = Convert.ToInt16(HWmincolumn.Text.Trim().ToString()); j <= Convert.ToInt16(HWmaxcolumn.Text.Trim().ToString()); j++) { if (i.ToString().Length == 1) { minrow = "0" + i.ToString(); } else { minrow = i.ToString(); } if (j.ToString().Length == 1) { mincolumn = "0" + j.ToString(); } else { mincolumn = j.ToString(); } hwid = ckdropdown.SelectedValue.ToString() + minrow.ToString() + mincolumn.ToString(); HWinfo hwinfo = new HWinfo(ckdropdown.SelectedValue.ToString(), hwid, Convert.ToInt16(mincolumn.ToString()), Convert.ToInt16(minrow.ToString()), HWmemo.Text.Trim().ToString()); if (hwinfo.Exists(hwid)) { continue; } hwinfo.Add(); } } BindGridView(); } } catch { this.PrintfError("数据插入有错,请重试!"); return; } }