diff --git a/Myshipping.Application/EDI/PILEdiHelper.cs b/Myshipping.Application/EDI/PILEdiHelper.cs
index bc5b8f41..609f3f5c 100644
--- a/Myshipping.Application/EDI/PILEdiHelper.cs
+++ b/Myshipping.Application/EDI/PILEdiHelper.cs
@@ -1,15 +1,14 @@
-using System;
+using Myshipping.Application.EDI.ESL;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application.EDI.PIL
{
- ///
- ///
- ///
public class PILEdiHelper
{
@@ -404,9 +403,9 @@ namespace Myshipping.Application.EDI.PIL
return error;
}
- if (string.IsNullOrEmpty(bill.GOODCLASSCODE))
+ if (string.IsNullOrEmpty(bill.GOODSNAME))
{
- error = error + "
提单号:" + bill.MBLNO + "货类代码不能为空";
+ error = error + "
提单号:" + bill.MBLNO + "货物品名不能为空";
return error;
}
@@ -574,6 +573,9 @@ namespace Myshipping.Application.EDI.PIL
{
if (string.IsNullOrEmpty(ctn.CTNALLCODE))
{ error = error + "
提单号:" + bill.MBLNO + " 集装箱箱型EDI代码不能为空"; }
+ if (string.IsNullOrEmpty(ctn.KINDPKGS_EDI_CODE))
+ { error = error + "
提单号:" + bill.MBLNO + " 集装箱包装EDI代码不能为空"; }
+
if ((ctn.CTNALLCODE.IndexOf("RH") > 0 || ctn.CTNALLCODE.IndexOf("RF") > 0) && (bill.CARGOID != "R"))
{
@@ -667,6 +669,9 @@ namespace Myshipping.Application.EDI.PIL
//
string filename = InttrEdi.filerpath + "\\" + InttrEdi.BSLIST[0].MBLNO + estr + ".pms";
+ //如果是部署linux需要修改路径
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ filename = filename.Replace("\\", "/");
if (System.IO.File.Exists(filename))
{
@@ -1139,7 +1144,7 @@ namespace Myshipping.Application.EDI.PIL
{
soc = "S";
}
- var ctnsumlist = new List();
+ List ctnsumlist = new List();
foreach (var ctn in bill.CTNLIST)
{
var isfind = false;
@@ -1777,5 +1782,8 @@ namespace Myshipping.Application.EDI.PIL
return filename;
}
#endregion
+
+
+
}
}
diff --git a/Myshipping.Application/EDI/TSLEdiHelper.cs b/Myshipping.Application/EDI/TSLEdiHelper.cs
index 1ecd0f5f..30df77cb 100644
--- a/Myshipping.Application/EDI/TSLEdiHelper.cs
+++ b/Myshipping.Application/EDI/TSLEdiHelper.cs
@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
@@ -719,6 +720,10 @@ namespace Myshipping.Application.EDI.TSL
{
string filename = InttrEdi.filerpath + "\\" + InttrEdi.BSLIST[0].MBLNO + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".txt";
+ //如果是部署linux需要修改路径
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ filename = filename.Replace("\\", "/");
+
if (System.IO.File.Exists(filename))
{
System.IO.File.Delete(filename);
diff --git a/Myshipping.Application/EDI/WYEdiHelper.cs b/Myshipping.Application/EDI/WYEdiHelper.cs
index edf5286a..1815e37b 100644
--- a/Myshipping.Application/EDI/WYEdiHelper.cs
+++ b/Myshipping.Application/EDI/WYEdiHelper.cs
@@ -4,6 +4,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Runtime.InteropServices;
namespace Myshipping.Application.EDI.WY
{
@@ -623,6 +624,10 @@ namespace Myshipping.Application.EDI.WY
string filename = InttrEdi.filerpath + "\\" + filetype + "_" + InttrEdi.BSLIST[0].MBLNO + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".txt";
+ //如果是部署linux需要修改路径
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ filename = filename.Replace("\\", "/");
+
if (System.IO.File.Exists(filename))
{
System.IO.File.Delete(filename);
diff --git a/Myshipping.Application/EDI/YMLEdiHelper.cs b/Myshipping.Application/EDI/YMLEdiHelper.cs
index 611151cb..37d7685a 100644
--- a/Myshipping.Application/EDI/YMLEdiHelper.cs
+++ b/Myshipping.Application/EDI/YMLEdiHelper.cs
@@ -4,6 +4,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Runtime.InteropServices;
namespace Myshipping.Application.EDI.YML
{
@@ -648,6 +649,10 @@ namespace Myshipping.Application.EDI.YML
var filetype = "IFTMBF";
string filename = InttrEdi.filerpath + "\\" + filetype + "_" + InttrEdi.BSLIST[0].MBLNO + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".txt";
+ //如果是部署linux需要修改路径
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ filename = filename.Replace("\\", "/");
+
if (System.IO.File.Exists(filename))
{
System.IO.File.Delete(filename);
diff --git a/Myshipping.Application/EDI/YTEdiHelper.cs b/Myshipping.Application/EDI/YTEdiHelper.cs
index 7fb5fc2b..48d8b2da 100644
--- a/Myshipping.Application/EDI/YTEdiHelper.cs
+++ b/Myshipping.Application/EDI/YTEdiHelper.cs
@@ -4,6 +4,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Runtime.InteropServices;
namespace Myshipping.Application.EDI.YT
{
@@ -637,6 +638,10 @@ namespace Myshipping.Application.EDI.YT
string filename = InttrEdi.filerpath + "\\" + filetype + "_" + InttrEdi.BSLIST[0].MBLNO + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".txt";
+ //如果是部署linux需要修改路径
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ filename = filename.Replace("\\", "/");
+
if (System.IO.File.Exists(filename))
{
System.IO.File.Delete(filename);
diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml
index a5214989..51f5bf68 100644
--- a/Myshipping.Application/Myshipping.Application.xml
+++ b/Myshipping.Application/Myshipping.Application.xml
@@ -1166,11 +1166,6 @@
体积 M
-
-
-
-
-
edi 文本格式处理判断(例如:1行35个字符不超过5行)
@@ -5001,13 +4996,13 @@
订单主键
- 348223980163141
+ 353244444368965
订单号
- SE2204013163
+ ES202211170001
diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
index 347229a1..9075f669 100644
--- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
+++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
@@ -46,6 +46,7 @@ using Myshipping.Application.EDI.TSL;
using Myshipping.Application.EDI.WY;
using Myshipping.Application.EDI.YML;
using Myshipping.Application.EDI.YT;
+using System.Runtime.InteropServices;
namespace Myshipping.Application
{
@@ -80,7 +81,7 @@ namespace Myshipping.Application
private readonly SqlSugarRepository _repBookingStatus;
const string CONST_MAPPING_MODULE = "BOOK_OR_CLOSING";
-
+ const string CONST_MAPPING_MODULE_ROUTE = "BOOK_OR_CLOSING_ROUTE";
public BookingOrderService(SqlSugarRepository rep, SqlSugarRepository repCtn, SqlSugarRepository ctndetailrep,
SqlSugarRepository bookinglog, SqlSugarRepository bookinglogdetail, SqlSugarRepository bookingremark,
@@ -1614,6 +1615,15 @@ namespace Myshipping.Application
string filePath = $"{Path.Combine(!string.IsNullOrWhiteSpace(fileCfg.basePath) ? fileCfg.basePath : App.WebHostEnvironment.WebRootPath, fileCfg.relativePath)}/edifiles/{order.BSNO}";
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ filePath = filePath.Replace("\\", "/");
+
+ //预先创建目录
+ if (!Directory.Exists(filePath))
+ {
+ Directory.CreateDirectory(filePath);
+ }
+
ediModel.filerpath = filePath;
ediModel.UseForWarderCode = model.useForwarderCode;
@@ -1638,15 +1648,26 @@ namespace Myshipping.Application
primaryModel.CTNLIST = new List();
+ //集装箱
foreach (var conta in contaList)
{
var contaModel = conta.Adapt();
- var currConta = ediCtnList.FirstOrDefault(x => x.Code.Equals(conta.CTNALL, StringComparison.OrdinalIgnoreCase));
- if (currConta != null)
- {
- contaModel.CTNALLCODE = currConta.MapCode;
- }
+ //EDI箱型
+ var currConta = ediCtnList.FirstOrDefault(x => x.Code.Equals(conta.CTNCODE, StringComparison.OrdinalIgnoreCase));
+
+ if (currConta == null)
+ throw Oops.Oh($"箱型{conta.CTNCODE}的EDI代码未找到");
+
+ contaModel.CTNALLCODE = currConta.MapCode;
+
+ //EDI包装
+ var ediContaPkgs = ediPkgsList.FirstOrDefault(x => x.Code.Equals(conta.KINDPKGS, StringComparison.OrdinalIgnoreCase));
+
+ if (currConta == null)
+ throw Oops.Oh($"集装箱包装{conta.KINDPKGS}的EDI代码未找到");
+
+ contaModel.KINDPKGS_EDI_CODE = ediContaPkgs.MapCode;
primaryModel.CTNLIST.Add(contaModel);
}
@@ -1663,14 +1684,26 @@ namespace Myshipping.Application
cargoModel.CNTRNO = contaList.FirstOrDefault(a => a.Id == cargo.CTNID.Value).CNTRNO;
var ediDetailPkgs = ediPkgsList.FirstOrDefault(x => x.Code.Equals(cargo.KINDPKGS, StringComparison.OrdinalIgnoreCase));
- if (ediDetailPkgs != null)
- {
- cargoModel.KINDPKGS_EDI_CODE = ediDetailPkgs.MapCode;
- }
+ if (ediDetailPkgs == null)
+ throw Oops.Oh($"货明细的包装{cargo.KINDPKGS}的EDI代码未找到");
+
+ cargoModel.KINDPKGS_EDI_CODE = ediDetailPkgs.MapCode;
+
primaryModel.CTNGOODSLIST.Add(cargoModel);
}
+ //这里临时赋值,等明确对应的扩展表字段后赋值
+ #if DEBUG
+ primaryModel.MasterBOLIndicator = "A1";
+ primaryModel.ConsigneeEdiCode = "CEE1";
+ primaryModel.ShipperEdiCode = "SHIP1";
+ primaryModel.SalesRepCode = "SALE1";
+ primaryModel.ACIHBL = String.Empty;
+ primaryModel.S0CC0C = String.Empty;
+
+#endif
+
ediModel.BSLIST.Add(primaryModel);
var result = await InnerSendBookingOrClosingEDI(model, ediModel, ediRouteEnum);
@@ -1680,6 +1713,10 @@ namespace Myshipping.Application
throw Oops.Bah(result.msg);
}
+
+
+
+
return result.extra.ToString();
}
#endregion
@@ -1832,24 +1869,31 @@ namespace Myshipping.Application
{
EDIRouteEnum routeEnum = EDIRouteEnum.NULL;
- switch (carrierId.ToUpper())
- {
- case "PIL":
- routeEnum = EDIRouteEnum.PIL;
- break;
- case "ONE":
- routeEnum = EDIRouteEnum.YT;
- break;
- case "TSL":
- routeEnum = EDIRouteEnum.TSL;
- break;
- case "YML":
- routeEnum = EDIRouteEnum.YML;
- break;
- case "WY":
- routeEnum = EDIRouteEnum.WY;
- break;
- }
+ var ediRouteCfg = _cache.GetAllMappingCarrier().GetAwaiter().GetResult()
+ .FirstOrDefault(t => t.Module.Equals(CONST_MAPPING_MODULE_ROUTE, StringComparison.OrdinalIgnoreCase)
+ && t.Code.Equals(carrierId, StringComparison.OrdinalIgnoreCase));
+
+ if (ediRouteCfg != null && !string.IsNullOrWhiteSpace(ediRouteCfg.MapCode))
+ routeEnum = (EDIRouteEnum)System.Enum.Parse(typeof(EDIRouteEnum), ediRouteCfg.MapCode);
+
+ //switch (carrierId.ToUpper())
+ //{
+ // case "PIL":
+ // routeEnum = EDIRouteEnum.PIL;
+ // break;
+ // case "ONE":
+ // routeEnum = EDIRouteEnum.YT;
+ // break;
+ // case "TSL":
+ // routeEnum = EDIRouteEnum.TSL;
+ // break;
+ // case "YML":
+ // routeEnum = EDIRouteEnum.YML;
+ // break;
+ // case "WY":
+ // routeEnum = EDIRouteEnum.WY;
+ // break;
+ //}
return routeEnum;
}
diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs
index 20e539f1..92ce2a5f 100644
--- a/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs
+++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs
@@ -64,7 +64,8 @@ namespace Myshipping.Application
.Map(dest => dest.SHIPPERDOORADDR, src => src.SHIPPERDOORADDR)
.Map(dest => dest.SCACCODE, src => src.SCACCODE)
.Map(dest => dest.ISCONTAINERSOC, src => src.ISCONTAINERSOC)
- .Map(dest => dest.FREIGHTPAYER, src => src.FREIGHTPAYER);
+ .Map(dest => dest.FREIGHTPAYER, src => src.FREIGHTPAYER)
+ .Map(dest => dest.GOODSNAME, src => src.DESCRIPTION);
config.ForType()
diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingOrClosingEDIOrderDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingOrClosingEDIOrderDto.cs
index 322dff7d..b764e519 100644
--- a/Myshipping.Application/Service/BookingOrder/Dto/BookingOrClosingEDIOrderDto.cs
+++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingOrClosingEDIOrderDto.cs
@@ -14,12 +14,12 @@ namespace Myshipping.Application
///
/// 订单主键
///
- /// 348223980163141
+ /// 353244444368965
public long Id { get; set; }
///
/// 订单号
///
- /// SE2204013163
+ /// ES202211170001
public string orderNo { get; set; }
///