|
|
|
@ -26,6 +26,7 @@ using Npoi.Mapper;
|
|
|
|
|
using NPOI.HPSF;
|
|
|
|
|
using NPOI.HSSF.UserModel;
|
|
|
|
|
using NPOI.POIFS.Crypt.Dsig;
|
|
|
|
|
using NPOI.SS.Formula.Eval;
|
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
|
using NPOI.SS.UserModel;
|
|
|
|
|
using NPOI.XSSF.Model;
|
|
|
|
@ -2578,8 +2579,13 @@ namespace Myshipping.Application
|
|
|
|
|
if (taskInfo.TASK_TYPE != TaskBusiTypeEnum.SI_FEEDBACK.ToString())
|
|
|
|
|
Oops.Oh($"当前任务类型不是{TaskBusiTypeEnum.SI_FEEDBACK.GetDescription()}");
|
|
|
|
|
|
|
|
|
|
var orderInfo = _bookingOrderRepository.AsQueryable()
|
|
|
|
|
.First(t => t.Id == long.Parse(taskInfo.BOOK_ORDER_NO));
|
|
|
|
|
|
|
|
|
|
var bookOrderList = _bookingOrderRepository.EntityContext.Queryable<BookingOrder>()
|
|
|
|
|
.InnerJoin<BookingCtn>((bk, ctn) => bk.Id == ctn.BILLID)
|
|
|
|
|
.Where((bk, ctn) => bk.Id == long.Parse(taskInfo.BOOK_ORDER_NO) && bk.TenantId == UserManager.TENANT_ID)
|
|
|
|
|
.Select((bk, ctn) => new { bk = bk, ctn = ctn }).ToList();
|
|
|
|
|
|
|
|
|
|
var orderInfo = bookOrderList.FirstOrDefault().bk;
|
|
|
|
|
|
|
|
|
|
model.TaskId = taskInfo.PK_ID;
|
|
|
|
|
|
|
|
|
@ -2591,11 +2597,13 @@ namespace Myshipping.Application
|
|
|
|
|
if (siFeedBackList.Count == 0)
|
|
|
|
|
Oops.Oh($"SI反馈信息不存在");
|
|
|
|
|
|
|
|
|
|
var siFeedBackInfo = siFeedBackList.FirstOrDefault().si.Adapt<TaskSIFeedBackResultBusiDto>();
|
|
|
|
|
var siFeedBackInfo = siFeedBackList.FirstOrDefault().si;
|
|
|
|
|
|
|
|
|
|
var resultInfo = siFeedBackInfo.Adapt<TaskSIFeedBackResultBusiDto>();
|
|
|
|
|
|
|
|
|
|
siFeedBackInfo.ContaList = siFeedBackList.Select(t => t.ctn.Adapt<TaskSIFeedBackResultContaDto>()).ToList();
|
|
|
|
|
resultInfo.ContaList = siFeedBackList.Select(t => t.ctn.Adapt<TaskSIFeedBackResultContaDto>()).ToList();
|
|
|
|
|
|
|
|
|
|
model.BusiInfo = siFeedBackInfo;
|
|
|
|
|
model.BusiInfo = resultInfo;
|
|
|
|
|
|
|
|
|
|
if (orderInfo != null)
|
|
|
|
|
{
|
|
|
|
@ -2604,6 +2612,14 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//进行数据比对确认差异字段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)
|
|
|
|
|
{
|
|
|
|
@ -2612,77 +2628,125 @@ namespace Myshipping.Application
|
|
|
|
|
return model;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// private async Task<string> InnerCompareDiff()
|
|
|
|
|
// {
|
|
|
|
|
// var compareField = new string[] { "SHIPPER", "CONSIGNEE", "NOTIFYPARTY", "MARKS", "DESCRIPTION", "BLFRT", "SERVICE", "ISSUETYPE", "PORTLOAD", "PORTDISCHARGE", "TRANSPORT", "DESTINATION", "PKGS", "KGS", "CBM", "KINDPKGS", "THIRDPAYADDR" };
|
|
|
|
|
// var listDiffField = new List<string>();
|
|
|
|
|
// var bookProps = typeof(OP_SEAE_ORDER).GetProperties();
|
|
|
|
|
// var feedProps = typeof(OP_SEAE_SI_FEEDBACK).GetProperties();
|
|
|
|
|
// foreach (var prop in compareField)
|
|
|
|
|
// {
|
|
|
|
|
// var pBook = bookProps.First(p => p.Name == prop);
|
|
|
|
|
// var bookVal = pBook.GetValue(bill.order);
|
|
|
|
|
// var pFeed = feedProps.First(p => p.Name == prop);
|
|
|
|
|
// var feedVal = pFeed.GetValue(siFeedback);
|
|
|
|
|
// if (pBook.PropertyType == typeof(string))
|
|
|
|
|
// {
|
|
|
|
|
// string st1 = bookVal as string;
|
|
|
|
|
// string st2 = feedVal as string;
|
|
|
|
|
// st1 = ProcessString(st1);
|
|
|
|
|
// st2 = ProcessString(st2);
|
|
|
|
|
|
|
|
|
|
// if (st1 != st2)
|
|
|
|
|
// {
|
|
|
|
|
// listDiffField.Add(prop);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// else if (pBook.PropertyType == typeof(int?))
|
|
|
|
|
// {
|
|
|
|
|
// var dt1 = bookVal as int?;
|
|
|
|
|
// var dt2 = feedVal as int?;
|
|
|
|
|
// if (dt1 != dt2)
|
|
|
|
|
// {
|
|
|
|
|
// listDiffField.Add(prop);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// else if (pBook.PropertyType == typeof(decimal?))
|
|
|
|
|
// {
|
|
|
|
|
// var dt1 = bookVal as decimal?;
|
|
|
|
|
// var dt2 = feedVal as decimal?;
|
|
|
|
|
// if (dt1 != dt2)
|
|
|
|
|
// {
|
|
|
|
|
// listDiffField.Add(prop);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// ViewData["DiffFields"] = listDiffField;
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
// #region 箱信息对比
|
|
|
|
|
// var listDiffCtn = new List<string>();
|
|
|
|
|
// var ctns = bookingDB.Ctns.Where(c => c.ORDNO == bill.order.ORDNO).ToList();
|
|
|
|
|
// foreach (var cc in feedbackCtn)
|
|
|
|
|
// {
|
|
|
|
|
// var ctnB = ctns.FirstOrDefault(c => c.CNTRNO == cc.CNTRNO);
|
|
|
|
|
// if (ctnB == null)
|
|
|
|
|
// {
|
|
|
|
|
// listDiffCtn.Add(cc.CNTRNO);
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// if (cc.KGS != ctnB.KGS
|
|
|
|
|
// || cc.PKGS != ctnB.PKGS
|
|
|
|
|
// || cc.SEALNO != ctnB.SEALNO
|
|
|
|
|
// || cc.CTNALL != ctnB.CTNALL
|
|
|
|
|
// || cc.CBM != ctnB.CBM)
|
|
|
|
|
// {
|
|
|
|
|
// listDiffCtn.Add(cc.CNTRNO);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// ViewData["DiffCtns"] = listDiffCtn;
|
|
|
|
|
// }
|
|
|
|
|
#region 比较主信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 比较主信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="bookingOrder">订舱详情</param>
|
|
|
|
|
/// <param name="taskSIFeedBackInfo">SI反馈详情</param>
|
|
|
|
|
/// <returns>返回差异</returns>
|
|
|
|
|
private async Task<List<string>> InnerCompareMainInfoDiff(BookingOrder bookingOrder, TaskSIFeedBackInfo 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<TaskSIFeedBackContaInfo> siContaList)
|
|
|
|
|
{
|
|
|
|
|
List<string> resultList = new List<string>();
|
|
|
|
|
|
|
|
|
|
var bookProps = typeof(BookingCtn).GetProperties();
|
|
|
|
|
var feedProps = typeof(TaskSIFeedBackContaInfo).GetProperties();
|
|
|
|
|
|
|
|
|
|
siContaList.GroupJoin(bookContaList, l => l.CONTA_NO, 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.SEAL_NO.Equals(bkCtn.SEALNO)
|
|
|
|
|
|| !l.CONTA_TYPE.Equals(bkCtn.CTNALL)
|
|
|
|
|
|| !l.CBM.Equals(bkCtn.CBM))
|
|
|
|
|
{
|
|
|
|
|
return l.CONTA_NO;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return l.CONTA_NO;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return resultList;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 样本业务提取帮助类
|
|
|
|
@ -2709,4 +2773,26 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public static class CompareObjExtension
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 整理文本数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="str">文本</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static string AdjustString(this string str)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(str))
|
|
|
|
|
return str;
|
|
|
|
|
|
|
|
|
|
var rtn = str.Replace("\r\n", "\n").Trim();
|
|
|
|
|
if (rtn.EndsWith("\n"))
|
|
|
|
|
{
|
|
|
|
|
rtn = rtn.Substring(0, rtn.Length - 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return rtn;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|