zhangxiaofeng 8 months ago
commit 6046251b0d

File diff suppressed because it is too large Load Diff

@ -0,0 +1,200 @@
using Furion;
using Myshipping.Application.Entity;
using Myshipping.Core;
using Myshipping.Core.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application.EDI
{
/// <summary>
/// 中远API订舱
/// </summary>
public static class ZhongYuanSoApiHelper
{
public async static Task<KeyValuePair<bool, string>> DoPost(long bookingId)
{
var repCustOrder = App.GetService<SqlSugarRepository<BookingCustomerOrder>>();
var repOrder = App.GetService<SqlSugarRepository<BookingOrder>>();
var repCtn = App.GetService<SqlSugarRepository<BookingCtn>>();
var cacheService = App.GetService<ISysCacheService>();
var order = repOrder.FirstOrDefault(o => o.Id == bookingId);
if (order == null)
{
return new KeyValuePair<bool, string>(false, "订舱信息未找到");
}
return new KeyValuePair<bool, string>();
}
}
public class ZhongYuanSoApiModel
{
/// <summary>
/// 用户key
/// </summary>
public string userKey { get; set; }
/// <summary>
/// 用户secret
/// </summary>
public string userSecret { get; set; }
/// <summary>
/// 网站账户
/// </summary>
public string webAccount { get; set; }
/// <summary>
/// 网站密码
/// </summary>
public string webPassword { get; set; }
/// <summary>
/// 上传类型
/// </summary>
public string uploadType { get; set; }
/// <summary>
/// 在选择草稿及模板时, 保存时填写的名称
/// </summary>
public string saveName { get; set; }
/// <summary>
/// 在选择草稿及模板时的描述
/// </summary>
public string saveDes { get; set; }
/// <summary>
/// 路线信息
/// </summary>
public ZhongYuanSoApiRoute routes { get; set; }
/// <summary>
/// 发货人信息
/// </summary>
public string shipperInfo { get; set; }
/// <summary>
/// 收货人信息
/// </summary>
public string consigneeInfo { get; set; }
/// <summary>
/// 通知人信息
/// </summary>
public string notifyInfo { get; set; }
/// <summary>
/// 货代信息
/// </summary>
public string forwarderInfo { get; set; }
}
public class ZhongYuanSoApiRoute
{
/// <summary>
/// 出发城市
/// </summary>
public string originCity { get; set; }
/// <summary>
/// 目的城市
/// </summary>
public string destinationCity { get; set; }
/// <summary>
/// 船名
/// </summary>
public string vesselName { get; set; }
/// <summary>
/// 航次
/// </summary>
public string voyageNumber { get; set; }
/// <summary>
/// 航线代码
/// </summary>
public string serviceCode { get; set; }
}
public class ZhongYuanSoApiSFT
{
/// <summary>
/// 名字
/// </summary>
public string partyName { get; set; }
/// <summary>
/// 国家
/// </summary>
public string country { get; set; }
/// <summary>
/// 省
/// </summary>
public string state { get; set; }
/// <summary>
/// 城市名
/// </summary>
public string city { get; set; }
/// <summary>
/// 区
/// </summary>
public string county { get; set; }
/// <summary>
/// 详细地址
/// </summary>
public string addressDes { get; set; }
/// <summary>
/// 邮编
/// </summary>
public string postalCode { get; set; }
/// <summary>
/// 姓
/// </summary>
public string firstName { get; set; }
/// <summary>
/// 名
/// </summary>
public string lastName { get; set; }
/// <summary>
/// 电话
/// </summary>
public ZhongYuanSoApiPhone phone { get; set; }
}
public class ZhongYuanSoApiPhone
{
/// <summary>
/// 国家代码
/// </summary>
public string countryCode { get; set; }
/// <summary>
/// 区号
/// </summary>
public string areaCode { get; set; }
/// <summary>
/// 电话号码
/// </summary>
public string number { get; set; }
}
}

@ -313,6 +313,11 @@ namespace Myshipping.Application.Entity
/// 运输条款代码
/// </summary>
public string SERVICECODE { get; set; }
/// <summary>
/// 船公司航线代码
/// </summary>
public string LANECODE { get; set; }
}
/// <summary>

@ -59,6 +59,13 @@ namespace Myshipping.Application.Entity
[Description("模板名称")]
public string TemplateName{ get; set; }
/// <summary>
/// 分类
/// </summary>
[SugarColumn(ColumnName = "Category")]
[Description("分类")]
public string Category { get; set; }
/// <summary>
/// 船司ID
/// </summary>
@ -150,6 +157,13 @@ namespace Myshipping.Application.Entity
[Description("发货人联系人姓")]
public string ShipperLastName { get; set; }
/// <summary>
/// 发货人电话国家代码
/// </summary>
[SugarColumn(ColumnName = "ShipperPhoneCountryCode")]
[Description("发货人电话国家代码")]
public string ShipperPhoneCountryCode { get; set; }
/// <summary>
/// 发货人电话区号
/// </summary>
@ -234,6 +248,13 @@ namespace Myshipping.Application.Entity
[Description("收货人联系人姓")]
public string ConsigneeLastName { get; set; }
/// <summary>
/// 收货人电话国家代码
/// </summary>
[SugarColumn(ColumnName = "ConsigneePhoneCountryCode")]
[Description("收货人电话国家代码")]
public string ConsigneePhoneCountryCode { get; set; }
/// <summary>
/// 收货人电话区号
/// </summary>
@ -318,6 +339,13 @@ namespace Myshipping.Application.Entity
[Description("通知人联系人姓")]
public string NotifypartLastName { get; set; }
/// <summary>
/// 通知人电话国家代码
/// </summary>
[SugarColumn(ColumnName = "NotifypartPhoneCountryCode")]
[Description("通知人电话国家代码")]
public string NotifypartPhoneCountryCode { get; set; }
/// <summary>
/// 通知人电话区号
/// </summary>
@ -402,6 +430,13 @@ namespace Myshipping.Application.Entity
[Description("订舱公司联系人姓")]
public string BookingLastName { get; set; }
/// <summary>
/// 订舱公司电话国家代码
/// </summary>
[SugarColumn(ColumnName = "BookingPhoneCountryCode")]
[Description("订舱公司电话国家代码")]
public string BookingPhoneCountryCode { get; set; }
/// <summary>
/// 订舱公司电话区号
/// </summary>

@ -47,6 +47,10 @@ namespace Myshipping.Application
/// <summary>
/// 沃尔塔航运
/// </summary>
VOL
VOL,
/// <summary>
/// INTTRA
/// </summary>
INTTRA
}
}

@ -517,7 +517,6 @@ namespace Myshipping.Application
}
#endregion
#region 客户端操作与接口
/// <summary>
/// 提交订舱
@ -1770,6 +1769,7 @@ namespace Myshipping.Application
var serviceList = await _cache.GetAllCodeService();
var frtList = await _cache.GetAllCodeFrt();
var ctnList = await _cache.GetAllCodeCtn();
#region 校验
/*
1.HSCODE
@ -1975,7 +1975,6 @@ namespace Myshipping.Application
custOrder.SERVICE = service.Name;
custOrder.BLFRT = frt.EnName;
//订舱账号、密码
var jobj = new JObject();
if (!string.IsNullOrEmpty(custOrder.ExtendData))

@ -325,6 +325,11 @@ namespace Myshipping.Application
/// 运输条款代码
/// </summary>
public string SERVICECODE { get; set; }
/// <summary>
/// 船公司航线代码
/// </summary>
public string LANECODE { get; set; }
}
//保存dto
@ -934,5 +939,10 @@ namespace Myshipping.Application
/// 订舱密码
/// </summary>
public string BOOKINGPASSWORD { get; set; }
/// <summary>
/// 航线代码
/// </summary>
public string LINECODE { get; set; }
}
}

@ -520,6 +520,8 @@ namespace Myshipping.Application.Service.BookingOrder
result.succ = false;
result.msg = $"MSK API订舱失败{ex.Message}";
throw Oops.Bah($"MSK API订舱失败{ex.Message}");
}
return result;

@ -8626,6 +8626,38 @@ namespace Myshipping.Application
result.extra = currRlt.succ ? currRlt.extra.ToString() : "";
result.extra2 = currRlt.succ ? currRlt.extra2.ToString() : "";
}
else if (ediRouteEnum == EDIRouteEnum.INTTRA)
{
#region INTTRA
string strCheck = InttraEdiHelper.IsCreateINTTR(ediModel);
_logger.LogInformation($"调用SO(SI),校验:{strCheck},数据对象:{JsonConvert.SerializeObject(ediModel)}");
if (!string.IsNullOrWhiteSpace(strCheck))
{
if (Regex.IsMatch(strCheck, "\\<br\\s{1,}/\\>"))
{
strCheck = Regex.Replace(strCheck, "\\<br\\s{1,}/\\>", "\n");
}
throw Oops.Bah($"发送{EDIRouteEnum.ESL.ToString()}校验失败,{strCheck}");
}
CommonWebApiResult currRlt = new CommonWebApiResult();
if (model.sendType == "B")
{
currRlt = InttraEdiHelper.CreateEdiINTTR(ediModel);
}
else if (model.sendType == "E")
{
currRlt = InttraEdiHelper.CreateEdiINTTRSI(ediModel);
}
#endregion
result.succ = currRlt.succ;
result.extra = currRlt.succ ? currRlt.extra.ToString() : "";
}
}
catch (Exception ex)
{

@ -1042,7 +1042,8 @@ namespace Myshipping.Application
/// <param name="slotId">舱位主键</param>
/// <param name="reqBatchNo">请求批次号用来区分对应的哪个批次任务</param>
/// <returns></returns>
private async Task PushCompareBCInfo(TaskBCInfoDto bcSrcDto, TaskBCInfoDto bcTargetDto, long slotId, string reqBatchNo)
[NonAction]
public async Task PushCompareBCInfo(TaskBCInfoDto bcSrcDto, TaskBCInfoDto bcTargetDto, long slotId, string reqBatchNo)
{
string batchNo = IDGen.NextID().ToString();
@ -1061,6 +1062,10 @@ namespace Myshipping.Application
DateTime nowDate = DateTime.Now;
var hisInfo = _bookingSlotCompareRepository.AsQueryable().First(a => a.COMPARE_BATCHNO == reqBatchNo);
if (hisInfo == null)
{
BookingSlotCompare entity = new BookingSlotCompare
{
SLOT_ID = slotId,
@ -1077,6 +1082,26 @@ namespace Myshipping.Application
};
await _bookingSlotCompareRepository.InsertAsync(entity);
}
else
{
hisInfo.COMPARE_DIFF_NUM = compareResult.extra.IsExistsDiff ? compareResult.extra.ShowDetailList.Count : 0;
hisInfo.UpdatedTime = nowDate;
hisInfo.UpdatedUserId = UserManager.UserId;
hisInfo.UpdatedUserName = UserManager.Name;
hisInfo.COMPARE_RLT = JSON.Serialize(compareResult.extra.ShowDetailList);
await _bookingSlotCompareRepository.AsUpdateable(hisInfo).UpdateColumns(it =>
new
{
it.COMPARE_DIFF_NUM,
it.COMPARE_RLT,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
}
}
#endregion
@ -1089,7 +1114,7 @@ namespace Myshipping.Application
/// <param name="bcTargetDto">BC变更后详情</param>
/// <returns>返回回执</returns>
[NonAction]
private async Task<TaskManageExcuteResultDto> ExcuteCompare(TaskBCInfoDto bcSrcDto, TaskBCInfoDto bcTargetDto)
public async Task<TaskManageExcuteResultDto> ExcuteCompare(TaskBCInfoDto bcSrcDto, TaskBCInfoDto bcTargetDto)
{
TaskManageExcuteResultDto model = null;
/*

@ -73,7 +73,35 @@ namespace Myshipping.Application
.Map(dest => dest.TransferPort1, src => src.TRANSFER_PORT_1)
.Map(dest => dest.TransferPort2, src => src.TRANSFER_PORT_2);
config.ForType<TaskBCInfoReadDto, TaskBCInfoDto>()
.Map(dest => dest.CarrierId, src => src.CarrierId)
.Map(dest => dest.Carrier, src => src.Carrier)
.Map(dest => dest.MBLNo, src => src.MBLNo)
.Map(dest => dest.BookingSlotType, src => src.BookingSlotType)
.Map(dest => dest.BookingSlotTypeName, src => src.BookingSlotTypeName)
.Map(dest => dest.Vessel, src => src.Vessel)
.Map(dest => dest.VoyNo, src => src.VoyNo)
.Map(dest => dest.VGMSubmissionCutDate, src => src.VGMCutoffTime.HasValue ? src.VGMCutoffTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.WeekAt, src => src.WeekAt)
.Map(dest => dest.CarriageType, src => src.CarriageType)
.Map(dest => dest.CarriageTypeName, src => src.CarriageTypeName)
.Map(dest => dest.ContractNo, src => src.ContractNo)
.Map(dest => dest.CtnStat, src => src.CtnStat)
.Map(dest => dest.CYCutoffTime, src => src.CYCutoffTime.HasValue ? src.CYCutoffTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.DetensionFreeDays, src => src.DetensionFreeDays)
.Map(dest => dest.ETD, src => src.ETD.HasValue ? src.ETD.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.ETA, src => src.ETA.HasValue ? src.ETA.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.LaneCode, src => src.LaneCode)
.Map(dest => dest.LaneName, src => src.LaneName)
.Map(dest => dest.ManifestCutDate, src => src.ManifestCutDate.HasValue ? src.ManifestCutDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.MDGFCutDate, src => src.MDGFCutDate.HasValue ? src.MDGFCutDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.SICutDate, src => src.SICutDate.HasValue ? src.SICutDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.PlaceDelivery, src => src.PlaceDelivery)
.Map(dest => dest.PlaceReceipt, src => src.PlaceReceipt)
.Map(dest => dest.PortDischarge, src => src.PortDischarge)
.Map(dest => dest.Portload, src => src.Portload)
.Map(dest => dest.TransferPort1, src => src.TransferPort1)
.Map(dest => dest.TransferPort2, src => src.TransferPort2);
}
}
}

@ -128,5 +128,22 @@ namespace Myshipping.Application
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> SendEmail(BookingSlotSendEmailDto model);
/// <summary>
/// 请求BC比对
/// </summary>
/// <param name="bcSrcDto">BC详情</param>
/// <param name="bcTargetDto">BC变更后详情</param>
/// <returns>返回回执</returns>
Task<TaskManageExcuteResultDto> ExcuteCompare(TaskBCInfoDto bcSrcDto, TaskBCInfoDto bcTargetDto);
/// <summary>
/// 推送BC变更比对
/// </summary>
/// <param name="bcSrcDto">原舱位详情</param>
/// <param name="bcTargetDto">变更后舱位详情</param>
/// <param name="slotId">舱位主键</param>
/// <param name="reqBatchNo">请求批次号用来区分对应的哪个批次任务</param>
/// <returns></returns>
Task PushCompareBCInfo(TaskBCInfoDto bcSrcDto, TaskBCInfoDto bcTargetDto, long slotId, string reqBatchNo);
}
}

@ -47,6 +47,11 @@ namespace Myshipping.Application
/// </summary>
public string TemplateName { get; set; }
/// <summary>
/// 分类
/// </summary>
public string Category { get; set; }
/// <summary>
/// 船司ID
/// </summary>
@ -112,6 +117,11 @@ namespace Myshipping.Application
/// </summary>
public string ShipperLastName { get; set; }
/// <summary>
/// 发货人电话国家代码
/// </summary>
public string ShipperPhoneCountryCode { get; set; }
/// <summary>
/// 发货人电话区号
/// </summary>
@ -172,6 +182,11 @@ namespace Myshipping.Application
/// </summary>
public string ConsigneeLastName { get; set; }
/// <summary>
/// 收货人电话国家代码
/// </summary>
public string ConsigneePhoneCountryCode { get; set; }
/// <summary>
/// 收货人电话区号
/// </summary>
@ -232,6 +247,11 @@ namespace Myshipping.Application
/// </summary>
public string NotifypartLastName { get; set; }
/// <summary>
/// 通知人电话国家代码
/// </summary>
public string NotifypartPhoneCountryCode { get; set; }
/// <summary>
/// 通知人电话区号
/// </summary>
@ -292,6 +312,11 @@ namespace Myshipping.Application
/// </summary>
public string BookingLastName { get; set; }
/// <summary>
/// 订舱公司电话国家代码
/// </summary>
public string BookingPhoneCountryCode { get; set; }
/// <summary>
/// 订舱公司电话区号
/// </summary>

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
public class EmailBCReadMessageInfo
{
/// <summary>
/// 表头
/// </summary>
public TaskMessageHead Head { get; set; }
/// <summary>
/// 表体
/// </summary>
public EmailBCReadMessageMainInfo Main { get; set; }
}
public class EmailBCReadMessageMainInfo
{
/// <summary>
/// 所属租户ID
/// </summary>
public string TenantId { get; set; }
}
}

@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
public class ParserReaderExcuteResultDto
{
/// <summary>
/// 是否成功 true=成功 false=失败
/// </summary>
public bool succ { get; set; } = false;
/// <summary>
/// 状态 0-成功
/// </summary>
public int status { get; set; } = 0;
/// <summary>
/// 返回消息
/// </summary>
public string msg { get; set; }
/// <summary>
/// 总记录数
/// </summary>
public int total { get; set; }
/// <summary>
/// 当前页列表数据
/// </summary>
public object rows { get; set; }
/// <summary>
/// 合计信息
/// </summary>
public object summary { get; set; }
/// <summary>
/// 扩展信息
/// </summary>
public object extra { get; set; }
/// <summary>
/// 扩展信息2
/// </summary>
public object extra2 { get; set; }
/// <summary>
/// 扩展信息场站统计
/// </summary>
public object yardStatInfo { get; set; }
/// <summary>
/// 是否异常
/// </summary>
public bool exceptionflag { get; set; }
/// <summary>
/// 生成HTML
/// </summary>
public string ResultHtml { get; set; }
}
}

@ -0,0 +1,417 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
///
/// </summary>
public class TaskBCInfoReadDto
{
/// <summary>
/// 订舱单位
/// </summary>
public string BookingParty { get; set; }
/// <summary>
/// 发货人
/// </summary>
public string Shipper { get; set; }
/// <summary>
/// 收货人
/// </summary>
public string Consignee { get; set; }
/// <summary>
/// 通知人
/// </summary>
public string NotifyParty { get; set; }
/// <summary>
/// BC更新次数
/// </summary>
public Nullable<int> BCModifyTimes { get; set; }
/// <summary>
/// BC更新时间
/// </summary>
public Nullable<DateTime> BCModifyDate { get; set; }
/// <summary>
/// 主单号
/// </summary>
public string MBLNo { get; set; }
/// <summary>
/// 船名
/// </summary>
public string Vessel { get; set; }
/// <summary>
/// 航次
/// </summary>
public string VoyNo { get; set; }
/// <summary>
/// 船公司
/// </summary>
public string Carrier { get; set; }
/// <summary>
/// 收货地
/// </summary>
public string PlaceReceipt { get; set; }
/// <summary>
/// 装货港
/// </summary>
public string Portload { get; set; }
/// <summary>
/// 截关时间
/// </summary>
public Nullable<DateTime> ClosingDate { get; set; }
/// <summary>
/// 截VGM时间
/// </summary>
public Nullable<DateTime> VGMCutoffTime { get; set; }
/// <summary>
/// ETA(预计到港时间)
/// </summary>
public Nullable<DateTime> ETA { get; set; }
/// <summary>
/// ETD(预计离港时间)
/// </summary>
public Nullable<DateTime> ETD { get; set; }
/// <summary>
/// 目的港ETA
/// </summary>
public Nullable<DateTime> PODETA { get; set; }
/// <summary>
/// 截单时间
/// </summary>
public Nullable<DateTime> CutSingleTime { get; set; }
/// <summary>
/// 卸货港
/// </summary>
public string PortDischarge { get; set; }
/// <summary>
/// 交货地
/// </summary>
public string PlaceDelivery { get; set; }
/// <summary>
/// 装运方式
/// </summary>
public string ShippingMethod { get; set; }
/// <summary>
/// 运输条款
/// </summary>
public string Service { get; set; }
/// <summary>
/// 港前运输形态
/// </summary>
public string PreTransMode { get; set; }
/// <summary>
/// 品名
/// </summary>
public string Description { get; set; }
/// <summary>
/// 签单地点
/// </summary>
public string IssuePlace { get; set; }
/// <summary>
/// 集港码头
/// </summary>
public string CollectionTerminal { get; set; }
/// <summary>
/// 约号
/// </summary>
public string ContractNo { get; set; }
/// <summary>
/// 预付地点
/// </summary>
public string PrepardAT { get; set; }
/// <summary>
/// 船代
/// </summary>
public string ShipAgent { get; set; }
/// <summary>
/// 场站
/// </summary>
public string Yard { get; set; }
/// <summary>
/// 场站联系人
/// </summary>
public string YardContactUserName { get; set; }
/// <summary>
/// 场站联系电话
/// </summary>
public string YardContactTel { get; set; }
/// <summary>
/// 一代客服姓名
/// </summary>
public string FstCustomerSerUserName { get; set; }
/// <summary>
/// 一代客服电话
/// </summary>
public string FstCustomerSerUserTel { get; set; }
/// <summary>
/// 一代客服邮箱
/// </summary>
public string FstCustomerSerUserEmail { get; set; }
/// <summary>
/// 备注1
/// </summary>
public string Remark1 { get; set; }
/// <summary>
/// 截港时间
/// </summary>
public Nullable<DateTime> CYCutoffTime { get; set; }
/// <summary>
/// 状态 TEMP-暂存 SUCC-已对应 ERROR-异常
/// </summary>
public string Status { get; set; }
/// <summary>
/// 文件MD5
/// </summary>
public string FileMD5 { get; set; }
/// <summary>
/// 最后对应时间,最后关联到订舱日期
/// </summary>
public Nullable<DateTime> LastToBookingDate { get; set; }
/// <summary>
/// 来源邮箱
/// </summary>
public string FromEmail { get; set; }
/// <summary>
/// 接收邮箱
/// </summary>
public string RecvEmail { get; set; }
/// <summary>
/// 订舱ID对应成功后订舱ID写入
/// </summary>
public Nullable<long> BookingOrderId { get; set; }
/// <summary>
/// 集装箱列表
/// </summary>
public List<TaskBCInfoReadCtnDto> CtnList { get; set; }
/// <summary>
/// 顺序号
/// </summary>
public int Indx { get; set; }
/// <summary>
/// 对应订舱序号
/// </summary>
public int BKOrderIndx { get; set; }
/// <summary>
/// 舱位主键
/// </summary>
public Nullable<long> BookingSlotId { get; set; }
/// <summary>
/// 船公司代号
/// </summary>
public string CarrierId { get; set; }
/// <summary>
/// 航线代码(船公司)
/// </summary>
public string LaneCode { get; set; }
/// <summary>
/// 航线名称(船公司)
/// </summary>
public string LaneName { get; set; }
/// <summary>
/// 承运方式 DIRECT_SHIP-直达TRANSFER_SHIP-中转
/// </summary>
public string CarriageType { get; set; }
/// <summary>
/// 承运方式名称 DIRECT_SHIP-直达TRANSFER_SHIP-中转
/// </summary>
public string CarriageTypeName { get; set; }
/// <summary>
/// 订舱方式 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary>
public string BookingSlotType { get; set; }
/// <summary>
/// 订舱方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary>
public string BookingSlotTypeName { get; set; }
/// <summary>
/// 箱型箱量
/// </summary>
public string CtnStat { get; set; }
/// <summary>
/// 所在周数
/// </summary>
public string WeekAt { get; set; }
/// <summary>
/// 箱使天数
/// </summary>
public int DetensionFreeDays { get; set; }
/// <summary>
/// 样单截止日期
/// </summary>
public Nullable<DateTime> SICutDate { get; set; }
/// <summary>
/// 舱单截止时间
/// </summary>
public Nullable<DateTime> ManifestCutDate { get; set; }
/// <summary>
/// MDGF提交截止时间
/// </summary>
public Nullable<DateTime> MDGFCutDate { get; set; }
/// <summary>
/// 中转港1
/// </summary>
public string TransferPort1 { get; set; }
/// <summary>
/// 中转港2
/// </summary>
public string TransferPort2 { get; set; }
/// <summary>
/// 二程船名
/// </summary>
public string SecondVessel { get; set; }
/// <summary>
/// 二程航次
/// </summary>
public string SecondVoyno { get; set; }
/// <summary>
/// 二程ETD
/// </summary>
public Nullable<DateTime> SecondETD { get; set; }
/// <summary>
/// 二程ETA
/// </summary>
public Nullable<DateTime> SecondETA { get; set; }
/// <summary>
/// 订舱确认时间
/// </summary>
public Nullable<DateTime> BookingConfirmDate { get; set; }
}
/// <summary>
/// 任务BC集装箱
/// </summary>
public class TaskBCInfoReadCtnDto
{
/// <summary>
/// 箱型代码
/// </summary>
public string CtnCode { get; set; }
/// <summary>
/// 箱型
/// </summary>
public string CtnALL { get; set; }
/// <summary>
/// 箱量
/// </summary>
public Nullable<int> CTNNUM { get; set; }
/// <summary>
/// 件数
/// </summary>
public Nullable<int> PKGS { get; set; }
/// <summary>
/// 尺码
/// </summary>
public Nullable<decimal> CBM { get; set; }
/// <summary>
/// 毛重
/// </summary>
public Nullable<decimal> KGS { get; set; }
/// <summary>
/// 皮重
/// </summary>
public Nullable<decimal> TareWeight { get; set; }
/// <summary>
/// 危品票标示
/// </summary>
public string IODGT { get; set; }
/// <summary>
/// 特殊装载需求
/// </summary>
public string SpecialLoadingRequire { get; set; }
/// <summary>
/// 提箱场站
/// </summary>
public string TakeCTNYard { get; set; }
/// <summary>
/// 提箱时间
/// </summary>
public Nullable<DateTime> TakeCTNTime { get; set; }
/// <summary>
/// 还箱场站
/// </summary>
public string ReturnCTNYard { get; set; }
}
}

@ -105,5 +105,12 @@ namespace Myshipping.Application
/// <param name="taskPkId">BC任务主键</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> SearchAndConnectBookingInfo(string taskPkId);
/// <summary>
/// 重新比对
/// </summary>
/// <param name="taskPKId">BC任务主键</param>
/// <returns></returns>
Task ReCompareResult(string taskPKId);
}
}

@ -30,9 +30,11 @@ using SqlSugar;
using StackExchange.Profiling.Internal;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Security.Principal;
@ -78,6 +80,7 @@ namespace Myshipping.Application
private readonly IBookingValueAddedService _bookingValueAddedService;
private readonly IDjyCustomerService _djyCustomerService;
private readonly INamedServiceProvider<IBookingMSKAPIService> _namedBookingMSKAPIServiceProvider;
private readonly IDjyTenantParamService _djyTenantParamService;
private readonly INamedServiceProvider<IBookingSlotService> _namedBookingSlotServiceProvider;
@ -87,6 +90,17 @@ namespace Myshipping.Application
const string CONST_BC_NOTICE_FILE_CODE = "bc_notice";
const string CONST_BC_NOTICE_FILE_NAME = "Booking Confirmation Notice";
//租户BC默认转发KEY
const string CONST_BC_DEFAULT_PARAM = "BC_TASK_AUTO_TRANSMIT";
//租户AMENDMENT默认转发KEY
const string CONST_AMENDMENT_DEFAULT_PARAM = "AMENDMENT_TASK_AUTO_TRANSMIT";
//租户CANCELLATION默认转发KEY
const string CONST_CANCELLATION_DEFAULT_PARAM = "CANCELLATION_TASK_AUTO_TRANSMIT";
//租户AMENDMENT默认钉钉消息KEY
const string CONST_AMENDMENT_DING_DEFAULT_PARAM = "AMENDMENT_TASK_DING_NOTICE";
//租户CANCELLATION默认钉钉消息KEY
const string CONST_CANCELLATION_DING_DEFAULT_PARAM = "CANCELLATION_TASK_DING_NOTICE";
public TaskManageBCService(SqlSugarRepository<TaskBCInfo> taskBCInfoRepository,
SqlSugarRepository<TaskBaseInfo> taskBaseRepository,
SqlSugarRepository<TaskBCCTNInfo> taskBCCTNInfoRepository,
@ -102,6 +116,7 @@ namespace Myshipping.Application
IBookingSlotService bookingSlotService, ISysCacheService cache, IBookingValueAddedService bookingValueAddedService,
INamedServiceProvider<IBookingSlotService> namedBookingSlotServiceProvider,
INamedServiceProvider<IBookingMSKAPIService> namedBookingMSKAPIServiceProvider,
IDjyTenantParamService djyTenantParamService,
SqlSugarRepository<BookingSlotBase> bookingSlotBaseRepository,
SqlSugarRepository<BookingSlotCtn> bookingSlotBaseCtnRepository,
SqlSugarRepository<BookingSlotAllocation> bookingSlotAllocationRepository,
@ -133,6 +148,7 @@ namespace Myshipping.Application
_bookingSlotAllocationCtnRepository = bookingSlotAllocationCtnRepository;
_namedBookingMSKAPIServiceProvider = namedBookingMSKAPIServiceProvider;
_namedBookingSlotServiceProvider = namedBookingSlotServiceProvider;
_djyTenantParamService = djyTenantParamService;
_logger = logger;
}
@ -1664,7 +1680,7 @@ namespace Myshipping.Application
if (fileInfo == null)
{
throw Oops.Oh($"提取订舱的Booking Confirmation Notice文件失败,不能发送邮件");
throw Oops.Oh($"提取变更文件失败,不能发送邮件");
}
_logger.LogInformation($"获取订舱附件地址,结果:{fileInfo.FILE_PATH}");
@ -2191,7 +2207,7 @@ namespace Myshipping.Application
emailApiUserDefinedDto.Attaches.Add(new AttachesInfo
{
AttachName = Path.GetFileName(filePath),
AttachName = Path.GetFileName(filePath).Replace("_MODIFY",""),
AttachContent = base64Str
});
@ -2306,66 +2322,161 @@ namespace Myshipping.Application
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
/*
1
2
3@
* Amendment
1
2
3
4
5
* Cancellation
1
2
3
4
*/
try
{
var baseTask = await _taskBaseRepository.AsQueryable().FirstAsync(u => u.PK_ID == taskPKId);
if (baseTask == null)
throw Oops.Oh($"主任务获取失败,不存在或已作废");
var bcOrder = _taskBCInfoRepository.AsQueryable().First(a => a.TASK_ID == taskPKId);
if (bcOrder == null)
throw Oops.Oh($"任务主键{taskPKId}无法获取BC业务信息");
throw Oops.Oh($"BC任务获取失败不存在或已作废");
if (!bcOrder.BOOKING_SLOT_ID.HasValue || bcOrder.BOOKING_SLOT_ID.Value == 0)
{
var server = _namedBookingSlotServiceProvider.GetService<ITransient>(nameof(BookingSlotService));
var slotModel = server.SearchBookingSlotWithOrderByNo(bcOrder.MBL_NO).GetAwaiter().GetResult();
if(bcOrder.BOOKING_SLOT_ID.HasValue && bcOrder.BOOKING_SLOT_ID.Value > 0)
if (slotModel != null && slotModel.BookingSlotId > 0)
{
if (slotModel.HasBookingOrder)
{
bcOrder.BOOKING_SLOT_ID = slotModel.BookingSlotId;
bcOrder.BOOKING_ORDER_ID = slotModel.BookingOrderList.FirstOrDefault();
bcOrder.UpdatedTime = DateTime.Now;
bcOrder.UpdatedUserId = UserManager.UserId;
bcOrder.UpdatedUserName = UserManager.Name;
await _taskBCInfoRepository.AsUpdateable(bcOrder).UpdateColumns(it => new
{
it.BOOKING_SLOT_ID,
it.BOOKING_ORDER_ID,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
}
else
{
bcOrder.BOOKING_SLOT_ID = slotModel.BookingSlotId;
bcOrder.UpdatedTime = DateTime.Now;
bcOrder.UpdatedUserId = UserManager.UserId;
bcOrder.UpdatedUserName = UserManager.Name;
await _taskBCInfoRepository.AsUpdateable(bcOrder).UpdateColumns(it => new
{
it.BOOKING_SLOT_ID,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
}
if (baseTask != null)
{
if (baseTask.IS_PUBLIC == 1)
{
baseTask.IS_PUBLIC = 0;
baseTask.RealUserId = UserManager.UserId;
baseTask.RealUserName = UserManager.Name;
baseTask.UpdatedTime = DateTime.Now;
baseTask.UpdatedUserId = UserManager.UserId;
baseTask.UpdatedUserName = UserManager.Name;
//更新任务台,将当前任务变更为个人任务
await _taskBaseRepository.AsUpdateable(baseTask).UpdateColumns(it => new
{
var slotInfo = await _bookingSlotBaseRepository.AsQueryable()
.FirstAsync(t => t.Id == bcOrder.BOOKING_SLOT_ID.Value);
it.IS_PUBLIC,
it.RealUserId,
it.RealUserName,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
if(slotInfo != null)
}).ExecuteCommandAsync();
}
}
}
else
{
//查询对应的订舱信息
var slotAlloc = await _bookingSlotAllocationRepository.AsQueryable()
.FirstAsync(a => a.BOOKING_SLOT_ID == slotInfo.Id && a.IsDeleted == false);
throw Oops.Oh($"无法获取舱位信息");
}
}
if (slotAlloc != null && slotAlloc.BOOKING_ID > 0)
DjyTenantParamValueOutput paramConfig = null;
DjyTenantParamValueOutput dingdingConfig = null;
var paramList = _djyTenantParamService.GetParaCodeWithValue(new[] { CONST_AMENDMENT_DEFAULT_PARAM,
CONST_CANCELLATION_DEFAULT_PARAM,
CONST_AMENDMENT_DING_DEFAULT_PARAM,
CONST_CANCELLATION_DING_DEFAULT_PARAM }).GetAwaiter().GetResult();
if (baseTask.TASK_TYPE == TaskBaseTypeEnum.BC_MODIFY.ToString())
{
//查询订舱记录
var bookingInfo = _bookingOrderRepository.AsQueryable()
.FirstAsync(a => a.Id == slotAlloc.BOOKING_ID && a.IsDeleted == false);
if (paramList != null && paramList.Count > 0)
{
paramConfig = paramList.FirstOrDefault(a => a.ParaCode.Equals(CONST_AMENDMENT_DEFAULT_PARAM, StringComparison.OrdinalIgnoreCase));
//如果订舱记录推送客户邮件
dingdingConfig = paramList.FirstOrDefault(a => a.ParaCode.Equals(CONST_AMENDMENT_DING_DEFAULT_PARAM, StringComparison.OrdinalIgnoreCase));
}
}
else if (baseTask.TASK_TYPE == TaskBaseTypeEnum.CANCELLATION.ToString())
{
if (paramList != null && paramList.Count > 0)
{
paramConfig = paramList.FirstOrDefault(a => a.ParaCode.Equals(CONST_CANCELLATION_DEFAULT_PARAM, StringComparison.OrdinalIgnoreCase));
/*
OP
*/
dingdingConfig = paramList.FirstOrDefault(a => a.ParaCode.Equals(CONST_CANCELLATION_DING_DEFAULT_PARAM, StringComparison.OrdinalIgnoreCase));
}
}
//如果有舱位只能推送钉钉消息
//var bcCtnList = _taskBCCTNInfoRepository.AsQueryable().Where(a => a.P_ID == bcOrder.PK_ID).ToList();
_logger.LogInformation($"taskPKId={taskPKId} 判断是否默认转发邮件 paramConfig={JSON.Serialize(paramConfig)}");
//var fileList = _taskFileRepository.AsQueryable().Where(a => a.TASK_PKID == taskPKId).ToList();
//如果值是ENABLE表示可以自动发送
if (paramConfig != null && paramConfig.ParaValue.Equals("ENABLE", StringComparison.OrdinalIgnoreCase))
{
_logger.LogInformation($"taskPKId={taskPKId} 准备发送邮件");
//推送舱位
//var bookingSlotId = GenerateBookingSlot(bcOrder, bcCtnList, fileList,"update").GetAwaiter().GetResult();
var emailRlt = await SendEmail(taskPKId);
//检索是否有差异
//var compareResult = _bookingSlotCompareRepository.AsQueryable().Filter(null, true)
// .Where(x => x.SLOT_ID == bookingSlotId && x.IsDeleted == false && x.TenantId ==
// bcOrder.TenantId).OrderByDescending(a=>a.CreatedTime).First();
_logger.LogInformation($"taskPKId={taskPKId} 发送邮件完成 结果={JSON.Serialize(emailRlt)}");
}
else
{
_logger.LogInformation($"taskPKId={taskPKId} 未配置自动发送邮件");
}
if (dingdingConfig != null && dingdingConfig.ParaValue.Equals("ENABLE", StringComparison.OrdinalIgnoreCase))
{
_logger.LogInformation($"taskPKId={taskPKId} 准备发送钉钉消息");
var emailRlt = await SendEmail(taskPKId);
_logger.LogInformation($"taskPKId={taskPKId} 发送钉钉消息完成 结果={JSON.Serialize(emailRlt)}");
//if(compareResult != null && compareResult.COMPARE_DIFF_NUM > 0)
//{
// //准备推送邮件
// await GenerateSendEmail(bcOrder);
//}
}
else
{
throw Oops.Oh($"未检索到对应的舱位信息");
_logger.LogInformation($"taskPKId={taskPKId} 未配置自动发送邮件");
}
result.succ = true;
result.msg = "执行成功";
}
catch (Exception ex)
{
@ -2611,6 +2722,341 @@ namespace Myshipping.Application
return result;
}
#endregion
#region 重新比对
/// <summary>
/// 重新比对
/// </summary>
/// <param name="taskPKId">BC任务主键</param>
/// <returns></returns>
[HttpGet("/TaskManageBC/ReCompareResult")]
public async Task ReCompareResult(string taskPKId)
{
List<CompareResultDetailInfo> list = new List<CompareResultDetailInfo>();
/*
1
2BookingConfirmation
3BookingConfirmation
4
*/
var baseTask = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPKId);
if (baseTask == null)
{
throw Oops.Oh($"未提取有效的任务信息");
}
if (baseTask.TASK_TYPE != TaskBaseTypeEnum.BC_MODIFY.ToString())
{
throw Oops.Oh($"任务类型不是Amendment不能重新比对");
}
var bcTaskInfo = _taskBCInfoRepository.AsQueryable().First(a => a.TASK_ID == taskPKId);
if (bcTaskInfo == null)
{
throw Oops.Oh($"未提取有效的BC任务信息");
}
long slotId = 0;
string reqBatchNo = bcTaskInfo.BATCH_NO;
var server = _namedBookingSlotServiceProvider.GetService<ITransient>(nameof(BookingSlotService));
//没有舱位先要匹配舱位,才能比对
if (!bcTaskInfo.BOOKING_SLOT_ID.HasValue)
{
var searchInfo = await server.SearchBookingSlotWithOrderByNo(bcTaskInfo.MBL_NO);
if (searchInfo != null)
{
if (searchInfo.HasBookingOrder)
{
bcTaskInfo.BOOKING_SLOT_ID = searchInfo.BookingSlotId;
bcTaskInfo.BOOKING_ORDER_ID = searchInfo.BookingOrderList.FirstOrDefault();
bcTaskInfo.UpdatedTime = DateTime.Now;
bcTaskInfo.UpdatedUserId = UserManager.UserId;
bcTaskInfo.UpdatedUserName = UserManager.Name;
await _taskBCInfoRepository.AsUpdateable(bcTaskInfo).UpdateColumns(it => new
{
it.BOOKING_SLOT_ID,
it.BOOKING_ORDER_ID,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
}
else
{
bcTaskInfo.BOOKING_SLOT_ID = searchInfo.BookingSlotId;
bcTaskInfo.UpdatedTime = DateTime.Now;
bcTaskInfo.UpdatedUserId = UserManager.UserId;
bcTaskInfo.UpdatedUserName = UserManager.Name;
await _taskBCInfoRepository.AsUpdateable(bcTaskInfo).UpdateColumns(it => new
{
it.BOOKING_SLOT_ID,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
}
if (baseTask.IS_PUBLIC == 1)
{
baseTask.IS_PUBLIC = 0;
baseTask.RealUserId = UserManager.UserId;
baseTask.RealUserName = UserManager.Name;
baseTask.UpdatedTime = DateTime.Now;
baseTask.UpdatedUserId = UserManager.UserId;
baseTask.UpdatedUserName = UserManager.Name;
//更新任务台,将当前任务变更为个人任务
await _taskBaseRepository.AsUpdateable(baseTask).UpdateColumns(it => new {
it.IS_PUBLIC,
it.RealUserId,
it.RealUserName,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
}
}
}
var bcInfo = _taskBaseRepository.AsQueryable().Filter(null, true).Where(a => a.MBL_NO == bcTaskInfo.MBL_NO && a.CARRIER_ID == bcTaskInfo.CARRIERID
&& a.TASK_TYPE == TaskBaseTypeEnum.BC.ToString() && a.IsDeleted == false && a.TenantId == UserManager.TENANT_ID).First();
if (bcInfo == null)
throw Oops.Oh($"未检索到对应的BC任务");
var modifyFile = _taskFileRepository.AsQueryable().First(a => a.TASK_PKID == taskPKId && a.FILE_CATEGORY == "BC_MODIFY");
if(modifyFile == null)
throw Oops.Oh($"未获取到当前任务的文件信息");
var bcFile = _taskFileRepository.AsQueryable().First(a => a.TASK_PKID == bcInfo.PK_ID && a.FILE_CATEGORY == "BC");
if (bcFile == null)
throw Oops.Oh($"未获取到当前任务对应BC的文件信息");
var modifyFileName = Path.GetFileName(modifyFile.FILE_PATH);
var bcFileName = Path.GetFileName(bcFile.FILE_PATH);
var opt = App.GetOptions<BookingAttachOptions>();
var dirAbs = opt.basePath;
if (string.IsNullOrEmpty(dirAbs))
{
dirAbs = App.WebHostEnvironment.WebRootPath;
}
var modifyFileFullPath = Path.Combine(dirAbs, modifyFile.FILE_PATH);
if (!File.Exists(modifyFileFullPath))
{
throw Oops.Oh("Amendment 文件提取失败");
}
var bcFileFullPath = Path.Combine(dirAbs, bcFile.FILE_PATH);
if (!File.Exists(bcFileFullPath))
{
throw Oops.Oh("BC 文件提取失败");
}
TaskBCInfoReadDto modifyBCReadInfo = await GetBCReaderInfo(modifyFileFullPath, modifyFileName, UserManager.TENANT_ID, taskPKId, App.Configuration["BookingAmendReadWebApiUrl"]);
if (modifyBCReadInfo == null)
throw Oops.Oh($"重新读取BC变更文件详情失败");
TaskBCInfoReadDto BCReadInfo = await GetBCReaderInfo(bcFileFullPath, bcFileName, UserManager.TENANT_ID, taskPKId, App.Configuration["BCReadWebApiUrl"]);
if (BCReadInfo == null)
throw Oops.Oh($"重新读取BC文件详情失败");
TaskBCInfoDto bcSrcDto = BCReadInfo.Adapt<TaskBCInfoDto>();
TaskBCInfoDto bcTargetDto = modifyBCReadInfo.Adapt<TaskBCInfoDto>();
if (BCReadInfo.CtnList != null && BCReadInfo.CtnList.Count > 0)
{
bcSrcDto.CtnList = BCReadInfo.CtnList.GroupBy(x => x.CtnALL)
.Select(x =>
{
return new TaskBCCTNInfoDto
{
CtnALL = x.Key,
CTNNUM = x.ToList()
.Sum(a => a.CTNNUM)
};
}).ToList();
}
if (modifyBCReadInfo.CtnList != null && modifyBCReadInfo.CtnList.Count > 0)
{
bcTargetDto.CtnList = modifyBCReadInfo.CtnList.GroupBy(x => x.CtnALL)
.Select(x =>
{
return new TaskBCCTNInfoDto
{
CtnALL = x.Key,
CTNNUM = x.ToList()
.Sum(a => a.CTNNUM)
};
}).ToList();
}
_logger.LogInformation($"触发比对差异开始reqBatchNo={reqBatchNo}");
//比对差异
await server.PushCompareBCInfo(bcSrcDto, bcTargetDto, slotId, reqBatchNo);
_logger.LogInformation($"触发比对差异结束reqBatchNo={reqBatchNo}");
}
#endregion
#region 读BC详情详情
/// <summary>
/// 读BC详情详情
/// </summary>
/// <param name="attachFullName">文件完整路径</param>
/// <param name="fileName">文件名称</param>
/// <param name="tenantId">所属租户</param>
/// <param name="taskPKId">任务ID</param>
/// <param name="url">请求URL</param>
/// <returns></returns>
private async Task<TaskBCInfoReadDto> GetBCReaderInfo(string attachFullName, string fileName, long tenantId,string taskPKId,string url)
{
TaskBCInfoReadDto taskBCInfoReadDto = null;
try
{
DateTime nowDate = DateTime.Now;
EmailBCReadMessageInfo messageInfo = new EmailBCReadMessageInfo
{
Head = new TaskMessageHead
{
GID = IDGen.NextID().ToString(),
MessageType = "BOOKING_AMENDMENT",
SenderId = "DJY",
SenderName = "新大简云",
ReceiverId = "RulesEngine",
ReceiverName = "大简云规则引擎",
Version = "1.0",
RequestDate = nowDate.ToString("yyyy-MM-dd HH:mm:ss"),
RequestAction = "ReadFile",
},
Main = new EmailBCReadMessageMainInfo
{
TenantId = tenantId > 0 ? tenantId.ToString() : ""
}
};
NameValueCollection par = new NameValueCollection();
par.Add("jsonData", JSON.Serialize(messageInfo));
//解析BookingAmendment
var compareRlt = await ExcuteReadFile(par, url,new
{
file = "file",
fileName = fileName,
fileBytes = File.ReadAllBytes(attachFullName)
});
_logger.LogInformation($"读取BC附件详情 taskPKId={taskPKId}compareRlt={JSON.Serialize(compareRlt)}");
if (compareRlt.succ)
{
taskBCInfoReadDto = JSON.Deserialize<TaskBCInfoReadDto>(JSON.Serialize(compareRlt.extra));
}
}
catch (Exception ex)
{
_logger.LogError($"读取BC附件详情异常原因{ex.Message}");
}
return taskBCInfoReadDto;
}
#endregion
#region 请求BookingAmendment解析
/// <summary>
/// 请求BookingAmendment解析
/// </summary>
/// <param name="nameValueCollection">请求参数</param>
/// <param name="url">请求url</param>
/// <param name="fileInfo">文件</param>
/// <param name="contentType">请求类型</param>
/// <returns>返回回执</returns>
[NonAction]
private async Task<ParserReaderExcuteResultDto> ExcuteReadFile(NameValueCollection nameValueCollection, string url,dynamic fileInfo,
string contentType = "application/json")
{
ParserReaderExcuteResultDto model = null;
var result = string.Empty;
using (var httpClient = new HttpClient())
{
try
{
using (var reduceAttach = new MultipartFormDataContent())
{
string[] allKeys = nameValueCollection.AllKeys;
foreach (string key in allKeys)
{
var dataContent = new ByteArrayContent(Encoding.UTF8.GetBytes(nameValueCollection[key]));
dataContent.Headers.ContentDisposition = new ContentDispositionHeaderValue($"form-data")
{
Name = key
};
reduceAttach.Add(dataContent);
}
#region 文件参数
if (fileInfo != null)
{
var Content = new ByteArrayContent(fileInfo.fileBytes);
//Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
//{
// Name = fileInfo.file.ToString(),
// FileName = fileInfo.fileName.ToString(),
//};
Content.Headers.Add("Content-Type", contentType);
reduceAttach.Add(Content, fileInfo.file.ToString(), HttpUtility.UrlEncode(fileInfo.fileName.ToString()));
}
#endregion
//httpClient.DefaultRequestHeaders.Add("USER_KEY", App.Configuration["ApiUserKey"]);
//httpClient.DefaultRequestHeaders.Add("USER_SECRET", App.Configuration["ApiUserSecret"]);
//请求
var response = httpClient.PostAsync(url, reduceAttach).Result;
result = response.Content.ReadAsStringAsync().Result;
model = JSON.Deserialize<ParserReaderExcuteResultDto>(result);
}
}
catch (Exception ex)
{
_logger.LogInformation("请求读取BC附件详情读取详情异常原因{error}", ex.Message);
throw Oops.Oh($"请求读取BC附件详情读取详情异常原因{ex.Message}");
}
}
return model;
}
#endregion
}
/// <summary>

@ -136,5 +136,7 @@
"BCCompareUrl": "http://localhost:5110/api/TaskBookingAmendmentParser/ExcuteBookingAmendmentCompare",
"MSKAPIDjyUserKey": "wu",
"MSKAPIDjyUserSecret": "123456",
"MSKAPIOPEnvironment": "TEST"
"MSKAPIOPEnvironment": "TEST",
"BCReadWebApiUrl": "http://localhost:5110/api/TaskBCParser/ExcuteBCFileRead",
"BookingAmendReadWebApiUrl": "http://localhost:5110/api/TaskBookingAmendmentParser/ExcuteBookingAmendmentRead"
}

@ -0,0 +1,37 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceProjectSyncWin.Entities
{
[Tenant("db_master")]
[SugarTable("task_bc_info")]
public class TaskBCEntity
{
/// <summary>
/// 主键
/// </summary>
[SugarColumn(ColumnDescription = "主键", IsPrimaryKey = true)]
public string PK_ID { get; set; }
public string MBL_NO { get; set; }
public string BUSI_TYPE { get; set; }
public Nullable<DateTime> SI_CUT_DATE { get; set; }
public Nullable<DateTime> ETD { get; set; }
public Nullable<DateTime> ETA { get; set; }
public Nullable<DateTime> VGM_CUTOFF_TIME { get; set; }
public string TASK_ID { get; set; }
}
}

@ -8,6 +8,7 @@ using Furion.RemoteRequest.Extensions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using ServiceProjectSyncWin;
using ServiceProjectSyncWin.Entities;
using SqlSugar;
using System.Text;
using System.Text.RegularExpressions;
@ -420,10 +421,12 @@ public class SyncHisRecord: ISyncHisRecord,ITransient
public void SyncServiceProjectRecord4()
{
string s = "\n预期运输计划\nFrom To Mode Vessel Voy No. ETD ETA\nTianjin PAC Intl Cntr PELABUHAN TANJUNG MVS MERETE MAERSK 351W 2023-12-25 2024-01-10\nTerminal PELEPAS TERMINAL\nPELABUHAN TANJUNG SYDNEY DPW TERMINAL MVS RIO MADEIRA 402S 2024-01-14 2024-01-27\nPELEPAS TERMINAL\n";
string s1 = Regex.Match(s, "(?<=ETD\\sETA\\\\n)(\\w|\\s)+(?=\\\\n)").Value;
/*
SI
1
2
*/
//_db.Queryable<TaskBCEntity>().Max(a => a.ORG_STATUS_ID);
}

Loading…
Cancel
Save