57 lines
1.9 KiB
C#
57 lines
1.9 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using HHWMS.Web.Models;
|
|
using Quartz;
|
|
using WalkingTec.Mvvm.Core;
|
|
using WalkingTec.Mvvm.Core.Support.Quartz;
|
|
|
|
namespace HHWMS.Web
|
|
{
|
|
[PersistJobDataAfterExecution]
|
|
[DisallowConcurrentExecution]
|
|
public class AddOtherOutJob : WtmJob
|
|
{
|
|
public override async Task Execute(IJobExecutionContext context)
|
|
{
|
|
try
|
|
{
|
|
var unitWork = new UnitWork(Wtm);
|
|
var transaction = unitWork.Find<InventoryTransaction>(x =>
|
|
x.Type == InventoryTranType.出库
|
|
&& x.BillType == InventoryTransaction.ErpOtherOutBillType
|
|
&& x.UploadErpFlag != 1
|
|
&& x.UploadErpFlag != null)
|
|
.OrderBy(x => x.ID)
|
|
.FirstOrDefault();
|
|
|
|
if (transaction != null)
|
|
{
|
|
var vm = Wtm.CreateVM<InventoryVM>();
|
|
await vm.ProcessErpOtherOut(transaction);
|
|
}
|
|
|
|
var job = unitWork.FindSingle<SysJob>(x => x.JobName == context.JobDetail.Key.Name);
|
|
if (job != null)
|
|
{
|
|
job.LastFireTime = TimeZoneInfo.ConvertTimeFromUtc(
|
|
context.FireTimeUtc.DateTime,
|
|
TimeZoneInfo.Local);
|
|
if (context.NextFireTimeUtc != null)
|
|
{
|
|
job.NextFireTime = TimeZoneInfo.ConvertTimeFromUtc(
|
|
context.NextFireTimeUtc.Value.DateTime,
|
|
TimeZoneInfo.Local);
|
|
}
|
|
unitWork.Update(job);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Wtm.DoLog("ERP领料出库补传失败", ActionLogTypesEnum.Job,
|
|
"AddOtherOutJob", request: "error", result: ex.Message);
|
|
}
|
|
}
|
|
}
|
|
}
|