|
|
|
@ -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<BookingStatus> _repBookingStatus;
|
|
|
|
|
|
|
|
|
|
const string CONST_MAPPING_MODULE = "BOOK_OR_CLOSING";
|
|
|
|
|
|
|
|
|
|
const string CONST_MAPPING_MODULE_ROUTE = "BOOK_OR_CLOSING_ROUTE";
|
|
|
|
|
|
|
|
|
|
public BookingOrderService(SqlSugarRepository<BookingOrder> rep, SqlSugarRepository<BookingCtn> repCtn, SqlSugarRepository<BookingCtnDetail> ctndetailrep,
|
|
|
|
|
SqlSugarRepository<BookingLog> bookinglog, SqlSugarRepository<BookingLogDetail> bookinglogdetail, SqlSugarRepository<BookingRemark> 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<MsOpSeaeCtnEDIBaseModel>();
|
|
|
|
|
|
|
|
|
|
//集装箱
|
|
|
|
|
foreach (var conta in contaList)
|
|
|
|
|
{
|
|
|
|
|
var contaModel = conta.Adapt<MsOpSeaeCtnEDIBaseModel>();
|
|
|
|
|
|
|
|
|
|
var currConta = ediCtnList.FirstOrDefault(x => x.Code.Equals(conta.CTNALL, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
if (currConta != null)
|
|
|
|
|
{
|
|
|
|
|
//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)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|