You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
3.9 KiB
C#

10 months ago
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<WmsModel> list = new List<WmsModel>();
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("<li data-role=\"list-divider\" style=\"font-size:11px\">");
sbDet.Append("仓库已收到车号"+truckno+"提货信息");
sbDet.Append("</li>");
//提货日期
sbDet.Append("<li>");
DateTime dt = DateTime.Parse(item.TiHuoRiQi);
sbDet.Append("提货日期:"+dt.ToString("yyyy-MM-dd"));
sbDet.Append("</li>");
//仓库
sbDet.Append("<li>");
sbDet.Append("仓库:"+item.CangKu);
sbDet.Append("</li>");
//地址
sbDet.Append("<li>");
sbDet.Append("地址:"+item.DiZhi);
sbDet.Append("</li>");
//电话
sbDet.Append("<li>");
sbDet.Append("电话:"+item.DianHua);
sbDet.Append("</li>");
}
model.content = sbDet.ToString();
}
}
}