@ -16753,7 +16753,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
var icount = 0 ;
var OpBill = new MsOpSeaeBill ( ) ;
var bsno = "" ;
r . WriteLine ( "UNB+UNO A:1 +" + ftpset . SENDCODE + ":ZZZ+" + ftpset . RECEIVECODE + ":ZZZ+" + DateTime . Now . ToString ( "yyMMdd:HHmm" ) + "+" + headData [ 0 ] . CUSTNO + "'" ) ;
r . WriteLine ( "UNB+UNO C:2 +" + ftpset . SENDCODE + ":ZZZ+" + ftpset . RECEIVECODE + ":ZZZ+" + DateTime . Now . ToString ( "yyMMdd:HHmm" ) + "+" + headData [ 0 ] . CUSTNO + "'" ) ;
foreach ( var bill in headData )
{
@ -16779,20 +16779,16 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
}
icount + + ;
if ( ftpset . SENDATTN ! = "" )
{
r . WriteLine ( "CTA+IC+:" + ftpset . SENDATTN + "'" ) ;
icount + + ;
}
if ( ftpset . SENDTEL ! = "" )
{
r . WriteLine ( "COM+" + ftpset . SENDTEL + ":TE'" ) ;
icount + + ;
}
if ( ftpset . SENDEMAIL ! = "" )
if ( dsUserOp ! = null )
{
r . WriteLine ( "COM+" + ftpset . SENDEMAIL + ":EM'" ) ;
icount + + ;
if ( dsUserOp . Tables [ 0 ] . Rows . Count > 0 )
{
r . WriteLine ( "CTA+IC+:" + dsUserOp . Tables [ 0 ] . Rows [ 0 ] [ "USERNAME" ] . ToString ( ) . Trim ( ) + "'" ) ;
r . WriteLine ( "COM+" + dsUserOp . Tables [ 0 ] . Rows [ 0 ] [ "OFFICEPHONE" ] . ToString ( ) . Trim ( ) + ":TE'" ) ;
r . WriteLine ( "COM+" + dsUserOp . Tables [ 0 ] . Rows [ 0 ] [ "EMAIL1" ] . ToString ( ) . Trim ( ) + ":EM'" ) ;
icount = icount + 3 ;
}
}
r . WriteLine ( "DTM+137:" + DateTime . Now . ToString ( "yyyyMMddHHmm" ) + ":203'" ) ;
@ -16876,16 +16872,65 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
if ( isbill ! = 1 )
{
r . WriteLine ( "CNT+7:" + Math . Round ( Convert . ToDecimal ( bill . KGS ) , 3 ) + ":KGM'" ) ;
r . WriteLine ( "CNT+11:" + bill . PKGS + " '") ;
r . WriteLine ( "CNT+11:" + bill . PKGS + " :" + GetPackageEDICode ( bill . KINDPKGS , "EVERGREEN" ) + " '") ;
r . WriteLine ( "CNT+15:" + Math . Round ( Convert . ToDecimal ( bill . CBM ) , 3 ) + ":MTQ'" ) ;
}
else
{
r . WriteLine ( "CNT+7:" + Math . Round ( OpBill . KGS , 3 ) + ":KGM'" ) ;
r . WriteLine ( "CNT+11:" + OpBill . PKGS + " '") ;
r . WriteLine ( "CNT+11:" + OpBill . PKGS + " :"+ GetPackageEDICode ( OpBill . KINDPKGS , "EVERGREEN" ) + " '") ;
r . WriteLine ( "CNT+15:" + Math . Round ( OpBill . CBM , 3 ) + ":MTQ'" ) ;
}
icount = icount + 3 ;
var copynum = GetBillNum ( bill . COPYNOBILL ) ;
if ( bill . ISSUETYPE = = "正本" )
{
r . WriteLine ( "DOC+705+++" + GetBillNum ( bill . NOBILL ) + "'" ) ;
icount = icount + 1 ;
if ( copynum ! = "" )
{
r . WriteLine ( "DOC+707+++" + copynum + "'" ) ;
icount = icount + 1 ;
}
}
else if ( bill . ISSUETYPE = = "海运单" | | bill . ISSUETYPE = = "Seaway" | | bill . ISSUETYPE = = "WAYBILL" | | bill . ISSUETYPE = = "SWB正本" | | bill . ISSUETYPE = = "SWB" | | bill . ISSUETYPE = = "SWB无正本" )
{
r . WriteLine ( "DOC+710+++" + GetBillNum ( bill . NOBILL ) + "'" ) ;
icount = icount + 1 ;
}
else if ( bill . ISSUETYPE = = "BILL COPY" | | bill . ISSUETYPE = = "电放" )
{
r . WriteLine ( "DOC+705+++" + GetBillNum ( bill . NOBILL ) + "'" ) ;
icount = icount + 1 ;
if ( copynum ! = "" )
{
r . WriteLine ( "DOC+707+++" + copynum + "'" ) ;
icount = icount + 1 ;
}
}
else if ( bill . ISSUETYPE = = "正副本" )
{
r . WriteLine ( "DOC+705+++" + GetBillNum ( bill . NOBILL ) + "'" ) ;
icount = icount + 1 ;
if ( copynum ! = "" )
{
r . WriteLine ( "DOC+707+++" + copynum + "'" ) ;
icount = icount + 1 ;
}
}
else if ( bill . ISSUETYPE = = "HOUSE BILL" )
{
r . WriteLine ( "DOC+714+++" + GetBillNum ( bill . NOBILL ) + "'" ) ;
icount = icount + 1 ;
}
//var ctnttllist = GetCtnTTLSum("BSNO='" + bill.BSNO + "'");
//var ctnttl = ctnttllist[0];
@ -16894,14 +16939,14 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
# endregion
#region 地址地点
if ( bill . BLFRT = = "FREIGHT COLLECT" )
r . WriteLine ( "LOC+57+" + bill . PREPARDATID + "::6:" + bill . PAYABLEAT + "'" ) ;
else
r . WriteLine ( "LOC+57+" + bill . PREPARDATID + "::6:" + bill . PREPARDAT + "'" ) ;
icount + + ;
//if (bill.BLFRT == "FREIGHT COLLECT" )
// r.WriteLine("LOC+57+" + bill.PREPARDATID + "::6:" + bill.PAYABLEAT + "'");
// else
// r.WriteLine("LOC+57+" + bill.PREPARDATID + "::6:" + bill.PREPARDAT + "'");
//icount++ ;
r . WriteLine ( "LOC+73+" + GetPortEDICode ( bill . ISSUEPLACEID , "MAERSK" ) + "::6:" + bill . ISSUEPLACE + "'" ) ;
icount + + ;
//r.WriteLine("LOC+73+" + GetPortEDICode(bill.ISSUEPLACEID, "MAERSK") + "::6:" + bill.ISSUEPLACE + "'") ;
//icount++ ;
# endregion
#region 提单号
@ -17136,7 +17181,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
{
for ( var i = 0 ; i < ShippingList . Count ; i + + )
{
if ( i = = 0 ) Shipping = "NAD+N I +++" + ShippingList [ 0 ] + "+" ;
if ( i = = 0 ) Shipping = "NAD+N 1 +++" + ShippingList [ 0 ] + "+" ;
if ( i = = 1 ) Shipping = Shipping + ShippingList [ i ] ;
if ( i = = 2 | | i = = 3 ) Shipping = Shipping + ":" + ShippingList [ i ] ;
if ( i > = 4 & & ShippingList . Count > 5 )
@ -17184,50 +17229,37 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
# endregion
#region 承运公司/人
// r.WriteLine("NAD+CA+" + carrier + ":160:86++" + bill.CARRIER + "'");
if ( ftpset . SENDNAME . Length > 35 )
r . WriteLine ( "NAD+BA+" + ftpset . SENDCOMPANYCODE + ":160:86++" + ftpset . SENDNAME . Substring ( 0 , 35 ) + "+" + ftpset . SENDNAME . Substring ( 35 ) + "'" ) ;
else
r . WriteLine ( "NAD+BA+" + ftpset . SENDCOMPANYCODE + ":160:86++" + ftpset . SENDNAME + "'" ) ;
// if (ftpset.SENDNAME.Length > 35)
// r.WriteLine("NAD+BA+" + ftpset.SENDCOMPANYCODE + ":160:86++" + ftpset.SENDNAME.Substring(0, 35) + "+" + ftpset.SENDNAME.Substring(35) + "'");
//else
// r.WriteLine("NAD+BA+" + ftpset.SENDCOMPANYCODE + ":160:86++" + ftpset.SENDNAME + "'");
//icount = icount + 2 ;
//r.WriteLine("CTA+IC+:" + billams.ATTN + "'");
//r.WriteLine("COM+" + billams.ATTNTEL + ":TE'");
//r.WriteLine("COM+" + billams.ATTNEMAIL + ":EM'");
if ( dsUserOp ! = null )
{
if ( dsUserOp . Tables [ 0 ] . Rows . Count > 0 )
{
r . WriteLine ( "CTA+IC+:" + dsUserOp . Tables [ 0 ] . Rows [ 0 ] [ "USERNAME" ] . ToString ( ) . Trim ( ) + "'" ) ;
r . WriteLine ( "COM+" + dsUserOp . Tables [ 0 ] . Rows [ 0 ] [ "OFFICEPHONE" ] . ToString ( ) . Trim ( ) + ":TE'" ) ;
r . WriteLine ( "COM+" + dsUserOp . Tables [ 0 ] . Rows [ 0 ] [ "EMAIL1" ] . ToString ( ) . Trim ( ) + ":EM'" ) ;
icount = icount + 5 ;
}
}
# endregion
#region 签单方式
if ( bill . ISSUETYPE = = "正本" )
{
r . WriteLine ( "DOC+706+++" + GetBillNum ( bill . NOBILL ) + "'" ) ;
icount + + ;
}
else if ( bill . ISSUETYPE = = "海运单" | | bill . ISSUETYPE = = "WAYBILL" | | bill . ISSUETYPE = = "Seaway" | | bill . ISSUETYPE = = "SWB正本" | | bill . ISSUETYPE = = "SWB无正本" )
{
r . WriteLine ( "DOC+710+++" + GetBillNum ( bill . NOBILL ) + "'" ) ;
icount + + ;
}
else if ( bill . ISSUETYPE = = "BILL COPY" | | bill . ISSUETYPE = = "电放" | | bill . ISSUETYPE = = "正副本" )
{
r . WriteLine ( "DOC+706+++" + GetBillNum ( bill . NOBILL ) + "'" ) ;
icount + + ;
}
else if ( bill . ISSUETYPE = = "HOUSE BILL" )
{
r . WriteLine ( "DOC+714+++" + GetBillNum ( bill . NOBILL ) + "'" ) ;
icount + + ;
}
# endregion
//#region 签单方式
//if (bill.ISSUETYPE == "正本")
//{
// r.WriteLine("DOC+706+++" + GetBillNum(bill.NOBILL) + "'");
// icount++;
//}
//else if (bill.ISSUETYPE == "海运单" || bill.ISSUETYPE == "WAYBILL" || bill.ISSUETYPE == "Seaway" || bill.ISSUETYPE == "SWB正本" || bill.ISSUETYPE == "SWB无正本")
// {
// r.WriteLine("DOC+710+++" + GetBillNum(bill.NOBILL) + "'");
// icount++;
// }
//else if (bill.ISSUETYPE == "BILL COPY" || bill.ISSUETYPE == "电放" || bill.ISSUETYPE == "正副本" )
// {
// r.WriteLine("DOC+706+++" + GetBillNum(bill.NOBILL) + "'");
// icount++;
// }
//else if (bill.ISSUETYPE == "HOUSE BILL" )
// {
// r.WriteLine("DOC+714+++" + GetBillNum(bill.NOBILL) + "'");
// icount++;
// }
//# endregion
//判断集装箱是否包含分箱明细
string slSQL = "select count(*) as inum from op_ctn_detail where CTN_ID in (select CTN_ID from op_ctn where bsno='" + bill . BSNO . ToString ( ) + "')" ;
@ -17258,6 +17290,8 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
else Shipping = formatEdiStr ( "txt" , OpBill . DESCRIPTION ) ;
Shipping = Shipping . Replace ( "\n" , "\\" ) ;
Shipping = Shipping . Replace ( "\r" , " " ) ;
var tmpdescription = "" ;
List < System . String > DescriptionListAll = new List < System . String > ( ) ;
string [ ] DescriptionList = Shipping . Split ( '\\' ) ;
if ( DescriptionList . Length ! = 0 )
{
@ -17265,45 +17299,72 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
{
if ( DescriptionList [ i ] ! = "" )
{
r . WriteLine ( "FTX+AAA+++" + DescriptionList [ i ] + "'" ) ;
icount = icount + 1 ;
if ( ( tmpdescription . Length + DescriptionList [ i ] . Length + 1 ) > 512 )
{
DescriptionListAll . Add ( tmpdescription ) ;
tmpdescription = DescriptionList [ i ] ;
}
else
{
tmpdescription = tmpdescription + " " + DescriptionList [ i ] ;
}
}
}
}
if ( DescriptionShipper ! = "" )
if ( ! string . IsNullOrEmpty ( tmpdescription ) )
{
DescriptionListAll . Add ( tmpdescription ) ;
}
r . WriteLine ( "FTX+AAA+++" + DescriptionShipper + "'" ) ;
icount = icount + 1 ;
if ( DescriptionListAll . Count ! = 0 )
{
foreach ( var description in DescriptionListAll )
{
r . WriteLine ( "FTX+AAA+++" + description + "'" ) ;
icount + + ;
}
}
if ( DescriptionConsignee ! = "" )
{
r . WriteLine ( "FTX+AAA+++" + DescriptionConsignee + "'" ) ;
icount = icount + 1 ;
}
if ( DescriptionNotifyparty ! = "" )
if ( DescriptionShipper ! = "" )
{
r . WriteLine ( "FTX+AAA+++" + DescriptionNotifyparty + "'" ) ;
icount = icount + 1 ;
if ( DescriptionShipper ! = "" )
{
r . WriteLine ( "FTX+AAA+++" + DescriptionShipper + "'" ) ;
icount + + ;
}
}
if ( isbill ! = 1 )
if ( DescriptionConsignee ! = "" )
{
r . WriteLine ( "MEA+AAE+G+KGM:" + Math . Round ( Convert . ToDecimal ( bill . KGS ) , 3 ) + "'" ) ;
r . WriteLine ( "MEA+AAE+AAW+MTQ:" + Math . Round ( Convert . ToDecimal ( bill . CBM ) , 3 ) + "'" ) ;
if ( DescriptionConsignee ! = "" )
{
r . WriteLine ( "FTX+AAA+++" + DescriptionConsignee + "'" ) ;
icount + + ;
}
}
else
if ( DescriptionNotifyparty ! = "" )
{
r . WriteLine ( "MEA+AAE+G+KGM:" + Math . Round ( OpBill . KGS , 3 ) + "'" ) ;
r . WriteLine ( "MEA+AAE+AAW+MTQ:" + Math . Round ( OpBill . CBM , 3 ) + "'" ) ;
if ( DescriptionNotifyparty ! = "" )
{
r . WriteLine ( "FTX+AAA+++" + DescriptionNotifyparty + "'" ) ;
icount + + ;
}
}
icount = icount + 2 ;
//if (isbill != 1)
//{
// r.WriteLine("MEA+AAE+G+KGM:" + Math.Round(Convert.ToDecimal(bill.KGS), 3) + "'");
// r.WriteLine("MEA+AAE+AAW+MTQ:" + Math.Round(Convert.ToDecimal(bill.CBM), 3) + "'");
//}
//else
//{
// r.WriteLine("MEA+AAE+G+KGM:" + Math.Round(OpBill.KGS, 3) + "'");
// r.WriteLine("MEA+AAE+AAW+MTQ:" + Math.Round(OpBill.CBM, 3) + "'");
//}
//icount = icount + 2;
if ( billams . GOODSNCM ! = "" )
@ -17338,14 +17399,14 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
Shipping = bill . BSNO ;
}
else Shipping = OpBill . AS_ID ;
var ctnsumlist2 = MsOpSeaeDAL . MsOpSeaeDAL . GetBodyList ( "BSNO='" + Shipping + "'" ) ;
foreach ( var ctn in ctnsumlist2 )
{
r . WriteLine ( "SGP+" + ctn . CNTRNO + "+" + ctn . PKGS . ToString ( ) + "'" ) ;
r . WriteLine ( "MEA+AAE+G+KGM:" + Math . Round ( ctn . KGS , 3 ) + "'" ) ;
r . WriteLine ( "MEA+AAE+AAW+MTQ:" + Math . Round ( ctn . CBM , 3 ) + "'" ) ;
icount = icount + 3 ;
}
//var ctnsumlist2 = MsOpSeaeDAL.MsOpSeaeDAL.GetBodyList("BSNO='" + Shipping + "'") ;
//foreach (var ctn in ctnsumlist2 )
// {
// r.WriteLine("SGP+" + ctn.CNTRNO + "+" + ctn.PKGS.ToString() + "'");
// r.WriteLine("MEA+AAE+G+KGM:" + Math.Round(ctn.KGS, 3) + "'");
// r.WriteLine("MEA+AAE+AAW+MTQ:" + Math.Round(ctn.CBM, 3) + "'");
// icount = icount + 3;
// }
# endregion
}
else
@ -17411,24 +17472,24 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
icount + + ;
}
/ /
lsSQL = "SELECT c.CTNALL,c.CNTRNO,c.SEALNO,d.PKGS,d.KINDPKGS,d.KGS,d.CBM,d.HSCODE,d.[DESCRIPTION] from op_ctn as c INNER JOIN op_ctn_detail as d on c.CTN_ID=d.CTN_ID where d.HSCODE='" + dsHSCODE . Tables [ 0 ] . Rows [ i ] [ "HSCODE" ] . ToString ( ) + "' and d.KINDPKGS='" + dsHSCODE . Tables [ 0 ] . Rows [ i ] [ "KINDPKGS" ] . ToString ( ) + "' and d.DESCRIPTION='" + dsHSCODE . Tables [ 0 ] . Rows [ i ] [ "DESCRIPTION" ] . ToString ( ) + "' order by c.CTNCODE,d.[ID]" ;
DataSet dsCNTRNO = T_ALL_DA . GetAllSQL ( lsSQL ) ;
if ( dsCNTRNO ! = null )
{
if ( dsCNTRNO . Tables [ 0 ] . Rows . Count > 0 )
{
for ( int n = 0 ; n < dsCNTRNO . Tables [ 0 ] . Rows . Count ; n + + )
{
//SGP+MSCU1234567+100'
r . WriteLine ( "SGP+" + dsCNTRNO . Tables [ 0 ] . Rows [ n ] [ "CNTRNO" ] . ToString ( ) + "+" + dsCNTRNO . Tables [ 0 ] . Rows [ n ] [ "PKGS" ] . ToString ( ) + "'" ) ;
//MEA+AAE+WT+KGM:1000'
r . WriteLine ( "MEA+AAE+G+KGM:" + Math . Round ( Decimal . Parse ( dsCNTRNO . Tables [ 0 ] . Rows [ n ] [ "KGS" ] . ToString ( ) ) , 3 ) + "'" ) ;
//MEA+AAE+AAW+MTQ:50.11'
r . WriteLine ( "MEA+AAE+AAW+MTQ:" + Math . Round ( Decimal . Parse ( dsCNTRNO . Tables [ 0 ] . Rows [ n ] [ "CBM" ] . ToString ( ) ) , 3 ) + "'" ) ;
icount = icount + 3 ;
}
}
}
//lsSQL = "SELECT c.CTNALL,c.CNTRNO,c.SEALNO,d.PKGS,d.KINDPKGS,d.KGS,d.CBM,d.HSCODE,d.[DESCRIPTION] from op_ctn as c INNER JOIN op_ctn_detail as d on c.CTN_ID=d.CTN_ID where d.HSCODE='" + dsHSCODE.Tables[0].Rows[i]["HSCODE"].ToString() + "' and d.KINDPKGS='" + dsHSCODE.Tables[0].Rows[i]["KINDPKGS"].ToString() + "' and d.DESCRIPTION='" + dsHSCODE.Tables[0].Rows[i]["DESCRIPTION"].ToString() + "' order by c.CTNCODE,d.[ID]";
//DataSet dsCNTRNO = T_ALL_DA.GetAllSQL(lsSQL) ;
//if (dsCNTRNO != null )
// {
// if (dsCNTRNO.Tables[0].Rows.Count > 0)
// {
// for (int n = 0; n < dsCNTRNO.Tables[0].Rows.Count; n++)
// {
// //SGP+MSCU1234567+100'
// r.WriteLine("SGP+" + dsCNTRNO.Tables[0].Rows[n]["CNTRNO"].ToString() + "+" + dsCNTRNO.Tables[0].Rows[n]["PKGS"].ToString() + "'");
// //MEA+AAE+WT+KGM:1000'
// r.WriteLine("MEA+AAE+G+KGM:" + Math.Round(Decimal.Parse(dsCNTRNO.Tables[0].Rows[n]["KGS"].ToString()), 3) + "'");
// //MEA+AAE+AAW+MTQ:50.11'
// r.WriteLine("MEA+AAE+AAW+MTQ:" + Math.Round(Decimal.Parse(dsCNTRNO.Tables[0].Rows[n]["CBM"].ToString()), 3) + "'");
// icount = icount + 3;
// }
// }
// }
}
}
}
@ -17448,8 +17509,11 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
r . WriteLine ( "EQD+CN+" + ctn . CNTRNO + "+" + GetCtnEDICode ( ctn . CTNALL , "EVERGREEN" ) + "+1'" ) ;
else
r . WriteLine ( "EQD+CN+" + ctn . CNTRNO + "+" + GetCtnEDICode ( ctn . CTNALL , "EVERGREEN" ) + "+2'" ) ;
r . WriteLine ( "MEA+AAE+G+KGM:" + Math . Round ( ctn . KGS , 3 ) + "'" ) ;
r . WriteLine ( "MEA+AAE+AAW+MTQ:" + Math . Round ( ctn . CBM , 3 ) + "'" ) ;
r . WriteLine ( "TMD+3'" ) ;
icount + + ;
r . WriteLine ( "MEA+WT+AAL+KGM:" + Math . Round ( ctn . KGS , 3 ) + "'" ) ;
r . WriteLine ( "MEA+VOL+AAW+MTQ:" + Math . Round ( ctn . CBM , 3 ) + "'" ) ;
r . WriteLine ( "MEA+AAU++" + GetPackageEDICode ( ctn . KINDPKGS , "EVERGREEN" ) + ":" + ctn . PKGS . ToString ( ) + "'" ) ;
icount = icount + 3 ;
if ( bill . CARGOID = = "R" )