修改测试PIL帮助类的方法

booking_auth_dev
jianghaiqing 2 years ago
parent f7ee65c3cb
commit e8e96a8cc0

@ -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
{
/// <summary>
///
/// </summary>
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 + "<br />提单号:" + bill.MBLNO + "货类代码不能为空";
error = error + "<br />提单号:" + bill.MBLNO + "货物品名不能为空";
return error;
}
@ -574,6 +573,9 @@ namespace Myshipping.Application.EDI.PIL
{
if (string.IsNullOrEmpty(ctn.CTNALLCODE))
{ error = error + "<br />提单号:" + bill.MBLNO + " 集装箱箱型EDI代码不能为空"; }
if (string.IsNullOrEmpty(ctn.KINDPKGS_EDI_CODE))
{ error = error + "<br />提单号:" + 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<MsOpSeaeCtnEDIBaseModel>();
List<MsOpSeaeCtnEDIBaseModel> ctnsumlist = new List<MsOpSeaeCtnEDIBaseModel>();
foreach (var ctn in bill.CTNLIST)
{
var isfind = false;
@ -1777,5 +1782,8 @@ namespace Myshipping.Application.EDI.PIL
return filename;
}
#endregion
}
}

@ -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);

@ -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);

@ -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);

@ -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);

@ -1166,11 +1166,6 @@
体积 M
</summary>
</member>
<member name="T:Myshipping.Application.EDI.PIL.PILEdiHelper">
<summary>
</summary>
</member>
<member name="M:Myshipping.Application.EDI.PIL.PILEdiHelper.formatlengthError(System.String,System.String,System.Int32,System.String,System.String,System.Int32,System.String,System.Boolean)">
<summary>
edi 文本格式处理判断例如1行35个字符不超过5行
@ -4967,13 +4962,13 @@
<summary>
订单主键
</summary>
<example>348223980163141</example>
<example>353244444368965</example>
</member>
<member name="P:Myshipping.Application.BookingOrClosingEDIOrderDto.orderNo">
<summary>
订单号
</summary>
<example>SE2204013163</example>
<example>ES202211170001</example>
</member>
<member name="P:Myshipping.Application.BookingOrClosingEDIOrderDto.useForwarderCode">
<summary>

@ -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
{
@ -79,7 +80,7 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<SysTenant> _repTenant;
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,
@ -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}";
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
filePath = filePath.Replace("\\", "/");
//预先创建目录
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
ediModel.filerpath = filePath;
ediModel.UseForWarderCode = model.useForwarderCode;
@ -1626,15 +1636,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);
}
@ -1651,14 +1672,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);
@ -1668,6 +1701,10 @@ namespace Myshipping.Application
throw Oops.Oh(result.msg);
}
return result.extra.ToString();
}
#endregion
@ -1820,24 +1857,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;
}

@ -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<BookingCtn, MsOpSeaeCtnEDIBaseModel>()

@ -14,12 +14,12 @@ namespace Myshipping.Application
/// <summary>
/// 订单主键
/// </summary>
/// <example>348223980163141</example>
/// <example>353244444368965</example>
public long Id { get; set; }
/// <summary>
/// 订单号
/// </summary>
/// <example>SE2204013163</example>
/// <example>ES202211170001</example>
public string orderNo { get; set; }
/// <summary>

Loading…
Cancel
Save