zhangxiaofeng 5 months ago
commit 9c572465b7

@ -46,5 +46,19 @@ namespace Myshipping.Application
/// <param name="taskPkId">截单回执任务主键</param> /// <param name="taskPkId">截单回执任务主键</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> ProcessSISubmitted(string taskPkId); Task<TaskManageOrderResultDto> ProcessSISubmitted(string taskPkId);
/// <summary>
/// 获取订舱详情
/// </summary>
/// <param name="taskPKId">任务主键</param>
/// <returns>返回结果</returns>
Task<TaskBookingOrderDto> GetBookingOrderInfo(string taskPKId);
/// <summary>
/// 获取SI反馈信息
/// </summary>
/// <param name="taskPKId">任务主键</param>
/// <returns>返回结果</returns>
Task<TaskSIFeedBackResultDto> GetSIFeedBackInfo(string taskPKId);
} }
} }

@ -2531,7 +2531,14 @@ namespace Myshipping.Application
if (bcOrder == null) if (bcOrder == null)
throw Oops.Oh($"任务主键{taskPKId}无法获取BC业务信息"); 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<CompareResultDetailInfo>();
}
} }
#endregion #endregion

@ -144,6 +144,7 @@ namespace Myshipping.Application
dto.CompleteTime = taskBase.COMPLETE_DATE; dto.CompleteTime = taskBase.COMPLETE_DATE;
dto.NoticeType = dischargeFull.NOTICE_TYPE; dto.NoticeType = dischargeFull.NOTICE_TYPE;
dto.NoticeTypeName = dischargeFull.NOTICE_TYPE_NAME; dto.NoticeTypeName = dischargeFull.NOTICE_TYPE_NAME;
dto.Carrier = dischargeFull.CARRIER;
return dto; return dto;
}).ToList(); }).ToList();

@ -16,6 +16,7 @@ using Myshipping.Application.Service;
using Myshipping.Core; using Myshipping.Core;
using Myshipping.Core.Service; using Myshipping.Core.Service;
using NPOI.OpenXmlFormats.Dml.Diagram; using NPOI.OpenXmlFormats.Dml.Diagram;
using Org.BouncyCastle.Asn1.X9;
using RabbitMQ.Client; using RabbitMQ.Client;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -40,6 +41,7 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<TaskBaseInfo> _taskBaseRepository; private readonly SqlSugarRepository<TaskBaseInfo> _taskBaseRepository;
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository; private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
private readonly SqlSugarRepository<BookingCtn> _bookingCtnRepository; private readonly SqlSugarRepository<BookingCtn> _bookingCtnRepository;
private readonly SqlSugarRepository<BookingCtnDetail> _bookingOrderContaCargoRepository;
private readonly SqlSugarRepository<BusinessCompareDiffRecord> _businessCompareDiffRecordRepository; private readonly SqlSugarRepository<BusinessCompareDiffRecord> _businessCompareDiffRecordRepository;
private readonly SqlSugarRepository<TaskFileInfo> _taskFileRepository; private readonly SqlSugarRepository<TaskFileInfo> _taskFileRepository;
private readonly SqlSugarRepository<BookingFile> _bookingFileRepository; private readonly SqlSugarRepository<BookingFile> _bookingFileRepository;
@ -61,6 +63,7 @@ namespace Myshipping.Application
SqlSugarRepository<TaskSISubmittedCtn> taskSISubmittedCtnRepository, SqlSugarRepository<TaskSISubmittedCtn> taskSISubmittedCtnRepository,
SqlSugarRepository<TaskFileInfo> taskFileRepository, SqlSugarRepository<TaskFileInfo> taskFileRepository,
SqlSugarRepository<BookingFile> bookingFileRepository, SqlSugarRepository<BookingFile> bookingFileRepository,
SqlSugarRepository<BookingCtnDetail> bookingOrderContaCargoRepository,
IBookingValueAddedService bookingValueAddedService, IDjyTenantParamService djyTenantParamService, IBookingValueAddedService bookingValueAddedService, IDjyTenantParamService djyTenantParamService,
IBookingOrderService bookingOrderService) IBookingOrderService bookingOrderService)
{ {
@ -77,6 +80,7 @@ namespace Myshipping.Application
_taskFileRepository = taskFileRepository; _taskFileRepository = taskFileRepository;
_bookingFileRepository = bookingFileRepository; _bookingFileRepository = bookingFileRepository;
_bookingOrderContaCargoRepository = bookingOrderContaCargoRepository;
} }
#region 获取截单回执详情 #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 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) 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)) if (paramConfig != null && paramConfig.ParaValue.Equals("ENABLE",StringComparison.OrdinalIgnoreCase))
{ {
@ -1064,70 +1069,70 @@ namespace Myshipping.Application
} }
#endregion #endregion
/// <summary> ///// <summary>
/// 获取SI反馈信息 ///// 获取SI反馈信息
/// </summary> ///// </summary>
/// <param name="taskPKId">任务主键</param> ///// <param name="taskPKId">任务主键</param>
/// <returns>返回结果</returns> ///// <returns>返回结果</returns>
[HttpGet("/TaskManageSISubmitted/GetSIFeedBackInfo")] //[HttpGet("/TaskManageSISubmitted/GetSIFeedBackInfo")]
public async Task<TaskSISubmittedShowDto> GetSIFeedBackInfo(string taskPKId) //public async Task<TaskSISubmittedShowDto> GetSIFeedBackInfo(string taskPKId)
{ //{
TaskSISubmittedShowDto dto = new TaskSISubmittedShowDto(); // 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) // if (taskBase == null)
throw Oops.Oh($"任务主键{taskPKId}无法获取业务信息"); // 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) // if (siSubmitted == null)
throw Oops.Oh($"截单回执主键{taskPKId}无法获取业务信息"); // throw Oops.Oh($"截单回执主键{taskPKId}无法获取业务信息");
var bookOrderList = _bookingOrderRepository.AsQueryable().Filter(null, true) // var bookOrderList = _bookingOrderRepository.AsQueryable().Filter(null, true)
.InnerJoin<BookingCtn>((bk, ctn) => bk.Id == ctn.BILLID) // .InnerJoin<BookingCtn>((bk, ctn) => bk.Id == ctn.BILLID)
.Where((bk, ctn) => bk.Id == siSubmitted.BOOKING_ID.Value && bk.TenantId == UserManager.TENANT_ID) // .Where((bk, ctn) => bk.Id == siSubmitted.BOOKING_ID.Value && bk.TenantId == UserManager.TENANT_ID)
.Select((bk, ctn) => new { bk = bk, ctn = ctn }).ToList(); // .Select((bk, ctn) => new { bk = bk, ctn = ctn }).ToList();
var orderInfo = bookOrderList.FirstOrDefault().bk; // var orderInfo = bookOrderList.FirstOrDefault().bk;
//var siFeedBackList = _taskSISubmittedRepository.EntityContext.Queryable<TaskSISubmitted>() // //var siFeedBackList = _taskSISubmittedRepository.EntityContext.Queryable<TaskSISubmitted>()
// .InnerJoin<TaskSISubmittedCtn>((si, ctn) => si.PK_ID == ctn.P_PKID) // // .InnerJoin<TaskSISubmittedCtn>((si, ctn) => si.PK_ID == ctn.P_PKID)
// .Where((si, ctn) => si.TASK_PKID == model.TaskId && si.TenantId == UserManager.TENANT_ID) // // .Where((si, ctn) => si.TASK_PKID == model.TaskId && si.TenantId == UserManager.TENANT_ID)
// .Select((si, ctn) => new { si = si, ctn = ctn }).ToList(); // // .Select((si, ctn) => new { si = si, ctn = ctn }).ToList();
//if (siFeedBackList.Count == 0) // //if (siFeedBackList.Count == 0)
// throw Oops.Oh($"SI反馈信息不存在"); // // throw Oops.Oh($"SI反馈信息不存在");
//var siFeedBackInfo = siFeedBackList.FirstOrDefault().si; // //var siFeedBackInfo = siFeedBackList.FirstOrDefault().si;
//var resultInfo = siFeedBackInfo.Adapt<TaskSIFeedBackResultBusiDto>(); // //var resultInfo = siFeedBackInfo.Adapt<TaskSIFeedBackResultBusiDto>();
//resultInfo.ContaList = siFeedBackList.Select(t => t.ctn.Adapt<TaskSIFeedBackResultContaDto>()).ToList(); // //resultInfo.ContaList = siFeedBackList.Select(t => t.ctn.Adapt<TaskSIFeedBackResultContaDto>()).ToList();
//model.BusiInfo = resultInfo; // //model.BusiInfo = resultInfo;
//if (orderInfo != null) // //if (orderInfo != null)
//{ // //{
// //订舱 // // //订舱
// model.BookingOrder = orderInfo.Adapt<TaskBookingOrderDto>(); // // model.BookingOrder = orderInfo.Adapt<TaskBookingOrderDto>();
//} // //}
////进行数据比对确认差异字段KEY // ////进行数据比对确认差异字段KEY
//var mainDiff = await InnerCompareMainInfoDiff(orderInfo, siFeedBackInfo); // //var mainDiff = await InnerCompareMainInfoDiff(orderInfo, siFeedBackInfo);
//model.SICompareOrderKeyList = mainDiff; // //model.SICompareOrderKeyList = mainDiff;
//var contaDiff = await InnerCompareContaInfoDiff(bookOrderList.Select(t => t.ctn).ToList(), // //var contaDiff = await InnerCompareContaInfoDiff(bookOrderList.Select(t => t.ctn).ToList(),
// siFeedBackList.Select(t => t.ctn).ToList()); // // siFeedBackList.Select(t => t.ctn).ToList());
//model.SICompareOrderContaKeyList = contaDiff; // //model.SICompareOrderContaKeyList = contaDiff;
return dto; // return dto;
} //}
#region 推送BC变更比对 #region 推送BC变更比对
@ -1299,5 +1304,300 @@ namespace Myshipping.Application
return model; return model;
} }
#endregion #endregion
#region 获取订舱详情
/// <summary>
/// 获取订舱详情
/// </summary>
/// <param name="taskPKId">任务主键</param>
/// <returns>返回结果</returns>
[HttpGet("/TaskManageSISubmitted/GetBookingOrderInfo")]
public async Task<TaskBookingOrderDto> 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<TaskBookingOrderDto>();
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<TaskBookingOrderContaDto>();
info.CargoList = currList.Adapt<List<TaskBookingOrderCargoDto>>();
return info;
}
return l.Adapt<TaskBookingOrderContaDto>();
}).ToList();
}
else
{
model.ContaList = contaList.Adapt<List<TaskBookingOrderContaDto>>();
}
//任务
model.TaskBaseInfo = taskBase.Adapt<TaskBaseInfoDto>();
}
}
catch (Exception ex)
{
throw Oops.Bah("获取订舱详情异常,{0}", ex.Message);
}
return model;
}
#endregion
#region 获取SI反馈信息
/// <summary>
/// 获取SI反馈信息
/// </summary>
/// <param name="taskPKId">任务主键</param>
/// <returns>返回结果</returns>
[HttpGet("/TaskManageSISubmitted/GetSIFeedBackInfo")]
public async Task<TaskSIFeedBackResultDto> 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<TaskSISubmittedCtn>((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<BookingOrder>()
.InnerJoin<BookingCtn>((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<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;
}
catch (Exception ex)
{
throw Oops.Bah("获取获取单票账单详情异常,{0}", ex.Message);
}
return model;
}
#endregion
#region 比较主信息
/// <summary>
/// 比较主信息
/// </summary>
/// <param name="bookingOrder">订舱详情</param>
/// <param name="taskSIFeedBackInfo">SI反馈详情</param>
/// <returns>返回差异</returns>
private async Task<List<string>> InnerCompareMainInfoDiff(BookingOrder bookingOrder, TaskSISubmitted taskSIFeedBackInfo)
{
List<string> resultList = new List<string>();
//需要比对的字段
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 比较箱信息
/// <summary>
/// 比较箱信息
/// </summary>
/// <param name="bookContaList">订舱箱信息</param>
/// <param name="siContaList">SI反馈箱信息</param>
/// <returns>返回差异</returns>
private async Task<List<string>> InnerCompareContaInfoDiff(List<BookingCtn> bookContaList, List<TaskSISubmittedCtn> siContaList)
{
List<string> resultList = new List<string>();
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
} }
} }

@ -4897,9 +4897,6 @@ namespace Myshipping.Application
if (taskInfo == null) if (taskInfo == null)
Oops.Oh($"任务信息获取失败"); Oops.Oh($"任务信息获取失败");
if (string.IsNullOrWhiteSpace(taskInfo.BOOK_ORDER_NO))
Oops.Oh($"任务信息的订舱主键不存在");
var orderInfo = _bookingOrderRepository.AsQueryable() var orderInfo = _bookingOrderRepository.AsQueryable()
.First(t => t.Id == long.Parse(taskInfo.BOOK_ORDER_NO)); .First(t => t.Id == long.Parse(taskInfo.BOOK_ORDER_NO));

Loading…
Cancel
Save