From ce05375479a7dad199e09405561d48c3cd587ee9 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Thu, 4 Jul 2024 14:29:06 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=AE=A2=E8=88=B1=E6=8B=92=E7=BB=9D?= =?UTF-8?q?=EF=BC=9A=E8=BF=90=E8=90=A5=E7=AB=AF=E6=8E=A5=E6=94=B6=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E5=AE=A2=E6=88=B7=E7=AB=AF=EF=BC=8C=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=E6=8E=A8=E9=80=81=E4=B8=9C=E8=83=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingCustomerOrderService.cs | 1 + .../BookingOrder/BookingOrderService.cs | 39 +++++++++++++++++-- .../Dto/ReceiveBookingRejectInputDto.cs | 7 ++++ .../Enum/BookingOrderSyncTypeEnum.cs | 8 +++- 4 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 Myshipping.Application/Service/BookingOrder/Dto/ReceiveBookingRejectInputDto.cs diff --git a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs index 310ba26b..03157da3 100644 --- a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs +++ b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs @@ -1360,6 +1360,7 @@ namespace Myshipping.Application { "BC" => BookingOrderSyncTypeEnum.BC, "CC" => BookingOrderSyncTypeEnum.CC, + "REJECT" => BookingOrderSyncTypeEnum.REJECT, //"FILE" => BookingOrderSyncTypeEnum.FILE, _ => null, }; diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 231b28f3..fdf6fbd2 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -10350,7 +10350,7 @@ namespace Myshipping.Application } } - + var ctn = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == item.Id && x.IsDeleted == false).ToListAsync(); dto.ctnInputs = ctn.Adapt>(); foreach (var it in dto.ctnInputs) @@ -10368,7 +10368,7 @@ namespace Myshipping.Application if (item.SPLIT_OR_MERGE_FLAG.Value == 2) { //如果当前是主票 - if(dto.CUSTNO.Equals(dto.HBLNO,StringComparison.OrdinalIgnoreCase)) + if (dto.CUSTNO.Equals(dto.HBLNO, StringComparison.OrdinalIgnoreCase)) { var allOrderList = await _rep.AsQueryable().Filter(null, true).Where(x => dto.HBLNO == x.HBLNO && (x.SPLIT_OR_MERGE_FLAG != null && x.SPLIT_OR_MERGE_FLAG == 2) && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync(); @@ -10376,7 +10376,7 @@ namespace Myshipping.Application if (allOrderList.Count > 0) { var allOrderIds = allOrderList.Select(x => x.Id).ToList(); - var currCtn = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID != null && allOrderIds.Contains(x.BILLID.Value) + var currCtn = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID != null && allOrderIds.Contains(x.BILLID.Value) && x.IsDeleted == false).ToListAsync(); dto.ctnInputs = currCtn.Adapt>(); @@ -12892,6 +12892,39 @@ namespace Myshipping.Application /// 接收BC信息更新订舱 /// [AllowAnonymous] + [HttpPost("/BookingOrder/ReceiveBookingReject")] + [ApiUser(ApiCode = "ReceiveBookingReject")] + public async Task ReceiveBookingReject(ReceiveBookingRejectInputDto input) + { + // 客户订舱:运营端发送订舱数据给客户端 + if (App.Configuration["RunType"] == CommonConst.RUN_TYPE_DJY) + { + return new ReceiveBcInfoResultDto(false, "非运营端,接收失败"); + } + if (string.IsNullOrWhiteSpace(input.CUSTNO)) + { + return new ReceiveBcInfoResultDto(false, "CUSTNO不能为空"); + } + var list = await _rep.AsQueryable().Filter(null, true).Where(x => x.CUSTNO == input.CUSTNO) + .ToListAsync(); + + if (list.Count == 0) + { + string msg = $"通过CUSTNO查询订舱用于推送拒绝请求时,未查询到数据,CUSTNO:【{input.CUSTNO}】,结束"; + _logger.LogInformation(msg); + return new ReceiveBcInfoResultDto(false, msg); + } + _logger.LogInformation($"通过CUSTNO查询订舱用于推送拒绝请求时,查询到{list.Count}条数据,CUSTNO:【{input.CUSTNO}】,开始推送客户端"); + foreach (var item in list) + { + CustomerBookingSyncHelper.SendCustomerBookingSync(item.Id, BookingOrderSyncTypeEnum.REJECT.ToString()); + } + return new ReceiveBcInfoResultDto(true, $"接收成功,共匹配到{list.Count}条订舱记录"); + } + /// + /// 接收BC信息更新订舱 + /// + [AllowAnonymous] [HttpPost("/BookingOrder/ReceiveBcInfo")] [ApiUser(ApiCode = "ReceiveBcInfo")] public async Task ReceiveBcInfo(ReceiveBcInfoDto input) diff --git a/Myshipping.Application/Service/BookingOrder/Dto/ReceiveBookingRejectInputDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/ReceiveBookingRejectInputDto.cs new file mode 100644 index 00000000..0bb00638 --- /dev/null +++ b/Myshipping.Application/Service/BookingOrder/Dto/ReceiveBookingRejectInputDto.cs @@ -0,0 +1,7 @@ +namespace Myshipping.Application.Service.BookingOrder.Dto +{ + public class ReceiveBookingRejectInputDto + { + public string CUSTNO { get; set; } + } +} diff --git a/Myshipping.Core/Enum/BookingOrderSyncTypeEnum.cs b/Myshipping.Core/Enum/BookingOrderSyncTypeEnum.cs index 4ba54da2..052da67d 100644 --- a/Myshipping.Core/Enum/BookingOrderSyncTypeEnum.cs +++ b/Myshipping.Core/Enum/BookingOrderSyncTypeEnum.cs @@ -6,13 +6,17 @@ public enum BookingOrderSyncTypeEnum { /// - /// 只同步BC+文件相关字段 + /// 只用于同步BC及文件相关字段 /// BC = 1, /// - /// 只同步CC号 + /// 只用于同步CC号 /// CC = 2, + /// + /// 只用于推送订舱拒绝消息 + /// + REJECT = 3, ///// ///// 只同步文件相关字段 ///// From 64244bbc9bff409f45f1dbe6a34188d033d24660 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Thu, 4 Jul 2024 14:43:51 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ITaskManageSISubmittedService.cs | 14 + .../TaskManagePlat/TaskManageBCService.cs | 9 +- ...askManagePODDischargeGateoutFullService.cs | 1 + .../TaskManageSISubmittedService.cs | 388 ++++++++++++++++-- .../TaskManagePlat/TaskManageService.cs | 3 - 5 files changed, 367 insertions(+), 48 deletions(-) diff --git a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageSISubmittedService.cs b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageSISubmittedService.cs index 463ce967..ddf25e37 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageSISubmittedService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Interface/ITaskManageSISubmittedService.cs @@ -46,5 +46,19 @@ namespace Myshipping.Application /// 截单回执任务主键 /// 返回回执 Task ProcessSISubmitted(string taskPkId); + + /// + /// 获取订舱详情 + /// + /// 任务主键 + /// 返回结果 + Task GetBookingOrderInfo(string taskPKId); + + /// + /// 获取SI反馈信息 + /// + /// 任务主键 + /// 返回结果 + Task GetSIFeedBackInfo(string taskPKId); } } diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs index f048a461..fe996c9c 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs @@ -2531,7 +2531,14 @@ namespace Myshipping.Application if (bcOrder == null) throw Oops.Oh($"任务主键{taskPKId}无法获取BC业务信息"); - return await _bookingSlotService.GetSlotCompareResult(bcOrder.BOOKING_SLOT_ID.Value, bcOrder.BATCH_NO); + if(bcOrder.BOOKING_SLOT_ID.HasValue) + { + return await _bookingSlotService.GetSlotCompareResult(bcOrder.BOOKING_SLOT_ID.Value, bcOrder.BATCH_NO); + } + else + { + return new List(); + } } #endregion diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManagePODDischargeGateoutFullService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManagePODDischargeGateoutFullService.cs index faaab653..7b8ac5d5 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManagePODDischargeGateoutFullService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManagePODDischargeGateoutFullService.cs @@ -144,6 +144,7 @@ namespace Myshipping.Application dto.CompleteTime = taskBase.COMPLETE_DATE; dto.NoticeType = dischargeFull.NOTICE_TYPE; dto.NoticeTypeName = dischargeFull.NOTICE_TYPE_NAME; + dto.Carrier = dischargeFull.CARRIER; return dto; }).ToList(); diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageSISubmittedService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageSISubmittedService.cs index bf64d8c2..c25ccd32 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageSISubmittedService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageSISubmittedService.cs @@ -16,6 +16,7 @@ using Myshipping.Application.Service; using Myshipping.Core; using Myshipping.Core.Service; using NPOI.OpenXmlFormats.Dml.Diagram; +using Org.BouncyCastle.Asn1.X9; using RabbitMQ.Client; using System; using System.Collections.Generic; @@ -40,6 +41,7 @@ namespace Myshipping.Application private readonly SqlSugarRepository _taskBaseRepository; private readonly SqlSugarRepository _bookingOrderRepository; private readonly SqlSugarRepository _bookingCtnRepository; + private readonly SqlSugarRepository _bookingOrderContaCargoRepository; private readonly SqlSugarRepository _businessCompareDiffRecordRepository; private readonly SqlSugarRepository _taskFileRepository; private readonly SqlSugarRepository _bookingFileRepository; @@ -61,6 +63,7 @@ namespace Myshipping.Application SqlSugarRepository taskSISubmittedCtnRepository, SqlSugarRepository taskFileRepository, SqlSugarRepository bookingFileRepository, + SqlSugarRepository bookingOrderContaCargoRepository, IBookingValueAddedService bookingValueAddedService, IDjyTenantParamService djyTenantParamService, IBookingOrderService bookingOrderService) { @@ -77,6 +80,7 @@ namespace Myshipping.Application _taskFileRepository = taskFileRepository; _bookingFileRepository = bookingFileRepository; + _bookingOrderContaCargoRepository = bookingOrderContaCargoRepository; } #region 获取截单回执详情 @@ -300,7 +304,8 @@ namespace Myshipping.Application var siCtnList = _taskSISubmittedCtnRepository.AsQueryable().Filter(null, true).Where(a => a.P_PKID == siSubmitted.PK_ID && a.TenantId == UserManager.TENANT_ID).ToList(); 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); + .First(a => ((a.MBLNO == siSubmitted.MBL_NO) || (a.SPLIT_OR_MERGE_FLAG != null && a.SPLIT_OR_MERGE_FLAG == 1 && a.CUSTNO == siSubmitted.MBL_NO)) && a.IsDeleted == false + && a.TenantId == UserManager.TENANT_ID && (a.ParentId == 0 || a.ParentId == null)); if (paramConfig != null && paramConfig.ParaValue.Equals("ENABLE",StringComparison.OrdinalIgnoreCase)) { @@ -1064,70 +1069,70 @@ namespace Myshipping.Application } #endregion - /// - /// 获取SI反馈信息 - /// - /// 任务主键 - /// 返回结果 - [HttpGet("/TaskManageSISubmitted/GetSIFeedBackInfo")] - public async Task GetSIFeedBackInfo(string taskPKId) - { - TaskSISubmittedShowDto dto = new TaskSISubmittedShowDto(); + ///// + ///// 获取SI反馈信息 + ///// + ///// 任务主键 + ///// 返回结果 + //[HttpGet("/TaskManageSISubmitted/GetSIFeedBackInfo")] + //public async Task GetSIFeedBackInfo(string taskPKId) + //{ + // TaskSISubmittedShowDto dto = new TaskSISubmittedShowDto(); - var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPKId); + // var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPKId); - if (taskBase == null) - throw Oops.Oh($"任务主键{taskPKId}无法获取业务信息"); + // if (taskBase == null) + // throw Oops.Oh($"任务主键{taskPKId}无法获取业务信息"); - var siSubmitted = _taskSISubmittedRepository.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID); + // var siSubmitted = _taskSISubmittedRepository.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID); - if (siSubmitted == null) - throw Oops.Oh($"截单回执主键{taskPKId}无法获取业务信息"); + // if (siSubmitted == null) + // throw Oops.Oh($"截单回执主键{taskPKId}无法获取业务信息"); - var bookOrderList = _bookingOrderRepository.AsQueryable().Filter(null, true) - .InnerJoin((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 bookOrderList = _bookingOrderRepository.AsQueryable().Filter(null, true) + // .InnerJoin((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 orderInfo = bookOrderList.FirstOrDefault().bk; - //var siFeedBackList = _taskSISubmittedRepository.EntityContext.Queryable() - // .InnerJoin((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(); + // //var siFeedBackList = _taskSISubmittedRepository.EntityContext.Queryable() + // // .InnerJoin((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反馈信息不存在"); + // //if (siFeedBackList.Count == 0) + // // throw Oops.Oh($"SI反馈信息不存在"); - //var siFeedBackInfo = siFeedBackList.FirstOrDefault().si; + // //var siFeedBackInfo = siFeedBackList.FirstOrDefault().si; - //var resultInfo = siFeedBackInfo.Adapt(); + // //var resultInfo = siFeedBackInfo.Adapt(); - //resultInfo.ContaList = siFeedBackList.Select(t => t.ctn.Adapt()).ToList(); + // //resultInfo.ContaList = siFeedBackList.Select(t => t.ctn.Adapt()).ToList(); - //model.BusiInfo = resultInfo; + // //model.BusiInfo = resultInfo; - //if (orderInfo != null) - //{ - // //订舱 - // model.BookingOrder = orderInfo.Adapt(); - //} + // //if (orderInfo != null) + // //{ + // // //订舱 + // // model.BookingOrder = orderInfo.Adapt(); + // //} - ////进行数据比对确认差异字段KEY - //var mainDiff = await InnerCompareMainInfoDiff(orderInfo, siFeedBackInfo); + // ////进行数据比对确认差异字段KEY + // //var mainDiff = await InnerCompareMainInfoDiff(orderInfo, siFeedBackInfo); - //model.SICompareOrderKeyList = mainDiff; + // //model.SICompareOrderKeyList = mainDiff; - //var contaDiff = await InnerCompareContaInfoDiff(bookOrderList.Select(t => t.ctn).ToList(), - // siFeedBackList.Select(t => t.ctn).ToList()); + // //var contaDiff = await InnerCompareContaInfoDiff(bookOrderList.Select(t => t.ctn).ToList(), + // // siFeedBackList.Select(t => t.ctn).ToList()); - //model.SICompareOrderContaKeyList = contaDiff; + // //model.SICompareOrderContaKeyList = contaDiff; - return dto; - } + // return dto; + //} #region 推送BC变更比对 @@ -1299,5 +1304,300 @@ namespace Myshipping.Application return model; } #endregion + + #region 获取订舱详情 + /// + /// 获取订舱详情 + /// + /// 任务主键 + /// 返回结果 + [HttpGet("/TaskManageSISubmitted/GetBookingOrderInfo")] + public async Task GetBookingOrderInfo(string taskPKId) + { + TaskBookingOrderDto model = new TaskBookingOrderDto(); + + string batchNo = IDGen.NextID().ToString(); + try + { + 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().Filter(null, true).First(a => a.TASK_ID == taskBase.PK_ID && a.TenantId == UserManager.TENANT_ID); + + if (siSubmitted == null) + throw Oops.Oh($"截单回执主键{taskPKId}无法获取业务信息"); + + BookingOrder orderInfo = null; + + if (!siSubmitted.BOOKING_ID.HasValue) + { + orderInfo = _bookingOrderRepository.AsQueryable().Filter(null, true) + .First(a => ((a.MBLNO == siSubmitted.MBL_NO) || (a.SPLIT_OR_MERGE_FLAG != null && a.SPLIT_OR_MERGE_FLAG == 1 && a.CUSTNO == siSubmitted.MBL_NO)) && a.IsDeleted == false + && a.TenantId == UserManager.TENANT_ID && (a.ParentId == 0 || a.ParentId == null)); + + if (orderInfo != null) + { + siSubmitted.BOOKING_ID = orderInfo.Id; + + await _taskSISubmittedRepository.AsUpdateable(siSubmitted).UpdateColumns(x => new + { + x.BOOKING_ID + }).ExecuteCommandAsync(); + } + } + else + { + var bookingId = siSubmitted.BOOKING_ID.Value; + orderInfo = _bookingOrderRepository.AsQueryable().Filter(null, true) + .First(a => a.Id == bookingId && a.IsDeleted == false + && a.TenantId == UserManager.TENANT_ID && (a.ParentId == 0 || a.ParentId == null)); + } + + if (orderInfo != null) + { + //订舱 + model = orderInfo.Adapt(); + + var contaList = await _bookingCtnRepository.AsQueryable().Where(x => x.BILLID == orderInfo.Id).ToListAsync(); + + //获取集装箱的主键 + var ctnArg = contaList.Select(t => t.Id).ToArray(); + + //查询集装箱所有的货物信息 + var cargoList = await _bookingOrderContaCargoRepository.AsQueryable() + .Where(x => ctnArg.Contains(x.CTNID.Value)).ToListAsync(); + + _logger.LogInformation("批次={no} 提取货物明细完成 数量={total}", batchNo, cargoList.Count); + + if (cargoList.Count > 0) + { + model.ContaList = contaList.GroupJoin(cargoList, l => l.Id, r => r.CTNID, (l, r) => { + var currList = r.ToList(); + + if (currList.Count > 0) + { + var info = l.Adapt(); + info.CargoList = currList.Adapt>(); + + return info; + } + + return l.Adapt(); + + }).ToList(); + } + else + { + model.ContaList = contaList.Adapt>(); + } + + //任务 + model.TaskBaseInfo = taskBase.Adapt(); + } + + } + catch (Exception ex) + { + throw Oops.Bah("获取订舱详情异常,{0}", ex.Message); + } + return model; + + } + #endregion + + + #region 获取SI反馈信息 + /// + /// 获取SI反馈信息 + /// + /// 任务主键 + /// 返回结果 + [HttpGet("/TaskManageSISubmitted/GetSIFeedBackInfo")] + public async Task GetSIFeedBackInfo(string taskPKId) + { + TaskSIFeedBackResultDto model = new TaskSIFeedBackResultDto(); + + try + { + 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 siFeedBackList = _taskSISubmittedRepository.AsQueryable().Filter(null, true) + .InnerJoin((si, ctn) => si.PK_ID == ctn.P_PKID) + .Where((si, ctn) => si.TASK_ID == 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 bookingId = siFeedBackList.FirstOrDefault().si.BOOKING_ID.Value; + + var bookOrderList = _bookingOrderRepository.EntityContext.Queryable() + .InnerJoin((bk, ctn) => bk.Id == ctn.BILLID) + .Where((bk, ctn) => bk.Id == bookingId && bk.TenantId == UserManager.TENANT_ID) + .Select((bk, ctn) => new { bk = bk, ctn = ctn }).ToList(); + + var orderInfo = bookOrderList.FirstOrDefault().bk; + + model.TaskId = taskBase.PK_ID; + + var siFeedBackInfo = siFeedBackList.FirstOrDefault().si; + + var resultInfo = siFeedBackInfo.Adapt(); + + resultInfo.ContaList = siFeedBackList.Select(t => t.ctn.Adapt()).ToList(); + + model.BusiInfo = resultInfo; + + if (orderInfo != null) + { + //订舱 + model.BookingOrder = orderInfo.Adapt(); + } + + //进行数据比对确认差异字段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; + } + catch (Exception ex) + { + throw Oops.Bah("获取获取单票账单详情异常,{0}", ex.Message); + } + return model; + } + #endregion + + #region 比较主信息 + /// + /// 比较主信息 + /// + /// 订舱详情 + /// SI反馈详情 + /// 返回差异 + private async Task> InnerCompareMainInfoDiff(BookingOrder bookingOrder, TaskSISubmitted taskSIFeedBackInfo) + { + List resultList = new List(); + + //需要比对的字段 + var compareField = new string[] { "SHIPPER", "CONSIGNEE", "NOTIFYPARTY", "MARKS", "DESCRIPTION", "BLFRT", "SERVICE", "ISSUETYPE", "PORTLOAD", "PORTDISCHARGE", + "TRANSPORT", "DESTINATION", "PKGS", "KGS", "CBM", "KINDPKGS", "THIRDPAYADDR" }; + + var bookProps = typeof(BookingOrder).GetProperties(); + var feedProps = typeof(TaskSIFeedBackInfo).GetProperties(); + + resultList = bookProps.GroupJoin(feedProps, l => l.Name.ToUpper(), + r => r.Name.ToUpper(), (l, r) => + { + if (compareField.Any(x => x.Equals(l.Name, StringComparison.OrdinalIgnoreCase))) + { + var currList = r.ToList(); + + if (currList.Count > 0) + { + var si = r.FirstOrDefault(); + + var bkVal = l.GetValue(bookingOrder); + var siVal = si.GetValue(taskSIFeedBackInfo); + + if (l.PropertyType == typeof(string)) + { + string st1 = (bkVal as string).AdjustString(); + string st2 = (siVal as string).AdjustString(); + + if (!st1.Equals(st2)) + { + return l.Name.ToUpper(); + } + + return string.Empty; + } + else if (l.PropertyType == typeof(int?)) + { + var dt1 = bkVal as int?; + var dt2 = siVal as int?; + + if (!dt1.Equals(dt2)) + { + return l.Name.ToUpper(); + } + + return string.Empty; + } + else if (l.PropertyType == typeof(decimal?)) + { + var dt1 = bkVal as decimal?; + var dt2 = siVal as decimal?; + + if (!dt1.Equals(dt2)) + { + return l.Name.ToUpper(); + } + + return string.Empty; + } + } + + return string.Empty; + } + + return string.Empty; + + }).Where(t => !string.IsNullOrWhiteSpace(t)).ToList(); + + return resultList; + } + #endregion + + #region 比较箱信息 + /// + /// 比较箱信息 + /// + /// 订舱箱信息 + /// SI反馈箱信息 + /// 返回差异 + private async Task> InnerCompareContaInfoDiff(List bookContaList, List siContaList) + { + List resultList = new List(); + + var bookProps = typeof(BookingCtn).GetProperties(); + var feedProps = typeof(TaskSIFeedBackContaInfo).GetProperties(); + + resultList = siContaList.GroupJoin(bookContaList, l => l.CNTRNO, r => r.CNTRNO, (l, r) => + { + var currList = r.ToList(); + + if (currList.Count > 0) + { + var bkCtn = currList.FirstOrDefault(); + + if (!l.KGS.Equals(bkCtn.KGS) + || !l.PKGS.Equals(bkCtn.PKGS) + || !l.SEALNO.Equals(bkCtn.SEALNO) + || !l.CTNALL.Equals(bkCtn.CTNALL) + || !l.CBM.Equals(bkCtn.CBM)) + { + return l.CNTRNO; + } + + return String.Empty; + } + + return l.CNTRNO; + }).Where(t => !string.IsNullOrWhiteSpace(t)).ToList(); + + return resultList; + } + #endregion + } } diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs index 1c8d969b..02fb7de1 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs @@ -4897,9 +4897,6 @@ namespace Myshipping.Application if (taskInfo == null) Oops.Oh($"任务信息获取失败"); - if (string.IsNullOrWhiteSpace(taskInfo.BOOK_ORDER_NO)) - Oops.Oh($"任务信息的订舱主键不存在"); - var orderInfo = _bookingOrderRepository.AsQueryable() .First(t => t.Id == long.Parse(taskInfo.BOOK_ORDER_NO)); From 8b4673b1b194d7c5de245a125d044e98477b48a6 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Thu, 4 Jul 2024 14:52:49 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingOrder/BookingOrderService.cs | 2 +- Myshipping.Core/Myshipping.Core.xml | 9 +++++++-- Myshipping.Web.Core/applicationconfig.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index fdf6fbd2..f31a0ebd 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -12889,7 +12889,7 @@ namespace Myshipping.Application #region BC /// - /// 接收BC信息更新订舱 + /// 运营端接收订舱拒绝消息 /// [AllowAnonymous] [HttpPost("/BookingOrder/ReceiveBookingReject")] diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index ed272361..aeeb19f5 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -4733,12 +4733,17 @@ - 只同步BC+文件相关字段 + 只用于同步BC及文件相关字段 - 只同步CC号 + 只用于同步CC号 + + + + + 只用于推送订舱拒绝消息 diff --git a/Myshipping.Web.Core/applicationconfig.json b/Myshipping.Web.Core/applicationconfig.json index dc0efa28..19a4fa0d 100644 --- a/Myshipping.Web.Core/applicationconfig.json +++ b/Myshipping.Web.Core/applicationconfig.json @@ -56,7 +56,7 @@ }, "Cache": { "CacheType": "RedisCache", // RedisCache - "RedisConnectionString": "60.209.125.238:36379,password=,defaultDatabase=11" + "RedisConnectionString": "127.0.0.1:6379,password=,defaultDatabase=11" }, "SnowId": { "WorkerId": "1" // 取值范围0~63,默认1