|
|
|
@ -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
|
|
|
|
|
/// <param name="bookingIds">订舱主键组</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
[HttpPost("/TaskShippingOrderCompare/ExcuteShippingOrderCompareBatch")]
|
|
|
|
|
public async Task<TaskManageExcuteResultDto> ExcuteShippingOrderCompareBatchAsync(string[] bookingIds)
|
|
|
|
|
public async Task<TaskManageExcuteResultDto> 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<TaskManageExcuteResultDto> rltList = new List<TaskManageExcuteResultDto>();
|
|
|
|
|
|
|
|
|
|
list.ForEach(async entity =>
|
|
|
|
|
//这里单票下货纸比对时,等待结果返回
|
|
|
|
|
if(ids.Length == 1)
|
|
|
|
|
{
|
|
|
|
|
var curRlt = await InnerExcuteShippingOrderCompareAsync(entity.Id.ToString());
|
|
|
|
|
result = await InnerExcuteShippingOrderCompareAsync(list.FirstOrDefault().Id.ToString());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
List<Task<TaskManageExcuteResultDto>> listOfTasks = new List<Task<TaskManageExcuteResultDto>>();
|
|
|
|
|
|
|
|
|
|
list.ForEach(entity =>
|
|
|
|
|
{
|
|
|
|
|
listOfTasks.Add(InnerExcuteShippingOrderCompareAsync(entity.Id.ToString()));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await Task.WhenAll<TaskManageExcuteResultDto>(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)
|
|
|
|
|
{
|
|
|
|
|