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.

1051 lines
54 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Text;
using DSWeb.EntityDA;
using System.Net;
namespace DSWeb.FeeCodes
{
public partial class QQCTAdapter : System.Web.UI.Page
{
private string strqqct = "";
private string strBSNO = "";
public string strUserID;//用户GID
T_ALL_DA T_ALL_DA = new T_ALL_DA();
public DataTable dtMTXX = new DataTable();//码头信息
public DataTable dtHGYDBGXX = new DataTable();//海关运抵报告信息
public DataTable dtHGFXXX = new DataTable();//海关放行信息
public DataTable dtWLFXSHXX = new DataTable();//外理放行审核信息
public DataTable dtCKCD = new DataTable();//出口舱单
public DataTable dtINFO = new DataTable();//合计表
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString();
}
else
{
Server.Transfer("~/Error/FriendError.aspx");
return;
//strUserID = "";
}
//
if (Request.QueryString["BSNO"] != null)
{
strBSNO = Request.QueryString["BSNO"].ToString();
}
//
if (strBSNO != "")
{
string strMBLNO = T_ALL_DA.GetStrSQL("MBLNO", "select top 1 MBLNO from op_seae where BSNO='" + strBSNO + "'");
//strMBLNO = "POBUTAO110901169"; //"APLU063457596";//POBUTAO111201714//POBUTAO111201706//POBUTAO120100309//POBUTAO120100744
if (strMBLNO.Trim() != "")
{
getInfo("http://www.qingdaoport.net/ywzx/qqct/dpcx/cargoDya.jsp?tdh=" + strMBLNO);
setInfo();
if (dtINFO == null || dtINFO.Rows.Count < 1)
{
strqqct = "此单暂无数据!";
}
else
{
string alt = T_ALL_DA.setQQCTCTN(strBSNO.Trim(), strUserID.Trim(), dtINFO);
if (alt != "")
{
strqqct = alt;
}
}
}
else
{
strqqct = "主提单号为空!";
}
/*
//if (strMBLNO.Trim() != "")
//{
// int iResult = 0;
// ArrayList alurl = getUrl("http://www.qingdaoport.net/ywzx/qqct/dpcx/cargoDya.jsp?tdh=" + strMBLNO);
// if (alurl.Count > 0)
// {
// ArrayList alinsert = new ArrayList();
// int j = 0;
// int k = (alurl.Count - 20) / 20;
// //
// iResult = T_ALL_DA.setQQCTCTNDEL(strBSNO.Trim());
// if (iResult == 1)
// {
// //
// for (int ik = 0; ik < k; ik++)
// {
// j = ik * 20;
// alinsert.Clear();
// for (int i = 20; i < 40; i++)
// {
// alinsert.Add(alurl[i + j].ToString().Trim());
// }
// //
// if (alinsert[1].ToString().Trim() != "" && alinsert[2].ToString().Trim() != "")//alinsert[17].ToString().Trim() == "装船" && alinsert[14].ToString().Trim() == "已装船"
// {
// iResult = T_ALL_DA.setQQCTCTN(strBSNO.Trim(), strUserID.Trim(), alinsert[5].ToString().Trim(), alinsert[6].ToString().Trim(), 1, alinsert[4].ToString().Trim(), alinsert[8].ToString().Trim());
// }
// else
// {
// continue;
// }
// if (iResult == 1)
// {
// }
// else if (iResult == -5)
// {
// strqqct += "箱号:" + alinsert[4].ToString().Trim() + "错误更新委托的集装箱大写和TEU出错\r\t";
// }
// else if (iResult == -6)
// {
// strqqct += "箱号:" + alinsert[4].ToString().Trim() + ",错误:插入集装箱明细出错!\r\t";
// }
// else if (iResult == -1 || iResult == -2)
// {
// strqqct += "箱号:" + alinsert[4].ToString().Trim() + ",错误:集装箱箱号封号导入出错!\r\t";
// }
// }
// }
// else if (iResult == -3)
// {
// strqqct += "箱号:" + alinsert[4].ToString().Trim() + ",错误:删除集装箱明细出错!\r\t";
// }
// else if (iResult == -4)
// {
// strqqct += "箱号:" + alinsert[4].ToString().Trim() + ",错误:删除集装箱明细出错!\r\t";
// }
// else if (iResult == -1 || iResult == -2)
// {
// strqqct += "箱号:" + alinsert[4].ToString().Trim() + ",错误:集装箱箱号封号导入出错!\r\t";
// }
// }
// else
// {
// strqqct = "此单暂无数据!";
// }
//}
//else
//{
// strqqct = "主提单号为空!";
//}
*/
//------
}
Response.Write(strqqct);
}
private ArrayList getUrl(string strUrl)
{
WebClient webClient = new WebClient();
ArrayList alist = new ArrayList();
Byte[] pageHtmlBtyes;
//string strUrl = "http://www.qingdaoport.net/ywzx/qqct/dpcx/hgfx.jsp?val=" + strMBLNO;
//string strUrl2 = "http://www.qingdaoport.net/ywzx/qqct/dpcx/hgfx.jsp?val=" + strMBLNO;
//string strUrl3 = "http://www.qingdaoport.net/ywzx/qqct/dpcx/cargoDya.jsp?tdh=POBUTAO110901073" + strMBLNO;
try
{
pageHtmlBtyes = webClient.DownloadData(strUrl);
//UTF8Encoding utf8Encoding = new UTF8Encoding();
Encoding gbEncoding = Encoding.GetEncoding("gb2312");
//
string[] txtval = gbEncoding.GetString(pageHtmlBtyes).Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
string ls = "";
for (int i = 0; i < txtval.Length; i++)
{
ls = txtval[i].ToString().Trim().Replace("\t", "");
int sss = ls.IndexOf(">") + 1;
int ttt = 0;
if (sss > 0)
{
if (ls.IndexOf("合计") > 0)
{
break;
}
else if (ls.IndexOf("暂无") > 0)
{
alist.Clear();
break;
}
else
{
if (ls.Substring(0, sss).Equals("<td align=\"center\">"))
{
ls = ls.Substring(sss);
ttt = ls.IndexOf("<");
if (ttt > 0)
{
ls = ls.Substring(0, ttt);
}
else
{
ls = "";
}
alist.Add(ls);
}
}
}
}
}
catch (Exception)
{
alist.Clear();
}
return alist;
}
private void getInfo(string strUrl)
{
WebClient webClient = new WebClient();
ArrayList alist = new ArrayList();
Byte[] pageHtmlBtyes;
//strUrl = "http://www.qingdaoport.net/ywzx/qqct/dpcx/hgfx.jsp?val=POBUTAO111201717";
//string strUrl2 = "http://www.qingdaoport.net/ywzx/qqct/dpcx/hgfx.jsp?val=" + strMBLNO;
//string strUrl3 = "http://www.qingdaoport.net/ywzx/qqct/dpcx/cargoDya.jsp?tdh=POBUTAO110901073" + strMBLNO;
try
{
pageHtmlBtyes = webClient.DownloadData(strUrl);
//UTF8Encoding utf8Encoding = new UTF8Encoding();
Encoding gbEncoding = Encoding.GetEncoding("gb2312");
//
string[] txtval = gbEncoding.GetString(pageHtmlBtyes).Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
//
#region 码头信息
string ls = "";
DataColumn dc = null;
DataRow newRow = null;
int bz = 0;
int bz0 = 0;
int bz1 = 0;
//
for (int i = 0; i < txtval.Length; i++)
{
ls = txtval[i].ToString().Trim().Replace("\t", "");
int sss = ls.IndexOf(">") + 1;
int ttt = 0;
if (sss > 0)
{
if (ls.IndexOf("合计") > 0)
{
if (bz == 1)
{
bz = 0;
break;
}
}
else if (ls.IndexOf("暂无") > 0)
{
if (bz == 1)
{
bz = 0;
break;
}
}
else if (ls.IndexOf("码头信息") > 0)
{
bz = 1;
//dc = dtMTXX.Columns.Add("序号", Type.GetType("System.Int32"));
//dc.AutoIncrement = true;//自动增加
//dc.AutoIncrementSeed = 1;//起始为1
//dc.AutoIncrementStep = 1;//步长为1
//dc.AllowDBNull = false;//
//
dc = dtMTXX.Columns.Add("序号", Type.GetType("System.String"));
dc = dtMTXX.Columns.Add("船名", Type.GetType("System.String"));
dc = dtMTXX.Columns.Add("航次", Type.GetType("System.String"));
dc = dtMTXX.Columns.Add("提单号", Type.GetType("System.String"));
dc = dtMTXX.Columns.Add("箱号", Type.GetType("System.String"));
dc = dtMTXX.Columns.Add("尺寸", Type.GetType("System.String"));
dc = dtMTXX.Columns.Add("箱型", Type.GetType("System.String"));
dc = dtMTXX.Columns.Add("箱主", Type.GetType("System.String"));
dc = dtMTXX.Columns.Add("铅封号", Type.GetType("System.String"));
dc = dtMTXX.Columns.Add("箱皮重", Type.GetType("System.String"));
dc = dtMTXX.Columns.Add("整箱重", Type.GetType("System.String"));
dc = dtMTXX.Columns.Add("码头放行", Type.GetType("System.String"));
dc = dtMTXX.Columns.Add("类别", Type.GetType("System.String"));
dc = dtMTXX.Columns.Add("卸货港", Type.GetType("System.String"));
dc = dtMTXX.Columns.Add("当前位置", Type.GetType("System.String"));
dc = dtMTXX.Columns.Add("入港类别", Type.GetType("System.String"));
dc = dtMTXX.Columns.Add("入港时间", Type.GetType("System.String"));
dc = dtMTXX.Columns.Add("出港类别", Type.GetType("System.String"));
dc = dtMTXX.Columns.Add("装船时间", Type.GetType("System.String"));
dc = dtMTXX.Columns.Add("堆存天", Type.GetType("System.String"));
}
else
{
if (bz == 1)
{
if (bz0 == 0)
{
newRow = dtMTXX.NewRow();
if (ls.Substring(0, sss).Equals("<td align=\"center\">"))
{
ls = ls.Substring(sss);
ttt = ls.IndexOf("<");
if (ttt > 0)
{
ls = ls.Substring(0, ttt);
}
else
{
ls = "";
}
newRow[bz0] = ls;
bz0 = bz0 + 1;
}
}
else if (bz0 == 19)
{
if (ls.Substring(0, sss).Equals("<td align=\"center\">"))
{
ls = ls.Substring(sss);
ttt = ls.IndexOf("<");
if (ttt > 0)
{
ls = ls.Substring(0, ttt);
}
else
{
ls = "";
}
newRow[bz0] = ls;
}
bz0 = 0;
if (bz1 > 0)
{
if (newRow[1].ToString().Trim()!="" && newRow[2].ToString().Trim()!="")
{
dtMTXX.Rows.Add(newRow);
}
}
bz1 = bz1 + 1;
}
else
{
if (ls.Substring(0, sss).Equals("<td align=\"center\">"))
{
ls = ls.Substring(sss);
ttt = ls.IndexOf("<");
if (ttt > 0)
{
ls = ls.Substring(0, ttt);
}
else
{
ls = "";
}
newRow[bz0] = ls;
bz0 = bz0 + 1;
}
}
}
}
}
}
#endregion
//
#region 出口舱单
ls = "";
dc = null;
newRow = null;
bz = 0;
bz0 = 0;
bz1 = 0;
//
for (int i = 0; i < txtval.Length; i++)
{
ls = txtval[i].ToString().Trim().Replace("\t", "");
int sss = ls.IndexOf(">") + 1;
int ttt = 0;
if (sss > 0)
{
if (ls.IndexOf("暂无") > 0)
{
if (bz == 1)
{
bz = 0;
break;
}
}
else if (ls.IndexOf("出口舱单") > 0)
{
bz = 1;
//dc = dtCKCD.Columns.Add("序号", Type.GetType("System.Int32"));
//dc.AutoIncrement = true;//自动增加
//dc.AutoIncrementSeed = 1;//起始为1
//dc.AutoIncrementStep = 1;//步长为1
//dc.AllowDBNull = false;//
//
dc = dtCKCD.Columns.Add("序号", Type.GetType("System.String"));
dc = dtCKCD.Columns.Add("接收时间", Type.GetType("System.String"));
dc = dtCKCD.Columns.Add("船名", Type.GetType("System.String"));
dc = dtCKCD.Columns.Add("航次", Type.GetType("System.String"));
dc = dtCKCD.Columns.Add("提单号", Type.GetType("System.String"));
dc = dtCKCD.Columns.Add("件数", Type.GetType("System.String"));
dc = dtCKCD.Columns.Add("货重", Type.GetType("System.String"));
dc = dtCKCD.Columns.Add("体积", Type.GetType("System.String"));
dc = dtCKCD.Columns.Add("箱号", Type.GetType("System.String"));
dc = dtCKCD.Columns.Add("尺寸", Type.GetType("System.String"));
dc = dtCKCD.Columns.Add("箱型", Type.GetType("System.String"));
dc = dtCKCD.Columns.Add("箱主", Type.GetType("System.String"));
dc = dtCKCD.Columns.Add("铅封号", Type.GetType("System.String"));
dc = dtCKCD.Columns.Add("整箱重", Type.GetType("System.String"));
dc = dtCKCD.Columns.Add("离港时间", Type.GetType("System.String"));
}
else
{
if (bz == 1)
{
if (bz0 == 0)
{
newRow = dtCKCD.NewRow();
if (ls.Substring(0, sss).Equals("<td align=\"center\">"))
{
ls = ls.Substring(sss);
ttt = ls.IndexOf("<");
if (ttt > 0)
{
ls = ls.Substring(0, ttt);
}
else
{
ls = "";
}
newRow[bz0] = ls;
bz0 = bz0 + 1;
}
}
else if (bz0 == 14)
{
if (ls.Substring(0, sss).Equals("<td align=\"center\">"))
{
ls = ls.Substring(sss);
ttt = ls.IndexOf("<");
if (ttt > 0)
{
ls = ls.Substring(0, ttt);
}
else
{
ls = "";
}
newRow[bz0] = ls;
}
bz0 = 0;
if (bz1 > 0)
{
dtCKCD.Rows.Add(newRow);
}
bz1 = bz1 + 1;
}
else
{
if (ls.Substring(0, sss).Equals("<td align=\"center\">"))
{
ls = ls.Substring(sss);
ttt = ls.IndexOf("<");
if (ttt > 0)
{
ls = ls.Substring(0, ttt);
}
else
{
ls = "";
}
newRow[bz0] = ls;
bz0 = bz0 + 1;
}
}
}
}
}
}
#endregion
//
if (dtCKCD == null || dtCKCD.Rows.Count<1)//如果出口舱单没有信息就需要加载其他数据表内容
{
#region 海关放行信息
ls = "";
dc = null;
newRow = null;
bz = 0;
bz0 = 0;
bz1 = 0;
//
for (int i = 0; i < txtval.Length; i++)
{
ls = txtval[i].ToString().Trim().Replace("\t", "");
int sss = ls.IndexOf(">") + 1;
int ttt = 0;
if (sss > 0)
{
if (ls.IndexOf("暂无") > 0)
{
if (bz == 1)
{
bz = 0;
break;
}
}
else if (ls.IndexOf("外理放行审核信息") > 0)
{
if (bz == 1)
{
bz = 0;
break;
}
}
else if (ls.IndexOf("海关放行信息") > 0)
{
bz = 1;
//dc = dtHGFXXX.Columns.Add("序号", Type.GetType("System.Int32"));
//dc.AutoIncrement = true;//自动增加
//dc.AutoIncrementSeed = 1;//起始为1
//dc.AutoIncrementStep = 1;//步长为1
//dc.AllowDBNull = false;//
//
dc = dtHGFXXX.Columns.Add("报关单号", Type.GetType("System.String"));
dc = dtHGFXXX.Columns.Add("放行时间", Type.GetType("System.String"));
dc = dtHGFXXX.Columns.Add("放行件数", Type.GetType("System.String"));
dc = dtHGFXXX.Columns.Add("船名", Type.GetType("System.String"));
dc = dtHGFXXX.Columns.Add("航次", Type.GetType("System.String"));
dc = dtHGFXXX.Columns.Add("提单号", Type.GetType("System.String"));
dc = dtHGFXXX.Columns.Add("净重", Type.GetType("System.String"));
dc = dtHGFXXX.Columns.Add("毛重", Type.GetType("System.String"));
dc = dtHGFXXX.Columns.Add("海关状态", Type.GetType("System.String"));
dc = dtHGFXXX.Columns.Add("导入时间", Type.GetType("System.String"));
dc = dtHGFXXX.Columns.Add("箱号", Type.GetType("System.String"));
}
else
{
if (bz == 1)
{
if (bz0 == 0)
{
newRow = dtHGFXXX.NewRow();
if (ls.Substring(0, sss).Equals("<td align=\"center\">"))
{
ls = ls.Substring(sss);
ttt = ls.IndexOf("<");
if (ttt > 0)
{
ls = ls.Substring(0, ttt);
}
else
{
ls = "";
}
newRow[bz0] = ls;
bz0 = bz0 + 1;
}
}
else if (bz0 == 9)
{
if (ls.Substring(0, sss).Equals("<td align=\"center\">"))
{
ls = ls.Substring(sss);
ttt = ls.IndexOf("<");
if (ttt > 0)
{
ls = ls.Substring(0, ttt);
}
else
{
ls = "";
}
newRow[bz0] = ls;
}
//
newRow[bz0+1] = "";
bz0 = 0;
if (bz1 > 0)
{
dtHGFXXX.Rows.Add(newRow);
}
bz1 = bz1 + 1;
}
else
{
if (ls.Substring(0, sss).Equals("<td align=\"center\">"))
{
ls = ls.Substring(sss);
ttt = ls.IndexOf("<");
if (ttt > 0)
{
ls = ls.Substring(0, ttt);
}
else
{
ls = "";
}
newRow[bz0] = ls;
bz0 = bz0 + 1;
}
}
}
}
}
}
#endregion
//
if (dtHGFXXX != null || dtCKCD.Rows.Count < 1)//如果海关放行信息表有信息
{
#region 外理放行审核信息
ls = "";
dc = null;
newRow = null;
bz = 0;
bz0 = 0;
bz1 = 0;
//
for (int i = 0; i < txtval.Length; i++)
{
ls = txtval[i].ToString().Trim().Replace("\t", "");
int sss = ls.IndexOf(">") + 1;
int ttt = 0;
if (sss > 0)
{
if (ls.IndexOf("暂无") > 0)
{
if (bz == 1)
{
bz = 0;
break;
}
}
else if (ls.IndexOf("出口舱单") > 0)
{
if (bz == 1)
{
bz = 0;
break;
}
}
else if (ls.IndexOf("外理放行审核信息") > 0)
{
bz = 1;
//dc = dtWLFXSHXX.Columns.Add("序号", Type.GetType("System.Int32"));
//dc.AutoIncrement = true;//自动增加
//dc.AutoIncrementSeed = 1;//起始为1
//dc.AutoIncrementStep = 1;//步长为1
//dc.AllowDBNull = false;//
//
dc = dtWLFXSHXX.Columns.Add("序号", Type.GetType("System.String"));
dc = dtWLFXSHXX.Columns.Add("英文船名", Type.GetType("System.String"));
dc = dtWLFXSHXX.Columns.Add("航次", Type.GetType("System.String"));
dc = dtWLFXSHXX.Columns.Add("主单号", Type.GetType("System.String"));
dc = dtWLFXSHXX.Columns.Add("分单号", Type.GetType("System.String"));
dc = dtWLFXSHXX.Columns.Add("箱号", Type.GetType("System.String"));
}
else
{
if (bz == 1)
{
if (bz0 == 0)
{
newRow = dtWLFXSHXX.NewRow();
if (ls.Substring(0, sss).Equals("<td align=\"center\">"))
{
ls = ls.Substring(sss);
ttt = ls.IndexOf("<");
if (ttt > 0)
{
ls = ls.Substring(0, ttt);
}
else
{
ls = "";
}
newRow[bz0] = ls;
bz0 = bz0 + 1;
}
}
else if (bz0 == 5)
{
if (ls.Substring(0, sss).Equals("<td align=\"center\">"))
{
ls = ls.Substring(sss);
ttt = ls.IndexOf("<");
if (ttt > 0)
{
ls = ls.Substring(0, ttt);
}
else
{
ls = "";
}
newRow[bz0] = ls;
}
bz0 = 0;
if (bz1 > 0)
{
dtWLFXSHXX.Rows.Add(newRow);
}
bz1 = bz1 + 1;
}
else
{
if (ls.Substring(0, sss).Equals("<td align=\"center\">"))
{
ls = ls.Substring(sss);
ttt = ls.IndexOf("<");
if (ttt > 0)
{
ls = ls.Substring(0, ttt);
}
else
{
ls = "";
}
newRow[bz0] = ls;
bz0 = bz0 + 1;
}
}
}
}
}
}
#endregion
//
if (dtWLFXSHXX == null || dtWLFXSHXX.Rows.Count < 1)//如果外理放行审核信息表没有信息就需要加载海关运抵报告信息表
{
#region 海关运抵报告信息表
ls = "";
dc = null;
newRow = null;
bz = 0;
bz0 = 0;
bz1 = 0;
//
for (int i = 0; i < txtval.Length; i++)
{
ls = txtval[i].ToString().Trim().Replace("\t", "");
int sss = ls.IndexOf(">") + 1;
int ttt = 0;
if (sss > 0)
{
if (ls.IndexOf("暂无") > 0)
{
if (bz == 1)
{
bz = 0;
break;
}
}
else if (ls.IndexOf("海关放行信息") > 0)
{
if (bz == 1)
{
bz = 0;
break;
}
}
else if (ls.IndexOf("海关运抵报告信息表") > 0)
{
bz = 1;
//
dc = dtHGYDBGXX.Columns.Add("序号", Type.GetType("System.String"));
dc = dtHGYDBGXX.Columns.Add("船名", Type.GetType("System.String"));
dc = dtHGYDBGXX.Columns.Add("航次", Type.GetType("System.String"));
dc = dtHGYDBGXX.Columns.Add("主单号", Type.GetType("System.String"));
dc = dtHGYDBGXX.Columns.Add("分单号", Type.GetType("System.String"));
dc = dtHGYDBGXX.Columns.Add("进港时间", Type.GetType("System.String"));
dc = dtHGYDBGXX.Columns.Add("发送时间", Type.GetType("System.String"));
dc = dtHGYDBGXX.Columns.Add("回执时间", Type.GetType("System.String"));
dc = dtHGYDBGXX.Columns.Add("回执状态", Type.GetType("System.String"));
dc = dtHGYDBGXX.Columns.Add("回执信息", Type.GetType("System.String"));
}
else
{
if (bz == 1)
{
if (bz0 == 0)
{
newRow = dtHGYDBGXX.NewRow();
if (ls.Substring(0, sss).Equals("<td align=\"center\">"))
{
ls = ls.Substring(sss);
ttt = ls.IndexOf("<");
if (ttt > 0)
{
ls = ls.Substring(0, ttt);
}
else
{
ls = "";
}
newRow[bz0] = ls;
bz0 = bz0 + 1;
}
}
else if (bz0 == 9)
{
if (ls.Substring(0, sss).Equals("<td align=\"center\">"))
{
ls = ls.Substring(sss);
ttt = ls.IndexOf("<");
if (ttt > 0)
{
ls = ls.Substring(0, ttt);
}
else
{
ls = "";
}
newRow[bz0] = ls;
}
bz0 = 0;
if (bz1 > 0)
{
dtHGYDBGXX.Rows.Add(newRow);
}
bz1 = bz1 + 1;
}
else
{
if (ls.Substring(0, sss).Equals("<td align=\"center\">"))
{
ls = ls.Substring(sss);
ttt = ls.IndexOf("<");
if (ttt > 0)
{
ls = ls.Substring(0, ttt);
}
else
{
ls = "";
}
newRow[bz0] = ls;
bz0 = bz0 + 1;
}
}
}
}
}
}
#endregion
}
//
#region 补充填充海关放行的箱号字段
if (dtWLFXSHXX != null || dtCKCD.Rows.Count < 1)//如果外理放行审核信息表有信息
{
for (int i = 0; i < dtWLFXSHXX.Rows.Count; i++)
{
string fdh = dtWLFXSHXX.Rows[i]["分单号"].ToString().Trim();
for (int j = 0; j < dtHGFXXX.Rows.Count; j++)
{
if (dtHGFXXX.Rows[j]["提单号"].ToString().Trim().Equals(fdh))
{
dtHGFXXX.Rows[j]["箱号"] = dtWLFXSHXX.Rows[i]["箱号"].ToString().Trim();
}
}
//
}
}
else if (dtHGYDBGXX != null || dtCKCD.Rows.Count < 1)//如果海关运抵报告信息表有信息
{
for (int i = 0; i < dtHGYDBGXX.Rows.Count; i++)
{
string fdh = dtHGYDBGXX.Rows[i]["分单号"].ToString().Trim();
for (int j = 0; j < dtHGFXXX.Rows.Count; j++)
{
if (dtHGFXXX.Rows[j]["提单号"].ToString().Trim().Equals(fdh))
{
dtHGFXXX.Rows[j]["箱号"] = dtHGYDBGXX.Rows[i]["箱号"].ToString().Trim();
}
}
//
}
}
else
{
for (int i = 0; i < dtMTXX.Rows.Count; i++)
{
string fdh = dtMTXX.Rows[i]["提单号"].ToString().Trim();
for (int j = 0; j < dtHGFXXX.Rows.Count; j++)
{
if (dtHGFXXX.Rows[j]["提单号"].ToString().Trim().Equals(fdh))
{
dtHGFXXX.Rows[j]["箱号"] = dtMTXX.Rows[i]["箱号"].ToString().Trim();
}
}
//
}
}
#endregion
}
}
}
catch (Exception)
{
return;
}
return;
}
private void setInfo()
{
//getInfo(strUrl);
//
//public int setQQCTCTN(string strBSNO, string strUserID, string strSIZE, string strCTN, int strCTNNUM, string strCNTRNO, string strSEALNO)
//str = "insert into op_seai_truck(BSNO,[SIZE],CTN,CTNNUM,TEU,CTNALL,REMARK,CNTRNO,SEALNO,PKGS) values('" + strBSNO + "','" + strSIZE.Trim() + "','" + strCTN.Trim() + "',1," + iTEU + ",'" + strSIZE.Trim() + strCTN.Trim() + "','','" + strCNTRNO + "','" + strSEALNO + "'," + inum + ")";
DataColumn dc = null;
DataRow newRow = null;
dc = dtINFO.Columns.Add("序号", Type.GetType("System.Int32"));
dc.AutoIncrement = true;//自动增加
dc.AutoIncrementSeed = 1;//起始为1
dc.AutoIncrementStep = 1;//步长为1
dc.AllowDBNull = false;//
//
dc = dtINFO.Columns.Add("尺寸", Type.GetType("System.String"));
dc = dtINFO.Columns.Add("箱型", Type.GetType("System.String"));
dc = dtINFO.Columns.Add("箱量", Type.GetType("System.String"));//1
dc = dtINFO.Columns.Add("TEU", Type.GetType("System.String"));//
dc = dtINFO.Columns.Add("表现形式", Type.GetType("System.String"));
dc = dtINFO.Columns.Add("箱号", Type.GetType("System.String"));
dc = dtINFO.Columns.Add("封号", Type.GetType("System.String"));
dc = dtINFO.Columns.Add("件数", Type.GetType("System.String"));
dc = dtINFO.Columns.Add("货重", Type.GetType("System.String"));
dc = dtINFO.Columns.Add("尺码", Type.GetType("System.String"));
dc = dtINFO.Columns.Add("备注", Type.GetType("System.String"));//
dc = dtINFO.Columns.Add("包装类型", Type.GetType("System.String"));//PACKAGES
dc = dtINFO.Columns.Add("箱皮重", Type.GetType("System.String"));
//
if (dtMTXX == null || dtMTXX.Rows.Count < 1)//码头信息dtMTXX
{
strqqct = "此单暂无数据!";
}
else
{
if (dtCKCD == null || dtCKCD.Rows.Count < 1)//出口舱单dtCKCD
{
if (dtHGFXXX == null || dtHGFXXX.Rows.Count < 1)//海关放行审核信息dtHGFXXX
{
//strqqct = "此单暂无件数和尺码信息!";
for (int i = 0; i < dtMTXX.Rows.Count; i++)
{
strqqct = "";
newRow = dtINFO.NewRow();
newRow["表现形式"] = dtMTXX.Rows[i]["尺寸"].ToString().Trim() + dtMTXX.Rows[i]["箱型"].ToString().Trim();
newRow["箱号"] = dtMTXX.Rows[i]["箱号"].ToString().Trim();
newRow["封号"] = dtMTXX.Rows[i]["铅封号"].ToString().Trim();
newRow["件数"] = "0";
newRow["货重"] = (Decimal.Parse(dtMTXX.Rows[i]["箱皮重"].ToString().Trim())-Decimal.Parse(dtMTXX.Rows[i]["箱皮重"].ToString().Trim())).ToString();
newRow["尺码"] = "0";
newRow["备注"] = "";
newRow["包装类型"] = "PACKAGES";
newRow["箱皮重"] = dtMTXX.Rows[i]["箱皮重"].ToString().Trim();
dtINFO.Rows.Add(newRow);
}
}
else
{
for (int i = 0; i < dtMTXX.Rows.Count; i++)
{
strqqct = "";
newRow = dtINFO.NewRow();
int sjian = 0;
Decimal szhong = 0;
string sxh = dtMTXX.Rows[i]["箱号"].ToString().Trim();
//
for (int j = 0; j < dtHGFXXX.Rows.Count; j++)
{
if (sxh.Equals(dtHGFXXX.Rows[j]["箱号"].ToString().Trim()))
{
sjian += int.Parse(dtHGFXXX.Rows[j]["放行件数"].ToString().Trim());
szhong += Decimal.Parse(dtHGFXXX.Rows[j]["毛重"].ToString().Trim());
}
}
//
newRow["尺寸"] = dtMTXX.Rows[i]["尺寸"].ToString().Trim();
newRow["箱型"] = dtMTXX.Rows[i]["箱型"].ToString().Trim();
newRow["箱量"] = "1";
if (int.Parse(newRow["尺寸"].ToString().Trim()) < 40)
{
newRow["TEU"] = newRow["箱量"].ToString().Trim();//
}
else
{
newRow["TEU"] = (int.Parse(newRow["箱量"].ToString().Trim()) * 2).ToString();//
}
newRow["表现形式"] = dtMTXX.Rows[i]["尺寸"].ToString().Trim() + dtMTXX.Rows[i]["箱型"].ToString().Trim();
newRow["箱号"] = dtMTXX.Rows[i]["箱号"].ToString().Trim();
newRow["封号"] = dtMTXX.Rows[i]["铅封号"].ToString().Trim();
newRow["件数"] = sjian.ToString().Trim();
newRow["货重"] = szhong.ToString().Trim();
newRow["尺码"] = "0";
newRow["备注"] = "";
newRow["包装类型"] = "PACKAGES";
newRow["箱皮重"] = dtMTXX.Rows[i]["箱皮重"].ToString().Trim();
dtINFO.Rows.Add(newRow);
}
}
}
else
{
for (int i = 0; i < dtMTXX.Rows.Count; i++)
{
strqqct = "";
newRow = dtINFO.NewRow();
int sjian = 0;
Decimal szhong = 0;
Decimal schi = 0;
string sxh = dtMTXX.Rows[i]["箱号"].ToString().Trim();
//
for (int j = 0; j < dtCKCD.Rows.Count; j++)
{
if (sxh.Equals(dtCKCD.Rows[j]["箱号"].ToString().Trim()))
{
sjian += int.Parse(dtCKCD.Rows[j]["件数"].ToString().Trim());
szhong += Decimal.Parse(dtCKCD.Rows[j]["货重"].ToString().Trim());
schi += Decimal.Parse(dtCKCD.Rows[j]["体积"].ToString().Trim());
}
}
//
newRow["尺寸"] = dtMTXX.Rows[i]["尺寸"].ToString().Trim();
newRow["箱型"] = dtMTXX.Rows[i]["箱型"].ToString().Trim();
newRow["箱量"] = "1";
if (int.Parse(newRow["尺寸"].ToString().Trim()) < 40)
{
newRow["TEU"] = newRow["箱量"].ToString().Trim();//
}
else
{
newRow["TEU"] = (int.Parse(newRow["箱量"].ToString().Trim())*2).ToString();//
}
newRow["表现形式"] = dtMTXX.Rows[i]["尺寸"].ToString().Trim()+dtMTXX.Rows[i]["箱型"].ToString().Trim();
newRow["箱号"] = dtMTXX.Rows[i]["箱号"].ToString().Trim();
newRow["封号"] = dtMTXX.Rows[i]["铅封号"].ToString().Trim();
newRow["件数"] = sjian.ToString().Trim();
newRow["货重"] = szhong.ToString().Trim();
newRow["尺码"] = schi.ToString().Trim();
newRow["备注"] = "";
newRow["包装类型"] = "PACKAGES";
newRow["箱皮重"] = dtMTXX.Rows[i]["箱皮重"].ToString().Trim();
dtINFO.Rows.Add(newRow);
}
}
}
DataTable dt = dtINFO;
}
//--
}
}