调整监测金蝶删单
This commit is contained in:
@@ -70,7 +70,7 @@ namespace WMS.Web.Domain.IService
|
||||
/// 金蝶删单后这边单据作废
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<Result> ErpDel(DateTime begin);
|
||||
Task<Result> ErpDel();
|
||||
/// <summary>
|
||||
/// 作废
|
||||
/// </summary>
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace WMS.Web.Domain.IService.Public
|
||||
/// 金蝶删单后这边单据作废
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<Result> ErpDel(DateTime begin);
|
||||
Task<Result> ErpDel();
|
||||
/// <summary>
|
||||
/// 查询出库任务单详情
|
||||
/// </summary>
|
||||
|
||||
@@ -149,6 +149,6 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
/// <returns></returns>
|
||||
Task<InStockTask> Update(InStockTask entity, bool isTransaction = true);
|
||||
/// 查询实体集合
|
||||
Task<List<InStockTask>> GetEntityList(DateTime begin);
|
||||
Task<List<InStockTask>> GetEntityListByStatus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
/// 查询实体集合
|
||||
Task<List<OutStockTask>> GetEntityList(List<int> ids);
|
||||
/// 查询实体集合
|
||||
Task<List<OutStockTask>> GetEntityList(DateTime begin);
|
||||
Task<List<OutStockTask>> GetEntityListByStatus();
|
||||
/// 查询实体集合(明细Id)
|
||||
Task<List<OutStockTask>> GetEntityListByDetailIds(List<int> ids);
|
||||
/// <summary>
|
||||
|
||||
@@ -99,7 +99,10 @@ namespace WMS.Web.Domain.Options
|
||||
/// 同步新物料执行cron表达式:每天23:30整点同步
|
||||
/// </summary>
|
||||
public string JobStartExpreMaterial { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 监测金蝶删单
|
||||
/// </summary>
|
||||
public string JobStartErpDelete { get; set; }
|
||||
/// <summary>
|
||||
/// 是否启用集群:键
|
||||
/// </summary>
|
||||
|
||||
71
src/WMS.Web.Domain/QuartzJob/ErpDeleteQuartzJob.cs
Normal file
71
src/WMS.Web.Domain/QuartzJob/ErpDeleteQuartzJob.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Quartz;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Domain.IService;
|
||||
using WMS.Web.Domain.IService.Public;
|
||||
using WMS.Web.Domain.Options;
|
||||
|
||||
namespace WMS.Web.Domain.QuartzJob
|
||||
{
|
||||
/// <summary>
|
||||
/// 监测金蝶删单
|
||||
/// </summary>
|
||||
public class ErpDeleteQuartzJob : IJob
|
||||
{
|
||||
private readonly ILogger<OutStockOrderQuartzJob> _logger;
|
||||
private readonly IServiceScopeFactory _serviceScopeFactory;
|
||||
private readonly AppOptions _options;
|
||||
private readonly IOutStockTaskService _outStockTaskService;
|
||||
private readonly ITransactionRepositories _transactionRepositories;
|
||||
private readonly IInStockTaskService _inStockTaskService;
|
||||
|
||||
public ErpDeleteQuartzJob(ILogger<OutStockOrderQuartzJob> logger,
|
||||
IServiceScopeFactory serviceScopeFactory,
|
||||
IOptions<AppOptions> options,
|
||||
IOutStockTaskService outStockTaskService,
|
||||
ITransactionRepositories transactionRepositories,
|
||||
IInStockTaskService inStockTaskService)
|
||||
{
|
||||
this._logger = logger;
|
||||
_serviceScopeFactory = serviceScopeFactory;
|
||||
this._options = options?.Value;
|
||||
_outStockTaskService = outStockTaskService;
|
||||
_transactionRepositories = transactionRepositories;
|
||||
_inStockTaskService = inStockTaskService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行方法
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
_logger.LogInformation($"出库单-监测金蝶删单:执行开始时间->{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")}");
|
||||
|
||||
//验证金蝶是否有删单
|
||||
await _outStockTaskService.ErpDel();
|
||||
|
||||
_logger.LogInformation($"出库单-监测金蝶删单:执行结束时间->{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")}");
|
||||
|
||||
//验证金蝶是否有删单
|
||||
await _inStockTaskService.ErpDel();
|
||||
_logger.LogInformation($"入库单-监测金蝶删单:执行结束时间->{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogInformation($"监测金蝶删单:定时任务执行失败->{ex.Message}");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,9 +64,6 @@ namespace WMS.Web.Domain.QuartzJob
|
||||
//3.记录:结束时间
|
||||
var enddatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
_logger.LogInformation($"同步金蝶入库单数据:执行结束时间->{begindatetime}");
|
||||
|
||||
//验证金蝶是否有删单//默认拉去8个小时以内的
|
||||
await _inStockTaskService.ErpDel(DateTime.Now.AddHours(-8));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -54,9 +54,6 @@ namespace WMS.Web.Domain.QuartzJob
|
||||
//5.记录:结束时间
|
||||
var enddatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
_logger.LogInformation($"出库单-同步金蝶出库单数据:执行结束时间->{enddatetime}");
|
||||
//验证金蝶是否有删单
|
||||
await _outStockTaskService.ErpDel(begin);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -706,9 +706,9 @@ namespace WMS.Web.Domain.Services
|
||||
/// <param name="begin"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task<Result> ErpDel(DateTime begin)
|
||||
public async Task<Result> ErpDel()
|
||||
{
|
||||
var list = await _inStockTaskRepositories.GetEntityList(begin);
|
||||
var list = await _inStockTaskRepositories.GetEntityListByStatus();
|
||||
var result = await GetData(list);
|
||||
if (!result.IsSuccess) return Result.ReFailure(result.Message, result.Status);
|
||||
var erp_list = result.Data;
|
||||
|
||||
@@ -646,9 +646,9 @@ namespace WMS.Web.Domain.Services
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task<Result> ErpDel(DateTime begin)
|
||||
public async Task<Result> ErpDel()
|
||||
{
|
||||
var list = await _outStockTaskRepositories.GetEntityList(begin);
|
||||
var list = await _outStockTaskRepositories.GetEntityListByStatus();
|
||||
var result = await GetData(list);
|
||||
if (!result.IsSuccess) return Result.ReFailure(result.Message, result.Status);
|
||||
var erp_list = result.Data;
|
||||
|
||||
Reference in New Issue
Block a user