diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageExcuteResultDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageExcuteResultDto.cs
index 31f632ee..4bd960d1 100644
--- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageExcuteResultDto.cs
+++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageExcuteResultDto.cs
@@ -31,10 +31,15 @@ namespace Myshipping.Application
///
public int total { get; set; }
+ ///
+ /// 当前页列表数据
+ ///
+ public object rows { get; set; }
+
///
/// 比对详情
///
- public CompareResultDetailInfo extra { get; set; }
+ public CompareResultInfo extra { get; set; }
///
/// 比对展示详情
diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskShippingOrderCompareService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskShippingOrderCompareService.cs
index b3131b8f..42c795d4 100644
--- a/Myshipping.Application/Service/TaskManagePlat/TaskShippingOrderCompareService.cs
+++ b/Myshipping.Application/Service/TaskManagePlat/TaskShippingOrderCompareService.cs
@@ -119,25 +119,23 @@ namespace Myshipping.Application
DateTime bDate = DateTime.Now;
- var ruleResult = await ExcuteCompare(msgModel);
+ var compareResult = await ExcuteCompare(msgModel);
DateTime eDate = DateTime.Now;
TimeSpan ts = eDate.Subtract(bDate);
var timeDiff = ts.TotalMilliseconds;
- _logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg}", batchNo, timeDiff, ruleResult.succ ? "成功" : "失败");
+ _logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg}", batchNo, timeDiff, compareResult.succ ? "成功" : "失败");
- if (ruleResult == null)
+ if (compareResult == null)
throw Oops.Oh($"订舱主键{bookingId}请求下货纸比对失败,返回为空");
- result.succ = ruleResult.succ;
+ result.succ = compareResult.succ;
+ result.msg = compareResult.msg;
+ result.extra = compareResult.extra;
+ result.extra2 = compareResult.extra2;
- if(ruleResult.total > 0 )
- {
- result.msg = "比对完成,比对数据差异";
- }
-
- _logger.LogInformation("批次={no} 请求下货纸比对返回结果{msg}", batchNo, JSON.Serialize(ruleResult));
+ _logger.LogInformation("批次={no} 请求下货纸比对返回结果{msg}", batchNo, JSON.Serialize(compareResult));
/*
result.msg = ruleResult.msg;
result.extra = ruleResult.extra;
@@ -162,13 +160,13 @@ namespace Myshipping.Application
/// 订舱主键组
/// 返回回执
[HttpPost("/TaskShippingOrderCompare/ExcuteShippingOrderCompareBatch")]
- public async Task ExcuteShippingOrderCompareBatchAsync(string[] bookingIds)
+ public async Task ExcuteShippingOrderCompareBatchAsync([FromBody] string[] bookingIds)
{
TaskManageExcuteResultDto result = new TaskManageExcuteResultDto();
try
{
- var ids = bookingIds.Select(a => long.Parse(a)).ToArray();
+ var ids = bookingIds.Select(a => long.Parse(a)).Distinct().ToArray();
var list = _bookingOrderRepository.AsQueryable().Where(t => ids.Contains(t.Id)).ToList();
@@ -187,17 +185,49 @@ namespace Myshipping.Application
throw Oops.Oh($"以下主键信息 {noRecord} 检索失败或者已作废过");
}
- List rltList = new List();
-
- list.ForEach(async entity =>
+ //这里单票下货纸比对时,等待结果返回
+ if(ids.Length == 1)
{
- var curRlt = await InnerExcuteShippingOrderCompareAsync(entity.Id.ToString());
+ result = await InnerExcuteShippingOrderCompareAsync(list.FirstOrDefault().Id.ToString());
+ }
+ else
+ {
+ List> listOfTasks = new List>();
+
+ list.ForEach(entity =>
+ {
+ listOfTasks.Add(InnerExcuteShippingOrderCompareAsync(entity.Id.ToString()));
+ });
+
+ await Task.WhenAll(listOfTasks);
- rltList.Add(curRlt);
- });
+ result.succ = true;
+ result.msg = "比对完成";
+
+ string rltMsg = string.Empty;
+
+ result.rows = listOfTasks.Select(a =>
+ {
+ var origId = a.Result.extra.OrigPKId;
+
+ var order = list.FirstOrDefault(x => x.Id == long.Parse(origId));
+
+ if (a.Result.succ)
+ {
+ if (a.Result.total > 0)
+ {
+ return new { MblNo = order.MBLNO, Msg = "比对异常", IsDiff = true, rlt = a.Result.succ };
+ }
+
+ return new { MblNo = order.MBLNO, Msg = "比对一致", IsDiff = false, rlt = a.Result.succ };
+ }
+
+ return new { MblNo = order?.MBLNO, Msg = "比对一致", IsDiff = false, rlt = a.Result.succ };
+ }).ToList();
+ }
- result.succ = true;
- result.msg = "比对完成";
+
+
}
catch (Exception ex)
{