Browse Source

超时问题,方案一

HQ
liuyunfeng 7 months ago
parent
commit
ea965197bd
  1. 18
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/EdiReceive/ImportRecordAppService.cs
  2. 4
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs
  3. 2
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/LastImportHostSNDomainService.cs
  4. 2
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore/EntityFrameworkCore/NewJitDbContext.cs

18
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
/// <param name="files">导入文件</param>
/// <param name="forceExecute">校验出错时,是否强制执行</param>
/// <returns>执行成功返回真</returns>
[UnitOfWork(IsDisabled =true)]
//[UnitOfWork(IsDisabled =true)]
//[UnitOfWork(isTransactional: false)] //[UnitOfWork(false)]
//[UnitOfWork]
[UnitOfWork]
[HttpPost]
[Route("import")]
[DisableRequestSizeLimit]
@ -472,8 +473,8 @@ 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<ImportRecordDto>, List<ImportRecord>>(srcLst);
foreach (var tar in tarLst)
@ -491,17 +492,19 @@ namespace WY.NewJit.EdiReceive
{
return ret2;
}
await uow.CompleteAsync();
//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<TimeOutRemindResultDto> 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);

4
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;

2
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/LastImportHostSNDomainService.cs

@ -60,7 +60,7 @@ namespace WY.NewJit.EdiReceive.Services
/// </summary>
/// <param name="productLine"></param>
/// <returns></returns>
public async Task<int> GetLastImportMaxHostSN()
public virtual async Task<int> GetLastImportMaxHostSN()
{
var lst = await _lastImportHostSNRepository.GetListAsync();
if (lst.Count > 0)

2
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.EntityFrameworkCore/EntityFrameworkCore/NewJitDbContext.cs

@ -169,7 +169,7 @@ namespace WY.NewJit.EntityFrameworkCore
public NewJitDbContext(DbContextOptions<NewJitDbContext> options)
: base(options)
{
this.Database.SetCommandTimeout(System.TimeSpan.FromMinutes(120));
}
protected override void OnModelCreating(ModelBuilder builder)

Loading…
Cancel
Save