@ -43215,6 +43215,685 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
# endregion
#region CSSA 报文
public static string IsCreateEdiCSSA ( List < MsOpSeae > headData , string type , string filetype , string filerole , string carrier = "" )
{
var error = "" ;
//if (string.IsNullOrEmpty(ftpset.SENDCOMPANYCODE)) {
//}
foreach ( var bill in headData )
{
//if (filetype != "B")
if ( bill . MBLNO = = null | | bill . MBLNO = = "" )
{ error = error + "<br />主提单号不能为空" ; }
if ( ( bill . BLFRT = = null | | bill . BLFRT = = "" ) )
{ error = error + "<br />提单号:" + bill . MBLNO + "付费方式不能为空" ; }
if ( bill . SERVICE = = "" | | bill . SERVICE = = null )
{ error = error + "<br />提单号:" + bill . MBLNO + "运输条款不能为空" ; }
if ( bill . ISSUEPLACE = = null | | bill . ISSUEPLACE = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "签单地点不能为空" ; }
if ( bill . ISSUETYPE = = null | | bill . ISSUETYPE = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "签单方式不能为空" ; }
if ( bill . VESSEL = = null | | bill . VESSEL = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "船名不能为空" ; }
if ( bill . VOYNO = = null | | bill . VOYNO = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "航次不能为空" ; }
if ( bill . ETD = = null | | bill . ETD = = "" )
{
error = error + "<br />提单号:" + bill . MBLNO + "开船日期不能为空" ;
return error ;
}
if ( GetPortEDICode ( bill . PORTLOADID , type ) = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "装货港代码不能为空" ; }
if ( bill . PORTLOAD = = null | | bill . PORTLOAD = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "装货港不能为空" ; }
if ( bill . PORTDISCHARGE = = null | | bill . PORTDISCHARGE = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "卸货港不能为空" ; }
if ( GetPortEDICode ( bill . PORTDISCHARGEID , type ) = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "卸货港代码不能为空" ; }
if ( bill . PLACEDELIVERY = = null | | bill . PLACEDELIVERY = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "交货地不能为空" ; }
if ( GetPortEDICode ( bill . PLACEDELIVERYID , type ) = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "交货地代码不能为空" ; }
if ( GetPackageEDICode ( bill . KINDPKGS , "CSSA" ) = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "包装EDI代码不能为空" ; }
if ( bill . DESCRIPTION = = null | | bill . DESCRIPTION = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "货物描述不能为空" ; }
if ( bill . MARKS = = null | | bill . MARKS = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "货物唛头不能为空" ; }
if ( bill . PKGS = = "0" )
{ error = error + "<br />提单号:" + bill . MBLNO + "货物件数不能为空" ; }
if ( Convert . ToDecimal ( bill . KGS ) = = 0 )
{ error = error + "<br />提单号:" + bill . MBLNO + "货物毛重不能为空" ; }
if ( bill . CARGOID = = null | | bill . CARGOID = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "货物标示不能为空" ; }
if ( bill . CARGOID = = "D" )
{
if ( bill . DCLASS = = null | | bill . DCLASS = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "危险品分类不能为空" ; }
if ( bill . DUNNO = = null | | bill . DUNNO = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "危险品编号不能为空" ; }
}
if ( bill . CARGOID = = "R" )
{
if ( bill . TEMPSET = = null | | bill . TEMPSET = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "设置温度不能为空" ; }
if ( bill . REEFERF ! = null & & bill . REEFERF ! = "" )
{
//if (bill.REEFERF.Length > 3)
//{
// error = error + "<br />提单号:" + bill.MBLNO + "冷藏通风度必须是不能大于3位数字! ";
//}
//else
//{
// if (StringIsNum(bill.REEFERF) == false)
// {
// error = error + "<br />提单号:" + bill.MBLNO + "冷藏通风度必须是不能大于3位数字! ";
// }
//}
}
}
var ctnlist = MsOpSeaeDAL . MsOpSeaeDAL . GetBodyList ( "BSNO='" + bill . BSNO + "'" ) ;
if ( ctnlist . Count = = 0 ) { error = error + "<br />提单号:" + bill . MBLNO + "集装箱信息不能为空" ; }
else
{
Decimal dlPKGS = 0 ;
Decimal dlKGS = 0 ;
Decimal dlCBM = 0 ;
foreach ( var ctn in ctnlist )
{
//if ((ctn.CTNALL.IndexOf("RH") > 0 || ctn.CTNALL.IndexOf("RF") > 0) && (bill.CARGOID != "R"))
//{
// { error = error + "<br />提单号:" + bill.MBLNO + " 集装箱箱型为冻柜,货类代码请选择冻柜"; }
//}
if ( ctn . CTNALL = = null | | ctn . CTNALL = = "" )
{ error = error + "|提单号:" + bill . MBLNO + "箱型不能为空" ; }
if ( filetype ! = "B" )
{
if ( ctn . CNTRNO = = null | | ctn . CNTRNO = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "箱号不能为空" ; }
//if (ctn.CTNSTATUS == null || ctn.CTNSTATUS == "")
//{ error = error + "<br />提单号:" + bill.HBLNO + "箱状态不能为空"; }
if ( ctn . KINDPKGS ! = bill . KINDPKGS )
{ error = error + "<br />提单号:" + bill . MBLNO + " 中的包装类型与集装箱的包装类型不同" ; }
/ /
dlPKGS + = ctn . PKGS ;
dlKGS + = ctn . KGS ;
dlCBM + = ctn . CBM ;
}
}
if ( filetype = = "E" )
{
if ( dlPKGS ! = Convert . ToInt32 ( bill . PKGS ) )
{ error = error + "<br />提单号:" + bill . MBLNO + " 集装箱件数合计数必须等于委托单总件数" ; }
if ( dlKGS ! = Convert . ToDecimal ( bill . KGS ) )
{ error = error + "<br />提单号:" + bill . MBLNO + " 集装箱重量合计数必须等于委托单总重量数" ; }
if ( dlCBM ! = Convert . ToDecimal ( bill . CBM ) )
{ error = error + "<br />提单号:" + bill . MBLNO + " 集装箱尺码合计数必须等于委托单总尺码数" ; }
}
}
if ( Convert . ToDecimal ( bill . PKGS ) = = 0 )
{ error = error + "<br />提单号:" + bill . MBLNO + " 货物件数不能为空" ; }
if ( Convert . ToDecimal ( bill . KGS ) = = 0 )
{ error = error + "<br />提单号:" + bill . MBLNO + " 货物重量不能为空" ; }
if ( Convert . ToDecimal ( bill . CBM ) = = 0 )
{ error = error + "<br />提单号:" + bill . MBLNO + " 货物尺码不能为空" ; }
if ( StringIsChinese ( bill . SHIPPER ) )
{
error = error + "<br />提单号:" + bill . MBLNO + "发货人含有中文或双字节字符" ;
}
if ( StringIsChinese ( bill . CONSIGNEE ) )
{
error = error + "<br />提单号:" + bill . MBLNO + "收货人含有中文或双字节字符" ;
}
if ( StringIsChinese ( bill . NOTIFYPARTY ) )
{
error = error + "<br />提单号:" + bill . MBLNO + "通知人含有中文或双字节字符" ;
}
if ( StringIsChinese ( bill . MARKS ) )
{
error = error + "<br />提单号:" + bill . MBLNO + "唛头含有中文或双字节字符" ;
}
if ( StringIsChinese ( bill . DESCRIPTION ) )
{
error = error + "<br />提单号:" + bill . MBLNO + "货物描述含有中文或双字节字符" ;
}
if ( GetPortEDICode ( bill . ISSUEPLACEID , type ) = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "签单地点EDI代码不能为空" ; }
if ( GetPortEDICode ( bill . ISSUEPLACE , type ) = = "" )
{ error = error + "<br />提单号:" + bill . MBLNO + "签单地点不能为空" ; }
}
return error ;
}
public static string CreateCSSAXmlStr ( List < MsOpSeae > headData , string usercode , string path , string mblno , string filerole , CodeFtpSet ftpset , int isbill , string carrier , string filetype , int IsNADFW , string tbNADFWID , string tbNADFW )
{
string tmpfilename = mblno + DateTime . Now . ToString ( "yyyyMMddHHmmssfff" ) + ".XML" ;
string filename = path + "\\" + tmpfilename ;
if ( System . IO . File . Exists ( filename ) )
{
System . IO . File . Delete ( filename ) ;
}
FileStream f = new FileStream ( filename , FileMode . Create ) ;
StreamWriter r = new StreamWriter ( f ) ;
var OpBill = new MsOpSeaeBill ( ) ;
r . WriteLine ( "<?xml version=\"1.0\" encoding=\"GB2312\"?>" ) ;
r . WriteLine ( "<edi>" ) ;
r . WriteLine ( "<head>" ) ;
r . WriteLine ( "<sndcom>" + ftpset . SENDCOMPANYCODE + "</sndcom>" ) ;
r . WriteLine ( "<sender>" + ftpset . SENDCODE + "</sender>" ) ;
r . WriteLine ( "<fromop>" + ftpset . SENDATTN + "</fromop>" ) ;
r . WriteLine ( "<fromtele>" + ftpset . SENDTEL + "</fromtele>" ) ;
r . WriteLine ( "<fromfax></fromfax>" ) ;
r . WriteLine ( "<frommail>" + ftpset . SENDEMAIL + "</frommail>" ) ;
r . WriteLine ( "<fromopc></fromopc>" ) ;
r . WriteLine ( "<fromope></fromope>" ) ;
r . WriteLine ( "<accom>" + ftpset . RECEIVECODE + "</accom>" ) ;
r . WriteLine ( "<accepter></accepter>" ) ;
r . WriteLine ( "<toop></toop>" ) ;
r . WriteLine ( "<sendtime>" + DateTime . Now . ToString ( "yyyy-MM-dd hh:mm:ss" ) + "</sendtime>" ) ;
if ( filetype = = "E" )
{
r . WriteLine ( "<editype>IFTMIN</editype>" ) ;
}
else
{
r . WriteLine ( "<editype>IFTMBF</editype>" ) ;
}
r . WriteLine ( "<EdiID>" + Guid . NewGuid ( ) . ToString ( ) + "</EdiID>" ) ;
r . WriteLine ( "<EdiName>" + tmpfilename + "</EdiName>" ) ;
r . WriteLine ( "<EdiMode>HYXML</EdiMode>" ) ;
r . WriteLine ( "<EdiReceiver>" + ftpset . RECEIVECODE + "</EdiReceiver>" ) ;
r . WriteLine ( "<EdiSender>" + ftpset . SENDCODE + "</EdiSender>" ) ;
r . WriteLine ( "</head>" ) ;
r . WriteLine ( "<Forward>" ) ;
r . WriteLine ( "EdiForwardFMT/>" ) ;
r . WriteLine ( "EdiForwardType/>" ) ;
r . WriteLine ( "EdiForwardURL/>" ) ;
r . WriteLine ( "EdiForwardId/>" ) ;
r . WriteLine ( "EdiForwardPass/>" ) ;
r . WriteLine ( "EdiForwardREFE1/>" ) ;
r . WriteLine ( "EdiForwardREFE2/>" ) ;
r . WriteLine ( "EdiForwardREFE3/>" ) ;
r . WriteLine ( "EdiForwardREFE4/>" ) ;
r . WriteLine ( "<EdiForwardREFE5>" + filerole + "</EdiForwardREFE5>" ) ;
r . WriteLine ( "</Forward>" ) ;
foreach ( var bill in headData )
{
if ( isbill = = 1 )
OpBill = MsOpSeaeDAL . MsOpSeaeDAL . GetBillData ( "BSNO='" + bill . BSNO + "'" ) ;
var billams = GetAmsData ( "BSNO='" + bill . BSNO + "'" ) ;
r . WriteLine ( "<reference>" ) ;
r . WriteLine ( "<enfreight>Original</enfreight>" ) ;
r . WriteLine ( "<refid></refid>" ) ;
r . WriteLine ( "<freid></freid>" ) ;
r . WriteLine ( "<referenceno>" + bill . CUSTNO + "</referenceno>" ) ;
r . WriteLine ( "<bookingno>" + bill . CUSTNO + "</bookingno>" ) ;
r . WriteLine ( "<workno>" + bill . CUSTNO + "</workno>" ) ;
r . WriteLine ( "<sale>" + ftpset . RECEIVESALE + "</sale>" ) ;
r . WriteLine ( "<billofladingno>" + bill . MBLNO + "</billofladingno>" ) ;
r . WriteLine ( "</reference>" ) ;
r . WriteLine ( "<detail>" ) ;
r . WriteLine ( "<baseinfo>" ) ;
r . WriteLine ( "<orderman>" + ftpset . SENDNAME + "</orderman>" ) ;
r . WriteLine ( "<source></source>" ) ;
r . WriteLine ( "<usdaccountshipper></usdaccountshipper>" ) ;
r . WriteLine ( "<customshipper></customshipper>" ) ;
r . WriteLine ( "<rmbaccountshipper></rmbaccountshipper>" ) ;
if ( bill . BLFRT . IndexOf ( "PREPAID" ) > = 0 )
r . WriteLine ( "<paymenttermcode>P</paymenttermcode>" ) ;
else if ( bill . BLFRT . IndexOf ( "COLLECT" ) > = 0 )
r . WriteLine ( "<paymenttermcode>C</paymenttermcode>" ) ;
else
r . WriteLine ( "<paymenttermcode>E</paymenttermcode>" ) ;
r . WriteLine ( "<paymentterm>" + bill . BLFRT + "</paymentterm>" ) ;
r . WriteLine ( "<payableat></payableat>" ) ;
r . WriteLine ( "<shippingitem>" + bill . SERVICE + "</shippingitem>" ) ;
r . WriteLine ( "<billofladingtype>" + GetISSUETYPEEDICode ( bill . ISSUETYPE , "CSSA" ) + "</billofladingtype>" ) ;
r . WriteLine ( "<shipper>" ) ;
var Shipping = "" ;
if ( isbill ! = 1 )
{
Shipping = formatEdiStr ( "txt" , bill . SHIPPER ) ;
}
else Shipping = formatEdiStr ( "txt" , OpBill . SHIPPER ) ;
List < System . String > ShippingList = formatlengthStr ( Shipping , 35 ) ;
if ( ShippingList . Count ! = 0 & & Shipping . Length > 0 )
{
for ( var i = 0 ; i < ShippingList . Count ; i + + )
{
r . WriteLine ( "<text>" + ShippingList [ i ] + "</text>" ) ;
}
}
r . WriteLine ( "</shipper>" ) ;
r . WriteLine ( "<consignee>" ) ;
Shipping = "" ;
if ( isbill ! = 1 )
{
Shipping = formatEdiStr ( "txt" , bill . CONSIGNEE ) ;
}
else Shipping = formatEdiStr ( "txt" , OpBill . CONSIGNEE ) ;
ShippingList = formatlengthStr ( Shipping , 35 ) ;
if ( ShippingList . Count ! = 0 & & Shipping . Length > 0 )
{
for ( var i = 0 ; i < ShippingList . Count ; i + + )
{
r . WriteLine ( "<text>" + ShippingList [ i ] + "</text>" ) ;
}
}
r . WriteLine ( "</consignee>" ) ;
r . WriteLine ( "<notifyparty>" ) ;
Shipping = "" ;
if ( isbill ! = 1 )
{
Shipping = formatEdiStr ( "txt" , bill . NOTIFYPARTY ) ;
}
else Shipping = formatEdiStr ( "txt" , OpBill . NOTIFYPARTY ) ;
ShippingList = formatlengthStr ( Shipping , 35 ) ;
if ( ShippingList . Count ! = 0 & & Shipping . Length > 0 )
{
for ( var i = 0 ; i < ShippingList . Count ; i + + )
{
r . WriteLine ( "<text>" + ShippingList [ i ] + "</text>" ) ;
}
}
r . WriteLine ( "</notifyparty>" ) ;
r . WriteLine ( "<ordermemo>" + billams . ORDERREMARK + "</ordermemo>" ) ;
r . WriteLine ( "<numberoforiginals>" + GetBillNum ( bill . NOBILL ) + "</numberoforiginals>" ) ;
r . WriteLine ( "<numberofcopys>" + GetBillNum ( bill . COPYNOBILL ) + "</numberofcopys>" ) ;
r . WriteLine ( "<placeofissuecode>" + GetPortEDICode ( bill . ISSUEPLACEID , "CSSA" ) + "</placeofissuecode>" ) ;
r . WriteLine ( "<placeofissue>" + bill . ISSUEPLACE + "</placeofissue>" ) ;
r . WriteLine ( "<timeofissue></timeofissue>" ) ;
r . WriteLine ( "</baseinfo>" ) ;
r . WriteLine ( "<cargo>" ) ;
r . WriteLine ( "<APPLICANT/" ) ;
r . WriteLine ( "<BOKKINGPARTY/>" ) ;
r . WriteLine ( "<FOBPARTY/>" ) ;
r . WriteLine ( "<SCNO>" + bill . SERVICECONTRACTNO + "</SCNO>" ) ;
r . WriteLine ( "<QUARANTINECODING/>" ) ;
r . WriteLine ( "<SCACCODE>" + billams . SCACCODE + "</SCACCODE>" ) ;
r . WriteLine ( "<QUOTATIONNO>" + bill . CONTRACTNO + "</QUOTATIONNO>" ) ;
r . WriteLine ( "<CHARGETYPE/>" ) ;
r . WriteLine ( "<realshipper>" ) ;
r . WriteLine ( "<text/>" ) ;
r . WriteLine ( "</realshipper>" ) ;
r . WriteLine ( "<realconsignee>" ) ;
r . WriteLine ( "<text/>" ) ;
r . WriteLine ( "</realconsignee>" ) ;
r . WriteLine ( "<realnotifyparty>" ) ;
r . WriteLine ( "<text/>" ) ;
r . WriteLine ( "</realnotifyparty>" ) ;
r . WriteLine ( "<realnotifyparty2>" ) ;
r . WriteLine ( "<text/>" ) ;
r . WriteLine ( "</realnotifyparty2>" ) ;
r . WriteLine ( "</cargo>" ) ;
r . WriteLine ( "<booking>" ) ;
r . WriteLine ( "<shipmentdate/" ) ;
r . WriteLine ( "<expirydate/>" ) ;
r . WriteLine ( "<tranship/>" ) ;
r . WriteLine ( "<batch/>" ) ;
r . WriteLine ( "<quotationno/>" ) ;
r . WriteLine ( "</booking>" ) ;
r . WriteLine ( "<freight>" ) ;
r . WriteLine ( "<fl>F</fl>" ) ;
r . WriteLine ( "<masterlclno>" + bill . MBLNO + "</masterlclno>" ) ;
r . WriteLine ( "<requestdate>" + bill . ETD + "</requestdate>" ) ;
r . WriteLine ( "<lastdate></lastdate>" ) ;
r . WriteLine ( "<arrivedate></arrivedate>" ) ;
r . WriteLine ( "<port>" ) ;
r . WriteLine ( "<placeofreceipt>" + bill . PLACERECEIPT + "</placeofreceipt>" ) ;
r . WriteLine ( "<portofloading>" + bill . PORTLOAD + "</portofloading>" ) ;
r . WriteLine ( "<portoftranship>" + bill . TRANSPORT + "</portoftranship>" ) ;
r . WriteLine ( "<portofdischarge>" + bill . PORTDISCHARGE + "</portofdischarge>" ) ;
r . WriteLine ( "<placeofdelivery>" + bill . PLACEDELIVERY + "</placeofdelivery>" ) ;
r . WriteLine ( "<finaldestination>" + bill . DESTINATION + "</finaldestination>" ) ;
r . WriteLine ( "<co_placeofreceipt>" + GetPortEDICode ( bill . PLACERECEIPTID , "CSSA" ) + "</co_placeofreceipt>" ) ;
r . WriteLine ( "<co_portofloading>" + GetPortEDICode ( bill . PORTLOADID , "CSSA" ) + "</co_portofloading>" ) ;
r . WriteLine ( "<co_portoftranship>" + GetPortEDICodeByEname ( bill . TRANSPORT , "CSSA" ) + "</co_portoftranship>" ) ;
r . WriteLine ( "<co_portofdischarge>" + GetPortEDICode ( bill . PORTDISCHARGEID , "CSSA" ) + "</co_portofdischarge>" ) ;
r . WriteLine ( "<co_placeofdelivery>" + GetPortEDICode ( bill . PLACEDELIVERYID , "CSSA" ) + "</co_placeofdelivery>" ) ;
r . WriteLine ( "<co_finaldestination>" + GetPortEDICode ( bill . DESTINATIONID , "CSSA" ) + "</co_finaldestination>" ) ;
r . WriteLine ( "</port>" ) ;
r . WriteLine ( "<vessel>" ) ;
r . WriteLine ( "<carrier>" + GetCustEDICode ( bill . CARRIER , "CSSA" ) + "</carrier>" ) ;
r . WriteLine ( "<oceanvessel>" + bill . VESSEL + "</oceanvessel>" ) ;
r . WriteLine ( "<voyno>" + bill . VOYNO + "</voyno>" ) ;
r . WriteLine ( "<etd>" + bill . ETD + "</etd>" ) ;
r . WriteLine ( "<deliverymode>SEA</deliverymode>" ) ;
r . WriteLine ( "</vessel>" ) ;
r . WriteLine ( "<info2nd>" ) ;
r . WriteLine ( "<carrier/" ) ;
r . WriteLine ( "<oceanvessel/>" ) ;
r . WriteLine ( "<voyno/>" ) ;
r . WriteLine ( "<etd/>" ) ;
r . WriteLine ( "<eta/>" ) ;
r . WriteLine ( "<remarks>" ) ;
r . WriteLine ( "<text/>" ) ;
r . WriteLine ( "</remarks>" ) ;
r . WriteLine ( "</info2nd>" ) ;
r . WriteLine ( "<container>" ) ;
if ( filetype = = "E" )
{
var ctndetaillist = MsOpSeaeDAL . MsOpSeaeDAL . GetBodyList ( "BSNO='" + bill . BSNO + "'" ) ;
foreach ( var ctn in ctndetaillist )
{
r . WriteLine ( "<containers>" ) ;
r . WriteLine ( "<containertype>" + GetCtnEDICode ( ctn . CTNALL , "CSSA" ) + "</containertype>" ) ;
r . WriteLine ( "<containerno>" + ctn . CNTRNO + "</containerno>" ) ;
r . WriteLine ( "<sealno>" + ctn . SEALNO + "</sealno>" ) ;
r . WriteLine ( "<containernoofpkgs>" + ctn . PKGS + "</containernoofpkgs>" ) ;
r . WriteLine ( "<containergrossweight>" + ctn . KGS + "</containergrossweight>" ) ;
r . WriteLine ( "<containercbm>" + ctn . CBM + "</containercbm>" ) ;
r . WriteLine ( "<containerpackagingcode>" + GetPackageEDICode ( ctn . KINDPKGS , "CSSA" ) + "</containerpackagingcode>" ) ;
r . WriteLine ( "<containerpackaging>" + ctn . KINDPKGS + "</containerpackaging>" ) ;
r . WriteLine ( "<containerdescription><text/></containerdescription>" ) ;
r . WriteLine ( "<containermarksandnumbers/>" ) ;
r . WriteLine ( "<vgmgrossmassweight></vgmgrossmassweight>" ) ;
r . WriteLine ( "<vgmweighingmethod></vgmweighingmethod>" ) ;
r . WriteLine ( "<vgmweighingtime></vgmweighingtime>" ) ;
r . WriteLine ( "<vgmresponsibleparty></vgmresponsibleparty>" ) ;
r . WriteLine ( "<vgmauthorizedperson></vgmauthorizedperson>" ) ;
r . WriteLine ( "<vgmauthorizedpersontele/>" ) ;
r . WriteLine ( "<vgmauthorizedpersonmail></vgmauthorizedpersonmail>" ) ;
r . WriteLine ( "<vgmremark/>" ) ;
r . WriteLine ( "</containers>" ) ;
}
}
else
{
var ctnlist = GetCtnSum ( "BSNO='" + bill . BSNO + "'" ) ;
foreach ( var ctn in ctnlist )
{
r . WriteLine ( "<containers>" ) ;
r . WriteLine ( "<containertype>" + GetCtnEDICode ( ctn . CTNALL , "CSSA" ) + "</containertype>" ) ;
r . WriteLine ( "<noofcontainer>" + ctn . CTNNUM + "</noofcontainer>" ) ;
r . WriteLine ( "</containers>" ) ;
}
}
r . WriteLine ( "</container>" ) ;
r . WriteLine ( "</freight>" ) ;
r . WriteLine ( "<goods>" ) ;
r . WriteLine ( "<marksandnumbers>" ) ;
Shipping = "" ;
if ( isbill ! = 1 )
{
Shipping = formatEdiStr ( "txt" , bill . MARKS ) ;
}
else Shipping = formatEdiStr ( "txt" , OpBill . MARKS ) ;
ShippingList = formatlengthStr ( Shipping , 35 ) ;
if ( ShippingList . Count ! = 0 & & Shipping . Length > 0 )
{
for ( var i = 0 ; i < ShippingList . Count ; i + + )
{
r . WriteLine ( "<text>" + ShippingList [ i ] + "</text>" ) ;
}
}
r . WriteLine ( "</marksandnumbers>" ) ;
r . WriteLine ( "<noofpkgs>" + bill . PKGS + "</noofpkgs>" ) ;
r . WriteLine ( "<packagingcode>" + GetPackageEDICode ( bill . KINDPKGS , "CSSA" ) + "</packagingcode>" ) ;
r . WriteLine ( "<packaging>" + bill . KINDPKGS + "</packaging>" ) ;
if ( bill . CARGOID = = "R" )
r . WriteLine ( "<cargoid>RF</cargoid>" ) ;
else if ( bill . CARGOID = = "D" )
r . WriteLine ( "<cargoid>DR</cargoid>" ) ;
else r . WriteLine ( "<cargoid>CG</cargoid>" ) ;
r . WriteLine ( "<hscode>" + bill . HSCODE + "</hscode>" ) ;
r . WriteLine ( "<description>" ) ;
Shipping = "" ;
if ( isbill ! = 1 )
{
Shipping = formatEdiStr ( "txt" , bill . DESCRIPTION ) ;
}
else Shipping = formatEdiStr ( "txt" , OpBill . DESCRIPTION ) ;
ShippingList = formatlengthStr ( Shipping , 35 ) ;
if ( ShippingList . Count ! = 0 & & Shipping . Length > 0 )
{
for ( var i = 0 ; i < ShippingList . Count ; i + + )
{
r . WriteLine ( "<text>" + ShippingList [ i ] + "</text>" ) ;
}
}
r . WriteLine ( "</description>" ) ;
r . WriteLine ( "<cdescription>" ) ;
r . WriteLine ( "<text/>" ) ;
r . WriteLine ( "</cdescription>" ) ;
r . WriteLine ( "<grossweight>" + bill . KGS + "</grossweight>" ) ;
r . WriteLine ( "<cbm>" + bill . CBM + "</cbm>" ) ;
r . WriteLine ( "<specialgoods>" ) ;
r . WriteLine ( "<text/>" ) ;
r . WriteLine ( "</specialgoods>" ) ;
r . WriteLine ( "</goods>" ) ;
r . WriteLine ( "<dr>" ) ;
r . WriteLine ( "<CLASS>" + bill . DCLASS + "</CLASS>" ) ;
r . WriteLine ( "<PAGE>" + bill . DPAGE + "</PAGE>" ) ;
r . WriteLine ( "<UNDGNO>" + bill . DUNNO + "</UNDGNO>" ) ;
r . WriteLine ( "<TECNAME></TECNAME>" ) ;
r . WriteLine ( "<PACKGROUP></PACKGROUP>" ) ;
r . WriteLine ( "<LABEL>" ) ;
r . WriteLine ( "<text>" + bill . DLABEL + "</text>" ) ;
r . WriteLine ( "</LABEL>" ) ;
r . WriteLine ( "<FLASHPOINT></FLASHPOINT>" ) ;
r . WriteLine ( "<FLASHUNIT></FLASHUNIT>" ) ;
r . WriteLine ( "<EMSNO></EMSNO>" ) ;
r . WriteLine ( "<MFAGNO></MFAGNO>" ) ;
r . WriteLine ( "<MPT></MPT>" ) ;
r . WriteLine ( "<Elinkman>" + bill . LINKMAN + " </Elinkman>" ) ;
r . WriteLine ( "<DANGEROUS>" ) ;
r . WriteLine ( "<text/>" ) ;
r . WriteLine ( "</DANGEROUS>" ) ;
r . WriteLine ( "<TEMPERATURE>" + bill . TEMPSET + "</TEMPERATURE>" ) ;
r . WriteLine ( "<TEMPERATUREUNIT>C</TEMPERATUREUNIT>" ) ;
r . WriteLine ( "<MINTEMPERATURE>" + bill . TEMPMIN + "</MINTEMPERATURE>" ) ;
r . WriteLine ( "<MAXTEMPERATURE>" + bill . TEMPMAX + "</MAXTEMPERATURE>" ) ;
r . WriteLine ( "<ALLCOLDTORAGE></ALLCOLDTORAGE>" ) ;
r . WriteLine ( "<VENTI>" + bill . REEFERF + "</VENTI>" ) ;
r . WriteLine ( "<REEFER>" ) ;
r . WriteLine ( "<text/>" ) ;
r . WriteLine ( "</REEFER>" ) ;
r . WriteLine ( "</dr>" ) ;
r . WriteLine ( "<loadplan>" ) ;
r . WriteLine ( "<entryno/" ) ;
r . WriteLine ( "<warehouse/>" ) ;
r . WriteLine ( "<landcarrier/>" ) ;
r . WriteLine ( "<stuffdate/>" ) ;
r . WriteLine ( "<stuffmode/>" ) ;
r . WriteLine ( "<stuffaddress/>" ) ;
r . WriteLine ( "<stuffmemo/>" ) ;
r . WriteLine ( "</loadplan>" ) ;
r . WriteLine ( "<announce>" ) ;
r . WriteLine ( "<text/>" ) ;
r . WriteLine ( "</announce>" ) ;
r . WriteLine ( "<remarks>" ) ;
r . WriteLine ( "<text/>" ) ;
r . WriteLine ( "</remarks>" ) ;
if ( filetype = = "E" )
{
T_ALL_DA T_ALL_DA = new EntityDA . T_ALL_DA ( ) ;
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 ( ) + "')" ;
int inum = int . Parse ( T_ALL_DA . GetStrSQL ( "inum" , slSQL ) ) ;
if ( inum < 1 )
{
}
else
{
r . WriteLine ( "<goodsdetail>" ) ;
#region 取集装箱分箱_货描、唛头信息
var markstr = "" ;
int line = 1 ;
string lsSQL = "SELECT d.HSCODE,d.KINDPKGS,d.DESCRIPTION,d.MARKS,c.CTNALL,c.CNTRNO,c.SEALNO,d.PKGS,d.KGS,d.CBM from op_ctn_detail d left join op_ctn as c on (c.CTN_ID=d.CTN_ID) where c.bsno='" + bill . BSNO . ToString ( ) + "' order by c.CTNCODE,c.CTNALL,d.[ID]" ;
DataSet dsHSCODE = T_ALL_DA . GetAllSQL ( lsSQL ) ;
if ( dsHSCODE ! = null )
{
if ( dsHSCODE . Tables [ 0 ] . Rows . Count > 0 )
{
for ( int i = 0 ; i < dsHSCODE . Tables [ 0 ] . Rows . Count ; i + + )
{
r . WriteLine ( "<cargosequenceno>" + line + "</cargosequenceno>" ) ;
r . WriteLine ( "<marksandnumbers>" ) ;
Shipping = "" ;
Shipping = formatEdiStr ( "txt" , dsHSCODE . Tables [ 0 ] . Rows [ i ] [ "MARKS" ] . ToString ( ) ) ;
//}
if ( dsHSCODE . Tables [ 0 ] . Rows [ i ] [ "MARKS" ] . ToString ( ) . Trim ( ) = = "" ) Shipping = formatEdiStr ( "txt" , bill . MARKS ) ;
ShippingList = formatlengthStr ( Shipping , 35 ) ;
if ( ShippingList . Count ! = 0 & & Shipping . Length > 0 )
{
for ( var j = 0 ; j < ShippingList . Count ; j + + )
{
r . WriteLine ( "<text>" + ShippingList [ j ] + "</text>" ) ;
}
}
r . WriteLine ( "</marksandnumbers>" ) ;
r . WriteLine ( "<noofpkgs>" + dsHSCODE . Tables [ 0 ] . Rows [ i ] [ "PKGS" ] . ToString ( ) + "</noofpkgs>" ) ;
r . WriteLine ( "<packagingcode>" + GetPackageEDICode ( dsHSCODE . Tables [ 0 ] . Rows [ i ] [ "KINDPKGS" ] . ToString ( ) , "CSSA" ) + "</packagingcode>" ) ;
r . WriteLine ( "<packaging>" + dsHSCODE . Tables [ 0 ] . Rows [ i ] [ "KINDPKGS" ] . ToString ( ) + "</packaging>" ) ;
if ( bill . CARGOID = = "R" )
r . WriteLine ( "<cargoid>RF</cargoid>" ) ;
else if ( bill . CARGOID = = "D" )
r . WriteLine ( "<cargoid>DR</cargoid>" ) ;
else r . WriteLine ( "<cargoid>CG</cargoid>" ) ;
r . WriteLine ( "<hscode>" + dsHSCODE . Tables [ 0 ] . Rows [ i ] [ "HSCODE" ] . ToString ( ) + "</hscode>" ) ;
r . WriteLine ( "<description>" ) ;
Shipping = "" ;
Shipping = formatEdiStr ( "txt" , dsHSCODE . Tables [ 0 ] . Rows [ i ] [ "DESCRIPTION" ] . ToString ( ) ) ;
ShippingList = formatlengthStr ( Shipping , 35 ) ;
if ( ShippingList . Count ! = 0 & & Shipping . Length > 0 )
{
for ( var j = 0 ; j < ShippingList . Count ; j + + )
{
r . WriteLine ( "<text>" + ShippingList [ j ] + "</text>" ) ;
}
}
r . WriteLine ( "</description>" ) ;
r . WriteLine ( "<cdescription>" ) ;
r . WriteLine ( "<text/>" ) ;
r . WriteLine ( "</cdescription>" ) ;
r . WriteLine ( "<grossweight>" + dsHSCODE . Tables [ 0 ] . Rows [ i ] [ "KGS" ] . ToString ( ) + "</grossweight>" ) ;
r . WriteLine ( "<cbm>" + dsHSCODE . Tables [ 0 ] . Rows [ i ] [ "CBM" ] . ToString ( ) + "</cbm>" ) ;
r . WriteLine ( "<specialgoods>" ) ;
r . WriteLine ( "<text/>" ) ;
r . WriteLine ( "</specialgoods>" ) ;
r . WriteLine ( "<dr>" ) ;
r . WriteLine ( "<CLASS>" + bill . DCLASS + "</CLASS>" ) ;
r . WriteLine ( "<PAGE>" + bill . DPAGE + "</PAGE>" ) ;
r . WriteLine ( "<UNDGNO>" + bill . DUNNO + "</UNDGNO>" ) ;
r . WriteLine ( "<TECNAME></TECNAME>" ) ;
r . WriteLine ( "<PACKGROUP></PACKGROUP>" ) ;
r . WriteLine ( "<LABEL>" ) ;
r . WriteLine ( "<text>" + bill . DLABEL + "</text>" ) ;
r . WriteLine ( "</LABEL>" ) ;
r . WriteLine ( "<FLASHPOINT></FLASHPOINT>" ) ;
r . WriteLine ( "<FLASHUNIT></FLASHUNIT>" ) ;
r . WriteLine ( "<EMSNO></EMSNO>" ) ;
r . WriteLine ( "<MFAGNO></MFAGNO>" ) ;
r . WriteLine ( "<MPT></MPT>" ) ;
r . WriteLine ( "<Elinkman>" + bill . LINKMAN + " </Elinkman>" ) ;
r . WriteLine ( "<DANGEROUS>" ) ;
r . WriteLine ( "<text/>" ) ;
r . WriteLine ( "</DANGEROUS>" ) ;
r . WriteLine ( "<TEMPERATURE>" + bill . TEMPSET + "</TEMPERATURE>" ) ;
r . WriteLine ( "<TEMPERATUREUNIT>C</TEMPERATUREUNIT>" ) ;
r . WriteLine ( "<MINTEMPERATURE>" + bill . TEMPMIN + "</MINTEMPERATURE>" ) ;
r . WriteLine ( "<MAXTEMPERATURE>" + bill . TEMPMAX + "</MAXTEMPERATURE>" ) ;
r . WriteLine ( "<ALLCOLDTORAGE></ALLCOLDTORAGE>" ) ;
r . WriteLine ( "<VENTI>" + bill . REEFERF + "</VENTI>" ) ;
r . WriteLine ( "<REEFER>" ) ;
r . WriteLine ( "<text/>" ) ;
r . WriteLine ( "</REEFER>" ) ;
r . WriteLine ( "</dr>" ) ;
r . WriteLine ( "<containers>" ) ;
r . WriteLine ( "<containertype>" + GetCtnEDICode ( dsHSCODE . Tables [ 0 ] . Rows [ i ] [ "CTNALL" ] . ToString ( ) , "CSSA" ) + "</containertype>" ) ;
r . WriteLine ( "<containerno>" + dsHSCODE . Tables [ 0 ] . Rows [ i ] [ "CNTRNO" ] . ToString ( ) + "</containerno>" ) ;
r . WriteLine ( "<sealno>" + dsHSCODE . Tables [ 0 ] . Rows [ i ] [ "SEALNO" ] . ToString ( ) + "</sealno>" ) ;
r . WriteLine ( "<containernoofpkgs>" + dsHSCODE . Tables [ 0 ] . Rows [ i ] [ "PKGS" ] . ToString ( ) + "</containernoofpkgs>" ) ;
r . WriteLine ( "<containergrossweight>" + Math . Round ( Decimal . Parse ( dsHSCODE . Tables [ 0 ] . Rows [ i ] [ "KGS" ] . ToString ( ) ) , 3 ) + "</containergrossweight>" ) ;
r . WriteLine ( "<containercbm>" + Math . Round ( Decimal . Parse ( dsHSCODE . Tables [ 0 ] . Rows [ i ] [ "CBM" ] . ToString ( ) ) , 3 ) + "</containercbm>" ) ;
r . WriteLine ( "<containernetweight></containernetweight>" ) ;
r . WriteLine ( "</containers>" ) ;
}
}
}
# endregion
r . WriteLine ( "</goodsdetail>" ) ;
}
}
r . WriteLine ( "</detail>" ) ;
}
r . Write ( "</edi>" ) ;
r . Close ( ) ;
f . Close ( ) ;
return filename ;
}
# endregion
# endregion
#region VGM导出