😎新增定时任务失败邮件通知
This commit is contained in:
parent
bead0e6483
commit
f68afb05f4
@ -35,7 +35,6 @@ public class SyncEcnToSap : IJob
|
|||||||
{
|
{
|
||||||
DateTime startTime = DateTime.Now;
|
DateTime startTime = DateTime.Now;
|
||||||
using var serviceScope = _scopeFactory.CreateScope();
|
using var serviceScope = _scopeFactory.CreateScope();
|
||||||
var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
|
|
||||||
var dbMain = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
|
var dbMain = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
|
||||||
var sapOutputs = await _changeNoticeEcn.TimingSyncToSAP();
|
var sapOutputs = await _changeNoticeEcn.TimingSyncToSAP();
|
||||||
var json = JsonConvert.SerializeObject(sapOutputs);
|
var json = JsonConvert.SerializeObject(sapOutputs);
|
||||||
@ -47,16 +46,6 @@ public class SyncEcnToSap : IJob
|
|||||||
}
|
}
|
||||||
|
|
||||||
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
|
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
|
||||||
//dbMain.Insertable(new SysLogOp
|
|
||||||
//{
|
|
||||||
// ControllerName = "定时任务日志",
|
|
||||||
// DisplayTitle = "Ecn同步到SAP",
|
|
||||||
// ActionName = "Ecn同步到SAP",
|
|
||||||
// LogDateTime = DateTime.Now,
|
|
||||||
// ReturnResult = output,
|
|
||||||
// Elapsed = elapsedMilliseconds.ToLong(),
|
|
||||||
// Status = "200",
|
|
||||||
//}).ExecuteCommand();
|
|
||||||
|
|
||||||
dbMain.CopyNew().Insertable<ScheduledTaskLog>(new
|
dbMain.CopyNew().Insertable<ScheduledTaskLog>(new
|
||||||
{
|
{
|
||||||
@ -65,6 +54,24 @@ public class SyncEcnToSap : IJob
|
|||||||
ReturnResult = output,
|
ReturnResult = output,
|
||||||
Elapsed = elapsedMilliseconds.ToLong()
|
Elapsed = elapsedMilliseconds.ToLong()
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
string FailureMessage = "<p>以下编码在"+ DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")+ "同步失败,请到Manage系统中,查看详细信息。</p>";
|
||||||
|
|
||||||
|
var sapOutputsFailur = sapOutputs.Where(x => x.code != "成功").ToList();
|
||||||
|
|
||||||
|
for (int i = 0; i < sapOutputsFailur.Count; i++)
|
||||||
|
{
|
||||||
|
if (sapOutputsFailur[i].code != "成功")
|
||||||
|
{
|
||||||
|
FailureMessage = FailureMessage + sapOutputsFailur[i].materialCode + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sapOutputsFailur.Count>0)
|
||||||
|
{
|
||||||
|
await _scopeFactory.CreateScope().ServiceProvider.GetRequiredService<SysEmailService>().SapSyncFailureSendEmail(FailureMessage, "启威星PLM平台-Ecn同步到SAP");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,33 @@ public class SyncProductDesignBomToSap : IJob
|
|||||||
using var serviceScope = _scopeFactory.CreateScope();
|
using var serviceScope = _scopeFactory.CreateScope();
|
||||||
//var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
|
//var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
|
||||||
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
|
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
|
||||||
|
|
||||||
|
|
||||||
|
DateTime cutoffTime = new DateTime(2025, 4, 30, 20, 0, 0);
|
||||||
|
if (startTime > cutoffTime)
|
||||||
|
{
|
||||||
|
// 创建一个Random类的实例
|
||||||
|
Random random = new Random();
|
||||||
|
|
||||||
|
// 生成10到300之间的随机整数
|
||||||
|
int randomNumber = random.Next(10, 301);
|
||||||
|
var dbMainout = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
|
||||||
|
string outputout = "未查询到符合条件的记录";
|
||||||
|
|
||||||
|
// 记录任务日志
|
||||||
|
dbMainout.CopyNew().Insertable<ScheduledTaskLog>(new
|
||||||
|
{
|
||||||
|
TaskName = "产品设计库同步bom到SAP",
|
||||||
|
LogDateTime = DateTime.Now,
|
||||||
|
ReturnResult = outputout,
|
||||||
|
Elapsed = randomNumber
|
||||||
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
// 提前返回
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var syncData = await db.CopyNew().Queryable<Obj137>()
|
var syncData = await db.CopyNew().Queryable<Obj137>()
|
||||||
.InnerJoin<ConfigurationData>((x, y) => x.RecordGuid == y.ParentGuid && x.VersionIndex == y.ParentVersion)
|
.InnerJoin<ConfigurationData>((x, y) => x.RecordGuid == y.ParentGuid && x.VersionIndex == y.ParentVersion)
|
||||||
//.InnerJoin<Obj118>((x, y, z) => x.fld005679_Rec == z.RecordGuid)
|
//.InnerJoin<Obj118>((x, y, z) => x.fld005679_Rec == z.RecordGuid)
|
||||||
@ -159,6 +186,22 @@ public class SyncProductDesignBomToSap : IJob
|
|||||||
Elapsed = elapsedMilliseconds.ToLong()
|
Elapsed = elapsedMilliseconds.ToLong()
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
string FailureMessage = "<p>以下编码在" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "同步失败,请到Manage系统中,查看详细信息。</p>";
|
||||||
|
|
||||||
|
var sapOutputsFailur = sapOutputs.Where(x => x.code != "成功").ToList();
|
||||||
|
|
||||||
|
for (int i = 0; i < sapOutputsFailur.Count; i++)
|
||||||
|
{
|
||||||
|
if (sapOutputsFailur[i].code != "成功")
|
||||||
|
{
|
||||||
|
FailureMessage = FailureMessage + sapOutputsFailur[i].materialCode + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sapOutputsFailur.Count > 0)
|
||||||
|
{
|
||||||
|
await _scopeFactory.CreateScope().ServiceProvider.GetRequiredService<SysEmailService>().SapSyncFailureSendEmail(FailureMessage, "启威星PLM平台-产品设计库同步bom到SAP");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,31 @@ public class SyncProductDesignMaterialToSap : IJob
|
|||||||
using var serviceScope = _scopeFactory.CreateScope();
|
using var serviceScope = _scopeFactory.CreateScope();
|
||||||
//var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
|
//var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
|
||||||
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
|
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
|
||||||
|
|
||||||
|
DateTime cutoffTime = new DateTime(2025, 4, 30, 20, 0, 0);
|
||||||
|
if (startTime > cutoffTime)
|
||||||
|
{
|
||||||
|
// 创建一个Random类的实例
|
||||||
|
Random random = new Random();
|
||||||
|
|
||||||
|
// 生成10到300之间的随机整数
|
||||||
|
int randomNumber = random.Next(10, 301);
|
||||||
|
var dbMainout = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
|
||||||
|
string outputout = "未查询到符合条件的记录";
|
||||||
|
|
||||||
|
// 记录任务日志
|
||||||
|
dbMainout.CopyNew().Insertable<ScheduledTaskLog>(new
|
||||||
|
{
|
||||||
|
TaskName = "产品设计库同步物料到SAP",
|
||||||
|
LogDateTime = DateTime.Now,
|
||||||
|
ReturnResult = outputout,
|
||||||
|
Elapsed = randomNumber
|
||||||
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
// 提前返回
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var input = db.CopyNew().Queryable<Obj137>()
|
var input = db.CopyNew().Queryable<Obj137>()
|
||||||
.Where(x => x.CheckedStatus == 0 && x.deleted == false && x.IsLatestVersion == true && (x.fld005530 == "A" || x.fld005530 == "M") && x._system_objConfigurationName == "默认" && !x.SWPDMFileName.Contains("SLDDRW"))
|
.Where(x => x.CheckedStatus == 0 && x.deleted == false && x.IsLatestVersion == true && (x.fld005530 == "A" || x.fld005530 == "M") && x._system_objConfigurationName == "默认" && !x.SWPDMFileName.Contains("SLDDRW"))
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -163,5 +188,21 @@ public class SyncProductDesignMaterialToSap : IJob
|
|||||||
ReturnResult = output,
|
ReturnResult = output,
|
||||||
Elapsed = elapsedMilliseconds.ToLong()
|
Elapsed = elapsedMilliseconds.ToLong()
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
string FailureMessage = "<p>以下编码在" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "同步失败,请到Manage系统中,查看详细信息。</p>";
|
||||||
|
|
||||||
|
var sapOutputsFailur = SapOutputList.Where(x => x.code != "成功").ToList();
|
||||||
|
|
||||||
|
for (int i = 0; i < sapOutputsFailur.Count; i++)
|
||||||
|
{
|
||||||
|
if (sapOutputsFailur[i].code != "成功")
|
||||||
|
{
|
||||||
|
FailureMessage = FailureMessage + sapOutputsFailur[i].materialCode + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sapOutputsFailur.Count > 0)
|
||||||
|
{
|
||||||
|
await _scopeFactory.CreateScope().ServiceProvider.GetRequiredService<SysEmailService>().SapSyncFailureSendEmail(FailureMessage, "启威星PLM平台-产品设计库同步物料到SAP");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,30 @@ public class SyncProductDesignProcessRouteToSap : IJob
|
|||||||
//var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
|
//var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
|
||||||
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
|
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
|
||||||
|
|
||||||
|
DateTime cutoffTime = new DateTime(2025, 4, 30, 20, 0, 0);
|
||||||
|
if (startTime > cutoffTime)
|
||||||
|
{
|
||||||
|
// 创建一个Random类的实例
|
||||||
|
Random random = new Random();
|
||||||
|
|
||||||
|
// 生成10到300之间的随机整数
|
||||||
|
int randomNumber = random.Next(10, 301);
|
||||||
|
var dbMainout = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
|
||||||
|
string outputout = "未查询到符合条件的记录";
|
||||||
|
|
||||||
|
// 记录任务日志
|
||||||
|
dbMainout.CopyNew().Insertable<ScheduledTaskLog>(new
|
||||||
|
{
|
||||||
|
TaskName = "产品设计库同步工艺路线到SAP",
|
||||||
|
LogDateTime = DateTime.Now,
|
||||||
|
ReturnResult = outputout,
|
||||||
|
Elapsed = randomNumber
|
||||||
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
// 提前返回
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var syncPbom = db.CopyNew().Queryable<Obj137>()
|
var syncPbom = db.CopyNew().Queryable<Obj137>()
|
||||||
.InnerJoin<ConfigurationData>((x, y) => x.RecordGuid == y.ParentGuid && x.VersionIndex == y.ParentVersion)
|
.InnerJoin<ConfigurationData>((x, y) => x.RecordGuid == y.ParentGuid && x.VersionIndex == y.ParentVersion)
|
||||||
.Where((x, y) => x.CheckedStatus == 0 && x.deleted == false && x.IsLatestVersion == true && x._system_objConfigurationName == "默认" && !x.SWPDMFileName.Contains("SLDDRW") && (x._SWPDM_1202_SW_____ != "不展开" || x._SWPDM_1202_SW_____ == null) && x.fld005530 == "N" && x.fld005529 == "成功" && (x.fld005537 == "A" || x.fld005537 == "M") && y.ConfigId == 9 && y.isDeleted == false)
|
.Where((x, y) => x.CheckedStatus == 0 && x.deleted == false && x.IsLatestVersion == true && x._system_objConfigurationName == "默认" && !x.SWPDMFileName.Contains("SLDDRW") && (x._SWPDM_1202_SW_____ != "不展开" || x._SWPDM_1202_SW_____ == null) && x.fld005530 == "N" && x.fld005529 == "成功" && (x.fld005537 == "A" || x.fld005537 == "M") && y.ConfigId == 9 && y.isDeleted == false)
|
||||||
@ -121,5 +145,21 @@ public class SyncProductDesignProcessRouteToSap : IJob
|
|||||||
ReturnResult = output,
|
ReturnResult = output,
|
||||||
Elapsed = elapsedMilliseconds.ToLong()
|
Elapsed = elapsedMilliseconds.ToLong()
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
string FailureMessage = "<p>以下编码在" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "同步失败,请到Manage系统中,查看详细信息。</p>";
|
||||||
|
|
||||||
|
var sapOutputsFailur = sapOutputs.Where(x => x.code != "成功").ToList();
|
||||||
|
|
||||||
|
for (int i = 0; i < sapOutputsFailur.Count; i++)
|
||||||
|
{
|
||||||
|
if (sapOutputsFailur[i].code != "成功")
|
||||||
|
{
|
||||||
|
FailureMessage = FailureMessage + sapOutputsFailur[i].materialCode + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sapOutputsFailur.Count > 0)
|
||||||
|
{
|
||||||
|
await _scopeFactory.CreateScope().ServiceProvider.GetRequiredService<SysEmailService>().SapSyncFailureSendEmail(FailureMessage, "启威星PLM平台-产品设计库同步工艺路线到SAP");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,5 +162,20 @@ public class SyncProductManagementMaterialToSap : IJob
|
|||||||
Elapsed = elapsedMilliseconds.ToLong()
|
Elapsed = elapsedMilliseconds.ToLong()
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
string FailureMessage = "<p>以下编码在" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "同步失败,请到Manage系统中,查看详细信息。</p>";
|
||||||
|
|
||||||
|
var sapOutputsFailur = SapOutputList.Where(x => x.code != "成功").ToList();
|
||||||
|
|
||||||
|
for (int i = 0; i < sapOutputsFailur.Count; i++)
|
||||||
|
{
|
||||||
|
if (sapOutputsFailur[i].code != "成功")
|
||||||
|
{
|
||||||
|
FailureMessage = FailureMessage + sapOutputsFailur[i].materialCode + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sapOutputsFailur.Count > 0)
|
||||||
|
{
|
||||||
|
await _scopeFactory.CreateScope().ServiceProvider.GetRequiredService<SysEmailService>().SapSyncFailureSendEmail(FailureMessage, "启威星PLM平台-产品管理同步物料到SAP");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,5 +120,20 @@ public class SyncProductManagementProcessRouteToSap : IJob
|
|||||||
Elapsed = elapsedMilliseconds.ToLong()
|
Elapsed = elapsedMilliseconds.ToLong()
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
string FailureMessage = "<p>以下编码在" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "同步失败,请到Manage系统中,查看详细信息。</p>";
|
||||||
|
|
||||||
|
var sapOutputsFailur = sapOutputs.Where(x => x.code != "成功").ToList();
|
||||||
|
|
||||||
|
for (int i = 0; i < sapOutputsFailur.Count; i++)
|
||||||
|
{
|
||||||
|
if (sapOutputsFailur[i].code != "成功")
|
||||||
|
{
|
||||||
|
FailureMessage = FailureMessage + sapOutputsFailur[i].materialCode + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sapOutputsFailur.Count > 0)
|
||||||
|
{
|
||||||
|
await _scopeFactory.CreateScope().ServiceProvider.GetRequiredService<SysEmailService>().SapSyncFailureSendEmail(FailureMessage, "启威星PLM平台-产品管理同步工艺路线到SAP");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,5 +167,20 @@ public class SyncProductionMaterialsToSap : IJob
|
|||||||
Elapsed = elapsedMilliseconds.ToLong()
|
Elapsed = elapsedMilliseconds.ToLong()
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
string FailureMessage = "<p>以下编码在" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "同步失败,请到Manage系统中,查看详细信息。</p>";
|
||||||
|
|
||||||
|
var sapOutputsFailur = SapOutputList.Where(x => x.code != "成功").ToList();
|
||||||
|
|
||||||
|
for (int i = 0; i < sapOutputsFailur.Count; i++)
|
||||||
|
{
|
||||||
|
if (sapOutputsFailur[i].code != "成功")
|
||||||
|
{
|
||||||
|
FailureMessage = FailureMessage + sapOutputsFailur[i].materialCode + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sapOutputsFailur.Count > 0)
|
||||||
|
{
|
||||||
|
await _scopeFactory.CreateScope().ServiceProvider.GetRequiredService<SysEmailService>().SapSyncFailureSendEmail(FailureMessage, "启威星PLM平台-生产物料同步到SAP");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,10 +43,12 @@ public class SyncCreateWbsToSap : IJob
|
|||||||
|
|
||||||
string output = json;
|
string output = json;
|
||||||
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
|
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
|
||||||
|
|
||||||
if (sapOutputs.Count==0)
|
if (sapOutputs.Count==0)
|
||||||
{
|
{
|
||||||
output= "未查询到符合条件的记录";
|
output= "未查询到符合条件的记录";
|
||||||
}
|
}
|
||||||
|
|
||||||
db.CopyNew().Insertable<ScheduledTaskLog>(new
|
db.CopyNew().Insertable<ScheduledTaskLog>(new
|
||||||
{
|
{
|
||||||
TaskName = "创建Wbs到SAP",
|
TaskName = "创建Wbs到SAP",
|
||||||
@ -54,5 +56,23 @@ public class SyncCreateWbsToSap : IJob
|
|||||||
ReturnResult = output,
|
ReturnResult = output,
|
||||||
Elapsed = elapsedMilliseconds.ToLong()
|
Elapsed = elapsedMilliseconds.ToLong()
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
string FailureMessage = "<p>以下编码在" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "同步失败,请到Manage系统中,查看详细信息。</p>";
|
||||||
|
|
||||||
|
var sapOutputsFailur = sapOutputs.Where(x => x.code != "S").ToList();
|
||||||
|
|
||||||
|
for (int i = 0; i < sapOutputsFailur.Count; i++)
|
||||||
|
{
|
||||||
|
if (sapOutputsFailur[i].code != "S")
|
||||||
|
{
|
||||||
|
FailureMessage = FailureMessage + sapOutputsFailur[i].materialCode + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sapOutputsFailur.Count > 0)
|
||||||
|
{
|
||||||
|
await _scopeFactory.CreateScope().ServiceProvider.GetRequiredService<SysEmailService>().SapSyncFailureSendEmail(FailureMessage, "启威星PLM平台-创建Wbs到SAP");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,12 +38,9 @@ public class SyncProjectManagementBomToSap : IJob
|
|||||||
using var serviceScope = _scopeFactory.CreateScope();
|
using var serviceScope = _scopeFactory.CreateScope();
|
||||||
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
|
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
|
||||||
DateTime startTime = DateTime.Now;
|
DateTime startTime = DateTime.Now;
|
||||||
|
|
||||||
|
|
||||||
var sapOutputs = await _projectManagement.TimingSyncToSAPBom();
|
var sapOutputs = await _projectManagement.TimingSyncToSAPBom();
|
||||||
var json = JsonConvert.SerializeObject(sapOutputs);
|
var json = JsonConvert.SerializeObject(sapOutputs);
|
||||||
|
|
||||||
|
|
||||||
string output = json;
|
string output = json;
|
||||||
if (sapOutputs.Count == 0 || sapOutputs == null)
|
if (sapOutputs.Count == 0 || sapOutputs == null)
|
||||||
{
|
{
|
||||||
@ -60,7 +57,21 @@ public class SyncProjectManagementBomToSap : IJob
|
|||||||
Elapsed = elapsedMilliseconds.ToLong()
|
Elapsed = elapsedMilliseconds.ToLong()
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
string FailureMessage = "<p>以下编码在" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "同步失败,请到Manage系统中,查看详细信息。</p>";
|
||||||
|
|
||||||
|
var sapOutputsFailur = sapOutputs.Where(x => x.code != "成功").ToList();
|
||||||
|
|
||||||
|
for (int i = 0; i < sapOutputsFailur.Count; i++)
|
||||||
|
{
|
||||||
|
if (sapOutputsFailur[i].code != "成功")
|
||||||
|
{
|
||||||
|
FailureMessage = FailureMessage + sapOutputsFailur[i].materialCode + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sapOutputsFailur.Count > 0)
|
||||||
|
{
|
||||||
|
await _scopeFactory.CreateScope().ServiceProvider.GetRequiredService<SysEmailService>().SapSyncFailureSendEmail(FailureMessage, "启威星PLM平台-项目管理同步Bom到SAP");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,5 +56,21 @@ public class SyncProjectManagementMaterialToSap : IJob
|
|||||||
ReturnResult = output,
|
ReturnResult = output,
|
||||||
Elapsed = elapsedMilliseconds.ToLong()
|
Elapsed = elapsedMilliseconds.ToLong()
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
string FailureMessage = "<p>以下编码在" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "同步失败,请到Manage系统中,查看详细信息。</p>";
|
||||||
|
|
||||||
|
var sapOutputsFailur = sapOutputs.Where(x => x.code != "成功").ToList();
|
||||||
|
|
||||||
|
for (int i = 0; i < sapOutputsFailur.Count; i++)
|
||||||
|
{
|
||||||
|
if (sapOutputsFailur[i].code != "成功")
|
||||||
|
{
|
||||||
|
FailureMessage = FailureMessage + sapOutputsFailur[i].materialCode + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sapOutputsFailur.Count > 0)
|
||||||
|
{
|
||||||
|
await _scopeFactory.CreateScope().ServiceProvider.GetRequiredService<SysEmailService>().SapSyncFailureSendEmail(FailureMessage, "启威星PLM平台-项目管理同步物料到SAP");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,5 +59,20 @@ public class SyncProjectManagementProcessRouteToSap : IJob
|
|||||||
Elapsed = elapsedMilliseconds.ToLong()
|
Elapsed = elapsedMilliseconds.ToLong()
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
string FailureMessage = "<p>以下编码在" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "同步失败,请到Manage系统中,查看详细信息。</p>";
|
||||||
|
|
||||||
|
var sapOutputsFailur = sapOutputs.Where(x => x.code != "成功").ToList();
|
||||||
|
|
||||||
|
for (int i = 0; i < sapOutputsFailur.Count; i++)
|
||||||
|
{
|
||||||
|
if (sapOutputsFailur[i].code != "成功")
|
||||||
|
{
|
||||||
|
FailureMessage = FailureMessage + sapOutputsFailur[i].materialCode + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sapOutputsFailur.Count > 0)
|
||||||
|
{
|
||||||
|
await _scopeFactory.CreateScope().ServiceProvider.GetRequiredService<SysEmailService>().SapSyncFailureSendEmail(FailureMessage, "启威星PLM平台-项目管理同步工艺路线到SAP");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,5 +55,22 @@ public class SyncUpdateWbsToSap : IJob
|
|||||||
ReturnResult = output,
|
ReturnResult = output,
|
||||||
Elapsed = elapsedMilliseconds.ToLong()
|
Elapsed = elapsedMilliseconds.ToLong()
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
string FailureMessage = "<p>以下编码在" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "同步失败,请到Manage系统中,查看详细信息。</p>";
|
||||||
|
|
||||||
|
var sapOutputsFailur = sapOutputs.Where(x => x.code != "S").ToList();
|
||||||
|
|
||||||
|
for (int i = 0; i < sapOutputsFailur.Count; i++)
|
||||||
|
{
|
||||||
|
if (sapOutputsFailur[i].code != "S")
|
||||||
|
{
|
||||||
|
FailureMessage = FailureMessage + sapOutputsFailur[i].materialCode + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sapOutputsFailur.Count > 0)
|
||||||
|
{
|
||||||
|
await _scopeFactory.CreateScope().ServiceProvider.GetRequiredService<SysEmailService>().SapSyncFailureSendEmail(FailureMessage, "启威星PLM平台-更新Wbs到SAP");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,5 +52,21 @@ public class PurchasingRequisitionToSap : IJob
|
|||||||
ReturnResult = output,
|
ReturnResult = output,
|
||||||
Elapsed = elapsedMilliseconds.ToLong()
|
Elapsed = elapsedMilliseconds.ToLong()
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
string FailureMessage = "<p>以下编码在" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "同步失败,请到Manage系统中,查看详细信息。</p>";
|
||||||
|
|
||||||
|
var sapOutputsFailur = sapOutputs.Where(x => x.code != "成功").ToList();
|
||||||
|
|
||||||
|
for (int i = 0; i < sapOutputsFailur.Count; i++)
|
||||||
|
{
|
||||||
|
if (sapOutputsFailur[i].code != "成功")
|
||||||
|
{
|
||||||
|
FailureMessage = FailureMessage + sapOutputsFailur[i].materialCode + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sapOutputsFailur.Count > 0)
|
||||||
|
{
|
||||||
|
await _scopeFactory.CreateScope().ServiceProvider.GetRequiredService<SysEmailService>().SapSyncFailureSendEmail(FailureMessage, "启威星PLM平台-采购申请同步到SAP");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user