zhangxiaofeng 2 days ago
commit 3ec901ff2e

@ -91,5 +91,203 @@ namespace Myshipping.Application
/// 付费方式代码
/// </summary>
public string PAYABLE { get; set; }
/// <summary>
/// 海丰扩展信息
/// </summary>
public SITCExtInfo SITCExt { get; set; }
}
public class SITCExtInfo
{
/// <summary>
/// 运程类型DIRECT-直达SECOND-二程THIRD-三程)
/// </summary>
public string TransferType { get; set; }
/// <summary>
/// 运程类型名称DIRECT-直达SECOND-二程THIRD-三程)
/// </summary>
public string TransferTypeName { get; set; }
/// <summary>
/// 一程运力类型MAIN-干线BRANCH-支线)
/// </summary>
public string FstShipCapacity { get; set; }
/// <summary>
/// 一程运力类型名称MAIN-干线BRANCH-支线)
/// </summary>
public string FstShipCapacityName { get; set; }
/// <summary>
/// 一程ETD
/// </summary>
public Nullable<DateTime> FstETD { get; set; }
/// <summary>
/// 一程船名
/// </summary>
public string FstVessel { get; set; }
/// <summary>
/// 一程航次号
/// </summary>
public string FstVoyno { get; set; }
/// <summary>
/// 一程装货港代码
/// </summary>
public string FstPortLoadCode { get; set; }
/// <summary>
/// 一程装货港名称
/// </summary>
public string FstPortLoad { get; set; }
/// <summary>
/// 一程卸货港代码
/// </summary>
public string FstPortDischargeCode { get; set; }
/// <summary>
/// 一程卸货港名称
/// </summary>
public string FstPortDischarge { get; set; }
/// <summary>
/// 一程港属类型LOCATION-本港)
/// </summary>
public string FstTransferLocType { get; set; }
/// <summary>
/// 一程港属类型名称LOCATION-本港)
/// </summary>
public string FstTransferLogTypeName { get; set; }
/// <summary>
/// 一程航线
/// </summary>
public string FstLaneName { get; set; }
/// <summary>
/// 二程运力类型MAIN-干线BRANCH-支线)
/// </summary>
public string SecShipCapacity { get; set; }
/// <summary>
/// 二程运力类型名称MAIN-干线BRANCH-支线)
/// </summary>
public string SecShipCapacityName { get; set; }
/// <summary>
/// 二程ETD
/// </summary>
public Nullable<DateTime> SecETD { get; set; }
/// <summary>
/// 二程船名
/// </summary>
public string SecVessel { get; set; }
/// <summary>
/// 二程航次号
/// </summary>
public string SecVoyno { get; set; }
/// <summary>
/// 二程装货港代码
/// </summary>
public string SecPortLoadCode { get; set; }
/// <summary>
/// 二程装货港名称
/// </summary>
public string SecPortLoad { get; set; }
/// <summary>
/// 二程卸货港代码
/// </summary>
public string SecPortDischargeCode { get; set; }
/// <summary>
/// 二程卸货港名称
/// </summary>
public string SecPortDischarge { get; set; }
/// <summary>
/// 二程港属类型LOCATION-本港)
/// </summary>
public string SecTransferLocType { get; set; }
/// <summary>
/// 二程港属类型名称LOCATION-本港)
/// </summary>
public string SecTransferLogTypeName { get; set; }
/// <summary>
/// 二程航线
/// </summary>
public string SecLaneName { get; set; }
/// <summary>
/// 三程运力类型MAIN-干线BRANCH-支线)
/// </summary>
public string ThdShipCapacity { get; set; }
/// <summary>
/// 三程运力类型名称MAIN-干线BRANCH-支线)
/// </summary>
public string ThdShipCapacityName { get; set; }
/// <summary>
/// 三程ETD
/// </summary>
public Nullable<DateTime> ThdETD { get; set; }
/// <summary>
/// 三程船名
/// </summary>
public string ThdVessel { get; set; }
/// <summary>
/// 三程航次号
/// </summary>
public string ThdVoyno { get; set; }
/// <summary>
/// 三程装货港代码
/// </summary>
public string ThdPortLoadCode { get; set; }
/// <summary>
/// 三程装货港名称
/// </summary>
public string ThdPortLoad { get; set; }
/// <summary>
/// 三程卸货港代码
/// </summary>
public string ThdPortDischargeCode { get; set; }
/// <summary>
/// 三程卸货港名称
/// </summary>
public string ThdPortDischarge { get; set; }
/// <summary>
/// 三程港属类型LOCATION-本港)
/// </summary>
public string ThdTransferLocType { get; set; }
/// <summary>
/// 三程港属类型名称LOCATION-本港)
/// </summary>
public string ThdTransferLogTypeName { get; set; }
/// <summary>
/// 三程航线
/// </summary>
public string ThdLaneName { get; set; }
}
}

@ -1,5 +1,7 @@
using DocumentFormat.OpenXml.ExtendedProperties;
using Google.Protobuf.WellKnownTypes;
using Mapster.Utils;
using MathNet.Numerics.LinearAlgebra.Factorization;
using Myshipping.Application.EDI.ESL;
using MySqlX.XDevAPI.Common;
using Newtonsoft.Json;
@ -203,6 +205,101 @@ namespace Myshipping.Application.EDI.SITC
});
}
/*
1. OUTTRA
2. json clen1-3
3.线线 线0 线1
4. SITC
5. cCommodity 0
*/
if (InttrEdi.SITCExt != null && !string.IsNullOrWhiteSpace(InttrEdi.SITCExt.TransferType) && !InttrEdi.SITCExt.TransferType.Equals("DIRECT",StringComparison.OrdinalIgnoreCase))
{
if (InttrEdi.SITCExt.TransferType.Equals("SECOND", StringComparison.OrdinalIgnoreCase))
{
postModel.extras.Add(new SitcApiPostModelExtra
{
ctype = "TRA",
clen = 1,
cnum = InttrEdi.SITCExt.FstShipCapacity == "MAIN" ? 1 : 0,
vent = InttrEdi.SITCExt.FstVoyno?.Trim(),
humdity = InttrEdi.SITCExt.FstVessel?.Trim(),
soc = InttrEdi.SITCExt.FstLaneName?.Trim(),
unit = InttrEdi.SITCExt.FstPortLoad,
tempSetting = InttrEdi.SITCExt.FstPortDischarge,
tempMax = InttrEdi.SITCExt.FstPortLoadCode,
tempMin = InttrEdi.SITCExt.FstPortDischargeCode,
etd = InttrEdi.SITCExt.FstETD.HasValue? InttrEdi.SITCExt.FstETD.Value.ToString("yyyy-MM-dd"):"",
cCommodity = "0"
});
postModel.extras.Add(new SitcApiPostModelExtra
{
ctype = "TRA",
clen = 2,
cnum = InttrEdi.SITCExt.SecShipCapacity == "MAIN" ? 1 : 0,
vent = InttrEdi.SITCExt.SecVoyno?.Trim(),
humdity = InttrEdi.SITCExt.SecVessel?.Trim(),
soc = InttrEdi.SITCExt.SecLaneName?.Trim(),
unit = InttrEdi.SITCExt.SecPortLoad,
tempSetting = InttrEdi.SITCExt.SecPortDischarge,
tempMax = InttrEdi.SITCExt.SecPortLoadCode,
tempMin = InttrEdi.SITCExt.SecPortDischargeCode,
etd = InttrEdi.SITCExt.SecETD.HasValue ? InttrEdi.SITCExt.SecETD.Value.ToString("yyyy-MM-dd") : "",
cCommodity = "0"
});
}
else if (InttrEdi.SITCExt.TransferType.Equals("THIRD", StringComparison.OrdinalIgnoreCase))
{
postModel.extras.Add(new SitcApiPostModelExtra
{
ctype = "TRA",
clen = 1,
cnum = InttrEdi.SITCExt.FstShipCapacity == "MAIN" ? 1 : 0,
vent = InttrEdi.SITCExt.FstVoyno?.Trim(),
humdity = InttrEdi.SITCExt.FstVessel?.Trim(),
soc = InttrEdi.SITCExt.FstLaneName?.Trim(),
unit = InttrEdi.SITCExt.FstPortLoad,
tempSetting = InttrEdi.SITCExt.FstPortDischarge,
tempMax = InttrEdi.SITCExt.FstPortLoadCode,
tempMin = InttrEdi.SITCExt.FstPortDischargeCode,
etd = InttrEdi.SITCExt.FstETD.HasValue ? InttrEdi.SITCExt.FstETD.Value.ToString("yyyy-MM-dd") : "",
cCommodity = "0"
});
postModel.extras.Add(new SitcApiPostModelExtra
{
ctype = "TRA",
clen = 2,
cnum = InttrEdi.SITCExt.SecShipCapacity == "MAIN" ? 1 : 0,
vent = InttrEdi.SITCExt.SecVoyno?.Trim(),
humdity = InttrEdi.SITCExt.SecVessel?.Trim(),
soc = InttrEdi.SITCExt.SecLaneName?.Trim(),
unit = InttrEdi.SITCExt.SecPortLoad,
tempSetting = InttrEdi.SITCExt.SecPortDischarge,
tempMax = InttrEdi.SITCExt.SecPortLoadCode,
tempMin = InttrEdi.SITCExt.SecPortDischargeCode,
etd = InttrEdi.SITCExt.SecETD.HasValue ? InttrEdi.SITCExt.SecETD.Value.ToString("yyyy-MM-dd") : "",
cCommodity = "0"
});
postModel.extras.Add(new SitcApiPostModelExtra
{
ctype = "TRA",
clen = 3,
cnum = InttrEdi.SITCExt.ThdShipCapacity == "MAIN" ? 1 : 0,
vent = InttrEdi.SITCExt.ThdVoyno?.Trim(),
humdity = InttrEdi.SITCExt.ThdVessel?.Trim(),
soc = InttrEdi.SITCExt.ThdLaneName?.Trim(),
unit = InttrEdi.SITCExt.ThdPortLoad,
tempSetting = InttrEdi.SITCExt.ThdPortDischarge,
tempMax = InttrEdi.SITCExt.ThdPortLoadCode,
tempMin = InttrEdi.SITCExt.ThdPortDischargeCode,
etd = InttrEdi.SITCExt.ThdETD.HasValue ? InttrEdi.SITCExt.ThdETD.Value.ToString("yyyy-MM-dd") : "",
cCommodity = "0"
});
}
}
string json = JsonConvert.SerializeObject(postModel, Formatting.Indented, new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
@ -573,6 +670,31 @@ namespace Myshipping.Application.EDI.SITC
/// 类型
/// </summary>
public string ctype { get; set; }
/// <summary>
/// 程次(TRA)
/// </summary>
public Nullable<int> clen { get; set; }
/// <summary>
/// 支线:0;干线:1(TRA)
/// </summary>
public Nullable<int> cnum { get; set; }
/// <summary>
/// 航线代码
/// </summary>
public string soc { get; set; }
/// <summary>
/// 开航日
/// </summary>
public string etd { get; set; }
/// <summary>
/// 运输类型
/// </summary>
public string cCommodity { get; set; }
}
public class SitcApiPostModelDangerInfo

@ -75,5 +75,195 @@ namespace Myshipping.Application.Entity
/// 付费方式代码
/// </summary>
public string PAYABLE { get; set; }
/// <summary>
/// 运程类型DIRECT-直达SECOND-二程THIRD-三程)
/// </summary>
public string TransferType { get; set; }
/// <summary>
/// 运程类型名称DIRECT-直达SECOND-二程THIRD-三程)
/// </summary>
public string TransferTypeName { get; set; }
/// <summary>
/// 一程运力类型MAIN-干线BRANCH-支线)
/// </summary>
public string FstShipCapacity { get; set; }
/// <summary>
/// 一程运力类型名称MAIN-干线BRANCH-支线)
/// </summary>
public string FstShipCapacityName { get; set; }
/// <summary>
/// 一程ETD
/// </summary>
public Nullable<DateTime> FstETD { get; set; }
/// <summary>
/// 一程船名
/// </summary>
public string FstVessel { get; set; }
/// <summary>
/// 一程航次号
/// </summary>
public string FstVoyno { get; set; }
/// <summary>
/// 一程装货港代码
/// </summary>
public string FstPortLoadCode { get; set; }
/// <summary>
/// 一程装货港名称
/// </summary>
public string FstPortLoad { get; set; }
/// <summary>
/// 一程卸货港代码
/// </summary>
public string FstPortDischargeCode { get; set; }
/// <summary>
/// 一程卸货港名称
/// </summary>
public string FstPortDischarge { get; set; }
/// <summary>
/// 一程港属类型LOCATION-本港)
/// </summary>
public string FstTransferLocType { get; set; }
/// <summary>
/// 一程港属类型名称LOCATION-本港)
/// </summary>
public string FstTransferLogTypeName { get; set; }
/// <summary>
/// 一程航线
/// </summary>
public string FstLaneName { get; set; }
/// <summary>
/// 二程运力类型MAIN-干线BRANCH-支线)
/// </summary>
public string SecShipCapacity { get; set; }
/// <summary>
/// 二程运力类型名称MAIN-干线BRANCH-支线)
/// </summary>
public string SecShipCapacityName { get; set; }
/// <summary>
/// 二程ETD
/// </summary>
public Nullable<DateTime> SecETD { get; set; }
/// <summary>
/// 二程船名
/// </summary>
public string SecVessel { get; set; }
/// <summary>
/// 二程航次号
/// </summary>
public string SecVoyno { get; set; }
/// <summary>
/// 二程装货港代码
/// </summary>
public string SecPortLoadCode { get; set; }
/// <summary>
/// 二程装货港名称
/// </summary>
public string SecPortLoad { get; set; }
/// <summary>
/// 二程卸货港代码
/// </summary>
public string SecPortDischargeCode { get; set; }
/// <summary>
/// 二程卸货港名称
/// </summary>
public string SecPortDischarge { get; set; }
/// <summary>
/// 二程港属类型LOCATION-本港)
/// </summary>
public string SecTransferLocType { get; set; }
/// <summary>
/// 二程港属类型名称LOCATION-本港)
/// </summary>
public string SecTransferLogTypeName { get; set; }
/// <summary>
/// 二程航线
/// </summary>
public string SecLaneName { get; set; }
/// <summary>
/// 三程运力类型MAIN-干线BRANCH-支线)
/// </summary>
public string ThdShipCapacity { get; set; }
/// <summary>
/// 三程运力类型名称MAIN-干线BRANCH-支线)
/// </summary>
public string ThdShipCapacityName { get; set; }
/// <summary>
/// 三程ETD
/// </summary>
public Nullable<DateTime> ThdETD { get; set; }
/// <summary>
/// 三程船名
/// </summary>
public string ThdVessel { get; set; }
/// <summary>
/// 三程航次号
/// </summary>
public string ThdVoyno { get; set; }
/// <summary>
/// 三程装货港代码
/// </summary>
public string ThdPortLoadCode { get; set; }
/// <summary>
/// 三程装货港名称
/// </summary>
public string ThdPortLoad { get; set; }
/// <summary>
/// 三程卸货港代码
/// </summary>
public string ThdPortDischargeCode { get; set; }
/// <summary>
/// 三程卸货港名称
/// </summary>
public string ThdPortDischarge { get; set; }
/// <summary>
/// 三程港属类型LOCATION-本港)
/// </summary>
public string ThdTransferLocType { get; set; }
/// <summary>
/// 三程港属类型名称LOCATION-本港)
/// </summary>
public string ThdTransferLogTypeName { get; set; }
/// <summary>
/// 三程航线
/// </summary>
public string ThdLaneName { get; set; }
}
}

@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using SqlSugar;
using Myshipping.Core.Entity;
using System.ComponentModel;
namespace Myshipping.Application
{
/// <summary>
/// 舱位管理主信息
/// </summary>
[SugarTable("booking_slot_base", TableDescription = "舱位管理主信息")]
public class BookingSlotChangeRecord : DBEntityTenant
{
/// <summary>
/// 舱位主键
/// </summary>
[SugarColumn(ColumnName = "SLOT_ID")]
[Description("舱位主键")]
public Nullable<long> SLOT_ID { get; set; }
/// <summary>
/// 订单主键
/// </summary>
[SugarColumn(ColumnName = "BOOKING_ID")]
[Description("订单主键")]
public Nullable<long> BOOKING_ID { get; set; }
/// <summary>
/// 变更类型标记 BEFORE-变更前CURRENT-变更后
/// </summary>
[SugarColumn(ColumnName = "CHANGE_FLAG")]
[Description("变更类型标记")]
public string CHANGE_FLAG { get; set; }
/// <summary>
/// 变更范围类型 SINGLE-单票变更,ALLSHIP-整船变更(例如截止时间变更)
/// </summary>
[SugarColumn(ColumnName = "CHANGE_RANGE")]
[Description("变更类型标记")]
public string CHANGE_RANGE { get; set; }
/// <summary>
/// 主提单号
/// </summary>
[SugarColumn(ColumnName = "MBL_NO")]
[Description("主提单号")]
public string MBL_NO { get; set; }
/// <summary>
/// 真提单号
/// </summary>
[SugarColumn(ColumnName = "REAL_MBL_NO")]
[Description("真提单号")]
public string REAL_MBL_NO { get; set; }
/// <summary>
/// 合约号
/// </summary>
[SugarColumn(ColumnName = "CONTRACT_NO")]
[Description("合约号")]
public string CONTRACT_NO { get; set; }
/// <summary>
/// 订舱抬头
/// </summary>
[SugarColumn(ColumnName = "BOOKING_PARTY")]
[Description("订舱抬头")]
public string BOOKING_PARTY { get; set; }
}
}

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
public class BookingSlotChangeRecordNotify
{
}
}

@ -26,6 +26,7 @@
<Compile Remove="Service\BookingCtn\BookingCtnService.cs" />
<Compile Remove="Service\BookingCtn\IBookingCtnService.cs" />
<Compile Remove="Service\TaskManagePlat\Dtos\TaskManageOrderVGMFeedBackInfo.cs" />
<Compile Remove="Service\TrackingSystem\Dtos\QueryTaskManageBaseDto.cs" />
</ItemGroup>
<ItemGroup>

@ -39,6 +39,7 @@ using Myshipping.Core.Service;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NPOI.HSSF.UserModel;
using NPOI.POIFS.Properties;
using NPOI.SS.UserModel;
using RabbitMQ.Client;
using SqlSugar;
@ -8246,6 +8247,497 @@ namespace Myshipping.Application
primaryModel.FEETYPE = multiline.FEETYPE;
primaryModel.PAYABLEEXT = multiline.PAYABLE;
#region 必填校验
//校验所有填写项必填ETD必须顺序填写
if (string.IsNullOrWhiteSpace(multiline.TransferType) && multiline.TransferType.Equals("SECOND", StringComparison.OrdinalIgnoreCase))
{
List<string> checkSITCList = new List<string>();
if(!multiline.FstETD.HasValue)
{
checkSITCList.Add("一程开船日期");
}
if (!multiline.SecETD.HasValue)
{
checkSITCList.Add("二程开船日期");
}
if (multiline.FstETD.Value >= multiline.SecETD.Value)
{
checkSITCList.Add("一程开船日期不能大于等于二程开船日期");
}
if (string.IsNullOrWhiteSpace(multiline.FstPortLoadCode))
{
checkSITCList.Add("一程装货港代码");
}
if (string.IsNullOrWhiteSpace(multiline.FstPortLoad))
{
checkSITCList.Add("一程装货港");
}
if (string.IsNullOrWhiteSpace(multiline.FstPortDischargeCode))
{
checkSITCList.Add("一程卸货港代码");
}
if (string.IsNullOrWhiteSpace(multiline.FstPortDischarge))
{
checkSITCList.Add("一程卸货港");
}
if (string.IsNullOrWhiteSpace(multiline.FstVessel))
{
checkSITCList.Add("一程船名");
}
if (string.IsNullOrWhiteSpace(multiline.FstVoyno))
{
checkSITCList.Add("一程航次");
}
if (string.IsNullOrWhiteSpace(multiline.FstLaneName))
{
checkSITCList.Add("一程航线");
}
if (string.IsNullOrWhiteSpace(multiline.SecPortLoadCode))
{
checkSITCList.Add("二程装货港代码");
}
if (string.IsNullOrWhiteSpace(multiline.SecPortLoad))
{
checkSITCList.Add("二程装货港");
}
if (string.IsNullOrWhiteSpace(multiline.SecPortDischargeCode))
{
checkSITCList.Add("二程卸货港代码");
}
if (string.IsNullOrWhiteSpace(multiline.SecPortDischarge))
{
checkSITCList.Add("二程卸货港");
}
if (string.IsNullOrWhiteSpace(multiline.SecVessel))
{
checkSITCList.Add("二程船名");
}
if (string.IsNullOrWhiteSpace(multiline.SecVoyno))
{
checkSITCList.Add("二程航次");
}
if (string.IsNullOrWhiteSpace(multiline.SecLaneName))
{
checkSITCList.Add("二程航线");
}
if (checkSITCList.Count > 0)
{
throw Oops.Oh(string.Join(",", checkSITCList.ToArray()) + " 必填");
}
}
if (string.IsNullOrWhiteSpace(multiline.TransferType) && multiline.TransferType.Equals("THIRD", StringComparison.OrdinalIgnoreCase))
{
List<string> checkSITCList = new List<string>();
if (!multiline.FstETD.HasValue)
{
checkSITCList.Add("一程开船日期必填");
}
if (!multiline.SecETD.HasValue)
{
checkSITCList.Add("二程开船日期必填");
}
if (!multiline.ThdETD.HasValue)
{
checkSITCList.Add("三程开船日期必填");
}
if (multiline.FstETD.Value >= multiline.SecETD.Value)
{
checkSITCList.Add("一程开船日期不能大于等于二程开船日期");
}
if (multiline.SecETD.Value >= multiline.ThdETD.Value)
{
checkSITCList.Add("二程开船日期不能大于等于三程开船日期");
}
if (string.IsNullOrWhiteSpace(multiline.FstPortLoadCode))
{
checkSITCList.Add("一程装货港代码");
}
if (string.IsNullOrWhiteSpace(multiline.FstPortLoad))
{
checkSITCList.Add("一程装货港");
}
if (string.IsNullOrWhiteSpace(multiline.FstPortDischargeCode))
{
checkSITCList.Add("一程卸货港代码");
}
if (string.IsNullOrWhiteSpace(multiline.FstPortDischarge))
{
checkSITCList.Add("一程卸货港");
}
if (string.IsNullOrWhiteSpace(multiline.FstVessel))
{
checkSITCList.Add("一程船名");
}
if (string.IsNullOrWhiteSpace(multiline.FstVoyno))
{
checkSITCList.Add("一程航次");
}
if (string.IsNullOrWhiteSpace(multiline.FstLaneName))
{
checkSITCList.Add("一程航线");
}
if (string.IsNullOrWhiteSpace(multiline.SecPortLoadCode))
{
checkSITCList.Add("二程装货港代码");
}
if (string.IsNullOrWhiteSpace(multiline.SecPortLoad))
{
checkSITCList.Add("二程装货港");
}
if (string.IsNullOrWhiteSpace(multiline.SecPortDischargeCode))
{
checkSITCList.Add("二程卸货港代码");
}
if (string.IsNullOrWhiteSpace(multiline.SecPortDischarge))
{
checkSITCList.Add("二程卸货港");
}
if (string.IsNullOrWhiteSpace(multiline.SecVessel))
{
checkSITCList.Add("二程船名");
}
if (string.IsNullOrWhiteSpace(multiline.SecVoyno))
{
checkSITCList.Add("二程航次");
}
if (string.IsNullOrWhiteSpace(multiline.SecLaneName))
{
checkSITCList.Add("二程航线");
}
if (string.IsNullOrWhiteSpace(multiline.ThdPortLoadCode))
{
checkSITCList.Add("三程装货港代码");
}
if (string.IsNullOrWhiteSpace(multiline.ThdPortLoad))
{
checkSITCList.Add("三程装货港");
}
if (string.IsNullOrWhiteSpace(multiline.ThdPortDischargeCode))
{
checkSITCList.Add("三程卸货港代码");
}
if (string.IsNullOrWhiteSpace(multiline.ThdPortDischarge))
{
checkSITCList.Add("三程卸货港");
}
if (string.IsNullOrWhiteSpace(multiline.ThdVessel))
{
checkSITCList.Add("三程船名");
}
if (string.IsNullOrWhiteSpace(multiline.ThdVoyno))
{
checkSITCList.Add("三程航次");
}
if (string.IsNullOrWhiteSpace(multiline.ThdLaneName))
{
checkSITCList.Add("三程航线");
}
if (checkSITCList.Count > 0)
{
throw Oops.Oh(string.Join(",", checkSITCList.ToArray()) + " 必填");
}
}
#endregion
#region 映射港口
//一程装货港
if (!string.IsNullOrWhiteSpace(multiline.FstPortLoadCode))
{
var currPortInfo = ediLoadPortList.FirstOrDefault(a =>
a.Code.Equals(multiline.FstPortLoadCode, StringComparison.OrdinalIgnoreCase));
if (currPortInfo != null)
{
multiline.FstPortLoadCode = currPortInfo.MapCode?.Trim();
multiline.FstPortLoad = currPortInfo.MapName?.Trim();
}
else
{
var codePortList = portList.Where(a =>
!string.IsNullOrWhiteSpace(a.EdiCode)
&& a.EdiCode.Equals(multiline.FstPortLoadCode, StringComparison.OrdinalIgnoreCase))
.Select(a => a.Code).ToList();
if (codePortList.Count > 0)
{
var currTPortInfo = ediPortList.FirstOrDefault(a =>
codePortList.Contains(a.Code)
&& !string.IsNullOrWhiteSpace(a.CarrierCode)
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
if (currTPortInfo != null)
{
multiline.FstPortLoadCode = currTPortInfo.MapCode?.Trim();
multiline.FstPortLoad = currTPortInfo.MapName?.Trim();
}
else
{
throw Oops.Bah($"一程装货港{multiline.FstPortLoadCode}的映射EDI代码未找到");
}
}
else
{
throw Oops.Bah($"一程装货港{multiline.FstPortLoadCode}基础港口代码未找到");
}
}
}
//一程卸货港
if (!string.IsNullOrWhiteSpace(multiline.FstPortDischargeCode))
{
var currPortInfo = ediLoadPortList.FirstOrDefault(a =>
a.Code.Equals(multiline.FstPortDischargeCode, StringComparison.OrdinalIgnoreCase));
if (currPortInfo != null)
{
multiline.FstPortDischargeCode = currPortInfo.MapCode?.Trim();
multiline.FstPortDischarge = currPortInfo.MapName?.Trim();
}
else
{
var codePortList = portList.Where(a =>
!string.IsNullOrWhiteSpace(a.EdiCode)
&& a.EdiCode.Equals(multiline.FstPortDischargeCode, StringComparison.OrdinalIgnoreCase))
.Select(a => a.Code).ToList();
if (codePortList.Count > 0)
{
var currTPortInfo = ediPortList.FirstOrDefault(a =>
codePortList.Contains(a.Code)
&& !string.IsNullOrWhiteSpace(a.CarrierCode)
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
if (currTPortInfo != null)
{
multiline.FstPortDischargeCode = currTPortInfo.MapCode?.Trim();
multiline.FstPortDischarge = currTPortInfo.MapName?.Trim();
}
else
{
throw Oops.Bah($"一程卸货港{multiline.FstPortDischargeCode}的映射EDI代码未找到");
}
}
else
{
throw Oops.Bah($"一程卸货港{multiline.FstPortDischargeCode}基础港口代码未找到");
}
}
}
//二程装货港
if (!string.IsNullOrWhiteSpace(multiline.SecPortLoadCode))
{
var currPortInfo = ediLoadPortList.FirstOrDefault(a =>
a.Code.Equals(multiline.SecPortLoadCode, StringComparison.OrdinalIgnoreCase));
if (currPortInfo != null)
{
multiline.SecPortLoadCode = currPortInfo.MapCode?.Trim();
multiline.SecPortLoad = currPortInfo.MapName?.Trim();
}
else
{
var codePortList = portList.Where(a =>
!string.IsNullOrWhiteSpace(a.EdiCode)
&& a.EdiCode.Equals(multiline.SecPortLoadCode, StringComparison.OrdinalIgnoreCase))
.Select(a => a.Code).ToList();
if (codePortList.Count > 0)
{
var currTPortInfo = ediPortList.FirstOrDefault(a =>
codePortList.Contains(a.Code)
&& !string.IsNullOrWhiteSpace(a.CarrierCode)
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
if (currTPortInfo != null)
{
multiline.SecPortLoadCode = currTPortInfo.MapCode?.Trim();
multiline.SecPortLoad = currTPortInfo.MapName?.Trim();
}
else
{
throw Oops.Bah($"二程装货港{multiline.FstPortDischargeCode}的映射EDI代码未找到");
}
}
else
{
throw Oops.Bah($"二程装货港{multiline.FstPortDischargeCode}基础港口代码未找到");
}
}
}
//二程卸货港
if (!string.IsNullOrWhiteSpace(multiline.SecPortDischargeCode))
{
var currPortInfo = ediLoadPortList.FirstOrDefault(a =>
a.Code.Equals(multiline.SecPortDischargeCode, StringComparison.OrdinalIgnoreCase));
if (currPortInfo != null)
{
multiline.SecPortDischargeCode = currPortInfo.MapCode?.Trim();
multiline.SecPortDischarge = currPortInfo.MapName?.Trim();
}
else
{
var codePortList = portList.Where(a =>
!string.IsNullOrWhiteSpace(a.EdiCode)
&& a.EdiCode.Equals(multiline.SecPortDischargeCode, StringComparison.OrdinalIgnoreCase))
.Select(a => a.Code).ToList();
if (codePortList.Count > 0)
{
var currTPortInfo = ediPortList.FirstOrDefault(a =>
codePortList.Contains(a.Code)
&& !string.IsNullOrWhiteSpace(a.CarrierCode)
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
if (currTPortInfo != null)
{
multiline.SecPortDischargeCode = currTPortInfo.MapCode?.Trim();
multiline.SecPortDischarge = currTPortInfo.MapName?.Trim();
}
else
{
throw Oops.Bah($"二程卸货港{multiline.FstPortDischargeCode}的映射EDI代码未找到");
}
}
else
{
throw Oops.Bah($"二程卸货港{multiline.FstPortDischargeCode}基础港口代码未找到");
}
}
}
//三程装货港
if (!string.IsNullOrWhiteSpace(multiline.ThdPortLoadCode))
{
var currPortInfo = ediLoadPortList.FirstOrDefault(a =>
a.Code.Equals(multiline.ThdPortLoadCode, StringComparison.OrdinalIgnoreCase));
if (currPortInfo != null)
{
multiline.ThdPortLoadCode = currPortInfo.MapCode?.Trim();
multiline.ThdPortLoad = currPortInfo.MapName?.Trim();
}
else
{
var codePortList = portList.Where(a =>
!string.IsNullOrWhiteSpace(a.EdiCode)
&& a.EdiCode.Equals(multiline.ThdPortLoadCode, StringComparison.OrdinalIgnoreCase))
.Select(a => a.Code).ToList();
if (codePortList.Count > 0)
{
var currTPortInfo = ediPortList.FirstOrDefault(a =>
codePortList.Contains(a.Code)
&& !string.IsNullOrWhiteSpace(a.CarrierCode)
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
if (currTPortInfo != null)
{
multiline.ThdPortLoadCode = currTPortInfo.MapCode?.Trim();
multiline.ThdPortLoad = currTPortInfo.MapName?.Trim();
}
else
{
throw Oops.Bah($"三程装货港{multiline.FstPortDischargeCode}的映射EDI代码未找到");
}
}
else
{
throw Oops.Bah($"三程装货港{multiline.FstPortDischargeCode}基础港口代码未找到");
}
}
}
//三程卸货港
if (!string.IsNullOrWhiteSpace(multiline.ThdPortDischargeCode))
{
var currPortInfo = ediLoadPortList.FirstOrDefault(a =>
a.Code.Equals(multiline.ThdPortDischargeCode, StringComparison.OrdinalIgnoreCase));
if (currPortInfo != null)
{
multiline.ThdPortDischargeCode = currPortInfo.MapCode?.Trim();
multiline.ThdPortDischarge = currPortInfo.MapName?.Trim();
}
else
{
var codePortList = portList.Where(a =>
!string.IsNullOrWhiteSpace(a.EdiCode)
&& a.EdiCode.Equals(multiline.ThdPortDischargeCode, StringComparison.OrdinalIgnoreCase))
.Select(a => a.Code).ToList();
if (codePortList.Count > 0)
{
var currTPortInfo = ediPortList.FirstOrDefault(a =>
codePortList.Contains(a.Code)
&& !string.IsNullOrWhiteSpace(a.CarrierCode)
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
if (currTPortInfo != null)
{
multiline.ThdPortDischargeCode = currTPortInfo.MapCode?.Trim();
multiline.ThdPortDischarge = currTPortInfo.MapName?.Trim();
}
else
{
throw Oops.Bah($"三程卸货港{multiline.FstPortDischargeCode}的映射EDI代码未找到");
}
}
else
{
throw Oops.Bah($"三程卸货港{multiline.FstPortDischargeCode}基础港口代码未找到");
}
}
}
#endregion
ediModel.SITCExt = multiline.Adapt<SITCExtInfo>();
}
}
@ -11017,7 +11509,10 @@ namespace Myshipping.Application
}
}
List<ServiceProjectStatusDto> statusList = new List<ServiceProjectStatusDto>();
//是否已截单
bool hasJDStatus = false;
List <ServiceProjectStatusDto> statusList = new List<ServiceProjectStatusDto>();
if (App.Configuration["ServiceStatusOpenAuto"] == "1")
{
@ -11042,6 +11537,11 @@ namespace Myshipping.Application
{
dto.CtnDayNum = statusList.FirstOrDefault(x => x.StatusSKUCode == "SQXS" && x.IsYield)?.ActVal;
}
if (statusList != null && statusList.Any(x => x.StatusSKUCode == "JD" && x.IsYield))
{
hasJDStatus = statusList.FirstOrDefault(x => x.StatusSKUCode == "JD" && x.IsYield).IsYield;
}
}
else
{
@ -11075,7 +11575,7 @@ namespace Myshipping.Application
{
List<BookingOrder> allOrderList = new List<BookingOrder>();
if (!string.IsNullOrWhiteSpace(oddCode) && oddCode.Equals("SIReceipt", StringComparison.OrdinalIgnoreCase))
if ((!string.IsNullOrWhiteSpace(oddCode) && oddCode.Equals("SIReceipt", StringComparison.OrdinalIgnoreCase)) || hasJDStatus)
{
allOrderList = await _rep.AsQueryable().Filter(null, true).Where(x => x.Id == item.Id
&& x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
@ -12386,6 +12886,91 @@ namespace Myshipping.Application
result.succ = true;
result.extra = sitcModel;
var record = _repBookingMultiLineSplitRecord.AsQueryable().Where(a => a.BOOKING_ID == model.Id).OrderByDescending(a => a.CreatedTime).First();
if (record != null)
{
if(string.IsNullOrWhiteSpace(record.TransferType) || record.TransferType.Equals("SECOND",StringComparison.OrdinalIgnoreCase)
|| record.TransferType.Equals("THIRD", StringComparison.OrdinalIgnoreCase))
{
if(string.IsNullOrWhiteSpace(record.FstPortLoadCode) && !string.IsNullOrWhiteSpace(order.PORTLOADID))
{
record.FstPortLoadCode = order.PORTLOADID;
record.FstPortLoad = order.PORTLOAD;
}
if(record.TransferType.Equals("SECOND", StringComparison.OrdinalIgnoreCase))
{
if (string.IsNullOrWhiteSpace(record.SecPortDischargeCode) && !string.IsNullOrWhiteSpace(order.PORTDISCHARGEID))
{
record.SecPortDischargeCode = order.PORTDISCHARGEID;
record.SecPortDischarge = order.PORTDISCHARGE;
}
}
else if (record.TransferType.Equals("THIRD", StringComparison.OrdinalIgnoreCase))
{
if (string.IsNullOrWhiteSpace(record.ThdPortDischargeCode) && !string.IsNullOrWhiteSpace(order.PORTDISCHARGEID))
{
record.ThdPortDischargeCode = order.PORTDISCHARGEID;
record.ThdPortDischarge = order.PORTDISCHARGE;
}
}
if (string.IsNullOrWhiteSpace(record.FstVessel) && !string.IsNullOrWhiteSpace(order.VESSEL))
{
record.FstVessel = order.VESSEL;
}
if (string.IsNullOrWhiteSpace(record.FstVoyno) && !string.IsNullOrWhiteSpace(order.VOYNO))
{
record.FstVoyno = order.VOYNO;
}
if (!record.FstETD.HasValue && order.ETD.HasValue)
{
record.FstETD = order.ETD.Value;
}
}
result.extra2 = record;
}
else
{
record = new BookingMultiLineSplitRecord();
if (!string.IsNullOrWhiteSpace(order.PORTLOADID))
{
record.FstPortLoadCode = order.PORTLOADID;
record.FstPortLoad = order.PORTLOAD;
}
if (!string.IsNullOrWhiteSpace(order.PORTDISCHARGEID))
{
record.SecPortDischargeCode = order.PORTDISCHARGEID;
record.SecPortDischarge = order.PORTDISCHARGE;
record.ThdPortDischargeCode = order.PORTDISCHARGEID;
record.ThdPortDischarge = order.PORTDISCHARGE;
}
if (!string.IsNullOrWhiteSpace(order.VESSEL))
{
record.FstVessel = order.VESSEL;
}
if (!string.IsNullOrWhiteSpace(order.VOYNO))
{
record.FstVoyno = order.VOYNO;
}
if (order.ETD.HasValue)
{
record.FstETD = order.ETD.Value;
}
result.extra2 = record;
}
return result;
}

@ -70,5 +70,195 @@ namespace Myshipping.Application
/// 付费方式代码
/// </summary>
public string PAYABLE { get; set; }
/// <summary>
/// 运程类型DIRECT-直达SECOND-二程THIRD-三程)
/// </summary>
public string TransferType { get; set; }
/// <summary>
/// 运程类型名称DIRECT-直达SECOND-二程THIRD-三程)
/// </summary>
public string TransferTypeName { get; set; }
/// <summary>
/// 一程运力类型MAIN-干线BRANCH-支线)
/// </summary>
public string FstShipCapacity { get; set; }
/// <summary>
/// 一程运力类型名称MAIN-干线BRANCH-支线)
/// </summary>
public string FstShipCapacityName { get; set; }
/// <summary>
/// 一程ETD
/// </summary>
public Nullable<DateTime> FstETD { get; set; }
/// <summary>
/// 一程船名
/// </summary>
public string FstVessel { get; set; }
/// <summary>
/// 一程航次号
/// </summary>
public string FstVoyno { get; set; }
/// <summary>
/// 一程装货港代码
/// </summary>
public string FstPortLoadCode { get; set; }
/// <summary>
/// 一程装货港名称
/// </summary>
public string FstPortLoad { get; set; }
/// <summary>
/// 一程卸货港代码
/// </summary>
public string FstPortDischargeCode { get; set; }
/// <summary>
/// 一程卸货港名称
/// </summary>
public string FstPortDischarge { get; set; }
/// <summary>
/// 一程港属类型LOCATION-本港)
/// </summary>
public string FstTransferLocType { get; set; }
/// <summary>
/// 一程港属类型名称LOCATION-本港)
/// </summary>
public string FstTransferLogTypeName { get; set; }
/// <summary>
/// 一程航线
/// </summary>
public string FstLaneName { get; set; }
/// <summary>
/// 二程运力类型MAIN-干线BRANCH-支线)
/// </summary>
public string SecShipCapacity { get; set; }
/// <summary>
/// 二程运力类型名称MAIN-干线BRANCH-支线)
/// </summary>
public string SecShipCapacityName { get; set; }
/// <summary>
/// 二程ETD
/// </summary>
public Nullable<DateTime> SecETD { get; set; }
/// <summary>
/// 二程船名
/// </summary>
public string SecVessel { get; set; }
/// <summary>
/// 二程航次号
/// </summary>
public string SecVoyno { get; set; }
/// <summary>
/// 二程装货港代码
/// </summary>
public string SecPortLoadCode { get; set; }
/// <summary>
/// 二程装货港名称
/// </summary>
public string SecPortLoad { get; set; }
/// <summary>
/// 二程卸货港代码
/// </summary>
public string SecPortDischargeCode { get; set; }
/// <summary>
/// 二程卸货港名称
/// </summary>
public string SecPortDischarge { get; set; }
/// <summary>
/// 二程港属类型LOCATION-本港)
/// </summary>
public string SecTransferLocType { get; set; }
/// <summary>
/// 二程港属类型名称LOCATION-本港)
/// </summary>
public string SecTransferLogTypeName { get; set; }
/// <summary>
/// 二程航线
/// </summary>
public string SecLaneName { get; set; }
/// <summary>
/// 三程运力类型MAIN-干线BRANCH-支线)
/// </summary>
public string ThdShipCapacity { get; set; }
/// <summary>
/// 三程运力类型名称MAIN-干线BRANCH-支线)
/// </summary>
public string ThdShipCapacityName { get; set; }
/// <summary>
/// 三程ETD
/// </summary>
public Nullable<DateTime> ThdETD { get; set; }
/// <summary>
/// 三程船名
/// </summary>
public string ThdVessel { get; set; }
/// <summary>
/// 三程航次号
/// </summary>
public string ThdVoyno { get; set; }
/// <summary>
/// 三程装货港代码
/// </summary>
public string ThdPortLoadCode { get; set; }
/// <summary>
/// 三程装货港名称
/// </summary>
public string ThdPortLoad { get; set; }
/// <summary>
/// 三程卸货港代码
/// </summary>
public string ThdPortDischargeCode { get; set; }
/// <summary>
/// 三程卸货港名称
/// </summary>
public string ThdPortDischarge { get; set; }
/// <summary>
/// 三程港属类型LOCATION-本港)
/// </summary>
public string ThdTransferLocType { get; set; }
/// <summary>
/// 三程港属类型名称LOCATION-本港)
/// </summary>
public string ThdTransferLogTypeName { get; set; }
/// <summary>
/// 三程航线
/// </summary>
public string ThdLaneName { get; set; }
}
}

@ -376,7 +376,18 @@ namespace Myshipping.Application
if (opEmailList.Count > 0)
opEmail = string.Join(";", opEmailList.Distinct().ToArray());
string emailTitle = $"{model.MBL_NO}-{model.VESSEL}/{model.VOYNO}/ 未提箱订舱取消确认";
var fstOrder = bookingOrderList.FirstOrDefault();
string emailTitle = string.Empty;
if (fstOrder != null && !string.IsNullOrWhiteSpace(fstOrder.VESSEL))
{
emailTitle = $"{model.MBL_NO}-{fstOrder.VESSEL}/{fstOrder.VOYNO}/ 未提箱订舱取消确认";
}
else
{
emailTitle = $"{model.MBL_NO}-{model.VESSEL}/{model.VOYNO}/ 未提箱订舱取消确认";
}
//提取当前公共邮箱的配置
DjyUserMailAccount publicMailAccount = _djyUserMailAccount.AsQueryable().Filter(null, true).First(x => x.TenantId == UserManager.TENANT_ID && x.ShowName == "PublicSend"
@ -530,7 +541,14 @@ namespace Myshipping.Application
baseHtml = baseHtml.Replace("#BillNo#", "");
}
if (!string.IsNullOrWhiteSpace(model.VESSEL))
var fstOrderInfo = bookingOrderList.FirstOrDefault();
if (!string.IsNullOrWhiteSpace(fstOrderInfo.VESSEL))
{
string s = $"{fstOrderInfo.VESSEL}/{fstOrderInfo.VOYNO}";
baseHtml = baseHtml.Replace("#VesselVoyno#", s);
}
else if (!string.IsNullOrWhiteSpace(model.VESSEL))
{
string s = $"{model.VESSEL}/{model.VOYNO}";
baseHtml = baseHtml.Replace("#VesselVoyno#", s);

@ -9750,6 +9750,11 @@
公开数据:获取箱型映射代码
</summary>
</member>
<member name="M:Myshipping.Core.Service.CommonDBService.PortMixList(Myshipping.Core.Service.NameQueryDto)">
<summary>
起始港和目的港合并查询
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.CodeCarrierDto.Code">
<summary>
代码

@ -14,6 +14,7 @@ using Microsoft.Extensions.Logging;
using Myshipping.Core.Entity.CommonDB;
using Microsoft.AspNetCore.Authorization;
using System.Reflection.Metadata.Ecma335;
using StackExchange.Profiling.Internal;
namespace Myshipping.Core.Service;
/// <summary>
@ -2430,4 +2431,53 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
}
#endregion
#region 起始港和目的港合并查询
/// <summary>
/// 起始港和目的港合并查询
/// </summary>
[HttpGet("/commondb/portmixlist")]
public async Task<dynamic> PortMixList([FromQuery] NameQueryDto input)
{
List<CodePort> resultList = new List<CodePort>();
List<CodePortLoad> codePortLoadlist = await _sysCacheService.GetAllCodePortLoad();
List<CodePort> codePortDischargelist = await _sysCacheService.GetAllCodePort();
var queryList = codePortLoadlist.WhereIF(!string.IsNullOrEmpty(input.KeyWord),
x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) ||
x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) ||
x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
.Take(input.Limit).OrderBy(x => x.Sort).ToList();
if (queryList.Count > 0)
{
resultList = queryList.Select(a => new CodePort
{
Code = a.Code,
CnName = a.CnName,
EnName = a.EnName,
EdiCode = a.EdiCode,
}).ToList();
}
if (queryList.Count < input.Limit)
{
int lessNum = input.Limit - queryList.Count;
var queryList2 = codePortDischargelist
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
.Take(lessNum).OrderBy(x => x.Sort).ToList();
if (queryList2.Count > 0)
resultList.AddRange(queryList2);
}
return resultList;
}
#endregion
}

@ -27,6 +27,8 @@ using static System.Net.Mime.MediaTypeNames;
using RabbitMQ.Client.Events;
using Org.BouncyCastle.Utilities.Bzip2;
using ICSharpCode.SharpZipLib.BZip2;
using StackExchange.Profiling.Internal;
using System.Drawing;
Serve.RunGeneric(additional: services =>
{
@ -796,6 +798,694 @@ public class SyncHisRecord: ISyncHisRecord,ITransient
/*
*/
string mailFilePath = "C:\\Users\\Administrator\\Desktop\\日志\\Your Transport Plan has Changed - Maersk241111.eml";
//string mailFilePath = "C:\\Users\\Administrator\\Desktop\\日志\\Your Transport Plan has Changed - Maersk-带reason.eml";
//读取邮件,解析邮件正文
MimeMessage mimeMsg = MimeMessage.Load(mailFilePath);
HtmlDocument html = new HtmlDocument();
html.LoadHtml(mimeMsg.HtmlBody);
var divWrapperList = html.DocumentNode.SelectNodes("//div[@class='wrapper']");
int perNum = divWrapperList.Count / 4;
List<TransPlanHasChangeDto> list = new List<TransPlanHasChangeDto>();
int start = 1;
int currListIdx = 0;
for (int i = 0; i < divWrapperList.Count; i++)
{
/*
4
1 BILLNO,
2 ETDETA
3
*/
if (start == 1)
{
#region 第一行 BILLNO, 原因
TransPlanHasChangeDto dto = new TransPlanHasChangeDto
{
From = new TransPlanHasChangeDetailDto
{
portList = new List<TransPlanHasChangePortDto>(),
dateList = new List<TransPlanHasChangeDateDto>(),
vesselList = new List<TransPlanHasChangeVesselVoynoDto>()
},
To = new TransPlanHasChangeDetailDto
{
portList = new List<TransPlanHasChangePortDto>(),
dateList = new List<TransPlanHasChangeDateDto>(),
vesselList = new List<TransPlanHasChangeVesselVoynoDto>()
},
Carrier = "MSK",
ContaNoList = new List<string>()
};
list.Add(dto);
currListIdx = list.Count - 1;
var billnoNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[1]/table/tbody/tr[1]/td[1]/table/tbody/tr[1]/td[1]/div");
if (billnoNode != null && !string.IsNullOrWhiteSpace(billnoNode.InnerText))
{
var s = billnoNode.InnerText;
if (Regex.IsMatch(s, "Bill\\s+of\\s+Lading\\s{0,}:"))
{
var name = Regex.Match(s, "Bill\\s+of\\s+Lading\\s{0,}:").Value;
list[currListIdx].BillNo = Regex.Match(s, "(?<=" + name + ")\\s{0,}\\w+").Value?.Trim();
}
}
var bookNoNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[1]/table/tbody/tr[1]/td[1]/table/tbody/tr[2]/td[1]/div");
if (bookNoNode != null && !string.IsNullOrWhiteSpace(bookNoNode.InnerText))
{
var s = bookNoNode.InnerText;
if (Regex.IsMatch(s, "Booking\\s+Number\\s{0,}:"))
{
var name = Regex.Match(s, "Booking\\s+Number\\s{0,}:").Value;
list[currListIdx].BookingNo = Regex.Match(s, "(?<=" + name + ")\\s{0,}\\w+").Value?.Trim();
}
}
var reasonNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[2]/table/tbody/tr[1]/td[1]/table/tbody/tr[1]/td[1]/div");
if (reasonNode != null && !string.IsNullOrWhiteSpace(reasonNode.InnerText) &&
Regex.IsMatch(reasonNode.InnerText, "Reason\\s+for\\s+the\\s+change:"))
{
var reasonTxtNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[2]/table/tbody/tr[1]/td[1]/table/tbody/tr[2]/td[1]/div");
if (reasonTxtNode != null && !string.IsNullOrWhiteSpace(reasonTxtNode.InnerText))
{
list[currListIdx].ChangeReasonNotes = reasonTxtNode.InnerText;
}
}
#endregion
}
else if (start == 3)
{
#region 处理装货港
TransPlanHasChangePortDto from = null;
TransPlanHasChangePortDto from2 = null;
var loadPortNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[1]/table/tbody/tr[1]/td[1]/table/tbody/tr[2]/td/div/div/b");
if (loadPortNode != null && !string.IsNullOrWhiteSpace(loadPortNode.InnerText))
{
var s = Regex.Replace(Regex.Replace(loadPortNode.InnerText, "\r\n", " "), "\\s{2,}", " ").Trim();
from = new TransPlanHasChangePortDto
{
Indx = 1,
PortName = s.Trim(),
IsRemoved = false,
};
if (s.IndexOf(",") >= 0)
{
var sArg = s.Split(new char[] { ',' });
if (sArg.Length == 2)
{
from.PortName = sArg[0].Trim();
from.TerminalName = sArg[1].Trim();
}
}
}
else
{
loadPortNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[1]/table/tbody/tr[1]/td[1]/table/tbody/tr[2]/td/div/div");
if (loadPortNode != null && !string.IsNullOrWhiteSpace(loadPortNode.InnerText))
{
var s = Regex.Replace(Regex.Replace(loadPortNode.InnerText, "\r\n", " "), "\\s{2,}", " ").Trim();
from = new TransPlanHasChangePortDto
{
Indx = 1,
PortName = s.Trim(),
IsRemoved = false,
};
if (s.IndexOf(",") >= 0)
{
var sArg = s.Split(new char[] { ',' });
if (sArg.Length == 2)
{
from.PortName = sArg[0].Trim();
from.TerminalName = sArg[1].Trim();
}
}
}
}
if (from != null)
{
list[currListIdx].From.portList.Add(from);
}
var wasLoadPortNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[1]/table/tbody/tr[1]/td[1]/table/tbody/tr[2]/td/div/div/div");
if (wasLoadPortNode != null && !string.IsNullOrWhiteSpace(wasLoadPortNode.InnerText))
{
var s = wasLoadPortNode.InnerText;
if (Regex.IsMatch(s, "\\bwas\\s+"))
{
s = Regex.Replace(Regex.Replace(s, "\r\n", " "), "\\s{2,}", " ").Trim();
s = Regex.Match(s, "(?<=\\bwas\\s).*").Value;
from2 = new TransPlanHasChangePortDto
{
Indx = 2,
PortName = s.Trim(),
IsRemoved = true,
};
if (s.IndexOf(",") >= 0)
{
var sArg = s.Split(new char[] { ',' });
if (sArg.Length == 2)
{
from2.PortName = sArg[0].Trim();
from2.TerminalName = sArg[1].Trim();
}
}
}
}
if (from2 != null)
{
list[currListIdx].From.portList.Add(from2);
}
#endregion
#region 处理ETD
TransPlanHasChangeDateDto fromETD = null;
TransPlanHasChangeDateDto fromETD2 = null;
var etdNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[1]/table/tbody/tr[1]/td[1]/table/tbody/tr[3]/td/div/div/b");
if (etdNode != null && !string.IsNullOrWhiteSpace(etdNode.InnerText))
{
var s = etdNode.InnerText;
s = Regex.Replace(s, "\r\n", " ").Trim();
s = Regex.Replace(s, "\\(\\s{0,}ETD\\s{0,}\\)", " ").Trim();
s = Regex.Replace(Regex.Replace(s,","," "), "\\s{2,}", " ").Trim();
DateTime etd = DateTime.Parse(s);
fromETD = new TransPlanHasChangeDateDto
{
Indx = 1,
DateVal = etd,
OrigDateTxt = Regex.Replace(etdNode.InnerText, "\r\n", " ").Trim(),
IsRemoved = false,
};
}
else
{
etdNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[1]/table/tbody/tr[1]/td[1]/table/tbody/tr[3]/td/div/div");
if (etdNode != null && !string.IsNullOrWhiteSpace(etdNode.InnerText))
{
var s = etdNode.InnerText;
s = Regex.Replace(s, "\r\n", " ").Trim();
s = Regex.Replace(s, "\\(\\s{0,}ETD\\s{0,}\\)", " ").Trim();
s = Regex.Replace(Regex.Replace(s, ",", " "), "\\s{2,}", " ").Trim();
DateTime etd = DateTime.Parse(s);
fromETD = new TransPlanHasChangeDateDto
{
Indx = 1,
DateVal = etd,
OrigDateTxt = Regex.Replace(etdNode.InnerText, "\r\n", " ").Trim(),
IsRemoved = false,
};
}
}
if (fromETD != null)
{
list[currListIdx].From.dateList.Add(fromETD);
}
var wasETDNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[1]/table/tbody/tr[1]/td[1]/table/tbody/tr[3]/td/div/div/div");
if (wasETDNode != null && !string.IsNullOrWhiteSpace(wasETDNode.InnerText))
{
var s = wasETDNode.InnerText;
if (Regex.IsMatch(s, "\\bwas\\s+"))
{
s = Regex.Replace(Regex.Replace(s, "\r\n", " "), "\\s{2,}", " ").Trim();
s = Regex.Match(s, "(?<=\\bwas\\s).*").Value;
s = Regex.Replace(s, "\\(\\s{0,}ETD\\s{0,}\\)", " ").Trim();
s = Regex.Replace(Regex.Replace(s, ",", " "), "\\s{2,}", " ").Trim();
DateTime etd = DateTime.Parse(s);
fromETD2 = new TransPlanHasChangeDateDto
{
Indx = 2,
DateVal = etd,
OrigDateTxt = Regex.Replace(wasETDNode.InnerText, "\r\n", " ").Trim(),
IsRemoved = true,
};
}
}
if (fromETD2 != null)
{
list[currListIdx].From.dateList.Add(fromETD2);
}
#endregion
#region 处理船名
TransPlanHasChangeVesselVoynoDto vessel = null;
TransPlanHasChangeVesselVoynoDto vessel2 = null;
var vesselNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[1]/table/tbody/tr[1]/td[1]/table/tbody/tr[4]/td/div/div/b");
if (vesselNode != null && !string.IsNullOrWhiteSpace(vesselNode.InnerText))
{
var s = Regex.Replace(Regex.Replace(vesselNode.InnerText, "\r\n", " "), "\\s{2,}", " ").Trim();
vessel = new TransPlanHasChangeVesselVoynoDto
{
Indx = 1,
Vessel = s.Trim(),
IsRemoved = false,
};
}
else
{
vesselNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[1]/table/tbody/tr[1]/td[1]/table/tbody/tr[4]/td/div/div");
if (vesselNode != null && !string.IsNullOrWhiteSpace(vesselNode.InnerText))
{
var s = Regex.Replace(Regex.Replace(vesselNode.InnerText, "\r\n", " "), "\\s{2,}", " ").Trim();
vessel = new TransPlanHasChangeVesselVoynoDto
{
Indx = 1,
Vessel = s.Trim(),
IsRemoved = false,
};
}
}
if (vessel != null)
{
list[currListIdx].From.vesselList.Add(vessel);
}
var wasVesselNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[1]/table/tbody/tr[1]/td[1]/table/tbody/tr[4]/td/div/div/div");
if (wasVesselNode != null && !string.IsNullOrWhiteSpace(wasVesselNode.InnerText))
{
var s = wasVesselNode.InnerText;
if (Regex.IsMatch(s, "\\bwas\\s+"))
{
s = Regex.Replace(Regex.Replace(s, "\r\n", " "), "\\s{2,}", " ").Trim();
s = Regex.Match(s, "(?<=\\bwas\\s).*").Value;
vessel2 = new TransPlanHasChangeVesselVoynoDto
{
Indx = 2,
Vessel = s.Trim(),
IsRemoved = true,
};
}
}
if (vessel2 != null)
{
list[currListIdx].From.vesselList.Add(vessel2);
}
#endregion
#region 处理卸货港
TransPlanHasChangePortDto to = null;
TransPlanHasChangePortDto to2 = null;
var dischargeNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[2]/table/tbody/tr[1]/td[1]/table/tbody/tr[2]/td/div/div/b");
if (dischargeNode != null && !string.IsNullOrWhiteSpace(dischargeNode.InnerText))
{
var s = Regex.Replace(Regex.Replace(dischargeNode.InnerText, "\r\n", " "), "\\s{2,}", " ").Trim();
to = new TransPlanHasChangePortDto
{
Indx = 1,
PortName = s.Trim(),
IsRemoved = false,
};
if (s.IndexOf(",") >= 0)
{
var sArg = s.Split(new char[] { ',' });
if (sArg.Length == 2)
{
to.PortName = sArg[0].Trim();
to.TerminalName = sArg[1].Trim();
}
}
}
else
{
dischargeNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[2]/table/tbody/tr[1]/td[1]/table/tbody/tr[2]/td/div/div");
if (dischargeNode != null && !string.IsNullOrWhiteSpace(dischargeNode.InnerText))
{
var s = Regex.Replace(Regex.Replace(dischargeNode.InnerText, "\r\n", " "), "\\s{2,}", " ").Trim();
to = new TransPlanHasChangePortDto
{
Indx = 1,
PortName = s.Trim(),
IsRemoved = false,
};
if (s.IndexOf(",") >= 0)
{
var sArg = s.Split(new char[] { ',' });
if (sArg.Length == 2)
{
to.PortName = sArg[0].Trim();
to.TerminalName = sArg[1].Trim();
}
}
}
}
if (to != null)
{
list[currListIdx].To.portList.Add(to);
}
var wasDischargeNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[2]/table/tbody/tr[1]/td[1]/table/tbody/tr[2]/td/div/div/div");
if (wasDischargeNode != null && !string.IsNullOrWhiteSpace(wasDischargeNode.InnerText))
{
var s = wasDischargeNode.InnerText;
if (Regex.IsMatch(s, "\\bwas\\s+"))
{
s = Regex.Replace(Regex.Replace(s, "\r\n", " "), "\\s{2,}", " ").Trim();
s = Regex.Match(s, "(?<=\\bwas\\s).*").Value;
to2 = new TransPlanHasChangePortDto
{
Indx = 2,
PortName = s.Trim(),
IsRemoved = true,
};
if (s.IndexOf(",") >= 0)
{
var sArg = s.Split(new char[] { ',' });
if (sArg.Length == 2)
{
to2.PortName = sArg[0].Trim();
to2.TerminalName = sArg[1].Trim();
}
}
}
}
if (to2 != null)
{
list[currListIdx].To.portList.Add(to2);
}
#endregion
#region 处理ETD
TransPlanHasChangeDateDto toETA = null;
TransPlanHasChangeDateDto toETA2 = null;
var etaNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[2]/table/tbody/tr[1]/td[1]/table/tbody/tr[3]/td/div/div/b");
if (etaNode != null && !string.IsNullOrWhiteSpace(etaNode.InnerText))
{
var s = etaNode.InnerText;
s = Regex.Replace(s, "\r\n", " ").Trim();
s = Regex.Replace(s, "\\(\\s{0,}ETA\\s{0,}\\)", " ").Trim();
s = Regex.Replace(Regex.Replace(s, ",", " "), "\\s{2,}", " ").Trim();
DateTime eta = DateTime.Parse(s);
toETA = new TransPlanHasChangeDateDto
{
Indx = 1,
DateVal = eta,
OrigDateTxt = Regex.Replace(etaNode.InnerText, "\r\n", " ").Trim(),
IsRemoved = false,
};
}
else
{
etaNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[2]/table/tbody/tr[1]/td[1]/table/tbody/tr[3]/td/div/div");
if (etaNode != null && !string.IsNullOrWhiteSpace(etaNode.InnerText))
{
var s = etaNode.InnerText;
s = Regex.Replace(s, "\r\n", " ").Trim();
s = Regex.Replace(s, "\\(\\s{0,}ETA\\s{0,}\\)", " ").Trim();
s = Regex.Replace(Regex.Replace(s, ",", " "), "\\s{2,}", " ").Trim();
DateTime eta = DateTime.Parse(s);
toETA = new TransPlanHasChangeDateDto
{
Indx = 1,
DateVal = eta,
OrigDateTxt = Regex.Replace(etaNode.InnerText, "\r\n", " ").Trim(),
IsRemoved = false,
};
}
}
if (toETA != null)
{
list[currListIdx].To.dateList.Add(toETA);
}
var wasETANode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[2]/table/tbody/tr[1]/td[1]/table/tbody/tr[3]/td/div/div/div");
if (wasETANode != null && !string.IsNullOrWhiteSpace(wasETANode.InnerText))
{
var s = wasETANode.InnerText;
if (Regex.IsMatch(s, "\\bwas\\s+"))
{
s = Regex.Replace(Regex.Replace(s, "\r\n", " "), "\\s{2,}", " ").Trim();
s = Regex.Match(s, "(?<=\\bwas\\s).*").Value;
s = Regex.Replace(s, "\\(\\s{0,}ETA\\s{0,}\\)", " ").Trim();
s = Regex.Replace(Regex.Replace(s, ",", " "), "\\s{2,}", " ").Trim();
DateTime eta = DateTime.Parse(s);
toETA2 = new TransPlanHasChangeDateDto
{
Indx = 2,
DateVal = eta,
OrigDateTxt = Regex.Replace(wasETANode.InnerText, "\r\n", " ").Trim(),
IsRemoved = true,
};
}
}
if (toETA2 != null)
{
list[currListIdx].To.dateList.Add(toETA2);
}
#endregion
#region 处理船名
TransPlanHasChangeVesselVoynoDto vesselPOD = null;
TransPlanHasChangeVesselVoynoDto vesselPOD2 = null;
var vesselPODNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[2]/table/tbody/tr[1]/td[1]/table/tbody/tr[4]/td/div/div/b");
if (vesselPODNode != null && !string.IsNullOrWhiteSpace(vesselPODNode.InnerText))
{
var s = Regex.Replace(Regex.Replace(vesselPODNode.InnerText, "\r\n", " "), "\\s{2,}", " ").Trim();
vesselPOD = new TransPlanHasChangeVesselVoynoDto
{
Indx = 1,
Vessel = s.Trim(),
IsRemoved = false,
};
}
else
{
vesselNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[2]/table/tbody/tr[1]/td[1]/table/tbody/tr[4]/td/div/div");
if (vesselNode != null && !string.IsNullOrWhiteSpace(vesselNode.InnerText))
{
var s = Regex.Replace(Regex.Replace(vesselNode.InnerText, "\r\n", " "), "\\s{2,}", " ").Trim();
vesselPOD = new TransPlanHasChangeVesselVoynoDto
{
Indx = 1,
Vessel = s.Trim(),
IsRemoved = false,
};
}
}
if (vesselPOD != null)
{
list[currListIdx].To.vesselList.Add(vesselPOD);
}
var wasVesselPODNode = divWrapperList[i].SelectSingleNode("./table/tbody/tr[1]/td[1]/div/table/tbody/tr[1]/td[1]/div[2]/table/tbody/tr[1]/td[1]/table/tbody/tr[4]/td/div/div/div");
if (wasVesselPODNode != null && !string.IsNullOrWhiteSpace(wasVesselPODNode.InnerText))
{
var s = wasVesselPODNode.InnerText;
if (Regex.IsMatch(s, "\\bwas\\s+"))
{
s = Regex.Replace(Regex.Replace(s, "\r\n", " "), "\\s{2,}", " ").Trim();
s = Regex.Match(s, "(?<=\\bwas\\s).*").Value;
vesselPOD2 = new TransPlanHasChangeVesselVoynoDto
{
Indx = 2,
Vessel = s.Trim(),
IsRemoved = true,
};
}
}
if (vesselPOD2 != null)
{
list[currListIdx].To.vesselList.Add(vesselPOD2);
}
#endregion
}
//每4行处理一次
if ((start + 1) == 5)
{
start = 1;
}
else
{
start++;
}
}
var jsonRlt = JSON.Serialize(list);
}
public string SplitSubjectValue(string subjectText, string strStart, string strEnd = null)
{
var startIdx = subjectText.IndexOf(strStart);
if (startIdx > -1)
{
subjectText = subjectText.Substring(startIdx + strStart.Length);
if (!string.IsNullOrEmpty(strEnd))
{
startIdx = subjectText.IndexOf(strEnd);
if (startIdx > -1)
{
subjectText = subjectText.Substring(0, startIdx);
}
}
return subjectText.Trim();
}
return string.Empty;
}
/// <summary>
/// 文本类型的正文,根据条件提取字段内容
/// </summary>
/// <param name="bodyText">邮件正文(文本类型)</param>
/// <param name="strStart">行起始关键字文本</param>
/// <param name="strEnd">行结束关键字文本</param>
/// <param name="afterLine">从指定行之后提取</param>
/// <returns></returns>
public string SplitFieldValue(string bodyText, string strStart, string strEnd = null, string afterLine = null)
{
var lines = bodyText.Split("\r\n".ToArray(), StringSplitOptions.RemoveEmptyEntries);
var findArr = new List<string>(lines);
if (!string.IsNullOrEmpty(afterLine))
{
var strList = findArr.Where(l => l.Trim().StartsWith(afterLine)).ToList();
if (strList.Count > 0)
{
var idx = findArr.IndexOf(strList[0]);
if (idx > -1)
{
findArr.RemoveRange(0, idx + 1);
}
}
}
//没有开始标志取afterLine的下一行
if (string.IsNullOrEmpty(strStart) && !string.IsNullOrEmpty(afterLine))
{
return findArr[0].Trim();
}
else
{
var lineFind = findArr.FirstOrDefault(x => x.Trim().StartsWith(strStart));
if (lineFind != null)
{
if (string.IsNullOrEmpty(strEnd))
{
return lineFind.Replace(strStart, "").Trim();
}
else
{
var tmp = lineFind.Substring(strStart.Length);
var endIdx = tmp.IndexOf(strEnd);
if (endIdx == -1)
{
return tmp.Trim();
}
else
{
return tmp.Substring(0, endIdx).Trim();
}
}
}
}
return string.Empty;
}
public void SyncServiceProjectRecord5()

Loading…
Cancel
Save