diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskShippingOrderCompareService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskShippingOrderCompareService.cs index 6b64b071..26be0dd7 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskShippingOrderCompareService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskShippingOrderCompareService.cs @@ -32,12 +32,16 @@ namespace Myshipping.Application private readonly SqlSugarRepository _bookingOrderRepository; private readonly SqlSugarRepository _bookingOrderContaRepository; - private readonly SqlSugarRepository _userRepository; + //private readonly SqlSugarRepository _userRepository; - public TaskShippingOrderCompareService(ISysCacheService cache, ILogger logger) + public TaskShippingOrderCompareService(ISysCacheService cache, ILogger logger, + SqlSugarRepository bookingOrderRepository, SqlSugarRepository bookingOrderContaRepository) { _cache = cache; _logger = logger; + + _bookingOrderRepository = bookingOrderRepository; + _bookingOrderContaRepository = bookingOrderContaRepository; } /// /// 执行下货纸比对 @@ -95,6 +99,9 @@ namespace Myshipping.Application var mainInfo = model.Adapt(); mainInfo.BusiPKId = model.Id.ToString(); + mainInfo.UserId = UserManager.UserId.ToString(); + mainInfo.UserName = UserManager.Name; + mainInfo.UserEmail = UserManager.Email; var contaList = await _bookingOrderContaRepository.AsQueryable().Where(x => x.BILLID == model.Id).ToListAsync(); @@ -111,7 +118,7 @@ namespace Myshipping.Application DateTime bDate = DateTime.Now; - var ruleResult = await ExcuteRulesEngine(msgModel); + var ruleResult = await ExcuteCompare(msgModel); DateTime eDate = DateTime.Now; TimeSpan ts = eDate.Subtract(bDate); @@ -123,9 +130,19 @@ namespace Myshipping.Application throw Oops.Oh($"订舱主键{bookingId}请求下货纸比对失败,返回为空"); result.succ = ruleResult.succ; + + if(ruleResult.total > 0 ) + { + result.msg = "比对完成,比对数据差异"; + } + + _logger.LogInformation("批次={no} 请求下货纸比对返回结果{msg}", batchNo, JSON.Serialize(ruleResult)); + /* result.msg = ruleResult.msg; result.extra = ruleResult.extra; result.extra2 = ruleResult.extra2; + */ + _logger.LogInformation("批次={no} 返回结果{msg}", batchNo, JSON.Serialize(result)); } @@ -168,10 +185,17 @@ namespace Myshipping.Application throw Oops.Oh($"以下主键信息 {noRecord} 检索失败或者已作废过"); } + List rltList = new List(); + list.ForEach(async entity => { - await InnerExcuteShippingOrderCompareAsync(entity.Id.ToString()); + var curRlt = await InnerExcuteShippingOrderCompareAsync(entity.Id.ToString()); + + rltList.Add(curRlt); }); + + result.succ = true; + result.msg = "比对完成"; } catch (Exception ex) { @@ -220,7 +244,7 @@ namespace Myshipping.Application /// /// [NonAction] - private async Task ExcuteRulesEngine(TaskMessageInfoDto info) + private async Task ExcuteCompare(TaskMessageInfoDto info) { TaskManageExcuteResultDto model = null; /*