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.
DS7/DSWeb/EDI/INTTRAEDIExport.aspx.cs

1962 lines
101 KiB
C#

2 years ago
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using System.Xml;
using DSWeb.EntityDA;
using DSWeb.Models;
using JsonHelper;
namespace DSWeb.EDI
{
public partial class INTTRAEDIExport : System.Web.UI.Page
{
public string strGIDS;//
public string strBSNO;//
public string strUserID;//登录用户GID
public string strCompanyID;//公司GID
public string strShowName;//用户显示名
public string strDeptName;//部门名称
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString();
}
else
{
Server.Transfer("~/Error/Fri}Error.aspx");
return;
}
if (Session["SHOWNAME"] != null)
{
strShowName = Session["SHOWNAME"].ToString();
}
if (Session["COMPANYID"] != null)
{
strCompanyID = Session["COMPANYID"].ToString();
}
if (Session["DEPTNAME"] != null)
{
strDeptName = Session["DEPTNAME"].ToString();
}
//
if (this.hdExport.Value != "")
{
setXML();
setExcelReport();
return;
}
//
if (!IsPostBack)
{
if (Request.QueryString["id"] != null && Request.QueryString["id"].ToString().Trim() != "") //if (Request.QueryString["id"] != null)
{
strBSNO = Request.QueryString["id"].ToString().Trim();
this.hdBSNO.Value = strBSNO;
}
//
if (Request.QueryString["ids"] != null && Request.QueryString["ids"].ToString().Trim() != "") //if (Request.QueryString["id"] != null)
{
strGIDS = Request.QueryString["ids"].ToString().Trim();
this.hdGIDS.Value = strGIDS;
}
//
getXML();
}
}
protected void getXML()
{
string OppPath = "xml";
string xmlPath = Server.MapPath(OppPath);
string xmlName = "INTTRA.xml";
//
if (File.Exists(xmlPath + "//" + xmlName)) //判断文件是否寸在
{
//存在的情况下
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(xmlPath + "//" + xmlName);
//更新文件
XmlNode roots = xmldoc.SelectSingleNode("History");//获取History节点的所有子节点
foreach (XmlNode root in roots)//遍历所有子节点
{
XmlElement xe = (XmlElement)root;//将子节点类型转换为XmlElement类型
if (xe.GetAttribute("companyid").ToString().Trim() == strCompanyID.Trim())//如果id属性值为“strCompanyID.Trim()”
{
XmlNodeList bakss = xe.ChildNodes;//继续获取xe子节点的所有子节点
foreach (XmlNode baks in bakss)//遍历
{
XmlElement bak = (XmlElement)baks;//转换类型
if (bak.Name == "Edit1")//如果找到
{
Edit1.Text = bak.InnerText.Trim();//发送方代码
}
else if (bak.Name == "Edit2")//发送方名称
{
Edit2.Text = bak.InnerText.Trim();
}
else if (bak.Name == "Edit3")//接收方代码
{
Edit3.Text = bak.InnerText.Trim();
}
else if (bak.Name == "Edit4")//接收方名称
{
Edit4.Text = bak.InnerText.Trim();
}
else if (bak.Name == "Edit7")//联系人
{
Edit7.Text = bak.InnerText.Trim();
}
else if (bak.Name == "Edit5")//固定电话
{
Edit5.Text = bak.InnerText.Trim();
}
else if (bak.Name == "Edit6")//邮件地址
{
Edit6.Text = bak.InnerText.Trim();
}
else if (bak.Name == "Edit12")//详细地址
{
Edit12.Text = bak.InnerText.Trim();
}
else if (bak.Name == "RadioGroup3")//文件功能
{
RadioGroup3.SelectedValue = bak.InnerText.ToString().Trim();
}
else if (bak.Name == "RadioGroup1")//类型
{
RadioGroup1.SelectedValue = bak.InnerText.ToString().Trim();
}
else if (bak.Name == "tbAddr")//FTP地址
{
tbAddr.Text = bak.InnerText.Trim();
}
else if (bak.Name == "tbName")//FTP用户名
{
tbName.Text = bak.InnerText.Trim();
}
else if (bak.Name == "tbPassword")//FTP密码
{
tbPassword.Text = bak.InnerText.Trim();
}
else if (bak.Name == "tbFile")//FTP文件夹
{
tbFile.Text = bak.InnerText.Trim();
}
}
break;
}
}
}
}
protected void setXML()
{
string OppPath = "xml";
string xmlPath = Server.MapPath(OppPath);
string xmlName = "INTTRA.xml";
//
if (File.Exists(xmlPath + "//" + xmlName)) //判断文件是否寸在
{
//更新文件
updateXML(xmlPath, xmlName);
}
else
{
//创建文件
createXML(xmlPath, xmlName);
}
}
protected void updateXML(string xmlPath, string xmlName)
{
int bz = 0;
//插入
//存在的情况下
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(xmlPath + "//" + xmlName);
//更新文件
XmlNode roots = xmldoc.SelectSingleNode("History");//获取History节点的所有子节点
foreach (XmlNode root in roots)//遍历所有子节点
{
XmlElement xe = (XmlElement)root;//将子节点类型转换为XmlElement类型
if (xe.GetAttribute("companyid").ToString().Trim() == strCompanyID.Trim())//如果id属性值为“strCompanyID.Trim()”
{
bz = 1;
XmlNodeList bakss = xe.ChildNodes;//继续获取xe子节点的所有子节点
foreach (XmlNode baks in bakss)//遍历
{
XmlElement bak = (XmlElement)baks;//转换类型
if (bak.Name == "Edit1")//如果找到
{
bak.InnerText = Edit1.Text.Trim();//发送方代码
}
else if (bak.Name == "Edit2")//发送方名称
{
bak.InnerText = Edit2.Text.Trim();
}
else if (bak.Name == "Edit3")//接收方代码
{
bak.InnerText = Edit3.Text.Trim();
}
else if (bak.Name == "Edit4")//接收方名称
{
bak.InnerText = Edit4.Text.Trim();
}
else if (bak.Name == "Edit7")//联系人
{
bak.InnerText = Edit7.Text.Trim();
}
else if (bak.Name == "Edit5")//固定电话
{
bak.InnerText = Edit5.Text.Trim();
}
else if (bak.Name == "Edit6")//邮件地址
{
bak.InnerText = Edit6.Text.Trim();
}
else if (bak.Name == "Edit12")//详细地址
{
bak.InnerText = Edit12.Text.Trim();
}
else if (bak.Name == "RadioGroup3")//文件功能
{
bak.InnerText = RadioGroup3.SelectedValue.ToString().Trim();
}
else if (bak.Name == "RadioGroup1")//类型
{
bak.InnerText = RadioGroup1.SelectedValue.ToString().Trim();
}
else if (bak.Name == "tbAddr")//FTP地址
{
bak.InnerText = tbAddr.Text.Trim();
}
else if (bak.Name == "tbName")//FTP用户名
{
bak.InnerText = tbName.Text.Trim();
}
else if (bak.Name == "tbPassword")//FTP密码
{
bak.InnerText = tbPassword.Text.Trim();
}
else if (bak.Name == "tbFile")//FTP文件夹
{
bak.InnerText = tbFile.Text.Trim();
}
}
break;
}
}
//
if (bz == 0)
{
insertXML(xmlPath, xmlName);
}
else
{
xmldoc.Save(xmlPath + "//" + xmlName);
}
}
protected void createXML(string xmlPath, string xmlName)
{
Directory.CreateDirectory(xmlPath);//创建该文件
XmlDocument xmldoc = new XmlDocument();
XmlNode xmlnode = xmldoc.CreateXmlDeclaration("1.0", "gb2312", null);
xmldoc.AppendChild(xmlnode);
XmlElement root = xmldoc.CreateElement("History");
xmldoc.AppendChild(root);
XmlElement bak = xmldoc.CreateElement("Bak");
bak.SetAttribute("companyid", strCompanyID.Trim());
root.AppendChild(bak);
XmlElement xeEdit1 = xmldoc.CreateElement("Edit1");
xeEdit1.InnerText = Edit1.Text.Trim();
bak.AppendChild(xeEdit1); //发送方代码
XmlElement xeEdit2 = xmldoc.CreateElement("Edit2");
xeEdit2.InnerText = Edit2.Text.Trim();
bak.AppendChild(xeEdit2); //发送方名称
XmlElement xeEdit3 = xmldoc.CreateElement("Edit3");
xeEdit3.InnerText = Edit3.Text.Trim();
bak.AppendChild(xeEdit3); //接收方代码
XmlElement xeEdit4 = xmldoc.CreateElement("Edit4");
xeEdit4.InnerText = Edit4.Text.Trim();
bak.AppendChild(xeEdit4); //接收方名称
XmlElement xeEdit7 = xmldoc.CreateElement("Edit7");
xeEdit7.InnerText = Edit7.Text.Trim();
bak.AppendChild(xeEdit7); //联系人
XmlElement xeEdit5 = xmldoc.CreateElement("Edit5");
xeEdit5.InnerText = Edit5.Text.Trim();
bak.AppendChild(xeEdit5); //固定电话
XmlElement xeEdit6 = xmldoc.CreateElement("Edit6");
xeEdit6.InnerText = Edit6.Text.Trim();
bak.AppendChild(xeEdit6); //邮件地址
XmlElement xeEdit12 = xmldoc.CreateElement("Edit12");
xeEdit12.InnerText = Edit12.Text.Trim();
bak.AppendChild(xeEdit12); //详细地址
XmlElement xeRadioGroup3 = xmldoc.CreateElement("RadioGroup3");
xeRadioGroup3.InnerText = RadioGroup3.SelectedValue.ToString().Trim();
bak.AppendChild(xeRadioGroup3); // 文件功能
XmlElement xeRadioGroup1 = xmldoc.CreateElement("RadioGroup1");
xeRadioGroup1.InnerText = RadioGroup1.SelectedValue.ToString().Trim();
bak.AppendChild(xeRadioGroup1); // 类型
XmlElement xeAddr = xmldoc.CreateElement("tbAddr");
xeAddr.InnerText = tbAddr.Text.Trim();
bak.AppendChild(xeAddr); // FTP地址
XmlElement xeName = xmldoc.CreateElement("tbName");
xeName.InnerText = tbName.Text.Trim();
bak.AppendChild(xeName); // FTP用户名
XmlElement xePassword = xmldoc.CreateElement("tbPassword");
xePassword.InnerText = tbPassword.Text.Trim();
bak.AppendChild(xePassword); // FTP密码
XmlElement xeFile = xmldoc.CreateElement("tbFile");
xeFile.InnerText = tbFile.Text.Trim();
bak.AppendChild(xeFile); // FTP文件夹
xmldoc.Save(xmlPath + "//" + xmlName);
}
protected void insertXML(string xmlPath, string xmlName)
{
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(xmlPath + "\\" + xmlName);
//存在文件
XmlNode root = xmldoc.SelectSingleNode("History");
XmlElement bak = xmldoc.CreateElement("Bak");
bak.SetAttribute("companyid", strCompanyID.Trim());
root.AppendChild(bak);
XmlElement xeEdit1 = xmldoc.CreateElement("Edit1");
xeEdit1.InnerText = Edit1.Text.Trim();
bak.AppendChild(xeEdit1); //发送方代码
XmlElement xeEdit2 = xmldoc.CreateElement("Edit2");
xeEdit2.InnerText = Edit2.Text.Trim();
bak.AppendChild(xeEdit2); //发送方名称
XmlElement xeEdit3 = xmldoc.CreateElement("Edit3");
xeEdit3.InnerText = Edit3.Text.Trim();
bak.AppendChild(xeEdit3); //接收方代码
XmlElement xeEdit4 = xmldoc.CreateElement("Edit4");
xeEdit4.InnerText = Edit4.Text.Trim();
bak.AppendChild(xeEdit4); //接收方名称
XmlElement xeEdit7 = xmldoc.CreateElement("Edit7");
xeEdit7.InnerText = Edit7.Text.Trim();
bak.AppendChild(xeEdit7); //联系人
XmlElement xeEdit5 = xmldoc.CreateElement("Edit5");
xeEdit5.InnerText = Edit5.Text.Trim();
bak.AppendChild(xeEdit5); //固定电话
XmlElement xeEdit6 = xmldoc.CreateElement("Edit6");
xeEdit6.InnerText = Edit6.Text.Trim();
bak.AppendChild(xeEdit6); //邮件地址
XmlElement xeEdit12 = xmldoc.CreateElement("Edit12");
xeEdit12.InnerText = Edit12.Text.Trim();
bak.AppendChild(xeEdit12); //详细地址
XmlElement xeRadioGroup3 = xmldoc.CreateElement("RadioGroup3");
xeRadioGroup3.InnerText = RadioGroup3.SelectedValue.ToString().Trim();
bak.AppendChild(xeRadioGroup3); // 文件功能
XmlElement xeRadioGroup1 = xmldoc.CreateElement("RadioGroup1");
xeRadioGroup1.InnerText = RadioGroup1.SelectedValue.ToString().Trim();
bak.AppendChild(xeRadioGroup1); // 类型
XmlElement xeAddr = xmldoc.CreateElement("tbAddr");
xeAddr.InnerText = tbAddr.Text.Trim();
bak.AppendChild(xeAddr); // FTP地址
XmlElement xeName = xmldoc.CreateElement("tbName");
xeName.InnerText = tbName.Text.Trim();
bak.AppendChild(xeName); // FTP用户名
XmlElement xePassword = xmldoc.CreateElement("tbPassword");
xePassword.InnerText = tbPassword.Text.Trim();
bak.AppendChild(xePassword); // FTP密码
XmlElement xeFile = xmldoc.CreateElement("tbFile");
xeFile.InnerText = tbFile.Text.Trim();
bak.AppendChild(xeFile); // FTP文件夹
xmldoc.Save(xmlPath + "//" + xmlName);
}
protected void setExcelReport()
{
EDIExportDA EDIExportDA = new EDIExportDA();
T_ALL_DA T_ALL_DA = new T_ALL_DA();
SeaExportInfoDA SeaExportInfoDA = new SeaExportInfoDA();
TopSeaeEntity TopSeaeEntity = new TopSeaeEntity();
//
string alt = "";
string ls = "";
string sMBLNO = "";
string[] itmGIDS = this.hdGIDS.Value.Trim().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
if (RadioGroup1.SelectedValue.ToString().Trim() == "0")//业务订舱
{
#region 业务订舱
for (int i = 0; i < itmGIDS.Length; i++)
{
TopSeaeEntity = SeaExportInfoDA.GetID(itmGIDS[i].ToString().Trim());
sMBLNO = TopSeaeEntity.VESSEL.ToString().Trim() + " " + TopSeaeEntity.VOYNO.ToString().Trim();
//
alt += "UNB+UNOC:2+" + Edit1.Text.Trim() + "SO" + ":ZZZ+" + Edit3.Text.Trim() + ":ZZZ+" + EDIExportDA.getdate("", 2) + "+" + TopSeaeEntity.CUSTNO.ToString().Trim() + "'\r\n";
alt += "UNH+" + TopSeaeEntity.CUSTNO.ToString().Trim() + "+IFTMIN:D:99B:UN" + "'\r\n";
alt += "BGM+335+" + TopSeaeEntity.MBLNO.ToString().Trim() + "SO+" + RadioGroup3.SelectedValue.ToString().Trim() + "'\r\n"; //9原始 5 更新
alt += "DTM+137:" + EDIExportDA.getdate("", 1) + ":203" + "'\r\n";
if (TopSeaeEntity.SERVICE.ToString().Trim().ToUpper() == "DOOR-DOOR")
{
alt += "TSR+27+2" + "'\r\n";
}
else if (TopSeaeEntity.SERVICE.ToString().Trim().ToUpper() == "DOOR-CY")
{
alt += "TSR+28+2" + "'\r\n";
}
else if (TopSeaeEntity.SERVICE.ToString().Trim().ToUpper() == "CY-DOOR")
{
alt += "TSR+29+2" + "'\r\n";
}
else if (TopSeaeEntity.SERVICE.ToString().Trim().ToUpper() == "CY-CY")
{
alt += "TSR+30+2" + "'\r\n";
}
else if (TopSeaeEntity.SERVICE.ToString().Trim().ToUpper() == "OTHER")
{
alt += "TSR+30+2" + "'\r\n";
}
//
if (TopSeaeEntity.PREPARDAT.ToString().Trim() != "")
{
ls = EDIExportDA.getEDIFormat(TopSeaeEntity.PREPARDAT.ToString().Trim());
}
else if (TopSeaeEntity.PAYABLEAT.ToString().Trim() != "")
{
ls = EDIExportDA.getEDIFormat(TopSeaeEntity.PAYABLEAT.ToString().Trim());
}
//
alt += "FTX+AAI+++" + TopSeaeEntity.BLFRT.ToString().Trim() + " Payable at " + ls + " " + TopSeaeEntity.SERVICE.ToString().Trim() + " " + TopSeaeEntity.PKGS.ToString().Trim() + TopSeaeEntity.KINDPKGS.ToString().Trim() + " " +EDIExportDA.getEDIFormat(TopSeaeEntity.REMARK.ToString().Trim().Replace("\r\n"," \n")) + "'\r\n";
//
alt += "CNT+7:" + TopSeaeEntity.KGS.ToString().Trim() + ":KGM'\r\n";
alt += "CNT+11:" + TopSeaeEntity.PKGS.ToString().Trim() + "'\r\n";
alt += "CNT+15:" + TopSeaeEntity.CBM.ToString().Trim() + ":MTQ'\r\n";
//
if (TopSeaeEntity.BLFRT.ToString().Trim().ToUpper() == "FREIGHT PREPAID")//运费预付
{
alt += "LOC+57+" + TopSeaeEntity.PORTLOADID.ToString().Trim() + "::6:" + EDIExportDA.getEDIFormat(TopSeaeEntity.PREPARDAT.ToString().Trim()) + "'\r\n";
}
else if (TopSeaeEntity.BLFRT.ToString().Trim().ToUpper() == "FREIGHT COLLECT")//运费到付
{
alt += "LOC+57+" + TopSeaeEntity.PORTDISCHARGEID.ToString().Trim() + "::6:" + EDIExportDA.getEDIFormat(TopSeaeEntity.PAYABLEAT.ToString().Trim()) + "'\r\n";
}
else
{
alt += "LOC+57+" + TopSeaeEntity.PORTLOADID.ToString().Trim() + "::6:" + EDIExportDA.getEDIFormat(TopSeaeEntity.PREPARDAT.ToString().Trim()) + "'\r\n";//运费预付
}
//
alt += "RFF+BN:" + TopSeaeEntity.MBLNO.ToString().Trim() + "'\r\n";
alt += "RFF+BM:" + TopSeaeEntity.MBLNO.ToString().Trim() + "'\r\n";
alt += "RFF+CT:" + TopSeaeEntity.CONTRACTNO.ToString().Trim() + "'\r\n";
//
if (TopSeaeEntity.BLFRT.ToString().Trim().ToUpper().IndexOf("PREPAID") > -1)
{
alt += "CPI+4++P'\r\n";
}
else
{
alt += "CPI+4++C'\r\n";
}
//
alt += "TDT+20+" + EDIExportDA.CutVoyNo(TopSeaeEntity.VOYNO.ToString().Trim()) + "+1+++++:::" + EDIExportDA.getEDIFormat(TopSeaeEntity.VESSEL.ToString().Trim()) + "'\r\n";
alt += "LOC+9+" + TopSeaeEntity.PORTLOADID.ToString().Trim() + ":139:6:" + EDIExportDA.getEDIFormat(TopSeaeEntity.PORTLOAD.ToString().Trim()) + "'\r\n";
alt += "DTM+133:" + EDIExportDA.getdate(TopSeaeEntity.ETD.ToString().Trim(), 1) + ":102" + "'\r\n";
alt += "LOC+88+" + TopSeaeEntity.PORTLOADID.ToString().Trim() + ":139:6:" + EDIExportDA.getEDIFormat(TopSeaeEntity.PORTLOAD.ToString().Trim()) + "'\r\n";
alt += "LOC+11+" + TopSeaeEntity.PORTDISCHARGEID.ToString().Trim() + ":139:6:" + EDIExportDA.getEDIFormat(TopSeaeEntity.PORTDISCHARGE.ToString().Trim()) + "'\r\n";
alt += "LOC+7+" + TopSeaeEntity.DESTINATIONID.ToString().Trim() + ":139:6:" + EDIExportDA.getEDIFormat(TopSeaeEntity.DESTINATION.ToString().Trim()) + "'\r\n";
//
//if(TopSeaeEntity.("所在国家").ToString().Trim()!="")
//{
// ls=Changestr(t_op_edi.fieldbyname("AMS发货人").ToString().Trim());
//}
//else
//{
// ls=TopSeaeEntity.SHIPPER.ToString().Trim();
//}
string sSHIPPER = ".*";
ls = TopSeaeEntity.SHIPPER.ToString().Trim();//发货人
string[] itms = ls.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
if (itms.Length > 0)
{
alt += "NAD+CZ+++";
ArrayList aList = new ArrayList();
for (int k = 0; k < itms.Length; k++)
{
ls = itms[k].ToString().Trim();
for (int n = 0; n < (ls.Length / 35 + 1); n++)
{
if (ls.Length < 36)
{
aList.Add(ls);
}
else
{
string sls = ls.Trim().Substring(0, 35);
int ils = EDIExportDA.getEDISUB(sls, 35);
sls = sls.Trim().Substring(0, ils);
aList.Add(sls);//
ls = ls.Trim().Substring(ils);
}
}
}
//
for (int m = 0; m < 5; m++)
{
try
{
if(aList.Count>5)
{
if(m==4)
{
ls = aList[m].ToString().Trim();
if (ls.Length < 35)
{
alt += EDIExportDA.getEDIFormat(aList[m].ToString().Trim()) + "*:";
}
else
{
string sls = ls.Trim().Substring(0, 34);
int ils = EDIExportDA.getEDISUB(sls, 34);
sls = sls.Trim().Substring(0, ils);
alt += EDIExportDA.getEDIFormat(sls.Trim()) + "*:";
ls = ls.Trim().Substring(ils);
sSHIPPER += ls.Trim() + "\r\n";
}
}
else
{
alt += EDIExportDA.getEDIFormat(aList[m].ToString().Trim()) + ":";
}
}
else
{
alt += EDIExportDA.getEDIFormat(aList[m].ToString().Trim()) + ":";
}
}
catch (Exception)
{
alt += "";
}
}
alt = alt.Trim().Substring(0, alt.Trim().Length - 1);
//
if (aList.Count > 5)
{
for (int j = 5; j < aList.Count; j++)
{
sSHIPPER += aList[j].ToString().Trim() + "\r\n";
}
}
else
{
sSHIPPER = "";
}
alt += "'\r\n";
}
//
//if t_op_edi.fieldbyname("所在国家").ToString().Trim(!="") {
// str_all.Text.Trim():=Changestr(t_op_edi.fieldbyname("AMS收货人").ToString().Trim());
//} else {
// str_all.Text.Trim():=Changestr(TopSeaeEntity.("收货人代码").ToString().Trim());
//}
string sCONSIGNEE = ".**";
ls = TopSeaeEntity.CONSIGNEE.ToString().Trim();//收货人
itms = ls.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
if (itms.Length > 0)
{
alt += "NAD+CN+++";
//
ArrayList aList = new ArrayList();
for (int k = 0; k < itms.Length; k++)
{
ls = itms[k].ToString().Trim();
for (int n = 0; n < (ls.Length / 35 + 1); n++)
{
if (ls.Length < 36)
{
aList.Add(ls);
}
else
{
string sls = ls.Trim().Substring(0, 35);
int ils = EDIExportDA.getEDISUB(sls, 35);
sls = sls.Trim().Substring(0, ils);
aList.Add(sls);//
ls = ls.Trim().Substring(ils);
}
}
}
//
for (int m = 0; m < 5; m++)
{
try
{
if(aList.Count>5)
{
if(m==4)
{
ls = aList[m].ToString().Trim();
if (ls.Length < 34)
{
alt += EDIExportDA.getEDIFormat(aList[m].ToString().Trim()) + "**:";
}
else
{
string sls = ls.Trim().Substring(0, 33);
int ils = EDIExportDA.getEDISUB(sls, 33);
sls = sls.Trim().Substring(0, ils);
alt += EDIExportDA.getEDIFormat(sls.Trim()) + "**:";
ls = ls.Trim().Substring(ils);
sSHIPPER += ls.Trim() + "\r\n";
}
}
else
{
alt += EDIExportDA.getEDIFormat(aList[m].ToString().Trim()) + ":";
}
}
else
{
alt += EDIExportDA.getEDIFormat(aList[m].ToString().Trim()) + ":";
}
}
catch (Exception)
{
alt += "";
}
}
alt = alt.Trim().Substring(0, alt.Trim().Length - 1);
//
if (aList.Count > 5)
{
for (int j = 5; j < aList.Count; j++)
{
sCONSIGNEE += aList[j].ToString().Trim() + "\r\n";
}
}
else
{
sCONSIGNEE = "";
}
alt += "'\r\n";
}
//
//if t_op_edi.fieldbyname("所在国家").ToString().Trim(!="") {
// str_all.Text.Trim():=Changestr(t_op_edi.fieldbyname("AMS通知人").ToString().Trim());
//} else {
// str_all.Text.Trim():=Changestr(TopSeaeEntity.("通知人代码").ToString().Trim());
//}
string sNOTIFYPARTY = ".***";
ls = TopSeaeEntity.NOTIFYPARTY.ToString().Trim();//通知人
itms = ls.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
if (itms.Length > 0)
{
alt += "NAD+NI+++";
//
ArrayList aList = new ArrayList();
for (int k = 0; k < itms.Length; k++)
{
ls = itms[k].ToString().Trim();
for (int n = 0; n < (ls.Length / 35 + 1); n++)
{
if (ls.Length < 36)
{
aList.Add(ls);
}
else
{
string sls = ls.Trim().Substring(0, 35);
int ils = EDIExportDA.getEDISUB(sls, 35);
sls = sls.Trim().Substring(0, ils);
aList.Add(sls);//
ls = ls.Trim().Substring(ils);
}
}
}
//
for (int m = 0; m < 5; m++)
{
try
{
if(aList.Count>5)
{
if(m==4)
{
ls = aList[m].ToString().Trim();
if (ls.Length < 33)
{
alt += aList[m].ToString().Trim() + "***:";
}
else
{
string sls = ls.Trim().Substring(0, 32);
int ils = EDIExportDA.getEDISUB(sls, 32);
sls = sls.Trim().Substring(0, ils);
alt += EDIExportDA.getEDIFormat(sls.Trim()) + "***:";
ls = ls.Trim().Substring(ils);
sSHIPPER += ls.Trim() + "\r\n";
}
}
else
{
alt += EDIExportDA.getEDIFormat(aList[m].ToString().Trim()) + ":";
}
}
else
{
alt += EDIExportDA.getEDIFormat(aList[m].ToString().Trim()) + ":";
}
}
catch (Exception)
{
alt += "";
}
}
alt = alt.Trim().Substring(0, alt.Trim().Length - 1);
//
if (aList.Count > 5)
{
alt += "***";
//
for (int j = 5; j < aList.Count; j++)
{
sNOTIFYPARTY += aList[j].ToString().Trim() + "\r\n";
}
}
else
{
sNOTIFYPARTY = "";
}
alt += "'\r\n";
}
//
alt += "NAD+CA+" + TopSeaeEntity.VESSELID.ToString().Trim() + ":160:86++" + EDIExportDA.getEDIFormat(TopSeaeEntity.CARRIER.ToString().Trim()) + "'\r\n";
//
if (TopSeaeEntity.SERVICE.ToString().Trim().ToUpper() == "DOOR-DOOR")
{
ls = Edit12.Text.Trim().Replace("\r\n", " \n");//
int n = 0;
if (ls.Length > 35)
{
alt += "NAD+SF+++" + ls.Trim().Substring(0, 35) + "+";
ls = ls.Trim().Substring(35);
while (ls.Length > 0)
{
if (ls.Length < 36)
{
alt += ":" + EDIExportDA.getEDIFormat(ls);
ls = "";
}
else
{
string sls = ls.Trim().Substring(0, 35);
int ils = EDIExportDA.getEDISUB(sls, 35);
sls = sls.Trim().Substring(0, ils);
alt += ":" + EDIExportDA.getEDIFormat(sls);//
ls = ls.Trim().Substring(ils);
}
n = n + 1;
//
if (ls.Trim() == "")
{
break;
}
if (n == 5)
{
break;
}
}
alt += "'\r\n";
}
else
{
alt += "NAD+SF+++" + EDIExportDA.getEDIFormat(ls.Trim()) + "'\r\n";
}
//
alt += "CTA+IC+:" + Edit7.Text.Trim() + "'\r\n";
alt += "COM+" + Edit5.Text.Trim() + ":TE" + "'\r\n";
alt += "COM+" + Edit6.Text.Trim() + ":EM" + "'\r\n";
//
//str_head:="";
//str_all.Clear;
//if t_op_edi.fieldbyname("所在国家").ToString().Trim(!="") {
// str_all.Text.Trim():=Changestr(t_op_edi.fieldbyname("AMS收货人").ToString().Trim()); //t_op_edi
//} else {
// str_all.Text.Trim():=Changestr(TopSeaeEntity.("收货人代码").ToString().Trim());
//}
ls = TopSeaeEntity.SHIPPER.ToString().Trim().Replace("\r\n", " \n");
if ((ls.Trim().ToUpper().IndexOf("TO ORDER") > -1) || (ls.Trim().ToUpper().IndexOf("SAME AS") > -1))
{
//if t_op_edi.fieldbyname("所在国家").ToString().Trim(!="") {
// str_all.Text.Trim():=Changestr(t_op_edi.fieldbyname("通知人代码").ToString().Trim());
//} else {
// str_all.Text.Trim():=Changestr(TopSeaeEntity.("通知人代码").ToString().Trim());
//}
ls = TopSeaeEntity.NOTIFYPARTY.ToString().Trim().Replace("\r\n", " \n");
}
//
n = 0;
if (ls.Length > 35)
{
alt += "NAD+ST+++" + ls.Trim().Substring(0, 35) + "+";
ls = ls.Trim().Substring(35);
while (ls.Length > 0)
{
if (ls.Length < 36)
{
alt += ":" + EDIExportDA.getEDIFormat(ls);
ls = "";
}
else
{
string sls = ls.Trim().Substring(0, 35);
int ils = EDIExportDA.getEDISUB(sls, 35);
sls = sls.Trim().Substring(0, ils);
alt += ":" + EDIExportDA.getEDIFormat(sls);//
ls = ls.Trim().Substring(ils);
}
n = n + 1;
//
if (ls.Trim() == "")
{
break;
}
if (n == 5)
{
break;
}
}
alt += "'\r\n";
}
else
{
alt += "NAD+ST+++" + EDIExportDA.getEDIFormat(ls.Trim()) + "'\r\n";
}
//
alt += "CTA+IC+:" + Edit7.Text.Trim() + "'\r\n";
alt += "COM+" + Edit5.Text.Trim() + ":TE" + "'\r\n";
alt += "COM+" + Edit6.Text.Trim() + ":EM" + "'\r\n";
}
else if (TopSeaeEntity.SERVICE.ToString().Trim().ToUpper() == "DOOR-CY")
{
ls = Edit12.Text.Trim().Replace("\r\n", " \n");//
int n = 0;
if (ls.Length > 35)
{
alt += "NAD+SF+++" + EDIExportDA.getEDIFormat(ls.Trim().Substring(0, 35)) + "+";
ls = ls.Trim().Substring(35);
while (ls.Length > 0)
{
if (ls.Length < 36)
{
alt += ":" + EDIExportDA.getEDIFormat(ls);
ls = "";
}
else
{
string sls = ls.Trim().Substring(0, 35);
int ils = EDIExportDA.getEDISUB(sls, 35);
sls = sls.Trim().Substring(0, ils);
alt += ":" + EDIExportDA.getEDIFormat(sls);//
ls = ls.Trim().Substring(ils);
}
n = n + 1;
//
if (ls.Trim() == "")
{
break;
}
if (n == 5)
{
break;
}
}
alt += "'\r\n";
}
else
{
alt += "NAD+SF+++" + EDIExportDA.getEDIFormat(ls.Trim()) + "'\r\n";
}
//
alt += "CTA+IC+:" + Edit7.Text.Trim() + "'\r\n";
alt += "COM+" + Edit5.Text.Trim() + ":TE" + "'\r\n";
alt += "COM+" + Edit6.Text.Trim() + ":EM" + "'\r\n";
}
else if (TopSeaeEntity.SERVICE.ToString().Trim().ToUpper() == "CY-DOOR")
{
//str_head:="";
//str_all.Clear;
//if t_op_edi.fieldbyname("所在国家").ToString().Trim(!="") {
// str_all.Text.Trim():=Changestr(t_op_edi.fieldbyname("AMS收货人").ToString().Trim());
//} else {
// str_all.Text.Trim():=Changestr(TopSeaeEntity.("收货人代码").ToString().Trim());
//}
ls = TopSeaeEntity.CONSIGNEE.ToString().Trim().Replace("\r\n", " \n");
int n = 0;
if (ls.Length > 35)
{
alt += "NAD+ST+++" + EDIExportDA.getEDIFormat(ls.Trim().Substring(0, 35)) + "+";
ls = ls.Trim().Substring(35);
while (ls.Length > 0)
{
if (ls.Length < 36)
{
alt += ":" + EDIExportDA.getEDIFormat(ls);
ls = "";
}
else
{
string sls = ls.Trim().Substring(0, 35);
int ils = EDIExportDA.getEDISUB(sls, 35);
sls = sls.Trim().Substring(0, ils);
alt += ":" + EDIExportDA.getEDIFormat(sls);//
ls = ls.Trim().Substring(ils);
}
n = n + 1;
//
if (ls.Trim() == "")
{
break;
}
if (n == 5)
{
break;
}
}
alt += "'\r\n";
}
else
{
alt += "NAD+ST+++" + EDIExportDA.getEDIFormat(ls.Trim()) + "'\r\n";
}
//
alt += "CTA+IC+:" + Edit7.Text.Trim() + "'\r\n";
alt += "COM+" + Edit5.Text.Trim() + ":TE" + "'\r\n";
alt += "COM+" + Edit6.Text.Trim() + ":EM" + "'\r\n";
}
//
if (Edit2.Text.Trim().Length <= 35)
{
alt += "NAD+FW+SEAWORTHYQD:160:86++" + Edit2.Text.Trim() + "'\r\n";
}
else if (Edit2.Text.Trim().Length > 70)
{
alt += "NAD+FW+SEAWORTHYQD:160:86++" + Edit2.Text.Trim().Substring(0, 35) + "+" + Edit2.Text.Trim().Substring(35, 35) + "'\r\n";
}
else
{
alt += "NAD+FW+SEAWORTHYQD:160:86++" + Edit2.Text.Trim().Substring(0, 35) + "+" + Edit2.Text.Trim().Substring(35) + "'\r\n";
}
//
if (Edit2.Text.Trim().Length <= 35)
{
alt += "NAD+HI+SEAWORTHYQD:160:86++" + Edit2.Text.Trim() + "'\r\n";
}
else if (Edit2.Text.Trim().Length > 70)
{
alt += "NAD+HI+SEAWORTHYQD:160:86++" + Edit2.Text.Trim().Substring(0, 35) + "+" + Edit2.Text.Trim().Substring(35, 35) + "'\r\n";
}
else
{
alt += "NAD+HI+SEAWORTHYQD:160:86++" + Edit2.Text.Trim().Substring(0, 35) + "+" + Edit2.Text.Trim().Substring(35) + "'\r\n";
}
//
alt += "CTA+IC+:" + Edit7.Text.Trim() + "'\r\n";
alt += "COM+" + Edit5.Text.Trim() + ":TE" + "'\r\n";
alt += "COM+" + Edit6.Text.Trim() + ":EM" + "'\r\n";
alt += "NAD+MR+++" + Edit2.Text.Trim() + "'\r\n";
alt += "CTA+NT+:" + Edit7.Text.Trim() + "'\r\n";
alt += "COM+" + Edit6.Text.Trim() + ":EM" + "'\r\n";
ls = T_ALL_DA.GetStrSQL("EDICODE", "select EDICODE from code_package where pkgs='" + EDIExportDA.getEDIFormat(TopSeaeEntity.KINDPKGS.ToString().Trim()) + "'");
alt += "GID+1+" + TopSeaeEntity.PKGS.ToString().Trim() + ":" +ls.Trim() + "::6:" + EDIExportDA.getEDIFormat(TopSeaeEntity.KINDPKGS.ToString().Trim()) + "'\r\n";
//货物描述
//if (RadioGroup1.SelectedValue.ToString().Trim() == "0")
//{
ls = TopSeaeEntity.DESCRIPTION.ToString().Trim();//货物描述
if(ls.Trim()!="")
{
string[] itmss = ls.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
for (int k = 0; k < itmss.Length; k++)
{
ls = itmss[k].ToString().Trim();
while (ls.Length > 0)
{
if (ls.Length < 51)
{
alt += "FTX+AAA+++" + EDIExportDA.getEDIFormat(ls) + "'\r\n";
ls = "";
}
else
{
string sls = ls.Trim().Substring(0, 50);
int ils = EDIExportDA.getEDISUB(sls, 50);
sls = sls.Trim().Substring(0, ils);
alt += "FTX+AAA+++" + EDIExportDA.getEDIFormat(sls) + "'\r\n";//货物描述1
ls = ls.Trim().Substring(ils);
}
}
}
}
//}
//发货人内容冗余
ls = sSHIPPER.Trim();//货物描述
if (ls.Trim().Length > 2)
{
string[] itmss = ls.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
for (int k = 0; k < itmss.Length; k++)
{
ls = itmss[k].ToString().Trim();
while (ls.Length > 0)
{
if (ls.Length < 51)
{
alt += "FTX+AAA+++" + EDIExportDA.getEDIFormat(ls) + "'\r\n";
ls = "";
}
else
{
string sls = ls.Trim().Substring(0, 50);
int ils = EDIExportDA.getEDISUB(sls, 50);
sls = sls.Trim().Substring(0, ils);
alt += "FTX+AAA+++" + EDIExportDA.getEDIFormat(sls) + "'\r\n";//货物描述1
ls = ls.Trim().Substring(ils);
}
}
}
}
//收货人内容冗余
ls = sCONSIGNEE.Trim();//货物描述
if (ls.Trim().Length > 3)
{
string[] itmss = ls.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
for (int k = 0; k < itmss.Length; k++)
{
ls = itmss[k].ToString().Trim();
while (ls.Length > 0)
{
if (ls.Length < 51)
{
alt += "FTX+AAA+++" + EDIExportDA.getEDIFormat(ls) + "'\r\n";
ls = "";
}
else
{
string sls = ls.Trim().Substring(0, 50);
int ils = EDIExportDA.getEDISUB(sls, 50);
sls = sls.Trim().Substring(0, ils);
alt += "FTX+AAA+++" + EDIExportDA.getEDIFormat(sls) + "'\r\n";//货物描述1
ls = ls.Trim().Substring(ils);
}
}
}
}
//通知人内容冗余
ls = sNOTIFYPARTY.Trim();//货物描述
if (ls.Trim().Length > 4)
{
string[] itmss = ls.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
for (int k = 0; k < itmss.Length; k++)
{
ls = itmss[k].ToString().Trim();
while (ls.Length > 0)
{
if (ls.Length < 51)
{
alt += "FTX+AAA+++" + EDIExportDA.getEDIFormat(ls) + "'\r\n";
ls = "";
}
else
{
string sls = ls.Trim().Substring(0, 50);
int ils = EDIExportDA.getEDISUB(sls, 50);
sls = sls.Trim().Substring(0, ils);
alt += "FTX+AAA+++" + EDIExportDA.getEDIFormat(sls) + "'\r\n";//货物描述1
ls = ls.Trim().Substring(ils);
}
}
}
}
//
alt += "MEA+AAE+WT+KGM:" + TopSeaeEntity.KGS.ToString().Trim() + "'\r\n";
alt += "MEA+AAE+AAW+MTQ:" + TopSeaeEntity.CBM.ToString().Trim() + "'\r\n";
//44唛头
ls = TopSeaeEntity.MARKS.ToString().Trim();//唛头
if(ls.Trim()!="")
{
string[] itmss = ls.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
for (int k = 0; k < itmss.Length; k++)
{
ls = itmss[k].ToString().Trim();
while (ls.Length > 0)
{
if (ls.Length < 51)
{
alt += "PCI++" + EDIExportDA.getEDIFormat(ls) + "'\r\n";
ls = "";
}
else
{
string sls = ls.Trim().Substring(0, 50);
int ils = EDIExportDA.getEDISUB(sls, 50);
sls = sls.Trim().Substring(0, ils);
alt += "PCI++" + EDIExportDA.getEDIFormat(sls) + "'\r\n";//唛头
ls = ls.Trim().Substring(ils);
}
}
}
}
//
if (TopSeaeEntity.CARGOID.ToString().Trim() == "D")
{
alt += "DGS+IMD+" + TopSeaeEntity.DCLASS.ToString().Trim() + "+" + TopSeaeEntity.DUNNO.ToString().Trim() + "'\r\n";
alt += "CTA+HG+:" + EDIExportDA.getEDIFormat(Edit7.Text.Trim()) + "'\r\n";
alt += "COM+" + EDIExportDA.getEDIFormat(Edit5.Text.Trim()) + ":TE" + "'\r\n";
}
//
DataSet ds = T_ALL_DA.GetAllSQL("select *,EDICODE=(select EDICODE from code_ctn where CTN=op_ctn.CTNALL),pkEDICODE1=(select EDICODE from code_package where PKGS=op_ctn.KINDPKGS) from op_ctn where bsno='" + TopSeaeEntity.BSNO.ToString().Trim() + "'");//
if (ds != null)
{
foreach (DataTable myTable in ds.Tables)
{
foreach (DataRow myRow in myTable.Rows)//遍历表
{
if (TopSeaeEntity.ISCONTAINERSOC)
{
alt += "EQD+CN++" + myRow["EDICODE"].ToString().Trim() + "+1" + "'\r\n";
}
else
{
alt += "EQD+CN++" + myRow["EDICODE"].ToString().Trim() + "+2" + "'\r\n"; //箱型 多箱型
}
alt += "EQN+" + myRow["CTNNUM"].ToString().Trim() + "'\r\n"; //数量
if (TopSeaeEntity.CARGOID.ToString().Trim() == "R")
{
alt += "MEA+AAE+AAS+CBM:" + TopSeaeEntity.REEFERF.ToString().Trim() + "'\r\n";
alt += "TMP+2+" + TopSeaeEntity.TEMPSET.ToString().Trim() + ":CEL" + "'\r\n";
}
}
}
}
}
//---
string[] itms5 = alt.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
ls = (itms5.Length + 1).ToString().Trim();
alt += "UNT+" + ls + "+" + TopSeaeEntity.CUSTNO.ToString().Trim() + "'\r\n";
alt += "UNZ+1+" + TopSeaeEntity.CUSTNO.ToString().Trim() + "'\r\n";
#endregion
}
else
{
if (RadioGroup1.SelectedValue.ToString().Trim() == "1")//提单确认
{
#region 提单确认
for (int i = 0; i < itmGIDS.Length; i++)
{
TopSeaeEntity = SeaExportInfoDA.GetID(itmGIDS[i].ToString().Trim());
sMBLNO = TopSeaeEntity.VESSEL.ToString().Trim() + " " + TopSeaeEntity.VOYNO.ToString().Trim();
//
alt+="UNB+UNOC:2+"+Edit1.Text.Trim()+":ZZZ+"+Edit3.Text.Trim() +":ZZZ+"+EDIExportDA.getdate("", 2)+"+" +TopSeaeEntity.CUSTNO.ToString().Trim()+"'\r\n";
alt+="UNH+"+TopSeaeEntity.CUSTNO.ToString().Trim()+"+IFTMIN:D:99B:UN"+"'\r\n";
alt += "BGM+340+" + TopSeaeEntity.MBLNO.ToString().Trim() + "+" + RadioGroup3.SelectedValue.ToString().Trim() + "" + "'\r\n";
//
if(TopSeaeEntity.SERVICE.ToString().Trim()=="DOOR-DOOR")
{
alt+="TSR+27+2"+"'\r\n";
}
else if(TopSeaeEntity.SERVICE.ToString().Trim()=="DOOR-CY")
{
alt+="TSR+28+2"+"'\r\n";
}
else if (TopSeaeEntity.SERVICE.ToString().Trim() == "CY-DOOR")
{
alt+="TSR+29+2"+"'\r\n";
}
else if (TopSeaeEntity.SERVICE.ToString().Trim() == "CY-CY")
{
alt+="TSR+30+2"+"'\r\n";
}
else if (TopSeaeEntity.SERVICE.ToString().Trim() == "OTHER")
{
alt+="TSR+30+2"+"'\r\n";
}
//
if(TopSeaeEntity.PREPARDAT.ToString().Trim() != "")
{
ls=EDIExportDA.getEDIFormat(TopSeaeEntity.PREPARDAT.ToString().Trim());
}
if(TopSeaeEntity.PAYABLEAT.ToString().Trim() != "")
{
ls=EDIExportDA.getEDIFormat(TopSeaeEntity.PAYABLEAT.ToString().Trim());
}
ls += TopSeaeEntity.BLFRT.ToString().Trim() + " Payable at " + ls.Trim() + " " + TopSeaeEntity.SERVICE.ToString().Trim() + " " + TopSeaeEntity.PKGS.ToString().Trim() + TopSeaeEntity.KINDPKGS.ToString().Trim() + " " + EDIExportDA.getEDIFormat(TopSeaeEntity.REMARK.ToString().Trim()) + " ";
string[] itmss = ls.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
for (int k = 0; k < itmss.Length; k++)
{
ls = itmss[k].ToString().Trim();
while (ls.Length > 0)
{
if (ls.Length < 513)
{
alt += "FTX+AAI+++" + EDIExportDA.getEDIFormat(ls) + "'\r\n";
ls = "";
}
else
{
string sls = ls.Trim().Substring(0, 512);
int ils = EDIExportDA.getEDISUB(sls, 512);
sls = sls.Trim().Substring(0, ils);
alt += "FTX+AAI+++" + EDIExportDA.getEDIFormat(sls) + "'\r\n";//
ls = ls.Trim().Substring(ils);
}
}
}
//
//if (t_op_edi.FieldByName("所在国家").ToString().Trim()="加拿大")) {
// if (t_op_edi.FieldByName("SCAC编号").ToString().Trim( != ""))
// alt+="FTX+CCI++MFS+1:CA:"+t_op_edi.FieldByName("SCAC编号").ToString().Trim()+"'\r\n")
// else
// alt+="FTX+CCI++MFS+5:CA"+"'\r\n";
//}
//if (t_op_edi.FieldByName("所在国家").ToString().Trim()="美国")) {
// if (t_op_edi.FieldByName("SCAC编号").ToString().Trim( != ""))
// alt+="FTX+CCI++MFS+1:US:"+t_op_edi.FieldByName("SCAC编号").ToString().Trim()+"'\r\n")
// else
// alt+="FTX+CCI++MFS+5:US"+"'\r\n";
//}
//
alt+="CNT+7:"+TopSeaeEntity.KGS.ToString().Trim()+":KGM'\r\n";
alt+="CNT+11:"+TopSeaeEntity.PKGS.ToString().Trim()+"'\r\n";
alt+="CNT+15:"+TopSeaeEntity.CBM.ToString().Trim()+":MTQ'\r\n";
//
if(TopSeaeEntity.BLFRT.ToString().Trim()=="FREIGHT PREPAID")//运费预付
{
alt+="LOC+57+"+TopSeaeEntity.PORTLOADID.ToString().Trim()+"::6:"+TopSeaeEntity.PREPARDAT.ToString().Trim()+"'\r\n";
}
else if(TopSeaeEntity.BLFRT.ToString().Trim()=="FREIGHT COLLECT") //运费到付
{
alt+="LOC+57+"+TopSeaeEntity.PORTDISCHARGEID.ToString().Trim()+"::6:"+TopSeaeEntity.PAYABLEAT.ToString().Trim()+"'\r\n";
}
else
{
alt+="LOC+57+"+TopSeaeEntity.PORTLOADID.ToString().Trim()+"::6:"+TopSeaeEntity.PREPARDAT.ToString().Trim()+"'\r\n";//运费预付
}
//
alt+="LOC+73+"+TopSeaeEntity.ISSUEPLACEID.ToString().Trim()+"::6:"+TopSeaeEntity.ISSUEPLACE.ToString().Trim()+"'\r\n";
//
if(TopSeaeEntity.ORDERNO.ToString().Trim()=="")
{
alt+="RFF+BN:"+TopSeaeEntity.MBLNO.ToString().Trim()+"'\r\n";
}
else
{
alt+="RFF+BN:"+TopSeaeEntity.ORDERNO.ToString().Trim()+"'\r\n";
}
alt+="RFF+BM:"+TopSeaeEntity.MBLNO.ToString().Trim()+"'\r\n";
alt+="RFF+CT:"+TopSeaeEntity.CONTRACTNO.ToString().Trim()+"'\r\n";
//
//if (t_op_edi.FieldByName("所在国家").ToString().Trim()="美国"))
//{
// alt+="REF+TN:"+t_op_edi.FieldByName("ITN编号").ToString().Trim()+"'\r\n";
//}
//
if(TopSeaeEntity.BLFRT.ToString().Trim().IndexOf("PREPAID")>-1)
{
alt+="CPI+4++P'\r\n";
}
else
{
alt+="CPI+4++C'\r\n";
}
//
alt += "TDT+20+" + EDIExportDA.CutVoyNo(TopSeaeEntity.VOYNO.ToString().Trim()) + "+1+++++:::" + TopSeaeEntity.VESSEL.ToString().Trim() + "'\r\n";
alt+="LOC+9+"+TopSeaeEntity.PORTLOADID.ToString().Trim()+":139:6:"+TopSeaeEntity.PORTLOAD.ToString().Trim()+"'\r\n";
alt+="LOC+88+"+TopSeaeEntity.PORTLOADID.ToString().Trim()+":139:6:"+TopSeaeEntity.PORTLOAD.ToString().Trim()+"'\r\n";
alt+="LOC+11+"+TopSeaeEntity.PORTDISCHARGEID.ToString().Trim()+":139:6:"+TopSeaeEntity.PORTDISCHARGE.ToString().Trim()+"'\r\n";
alt+="LOC+7+"+TopSeaeEntity.DESTINATIONID.ToString().Trim()+":139:6:"+TopSeaeEntity.DESTINATION.ToString().Trim()+"'\r\n";
//
//if t_op_edi.FieldByName("所在国家").ToString().Trim( != "") {
// str_all.Text.Trim():=Changestr(t_op_edi.fieldbyname("AMS发货人").ToString().Trim());
//} else {
// str_all.Text.Trim():=Changestr(TopSeaeEntity.("发货人代码").ToString().Trim());
//}
string sSHIPPER = ".*";
ls = TopSeaeEntity.SHIPPER.ToString().Trim();//发货人
string[] itms = ls.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
if (itms.Length > 0)
{
alt += "NAD+CZ+++";
ArrayList aList = new ArrayList();
for (int k = 0; k < itms.Length; k++)
{
ls = itms[k].ToString().Trim();
for (int n = 0; n < (ls.Length / 35 + 1); n++)
{
if (ls.Length < 36)
{
aList.Add(ls);
}
else
{
string sls = ls.Trim().Substring(0, 35);
int ils = EDIExportDA.getEDISUB(sls, 35);
sls = sls.Trim().Substring(0, ils);
aList.Add(sls);//
ls = ls.Trim().Substring(ils);
}
}
}
//
for (int m = 0; m < 5; m++)
{
try
{
if(aList.Count>5)
{
if(m==4)
{
ls = aList[m].ToString().Trim();
if (ls.Length < 35)
{
alt += EDIExportDA.getEDIFormat(aList[m].ToString().Trim()) + "*:";
}
else
{
string sls = ls.Trim().Substring(0, 34);
int ils = EDIExportDA.getEDISUB(sls, 34);
sls = sls.Trim().Substring(0, ils);
alt += EDIExportDA.getEDIFormat(sls.Trim()) + "*:";
ls = ls.Trim().Substring(ils);
sSHIPPER += ls.Trim() + "\r\n";
}
}
else
{
alt += EDIExportDA.getEDIFormat(aList[m].ToString().Trim()) + ":";
}
}
else
{
alt += EDIExportDA.getEDIFormat(aList[m].ToString().Trim()) + ":";
}
}
catch (Exception)
{
alt += "";
}
}
alt = alt.Trim().Substring(0, alt.Trim().Length - 1);
//
if (aList.Count > 5)
{
for (int j = 5; j < aList.Count; j++)
{
sSHIPPER += aList[j].ToString().Trim() + "\r\n";
}
}
else
{
sSHIPPER = "";
}
alt += "'\r\n";
}
//
//if t_op_edi.FieldByName("所在国家").ToString().Trim( != "") {
// str_all.Text.Trim():=Changestr(t_op_edi.fieldbyname("AMS收货人").ToString().Trim());
//} else {
// str_all.Text.Trim():=Changestr(TopSeaeEntity.("收货人代码").ToString().Trim());
//}
string sCONSIGNEE = ".**";
ls = TopSeaeEntity.CONSIGNEE.ToString().Trim();//收货人
itms = ls.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
if (itms.Length > 0)
{
alt += "NAD+CN+++";
//
ArrayList aList = new ArrayList();
for (int k = 0; k < itms.Length; k++)
{
ls = itms[k].ToString().Trim();
for (int n = 0; n < (ls.Length / 35 + 1); n++)
{
if (ls.Length < 36)
{
aList.Add(ls);
}
else
{
string sls = ls.Trim().Substring(0, 35);
int ils = EDIExportDA.getEDISUB(sls, 35);
sls = sls.Trim().Substring(0, ils);
aList.Add(sls);//
ls = ls.Trim().Substring(ils);
}
}
}
//
for (int m = 0; m < 5; m++)
{
try
{
if(aList.Count>5)
{
if(m==4)
{
ls = aList[m].ToString().Trim();
if (ls.Length < 34)
{
alt += EDIExportDA.getEDIFormat(aList[m].ToString().Trim()) + "**:";
}
else
{
string sls = ls.Trim().Substring(0, 33);
int ils = EDIExportDA.getEDISUB(sls, 33);
sls = sls.Trim().Substring(0, ils);
alt += EDIExportDA.getEDIFormat(sls.Trim()) + "**:";
ls = ls.Trim().Substring(ils);
sSHIPPER += ls.Trim() + "\r\n";
}
}
else
{
alt += EDIExportDA.getEDIFormat(aList[m].ToString().Trim()) + ":";
}
}
else
{
alt += EDIExportDA.getEDIFormat(aList[m].ToString().Trim()) + ":";
}
}
catch (Exception)
{
alt += "";
}
}
alt = alt.Trim().Substring(0, alt.Trim().Length - 1);
//
if (aList.Count > 5)
{
for (int j = 5; j < aList.Count; j++)
{
sCONSIGNEE += aList[j].ToString().Trim() + "\r\n";
}
}
else
{
sCONSIGNEE = "";
}
alt += "'\r\n";
}
//
//if (t_op_edi.FieldByName("所在国家").ToString().Trim()="美国")) {
// str_guodu:=str_guodu+"+++"+t_op_edi.FieldByName("收货人邮编").ToString().Trim()+"'\r\n";
// str.Add(str_guodu);
// } else if (t_op_edi.FieldByName("所在国家").ToString().Trim()="加拿大")) {
// str_guodu:=str_guodu+"+++"+t_op_edi.FieldByName("收货人邮编").ToString().Trim()+"+CA"+"'\r\n";
// str.Add(str_guodu);
// } else if (t_op_edi.FieldByName("所在国家").ToString().Trim()="巴西")) {
// str_guodu:=str_guodu+"++++"+t_op_edi.FieldByName("收货人国家代码").ToString().Trim()+"'\r\n";
// str.Add(str_guodu);
// alt+="RFF+GN:"+t_op_edi.FieldByName("收货人税号").ToString().Trim()+"'\r\n"; //
// } else {
// str_guodu:=str_guodu+"'\r\n";
// str.Add(str_guodu);
// }
//
//
//if t_op_edi.FieldByName("所在国家").ToString().Trim( != "") {
// str_all.Text.Trim():=Changestr(t_op_edi.fieldbyname("AMS通知人").ToString().Trim());
//} else {
// str_all.Text.Trim():=Changestr(TopSeaeEntity.("通知人代码").ToString().Trim());
//}
//
string sNOTIFYPARTY = ".***";
ls = TopSeaeEntity.NOTIFYPARTY.ToString().Trim();//通知人
itms = ls.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
if (itms.Length > 0)
{
alt += "NAD+NI+++";
//
ArrayList aList = new ArrayList();
for (int k = 0; k < itms.Length; k++)
{
ls = itms[k].ToString().Trim();
for (int n = 0; n < (ls.Length / 35 + 1); n++)
{
if (ls.Length < 36)
{
aList.Add(ls);
}
else
{
string sls = ls.Trim().Substring(0, 35);
int ils = EDIExportDA.getEDISUB(sls, 35);
sls = sls.Trim().Substring(0, ils);
aList.Add(sls);//
ls = ls.Trim().Substring(ils);
}
}
}
//
for (int m = 0; m < 5; m++)
{
try
{
if(aList.Count>5)
{
if(m==4)
{
ls = aList[m].ToString().Trim();
if (ls.Length < 33)
{
alt += EDIExportDA.getEDIFormat(aList[m].ToString().Trim()) + "***:";
}
else
{
string sls = ls.Trim().Substring(0, 32);
int ils = EDIExportDA.getEDISUB(sls, 32);
sls = sls.Trim().Substring(0, ils);
alt += EDIExportDA.getEDIFormat(sls.Trim()) + "***:";
ls = ls.Trim().Substring(ils);
sSHIPPER += ls.Trim() + "\r\n";
}
}
else
{
alt += EDIExportDA.getEDIFormat(aList[m].ToString().Trim()) + ":";
}
}
else
{
alt += EDIExportDA.getEDIFormat(aList[m].ToString().Trim()) + ":";
}
}
catch (Exception)
{
alt += "";
}
}
alt = alt.Trim().Substring(0, alt.Trim().Length - 1);
//
if (aList.Count > 5)
{
alt += "***";
//
for (int j = 5; j < aList.Count; j++)
{
sNOTIFYPARTY += aList[j].ToString().Trim() + "\r\n";
}
}
else
{
sNOTIFYPARTY = "";
}
alt += "'\r\n";
}
//if (t_op_edi.FieldByName("所在国家").ToString().Trim()="美国")) {
// str_guodu:=str_guodu+"+++"+t_op_edi.FieldByName("通知人邮编").ToString().Trim()+"'\r\n";
// str.Add(str_guodu);
//} else if (t_op_edi.FieldByName("所在国家").ToString().Trim()="加拿大")) {
// str_guodu:=str_guodu+"'\r\n";
// str.Add(str_guodu);
//} else if (t_op_edi.FieldByName("所在国家").ToString().Trim()="巴西")) {
// if t_op_edi.FieldByName("通知人国家代码").ToString().Trim( != "")
// str_guodu:=str_guodu+"++++"+t_op_edi.FieldByName("通知人国家代码").ToString().Trim()+"'\r\n"
// else
// str_guodu:=str_guodu+"'\r\n";
// str.Add(str_guodu);
// if t_op_edi.FieldByName("通知人税号").ToString().Trim( != "") {
// alt+="RFF+GN:"+t_op_edi.FieldByName("通知人税号").ToString().Trim()+"'\r\n"; //
// }
//} else {
// str_guodu:=str_guodu+"'\r\n";
// str.Add(str_guodu);
//}
//
alt+="NAD+CA+"+TopSeaeEntity.VESSELID.ToString().Trim()+":160:86++"+TopSeaeEntity.CARRIER.ToString().Trim()+"'\r\n";
alt+="NAD+HI+SEAWORTHYQD:160:86++"+Edit2.Text.Trim()+"'\r\n";
alt+="CTA+IC+:"+Edit7.Text.Trim()+"'\r\n";
alt+="COM+"+Edit5.Text.Trim()+":TE"+"'\r\n";
alt+="COM+"+Edit6.Text.Trim()+":EM"+"'\r\n";
//
if(TopSeaeEntity.NOBILL.ToString().Trim()=="ONE")
ls="1";
else if(TopSeaeEntity.NOBILL.ToString().Trim()=="TWO")
ls="2";
else if(TopSeaeEntity.NOBILL.ToString().Trim()=="THREE")
ls="3";
else if(TopSeaeEntity.NOBILL.ToString().Trim()=="FOUR")
ls="4";
else if(TopSeaeEntity.NOBILL.ToString().Trim()=="FIVE")
ls="5";
else if(TopSeaeEntity.NOBILL.ToString().Trim()=="SIX")
ls="6";
else if(TopSeaeEntity.NOBILL.ToString().Trim()=="SERVEN")
ls="7";
else if(TopSeaeEntity.NOBILL.ToString().Trim()=="EIGHT")
ls="8";
else if(TopSeaeEntity.NOBILL.ToString().Trim()=="NIGHT")
ls="9";
else if(TopSeaeEntity.NOBILL.ToString().Trim()=="TEN")
ls="10";
string ls2="";
if(TopSeaeEntity.ISSUETYPE.ToString().Trim()=="正本")
{
ls2="706";
alt += "DOC+" + ls2 + "+++" + ls + "'\r\n";
}
else if(TopSeaeEntity.ISSUETYPE.ToString().Trim()=="海运单")
{
ls2="710";
alt += "DOC+" + ls2 + "+++" + ls + "'\r\n";
}
else if(TopSeaeEntity.ISSUETYPE.ToString().Trim()=="BILL COPY")
{
ls2="707";
alt += "DOC+" + ls2 + "+++" + ls + "'\r\n";
}
else if(TopSeaeEntity.ISSUETYPE.ToString().Trim()=="HOUSE BILL")
{
ls2="714";
alt += "DOC+" + ls2 + "+++" + ls + "'\r\n";
}
else if(TopSeaeEntity.ISSUETYPE.ToString().Trim()=="正副本")
{
ls2="706";
alt += "DOC+" + ls2 + "+++" + ls + "'\r\n";
ls2="707";
alt += "DOC+" + ls2 + "+++" + "1" + "'\r\n";
}
else
{
ls2="706";
alt += "DOC+" + ls2 + "+++" + ls + "'\r\n";
}
//
ls = T_ALL_DA.GetStrSQL("EDICODE", "select EDICODE from code_package where pkgs='" + EDIExportDA.getEDIFormat(TopSeaeEntity.KINDPKGS.ToString().Trim()) + "'");
alt+="GID+1+"+TopSeaeEntity.PKGS.ToString().Trim()+":"+ls.Trim()+"::6:"+TopSeaeEntity.KINDPKGS.ToString().Trim()+"'\r\n";
//
if(TopSeaeEntity.SERVICE.ToString().Trim() != "")
{
DataSet ds2 = T_ALL_DA.GetAllSQL("select *,pkEDICODE1=(select EDICODE from code_package where PKGS=op_seae_hs.KINDPKGS1),pkEDICODE2=(select EDICODE from code_package where PKGS=op_seae_hs.KINDPKGS2) from op_seae_hs where bsno='" + TopSeaeEntity.BSNO.ToString().Trim() + "'");//
if (ds2 != null)
{
foreach (DataTable myTable in ds2.Tables)
{
foreach (DataRow myRow in myTable.Rows)//遍历表
{
alt += "PIA+5+" + myRow["CARGOCODE"].ToString().Trim() + ":HS" + "'\r\n";
}
}
}
}
//货物描述
//if (RadioGroup1.SelectedValue.ToString().Trim() == "0")//业务订舱
//{
// ls = TopSeaeEntity.DESCRIPTION.ToString().Trim();//货物描述
// if(ls.Trim()!="")
// {
// string[] itms0 = ls.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
// for (int k = 0; k < itms0.Length; k++)
// {
// ls = itms0[k].ToString().Trim();
// while (ls.Length > 0)
// {
// if (ls.Length < 27)
// {
// alt += "FTX+AAA+++" + EDIExportDA.getEDIFormat(ls) + "'\r\n";
// ls = "";
// }
// else
// {
// string sls = ls.Trim().Substring(0, 26);
// int ils = EDIExportDA.getEDISUB(sls, 26);
// sls = sls.Trim().Substring(0, ils);
// alt += "FTX+AAA+++" + EDIExportDA.getEDIFormat(sls) + "'\r\n";//货物描述1
// ls = ls.Trim().Substring(ils);
// }
// }
// }
// }
//}
//else
//{
//货物描述//提单确认
ls = TopSeaeEntity.DESCRIPTION.ToString().Trim();//货物描述
if(ls.Trim()!="")
{
string[] itms1 = ls.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
for (int k = 0; k < itms1.Length; k++)
{
ls = itms1[k].ToString().Trim();
while (ls.Length > 0)
{
if (ls.Length < 27)
{
alt += "FTX+AAA+++" + EDIExportDA.getEDIFormat(ls) + "'\r\n";
ls = "";
}
else
{
string sls = ls.Trim().Substring(0, 26);
int ils = EDIExportDA.getEDISUB(sls, 26);
sls = sls.Trim().Substring(0, ils);
alt += "FTX+AAA+++" + EDIExportDA.getEDIFormat(sls) + "'\r\n";//货物描述1
ls = ls.Trim().Substring(ils);
}
}
}
}
//}
//发货人内容冗余
ls = sSHIPPER.Trim();//货物描述
if(ls.Trim().Length>2)
{
string[] itms2 = ls.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
for (int k = 0; k < itms2.Length; k++)
{
ls = itms2[k].ToString().Trim();
while (ls.Length > 0)
{
if (ls.Length < 27)
{
alt += "FTX+AAA+++" + EDIExportDA.getEDIFormat(ls) + "'\r\n";
ls = "";
}
else
{
string sls = ls.Trim().Substring(0, 26);
int ils = EDIExportDA.getEDISUB(sls, 26);
sls = sls.Trim().Substring(0, ils);
alt += "FTX+AAA+++" + EDIExportDA.getEDIFormat(sls) + "'\r\n";//货物描述1
ls = ls.Trim().Substring(ils);
}
}
}
}
//收货人内容冗余
ls = sCONSIGNEE.Trim();//货物描述
if (ls.Trim().Length > 3)
{
string[] itms3 = ls.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
for (int k = 0; k < itms3.Length; k++)
{
ls = itms3[k].ToString().Trim();
while (ls.Length > 0)
{
if (ls.Length < 27)
{
alt += "FTX+AAA+++" + EDIExportDA.getEDIFormat(ls) + "'\r\n";
ls = "";
}
else
{
string sls = ls.Trim().Substring(0, 26);
int ils = EDIExportDA.getEDISUB(sls, 26);
sls = sls.Trim().Substring(0, ils);
alt += "FTX+AAA+++" + EDIExportDA.getEDIFormat(sls) + "'\r\n";//货物描述1
ls = ls.Trim().Substring(ils);
}
}
}
}
//通知人内容冗余
ls = sNOTIFYPARTY.Trim();//货物描述
if (ls.Trim().Length > 4)
{
string[] itms4 = ls.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
for (int k = 0; k < itms4.Length; k++)
{
ls = itms4[k].ToString().Trim();
while (ls.Length > 0)
{
if (ls.Length < 27)
{
alt += "FTX+AAA+++" + EDIExportDA.getEDIFormat(ls) + "'\r\n";
ls = "";
}
else
{
string sls = ls.Trim().Substring(0, 26);
int ils = EDIExportDA.getEDISUB(sls, 26);
sls = sls.Trim().Substring(0, ils);
alt += "FTX+AAA+++" + EDIExportDA.getEDIFormat(sls) + "'\r\n";//货物描述1
ls = ls.Trim().Substring(ils);
}
}
}
}
//
alt+="MEA+AAE+WT+KGM:"+TopSeaeEntity.KGS.ToString().Trim()+"'\r\n";
alt+="MEA+AAE+AAW+MTQ:"+TopSeaeEntity.CBM.ToString().Trim()+"'\r\n";
//44唛头
ls = TopSeaeEntity.MARKS.ToString().Trim();//唛头
if (ls.Trim() != "")
{
string[] itms5 = ls.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
for (int k = 0; k < itms5.Length; k++)
{
ls = itms5[k].ToString().Trim();
while (ls.Length > 0)
{
if (ls.Length < 36)
{
alt += "PCI++" + EDIExportDA.getEDIFormat(ls) + "'\r\n";
ls = "";
}
else
{
string sls = ls.Trim().Substring(0, 35);
int ils = EDIExportDA.getEDISUB(sls, 35);
sls = sls.Trim().Substring(0, ils);
alt += "PCI++" + EDIExportDA.getEDIFormat(sls) + "'\r\n";//唛头
ls = ls.Trim().Substring(ils);
}
}
}
}
//
DataSet ds = T_ALL_DA.GetAllSQL("select *,EDICODE=(select EDICODE from code_ctn where CTN=op_ctn.CTNALL),pkEDICODE1=(select EDICODE from code_package where PKGS=op_ctn.KINDPKGS) from op_ctn where bsno='" + TopSeaeEntity.BSNO.ToString().Trim() + "'");//
if (ds != null)
{
foreach (DataTable myTable in ds.Tables)
{
foreach (DataRow myRow in myTable.Rows)//遍历表
{
alt+="SGP+"+myRow["CNTRNO"].ToString().Trim()+"+"+myRow["PKGS"].ToString().Trim()+"'\r\n";
alt+="MEA+AAE+WT+KGM:"+myRow["KGS"].ToString().Trim()+"'\r\n";
alt+="MEA+AAE+AAW+MTQ:"+myRow["CBM"].ToString().Trim()+"'\r\n";
}
}
}
//---
if(TopSeaeEntity.CARGOID.ToString().Trim()=="D")
{
alt+="DGS+IMD+"+TopSeaeEntity.DCLASS.ToString().Trim()+"+"+TopSeaeEntity.DUNNO.ToString().Trim()+"'\r\n";
alt+="CTA+HG+:"+Edit7.Text.Trim()+"'\r\n";
alt+="COM+"+Edit5.Text.Trim()+":TE"+"'\r\n";
}
//
if (ds != null)
{
foreach (DataTable myTable in ds.Tables)
{
foreach (DataRow myRow in myTable.Rows)//遍历表
{
if (TopSeaeEntity.ISCONTAINERSOC)
{
alt += "EQD+CN+" + myRow["CNTRNO"].ToString().Trim() + "+" + myRow["EDICODE"].ToString().Trim() + "+1" + "'\r\n"; //数量
}
else
{
alt+="EQD+CN+"+myRow["CNTRNO"].ToString().Trim()+"+"+myRow["EDICODE"].ToString().Trim()+"+2"+"'\r\n"; //数量
}
alt+="MEA+AAE+WT+KGM:"+myRow["KGS"].ToString().Trim()+"'\r\n";
alt+="MEA+AAE+AAW+MTQ:"+myRow["CBM"].ToString().Trim()+"'\r\n";
//
if(TopSeaeEntity.CARGOID.ToString().Trim()=="R")
{
alt+="MEA+AAE+AAS+CBM:"+TopSeaeEntity.REEFERF.ToString().Trim()+"'\r\n";
}
alt+="SEL+"+myRow["SEALNO"].ToString().Trim()+"+CA"+"'\r\n";
if(TopSeaeEntity.CARGOID.ToString().Trim()=="R")
{
alt+="TMP+2+"+TopSeaeEntity.TEMPSET.ToString().Trim()+":CEL"+"'\r\n";
}
}
}
}
//---
}
//---
string[] itms6 = alt.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
ls = (itms6.Length+1).ToString().Trim();
alt+="UNT+"+ls+"+"+TopSeaeEntity.CUSTNO.ToString().Trim()+"'\r\n";
alt += "UNZ+1+" + TopSeaeEntity.CUSTNO.ToString().Trim() + "'\r\n";
#endregion
}
}
//
if (alt.Trim() == "")
{
return;
}
//
StringWriter sw = new StringWriter();
sw.WriteLine(alt);
//
sw.Close();
switch ("MUTEXT")
{
case "MUTEXT":
Response.AddHeader("Content-Disposition", "attachment; filename=" + sMBLNO + ".txt");
Response.ContentType = "application/txt";
break;
case "MUEXCEL":
Response.AddHeader("Content-Disposition", "attachment; filename=report.xls");
Response.ContentType = "application/ms-excel";
break;
case "MUWORD":
Response.AddHeader("Content-Disposition", "attachment; filename=report.doc");
Response.ContentType = "application/ms-word";
break;
case "MUPDF":
Response.AddHeader("Content-Disposition", "attachment; filename=report.pdf");
Response.ContentType = "application/pdf";
break;
case "MUXML":
Response.AddHeader("Content-Disposition", "attachment; filename=report.xml");
Response.ContentType = "application/xml";
break;
}
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
Response.Write(sw);
Response.End();
}
//
}
}