修改SI 截单回执任务台

master
jianghaiqing 7 months ago
parent 276d5b7728
commit 7e114cc5dd

@ -20,21 +20,21 @@ namespace Myshipping.Application
/// </summary>
[SugarColumn(ColumnName = "BUSI_ID")]
[Description("业务主键")]
public long BUSI_ID { get; set; }
public string BUSI_ID { get; set; }
/// <summary>
/// 业务类型
/// </summary>
[SugarColumn(ColumnName = "BUSI_TYPE")]
[Description("业务类型")]
public long BUSI_TYPE { get; set; }
public string BUSI_TYPE { get; set; }
/// <summary>
/// 任务主键
/// </summary>
[SugarColumn(ColumnName = "TASK_ID")]
[Description("任务主键")]
public long TASK_ID { get; set; }
public string TASK_ID { get; set; }
/// <summary>
/// 打印时间

@ -131,5 +131,89 @@ namespace Myshipping.Application
/// </summary>
public Nullable<decimal> CBM { get; set; }
/// <summary>
/// 船名
/// </summary>
public string VESSEL { get; set; }
/// <summary>
/// 海关航次
/// </summary>
public string VOYNO { get; set; }
/// <summary>
/// 商品名称
/// </summary>
public string COMMODITY { get; set; }
/// <summary>
/// 收货地代码
/// </summary>
//[Description("收货地代码")]
public string PLACERECEIPTID { get; set; }
/// <summary>
/// 收货地
/// </summary>
public string PLACERECEIPT { get; set; }
/// <summary>
/// 起运港代码
/// </summary>
public string PORTLOADID { get; set; }
/// <summary>
/// 起运港
/// </summary>
public string PORTLOAD { get; set; }
/// <summary>
/// 卸货港代码
/// </summary>
public string PORTDISCHARGEID { get; set; }
/// <summary>
/// 卸货港
/// </summary>
public string PORTDISCHARGE { get; set; }
/// <summary>
/// 交货地代码
/// </summary>
public string PLACEDELIVERYID { get; set; }
/// <summary>
/// 交货地
/// </summary>
public string PLACEDELIVERY { get; set; }
/// <summary>
/// 处理状态 TEMP-待处理SUCC-处理成功FAILURE-失败
/// </summary>
public string PROCESS_STATUS { get; set; }
/// <summary>
/// 是否设置了自动更新订舱
/// </summary>
public bool IS_SET_AUTO_UPD_BOOKING { get; set; }
/// <summary>
/// 处理结果
/// </summary>
public string PROCESS_RESULT { get; set; }
/// <summary>
/// 处理时间
/// </summary>
public Nullable<DateTime> PROCESS_DATE { get; set; }
/// <summary>
/// 比对差异数量
/// </summary>
public Nullable<int> DIFF_NUM { get; set; }
/// <summary>
/// 是否已更新订舱
/// </summary>
public bool IS_UPDATE_BOOKING { get; set; }
/// <summary>
/// 更新订舱时间
/// </summary>
public Nullable<DateTime> UPDATE_BOOKING_DATE { get; set; }
}
}

@ -0,0 +1,112 @@
using Furion.JsonSerialization;
using Furion.RemoteRequest.Extensions;
using Furion;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Furion.Logging;
using Microsoft.Extensions.Logging;
namespace Myshipping.Application.Helper
{
public class EmailNoticeHelper
{
#region 发送邮件(内部方法)
/// <summary>
/// 发送邮件(内部方法)
/// </summary>
/// <param name="emailList">邮件详情列表</param>
/// <returns>返回回执</returns>
public async Task<CommonWebApiResult> InnerSendEmailNotice(List<EmailApiDto> emailList)
{
string emailUrl = string.Empty;
CommonWebApiResult result = new CommonWebApiResult();
//日志
var _logger = Log.CreateLogger(nameof(EmailNoticeHelper));
DateTime bDate = DateTime.Now;
try
{
emailUrl = App.Configuration["EmailNoticeUrl"];
var res = await emailUrl.SetBody(emailList, "application/json").PostAsync();
DateTime eDate = DateTime.Now;
TimeSpan ts = eDate.Subtract(bDate);
var timeDiff = ts.TotalMilliseconds;
_logger.LogInformation($"邮件上传完成 用时:{timeDiff}ms.发送邮件返回:{JSON.Serialize(res)}");
if (res != null && res.StatusCode == System.Net.HttpStatusCode.OK)
{
var userResult = await res.Content.ReadAsStringAsync();
var respObj = JsonConvert.DeserializeAnonymousType(userResult, new
{
Success = false,
Message = string.Empty,
Code = -9999,
});
result.succ = respObj.Success;
result.msg = respObj.Message;
}
}
catch (Exception ex)
{
_logger.LogInformation($"发送邮件异常:{ex.Message}");
result.succ = false;
result.msg = $"发送邮件异常:{ex.Message}";
}
return result;
}
#endregion
#region 发送邮件
/// <summary>
/// 发送邮件
/// </summary>
/// <param name="title">标题</param>
/// <param name="content">内容</param>
/// <param name="userEmailList">接收人列表</param>
/// <returns></returns>
public async Task<CommonWebApiResult> SendEmailNotice(string title, string content, List<string> userEmailList)
{
List<EmailApiDto> list = new List<EmailApiDto>();
EmailApiDto dto = new EmailApiDto
{
SendTo = string.Join(";", userEmailList.ToArray()),
Title = title,
Body = content,
Attaches = new List<AttachesInfo>(),
};
list.Add(dto);
return await InnerSendEmailNotice(list);
}
#endregion
}
public static class StringUtilsExtension
{
/// <summary>
/// 获取用户邮件列表
/// </summary>
/// <param name="input">任意字符串</param>
/// <returns>返回用户邮件列表</returns>
public static List<string> GetUserEmailList(this string input)
{
if (string.IsNullOrWhiteSpace(input))
return new List<string>();
return input.Split(new char[] { ',' }).ToList();
}
}
}

@ -15,6 +15,7 @@ using Microsoft.Extensions.Logging;
using Myshipping.Application.ConfigOption;
using Myshipping.Application.Entity;
using Myshipping.Application.Event;
using Myshipping.Application.Helper;
using Myshipping.Application.Service.BookingOrder.Dto;
using Myshipping.Application.Service.BookingSlot.Dto;
using Myshipping.Core;
@ -1055,54 +1056,66 @@ namespace Myshipping.Application
TimeSpan ts = eDate.Subtract(bDate);
var timeDiff = ts.TotalMilliseconds;
_logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg}", batchNo, timeDiff, compareResult.succ ? "成功" : "失败");
if(compareResult != null)
{
_logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg}", batchNo, timeDiff, compareResult.succ ? "成功" : "失败");
}
if (compareResult == null)
throw Oops.Oh($"舱位主键{slotId}请求BC比对失败返回为空");
if (compareResult != null)
{
DateTime nowDate = DateTime.Now;
DateTime nowDate = DateTime.Now;
var hisInfo = _bookingSlotCompareRepository.AsQueryable().Filter(null, true).First(a => a.COMPARE_BATCHNO == reqBatchNo);
var hisInfo = _bookingSlotCompareRepository.AsQueryable().Filter(null, true).First(a => a.COMPARE_BATCHNO == reqBatchNo);
if (hisInfo == null)
{
BookingSlotCompare entity = new BookingSlotCompare
{
SLOT_ID = slotId,
COMPARE_BATCHNO = reqBatchNo,
COMPARE_DIFF_NUM = compareResult.extra.IsExistsDiff ? compareResult.extra.ShowDetailList.Count : 0,
CreatedTime = nowDate,
UpdatedTime = nowDate,
CreatedUserId = UserManager.UserId,
CreatedUserName = UserManager.Name,
UpdatedUserId = UserManager.UserId,
UpdatedUserName = UserManager.Name,
COMPARE_TYPE = "BC_MODIFY",
COMPARE_RLT = JSON.Serialize(compareResult.extra.ShowDetailList),
};
if (hisInfo == null)
{
BookingSlotCompare entity = new BookingSlotCompare
await _bookingSlotCompareRepository.InsertAsync(entity);
}
else
{
SLOT_ID = slotId,
COMPARE_BATCHNO = reqBatchNo,
COMPARE_DIFF_NUM = compareResult.extra.IsExistsDiff ? compareResult.extra.ShowDetailList.Count : 0,
CreatedTime = nowDate,
UpdatedTime = nowDate,
CreatedUserId = UserManager.UserId,
CreatedUserName = UserManager.Name,
UpdatedUserId = UserManager.UserId,
UpdatedUserName = UserManager.Name,
COMPARE_TYPE = "BC_MODIFY",
COMPARE_RLT = JSON.Serialize(compareResult.extra.ShowDetailList),
};
hisInfo.COMPARE_DIFF_NUM = compareResult.extra.IsExistsDiff ? compareResult.extra.ShowDetailList.Count : 0;
hisInfo.UpdatedTime = nowDate;
hisInfo.UpdatedUserId = UserManager.UserId;
hisInfo.UpdatedUserName = UserManager.Name;
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);
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();
}
//throw Oops.Oh($"舱位主键{slotId}请求BC比对失败返回为空");
await _bookingSlotCompareRepository.AsUpdateable(hisInfo).UpdateColumns(it =>
new
if (compareResult.extra.ShowDetailList == null || compareResult.extra.ShowDetailList.Count == 0)
{
it.COMPARE_DIFF_NUM,
it.COMPARE_RLT,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
new EmailNoticeHelper().SendEmailNotice($"MBLNO={bcSrcDto.MBLNo} 与舱位比对差异失败比对结果为0", $"MBLNO={bcSrcDto.MBLNo} 与舱位比对差异失败比对结果为0", App.Configuration["EmailNoticeDefaultUser"].GetUserEmailList());
}
}
else
{
new EmailNoticeHelper().SendEmailNotice($"MBLNO={bcSrcDto.MBLNo} 与舱位比对差异失败,未获取到比对结果", $"MBLNO={bcSrcDto.MBLNo} 与舱位比对差异失败,未获取到比对结果", App.Configuration["EmailNoticeDefaultUser"].GetUserEmailList());
}
}
#endregion
@ -1162,7 +1175,7 @@ namespace Myshipping.Application
{
_logger.LogInformation("推送BC比对异常原因{error}", ex.Message);
throw Oops.Oh($"推送BC比对异常原因{ex.Message}");
// throw Oops.Oh($"推送BC比对异常原因{ex.Message}");
}
}

@ -0,0 +1,247 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application.Service
{
public class SIFeedBackCompareDto
{
/// <summary>
/// 提单号
/// </summary>
public string MblNo { get; set; }
/// <summary>
/// 船公司
/// </summary>
public string Carrier { get; set; }
/// <summary>
/// 通知时间
/// </summary>
public Nullable<DateTime> NoticeDate { get; set; }
/// <summary>
/// 发货人
/// </summary>
public string Shipper { get; set; }
/// <summary>
/// 收货人
/// </summary>
public string Consignee { get; set; }
/// <summary>
/// 通知人
/// </summary>
public string NotifyParty { get; set; }
/// <summary>
/// 第二通知人
/// </summary>
public string NotifyParty2 { get; set; }
/// <summary>
/// 订舱方
/// </summary>
public string TransportReceiver { get; set; }
/// <summary>
/// 唛头
/// </summary>
public string Marks { get; set; }
/// <summary>
/// HS CODE
/// </summary>
public string HSCode { get; set; }
/// <summary>
/// 货描
/// </summary>
public string Description { get; set; }
/// <summary>
/// 船名
/// </summary>
public string Vessel { get; set; }
/// <summary>
/// 航次
/// </summary>
public string VoyNo { get; set; }
/// <summary>
/// 截单备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 付费方式
/// </summary>
public string BLFRT { get; set; }
/// <summary>
/// 运输条款
/// </summary>
/// <example>CY-CY</example>
public string Service { get; set; }
/// <summary>
/// 签单方式
/// </summary>
/// <example>TELEX</example>
public string IssueType { get; set; }
/// <summary>
/// 提取签单方式
/// </summary>
/// <example>TELEX</example>
public string TakeIssueTypeName { get; set; }
/// <summary>
/// 装货港代码
/// </summary>
/// <example>CNTAO</example>
public string PortLoadId { get; set; }
/// <summary>
/// 装货港
/// </summary>
public string PortLoad { get; set; }
/// <summary>
/// 卸货港代码
/// </summary>
/// <example>GUPIT</example>
public string PortDischargeId { get; set; }
/// <summary>
/// 卸货港
/// </summary>
public string PortDischarge { get; set; }
/// <summary>
/// 中转港代码
/// </summary>
/// <example>GUPIT</example>
public string PortTransId { get; set; }
/// <summary>
/// 中转港
/// </summary>
public string PortTrans { get; set; }
/// <summary>
/// 目的地代码
/// </summary>
/// <example>GUPIT</example>
public string DestinationId { get; set; }
/// <summary>
/// 目的地
/// </summary>
public string Destination { get; set; }
/// <summary>
/// 件数
/// </summary>
public int? PKGS { get; set; }
/// <summary>
/// 包装
/// </summary>
public string KindPKGS { get; set; }
/// <summary>
/// 毛重
/// </summary>
public decimal? KGS { get; set; }
/// <summary>
/// 尺寸
/// </summary>
public decimal? CBM { get; set; }
/// <summary>
/// 第三付款地
/// </summary>
public string ThirdPayAddr { get; set; }
/// <summary>
/// 截单上传时间
/// </summary>
public string SubmittedDate { get; set; }
/// <summary>
/// 签单方式(seaway、original、telex)
/// </summary>
public string DocumentType { get; set; }
/// <summary>
/// 提单份数
/// </summary>
public string BillOfNum { get; set; }
/// <summary>
/// 放单方式
/// </summary>
public string ReleaseInstruction { get; set; }
/// <summary>
/// 是否拆单 SPLIT-标识已拆单
/// </summary>
public string SISubType { get; set; }
/// <summary>
/// 箱信息
/// </summary>
public List<SIFeedBackCompareContaDto> ContaList { get; set; }
}
public class SIFeedBackCompareContaDto
{
/// <summary>
/// 集装箱号
/// </summary>
/// <example>RFCU2088064</example>
public string ContaNo { get; set; }
/// <summary>
/// 铅封号
/// </summary>
/// <example>T090518</example>
public string SealNo { get; set; }
/// <summary>
/// 件数
/// </summary>
/// <example>222</example>
public int PKGS { get; set; }
/// <summary>
/// 重量
/// </summary>
/// <example>1651</example>
public decimal? KGS { get; set; }
/// <summary>
/// 尺寸
/// </summary>
/// <example>9.67</example>
public decimal? CBM { get; set; }
/// <summary>
/// 箱型代码
/// </summary>
/// <example>20GP</example>
public string ContaType { get; set; }
/// <summary>
/// 箱型
/// </summary>
/// <example>20GP</example>
public string ContaTypeName { get; set; }
/// <summary>
/// 包装
/// </summary>
public string KINDPKGS { get; set; }
/// <summary>
/// 称重方式
/// </summary>
public string WeighType { get; set; }
/// <summary>
/// 称重重量
/// </summary>
public Nullable<decimal> WeighKGS { get; set; }
}
}

@ -1,6 +1,7 @@
using Mapster;
using Myshipping.Application.Entity;
using Myshipping.Application.Entity.TaskManagePlat;
using Myshipping.Application.Service;
using Myshipping.Application.Service.TaskManagePlat.Dtos;
using System;
using System.Collections.Generic;
@ -1041,7 +1042,14 @@ namespace Myshipping.Application
.Map(dest => dest.PKGS, src => src.PKGS)
.Map(dest => dest.KINDPKGS, src => src.KindPKGS)
.Map(dest => dest.KGS, src => src.KGS)
.Map(dest => dest.CBM, src => src.CBM);
.Map(dest => dest.CBM, src => src.CBM)
.Map(dest => dest.VESSEL, src => src.Vessel)
.Map(dest => dest.VOYNO, src => src.VoyNo)
.Map(dest => dest.COMMODITY, src => src.Commodity)
.Map(dest => dest.PORTLOAD, src => src.PortLoad)
.Map(dest => dest.PORTDISCHARGE, src => src.PortDischarge)
.Map(dest => dest.PLACEDELIVERY, src => src.PlaceReceipt)
.Map(dest => dest.PLACEDELIVERY, src => src.PlaceDelivery);
config.ForType<TaskManageOrderSIFeedBackContaInfo, TaskSISubmittedCtn>()
.Map(dest => dest.CNTRNO, src => src.ContaNo)
@ -1101,8 +1109,33 @@ namespace Myshipping.Application
.Map(dest => dest.CurContaLocation, src => src.CUR_CONTA_LOCATION)
.Map(dest => dest.DetentionFeeTillDate, src => src.DETENTION_FEE_TILL_DATE);
config.ForType<BookingOrder, SIFeedBackCompareDto>()
.Map(dest => dest.MblNo, src => src.MBLNO)
.Map(dest => dest.Carrier, src => src.CARRIERID)
.Map(dest => dest.Shipper, src => src.SHIPPER)
.Map(dest => dest.Consignee, src => src.CONSIGNEE)
.Map(dest => dest.NotifyParty, src => src.NOTIFYPARTY)
.Map(dest => dest.NotifyParty2, src => src.NOTIFYPARTY2)
.Map(dest => dest.IssueType, src => src.ISSUETYPE)
.Map(dest => dest.BillOfNum, src => src.NOBILL)
.Map(dest => dest.Marks, src => src.MARKS)
.Map(dest => dest.HSCode, src => src.HSCODE)
.Map(dest => dest.Description, src => src.DESCRIPTION)
.Map(dest => dest.KindPKGS, src => src.KINDPKGS);
config.ForType<TaskSISubmitted, SIFeedBackCompareDto>()
.Map(dest => dest.MblNo, src => src.MBL_NO)
.Map(dest => dest.Carrier, src => src.CARRIER)
.Map(dest => dest.Shipper, src => src.SHIPPER)
.Map(dest => dest.Consignee, src => src.CONSIGNEE)
.Map(dest => dest.NotifyParty, src => src.NOTIFYPARTY)
.Map(dest => dest.NotifyParty2, src => src.NOTIFYPARTY2)
.Map(dest => dest.IssueType, src => src.ISSUETYPE)
.Map(dest => dest.BillOfNum, src => src.BILLOF_NUM)
.Map(dest => dest.Marks, src => src.MARKS)
.Map(dest => dest.HSCode, src => src.HSCODE)
.Map(dest => dest.Description, src => src.DESCRIPTION)
.Map(dest => dest.KindPKGS, src => src.KINDPKGS);
}
}
}

@ -53,7 +53,6 @@ namespace Myshipping.Application
/// <example>20GP</example>
public string ContaTypeName { get; set; }
/// <summary>
/// 包装
/// </summary>

@ -23,7 +23,7 @@ namespace Myshipping.Application
public string Carrier { get; set; }
/// <summary>
/// 船公司
/// 通知时间
/// </summary>
public Nullable<DateTime> NoticeDate { get; set; }
@ -65,6 +65,17 @@ namespace Myshipping.Application
/// 货描
/// </summary>
public string Description { get; set; }
/// <summary>
/// 船名
/// </summary>
public string Vessel { get; set; }
/// <summary>
/// 航次
/// </summary>
public string VoyNo { get; set; }
/// <summary>
/// 截单备注
/// </summary>
@ -176,6 +187,21 @@ namespace Myshipping.Application
/// </summary>
public string SISubType { get; set; }
/// <summary>
/// 商品名称
/// </summary>
public string Commodity { get; set; }
/// <summary>
/// 收货地
/// </summary>
public string PlaceReceipt { get; set; }
/// <summary>
/// 交货地
/// </summary>
public string PlaceDelivery { get; set; }
/// <summary>
/// 箱信息
/// </summary>

@ -736,6 +736,7 @@ namespace Myshipping.Application
}
}
if (model.GenerateMethod == "GEN_BOOKING_SLOT")
{
#region 推送舱位、推送订舱
@ -1381,6 +1382,7 @@ namespace Myshipping.Application
var djyCustomerInfo = _djyCustomerService.Detail(new GetDjyCustomerInput { Id = generateModel.CustomerId.Value })
.GetAwaiter().GetResult();
generateModel.CustomerContactList.ForEach(contact =>
{
DjyCustomerContactOutput djyCustomerContactMan = null;
@ -3464,6 +3466,28 @@ namespace Myshipping.Application
return id;
}
#endregion
#region 校验生成订舱或舱位的联系人信息
/// <summary>
/// 校验生成订舱或舱位的联系人信息
/// </summary>
/// <param name="model">请求参数</param>
private void ValidateContact(BookingOrSlotGenerateDto model)
{
if (model.GenerateMethod == "GEN_BOOKING_SLOT" || model.GenerateMethod == "GEN_BOOKING" || model.GenerateMethod == "UPD_BOOKING")
{
if (model.CustomerContactList != null && model.CustomerContactList.Count > 0)
{
//校验提交的联系人必须是委托客户绑定的,方式前端缓存错误的联系人
//取委托客户下面所有的联系人列表
var djyCustomerInfo = _djyCustomerService.Detail(new GetDjyCustomerInput { Id = model.CustomerId.Value })
.GetAwaiter().GetResult();
}
}
}
#endregion
}
/// <summary>

@ -1,4 +1,7 @@
using Furion.DynamicApiController;
using Furion;
using Furion.DependencyInjection;
using Furion.DistributedIDGenerator;
using Furion.DynamicApiController;
using Furion.FriendlyException;
using Furion.JsonSerialization;
using ICSharpCode.SharpZipLib.Zip;
@ -6,13 +9,21 @@ using Mapster;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Myshipping.Application.Entity;
using Myshipping.Application.Entity.TaskManagePlat;
using Myshipping.Application.Helper;
using Myshipping.Application.Service;
using Myshipping.Core;
using Myshipping.Core.Service;
using NPOI.OpenXmlFormats.Dml.Diagram;
using RabbitMQ.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Yitter.IdGenerator;
namespace Myshipping.Application
{
@ -20,16 +31,19 @@ namespace Myshipping.Application
/// 截单回执
/// </summary>
[ApiDescriptionSettings("Application", Name = "TaskManageSISubmitted", Order = 10)]
public class TaskManageSISubmittedService : ITaskManageSISubmittedService, IDynamicApiController
public class TaskManageSISubmittedService : ITaskManageSISubmittedService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<TaskSISubmitted> _taskSISubmittedRepository;
private readonly SqlSugarRepository<TaskSISubmittedCtn> _taskSISubmittedCtnRepository;
private readonly SqlSugarRepository<TaskBaseInfo> _taskBaseRepository;
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
private readonly SqlSugarRepository<BookingCtn> _bookingCtnRepository;
private readonly SqlSugarRepository<BusinessCompareDiffRecord> _businessCompareDiffRecordRepository;
private readonly ILogger<TaskManageSISubmittedService> _logger;
private readonly IBookingValueAddedService _bookingValueAddedService;
private readonly IDjyTenantParamService _djyTenantParamService;
private readonly IBookingOrderService _bookingOrderService;
//租户SI回执是否自动更新订舱
const string CONST_SI_SUBMITTED_DEFAULT_PARAM = "SI_SUBMITTED_AUTO_UPDATE_ORDER";
@ -39,7 +53,10 @@ namespace Myshipping.Application
SqlSugarRepository<TaskBaseInfo> taskBaseRepository,
SqlSugarRepository<BookingOrder> bookingOrderRepository,
SqlSugarRepository<BusinessCompareDiffRecord> businessCompareDiffRecordRepository,
IBookingValueAddedService bookingValueAddedService, IDjyTenantParamService djyTenantParamService)
SqlSugarRepository<BookingCtn> bookingCtnRepository,
SqlSugarRepository<TaskSISubmittedCtn> taskSISubmittedCtnRepository,
IBookingValueAddedService bookingValueAddedService, IDjyTenantParamService djyTenantParamService,
IBookingOrderService bookingOrderService)
{
_logger = logger;
_taskSISubmittedRepository = taskSISubmittedRepository;
@ -48,6 +65,9 @@ namespace Myshipping.Application
_bookingValueAddedService = bookingValueAddedService;
_djyTenantParamService = djyTenantParamService;
_businessCompareDiffRecordRepository = businessCompareDiffRecordRepository;
_bookingCtnRepository = bookingCtnRepository;
_taskSISubmittedCtnRepository = taskSISubmittedCtnRepository;
_bookingOrderService = bookingOrderService;
}
#region 获取截单回执详情
@ -236,20 +256,22 @@ namespace Myshipping.Application
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
TaskSISubmitted siSubmitted = null;
try
{
/*
1SI_SUBMITTED_AUTO_UPDATE_ORDER=ENABLE
2
3
4
*/
var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPkId);
var taskBase = _taskBaseRepository.AsQueryable().Filter(null,true).First(a => a.PK_ID == taskPkId && a.TenantId == UserManager.TENANT_ID);
if (taskBase == null)
throw Oops.Oh($"任务主键{taskPkId}无法获取业务信息");
var siSubmitted = _taskSISubmittedRepository.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID);
siSubmitted = _taskSISubmittedRepository.AsQueryable().Filter(null, true).First(a => a.TASK_ID == taskBase.PK_ID && a.TenantId == UserManager.TENANT_ID);
if (siSubmitted == null)
throw Oops.Oh($"截单回执主键{taskPkId}无法获取业务信息");
@ -266,19 +288,399 @@ namespace Myshipping.Application
paramConfig = paramList.FirstOrDefault(a => a.ParaCode.Equals(CONST_SI_SUBMITTED_DEFAULT_PARAM, StringComparison.OrdinalIgnoreCase));
}
if(paramConfig != null)
{
//更新前先比对一遍差异
//更新订舱数据
var siCtnList = _taskSISubmittedCtnRepository.AsQueryable().Filter(null, true).Where(a => a.P_PKID == siSubmitted.PK_ID && a.TenantId == UserManager.TENANT_ID).ToList();
//更新任务的状态
//直接完成SI的回执任务
if (paramConfig != null && paramConfig.ParaValue.Equals("ENABLE",StringComparison.OrdinalIgnoreCase))
{
siSubmitted.IS_SET_AUTO_UPD_BOOKING = true;
var orderInfo = _bookingOrderRepository.AsQueryable().Filter(null, true)
.First(a => a.MBLNO == siSubmitted.MBL_NO && a.IsDeleted == false && a.TenantId == UserManager.TENANT_ID && a.ParentId == 0);
if(orderInfo != null)
{
siSubmitted.BOOKING_ID = orderInfo.Id;
var ctnList = _bookingCtnRepository.AsQueryable().Filter(null, true)
.Where(a => a.BILLID == orderInfo.Id && a.IsDeleted == false && a.TenantId == UserManager.TENANT_ID).ToList();
SIFeedBackCompareDto siSrcDto = orderInfo.Adapt<SIFeedBackCompareDto>();
if (ctnList.Count > 0)
{
siSrcDto.ContaList = ctnList.Select(t => new SIFeedBackCompareContaDto
{
ContaNo = t.CNTRNO,
SealNo = t.SEALNO,
ContaType = t.CTNCODE,
ContaTypeName = t.CTNALL,
PKGS = t.PKGS.HasValue ? t.PKGS.Value : 0,
CBM = t.CBM,
KGS = t.KGS,
WeighType = t.WEIGHTYPE == "累加" ? "ADD" : "ALL",
WeighKGS = t.WEIGHKGS
}).ToList();
}
SIFeedBackCompareDto siTargetDto = siSubmitted.Adapt<SIFeedBackCompareDto>();
if (siCtnList.Count > 0)
{
siTargetDto.ContaList = siCtnList.Select(t => new SIFeedBackCompareContaDto
{
ContaNo = t.CNTRNO,
SealNo = t.SEALNO,
ContaType = t.CTNCODE,
ContaTypeName = t.CTNALL,
PKGS = t.PKGS.HasValue ? t.PKGS.Value : 0,
CBM = t.CBM,
KGS = t.KGS,
WeighType = t.WEIGHTYPE,
WeighKGS = t.WEIGHKGS
}).ToList();
}
//更新前先比对一遍差异
var compareRlt = await PushCompareSIInfo(siSrcDto, siTargetDto, orderInfo.Id, taskPkId);
if (string.IsNullOrWhiteSpace(compareRlt.Item1))
{
siSubmitted.DIFF_NUM = compareRlt.Item2;
}
SaveBookingOrderInput bkModel = null;
if (orderInfo != null)
{
bkModel = new SaveBookingOrderInput
{
Id = orderInfo.Id,
ctnInputs = new List<BookingCtnDto>(),
ChangedFields = new List<string>()
};
if (!string.IsNullOrEmpty(siSubmitted.ISSUETYPE))
{
if (siSubmitted.ISSUETYPE.Equals("seaway", StringComparison.OrdinalIgnoreCase))
{
//bkModel.ISSUETYPE = "seaway";
bkModel.ISSUETYPE = "Seaway Bill";
}
else if (siSubmitted.ISSUETYPE.Equals("telex", StringComparison.OrdinalIgnoreCase))
{
//bkModel.ISSUETYPE = "telex";
bkModel.ISSUETYPE = "Telex";
}
else if (siSubmitted.ISSUETYPE.Equals("seaway", StringComparison.OrdinalIgnoreCase))
{
//bkModel.ISSUETYPE = "original";
bkModel.ISSUETYPE = "Original";
}
bkModel.ChangedFields.Add(nameof(SaveBookingOrderInput.ISSUETYPE));
//bkModel.ChangedFields.Add(nameof(SaveBookingOrderInput.ISSUETYPE));
}
if (!string.IsNullOrEmpty(siSubmitted.SHIPPER))
{
bkModel.SHIPPER = siSubmitted.SHIPPER;
bkModel.ChangedFields.Add(nameof(SaveBookingOrderInput.SHIPPER));
}
if (!string.IsNullOrEmpty(siSubmitted.CONSIGNEE))
{
bkModel.CONSIGNEE = siSubmitted.CONSIGNEE;
bkModel.ChangedFields.Add(nameof(SaveBookingOrderInput.CONSIGNEE));
}
if (!string.IsNullOrEmpty(siSubmitted.NOTIFYPARTY))
{
bkModel.NOTIFYPARTY = siSubmitted.NOTIFYPARTY;
bkModel.ChangedFields.Add(nameof(SaveBookingOrderInput.NOTIFYPARTY));
}
if (!string.IsNullOrEmpty(siSubmitted.NOTIFYPARTY2))
{
bkModel.NOTIFYPARTY2 = siSubmitted.NOTIFYPARTY2;
bkModel.ChangedFields.Add(nameof(SaveBookingOrderInput.NOTIFYPARTY2));
}
if (!string.IsNullOrEmpty(siSubmitted.KINDPKGS))
{
bkModel.KINDPKGS = siSubmitted.KINDPKGS;
bkModel.ChangedFields.Add(nameof(SaveBookingOrderInput.KINDPKGS));
}
if (!string.IsNullOrEmpty(siSubmitted.DESCRIPTION))
{
bkModel.DESCRIPTION = siSubmitted.DESCRIPTION;
bkModel.ChangedFields.Add(nameof(SaveBookingOrderInput.DESCRIPTION));
}
if (!string.IsNullOrEmpty(siSubmitted.HSCODE))
{
bkModel.HSCODE = siSubmitted.HSCODE;
bkModel.ChangedFields.Add(nameof(SaveBookingOrderInput.HSCODE));
}
}
if (ctnList.Count > 0)
{
List<BookingCtn> oddCtnList = new List<BookingCtn>();
foreach (var ctn in ctnList)
{
if (!string.IsNullOrWhiteSpace(ctn.CTNCODE) && string.IsNullOrWhiteSpace(ctn.CNTRNO) && ctn.CTNNUM.HasValue && ctn.CTNNUM.Value > 1)
{
for (int i = 0; i < ctn.CTNNUM.Value - 1; i++)
{
oddCtnList.Add(new BookingCtn
{
BILLID = orderInfo.Id,
IsDeleted = false,
CreatedTime = DateTime.Now,
UpdatedTime = DateTime.Now,
CreatedUserId = ctn.CreatedUserId,
CreatedUserName = ctn.CreatedUserName,
CTNCODE = ctn.CTNCODE,
CTNALL = ctn.CTNALL,
});
}
ctn.CTNNUM = 1;
}
}
if (oddCtnList.Count > 0)
{
ctnList.AddRange(oddCtnList);
}
}
if (siCtnList.Count > 0)
{
siCtnList.ForEach(x =>
{
var ctn = ctnList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(x.CNTRNO) && !string.IsNullOrWhiteSpace(a.CNTRNO)
&& a.CNTRNO.Equals(x.CNTRNO, StringComparison.OrdinalIgnoreCase));
if (ctn != null)
{
ctn.CTNCODE = x.CTNCODE;
ctn.CTNALL = x.CTNALL;
ctn.CTNNUM = 1;
ctn.SEALNO = x.SEALNO;
ctn.PKGS = x.PKGS;
ctn.KGS = x.KGS;
ctn.WEIGHTYPE = x.WEIGHTYPE;
ctn.WEIGHKGS = x.WEIGHKGS;
ctn.CBM = x.CBM;
ctn.REMARK += "SI Add";
ctn.TenantId = UserManager.TENANT_ID;
ctn.CreatedTime = DateTime.Now;
ctn.CreatedUserId = UserManager.UserId;
ctn.CreatedUserName = UserManager.Name;
if (x.WEIGHKGS.HasValue && x.KGS.HasValue)
ctn.TAREWEIGHT = x.WEIGHKGS.Value - x.KGS.Value;
}
else
{
ctn = ctnList.FirstOrDefault(a => a.CTNCODE == x.CTNCODE && string.IsNullOrWhiteSpace(a.CNTRNO));
if (ctn != null)
{
ctn.CNTRNO = x.CNTRNO;
ctn.CTNCODE = x.CTNCODE;
ctn.CTNALL = x.CTNALL;
ctn.CTNNUM = 1;
ctn.SEALNO = x.SEALNO;
ctn.PKGS = x.PKGS;
ctn.KGS = x.KGS;
ctn.WEIGHTYPE = x.WEIGHTYPE;
ctn.WEIGHKGS = x.WEIGHKGS;
ctn.CBM = x.CBM;
ctn.REMARK += "SI Add";
ctn.TenantId = UserManager.TENANT_ID;
ctn.CreatedTime = DateTime.Now;
ctn.CreatedUserId = UserManager.UserId;
ctn.CreatedUserName = UserManager.Name;
if (x.WEIGHKGS.HasValue && x.KGS.HasValue)
ctn.TAREWEIGHT = x.WEIGHKGS.Value - x.KGS.Value;
}
else
{
ctn = ctnList.FirstOrDefault(a => a.CTNALL == x.CTNALL && string.IsNullOrWhiteSpace(a.CNTRNO));
if (ctn != null)
{
ctn.CNTRNO = x.CNTRNO;
ctn.CTNCODE = x.CTNCODE;
ctn.CTNALL = x.CTNALL;
ctn.CTNNUM = 1;
ctn.SEALNO = x.SEALNO;
ctn.PKGS = x.PKGS;
ctn.KGS = x.KGS;
ctn.WEIGHTYPE = x.WEIGHTYPE;
ctn.WEIGHKGS = x.WEIGHKGS;
ctn.CBM = x.CBM;
ctn.REMARK += "SI Add";
ctn.TenantId = UserManager.TENANT_ID;
ctn.CreatedTime = DateTime.Now;
ctn.CreatedUserId = UserManager.UserId;
ctn.CreatedUserName = UserManager.Name;
if (x.WEIGHKGS.HasValue && x.KGS.HasValue)
ctn.TAREWEIGHT = x.WEIGHKGS.Value - x.KGS.Value;
}
else
{
ctnList.Add(new BookingCtn
{
BILLID = orderInfo.Id,
IsDeleted = false,
CreatedTime = DateTime.Now,
UpdatedTime = DateTime.Now,
CreatedUserId = UserManager.UserId,
CreatedUserName = UserManager.Name,
TenantId = UserManager.TENANT_ID,
CNTRNO = x.CNTRNO,
CTNCODE = x.CTNCODE,
CTNALL = x.CTNALL,
CTNNUM = 1,
SEALNO = x.SEALNO,
PKGS = x.PKGS,
KGS = x.KGS,
WEIGHTYPE = x.WEIGHTYPE,
WEIGHKGS = x.WEIGHKGS,
CBM = x.CBM,
REMARK = "SI Add",
});
}
}
}
});
if (ctnList.Any(t => t.REMARK.IndexOf("SI Add") < 0))
ctnList.ForEach(t => { if (t.REMARK.IndexOf("SI Add") < 0) ctnList.Remove(t); });
}
//更新订舱数据
var bkRlt = await _bookingOrderService.Save(bkModel);
if (bkRlt.Id > 0)
{
siSubmitted.PROCESS_STATUS = "SUCC";
siSubmitted.PROCESS_DATE = DateTime.Now;
siSubmitted.IS_UPDATE_BOOKING = true;
siSubmitted.UPDATE_BOOKING_DATE = DateTime.Now;
//直接完成SI的回执任务
if (taskBase.IS_PUBLIC == 1)
{
//更新任务的状态
taskBase.IS_PUBLIC = 0;
taskBase.IS_COMPLETE = 1;
taskBase.COMPLETE_DEAL = "AUTO";
taskBase.COMPLETE_DEAL_NAME = "自动";
taskBase.COMPLETE_DATE = DateTime.Now;
if (!string.IsNullOrWhiteSpace(orderInfo.OP))
{
taskBase.RealUserId = long.Parse(orderInfo.OPID);
taskBase.RealUserName = orderInfo.OP;
taskBase.UpdatedTime = DateTime.Now;
taskBase.UpdatedUserId = long.Parse(orderInfo.OPID);
taskBase.UpdatedUserName = orderInfo.OP;
}
else
{
taskBase.RealUserId = orderInfo.CreatedUserId.Value;
taskBase.RealUserName = orderInfo.CreatedUserName;
taskBase.UpdatedTime = DateTime.Now;
taskBase.UpdatedUserId = orderInfo.CreatedUserId.Value;
taskBase.UpdatedUserName = orderInfo.CreatedUserName;
}
//更新任务台,将当前任务变更为个人任务
await _taskBaseRepository.AsUpdateable(taskBase).UpdateColumns(it => new {
it.IS_PUBLIC,
it.RealUserId,
it.RealUserName,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
}
else
{
taskBase.IS_COMPLETE = 1;
taskBase.COMPLETE_DEAL = "AUTO";
taskBase.COMPLETE_DEAL_NAME = "自动";
taskBase.COMPLETE_DATE = DateTime.Now;
if (!string.IsNullOrWhiteSpace(orderInfo.OP))
{
taskBase.RealUserId = long.Parse(orderInfo.OPID);
taskBase.RealUserName = orderInfo.OP;
taskBase.UpdatedTime = DateTime.Now;
taskBase.UpdatedUserId = long.Parse(orderInfo.OPID);
taskBase.UpdatedUserName = orderInfo.OP;
}
else
{
taskBase.RealUserId = orderInfo.CreatedUserId.Value;
taskBase.RealUserName = orderInfo.CreatedUserName;
taskBase.UpdatedTime = DateTime.Now;
taskBase.UpdatedUserId = orderInfo.CreatedUserId.Value;
taskBase.UpdatedUserName = orderInfo.CreatedUserName;
}
//更新任务台,将当前任务变更为个人任务
await _taskBaseRepository.AsUpdateable(taskBase).UpdateColumns(it => new {
it.IS_PUBLIC,
it.RealUserId,
it.RealUserName,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
}
}
else
{
siSubmitted.PROCESS_STATUS = "FAILURE";
siSubmitted.PROCESS_DATE = DateTime.Now;
siSubmitted.PROCESS_RESULT = "更新订舱信息失败";
siSubmitted.UPDATE_BOOKING_DATE = DateTime.Now;
}
}
else
{
result.succ = false;
result.msg = $"提单号{siSubmitted.MBL_NO} 检索订舱数据失败";
}
}
else
{
result.succ = false;
result.msg = "当前租户没开通自动SI回执是否自动更新订舱";
siSubmitted.IS_SET_AUTO_UPD_BOOKING = false;
}
}
catch (Exception ex)
@ -287,8 +689,268 @@ namespace Myshipping.Application
result.msg = ex.Message;
}
if (!result.succ && siSubmitted != null)
{
siSubmitted.PROCESS_STATUS = "FAILURE";
siSubmitted.PROCESS_DATE = DateTime.Now;
if (result.msg.Length > 500)
{
siSubmitted.PROCESS_RESULT = result.msg.Substring(0,500);
}
else
{
siSubmitted.PROCESS_RESULT = result.msg;
}
await _taskSISubmittedRepository.AsUpdateable(siSubmitted).UpdateColumns(x => new
{
x.PROCESS_DATE,
x.PROCESS_STATUS,
x.PROCESS_RESULT,
x.IS_SET_AUTO_UPD_BOOKING
}).ExecuteCommandAsync();
}
return result;
}
#endregion
/// <summary>
/// 获取SI反馈信息
/// </summary>
/// <param name="taskPKId">任务主键</param>
/// <returns>返回结果</returns>
[HttpGet("/TaskManageSISubmitted/GetSIFeedBackInfo")]
public async Task<TaskSISubmittedShowDto> GetSIFeedBackInfo(string taskPKId)
{
TaskSISubmittedShowDto dto = new TaskSISubmittedShowDto();
var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPKId);
if (taskBase == null)
throw Oops.Oh($"任务主键{taskPKId}无法获取业务信息");
var siSubmitted = _taskSISubmittedRepository.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID);
if (siSubmitted == null)
throw Oops.Oh($"截单回执主键{taskPKId}无法获取业务信息");
var bookOrderList = _bookingOrderRepository.AsQueryable().Filter(null, true)
.InnerJoin<BookingCtn>((bk, ctn) => bk.Id == ctn.BILLID)
.Where((bk, ctn) => bk.Id == siSubmitted.BOOKING_ID.Value && bk.TenantId == UserManager.TENANT_ID)
.Select((bk, ctn) => new { bk = bk, ctn = ctn }).ToList();
var orderInfo = bookOrderList.FirstOrDefault().bk;
//var siFeedBackList = _taskSISubmittedRepository.EntityContext.Queryable<TaskSISubmitted>()
// .InnerJoin<TaskSISubmittedCtn>((si, ctn) => si.PK_ID == ctn.P_PKID)
// .Where((si, ctn) => si.TASK_PKID == model.TaskId && si.TenantId == UserManager.TENANT_ID)
// .Select((si, ctn) => new { si = si, ctn = ctn }).ToList();
//if (siFeedBackList.Count == 0)
// throw Oops.Oh($"SI反馈信息不存在");
//var siFeedBackInfo = siFeedBackList.FirstOrDefault().si;
//var resultInfo = siFeedBackInfo.Adapt<TaskSIFeedBackResultBusiDto>();
//resultInfo.ContaList = siFeedBackList.Select(t => t.ctn.Adapt<TaskSIFeedBackResultContaDto>()).ToList();
//model.BusiInfo = resultInfo;
//if (orderInfo != null)
//{
// //订舱
// model.BookingOrder = orderInfo.Adapt<TaskBookingOrderDto>();
//}
////进行数据比对确认差异字段KEY
//var mainDiff = await InnerCompareMainInfoDiff(orderInfo, siFeedBackInfo);
//model.SICompareOrderKeyList = mainDiff;
//var contaDiff = await InnerCompareContaInfoDiff(bookOrderList.Select(t => t.ctn).ToList(),
// siFeedBackList.Select(t => t.ctn).ToList());
//model.SICompareOrderContaKeyList = contaDiff;
return dto;
}
#region 推送BC变更比对
/// <summary>
/// 推送BC变更比对sysUser
/// </summary>
/// <param name="siSrcDto">订舱详情</param>
/// <param name="siTargetDto">SI截单详情</param>
/// <param name="bookingId">订舱主键</param>
/// <param name="taskPKId">任务ID</param>
/// <returns></returns>
[NonAction]
public async Task<Tuple<string,int>> PushCompareSIInfo(SIFeedBackCompareDto siSrcDto, SIFeedBackCompareDto siTargetDto, long bookingId, string taskPKId)
{
string result = string.Empty;
int diffNum = 0;
string batchNo = IDGen.NextID().ToString();
DateTime bDate = DateTime.Now;
var compareResult = await ExcuteCompare(siSrcDto, siTargetDto);
DateTime eDate = DateTime.Now;
TimeSpan ts = eDate.Subtract(bDate);
var timeDiff = ts.TotalMilliseconds;
if (compareResult != null)
{
_logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg}", batchNo, timeDiff, compareResult.succ ? "成功" : "失败");
if(!compareResult.succ)
{
result = $"比对失败,原因:{compareResult.msg}";
}
}
if (compareResult != null)
{
DateTime nowDate = DateTime.Now;
var hisInfo = _businessCompareDiffRecordRepository.AsQueryable().Filter(null, true).First(a =>
a.BUSI_ID == bookingId.ToString() && a.TASK_ID == taskPKId);
if (hisInfo == null)
{
BusinessCompareDiffRecord entity = new BusinessCompareDiffRecord
{
BUSI_ID = bookingId.ToString(),
TASK_ID = taskPKId,
BUSI_TYPE = "SI_SUBMITTED",
COMPARE_DIFF_NUM = compareResult.extra.IsExistsDiff ? compareResult.extra.ShowDetailList.Count : 0,
CreatedTime = nowDate,
UpdatedTime = nowDate,
CreatedUserId = UserManager.UserId,
CreatedUserName = UserManager.Name,
UpdatedUserId = UserManager.UserId,
UpdatedUserName = UserManager.Name,
COMPARE_TYPE = "SI_MODIFY",
COMPARE_RLT = JSON.Serialize(compareResult.extra.ShowDetailList),
};
await _businessCompareDiffRecordRepository.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 _businessCompareDiffRecordRepository.AsUpdateable(hisInfo).UpdateColumns(it =>
new
{
it.COMPARE_DIFF_NUM,
it.COMPARE_RLT,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
}
if (compareResult.extra.ShowDetailList == null || compareResult.extra.ShowDetailList.Count == 0)
{
result = $"比对失败,没有比对出差异";
new EmailNoticeHelper().SendEmailNotice($"MBLNO={siSrcDto.MblNo} SI 回执比对差异失败比对结果为0", $"MBLNO={siSrcDto.MblNo} SI 回执比对差异失败比对结果为0", App.Configuration["EmailNoticeDefaultUser"].GetUserEmailList());
}
else
{
diffNum = compareResult.extra.ShowDetailList.Count;
}
}
else
{
result = $"比对失败,未获取到比对结果";
new EmailNoticeHelper().SendEmailNotice($"MBLNO={siSrcDto.MblNo} SI 回执比对差异失败,未获取到比对结果", $"MBLNO={siSrcDto.MblNo} SI 回执比对差异失败,未获取到比对结果", App.Configuration["EmailNoticeDefaultUser"].GetUserEmailList());
}
return new Tuple<string, int>(result,diffNum);
}
#endregion
#region 请求BC比对
/// <summary>
/// 请求SI比对
/// </summary>
/// <param name="siSrcDto">订舱详情</param>
/// <param name="siTargetDto">SI截单详情</param>
/// <returns>返回回执</returns>
[NonAction]
public async Task<TaskManageExcuteResultDto> ExcuteCompare(SIFeedBackCompareDto siSrcDto, SIFeedBackCompareDto siTargetDto)
{
TaskManageExcuteResultDto model = null;
/*
1URL
2JSON
3POST
4
*/
var url = App.Configuration["SICompareUrl"];
using (var httpClient = new HttpClient())
{
try
{
using (var reduceAttach = new MultipartFormDataContent())
{
var dataContent = new ByteArrayContent(Encoding.UTF8.GetBytes(JSON.Serialize(siSrcDto)));
dataContent.Headers.ContentDisposition = new ContentDispositionHeaderValue($"form-data")
{
Name = "srcJson"
};
reduceAttach.Add(dataContent);
var dataContent2 = new ByteArrayContent(Encoding.UTF8.GetBytes(JSON.Serialize(siTargetDto)));
dataContent2.Headers.ContentDisposition = new ContentDispositionHeaderValue($"form-data")
{
Name = "destJson"
};
reduceAttach.Add(dataContent2);
//请求
var response = httpClient.PostAsync(url, reduceAttach).Result;
var result = response.Content.ReadAsStringAsync().Result;
model = JSON.Deserialize<TaskManageExcuteResultDto>(result);
}
}
catch (Exception ex)
{
_logger.LogInformation("推送SI比对异常原因{error}", ex.Message);
throw Oops.Oh($"推送SI比对异常原因{ex.Message}");
}
}
return model;
}
#endregion
}
}

@ -125,7 +125,8 @@ namespace Myshipping.Application
private readonly INamedServiceProvider<ITaskManageRollingNominationService> _namedRollingNominationServiceProvider;
private readonly INamedServiceProvider<ITaskManageBCService> _namedTaskManageBCServiceProvider;
private readonly INamedServiceProvider<IBookingMSKAPIService> _namedBookingMSKAPIServiceProvider;
private readonly INamedServiceProvider<ITaskManageSISubmittedService> _namedtaskSISubmittedServiceProvider;
private readonly IBookingValueAddedService _bookingValueAddedService;
const string CONST_WEB_ACCOUNT_TYPE = "CmaWeb";
@ -183,6 +184,7 @@ namespace Myshipping.Application
INamedServiceProvider<ITaskManageBCService> namedTaskManageBCServiceProvider,
IBookingValueAddedService bookingValueAddedService,
INamedServiceProvider<IBookingMSKAPIService> namedBookingMSKAPIServiceProvider,
INamedServiceProvider<ITaskManageSISubmittedService> namedtaskSISubmittedServiceProvider,
ILogger<BookingOrderService> logger)
{
_taskBaseInfoRepository = taskBaseInfoRepository;
@ -222,6 +224,7 @@ namespace Myshipping.Application
_namedRollingNominationServiceProvider = namedRollingNominationServiceProvider;
_bookingValueAddedService = bookingValueAddedService;
_namedTaskManageBCServiceProvider = namedTaskManageBCServiceProvider;
_namedtaskSISubmittedServiceProvider = namedtaskSISubmittedServiceProvider;
_sysDataUserMenuService = sysDataUserMenuService;
@ -642,6 +645,8 @@ namespace Myshipping.Application
//SI反馈箱信息入库
if (info.Main.SIFeedBack.ContaList != null && info.Main.SIFeedBack.ContaList.Count > 0)
{
var ediCtnList = _cache.GetAllCodeCtn().GetAwaiter().GetResult();
info.Main.SIFeedBack.ContaList.ForEach(async ctn =>
{
var contaInfo = ctn.Adapt<TaskSISubmittedCtn>();
@ -657,11 +662,29 @@ namespace Myshipping.Application
contaInfo.TenantId = taskInfo.TenantId;
contaInfo.TenantName = taskInfo.TenantName;
if (string.IsNullOrWhiteSpace(contaInfo.CTNCODE) && !string.IsNullOrWhiteSpace(contaInfo.CTNALL))
{
if (ediCtnList != null && ediCtnList.Count > 0)
{
var ctnCodeInfo = ediCtnList.FirstOrDefault(x => x.Name.Equals(contaInfo.CTNALL, StringComparison.OrdinalIgnoreCase));
if (ctnCodeInfo != null)
{
contaInfo.CTNCODE = ctnCodeInfo.Code;
}
}
}
_taskSISubmittedCtnRepository.Insert(contaInfo);
});
}
//这里入库完成后执行SI的处理
var siService = _namedtaskSISubmittedServiceProvider
.GetService<ITransient>(nameof(TaskManageSISubmittedService));
await siService.ProcessSISubmitted(taskSISubmitted.TASK_ID);
}
#endregion
@ -5794,7 +5817,7 @@ namespace Myshipping.Application
/// <param name="modifyFile">截单回执变更内容后文件</param>
/// <param name="jsonData">截单回执任务详情JSON</param>
/// <returns>返回回执</returns>
[AllowAnonymous, HttpPost("/TaskManage/CreateSISubmittedTaskJob"), ApiUser(ApiCode = "BCTaskManage")]
[HttpPost("/TaskManage/CreateSISubmittedTaskJob"), AllowAnonymous, ApiUser(ApiCode = "BCTaskManage")]
public async Task<TaskManageOrderResultDto> CreateSISubmittedTaskJob(IFormFile file, IFormFile modifyFile, [FromForm] string jsonData)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();

@ -138,5 +138,8 @@
"MSKAPIDjyUserSecret": "123456",
"MSKAPIOPEnvironment": "TEST",
"BCReadWebApiUrl": "http://localhost:5110/api/TaskBCParser/ExcuteBCFileRead",
"BookingAmendReadWebApiUrl": "http://localhost:5110/api/TaskBookingAmendmentParser/ExcuteBookingAmendmentRead"
"BookingAmendReadWebApiUrl": "http://localhost:5110/api/TaskBookingAmendmentParser/ExcuteBookingAmendmentRead",
"SICompareUrl": "http://localhost:5110/api/TaskDraftCompare/ExcuteSISubmittedCompare",
"EmailNoticeUrl": "http://47.104.73.97:8801/mail/send",
"EmailNoticeDefaultUser": "jianghaiqing@myshipping.net"
}
Loading…
Cancel
Save