//绑定grvKC_WLH private void BindgrvKC_WLH() { try { string sql = GetSqlstr(); string sortEx = this.grvKC_WLH.Attributes["SortExpression"]; string sortDirect = this.grvKC_WLH.Attributes["SortDirection"]; string strSort = (!string.IsNullOrEmpty(sortEx)) ? sortEx + " " + sortDirect : ""; DataSet ds = KCQuery.GetQueryKC_WLH(sql, strSort, PageControl4.GetPageSize(), PageControl4.GetCurrPage()); this.grvKC_WLH.DataSource = ds; this.grvKC_WLH.DataBind(); DataSet dsCount = KCQuery.GetCountKC_WLH(sql); if (dsCount != null && dsCount.Tables[0].Rows.Count > 0 && dsCount.Tables[0].Rows[0]["HJCOUNT"].ToString() != "0") { this.lblCount.Text = dsCount.Tables[0].Rows[0]["HJCOUNT"].ToString(); this.lblSL.Text = dsCount.Tables[0].Rows[0]["HJSL"].ToString(); this.lblZL.Text = Convert.ToDecimal(dsCount.Tables[0].Rows[0]["HJZL"]).ToString("#0.0000"); } else { this.lblCount.Text = "0"; this.lblSL.Text = "0"; this.lblZL.Text = "0.0000"; } } catch (Exception ex) { String strEx = ex.Message; this.PrintfError("数据访问错误,请重试!"); } }
private void SetPageWLH() { try { string sqlWhere = GetSqlstr(); int outCount; int pageCount = KCQuery.GetPageCount_WLH(sqlWhere, PageControl1.GetPageSize(), out outCount); PageControl4.SetInitView(pageCount, outCount); } catch { this.PrintfError("数据访问错误,请重试!"); return; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string type = ""; if (Request["TYPE"] == null) { return; } type = Request["TYPE"]; switch (type) { case "1": //获取仓库 DataSet ds = null; try { ds = KCQuery.GetCKID(); } catch (Exception ex) { string a = ex.Message; Response.Write("ERROR"); } if (ds != null) { try { XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Response.ContentEncoding); writer.Formatting = Formatting.Indented; writer.Indentation = 4; writer.IndentChar = ' '; ds.WriteXml(writer); writer.Flush(); writer.Close(); Response.End(); } catch { } } break; case "2": //货位 DataSet ds2 = null; try { string ck = ""; if (!string.IsNullOrEmpty(Request.QueryString["ck"])) { ck = Request.QueryString["ck"].ToString(); } ds2 = KCQuery.GetKCHW(ck); } catch (Exception ex) { string a = ex.Message; Response.Write("ERROR"); } if (ds2 != null) { try { XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Response.ContentEncoding); writer.Formatting = Formatting.Indented; writer.Indentation = 4; writer.IndentChar = ' '; ds2.WriteXml(writer); writer.Flush(); writer.Close(); Response.End(); } catch { } } break; case "3": //获取PCH DataSet ds3 = null; try { ds3 = KCQuery.GetKCPCH(); } catch (Exception ex) { string a = ex.Message; Response.Write("ERROR"); } if (ds3 != null) { try { XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Response.ContentEncoding); writer.Formatting = Formatting.Indented; writer.Indentation = 4; writer.IndentChar = ' '; ds3.WriteXml(writer); writer.Flush(); writer.Close(); Response.End(); } catch { } } break; case "4": //获取属性 DataSet ds4 = null; try { ds4 = KCQuery.GetKCSX(); } catch (Exception ex) { string a = ex.Message; Response.Write("ERROR"); } if (ds4 != null) { try { XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Response.ContentEncoding); writer.Formatting = Formatting.Indented; writer.Indentation = 4; writer.IndentChar = ' '; ds4.WriteXml(writer); writer.Flush(); writer.Close(); Response.End(); } catch { } } break; case "5": //获取物料号 DataSet ds5 = null; try { ds5 = KCQuery.GetKCWLH(); } catch (Exception ex) { string a = ex.Message; Response.Write("ERROR"); } if (ds5 != null) { try { XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Response.ContentEncoding); writer.Formatting = Formatting.Indented; writer.Indentation = 4; writer.IndentChar = ' '; ds5.WriteXml(writer); writer.Flush(); writer.Close(); Response.End(); } catch { } } break; case "6": //特殊信息 DataSet ds6 = null; try { string sqlstr = ""; string ck = ""; string pch = ""; string hw = ""; string sx = ""; string wlh = ""; if (!string.IsNullOrEmpty(Request.QueryString["ck"])) { ck = Request.QueryString["ck"]; sqlstr += " AND ck='" + ck + "'"; } if (!string.IsNullOrEmpty(Request.QueryString["pch"])) { pch = Request.QueryString["pch"]; sqlstr += " AND pch='" + pch + "'"; } if (!string.IsNullOrEmpty(Request.QueryString["sx"])) { sx = Request.QueryString["sx"]; sqlstr += " AND sx='" + sx + "'"; } if (!string.IsNullOrEmpty(Request.QueryString["wlh"])) { wlh = Request.QueryString["wlh"]; sqlstr += " AND wlh='" + wlh + "'"; } if (!string.IsNullOrEmpty(Request.QueryString["hw"])) { hw = Request.QueryString["hw"]; sqlstr += " AND hw='" + hw + "'"; } ds6 = KCQuery.GetKCTSXX(sqlstr); } catch (Exception ex) { string a = ex.Message; Response.Write("ERROR"); } if (ds6 != null) { try { XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Response.ContentEncoding); writer.Formatting = Formatting.Indented; writer.Indentation = 4; writer.IndentChar = ' '; ds6.WriteXml(writer); writer.Flush(); writer.Close(); Response.End(); } catch { } } break; case "7": //转出物料 DataSet ds7 = null; try { ds7 = RKZBQuery.GetRKWLH(); } catch (Exception ex) { string a = ex.Message; Response.Write("ERROR"); } if (ds7 != null) { try { XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Response.ContentEncoding); writer.Formatting = Formatting.Indented; writer.Indentation = 4; writer.IndentChar = ' '; ds7.WriteXml(writer); writer.Flush(); writer.Close(); Response.End(); } catch { } } break; case "8": //牌号 DataSet ds8 = null; try { ds8 = KCQuery.GetKCPH(); } catch (Exception ex) { string a = ex.Message; Response.Write("ERROR"); } if (ds8 != null) { try { XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Response.ContentEncoding); writer.Formatting = Formatting.Indented; writer.Indentation = 4; writer.IndentChar = ' '; ds8.WriteXml(writer); writer.Flush(); writer.Close(); Response.End(); } catch { } } break; case "9": //规格 DataSet ds9 = null; try { ds9 = KCQuery.GetKCGG(); } catch (Exception ex) { string a = ex.Message; Response.Write("ERROR"); } if (ds9 != null) { try { XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Response.ContentEncoding); writer.Formatting = Formatting.Indented; writer.Indentation = 4; writer.IndentChar = ' '; ds9.WriteXml(writer); writer.Flush(); writer.Close(); Response.End(); } catch { } } break; case "10": //条码 DataSet ds10 = null; try { ds10 = KCQuery.GetKCTM(); } catch (Exception ex) { string a = ex.Message; Response.Write("ERROR"); } if (ds10 != null) { try { XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Response.ContentEncoding); writer.Formatting = Formatting.Indented; writer.Indentation = 4; writer.IndentChar = ' '; ds10.WriteXml(writer); writer.Flush(); writer.Close(); Response.End(); } catch { } } break; } } }