修改下货纸比对

optimize
jianghaiqing 2 years ago
parent 9e484a6984
commit 353d4b7c1e

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

Loading…
Cancel
Save