//绑定 private void BindGridView() { try { string sql = GetSqlStr(); string sortEx = this.grvCKZB.Attributes["SortExpression"]; string sortDirect = this.grvCKZB.Attributes["SortDirection"]; string strSort = (!string.IsNullOrEmpty(sortEx)) ? sortEx + " " + sortDirect : ""; DataSet ds = CKZBQuery.GetQueryCKZB(sql, strSort, PageControl1.GetPageSize(), PageControl1.GetCurrPage()); this.grvCKZB.DataSource = ds; this.grvCKZB.DataBind(); this.SetDisplayList1.InitSetListControl(this.grvCKZB, SysBaseConfig.CKZB_Q_PAGE); this.SetDisplayList1.SetGridViewDisplay(grvCKZB); DataSet dsCount = CKZBQuery.GetCount(sql); if (dsCount != null && dsCount.Tables[0].Rows.Count > 0 && !string.IsNullOrEmpty((dsCount.Tables[0].Rows[0]["HJZL"]).ToString())) { this.lblSUM.Text = dsCount.Tables[0].Rows[0]["Count"].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.lblSUM.Text = "0"; this.lblZL.Text = "0"; this.lblSL.Text = "0"; } } catch (Exception ex) { String strEx = ex.Message; this.PrintfError("数据访问错误,请重试!"); } }
//设置分页控件显示 private void SetPageCountView() { try { string sqlWhere = GetSqlStr(); int outCount; int pageCount = CKZBQuery.GetPageCount(sqlWhere, PageControl1.GetPageSize(), out outCount); PageControl1.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 = RKZBQuery.GetRKCKHID(); } 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 { ds2 = CKZBQuery.GetCKSX(); } 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": //获取入库单号 DataSet ds3 = null; try { ds3 = CKZBQuery.GetCKDH(); } 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 = CKZBQuery.GetCKPH(); } 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 = CKZBQuery.GetCKPCH(); } 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 { ds6 = CKZBQuery.GetCKGG(); } 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 = CKZBQuery.GetCKWLH(); } 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 = CKZBQuery.GetCKCPH(); } 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 = CKZBQuery.GetCKType(); } 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 = RKZBQuery.GetRKSCX(); } 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; case "11": //班别 DataSet ds11 = null; try { ds11 = RKZBQuery.GetRKBB(); } catch (Exception ex) { string a = ex.Message; Response.Write("ERROR"); } if (ds11 != null) { try { XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Response.ContentEncoding); writer.Formatting = Formatting.Indented; writer.Indentation = 4; writer.IndentChar = ' '; ds11.WriteXml(writer); writer.Flush(); writer.Close(); Response.End(); } catch { } } break; case "12": //特殊信息 DataSet ds12 = null; try { ds12 = RKZBQuery.GetRKTSXX(); } catch (Exception ex) { string a = ex.Message; Response.Write("ERROR"); } if (ds12 != null) { try { XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Response.ContentEncoding); writer.Formatting = Formatting.Indented; writer.Indentation = 4; writer.IndentChar = ' '; ds12.WriteXml(writer); writer.Flush(); writer.Close(); Response.End(); } catch { } } break; } } }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request["TYPE"])) { string type = Request["TYPE"]; switch (type) { case "1": //打印完工单 if (!string.IsNullOrEmpty(Request["QUERYSQL"])) { try { DataSet ds = WGDQuery.QueryWGDExcel(Request["QUERYSQL"]); string strPrin = this.DGPrint(ds.Tables[0]); Response.Write(strPrin); } catch { return; } } break; case "2": //打印IC卡信息 try { DataSet ds = ICParam.GetPrintDS(Request["QUERYSQL"]); string strPrin = this.DGPrint(ds.Tables[0]); Response.Write(strPrin); } catch { return; } break; case "3": //打印发运单(进出门管理的查看发运单模块) try { DataSet ds1 = InDoorParam.GetPrintDS(Request["QUERYSQL"]); string strPrin1 = this.DGPrint(ds1.Tables[0]); Response.Write(strPrin1); } catch { return; } break; case "4": //打印发运单(查询) break; case "5": //打印转库单(查询) try { DataSet ds = ZKDQuery.QueryZKDExcel(Request["QUERYSQL"]); string strPrin = this.DGPrint(ds.Tables[0]); Response.Write(strPrin); } catch { return; } break; case "6": //打印移位单(查询) try { DataSet ds = YWDQuery.QueryYWDExcel(Request["QUERYSQL"]); string strPrin = this.DGPrint(ds.Tables[0]); Response.Write(strPrin); } catch { return; } break; case "7": //打印退货单(查询) try { DataSet ds = THDQuery.QueryTHDExcel(Request["QUERYSQL"]); string strPrin = this.DGPrint(ds.Tables[0]); Response.Write(strPrin); } catch { return; } break; case "8": //打印待判品查询单(查询) try { DataSet ds = DPPQuery.QueryPDDExcel(Request["QUERYSQL"]); string strPrin = this.DGPrint(ds.Tables[0]); Response.Write(strPrin); } catch { return; } break; case "9": //打印入库账簿单(查询) try { DataSet ds = RKZBQuery.QueryRKZBExcel(Request["QUERYSQL"]); string strPrin = this.DGPrint(ds.Tables[0]); Response.Write(strPrin); } catch { return; } break; case "10": //打印出库账簿单(查询) try { DataSet ds = CKZBQuery.QueryCKZBExcel(Request["QUERYSQL"]); string strPrin = this.DGPrint(ds.Tables[0]); Response.Write(strPrin); } catch { return; } break; } } }