//设置分页控件显示 private void SetPageCountView() { try { string sql = GetSqlTHD(); int outCount; int pageCount = THDQuery.GetPageCount(sql, PageControl2.GetPageSize(), out outCount); PageControl2.SetInitView(pageCount, outCount); } catch { this.PrintfError("数据访问错误,请重试!"); return; } }
//帮定grvTHD private void BindGridView() { try { string sql = GetSqlTHD(); string sortEx = this.grvTHD.Attributes["SortExpression"]; string sortDirect = this.grvTHD.Attributes["SortDirection"]; string strSort = (!string.IsNullOrEmpty(sortEx)) ? sortEx + " " + sortDirect : ""; DataSet ds = THDQuery.GetQueryTHD(sql, strSort, PageControl2.GetPageSize(), PageControl2.GetCurrPage()); this.grvTHD.DataSource = ds; this.grvTHD.DataBind(); this.SetDisplayList1.InitSetListControl(this.grvTHD, SysBaseConfig.THD_Q_PAGE); this.SetDisplayList1.SetGridViewDisplay(grvTHD); } catch (Exception ex) { String strEx = ex.Message; this.PrintfError("数据访问错误,请重试!"); } }
private string GetSqlTHD() { string Sql_THD = ""; //仓库 if (!string.IsNullOrEmpty(this.hidCKH.Value)) { Sql_THD += " CK ='" + hidCKH.Value + "' "; } //制单人 if (!string.IsNullOrEmpty(this.hidZDR.Value)) { if (!string.IsNullOrEmpty(Sql_THD)) { Sql_THD += " AND NCZDRY='" + this.hidZDR.Value.Trim() + "'"; } else { Sql_THD += " NCZDRY ='" + this.hidZDR.Value.Trim() + "'"; } } //发运单 if (!string.IsNullOrEmpty(this.hidFYDH.Value)) { if (!string.IsNullOrEmpty(Sql_THD)) { Sql_THD += " AND CKDH like '%" + this.hidFYDH.Value.Trim() + "%'"; } else { Sql_THD += " CKDH like '%" + this.hidFYDH.Value.Trim() + "%'"; } } //部门 if (!string.IsNullOrEmpty(this.hidBM.Value)) { if (!string.IsNullOrEmpty(Sql_THD)) { Sql_THD += " AND NCBM='" + this.hidBM.Value.Trim() + "'"; } else { Sql_THD += " NCBM ='" + this.hidBM.Value.Trim() + "'"; } } //退货单 if (!string.IsNullOrEmpty(this.hidTHDH.Value)) { if (!string.IsNullOrEmpty(Sql_THD)) { Sql_THD += " AND THDH like '%" + this.hidTHDH.Value.Trim() + "%'"; } else { Sql_THD += " THDH like '%" + this.hidTHDH.Value.Trim() + "%'"; } } //牌号 if (!string.IsNullOrEmpty(this.hidPH.Value)) { if (!string.IsNullOrEmpty(Sql_THD)) { Sql_THD += " AND PH like '%" + this.hidPH.Value.Trim() + "%'"; } else { Sql_THD += " PH like '%" + this.hidPH.Value.Trim() + "%'"; } } //物料号 if (!string.IsNullOrEmpty(this.hidWLH.Value)) { if (!string.IsNullOrEmpty(Sql_THD)) { Sql_THD += " AND WLH like '%" + this.hidWLH.Value.Trim() + "%'"; } else { Sql_THD += " WLH like '%" + this.hidWLH.Value.Trim() + "%'"; } } //规格 if (!string.IsNullOrEmpty(this.hidGG.Value)) { if (!string.IsNullOrEmpty(Sql_THD)) { Sql_THD += " AND GG like '%" + this.hidGG.Value.Trim() + "%'"; } else { Sql_THD += " GG like '%" + this.hidGG.Value.Trim() + "%'"; } } //属性 if (!string.IsNullOrEmpty(this.hidSX.Value)) { if (!string.IsNullOrEmpty(Sql_THD)) { Sql_THD += " AND SX like '%" + this.hidSX.Value.Trim() + "%'"; } else { Sql_THD += " SX like '%" + this.hidSX.Value.Trim() + "%'"; } } //客户号 if (!string.IsNullOrEmpty(this.hidKHH.Value)) { if (!string.IsNullOrEmpty(Sql_THD)) { Sql_THD += " AND KHBM like '%" + this.hidKHH.Value.Trim() + "%'"; } else { Sql_THD += " KHBM ='%" + this.hidKHH.Value.Trim() + "%'"; } } //IC卡号 if (!string.IsNullOrEmpty(this.hidICKH.Value)) { string ickhbm = "ACCTRUEWMS"; try { DataSet ds = THDQuery.GetTHDIC(this.hidICKH.Value.Trim()); if (ds != null) { ickhbm = ds.Tables[0].Rows[0]["KHID"].ToString(); } } catch { this.PrintfError("访问数据错误!"); } if (!string.IsNullOrEmpty(Sql_THD)) { Sql_THD += " and KHBM='" + ickhbm + "'"; } else { Sql_THD += " KHBM='" + ickhbm + "'"; } } //退货日期 if (this.chkTuiHuoRQ.Checked && !string.IsNullOrEmpty(this.TuiHuo_Start.Text)) { string TuiHuo_Start = this.TuiHuo_Start.Text.Trim() + " 00:00:00"; if (!string.IsNullOrEmpty(Sql_THD)) { Sql_THD += " AND CZRQ >='" + TuiHuo_Start + "'"; } else { Sql_THD += " CZRQ >='" + TuiHuo_Start + "'"; } } if (this.chkTuiHuoRQ.Checked && !string.IsNullOrEmpty(this.TuiHuo_End.Text.Trim())) { string TuiHuo_End = this.TuiHuo_End.Text.Trim() + " 23:59:59"; if (!string.IsNullOrEmpty(Sql_THD)) { Sql_THD += " AND CZRQ <='" + TuiHuo_End + "'"; } else { Sql_THD += " CZRQ >='" + TuiHuo_End + "'"; } } //自由项1 if (this.chkFree1.Checked && !string.IsNullOrEmpty(this.txtFree1.Text)) { if (!string.IsNullOrEmpty(Sql_THD)) { Sql_THD += " AND vfree1 like '%" + this.txtFree1.Text.Trim() + "%'"; } else { Sql_THD += " vfree1 like '%" + this.txtFree1.Text.Trim() + "%'"; } } //自由项2 if (this.chkFree2.Checked && !string.IsNullOrEmpty(this.txtFree2.Text)) { if (!string.IsNullOrEmpty(Sql_THD)) { Sql_THD += " AND vfree2 like '%" + this.txtFree2.Text.Trim() + "%'"; } else { Sql_THD += " vfree2 like '%" + this.txtFree2.Text.Trim() + "%'"; } } //自由项3 if (this.chkFree3.Checked && !string.IsNullOrEmpty(this.txtFree3.Text)) { if (!string.IsNullOrEmpty(Sql_THD)) { Sql_THD += " AND vfree3 like '%" + this.txtFree3.Text.Trim() + "%'"; } else { Sql_THD += " vfree3 like '%" + this.txtFree3.Text.Trim() + "%'"; } } return(Sql_THD); }
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; } } }
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 = THDQuery.GetTHDCKID(); } 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 = THDQuery.GetTHDZDR(); } 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 = THDQuery.GetTHDFYDH(); } 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 = THDQuery.GetTHDNCBM(); } 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 = THDQuery.GetTHDH(); } 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 = THDQuery.GetTHDPH(); } 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 = THDQuery.GetTHDWLH(); } 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 = THDQuery.GetTHDGG(); } 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 = THDQuery.GetTHDSX(); } 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 = THDQuery.GetTHDKHH(); } 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; } } }