diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/EdiReceive/ImportRecordAppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/EdiReceive/ImportRecordAppService.cs index 2b49774..4d157cb 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/EdiReceive/ImportRecordAppService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/EdiReceive/ImportRecordAppService.cs @@ -11,6 +11,7 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.BlobStoring; @@ -428,9 +429,9 @@ namespace WY.NewJit.EdiReceive /// 导入文件 /// 校验出错时,是否强制执行 /// 执行成功返回真 - [UnitOfWork(IsDisabled =true)] + //[UnitOfWork(IsDisabled =true)] //[UnitOfWork(isTransactional: false)] //[UnitOfWork(false)] - //[UnitOfWork] + [UnitOfWork] [HttpPost] [Route("import")] [DisableRequestSizeLimit] @@ -472,36 +473,38 @@ namespace WY.NewJit.EdiReceive return ret; } - using (var uow = _unitOfWorkManager.Begin(requiresNew:true)) + //using (var uow = _unitOfWorkManager.Begin()) + //{ + var srcLst = impResult.Data.AsEnumerable().ToList(); + var tarLst = ObjectMapper.Map, List>(srcLst); + foreach (var tar in tarLst) { - var srcLst = impResult.Data.AsEnumerable().ToList(); - var tarLst = ObjectMapper.Map, List>(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; + //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; + //} } catch (Exception ex) { ret.Status = false; ret.Message = _errorMessagePrefix + "ImportAsync 执行出错:" + ex.Message; _logger.LogError(ret.Message); - return ret; + throw new BusinessException("1001", ret.Message); + //return ret; } } @@ -515,6 +518,7 @@ namespace WY.NewJit.EdiReceive [Route("print-timeout-remind")] public virtual async Task PrintTimeoutRemind() { + //return new TimeOutRemindResultDto(); TimeOutRemindResultDto retObj = new TimeOutRemindResultDto(); retObj.ConfigMinutes = _configuration[$"ConfigDic:ProductLineTimeoutRemind_New:{"Record"}"].TryToInt() ?? 40; var qry = await _importRecordRepository.MaxAsync(itm => itm.CreateTime); diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs index 2812b39..1b71dfa 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs @@ -190,7 +190,7 @@ namespace WY.NewJit.EdiReceive.Services _hqCacheManagerDomainService.InitLoadCache(); //批量插入 导入记录 - await _importRecordRepository.InsertManyAsync(notRepeatOrder); + await _importRecordRepository.InsertManyAsync(notRepeatOrder, true); //过滤掉其它厂家的订单,只取派格订单 var paigeOrderLst = notRepeatOrder.Where(itm => itm.VehicleModelCode.Substring(0, 2) == _vehicleModelPrefix).OrderBy(itm => itm.HostSN).ToList(); @@ -206,7 +206,7 @@ namespace WY.NewJit.EdiReceive.Services if (isRepeat == true) { #region 重复报文 - var succObj = InsertM100RepeatBill(orderItem, m100Obj); + var succObj = await InsertM100RepeatBill(orderItem, m100Obj); _logger.LogDebug(_errorMessagePrefix + $"流水号{orderItem.HostSN}是重复报文"); ret.Status = (succObj != null); return ret; diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/LastImportHostSNDomainService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/LastImportHostSNDomainService.cs index d3b9d22..3571f60 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/LastImportHostSNDomainService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/LastImportHostSNDomainService.cs @@ -60,7 +60,7 @@ namespace WY.NewJit.EdiReceive.Services /// /// /// - public async Task GetLastImportMaxHostSN() + public virtual async Task GetLastImportMaxHostSN() { var lst = await _lastImportHostSNRepository.GetListAsync(); if (lst.Count > 0) diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore/EntityFrameworkCore/NewJitDbContext.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore/EntityFrameworkCore/NewJitDbContext.cs index d08d321..afd6f2a 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore/EntityFrameworkCore/NewJitDbContext.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore/EntityFrameworkCore/NewJitDbContext.cs @@ -169,7 +169,7 @@ namespace WY.NewJit.EntityFrameworkCore public NewJitDbContext(DbContextOptions options) : base(options) { - + this.Database.SetCommandTimeout(System.TimeSpan.FromMinutes(120)); } protected override void OnModelCreating(ModelBuilder builder)