@ -224,6 +224,10 @@ namespace DS.WMS.Core.Op.EDI
#region 格式化每行
public static List < System . String > formatlengthStr ( string str , int length , bool formatstr = false , bool nodelsp = false )
{
//2022-12-28 JHQ 传的字段是null会导致报错, 这里改为如果是NULL则默认赋空字符串。
if ( str = = null )
str = "" ;
str = str . Replace ( "\r\n" , "\\" ) ;
str = str . Replace ( "\n" , "\\" ) ;
str = str . Replace ( "\r" , " " ) ;
@ -303,17 +307,17 @@ namespace DS.WMS.Core.Op.EDI
if ( string . IsNullOrEmpty ( InttrEdi . RECEIVECODE ) )
{ error = error + "<br />接收方代码不能为空" ; }
if ( InttrEdi . filetype = = "B" )
{
if ( InttrEdi . UseForWarderCode )
{
if ( string . IsNullOrEmpty ( InttrEdi . ForWarderCode ) )
{ error = error + "<br />货代代码不能为空" ; }
//if (InttrEdi.filetype == "B" )
// {
// if (InttrEdi.UseForWarderCode)
// {
// if (string.IsNullOrEmpty(InttrEdi.ForWarderCode))
// { error = error + "<br />货代代码不能为空"; }
if ( string . IsNullOrEmpty ( InttrEdi . ForWarderName ) )
{ error = error + "<br />货代称呼不能为空" ; }
}
}
// if (string.IsNullOrEmpty(InttrEdi.ForWarderName))
// { error = error + "<br />货代称呼不能为空"; }
// }
// }
foreach ( var headData in InttrEdi . BSLIST )
@ -325,9 +329,7 @@ namespace DS.WMS.Core.Op.EDI
if ( string . IsNullOrEmpty ( headData . BLFRT ) )
{ error = error + "<br />提单号:" + headData . MBLNO + " 付费方式不能为空" ; }
//2023-01-04 JHQ 跟韩训涛确认, ESL这里不处理航线代码, 去掉不为空校验, 并在生成EDI报文时, 对ESL航线代码赋空串
//if (string.IsNullOrEmpty(headData.ESLLINECODE))
//{ error = error + "<br />提单号:" + headData.MBLNO + " ESL航线代码不能为空"; }
if ( InttrEdi . filetype = = "E" )
{
@ -337,13 +339,27 @@ namespace DS.WMS.Core.Op.EDI
if ( string . IsNullOrEmpty ( headData . VOYNO ) )
{ error = error + "<br />提单号:" + headData . MBLNO + " 航次不能为空" ; }
if ( string . IsNullOrEmpty ( headData . ETD ) )
if ( InttrEdi . filetype ! = "B" | | headData . CARRIEREDICODE = = "YML" )
{
error = error + "<br />提单号:" + headData . MBLNO + " 开船日期不能为空" ;
return error ;
if ( string . IsNullOrEmpty ( headData . ETD ) )
{
error = error + "<br />提单号:" + headData . MBLNO + " 开船日期不能为空" ;
return error ;
}
}
}
if ( headData . CARRIEREDICODE ! = "ZIM" )
{
if ( string . IsNullOrEmpty ( headData . PLACERECEIPTID ) | | headData . PLACERECEIPTID . Length ! = 5 )
{ error = error + "<br />提单号:" + headData . MBLNO + " 收货地代码不能为空或录入不正确(必须是5位代码)" ; }
if ( string . IsNullOrEmpty ( headData . PLACERECEIPT ) )
{ error = error + "<br />提单号:" + headData . MBLNO + " 收货地不能为空" ; }
}
if ( string . IsNullOrEmpty ( headData . PORTLOADID ) | | headData . PORTLOADID . Length ! = 5 )
{ error = error + "<br />提单号:" + headData . MBLNO + " 装货港代码不能为空或录入不正确(必须是5位代码)" ; }
@ -367,12 +383,6 @@ namespace DS.WMS.Core.Op.EDI
{ error = error + "<br />提单号:" + headData . MBLNO + " 目的地代码不能为空或录入不正确(必须是5位代码)" ; }
}
if ( string . IsNullOrEmpty ( headData . ESLLINECODE ) )
{ error = error + "<br />提单号:" + headData . MBLNO + " 航司航线不能为空" ; }
if ( string . IsNullOrWhiteSpace ( headData . CONTRACTNO ) )
{ error = error + "<br />提单号:" + headData . MBLNO + " 运费协议号不能为空" ; }
if ( string . IsNullOrEmpty ( headData . KINDPKGS_EDI_CODE ) )
{ error = error + "<br />提单号:" + headData . MBLNO + " 包装EDI代码不能为空" ; }
if ( headData . PKGS = = 0 )
@ -400,6 +410,14 @@ namespace DS.WMS.Core.Op.EDI
if ( headData . REEFERF = = null | | headData . REEFERF = = "" )
{ error = error + "<br />提单号:" + headData . MBLNO + " 通风度不能为空" ; }
}
if ( headData . ISSUEPLACE = = null | | headData . ISSUEPLACE = = "" )
{ error = error + "<br />提单号:" + headData . MBLNO + "签单地点不能为空" ; }
if ( headData . CARRIEREDICODE = = "APL" )
if ( headData . ISSUETYPE = = null | | headData . ISSUETYPE = = "" )
{ error = error + "<br />提单号:" + headData . MBLNO + "签单方式不能为空" ; }
if ( headData . SERVICE = = "" | | headData . SERVICE = = null )
{ error = error + "<br />提单号:" + headData . MBLNO + "运输条款不能为空" ; }
if ( string . IsNullOrEmpty ( headData . MARKS ) )
{
@ -417,6 +435,11 @@ namespace DS.WMS.Core.Op.EDI
}
}
if ( ! new string [ ] { "ORI" , "TER" , "EXP" } . Contains ( headData . ISSUETYPE ) )
{
error = error + "<br />提单号:" + headData . MBLNO + "签单方式未识别" ;
}
if ( string . IsNullOrEmpty ( headData . DESCRIPTION ) )
{
error = error + "<br />提单号:" + headData . MBLNO + " 货物描述不能为空" ;
@ -446,17 +469,14 @@ namespace DS.WMS.Core.Op.EDI
}
else
{
//2023-04-04 经和川操作确认不对收、发、通信息判断每行35个字符判断, 考虑判断方法判断了行数, 这里暂时改外调大单行的最大字符数35改为70
if ( headData . CARRIEREDICODE = = "HLCU" )
{
error + = formatlengthError ( "txt" , headData . SHIPPER , 70 , headData . MBLNO , "发货人" , 6 , "-" , false ) ;
error + = formatlengthError ( "txt" , headData . SHIPPER , 35 , headData . MBLNO , "发货人" , 6 , "-" , false ) ;
}
else
{
error + = formatlengthError ( "txt" , headData . SHIPPER , 70 , headData . MBLNO , "发货人" , 6 , "*" , false ) ;
error + = formatlengthError ( "txt" , headData . SHIPPER , 35 , headData . MBLNO , "发货人" , 6 , "*" , false ) ;
}
}
}
//}
@ -475,15 +495,13 @@ namespace DS.WMS.Core.Op.EDI
}
else
{
//2023-04-04 经和川操作确认不对收、发、通信息判断每行35个字符判断, 考虑判断方法判断了行数, 这里暂时改外调大单行的最大字符数35改为70
if ( headData . CARRIEREDICODE = = "HLCU" )
{
error + = formatlengthError ( "txt" , headData . CONSIGNEE , 70 , headData . MBLNO , "收货人" , 6 , "--" , false ) ;
error + = formatlengthError ( "txt" , headData . CONSIGNEE , 35 , headData . MBLNO , "收货人" , 6 , "--" , false ) ;
}
else
{
error + = formatlengthError ( "txt" , headData . CONSIGNEE , 70 , headData . MBLNO , "收货人" , 6 , "**" , false ) ;
error + = formatlengthError ( "txt" , headData . CONSIGNEE , 35 , headData . MBLNO , "收货人" , 6 , "**" , false ) ;
}
}
}
@ -503,15 +521,13 @@ namespace DS.WMS.Core.Op.EDI
}
else
{
//2023-04-04 经和川操作确认不对收、发、通信息判断每行35个字符判断, 考虑判断方法判断了行数, 这里暂时改外调大单行的最大字符数35改为70
if ( headData . CARRIEREDICODE = = "HLCU" )
{
error + = formatlengthError ( "txt" , headData . NOTIFYPARTY , 70 , headData . MBLNO , "通知人" , 6 , "---" , false ) ;
error + = formatlengthError ( "txt" , headData . NOTIFYPARTY , 35 , headData . MBLNO , "通知人" , 6 , "---" , false ) ;
}
else
{
error + = formatlengthError ( "txt" , headData . NOTIFYPARTY , 70 , headData . MBLNO , "通知人" , 6 , "***" , false ) ;
error + = formatlengthError ( "txt" , headData . NOTIFYPARTY , 35 , headData . MBLNO , "通知人" , 6 , "***" , false ) ;
}
}
}
@ -534,7 +550,7 @@ namespace DS.WMS.Core.Op.EDI
{
if ( string . IsNullOrEmpty ( ctn . CTNALLCODE ) )
{ error = error + "<br />提单号:" + headData . MBLNO + " 集装箱箱型EDI代码不能为空" ; }
if ( ctn . CTNALLCODE ! = null & & ( ctn . CTNALLCODE . IndexOf ( "RH" ) > 0 | | ctn . CTNALLCODE . IndexOf ( "RF" ) > 0 ) & & ( headData . CARGOID ! = "R" ) )
if ( ( ctn . CTNALLCODE . IndexOf ( "RH" ) > 0 | | ctn . CTNALLCODE . IndexOf ( "RF" ) > 0 ) & & ( headData . CARGOID ! = "R" ) )
{
{ error = error + "<br />提单号:" + headData . MBLNO + " 集装箱箱型为冻柜,货类代码请选择冻柜" ; }
}
@ -630,10 +646,10 @@ namespace DS.WMS.Core.Op.EDI
//跟韩工确认增加判断
if ( ! string . IsNullOrWhiteSpace ( headData . BLFRT ) & & headData . BLFRT . IndexOf ( "PREPAID" ) > = 0 )
{
if ( string . IsNullOrWhiteSpace ( headData . PREPARDAT ) )
{
error = error + "<br />提单号:" + headData . MBLNO + " 付费方式是预付,预付地点不能为空" ;
}
//if (string.IsNullOrWhiteSpace(headData.PREPARDAT) )
// {
// error = error + "<br />提单号:" + headData.MBLNO + " 付费方式是预付,预付地点不能为空";
// }
if ( ! string . IsNullOrWhiteSpace ( headData . PAYABLEAT ) )
{
@ -642,32 +658,26 @@ namespace DS.WMS.Core.Op.EDI
}
else if ( ! string . IsNullOrWhiteSpace ( headData . BLFRT ) & & headData . BLFRT . IndexOf ( "COLLECT" ) > = 0 )
{
if ( string . IsNullOrWhiteSpace ( headData . PAYABLEAT ) )
{
error = error + "<br />提单号:" + headData . MBLNO + " 付费方式是到付,到付地点不能为空" ;
}
//if (string.IsNullOrWhiteSpace(headData.PAYABLEAT) )
// {
// error = error + "<br />提单号:" + headData.MBLNO + " 付费方式是到付,到付地点不能为空";
// }
if ( ! string . IsNullOrWhiteSpace ( headData . PREPARDAT ) )
{
error = error + "<br />提单号:" + headData . MBLNO + " 付费方式是到付,预付地点不能填写" ;
}
}
}
return error ;
}
# endregion
#region 生成报文(订舱( InttrEdi. filetype=="B"),截单(InttrEdi. filetype=="E"))
#region 生成报文(订舱( filetype=="B"),截单(filetype=="E"))
public static EdiDataResult CreateEdiVOLTA ( EDIBaseModel InttrEdi )
{
/ *
注 意 的 几 个 问 题
1 、 SERVICECONTRACTNO ( 服 务 合 同 号 ) 查 了 原 来 大 简 云 的 记 录 , 前 端 没 有 录 入 的 编 辑 框 , 后 台 也 没 有 做 数 据 对 应 , 一 直 是 空 着 的 。 不 确 定 是 否 影 响 到 EDI 的 报 文 。
* /
EdiDataResult result = new EdiDataResult { Succeeded = false } ;
var result = new EdiDataResult { Succeeded = false } ;
var filetype = "IFTMIN" ;
if ( InttrEdi . filetype ! = "E" ) filetype = "IFTMBF" ;
@ -677,22 +687,17 @@ namespace DS.WMS.Core.Op.EDI
if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
filename = filename . Replace ( "\\" , "/" ) ;
//if (System.IO.File.Exists(filename))
//{
// System.IO.File.Delete(filename);
//}
FileStream f = new FileStream ( filename , FileMode . Create ) ;
StreamWriter r = new StreamWriter ( f , Encoding . Default ) ;
var icount = 0 ;
var bsno = "" ;
var isfirst = true ;
foreach ( var bill in InttrEdi . BSLIST )
{
//2023-01-04 JHQ 跟韩训涛确认, ESL这里不处理航线代码, 去掉不为空校验, 并在生成EDI报文时, 对ESL航线代码赋空串
if ( bill . ESLLINECODE = = null )
bill . ESLLINECODE = string . Empty ;
//2022-01-04
if ( InttrEdi . ForWarderName = = null )
InttrEdi . ForWarderName = string . Empty ;
if ( isfirst )
{
if ( InttrEdi . filetype = = "E" )
@ -704,14 +709,74 @@ namespace DS.WMS.Core.Op.EDI
}
//2023-03-03 修改运输条款SERVICE改为EDI的映射值, 经过韩工确认
if ( bill . CARRIEREDICODE = = "ONEY" )
{
var sendno = bill . EDIATTNEMAIL ;
if ( filetype = = "E" ) sendno = bill . AMSCODE ;
var MBLNO = bill . MBLNO ;
if ( MBLNO . Substring ( 0 , 4 ) = = "ONEY" )
{
MBLNO = MBLNO . Substring ( 4 , MBLNO . Length - 4 ) ;
}
//2023-02-28 ONE的逻辑是去掉了提单号的前4位, 跟韩工已确认, 与东胜7相同
//2023-03-03 韩工给提供了新的02行的处理SENDNAME改为读取FTP配置的
/ *
r . WriteLine ( "02"
+ ":" + MBLNO //2 REFERENCE NO. 运编号 X(35) 一般为流水号 M
+ ":" + MBLNO //3 B\L NO. 提单号 X(20) 船公司的提单号 C
+ ":" + bill . SERVICE //4 DELIVERY TERM 交货条款 X(9) CY-CY(pier-pier/port):30CY-CFS(pier/port-door):29CFS-CY(door-pier/port):28CFS-CFS(door-door):27 M
+ ":" + InttrEdi . SENDNAME //5 BOOKING PARTY 订舱人说明 X(70) 货代方企业名称或代码 C
+ ":ONEY" //6 ISSUE PARTY CODE 签单人代码 X(13) 即接受订舱的人的代码 M
+ ":" //7 ISSUE PARTY 签单人说明 X(35) C
+ ":" //8 APPLICANT 询价单位 X(13) 向船公司询价的单位代码 C
+ ":" //9 FOB BK PARTY 国外订舱单位 X(13) 国外FOB货订舱单位的代码 C
+ ":" //10 B/L TRANSHIP ID 转船标识 X(1) Y/N C
+ ":" //11 BATCH ID 分批 X(1) Y/N C
+ ":" //12 SHIPMENT DATE 装期 9(8) CCYYMMDD C
+ ":" //13 EXPIRY DATE 效期 9(8) CCYYMMDD C
+ ":" + bill . CONTRACTNO //14 QUOTATION NO. 运费协议号 X(30) MAERSK为必选 C
+ ":" //15 CHARGE TYPE 费率本代码 X(1) C
+ ":" + bill . CONTRACTNO //16 S/C NO. 合约号 X(30) C
+ ":" //17 BOOKING NO. 船公司订舱编号 X(20) 船公司系统内部订舱编号 C
+ ":" //18 SLOT CHARTER ID 舱位互用标识 X(1) C
+ ":" + sendno //19 AMS CODE AMS代码 X(15) C
//注: QUOTATION NO.项填本票订舱货的运价是通过向中集询价后定下的特殊运价编号。
+ "'" ) ;
* /
//2023-03-03 修改运输条款SERVICE改为EDI的映射值, 经过韩工确认
r . WriteLine ( "02"
+ ":" + MBLNO //2 REFERENCE NO. 运编号 X(35) 一般为流水号 M
+ ":" + MBLNO //3 B\L NO. 提单号 X(20) 船公司的提单号 C
+ ":" + bill . SERVICEEDICODE //4 DELIVERY TERM 交货条款 X(9) CY-CY(pier-pier/port):30CY-CFS(pier/port-door):29CFS-CY(door-pier/port):28CFS-CFS(door-door):27 M
+ ":" + formatEdiStr ( "txt" , InttrEdi . SENDCOMPANYCODE ) //5 BOOKING PARTY 订舱人说明 X(70) 货代方企业名称或代码 C
+ ":ONEY" //6 ISSUE PARTY CODE 签单人代码 X(13) 即接受订舱的人的代码 M
+ ":" //7 ISSUE PARTY 签单人说明 X(35) C
+ ":" //8 APPLICANT 询价单位 X(13) 向船公司询价的单位代码 C
+ ":" //9 FOB BK PARTY 国外订舱单位 X(13) 国外FOB货订舱单位的代码 C
+ ":" //10 B/L TRANSHIP ID 转船标识 X(1) Y/N C
+ ":" //11 BATCH ID 分批 X(1) Y/N C
+ ":" //12 SHIPMENT DATE 装期 9(8) CCYYMMDD C
+ ":" //13 EXPIRY DATE 效期 9(8) CCYYMMDD C
+ ":" + bill . CONTRACTNO //14 QUOTATION NO. 运费协议号 X(30) MAERSK为必选 C
+ ":" //15 CHARGE TYPE 费率本代码 X(1) C
+ ":" + bill . CONTRACTNO //16 S/C NO. 合约号 X(30) C
+ ":" //17 BOOKING NO. 船公司订舱编号 X(20) 船公司系统内部订舱编号 C
+ ":" //18 SLOT CHARTER ID 舱位互用标识 X(1) C
+ ":" + sendno //19 AMS CODE AMS代码 X(15) C
//注: QUOTATION NO.项填本票订舱货的运价是通过向中集询价后定下的特殊运价编号。
+ "'" ) ;
}
else
if ( InttrEdi . filetype = = "E" )
{
//2023-03-03 修改运输条款SERVICE改为EDI的映射值, 经过韩工确认
r . WriteLine ( "02"
+ ":" + bill . ORDERNO //2 REFERENCE NO. 运编号 X(35) 一般为流水号 M
+ ":" + bill . MBLNO //3 B\L NO. 提单号 X(20) 船公司的提单号 C
+ ":" + bill . SERVICEEDICODE //4 DELIVERY TERM 交货条款 X(9) CY-CY(pier-pier/port):30CY-CFS(pier/port-door):29CFS-CY(door-pier/port):28CFS-CFS(door-door):27 M
+ ":" + formatEdiStr ( "txt" , InttrEdi . ForWarderName . Replace ( "\n" , " " ) . Replace ( "\r" , " " ) ) //5 BOOKING PARTY 订舱人说明 X(70) 货代方企业名称或代码 C
+ ":" + formatEdiStr ( "txt" , ! string . IsNullOrWhiteSpace ( InttrEdi . ForWarderName ) ? InttrEdi . ForWarderName . Replace ( "\n" , " " ) . Replace ( "\r" , " " ) : "" ) //5 BOOKING PARTY 订舱人说明 X(70) 货代方企业名称或代码 C
+ ":" + InttrEdi . RECEIVECODE //6 ISSUE PARTY CODE 签单人代码 X(13) 即接受订舱的人的代码 M
+ ":" //7 ISSUE PARTY 签单人说明 X(35) C
+ ":" //8 APPLICANT 询价单位 X(13) 向船公司询价的单位代码 C
@ -734,12 +799,14 @@ namespace DS.WMS.Core.Op.EDI
}
else
{
var sendno = bill . EDIATTNEMAIL ;
//2023-03-03 修改运输条款SERVICE改为EDI的映射值, 经过韩工确认
r . WriteLine ( "02"
+ ":" + bill . ORDERNO //2 REFERENCE NO. 运编号 X(35) 一般为流水号 M
+ ":" + bill . MBLNO //3 B\L NO. 提单号 X(20) 船公司的提单号 C
+ ":" + bill . SERVICEEDICODE //4 DELIVERY TERM 交货条款 X(9) CY-CY(pier-pier/port):30CY-CFS(pier/port-door):29CFS-CY(door-pier/port):28CFS-CFS(door-door):27 M
+ ":" + formatEdiStr ( "txt" , InttrEdi . ForWarderName . Replace ( "\n" , " " ) . Replace ( "\r" , " " ) ) //5 BOOKING PARTY 订舱人说明 X(70) 货代方企业名称或代码 C
+ ":" + formatEdiStr ( "txt" , ! string . IsNullOrWhiteSpace ( InttrEdi . ForWarderName ) ? InttrEdi . ForWarderName . Replace ( "\n" , " " ) . Replace ( "\r" , " " ) : "" ) //5 BOOKING PARTY 订舱人说明 X(70) 货代方企业名称或代码 C
+ ":" + InttrEdi . RECEIVECODE //6 ISSUE PARTY CODE 签单人代码 X(13) 即接受订舱的人的代码 M
+ ":" //7 ISSUE PARTY 签单人说明 X(35) C
+ ":" //8 APPLICANT 询价单位 X(13) 向船公司询价的单位代码 C
@ -750,23 +817,19 @@ namespace DS.WMS.Core.Op.EDI
+ ":" //13 EXPIRY DATE 效期 9(8) CCYYMMDD C
+ ":" + bill . CONTRACTNO //14 QUOTATION NO. 运费协议号 X(30) MAERSK为必选 C
+ ":" //15 CHARGE TYPE 费率本代码 X(1) C
+ ":" + bill . SERVICECONTRACTNO //16 S/C NO. 合约号 X(30) C
/ * 2023 - 04 - 10 经 过 测 试 发 现 会 吧 这 个 订 舱 编 号 写 到 备 注 里 , 这 里 选 择 去 掉 填 写 订 舱 编 号
+ ":" + bill . ORDERNO //17 BOOKING NO. 船公司订舱编号 X(20) 船公司系统内部订舱编号 C
* /
+ ":" + bill . CONTRACTNO //16 S/C NO. 合约号 X(30) C
+ ":" //17 BOOKING NO. 船公司订舱编号 X(20) 船公司系统内部订舱编号 C
+ ":" //18 SLOT CHARTER ID 舱位互用标识 X(1) C
+ ":" + bill . EDIATTNEMAIL //21 AMS CODE AMS代码 X(15) C
+ ":" + bill . EDIATTN //22 AMS CODE AMS代码 X(15) C
+ ":" + bill . EDIATTNTEL //23 AMS CODE AMS代码 X(15) C
//注: QUOTATION NO.项填本票订舱货的运价是通过向中集询价后定下的特殊运价编号。
+ ":" + sendno //19 AMS CODE AMS代码 X(15) C
//注: QUOTATION NO.项填本票订舱货的运价是通过向中集询价后定下的特殊运价编号。
+ "'" ) ;
}
icount + + ;
var ISSUETYPE = "" ;
/ * 2022 - 01 - 04 这 里 新 订 舱 系 统 的 签 单 方 式 代 码 已 变 更 采 用 新 的 编 码 来 判 断
//2023-03-02 测试这里有问题,签单方式用的中文,要改成英文正本-ORIGINAL 电放-TELEX
/ *
if ( bill . ISSUETYPE = = "正本" )
{
ISSUETYPE = "ORI" ;
@ -777,28 +840,36 @@ namespace DS.WMS.Core.Op.EDI
}
else ISSUETYPE = "EXP" ;
* /
//if (bill.ISSUETYPE == "ORIGINAL")
//{
// ISSUETYPE = "ORI";
//}
//else if (bill.ISSUETYPE == "TELEX")
//{
// ISSUETYPE = "TER";
//}
//else ISSUETYPE = "EXP";
if ( bill . ISSUETYPE = = "ORIGINAL" )
if ( new string [ ] { "ORI" , "TER" , "EXP" } . Contains ( bill . ISSUETYPE ) )
{
//正本
ISSUETYPE = "ORI" ;
ISSUETYPE = bill . ISSUETYPE ;
}
else if ( bill . ISSUETYPE = = "TELEX" )
{
//电放
ISSUETYPE = "TER" ;
}
else ISSUETYPE = "EXP" ;
r . WriteLine ( "03:" + ISSUETYPE + ":" + bill . ISSUEPLACEID . Trim ( ) + ":" + bill . ISSUEPLACE . Trim ( ) + ":" + GetDateStr ( bill . ISSUEDATE , "yyyyMMdd" ) + ":" + GetBillNum2 ( bill . NOBILL ) + ":" + bill . PREPARDAT + ":" + bill . PAYABLEAT + "'" ) ;
icount + + ;
r . WriteLine ( "11:" + bill . ESLLINECODE + ":" + bill . VESSEL + ":" + bill . VOYNO + ":::" + InttrEdi . RECEIVECODE + "::" + GetDateStr ( bill . ETD , "yyyyMMdd" ) + ":::::'" ) ;
//2024-09-13 参考韩工东胜7去掉ETD
//r.WriteLine("11:" + bill.VESSELID + ":" + bill.VESSEL + ":" + bill.VOYNO + ":::::" + GetDateStr(bill.ETD, "yyyyMMdd") + ":::::'");
r . WriteLine ( "11:" + bill . VESSELID + ":" + bill . VESSEL + ":" + bill . VOYNO + "::::::::::'" ) ;
icount + + ;
var DESTINATIONID = bill . DESTINATIONID ;
var DESTINATION = bill . DESTINATION ;
if ( bill . CARRIEREDICODE = = "ONEY" | | bill . CARRIEREDICODE = = "ZIM" )
{
DESTINATIONID = "" ;
DESTINATION = "" ;
}
r . WriteLine ( "12"
+ ":" + bill . PLACERECEIPTID //2 PLACE CODE OF RECEIPT 收货地代码 X(5) OOCL、HLC的订舱要求必选 O
@ -811,8 +882,8 @@ namespace DS.WMS.Core.Op.EDI
+ ":" + bill . TRANSPORT //9 TRANSFER PORT 中转港 X(35) C
+ ":" + bill . PLACEDELIVERYID //10 PLACE OF DELIVERY CODE 交货地代码 X(5) OOCL的订舱要求必选 O
+ ":" + bill . PLACEDELIVERY //11 PLACE OF DELIVERY 交货地 X(35) C
+ ":" + bill. DESTINATIONID//12 FINAL DESTINATION CODE 目的地代码 X(5) C
+ ":" + bill. DESTINATION//13 FINAL DESTINATION CODE 目的地 X(35) C
+ ":" + DESTINATIONID//12 FINAL DESTINATION CODE 目的地代码 X(5) C
+ ":" + DESTINATION//13 FINAL DESTINATION CODE 目的地 X(35) C
+ "'" ) ;
icount = icount + 1 ;
@ -833,23 +904,26 @@ namespace DS.WMS.Core.Op.EDI
List < System . String > ShippingList = formatlengthStr ( Shipping , 70 ) ;
if ( Shipping ! = "" )
if ( ! string . IsNullOrWhiteSpace ( Shipping ) )
{
r . WriteLine ( "17:" + formatListStr ( ShippingList , 5 ) + "'" ) ;
icount + + ;
}
if ( InttrEdi . filetype ! = "E" & & ! string . IsNullOrEmpty ( bill . NVONO ) )
{
r . WriteLine ( "18:NVO:" + bill . NVONO + "'" ) ;
}
Shipping = formatEdiStr ( "txt" , bill . SHIPPER ) ;
/ *
2023 - 04 - 06 ESL 的 EDI 去 掉 校 验 后 , 这 里 需 要 截 取 需 要 按 照 最 大 35 来 截 取
ShippingList = formatlengthStr ( Shipping , 75 ) ;
* /
ShippingList = formatlengthStr ( Shipping , 35 ) ;
if ( ShippingList . Count ! = 0 & & Shipping . Length > 0 )
{
r . WriteLine ( "20::" + formatListStr ( ShippingList , 6 ) + "'" ) ;
//2024-09-13 韩工确认最大行数6改为9
r . WriteLine ( "20::" + formatListStr ( ShippingList , 9 ) + "'" ) ;
icount = icount + 1 ;
}
@ -857,67 +931,89 @@ namespace DS.WMS.Core.Op.EDI
Shipping = formatEdiStr ( "txt" , bill . CONSIGNEE ) ;
/ *
2023 - 04 - 06 ESL 的 EDI 去 掉 校 验 后 , 这 里 需 要 截 取 需 要 按 照 最 大 35 来 截 取
ShippingList = formatlengthStr ( Shipping , 75 ) ;
* /
ShippingList = formatlengthStr ( Shipping , 35 ) ;
if ( ShippingList . Count ! = 0 & & Shipping . Length > 0 )
{
r . WriteLine ( "21::" + formatListStr ( ShippingList , 6 ) + "'" ) ;
//2024-09-13 韩工确认最大行数6改为9
r . WriteLine ( "21::" + formatListStr ( ShippingList , 9 ) + "'" ) ;
icount = icount + 1 ;
}
Shipping = formatEdiStr ( "txt" , bill . NOTIFYPARTY ) ;
/ *
2023 - 04 - 06 ESL 的 EDI 去 掉 校 验 后 , 这 里 需 要 截 取 需 要 按 照 最 大 35 来 截 取
ShippingList = formatlengthStr ( Shipping , 75 ) ;
* /
ShippingList = formatlengthStr ( Shipping , 35 ) ;
if ( ShippingList . Count ! = 0 & & Shipping . Length > 0 )
{
r . WriteLine ( "22::" + formatListStr ( ShippingList , 6 ) + "'" ) ;
//2024-09-13 韩工确认最大行数6改为9
r . WriteLine ( "22::" + formatListStr ( ShippingList , 9 ) + "'" ) ;
icount = icount + 1 ;
}
if ( InttrEdi . filetype = = "E" )
Shipping = formatEdiStr ( "txt" , ! string . IsNullOrWhiteSpace ( bill . NOTIFYPARTY2 ) ? bill . NOTIFYPARTY2 : "" ) ;
ShippingList = formatlengthStr ( Shipping , 35 ) ;
if ( ! string . IsNullOrWhiteSpace ( Shipping ) )
{
Shipping = formatEdiStr ( "txt" , bill . NOTIFYPARTY2 ) ;
ShippingList = formatlengthStr ( Shipping , 75 ) ;
if ( Shipping ! = "" )
{
r . WriteLine ( "23::" + formatListStr ( ShippingList , 6 ) + "'" ) ;
icount = icount + 1 ;
r . WriteLine ( "23::" + formatListStr ( ShippingList , 6 ) + "'" ) ;
icount = icount + 1 ;
}
}
Shipping = bill . AMSCONSIGNEE ;
ShippingList = formatlengthStr ( Shipping , 35 ) ;
if ( ! string . IsNullOrWhiteSpace ( Shipping ) )
{
r . WriteLine ( "24::" + formatListStr ( ShippingList , 6 , true ) + "'" ) ;
icount = icount + 1 ;
}
Shipping = bill . AMSNOTIFYPARTY ;
ShippingList = formatlengthStr ( Shipping , 35 ) ;
if ( ! string . IsNullOrWhiteSpace ( Shipping ) )
{
r . WriteLine ( "25::" + formatListStr ( ShippingList , 6 , true ) + "'" ) ;
icount = icount + 1 ;
}
var cargoid = bill . CARGOID ;
if ( cargoid = = "" | | cargoid = = " " ) cargoid = "S" ;
r . WriteLine ( "41:1:" + bill . HSCODE + ":" + cargoid + ":" + bill . PKGS . ToString ( ) + ":" + bill . KINDPKGS_EDI_CODE + ":" + bill . KINDPKGS + ":" + bill . KGS . ToString ( "0.###" ) + ":"
+ bill . CBM . ToString ( "0.###" ) + "::::::" + bill . KGS . ToString ( "0.###" ) + ":::'" ) ;
var kingweight = bill . KINGTAREWEIGHT ;
if ( kingweight = = 0 )
kingweight = 100 ;
r . WriteLine ( "41:1:" + bill . HSCODE + ":" + cargoid + ":" + bill . PKGS . ToString ( ) + ":" + bill . KINDPKGS_EDI_CODE + ":" + bill . KINDPKGS + ":" + kingweight . ToString ( ) + ":"
+ bill . CBM . ToString ( ) + "::::::" + bill . KGS . ToString ( ) + ":::'" ) ;
icount = icount + 1 ;
if ( cargoid = = "R" )
{
r . WriteLine ( "43::::::::::" + bill . REEFERF + ":C:" + bill . TEMPSET + ":" + bill . TEMPMIN + ":" + bill . TEMPMAX + ":::::'" ) ;
icount = icount + 1 ;
}
else if ( cargoid = = "D" )
{
r . WriteLine ( "43:" + bill . DCLASS + ":" + bill . DPAGE + ":" + bill . DUNNO + ":" + bill . DLABEL + "::::::::::::'" ) ;
icount = icount + 1 ;
icount = icount + 1 ;
}
Shipping = formatEdiStr ( "txt" , bill . MARKS ) ;
ShippingList = formatlengthStr ( Shipping , 35 ) ;
@ -972,7 +1068,7 @@ namespace DS.WMS.Core.Op.EDI
}
}
}
if ( strtemp ! = "" )
if ( ! string . IsNullOrWhiteSpace ( strtemp ) )
{
r . WriteLine ( strtemp + "'" ) ;
icount = icount + 1 ;
@ -1049,7 +1145,7 @@ namespace DS.WMS.Core.Op.EDI
if ( InttrEdi . filetype = = "E" )
{
r . WriteLine ( "51:" + ctn . CNTRNO + ":" + ctn . CTNALLCODE + ":"
+ ctn . SEALNO + ":" + ctn . PKGS . ToString ( ) + ":" + ctn . KGS . ToString ( "0.###" ) + "::" + ctn . CBM . ToString ( "0.###" ) + ":" + bill . EDIATTNEMAIL + "'" ) ;
+ ctn . SEALNO + ":" + ctn . PKGS . ToString ( ) + ":" + ctn . KGS . ToString ( ) + "::" + ctn . CBM . ToString ( ) + ":" + bill . EDIATTNEMAIL + "'" ) ;
icount = icount + 1 ;
if ( bill . CTNGOODSLIST ! = null & & bill . CTNGOODSLIST . Count ! = 0 )
@ -1057,7 +1153,7 @@ namespace DS.WMS.Core.Op.EDI
foreach ( var ctnhs in bill . CTNGOODSLIST )
{
r . WriteLine ( "53:" + ctnhs . HSCODE + ":" + ctnhs . PKGS . ToString ( ) + ":"
+ ctnhs . KGS . ToString ( "0.###" ) + ":" + ctnhs . CBM . ToString ( "0.###" ) + ":" + ctnhs . KINDPKGS_EDI_CODE + ":" + ctnhs . KINDPKGS + "'" ) ;
+ ctnhs . KGS . ToString ( ) + ":" + ctnhs . CBM . ToString ( ) + ":" + ctnhs . KINDPKGS_EDI_CODE + ":" + ctnhs . KINDPKGS + "'" ) ;
icount = icount + 1 ;
Shipping = formatEdiStr ( "txt" , ctnhs . DESCRIPTION ) ;
ShippingList = formatlengthStr ( Shipping , 70 ) ;
@ -1068,7 +1164,7 @@ namespace DS.WMS.Core.Op.EDI
for ( var i = 0 ; i < ShippingList . Count ; i + + )
{
if ( ShippingList [ i ] ! = "" )
if ( ! string . IsNullOrWhiteSpace ( ShippingList [ i ] ) )
{
if ( m < = 5 )
{
@ -1092,7 +1188,7 @@ namespace DS.WMS.Core.Op.EDI
}
}
}
if ( strtemp ! = "" )
if ( ! string . IsNullOrWhiteSpace ( strtemp ) )
{
r . WriteLine ( strtemp + "'" ) ;
icount = icount + 1 ;
@ -1101,13 +1197,20 @@ namespace DS.WMS.Core.Op.EDI
}
}
else
{
r . WriteLine ( "53:" + bill . HSCODE + ":" + ctn . PKGS . ToString ( ) + ":"
+ ctn . KGS . ToString ( ) + ":" + ctn . CBM . ToString ( ) + ":" + ctn . KINDPKGS_EDI_CODE + ":" + ctn . KINDPKGS + "'" ) ;
icount = icount + 1 ;
}
}
else
{
if ( ! string . IsNullOrEmpty ( ctn . CNTRNO ) )
{
r . WriteLine ( "51:" + ctn . CNTRNO + ":" + ctn . CTNALLCODE + ":"
+ ctn . SEALNO + ":" + ctn . PKGS . ToString ( ) + ":" + ctn . KGS . ToString ( "0.###" ) + ":'" ) ;
+ ctn . SEALNO + ":" + ctn . PKGS . ToString ( ) + ":" + ctn . KGS . ToString ( ) + ":'" ) ;
icount = icount + 1 ;
}
}
@ -1116,7 +1219,7 @@ namespace DS.WMS.Core.Op.EDI
}
icount = icount + 1 ;
//icount = icount + 1 ;
r . WriteLine ( "99:" + icount . ToString ( ) + "'" ) ;
r . Close ( ) ;
f . Close ( ) ;