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.

114 lines
3.3 KiB
C#

1 year ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace web.Web.wx.Views.YZ.StatusPage
{
public partial class ctnPage : System.Web.UI.Page
{
public string _tbHTML = "";
public string _MBLNO = "";
public string _CARRIERID = "";
public string _YARD = "";
/// <summary>
/// tx,fc,jg,mdgtx
/// </summary>
public string _STYPE = "";
public string _STEXT = "";
protected void Page_Load(object sender, EventArgs e)
{
_MBLNO = Request["mblno"];
_STYPE = Request["stype"];
if (_MBLNO!=""&& _MBLNO != null && _STYPE !=""&& _STYPE != null)
{
SetupHTML();
}
}
private void SetupHTML()
{
StringBuilder sb = new StringBuilder();
Entities me = new Entities();
op_seae_billtrack bt = me.op_seae_billtrack.Where(o => o.MBLNO == _MBLNO).First();
_CARRIERID = bt.CARRIERID;
_YARD = bt.YARD;
List<op_seae_billtrack_ctn> ctnList = me.op_seae_billtrack_ctn.Where(o => o.MBLNO == _MBLNO).ToList();
foreach (var ctn in ctnList)
{
sb.Append("<tr>");
string time ="---";
if (_STYPE == "fc")
{
_STEXT = "返场";
time = convertDatetime(ctn.FanChangShiJian);
}
else if (_STYPE == "tx")
{
_STEXT = "提箱";
time = convertDatetime(ctn.TiXiangShiJian);
}
else if (_STYPE == "jg")
{
_STEXT = "集港";
time = convertDatetime(ctn.JiGangShiJian);
}
else if(_STYPE == "mdgtx")
{
_STEXT = "目的港提箱";
time = convertDatetime(bt.txTime);
}
string cls = "";
if (time=="---")
{
cls = "red";
}
else
{
cls = "green";
}
string cls2 = "";
if (time=="---")
{
cls2 = "";
}
else
{
cls2 = "green";
}
sb.Append("<td class=\"" + cls2 + "\">" + ctn.CTNALL + "</td>");
sb.Append("<td class=\"" + cls2 + "\">" + ctn.CNTRNO + "</td>");
sb.Append("<td class=\"" + cls2 + "\">" + ctn.SEALNO + "</td>");
sb.Append("<td class=\""+cls+"\">"+time+"</td>");
sb.Append("</tr>");
}
_tbHTML= sb.ToString();
}
private string convertDatetime(DateTime? dt)
{
try
{
if (dt==null)
{
return "---";
}
else
{
return dt.Value.ToString("yyyy-MM-dd HH:ss");
}
}
catch (Exception)
{
return "---";
}
}
}
}