调整监测金蝶删单
This commit is contained in:
@@ -157,9 +157,7 @@ namespace WMS.Web.Api.Controllers
|
||||
//2.同步金蝶
|
||||
await _inStockTaskService.Sysn(sourcesBillNos);
|
||||
////再刷新
|
||||
await _inStockTaskService.Sysn(null);
|
||||
//验证金蝶是否有删单//默认拉去8个小时以内的
|
||||
return await _inStockTaskService.ErpDel(DateTime.Now.AddHours(-8));
|
||||
return await _inStockTaskService.Sysn(null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -269,9 +269,7 @@ namespace WMS.Web.Api.Controllers
|
||||
//先刷新选中的数据
|
||||
await _outStockTaskService.Sync(res.Select(s => s.BillNo).ToList());
|
||||
//再刷新3天内所有的
|
||||
await _outStockTaskService.Sync(null, begin);
|
||||
//验证金蝶是否有删单
|
||||
return await _outStockTaskService.ErpDel(DateTime.Now.AddHours(-8));
|
||||
return await _outStockTaskService.Sync(null, begin);
|
||||
}
|
||||
/// <summary>
|
||||
/// 出库任务单详情
|
||||
|
||||
@@ -142,6 +142,20 @@ namespace WMS.Web.Api.Controllers
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 手动同步金蝶删单信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("RefreshErpDelete")]
|
||||
public async Task<string> RefreshErpDelete()
|
||||
{
|
||||
if (!_env.IsDevelopment()) return "";
|
||||
await _inStockTaskService.ErpDel();
|
||||
await _outStockTaskService.ErpDel();
|
||||
return "";
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("tf")]
|
||||
public async Task<string> TestTF()
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
"JobStartExpreAmount": "0 50 23 * * ?",
|
||||
"JobStartExpreSend": "0 0 12,16,20 * * ?",
|
||||
"JobStartExpreMaterial": "0 30 23 * * ?",
|
||||
|
||||
"JobStartErpDelete": "0 5 8/12/16/20 * * ?",
|
||||
//a.是否启用集群:键和值
|
||||
"JobStoreClusteredKey": "quartz.jobStore.clustered",
|
||||
"JobStoreClusteredValue": true,
|
||||
|
||||
@@ -792,6 +792,12 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Api.Controllers.TestController.RefreshErpDelete">
|
||||
<summary>
|
||||
手动同步金蝶删单信息
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Api.Controllers.TestController.GetMaterial(System.Collections.Generic.List{System.Int32})">
|
||||
<summary>
|
||||
根据物料Id获取物料编码
|
||||
|
||||
@@ -3165,7 +3165,7 @@
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskRepositories.GetEntityList(System.DateTime)">
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskRepositories.GetEntityListByStatus">
|
||||
查询实体集合
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Infrastructure.IInventoryDetailsRepositories">
|
||||
@@ -3338,7 +3338,7 @@
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IOutStockTaskRepositories.GetEntityList(System.Collections.Generic.List{System.Int32})">
|
||||
查询实体集合
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IOutStockTaskRepositories.GetEntityList(System.DateTime)">
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IOutStockTaskRepositories.GetEntityListByStatus">
|
||||
查询实体集合
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IOutStockTaskRepositories.GetEntityListByDetailIds(System.Collections.Generic.List{System.Int32})">
|
||||
@@ -3744,7 +3744,7 @@
|
||||
<param name="billNos"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.IInStockTaskService.ErpDel(System.DateTime)">
|
||||
<member name="M:WMS.Web.Domain.IService.IInStockTaskService.ErpDel">
|
||||
<summary>
|
||||
金蝶删单后这边单据作废
|
||||
</summary>
|
||||
@@ -4341,7 +4341,7 @@
|
||||
<param name="begin"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.Public.IOutStockTaskService.ErpDel(System.DateTime)">
|
||||
<member name="M:WMS.Web.Domain.IService.Public.IOutStockTaskService.ErpDel">
|
||||
<summary>
|
||||
金蝶删单后这边单据作废
|
||||
</summary>
|
||||
@@ -4785,6 +4785,11 @@
|
||||
同步新物料执行cron表达式:每天23:30整点同步
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Options.QuartzJobOptions.JobStartErpDelete">
|
||||
<summary>
|
||||
监测金蝶删单
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Options.QuartzJobOptions.JobStoreClusteredKey">
|
||||
<summary>
|
||||
是否启用集群:键
|
||||
@@ -4897,6 +4902,18 @@
|
||||
<param name="context"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.QuartzJob.ErpDeleteQuartzJob">
|
||||
<summary>
|
||||
监测金蝶删单
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.QuartzJob.ErpDeleteQuartzJob.Execute(Quartz.IJobExecutionContext)">
|
||||
<summary>
|
||||
执行方法
|
||||
</summary>
|
||||
<param name="context"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.QuartzJob.InStockOrderQuartzJob">
|
||||
<summary>
|
||||
erp入库任务单-获取定时任务
|
||||
@@ -5468,7 +5485,7 @@
|
||||
<returns></returns>
|
||||
<exception cref="T:System.NotImplementedException"></exception>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.InStockTaskService.ErpDel(System.DateTime)">
|
||||
<member name="M:WMS.Web.Domain.Services.InStockTaskService.ErpDel">
|
||||
<summary>
|
||||
金蝶删单后wms单据作废
|
||||
</summary>
|
||||
@@ -5678,7 +5695,7 @@
|
||||
<param name="dto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.OutStockTaskService.ErpDel(System.DateTime)">
|
||||
<member name="M:WMS.Web.Domain.Services.OutStockTaskService.ErpDel">
|
||||
<summary>
|
||||
金蝶删单后wms单据作废
|
||||
</summary>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -285,6 +285,18 @@ namespace WMS.Web.Repositories.DependencyInjection
|
||||
//.WithCronSchedule(CronScheduleBuilder.DailyAtHourAndMinute(options.JobStartHour[5], options.JobStartMinute[5]))
|
||||
.WithDescription("MaterialsQuartzJobTriggerDecs"));
|
||||
#endregion
|
||||
|
||||
#region 监测金蝶删单
|
||||
var jobKey_erpdelete = new JobKey("ErpDeleteQuartzJob", options.QuartzJobValue);
|
||||
q.AddJob<ErpDeleteQuartzJob>(jobKey_erpdelete, j => j.WithDescription("ErpDeleteQuartzJob"));
|
||||
q.AddTrigger(t => t
|
||||
.WithIdentity("ErpDeleteQuartzJobTrigger")
|
||||
.ForJob(jobKey_erpdelete)
|
||||
.StartNow()
|
||||
.WithCronSchedule(options.JobStartErpDelete)
|
||||
//.WithCronSchedule(CronScheduleBuilder.DailyAtHourAndMinute(options.JobStartHour[5], options.JobStartMinute[5]))
|
||||
.WithDescription("ErpDeleteQuartzJobTriggerDecs"));
|
||||
#endregion
|
||||
});
|
||||
//.net core核心托管-添加Quartz服务器
|
||||
Services.AddQuartzServer(options =>
|
||||
|
||||
@@ -829,11 +829,13 @@ namespace WMS.Web.Repositories
|
||||
return (list, total);
|
||||
}
|
||||
|
||||
public async Task<List<InStockTask>> GetEntityList(DateTime begin)
|
||||
public async Task<List<InStockTask>> GetEntityListByStatus()
|
||||
{
|
||||
var res = await _context.InStockTask
|
||||
.Include(s => s.Details)
|
||||
.Where(f => f.WmsUpdateTime >= begin)
|
||||
.Where(f => f.Status == InstockStatus.Wait
|
||||
|| f.Status == InstockStatus.Part
|
||||
|| f.Status == InstockStatus.WaitInStock)
|
||||
.ToListAsync();
|
||||
|
||||
return res;
|
||||
|
||||
@@ -567,11 +567,11 @@ namespace WMS.Web.Repositories
|
||||
return entitys.Clone();
|
||||
}
|
||||
|
||||
public async Task<List<OutStockTask>> GetEntityList(DateTime begin)
|
||||
public async Task<List<OutStockTask>> GetEntityListByStatus()
|
||||
{
|
||||
var res = await _context.OutStockTask
|
||||
.Include(s => s.Details).ThenInclude(s => s.ErpDetails)
|
||||
.Where(f => f.WmsUpdateTime >= begin)
|
||||
.Where(f => f.Status==OutStockStatus.Wait || f.Status == OutStockStatus.Part)
|
||||
.ToListAsync();
|
||||
|
||||
return res.Clone();
|
||||
|
||||
Reference in New Issue
Block a user