修改测试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.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Myshipping.Application.EDI.PIL namespace Myshipping.Application.EDI.PIL
{ {
/// <summary>
///
/// </summary>
public class PILEdiHelper public class PILEdiHelper
{ {
@ -404,9 +403,9 @@ namespace Myshipping.Application.EDI.PIL
return error; return error;
} }
if (string.IsNullOrEmpty(bill.GOODCLASSCODE)) if (string.IsNullOrEmpty(bill.GOODSNAME))
{ {
error = error + "<br />提单号:" + bill.MBLNO + "货类代码不能为空"; error = error + "<br />提单号:" + bill.MBLNO + "货物品名不能为空";
return error; return error;
} }
@ -574,6 +573,9 @@ namespace Myshipping.Application.EDI.PIL
{ {
if (string.IsNullOrEmpty(ctn.CTNALLCODE)) if (string.IsNullOrEmpty(ctn.CTNALLCODE))
{ error = error + "<br />提单号:" + bill.MBLNO + " 集装箱箱型EDI代码不能为空"; } { 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")) 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"; 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)) if (System.IO.File.Exists(filename))
{ {
@ -1139,7 +1144,7 @@ namespace Myshipping.Application.EDI.PIL
{ {
soc = "S"; soc = "S";
} }
var ctnsumlist = new List<MsOpSeaeCtnEDIBaseModel>(); List<MsOpSeaeCtnEDIBaseModel> ctnsumlist = new List<MsOpSeaeCtnEDIBaseModel>();
foreach (var ctn in bill.CTNLIST) foreach (var ctn in bill.CTNLIST)
{ {
var isfind = false; var isfind = false;
@ -1777,5 +1782,8 @@ namespace Myshipping.Application.EDI.PIL
return filename; return filename;
} }
#endregion #endregion
} }
} }

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading.Tasks; 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"; 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)) if (System.IO.File.Exists(filename))
{ {
System.IO.File.Delete(filename); System.IO.File.Delete(filename);

@ -4,6 +4,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace Myshipping.Application.EDI.WY 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"; 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)) if (System.IO.File.Exists(filename))
{ {
System.IO.File.Delete(filename); System.IO.File.Delete(filename);

@ -4,6 +4,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace Myshipping.Application.EDI.YML namespace Myshipping.Application.EDI.YML
{ {
@ -648,6 +649,10 @@ namespace Myshipping.Application.EDI.YML
var filetype = "IFTMBF"; var filetype = "IFTMBF";
string filename = InttrEdi.filerpath + "\\" + filetype + "_" + InttrEdi.BSLIST[0].MBLNO + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".txt"; 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)) if (System.IO.File.Exists(filename))
{ {
System.IO.File.Delete(filename); System.IO.File.Delete(filename);

@ -4,6 +4,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace Myshipping.Application.EDI.YT 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"; 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)) if (System.IO.File.Exists(filename))
{ {
System.IO.File.Delete(filename); System.IO.File.Delete(filename);

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

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

@ -64,7 +64,8 @@ namespace Myshipping.Application
.Map(dest => dest.SHIPPERDOORADDR, src => src.SHIPPERDOORADDR) .Map(dest => dest.SHIPPERDOORADDR, src => src.SHIPPERDOORADDR)
.Map(dest => dest.SCACCODE, src => src.SCACCODE) .Map(dest => dest.SCACCODE, src => src.SCACCODE)
.Map(dest => dest.ISCONTAINERSOC, src => src.ISCONTAINERSOC) .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>() config.ForType<BookingCtn, MsOpSeaeCtnEDIBaseModel>()

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

Loading…
Cancel
Save