using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using DSWeb.Areas.Mobile.Models.Common; using System.Data; using Microsoft.Practices.EnterpriseLibrary.Data; using DSWeb.Areas.Mobile.Models.WMS; using System.Text; namespace DSWeb.Areas.Mobile.Views.WMS { public partial class ZWCCX : System.Web.Mvc.ViewPage { public PageContentModel model = new PageContentModel(); protected void Page_Load(object sender, EventArgs e) { SetupHTML(); string truckno = Request.QueryString["truckno"]; truckno.Replace(",","").Replace("'",""); this.hdkeyword.Value = truckno; } private void SetupHTML() { string truckno = Request.QueryString["truckno"]; truckno.Replace(",", "").Replace("'", ""); string sql = ""; if (truckno!="") { //this.hdkeyword.Value = truckno; sql = @"select distinct wo.DODATE TiHuoRiQi, wod.STORAGENAME CangKu, ic.ADDR DiZhi, ic.TEL DianHua from wms_out_detail wod left join wms_out wo on wod.OUTBSNO = wo.BSNO left join info_client ic on wod.STORAGENAME = ic.SHORTNAME where wod.TRUCKNO = '"+truckno+ "' and wo.DODATE>=(GETDATE()-3) order by wo.DODATE desc"; } else { model.content = "请输入车牌号!"; return; } Database db = DatabaseFactory.CreateDatabase(); List list = new List(); using (IDataReader reader = db.ExecuteReader(CommandType.Text, sql)) { while (reader.Read()) { WmsModel wm = new WmsModel(); if (reader["TiHuoRiQi"]==DBNull.Value) { wm.TiHuoRiQi = "-"; } else { DateTime dt = DateTime.Parse(reader["TiHuoRiQi"].ToString()); wm.TiHuoRiQi = dt.ToString("yyyy-MM-dd"); } wm.CangKu = reader["CangKu"].ToString(); wm.DiZhi = reader["DiZhi"] == DBNull.Value ? "" : reader["DiZhi"].ToString(); wm.DianHua = reader["DianHua"] == DBNull.Value ? "" : reader["DianHua"].ToString(); list.Add(wm); } } StringBuilder sbDet = new StringBuilder(); foreach (var item in list) { //仓库已收到车号XXX提货信息 sbDet.Append("
  • "); sbDet.Append("仓库已收到车号"+truckno+"提货信息"); sbDet.Append("
  • "); //提货日期 sbDet.Append("
  • "); DateTime dt = DateTime.Parse(item.TiHuoRiQi); sbDet.Append("提货日期:"+dt.ToString("yyyy-MM-dd")); sbDet.Append("
  • "); //仓库 sbDet.Append("
  • "); sbDet.Append("仓库:"+item.CangKu); sbDet.Append("
  • "); //地址 sbDet.Append("
  • "); sbDet.Append("地址:"+item.DiZhi); sbDet.Append("
  • "); //电话 sbDet.Append("
  • "); sbDet.Append("电话:"+item.DianHua); sbDet.Append("
  • "); } model.content = sbDet.ToString(); } } }