|
|
@ -78,6 +78,9 @@ namespace WY.NewJit.EdiReceive |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private readonly IUnitOfWorkManager _unitOfWorkManager; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
@ -91,7 +94,8 @@ namespace WY.NewJit.EdiReceive |
|
|
|
IBlobContainer<OurFileContainer> blobContainer, |
|
|
|
DicDomainService dicDomainService, |
|
|
|
EdiParseDomainService ediParseDomainService, |
|
|
|
Microsoft.Extensions.Configuration.IConfiguration configuration) |
|
|
|
Microsoft.Extensions.Configuration.IConfiguration configuration, |
|
|
|
IUnitOfWorkManager unitOfWorkManager) |
|
|
|
{ |
|
|
|
_importRecordRepository = importRecordRepository; |
|
|
|
_logger = logger; |
|
|
@ -100,6 +104,7 @@ namespace WY.NewJit.EdiReceive |
|
|
|
_dicDomainService = dicDomainService; |
|
|
|
_ediParseDomainService = ediParseDomainService; |
|
|
|
_configuration = configuration; |
|
|
|
_unitOfWorkManager = unitOfWorkManager; |
|
|
|
} |
|
|
|
|
|
|
|
#region 私有方法
|
|
|
@ -423,7 +428,7 @@ namespace WY.NewJit.EdiReceive |
|
|
|
/// <param name="files">导入文件</param>
|
|
|
|
/// <param name="forceExecute">校验出错时,是否强制执行</param>
|
|
|
|
/// <returns>执行成功返回真</returns>
|
|
|
|
[UnitOfWork] |
|
|
|
[UnitOfWork(IsDisabled =true)] |
|
|
|
[HttpPost] |
|
|
|
[Route("import")] |
|
|
|
[DisableRequestSizeLimit] |
|
|
@ -465,25 +470,29 @@ namespace WY.NewJit.EdiReceive |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
var srcLst = impResult.Data.AsEnumerable().ToList(); |
|
|
|
var tarLst = ObjectMapper.Map<List<ImportRecordDto>, List<ImportRecord>>(srcLst); |
|
|
|
foreach (var tar in tarLst) |
|
|
|
{ |
|
|
|
//tar.CreatePerson = "导入";
|
|
|
|
tar.CreateTime = ServerHelper.CurrentDateTime; |
|
|
|
} |
|
|
|
//报文解析
|
|
|
|
ObjectResultDto ret2 = await _ediParseDomainService.ParseEdi(tarLst, forceExecute); |
|
|
|
if (ret2.Status == false) |
|
|
|
{ |
|
|
|
return ret2; |
|
|
|
} |
|
|
|
if (ret2.Status == true && ret2.Message.HasValue()) |
|
|
|
using (var uow = _unitOfWorkManager.Begin()) |
|
|
|
{ |
|
|
|
return ret2; |
|
|
|
var srcLst = impResult.Data.AsEnumerable().ToList(); |
|
|
|
var tarLst = ObjectMapper.Map<List<ImportRecordDto>, List<ImportRecord>>(srcLst); |
|
|
|
foreach (var tar in tarLst) |
|
|
|
{ |
|
|
|
//tar.CreatePerson = "导入";
|
|
|
|
tar.CreateTime = ServerHelper.CurrentDateTime; |
|
|
|
} |
|
|
|
//报文解析
|
|
|
|
ObjectResultDto ret2 = await _ediParseDomainService.ParseEdi(tarLst, forceExecute); |
|
|
|
if (ret2.Status == false) |
|
|
|
{ |
|
|
|
return ret2; |
|
|
|
} |
|
|
|
if (ret2.Status == true && ret2.Message.HasValue()) |
|
|
|
{ |
|
|
|
return ret2; |
|
|
|
} |
|
|
|
await uow.CompleteAsync(); |
|
|
|
ret.Status = true; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
ret.Status = true; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|