@ -4,6 +4,7 @@ using System.IO;
using System.Linq ;
using System.Linq ;
using System.Runtime.InteropServices ;
using System.Runtime.InteropServices ;
using System.Text ;
using System.Text ;
using System.Threading ;
using System.Threading.Tasks ;
using System.Threading.Tasks ;
namespace Myshipping.Application.EDI
namespace Myshipping.Application.EDI
@ -31,6 +32,7 @@ namespace Myshipping.Application.EDI
if ( str = = "DAAE" ) return "DELMAS" ;
if ( str = = "DAAE" ) return "DELMAS" ;
if ( str = = "UASC" ) return "UASC" ;
if ( str = = "UASC" ) return "UASC" ;
if ( str = = "COSU" ) return "COSCO" ;
if ( str = = "COSU" ) return "COSCO" ;
if ( str = = "OOLU" ) return "OOCL" ;
else return "" ;
else return "" ;
}
}
public static string GetBillNum ( string str )
public static string GetBillNum ( string str )
@ -186,6 +188,9 @@ namespace Myshipping.Application.EDI
/// <returns></returns>
/// <returns></returns>
public static string formatEdiStr ( string fileType , string str )
public static string formatEdiStr ( string fileType , string str )
{
{
if ( str = = null )
str = string . Empty ;
if ( fileType = = "txt" )
if ( fileType = = "txt" )
{
{
return str . Replace ( "?" , "??" ) . Replace ( ":" , "?:" ) . Replace ( "+" , "?+" ) . Replace ( "'" , "?'" ) ;
return str . Replace ( "?" , "??" ) . Replace ( ":" , "?:" ) . Replace ( "+" , "?+" ) . Replace ( "'" , "?'" ) ;
@ -340,7 +345,7 @@ namespace Myshipping.Application.EDI
if ( headData . CARGOID = = "D" | | headData . SERVICE = = "DOOR-DOOR" | | headData . SERVICE = = "DOOR-CY" | | headData . SERVICE = = "CY-DOOR" )
if ( headData . CARGOID = = "D" | | headData . SERVICE = = "DOOR-DOOR" | | headData . SERVICE = = "DOOR-CY" | | headData . SERVICE = = "CY-DOOR" )
{
{
if ( headData . CARRIER ! = "YML" )
if ( headData . CARRIER ID ! = "YML" )
{
{
if ( string . IsNullOrEmpty ( headData . EDIATTN ) )
if ( string . IsNullOrEmpty ( headData . EDIATTN ) )
{ error = error + "<br />EDI信息联系人不能为空" ; }
{ error = error + "<br />EDI信息联系人不能为空" ; }
@ -771,7 +776,7 @@ namespace Myshipping.Application.EDI
r . WriteLine ( "UNH+" + bill . ORDERNO + "+IFTMBF:D:99B:UN'" ) ;
r . WriteLine ( "UNH+" + bill . ORDERNO + "+IFTMBF:D:99B:UN'" ) ;
icount = icount + 2 ;
icount = icount + 2 ;
if ( bill . CARRIER ED ICO DE = = "HLCU" )
if ( bill . CARRIER ID = = "HLCU" )
{
{
if ( InttrEdi . filerole = = "9" )
if ( InttrEdi . filerole = = "9" )
r . WriteLine ( "BGM+335+" + bill . ORDERNO + "SO+9'" ) ;
r . WriteLine ( "BGM+335+" + bill . ORDERNO + "SO+9'" ) ;
@ -795,15 +800,15 @@ namespace Myshipping.Application.EDI
r . WriteLine ( "DTM+137:" + DateTime . Now . ToString ( "yyyyMMddHHmm" ) + ":203'" ) ;
r . WriteLine ( "DTM+137:" + DateTime . Now . ToString ( "yyyyMMddHHmm" ) + ":203'" ) ;
icount = icount + 2 ;
icount = icount + 2 ;
if ( bill . SERVICE . ToUpper ( ) = = "DOOR-DOOR" )
if ( bill . SERVICE EDICODE . ToUpper ( ) = = "DOOR-DOOR" )
{
{
r . WriteLine ( "TSR+27+2'" ) ;
r . WriteLine ( "TSR+27+2'" ) ;
}
}
else if ( bill . SERVICE . ToUpper ( ) = = "DOOR-CY" )
else if ( bill . SERVICE EDICODE . ToUpper ( ) = = "DOOR-CY" )
{
{
r . WriteLine ( "TSR+28+2'" ) ;
r . WriteLine ( "TSR+28+2'" ) ;
}
}
else if ( bill . SERVICE . ToUpper ( ) = = "CY-DOOR" )
else if ( bill . SERVICE EDICODE . ToUpper ( ) = = "CY-DOOR" )
{
{
r . WriteLine ( "TSR+29+2'" ) ;
r . WriteLine ( "TSR+29+2'" ) ;
}
}
@ -818,7 +823,7 @@ namespace Myshipping.Application.EDI
if ( bill . BLFRT . IndexOf ( "COLLECT" ) > = 0 )
if ( bill . BLFRT . IndexOf ( "COLLECT" ) > = 0 )
str_pay = bill . PAYABLEAT ;
str_pay = bill . PAYABLEAT ;
/ * 2024 - 04 - 08 JHQ 参 考 东 胜 去 掉 了
if ( bill . CARRIEREDICODE = = "HLCU" )
if ( bill . CARRIEREDICODE = = "HLCU" )
{
{
r . WriteLine ( "FTX+AAI+++" + bill . BLFRT + " Payable at " + str_pay + " " + bill . SERVICE + " " + bill . CONTRACTNO + " "
r . WriteLine ( "FTX+AAI+++" + bill . BLFRT + " Payable at " + str_pay + " " + bill . SERVICE + " " + bill . CONTRACTNO + " "
@ -834,17 +839,34 @@ namespace Myshipping.Application.EDI
r . WriteLine ( "FTX+AAI+++" + bill . BLFRT + " Payable at " + str_pay + " " + bill . SERVICE + " "
r . WriteLine ( "FTX+AAI+++" + bill . BLFRT + " Payable at " + str_pay + " " + bill . SERVICE + " "
+ bill . PKGS . ToString ( ) + bill . KINDPKGS + " " + formatEdiStr ( "txt" , bill . EDIREMARK . Replace ( "\r\n" , " " ) . Replace ( "\n" , " " ) . Replace ( "\r" , " " ) ) + "'" ) ;
+ bill . PKGS . ToString ( ) + bill . KINDPKGS + " " + formatEdiStr ( "txt" , bill . EDIREMARK . Replace ( "\r\n" , " " ) . Replace ( "\n" , " " ) . Replace ( "\r" , " " ) ) + "'" ) ;
}
}
icount = icount + 2 ;
icount = icount + 2 ;
* /
icount = icount + 1 ;
var Shipping = "" ;
Shipping = formatEdiStr ( "txt" , bill . EDIREMARK ) ;
Shipping = Shipping . Replace ( "\n" , "\\" ) ;
Shipping = Shipping . Replace ( "\r" , " " ) ;
string [ ] EdiRemarkList = Shipping . Split ( '\\' ) ;
if ( EdiRemarkList . Length ! = 0 )
{
for ( var i = 0 ; i < EdiRemarkList . Length ; i + + )
{
r . WriteLine ( "FTX+AAI+++" + EdiRemarkList [ i ] + "'" ) ;
icount = icount + 1 ;
}
}
/*件重尺*/
/*件重尺*/
r . WriteLine ( "CNT+7:" + Math . Round ( Convert . ToDecimal ( bill . KGS ) , 3 ) + ":KGM'" ) ; //按照四舍五入的国际标准
r . WriteLine ( "CNT+7:" + bill. KGS . ToString ( "0.###" ) + ":KGM'" ) ; //按照四舍五入的国际标准
r . WriteLine ( "CNT+11:" + bill . PKGS . ToString ( ) + "'" ) ;
r . WriteLine ( "CNT+11:" + bill . PKGS . ToString ( ) + "'" ) ;
r . WriteLine ( "CNT+15:" + Math . Round ( Convert . ToDecimal ( bill . CBM ) , 3 ) + ":MTQ'" ) ;
r . WriteLine ( "CNT+15:" + bill. CBM . ToString ( "0.###" ) + ":MTQ'" ) ;
icount = icount + 3 ;
icount = icount + 3 ;
//2024-04-08 这里看2.0文档显示不使用 CNT
if ( bill . CARRIEREDICODE = = "UASC" )
if ( bill . CARRIER ID = = "UASC" )
{
{
if ( bill . CTNLIST . Count > 0 )
if ( bill . CTNLIST . Count > 0 )
{
{
@ -861,7 +883,7 @@ namespace Myshipping.Application.EDI
if ( bill . BLFRT = = "FREIGHT COLLECT" )
if ( bill . BLFRT = = "FREIGHT COLLECT" )
{
{
if ( bill . PAYABLEAT ! = "" )
if ( ! string . IsNullOrWhiteSpace ( bill . PAYABLEAT ) )
{
{
r . WriteLine ( "LOC+57+" + bill . PREPARDATID + "::6:" + bill . PAYABLEAT + "'" ) ;
r . WriteLine ( "LOC+57+" + bill . PREPARDATID + "::6:" + bill . PAYABLEAT + "'" ) ;
icount = icount + 1 ;
icount = icount + 1 ;
@ -924,17 +946,25 @@ namespace Myshipping.Application.EDI
r . WriteLine ( "TDT+20+" + voyno + "+1++" + bill . CARRIEREDICODE + "+++:::" + bill . VESSEL + "'" ) ;
r . WriteLine ( "TDT+20+" + voyno + "+1++" + bill . CARRIEREDICODE + "+++:::" + bill . VESSEL + "'" ) ;
r . WriteLine ( "LOC+9+" + bill . PORTLOADID + ":139:6:" + bill . PORTLOAD + "'" ) ;
r . WriteLine ( "LOC+9+" + bill . PORTLOADID + ":139:6:" + bill . PORTLOAD + "'" ) ;
r . WriteLine ( "DTM+133:" + Convert . ToDateTime ( bill . ETD ) . ToString ( "yyyyMMdd" ) + ":102'" ) ; //yyyyMMddHHmm
r . WriteLine ( "DTM+133:" + Convert . ToDateTime ( bill . ETD ) . ToString ( "yyyyMMdd" ) + ":102'" ) ; //yyyyMMddHHmm
r . WriteLine ( "LOC+88+" + bill . PORTLOADID + ":139:6:" + bill . PORTLOAD + "'" ) ;
if ( ! string . IsNullOrEmpty ( bill . PLACERECEIPTID ) )
r . WriteLine ( "LOC+88+" + bill . PLACERECEIPTID + ":139:6:" + bill . PLACERECEIPT + "'" ) ;
else
r . WriteLine ( "LOC+88+" + bill . PORTLOADID + ":139:6:" + bill . PORTLOAD + "'" ) ;
r . WriteLine ( "LOC+11+" + bill . PORTDISCHARGEID + ":139:6:" + bill . PORTDISCHARGE + "'" ) ;
r . WriteLine ( "LOC+11+" + bill . PORTDISCHARGEID + ":139:6:" + bill . PORTDISCHARGE + "'" ) ;
icount = icount + 5 ;
icount = icount + 5 ;
if ( bill . DESTINATION ! = "" )
if ( ! string . IsNullOrWhiteSpace ( bill . DESTINATIONID ) )
{
{
r . WriteLine ( "LOC+7+" + bill . DESTINATIONID + ":139:6:" + bill . DESTINATION + "'" ) ;
r . WriteLine ( "LOC+7+" + bill . DESTINATIONID + ":139:6:" + bill . DESTINATION + "'" ) ;
icount = icount + 1 ;
icount = icount + 1 ;
}
}
var Shipping = "" ;
var DescriptionShipper = "" ;
//处理发货人
Shipping = string . Empty ;
var DescriptionShipper = string . Empty ;
Shipping = formatEdiStr ( "txt" , bill . SHIPPER ) ;
Shipping = formatEdiStr ( "txt" , bill . SHIPPER ) ;
List < System . String > ShippingList = formatlengthStr ( Shipping , 35 ) ;
List < System . String > ShippingList = formatlengthStr ( Shipping , 35 ) ;
@ -957,6 +987,7 @@ namespace Myshipping.Application.EDI
}
}
else
else
Shipping = Shipping + ":" + ShippingList [ i ] ;
Shipping = Shipping + ":" + ShippingList [ i ] ;
if ( bill . CARRIEREDICODE = = "HLCU" )
if ( bill . CARRIEREDICODE = = "HLCU" )
{
{
Shipping = Shipping + "-" ;
Shipping = Shipping + "-" ;
@ -1008,6 +1039,7 @@ namespace Myshipping.Application.EDI
}
}
else
else
Shipping = Shipping + ":" + ShippingList [ i ] ;
Shipping = Shipping + ":" + ShippingList [ i ] ;
if ( bill . CARRIEREDICODE = = "HLCU" )
if ( bill . CARRIEREDICODE = = "HLCU" )
{
{
Shipping = Shipping + "--" ;
Shipping = Shipping + "--" ;
@ -1061,7 +1093,6 @@ namespace Myshipping.Application.EDI
if ( ShippingList . Count ! = 0 & & Shipping . Length > 0 )
if ( ShippingList . Count ! = 0 & & Shipping . Length > 0 )
{
{
for ( var i = 0 ; i < ShippingList . Count ; i + + )
for ( var i = 0 ; i < ShippingList . Count ; i + + )
{
{
if ( i = = 0 ) Shipping = "NAD+NI+++" + ShippingList [ 0 ] + "+" ;
if ( i = = 0 ) Shipping = "NAD+NI+++" + ShippingList [ 0 ] + "+" ;
@ -1109,10 +1140,10 @@ namespace Myshipping.Application.EDI
}
}
else if ( bill . BYCOUNTRY = = "BRAZIL" )
else if ( bill . BYCOUNTRY = = "BRAZIL" )
{
{
if ( bill . NOTIFYPARTYCOUNTRY ! = "" )
if ( ! string . IsNullOrWhiteSpace ( bill . NOTIFYPARTYCOUNTRY ) )
Shipping = Shipping + "++++" + bill . NOTIFYPARTYCOUNTRY ;
Shipping = Shipping + "++++" + bill . NOTIFYPARTYCOUNTRY ;
r . WriteLine ( Shipping + "'" ) ;
r . WriteLine ( Shipping + "'" ) ;
if ( bill . NOTIFYPARTYTAXNO ! = "" )
if ( ! string . IsNullOrWhiteSpace ( bill . NOTIFYPARTYTAXNO ) )
{
{
r . WriteLine ( "RFF+GN:" + bill . NOTIFYPARTYTAXNO + "'" ) ;
r . WriteLine ( "RFF+GN:" + bill . NOTIFYPARTYTAXNO + "'" ) ;
icount = icount + 1 ;
icount = icount + 1 ;
@ -1125,7 +1156,7 @@ namespace Myshipping.Application.EDI
r . WriteLine ( "NAD+CA+" + bill . CARRIEREDICODE + ":160:86++" + GetCarrierName ( bill . CARRIEREDICODE ) + "'" ) ;
r . WriteLine ( "NAD+CA+" + bill . CARRIEREDICODE + ":160:86++" + GetCarrierName ( bill . CARRIEREDICODE ) + "'" ) ;
icount = icount + 1 ;
icount = icount + 1 ;
if ( bill . SERVICE = = "DOOR-DOOR" )
if ( bill . SERVICE EDICODE = = "DOOR-DOOR" )
{
{
Shipping = formatEdiStr ( "txt" , bill . SHIPPER ) ;
Shipping = formatEdiStr ( "txt" , bill . SHIPPER ) ;
ShippingList = formatlengthStr ( Shipping , 35 ) ;
ShippingList = formatlengthStr ( Shipping , 35 ) ;
@ -1208,7 +1239,7 @@ namespace Myshipping.Application.EDI
}
}
if ( bill . WEITUO ! = "" )
if ( ! string . IsNullOrWhiteSpace ( bill . WEITUO ) )
{
{
if ( bill . WEITUO . Length > 35 )
if ( bill . WEITUO . Length > 35 )
r . WriteLine ( "NAD+FW+++" + formatEdiStr ( "txt" , bill . WEITUO . Substring ( 0 , 35 ) ) + "+" + formatEdiStr ( "txt" , bill . WEITUO . Substring ( 35 ) ) + "'" ) ;
r . WriteLine ( "NAD+FW+++" + formatEdiStr ( "txt" , bill . WEITUO . Substring ( 0 , 35 ) ) + "+" + formatEdiStr ( "txt" , bill . WEITUO . Substring ( 35 ) ) + "'" ) ;
@ -1258,7 +1289,7 @@ namespace Myshipping.Application.EDI
icount = icount + 8 ;
icount = icount + 8 ;
if ( bill . HSCODE ! = "" )
if ( ! string . IsNullOrWhiteSpace ( bill . HSCODE ) )
{
{
r . WriteLine ( "PIA+5+" + bill . HSCODE + ":HS'" ) ;
r . WriteLine ( "PIA+5+" + bill . HSCODE + ":HS'" ) ;
icount = icount + 1 ;
icount = icount + 1 ;
@ -1278,27 +1309,27 @@ namespace Myshipping.Application.EDI
}
}
}
}
if ( DescriptionShipper ! = "" )
if ( ! string . IsNullOrWhiteSpace ( DescriptionShipper ) )
{
{
r . WriteLine ( "FTX+AAA+++" + DescriptionShipper + "'" ) ;
r . WriteLine ( "FTX+AAA+++" + DescriptionShipper + "'" ) ;
icount = icount + 1 ;
icount = icount + 1 ;
}
}
if ( DescriptionConsignee ! = "" )
if ( ! string . IsNullOrWhiteSpace ( DescriptionConsignee ) )
{
{
r . WriteLine ( "FTX+AAA+++" + DescriptionConsignee + "'" ) ;
r . WriteLine ( "FTX+AAA+++" + DescriptionConsignee + "'" ) ;
icount = icount + 1 ;
icount = icount + 1 ;
}
}
if ( DescriptionNotifyparty ! = "" )
if ( ! string . IsNullOrWhiteSpace ( DescriptionNotifyparty ) )
{
{
r . WriteLine ( "FTX+AAA+++" + DescriptionNotifyparty + "'" ) ;
r . WriteLine ( "FTX+AAA+++" + DescriptionNotifyparty + "'" ) ;
icount = icount + 1 ;
icount = icount + 1 ;
}
}
r . WriteLine ( "MEA+AAE+WT+KGM:" + Math. Round ( Convert . ToDecimal ( bill . KGS ) , 3 ) + "'" ) ;
r . WriteLine ( "MEA+AAE+WT+KGM:" + bill. KGS . ToString ( "0.###" ) + "'" ) ;
r . WriteLine ( "MEA+AAE+AAW+MTQ:" + Math. Round ( Convert . ToDecimal ( bill . CBM ) , 3 ) + "'" ) ;
r . WriteLine ( "MEA+AAE+AAW+MTQ:" + bill. CBM . ToString ( "0.###" ) + "'" ) ;
icount = icount + 2 ;
icount = icount + 2 ;
Shipping = formatEdiStr ( "txt" , bill . MARKS ) ;
Shipping = formatEdiStr ( "txt" , bill . MARKS ) ;
@ -1316,6 +1347,7 @@ namespace Myshipping.Application.EDI
}
}
}
}
//危险品
if ( bill . CARGOID = = "D" )
if ( bill . CARGOID = = "D" )
{
{
r . WriteLine ( "DGS+IMD+" + bill . DCLASS + "+" + bill . DUNNO + "'" ) ;
r . WriteLine ( "DGS+IMD+" + bill . DCLASS + "+" + bill . DUNNO + "'" ) ;
@ -1336,6 +1368,7 @@ namespace Myshipping.Application.EDI
isfind = true ;
isfind = true ;
}
}
} ) ;
} ) ;
if ( ! isfind )
if ( ! isfind )
{
{
var ctnnum = new MsOpSeaeCtnEDIBaseModel ( ) ;
var ctnnum = new MsOpSeaeCtnEDIBaseModel ( ) ;
@ -1350,16 +1383,41 @@ namespace Myshipping.Application.EDI
r . WriteLine ( "EQD+CN++" + ctn . CTNALLCODE + "+1'" ) ;
r . WriteLine ( "EQD+CN++" + ctn . CTNALLCODE + "+1'" ) ;
else
else
r . WriteLine ( "EQD+CN++" + ctn . CTNALLCODE + "+2'" ) ;
r . WriteLine ( "EQD+CN++" + ctn . CTNALLCODE + "+2'" ) ;
r . WriteLine ( "EQN+" + ctn . CTNNUM . ToString ( ) + "'" ) ;
r . WriteLine ( "EQN+" + ctn . CTNNUM . ToString ( ) + "'" ) ;
icount = icount + 2 ;
icount = icount + 2 ;
if ( bill . CARGOID = = "R" )
if ( bill . CARGOID = = "R" )
{
{
if ( bill . REEFERF ! = "" )
if ( ! string . IsNullOrWhiteSpace ( bill . REEFERF ) )
r . WriteLine ( "MEA+AAE+AAS+CBM:" + bill . REEFERF + "'" ) ;
r . WriteLine ( "MEA+AAE+AAS+CBM:" + bill . REEFERF + "'" ) ;
if ( bill . HUMIDITY ! = "" )
if ( ! string . IsNullOrWhiteSpace ( bill . HUMIDITY ) )
r . WriteLine ( "MEA+AAE+AAO+HMD:" + bill . HUMIDITY + "'" ) ;
r . WriteLine ( "MEA+AAE+AAO+HMD:" + bill . HUMIDITY + "'" ) ;
r . WriteLine ( "TMP+2+" + bill . TEMPSET + ":CEL'" ) ;
//温度这里如果是带小数点的值,会导致错误,这里需要慎重
var tempset = bill . TEMPSET ;
if ( ! string . IsNullOrWhiteSpace ( tempset ) )
{
var fuhao = "" ;
if ( tempset . IndexOf ( "-" ) = = 0 )
{
fuhao = "-" ;
tempset = tempset . Replace ( "-" , "" ) ;
}
if ( tempset . Length < 3 )
{
for ( int i = 0 ; i < 3 - tempset . Length + 1 ; i + + )
{
tempset = "0" + tempset ;
}
}
tempset = fuhao + tempset ;
}
else
{
tempset = "000" ;
}
r . WriteLine ( "TMP+2+" + tempset + ":CEL'" ) ;
icount = icount + 2 ;
icount = icount + 2 ;
@ -1405,15 +1463,15 @@ namespace Myshipping.Application.EDI
if ( bill . SERVICE . ToUpper ( ) = = "DOOR-DOOR" )
if ( bill . SERVICE EDICODE . ToUpper ( ) = = "DOOR-DOOR" )
{
{
r . WriteLine ( "TSR+27+2'" ) ;
r . WriteLine ( "TSR+27+2'" ) ;
}
}
else if ( bill . SERVICE . ToUpper ( ) = = "DOOR-CY" )
else if ( bill . SERVICE EDICODE . ToUpper ( ) = = "DOOR-CY" )
{
{
r . WriteLine ( "TSR+28+2'" ) ;
r . WriteLine ( "TSR+28+2'" ) ;
}
}
else if ( bill . SERVICE . ToUpper ( ) = = "CY-DOOR" )
else if ( bill . SERVICE EDICODE . ToUpper ( ) = = "CY-DOOR" )
{
{
r . WriteLine ( "TSR+29+2'" ) ;
r . WriteLine ( "TSR+29+2'" ) ;
}
}
@ -1423,11 +1481,11 @@ namespace Myshipping.Application.EDI
}
}
var str_pay = "" ;
var str_pay = "" ;
if ( bill . BLFRT . IndexOf ( "PREPAID" ) > = 0 )
if ( bill . BLFRT EDICODE . IndexOf ( "PREPAID" ) > = 0 )
str_pay = bill . PREPARDAT ;
str_pay = bill . PREPARDAT ;
if ( bill . BLFRT . IndexOf ( "COLLECT" ) > = 0 )
if ( bill . BLFRT EDICODE . IndexOf ( "COLLECT" ) > = 0 )
str_pay = bill . PAYABLEAT ;
str_pay = bill . PAYABLEAT ;
r . WriteLine ( "FTX+AAI+++" + bill . BLFRT + " Payable at " + str_pay + " " + bill . SERVIC E + " "
r . WriteLine ( "FTX+AAI+++" + bill . BLFRT EDICODE + " Payable at " + str_pay + " " + bill . SERVIC EEDICOD E + " "
+ bill . PKGS . ToString ( ) + bill . KINDPKGS + "'" ) ;
+ bill . PKGS . ToString ( ) + bill . KINDPKGS + "'" ) ;
icount = icount + 5 ;
icount = icount + 5 ;
@ -1593,8 +1651,6 @@ namespace Myshipping.Application.EDI
}
}
var DescriptionShipper = "" ;
var DescriptionShipper = "" ;
Shipping = formatEdiStr ( "txt" , bill . SHIPPER ) ;
Shipping = formatEdiStr ( "txt" , bill . SHIPPER ) ;
@ -1715,6 +1771,7 @@ namespace Myshipping.Application.EDI
else r . WriteLine ( Shipping + "'" ) ;
else r . WriteLine ( Shipping + "'" ) ;
icount = icount + 1 ;
icount = icount + 1 ;
/ * 2024 - 04 - 08 JHQ 看 文 档 2.0 应 该 没 有 这 段 代 码 了
if ( ! string . IsNullOrEmpty ( bill . WEITUO ) )
if ( ! string . IsNullOrEmpty ( bill . WEITUO ) )
{
{
if ( bill . WEITUO . Length > 35 )
if ( bill . WEITUO . Length > 35 )
@ -1739,10 +1796,11 @@ namespace Myshipping.Application.EDI
r . WriteLine ( "NAD+FW+" + InttrEdi . SENDCODE + ":160:86++" + InttrEdi . SENDNAME + "'" ) ;
r . WriteLine ( "NAD+FW+" + InttrEdi . SENDCODE + ":160:86++" + InttrEdi . SENDNAME + "'" ) ;
}
}
}
}
icount + + ;
* /
icount + + ;
Shipping = formatEdiStr ( "txt" , bill . NOTIFYPARTY ) ;
Shipping = formatEdiStr ( "txt" , bill . NOTIFYPARTY ) ;
@ -1813,6 +1871,7 @@ namespace Myshipping.Application.EDI
else r . WriteLine ( Shipping + "'" ) ;
else r . WriteLine ( Shipping + "'" ) ;
icount = icount + 1 ;
icount = icount + 1 ;
/ * 2024 - 04 - 08 JHQ 参 考 文 档 2.0 去 掉 了
Shipping = formatEdiStr ( "txt" , bill . NOTIFYPARTY2 ) ;
Shipping = formatEdiStr ( "txt" , bill . NOTIFYPARTY2 ) ;
ShippingList = formatlengthStr ( Shipping , 35 ) ;
ShippingList = formatlengthStr ( Shipping , 35 ) ;
if ( ShippingList . Count ! = 0 & & Shipping . Length > 0 )
if ( ShippingList . Count ! = 0 & & Shipping . Length > 0 )
@ -1826,10 +1885,11 @@ namespace Myshipping.Application.EDI
}
}
r . WriteLine ( Shipping + "'" ) ;
r . WriteLine ( Shipping + "'" ) ;
}
}
* /
r . WriteLine ( "NAD+CA+" + bill . CARRIEREDICODE + ":160:86++" + GetCarrierName ( bill . CARRIEREDICODE ) + "'" ) ;
r . WriteLine ( "NAD+CA+" + bill . CARRIEREDICODE + ":160:86++" + GetCarrierName ( bill . CARRIEREDICODE ) + "'" ) ;
icount = icount + 1 ;
if ( InttrEdi . SENDNAME . Length > 35 )
if ( InttrEdi . SENDNAME . Length > 35 )
r . WriteLine ( "NAD+HI+" + InttrEdi . SENDCODE + ":160:86++" + InttrEdi . SENDNAME . Substring ( 0 , 35 ) + "+" + InttrEdi . SENDNAME . Substring ( 35 ) + "'" ) ;
r . WriteLine ( "NAD+HI+" + InttrEdi . SENDCODE + ":160:86++" + InttrEdi . SENDNAME . Substring ( 0 , 35 ) + "+" + InttrEdi . SENDNAME . Substring ( 35 ) + "'" ) ;
@ -1853,7 +1913,8 @@ namespace Myshipping.Application.EDI
}
}
}
}
else if ( bill . ISSUETYPE = = "海运单" | | bill . ISSUETYPE . ToUpper ( ) = = "SEAWAY" | | bill . ISSUETYPE . ToUpper ( ) = = "SEAWAY BILL" | | bill . ISSUETYPE . ToUpper ( ) = = "WAYBILL" | | bill . ISSUETYPE . ToUpper ( ) = = "SWB正本" | | bill . ISSUETYPE . ToUpper ( ) = = "SWB无正本" )
else if ( bill . ISSUETYPE = = "海运单" | | bill . ISSUETYPE . ToUpper ( ) = = "SEAWAY" | | bill . ISSUETYPE . ToUpper ( ) = = "SEAWAY BILL" | | bill . ISSUETYPE . ToUpper ( ) = = "WAYBILL" | | bill . ISSUETYPE . ToUpper ( ) = = "SWB正本"
| | bill . ISSUETYPE . ToUpper ( ) = = "SWB无正本" )
{
{
r . WriteLine ( "DOC+710+++" + GetBillNum ( bill . NOBILL ) + "'" ) ;
r . WriteLine ( "DOC+710+++" + GetBillNum ( bill . NOBILL ) + "'" ) ;
icount = icount + 1 ;
icount = icount + 1 ;
@ -2016,9 +2077,9 @@ namespace Myshipping.Application.EDI
}
}
//MEA+AAE+WT+KGM:3000'
//MEA+AAE+WT+KGM:3000'
//MEA+AAE+AAW+MTQ:110.11'
//MEA+AAE+AAW+MTQ:110.11'
r . WriteLine ( "MEA+AAE+WT+KGM:" + Math. Round ( Convert . ToDecimal ( ctngood . KGS ) , 3 ) + "'" ) ;
r . WriteLine ( "MEA+AAE+WT+KGM:" + ctngood. KGS . ToString ( "0.###" ) + "'" ) ;
icount + + ;
icount + + ;
r . WriteLine ( "MEA+AAE+AAW+MTQ:" + Math. Round ( Convert . ToDecimal ( ctngood . CBM ) , 3 ) + "'" ) ;
r . WriteLine ( "MEA+AAE+AAW+MTQ:" + ctngood. CBM . ToString ( "0.###" ) + "'" ) ;
icount + + ;
icount + + ;
//PCI++MARKS AND NUMBERS:FOR MATERIAL 1: OUR PONUMBER: PO_123456'
//PCI++MARKS AND NUMBERS:FOR MATERIAL 1: OUR PONUMBER: PO_123456'
//if (isbill != 1)
//if (isbill != 1)