feat: add ERP material issue outbound callback
This commit is contained in:
1 parent
3da4bddb98
commit
eda824cea7
13 files changed
+587
-20
No files matched your search
@@ -0,0 +1,56 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user