|
|
@ -46,6 +46,7 @@ using Myshipping.Application.EDI.TSL;
|
|
|
|
using Myshipping.Application.EDI.WY;
|
|
|
|
using Myshipping.Application.EDI.WY;
|
|
|
|
using Myshipping.Application.EDI.YML;
|
|
|
|
using Myshipping.Application.EDI.YML;
|
|
|
|
using Myshipping.Application.EDI.YT;
|
|
|
|
using Myshipping.Application.EDI.YT;
|
|
|
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Application
|
|
|
|
namespace Myshipping.Application
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -79,7 +80,7 @@ namespace Myshipping.Application
|
|
|
|
private readonly SqlSugarRepository<SysTenant> _repTenant;
|
|
|
|
private readonly SqlSugarRepository<SysTenant> _repTenant;
|
|
|
|
|
|
|
|
|
|
|
|
const string CONST_MAPPING_MODULE = "BOOK_OR_CLOSING";
|
|
|
|
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,
|
|
|
|
public BookingOrderService(SqlSugarRepository<BookingOrder> rep, SqlSugarRepository<BookingCtn> repCtn, SqlSugarRepository<BookingCtnDetail> ctndetailrep,
|
|
|
|
SqlSugarRepository<BookingLog> bookinglog, SqlSugarRepository<BookingLogDetail> bookinglogdetail, SqlSugarRepository<BookingRemark> bookingremark,
|
|
|
|
SqlSugarRepository<BookingLog> bookinglog, SqlSugarRepository<BookingLogDetail> bookinglogdetail, SqlSugarRepository<BookingRemark> bookingremark,
|
|
|
@ -1602,6 +1603,15 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
string filePath = $"{Path.Combine(!string.IsNullOrWhiteSpace(fileCfg.basePath) ? fileCfg.basePath : App.WebHostEnvironment.WebRootPath, fileCfg.relativePath)}/edifiles/{order.BSNO}";
|
|
|
|
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.filerpath = filePath;
|
|
|
|
|
|
|
|
|
|
|
|
ediModel.UseForWarderCode = model.useForwarderCode;
|
|
|
|
ediModel.UseForWarderCode = model.useForwarderCode;
|
|
|
@ -1626,15 +1636,26 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
primaryModel.CTNLIST = new List<MsOpSeaeCtnEDIBaseModel>();
|
|
|
|
primaryModel.CTNLIST = new List<MsOpSeaeCtnEDIBaseModel>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//集装箱
|
|
|
|
foreach (var conta in contaList)
|
|
|
|
foreach (var conta in contaList)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var contaModel = conta.Adapt<MsOpSeaeCtnEDIBaseModel>();
|
|
|
|
var contaModel = conta.Adapt<MsOpSeaeCtnEDIBaseModel>();
|
|
|
|
|
|
|
|
|
|
|
|
var currConta = ediCtnList.FirstOrDefault(x => x.Code.Equals(conta.CTNALL, StringComparison.OrdinalIgnoreCase));
|
|
|
|
//EDI箱型
|
|
|
|
if (currConta != null)
|
|
|
|
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;
|
|
|
|
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);
|
|
|
|
primaryModel.CTNLIST.Add(contaModel);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1651,14 +1672,26 @@ namespace Myshipping.Application
|
|
|
|
cargoModel.CNTRNO = contaList.FirstOrDefault(a => a.Id == cargo.CTNID.Value).CNTRNO;
|
|
|
|
cargoModel.CNTRNO = contaList.FirstOrDefault(a => a.Id == cargo.CTNID.Value).CNTRNO;
|
|
|
|
|
|
|
|
|
|
|
|
var ediDetailPkgs = ediPkgsList.FirstOrDefault(x => x.Code.Equals(cargo.KINDPKGS, StringComparison.OrdinalIgnoreCase));
|
|
|
|
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;
|
|
|
|
cargoModel.KINDPKGS_EDI_CODE = ediDetailPkgs.MapCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
primaryModel.CTNGOODSLIST.Add(cargoModel);
|
|
|
|
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);
|
|
|
|
ediModel.BSLIST.Add(primaryModel);
|
|
|
|
|
|
|
|
|
|
|
|
var result = await InnerSendBookingOrClosingEDI(model, ediModel, ediRouteEnum);
|
|
|
|
var result = await InnerSendBookingOrClosingEDI(model, ediModel, ediRouteEnum);
|
|
|
@ -1668,6 +1701,10 @@ namespace Myshipping.Application
|
|
|
|
throw Oops.Oh(result.msg);
|
|
|
|
throw Oops.Oh(result.msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result.extra.ToString();
|
|
|
|
return result.extra.ToString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
@ -1820,24 +1857,31 @@ namespace Myshipping.Application
|
|
|
|
{
|
|
|
|
{
|
|
|
|
EDIRouteEnum routeEnum = EDIRouteEnum.NULL;
|
|
|
|
EDIRouteEnum routeEnum = EDIRouteEnum.NULL;
|
|
|
|
|
|
|
|
|
|
|
|
switch (carrierId.ToUpper())
|
|
|
|
var ediRouteCfg = _cache.GetAllMappingCarrier().GetAwaiter().GetResult()
|
|
|
|
{
|
|
|
|
.FirstOrDefault(t => t.Module.Equals(CONST_MAPPING_MODULE_ROUTE, StringComparison.OrdinalIgnoreCase)
|
|
|
|
case "PIL":
|
|
|
|
&& t.Code.Equals(carrierId, StringComparison.OrdinalIgnoreCase));
|
|
|
|
routeEnum = EDIRouteEnum.PIL;
|
|
|
|
|
|
|
|
break;
|
|
|
|
if (ediRouteCfg != null && !string.IsNullOrWhiteSpace(ediRouteCfg.MapCode))
|
|
|
|
case "ONE":
|
|
|
|
routeEnum = (EDIRouteEnum)System.Enum.Parse(typeof(EDIRouteEnum), ediRouteCfg.MapCode);
|
|
|
|
routeEnum = EDIRouteEnum.YT;
|
|
|
|
|
|
|
|
break;
|
|
|
|
//switch (carrierId.ToUpper())
|
|
|
|
case "TSL":
|
|
|
|
//{
|
|
|
|
routeEnum = EDIRouteEnum.TSL;
|
|
|
|
// case "PIL":
|
|
|
|
break;
|
|
|
|
// routeEnum = EDIRouteEnum.PIL;
|
|
|
|
case "YML":
|
|
|
|
// break;
|
|
|
|
routeEnum = EDIRouteEnum.YML;
|
|
|
|
// case "ONE":
|
|
|
|
break;
|
|
|
|
// routeEnum = EDIRouteEnum.YT;
|
|
|
|
case "WY":
|
|
|
|
// break;
|
|
|
|
routeEnum = EDIRouteEnum.WY;
|
|
|
|
// case "TSL":
|
|
|
|
break;
|
|
|
|
// routeEnum = EDIRouteEnum.TSL;
|
|
|
|
}
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case "YML":
|
|
|
|
|
|
|
|
// routeEnum = EDIRouteEnum.YML;
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case "WY":
|
|
|
|
|
|
|
|
// routeEnum = EDIRouteEnum.WY;
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
return routeEnum;
|
|
|
|
return routeEnum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|