|
|
|
@ -328,8 +328,14 @@ namespace DS.WMS.Core.Op.EDI
|
|
|
|
|
if (string.IsNullOrEmpty(headData.OpEmail))
|
|
|
|
|
{ error = error + "<br />操作的邮箱不能为空"; }
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(headData.MBLNO))
|
|
|
|
|
{ error = error + "<br />主提单号不能为空"; }
|
|
|
|
|
|
|
|
|
|
//截单时必需校验提单号,订舱时CMA可以不校验提单号必填
|
|
|
|
|
if (InttrEdi.filetype == "E" || (InttrEdi.filetype == "B" && (headData.CARRIEREDICODE != "HLCU" && headData.CARRIEREDICODE != "CMDU" && headData.CARRIEREDICODE != "CHNL")))
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(headData.MBLNO))
|
|
|
|
|
{ error = error + "<br />主提单号不能为空"; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(headData.BLFRT))
|
|
|
|
|
{ error = error + "<br />提单号:" + headData.MBLNO + " 付费方式不能为空"; }
|
|
|
|
@ -359,12 +365,14 @@ namespace DS.WMS.Core.Op.EDI
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(headData.VESSEL))
|
|
|
|
|
{ error = error + "<br />提单号:" + headData.MBLNO + " 船名不能为空"; }
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(headData.VOYNO))
|
|
|
|
|
{ error = error + "<br />提单号:" + headData.MBLNO + " 航次不能为空"; }
|
|
|
|
|
if (InttrEdi.filetype == "E")
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(headData.VESSEL))
|
|
|
|
|
{ error = error + "<br />提单号:" + headData.MBLNO + " 船名不能为空"; }
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(headData.VOYNO))
|
|
|
|
|
{ error = error + "<br />提单号:" + headData.MBLNO + " 航次不能为空"; }
|
|
|
|
|
}
|
|
|
|
|
if (InttrEdi.filetype == "E")
|
|
|
|
|
{
|
|
|
|
|
if (headData.SIREMARK.IndexOf("PLEASE BOOK OCEAN CARRIER") > -1 || headData.SIREMARK.ToString().Trim() == "")
|
|
|
|
@ -417,32 +425,79 @@ namespace DS.WMS.Core.Op.EDI
|
|
|
|
|
{ error = error + "<br />提单号:" + headData.MBLNO + " 船公司EDI代码不能为空"; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(headData.SHIPPER))
|
|
|
|
|
//CMA 订舱时,发货人可以不填
|
|
|
|
|
if (InttrEdi.filetype.Equals("B", StringComparison.OrdinalIgnoreCase) && headData.CARRIEREDICODE.Equals("CMDU", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
error = error + "<br />提单号:" + headData.MBLNO + " 发货人不能为空";
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(headData.SHIPPER))
|
|
|
|
|
{
|
|
|
|
|
if (StringIsChinese(headData.SHIPPER))
|
|
|
|
|
{
|
|
|
|
|
error = error + "<br />提单号:" + headData.MBLNO + " 发货人含有中文或双字节字符";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (headData.CARRIEREDICODE == "HLCU")
|
|
|
|
|
{
|
|
|
|
|
error += formatlengthError("txt", headData.SHIPPER, 35, headData.MBLNO, "发货人", 6, "-", false);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
error += formatlengthError("txt", headData.SHIPPER, 35, headData.MBLNO, "发货人", 6, "*", false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (StringIsChinese(headData.SHIPPER))
|
|
|
|
|
if (string.IsNullOrEmpty(headData.SHIPPER))
|
|
|
|
|
{
|
|
|
|
|
error = error + "<br />提单号:" + headData.MBLNO + " 发货人含有中文或双字节字符";
|
|
|
|
|
error = error + "<br />提单号:" + headData.MBLNO + " 发货人不能为空";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (headData.CARRIEREDICODE == "HLCU")
|
|
|
|
|
if (StringIsChinese(headData.SHIPPER))
|
|
|
|
|
{
|
|
|
|
|
error += formatlengthError("txt", headData.SHIPPER, 35, headData.MBLNO, "发货人", 6, "-", false);
|
|
|
|
|
error = error + "<br />提单号:" + headData.MBLNO + " 发货人含有中文或双字节字符";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
error += formatlengthError("txt", headData.SHIPPER, 35, headData.MBLNO, "发货人", 6, "*", false);
|
|
|
|
|
if (headData.CARRIEREDICODE == "HLCU")
|
|
|
|
|
{
|
|
|
|
|
error += formatlengthError("txt", headData.SHIPPER, 35, headData.MBLNO, "发货人", 6, "-", false);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
error += formatlengthError("txt", headData.SHIPPER, 35, headData.MBLNO, "发货人", 6, "*", false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//改为截单时校验
|
|
|
|
|
if (InttrEdi.filetype == "E")
|
|
|
|
|
//CMA 订舱时,收货人可以不填
|
|
|
|
|
if (InttrEdi.filetype.Equals("B", StringComparison.OrdinalIgnoreCase) && headData.CARRIEREDICODE.Equals("CMDU", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(headData.CONSIGNEE))
|
|
|
|
|
{
|
|
|
|
|
if (StringIsChinese(headData.CONSIGNEE))
|
|
|
|
|
{
|
|
|
|
|
error = error + "<br />提单号:" + headData.MBLNO + " 收货人含有中文或双字节字符";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (headData.CARRIEREDICODE == "HLCU")
|
|
|
|
|
{
|
|
|
|
|
error += formatlengthError("txt", headData.CONSIGNEE, 35, headData.MBLNO, "收货人", 6, "--", false);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
error += formatlengthError("txt", headData.CONSIGNEE, 35, headData.MBLNO, "收货人", 6, "**", false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(headData.CONSIGNEE))
|
|
|
|
|
{
|
|
|
|
@ -498,8 +553,29 @@ namespace DS.WMS.Core.Op.EDI
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//改为截单时校验
|
|
|
|
|
if (InttrEdi.filetype == "E")
|
|
|
|
|
//CMA 订舱时,通知人可以不填
|
|
|
|
|
if (InttrEdi.filetype.Equals("B", StringComparison.OrdinalIgnoreCase) && headData.CARRIEREDICODE.Equals("CMDU", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(headData.NOTIFYPARTY))
|
|
|
|
|
{
|
|
|
|
|
if (StringIsChinese(headData.NOTIFYPARTY))
|
|
|
|
|
{
|
|
|
|
|
error = error + "<br />提单号:" + headData.MBLNO + " 通知人含有中文或双字节字符";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (headData.CARRIEREDICODE == "HLCU")
|
|
|
|
|
{
|
|
|
|
|
error += formatlengthError("txt", headData.NOTIFYPARTY, 35, headData.MBLNO, "通知人", 6, "---", false);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
error += formatlengthError("txt", headData.NOTIFYPARTY, 35, headData.MBLNO, "通知人", 6, "***", false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(headData.NOTIFYPARTY))
|
|
|
|
|
{
|
|
|
|
@ -527,26 +603,26 @@ namespace DS.WMS.Core.Op.EDI
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(headData.NOTIFYPARTY2))
|
|
|
|
|
{
|
|
|
|
|
error += formatlengthError("txt", headData.NOTIFYPARTY2, 35, headData.MBLNO, "第二通知人", 5, "", false);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(headData.NOTIFYPARTY2))
|
|
|
|
|
{
|
|
|
|
|
error += formatlengthError("txt", headData.NOTIFYPARTY2, 35, headData.MBLNO, "第二通知人", 5, "", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(headData.MARKS))
|
|
|
|
|
if (string.IsNullOrEmpty(headData.MARKS))
|
|
|
|
|
{
|
|
|
|
|
error = error + "<br />提单号:" + headData.MBLNO + " 唛头不能为空";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (StringIsChinese(headData.MARKS))
|
|
|
|
|
{
|
|
|
|
|
error = error + "<br />提单号:" + headData.MBLNO + " 唛头不能为空";
|
|
|
|
|
error = error + "<br />提单号:" + headData.MBLNO + " 唛头含有中文或双字节字符";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (StringIsChinese(headData.MARKS))
|
|
|
|
|
{
|
|
|
|
|
error = error + "<br />提单号:" + headData.MBLNO + " 唛头含有中文或双字节字符";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
error += formatlengthError("txt", headData.MARKS, 35, headData.MBLNO, "唛头", 0, "", false);
|
|
|
|
|
}
|
|
|
|
|
error += formatlengthError("txt", headData.MARKS, 35, headData.MBLNO, "唛头", 0, "", false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -770,7 +846,7 @@ namespace DS.WMS.Core.Op.EDI
|
|
|
|
|
#region 订舱
|
|
|
|
|
public static EdiDataResult CreateEdiINTTR(EDIBaseModel InttrEdi)
|
|
|
|
|
{
|
|
|
|
|
EdiDataResult result = new EdiDataResult { Succeeded = false };
|
|
|
|
|
var result = new EdiDataResult { Succeeded = false };
|
|
|
|
|
|
|
|
|
|
string filename = InttrEdi.filerpath + "\\" + InttrEdi.BSLIST[0].MBLNO + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".txt";
|
|
|
|
|
|
|
|
|
@ -790,10 +866,10 @@ namespace DS.WMS.Core.Op.EDI
|
|
|
|
|
{
|
|
|
|
|
bsno = bill.ORDERNO;
|
|
|
|
|
r.WriteLine("UNB+UNOC:2+" + InttrEdi.SENDCODE + "SO:ZZZ+" + InttrEdi.RECEIVECODE + ":ZZZ+" + DateTime.Now.ToString("yyMMdd:HHmm") + "+" + bill.ORDERNO + "'");
|
|
|
|
|
r.WriteLine("UNH+" + bill.ORDERNO + "+IFTMBF:D:99B:UN'");
|
|
|
|
|
r.WriteLine("UNH+" + bill.ORDERNO + "+IFTMIN:D:99B:UN'");
|
|
|
|
|
icount = icount + 2;
|
|
|
|
|
|
|
|
|
|
if (bill.CARRIEREDICODE == "HLCU")
|
|
|
|
|
if (bill.CARRIEREDICODE == "HLCU" || bill.CARRIEREDICODE == "CMDU" || bill.CARRIEREDICODE == "CHNL")
|
|
|
|
|
{
|
|
|
|
|
if (InttrEdi.filerole == "9")
|
|
|
|
|
r.WriteLine("BGM+335+" + bill.ORDERNO + "SO+9'");
|
|
|
|
@ -834,6 +910,9 @@ namespace DS.WMS.Core.Op.EDI
|
|
|
|
|
r.WriteLine("TSR+30+2'");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//2024-05-22 少了一行计数追加上 JHQ
|
|
|
|
|
//icount = icount + 1;
|
|
|
|
|
|
|
|
|
|
var str_pay = "";
|
|
|
|
|
if (bill.BLFRT.IndexOf("PREPAID") >= 0)
|
|
|
|
|
str_pay = bill.PREPARDAT;
|
|
|
|
@ -937,7 +1016,7 @@ namespace DS.WMS.Core.Op.EDI
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bill.CARRIEREDICODE != "COSU")
|
|
|
|
|
if (bill.CARRIEREDICODE != "COSU" && !string.IsNullOrWhiteSpace(bill.MBLNO))
|
|
|
|
|
{
|
|
|
|
|
if (bill.CARRIEREDICODE == "HLCU")
|
|
|
|
|
{
|
|
|
|
@ -951,6 +1030,7 @@ namespace DS.WMS.Core.Op.EDI
|
|
|
|
|
}
|
|
|
|
|
icount = icount + 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
r.WriteLine("RFF+CT:" + bill.CONTRACTNO + "'");
|
|
|
|
|
|
|
|
|
|
if (bill.BLFRT.IndexOf("PREPAID") >= 0)
|
|
|
|
@ -1271,6 +1351,7 @@ namespace DS.WMS.Core.Op.EDI
|
|
|
|
|
else
|
|
|
|
|
r.WriteLine("NAD+FW+++" + formatEdiStr("txt", bill.WEITUO) + "'");
|
|
|
|
|
|
|
|
|
|
icount = icount + 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -1278,7 +1359,7 @@ namespace DS.WMS.Core.Op.EDI
|
|
|
|
|
if (InttrEdi.UseForWarderCode)
|
|
|
|
|
{
|
|
|
|
|
r.WriteLine("NAD+FW+" + InttrEdi.ForWarderCode + ":160:86++" + InttrEdi.ForWarderName + "'");
|
|
|
|
|
icount++;
|
|
|
|
|
icount = icount + 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -1286,6 +1367,8 @@ namespace DS.WMS.Core.Op.EDI
|
|
|
|
|
r.WriteLine("NAD+FW+" + InttrEdi.SENDCODE + ":160:86++" + InttrEdi.SENDNAME.Substring(0, 35) + "+" + InttrEdi.SENDNAME.Substring(35) + "'");
|
|
|
|
|
else
|
|
|
|
|
r.WriteLine("NAD+FW+" + InttrEdi.SENDCODE + ":160:86++" + InttrEdi.SENDNAME + "'");
|
|
|
|
|
|
|
|
|
|
icount = icount + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1456,9 +1539,6 @@ namespace DS.WMS.Core.Op.EDI
|
|
|
|
|
r.Close();
|
|
|
|
|
f.Close();
|
|
|
|
|
|
|
|
|
|
//result.succ = true;
|
|
|
|
|
//result.extra = filename;
|
|
|
|
|
//return result;
|
|
|
|
|
result.Succeeded = true;
|
|
|
|
|
result.ExtraData1 = filename;
|
|
|
|
|
return result;
|
|
|
|
|