😎优化方法查询方式

This commit is contained in:
bairubing 2025-01-15 10:57:31 +08:00
parent 3bf222fa63
commit acd4e637db
44 changed files with 4862 additions and 1276 deletions

View File

@ -5,12 +5,14 @@
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using Admin.NET.Core.Service;
using DocumentFormat.OpenXml.Bibliography;
using DocumentFormat.OpenXml.Drawing.Spreadsheet;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Server.IISIntegration;
using Microsoft.Extensions.DependencyInjection;
using NewLife;
using Qiniu.CDN;
using RazorEngine;
@ -38,6 +40,7 @@ public class DataValidationService : IDynamicApiController, ITransient
public SqlSugarRepository<Obj137> _obj137Rep;
public SqlSugarRepository<ObjectTypeCheckList> _objectTypeCheckListRep;
public SqlSugarRepository<ConfigurationData> _configurationDataRep;
private readonly IServiceScopeFactory _scopeFactory;
public DataValidationService(
SqlSugarRepository<Obj110> obj110Rep,
SqlSugarRepository<Obj109> obj109Rep,
@ -46,7 +49,8 @@ public class DataValidationService : IDynamicApiController, ITransient
SqlSugarRepository<Obj122> obj122Rep,
SqlSugarRepository<Obj137> obj137Rep,
SqlSugarRepository<ObjectTypeCheckList> objectTypeCheckList,
SqlSugarRepository<ConfigurationData> configurationDataRep
SqlSugarRepository<ConfigurationData> configurationDataRep,
IServiceScopeFactory scopeFactory
)
{
@ -58,6 +62,7 @@ public class DataValidationService : IDynamicApiController, ITransient
_obj137Rep = obj137Rep;
_objectTypeCheckListRep = objectTypeCheckList;
_configurationDataRep = configurationDataRep;
_scopeFactory = scopeFactory;
}
/// <summary>
/// 验证物料是否存在
@ -68,34 +73,93 @@ public class DataValidationService : IDynamicApiController, ITransient
/// <returns></returns>
public async Task<string> VerificationMaterial(long objId, string materialCode, string recordGuid)
{
using var serviceScope = _scopeFactory.CreateScope();
//var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
string verification = "不存在";
var tasks = new List<Task<int>>();
switch (objId)
if (objId==110)
{
case 110:
tasks.Add(_obj110Rep.AsQueryable().Where(x => x._System_objNBS == materialCode && x.deleted == false && x.RecordGuid == recordGuid).CountAsync());
break;
case 109:
tasks.Add(_obj109Rep.AsQueryable().Where(x => x._System_objNBS == materialCode && x.deleted == false && x.RecordGuid == recordGuid).CountAsync());
break;
case 112:
tasks.Add(_obj112Rep.AsQueryable().Where(x => x._System_objNBS == materialCode && x.deleted == false && x.RecordGuid == recordGuid).CountAsync());
break;
case 133:
tasks.Add(_obj133Rep.AsQueryable().Where(x => x._System_objNBS == materialCode && x.deleted == false && x.RecordGuid == recordGuid).CountAsync());
break;
case 122:
tasks.Add(_obj122Rep.AsQueryable().Where(x => x._System_objNBS == materialCode && x.deleted == false && x.RecordGuid == recordGuid).CountAsync());
break;
case 137:
tasks.Add(_obj137Rep.AsQueryable().Where(x => x._System_objNBS == materialCode && x.deleted == false && x.RecordGuid == recordGuid).CountAsync());
break;
}
if (tasks.Count > 0)
var data = db.CopyNew().Queryable<Obj110>().Where(x => x._System_objNBS == materialCode && x.deleted == false && x.RecordGuid == recordGuid).Count();
if (data>0)
{
var result = await Task.WhenAll(tasks);
verification = result.Any(count => count > 0) ? "存在" : "不存在";
verification = "存在";
}
}
if (objId == 109)
{
var data = db.CopyNew().Queryable<Obj109>().Where(x => x._System_objNBS == materialCode && x.deleted == false && x.RecordGuid == recordGuid).Count();
if (data > 0)
{
verification = "存在";
}
}
if (objId == 112)
{
var data = db.CopyNew().Queryable<Obj112>().Where(x => x._System_objNBS == materialCode && x.deleted == false && x.RecordGuid == recordGuid).Count();
if (data > 0)
{
verification = "存在";
}
}
if (objId == 133)
{
var data = db.CopyNew().Queryable<Obj133>().Where(x => x._System_objNBS == materialCode && x.deleted == false && x.RecordGuid == recordGuid).Count();
if (data > 0)
{
verification = "存在";
}
}
if (objId == 137)
{
var data = db.CopyNew().Queryable<Obj137>().Where(x => x._System_objNBS == materialCode && x.deleted == false && x.RecordGuid == recordGuid && x._system_objConfigurationName == "默认").Count();
if (data > 0)
{
verification = "存在";
}
}
if (objId == 122)
{
var data = db.CopyNew().Queryable<Obj122>().Where(x => x._System_objNBS == materialCode && x.deleted == false && x.RecordGuid == recordGuid).Count();
if (data > 0)
{
verification = "存在";
}
}
//var tasks = new List<Task<int>>();
//switch (objId)
//{
// case 110:
// tasks.Add(_obj110Rep.AsQueryable().Where(x => x._System_objNBS == materialCode && x.deleted == false && x.RecordGuid == recordGuid).CountAsync());
// break;
// case 109:
// tasks.Add(_obj109Rep.AsQueryable().Where(x => x._System_objNBS == materialCode && x.deleted == false && x.RecordGuid == recordGuid).CountAsync());
// break;
// case 112:
// tasks.Add(_obj112Rep.AsQueryable().Where(x => x._System_objNBS == materialCode && x.deleted == false && x.RecordGuid == recordGuid).CountAsync());
// break;
// case 133:
// tasks.Add(_obj133Rep.AsQueryable().Where(x => x._System_objNBS == materialCode && x.deleted == false && x.RecordGuid == recordGuid).CountAsync());
// break;
// case 122:
// tasks.Add(_obj122Rep.AsQueryable().Where(x => x._System_objNBS == materialCode && x.deleted == false && x.RecordGuid == recordGuid).CountAsync());
// break;
// case 137:
// tasks.Add(_obj137Rep.AsQueryable().Where(x => x._System_objNBS == materialCode && x.deleted == false && x.RecordGuid == recordGuid).CountAsync());
// break;
//}
//if (tasks.Count > 0)
//{
// var result = await Task.WhenAll(tasks);
// verification = result.Any(count => count > 0) ? "存在" : "不存在";
//}
return verification;
}
@ -107,10 +171,13 @@ public class DataValidationService : IDynamicApiController, ITransient
/// <returns></returns>
public async Task<List<EcnItemData>> ChangeModuleMaterial(long idRecord)
{
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var encodingList = new List<EcnItemData>();
// 获取符合条件的检查列表项
var checkList = await _objectTypeCheckListRep.AsQueryable()
var checkList = await db.CopyNew().Queryable<ObjectTypeCheckList>()
.Where(x => x.ParentIdRecord == idRecord && (x.ColumnId == 4638 || x.ColumnId == 6002))
.ToListAsync();
@ -125,33 +192,33 @@ public class DataValidationService : IDynamicApiController, ITransient
switch (objectId)
{
case 110:
data = await _obj110Rep.AsQueryable()
.Where(x => x.RecordGuid == recordGuid && x.deleted == false)
data = await db.CopyNew().Queryable<Obj110>()
.Where(x => x.RecordGuid == recordGuid && x.deleted == false).OrderByDescending(x=>x.idRecord)
.FirstAsync();
break;
case 109:
data = await _obj109Rep.AsQueryable()
.Where(x => x.RecordGuid == recordGuid && x.deleted == false)
data = await db.CopyNew().Queryable<Obj109>()
.Where(x => x.RecordGuid == recordGuid && x.deleted == false).OrderByDescending(x => x.idRecord)
.FirstAsync();
break;
case 112:
data = await _obj112Rep.AsQueryable()
.Where(x => x.RecordGuid == recordGuid && x.deleted == false)
data = await db.CopyNew().Queryable<Obj112>()
.Where(x => x.RecordGuid == recordGuid && x.deleted == false).OrderByDescending(x => x.idRecord)
.FirstAsync();
break;
case 133:
data = await _obj133Rep.AsQueryable()
.Where(x => x.RecordGuid == recordGuid && x.deleted == false)
data = await db.CopyNew().Queryable<Obj133>()
.Where(x => x.RecordGuid == recordGuid && x.deleted == false).OrderByDescending(x => x.idRecord)
.FirstAsync();
break;
case 122:
data = await _obj122Rep.AsQueryable()
.Where(x => x.RecordGuid == recordGuid && x.deleted == false)
data = await db.CopyNew().Queryable<Obj122>()
.Where(x => x.RecordGuid == recordGuid && x.deleted == false).OrderByDescending(x => x.idRecord)
.FirstAsync();
break;
case 137:
data = await _obj137Rep.AsQueryable()
.Where(x => x.RecordGuid == recordGuid && x.deleted == false)
data = await db.CopyNew().Queryable<Obj137>()
.Where(x => x.RecordGuid == recordGuid && x.deleted == false).OrderByDescending(x => x.idRecord)
.FirstAsync();
break;
default:
@ -177,15 +244,17 @@ public class DataValidationService : IDynamicApiController, ITransient
/// <returns></returns>
public async Task<string> GetUnit(long objid, string ChildGuid)
{
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var unit = "";
if (objid == 137)
{
var data = await _obj137Rep.AsQueryable().Where(x => x.RecordGuid == ChildGuid && x.deleted == false).OrderByDescending(x => x.VersionIndex).FirstAsync();
var data = await db.CopyNew().Queryable<Obj137>().Where(x => x.RecordGuid == ChildGuid && x.deleted == false).OrderByDescending(x => x.VersionIndex).FirstAsync();
unit = data._SWPDM_126_SW___;
}
if (objid == 112)
{
var data = await _obj112Rep.AsQueryable().Where(x => x.RecordGuid == ChildGuid && x.deleted == false).OrderByDescending(x => x.VersionIndex).FirstAsync();
var data = await db.CopyNew().Queryable<Obj112>().Where(x => x.RecordGuid == ChildGuid && x.deleted == false).OrderByDescending(x => x.VersionIndex).FirstAsync();
unit = data.fld004594;
}
return unit;
@ -245,11 +314,14 @@ public class DataValidationService : IDynamicApiController, ITransient
/// <returns></returns>
public async Task<int> GetLineNumber(long objId, string recordGuid, int versionIndex, int configId)
{
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
int lineNumber = 0;
if (objId == 118)
{
lineNumber = await _configurationDataRep.AsQueryable().Where(x => x.ParentGuid == recordGuid && x.isDeleted == false && x.ParentVersion == versionIndex && x.ConfigId == configId && x.isSuppressed == false && x.inContext == false).CountAsync();
lineNumber = await db.CopyNew().Queryable<ConfigurationData>().Where(x => x.ParentGuid == recordGuid && x.isDeleted == false && x.ParentVersion == versionIndex && x.ConfigId == configId && x.isSuppressed == false && x.inContext == false).CountAsync();
}
return lineNumber;
@ -281,12 +353,15 @@ public class DataValidationService : IDynamicApiController, ITransient
/// <returns></returns>
public async Task<string> ComparativeVersion(long objId, string recordGuid, int newVersion, int olderVersion)
{
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
string contrastResult = "";
if (objId == 137)
{
var contrastNewData = await _obj137Rep.AsQueryable().Where(x => x.RecordGuid == recordGuid && x.deleted == false && x.VersionIndex == newVersion).FirstAsync();
var contrastOlderData = await _obj137Rep.AsQueryable().Where(x => x.RecordGuid == recordGuid && x.deleted == false && x.VersionIndex == olderVersion).FirstAsync();
var contrastNewData = await db.CopyNew().Queryable<Obj137>().Where(x => x.RecordGuid == recordGuid && x.deleted == false && x.VersionIndex == newVersion).FirstAsync();
var contrastOlderData = await db.CopyNew().Queryable<Obj137>().Where(x => x.RecordGuid == recordGuid && x.deleted == false && x.VersionIndex == olderVersion).FirstAsync();
if (contrastNewData.revision != contrastOlderData.revision)
{
contrastResult = "是";
@ -399,19 +474,6 @@ public class DataValidationService : IDynamicApiController, ITransient
return "修改成功";
}
[AllowAnonymous]
public async Task<string> cscscs1()
{
await Task.Delay(20000);
return "测试1执行时间" + DateTime.Now.ToString("HH:dd:ss");
}
[AllowAnonymous]
public async Task<string> cscscs2()
{
await Task.Delay(20000);
return "测试2执行时间" + DateTime.Now.ToString("HH:dd:ss");
}
/// <summary>
/// SAP wbs状态

View File

@ -9,7 +9,8 @@
{
//"ConfigId": "1300000000001", // -
"DbType": "SqlServer", // MySqlSqlServerSqliteOraclePostgreSQLDmKdbndpOscarMySqlConnectorAccessOpenGaussQuestDBHGClickHouseGBaseOdbcCustom
"ConnectionString": "Data Source=192.168.10.101;Initial Catalog=VistarStarDataManage;User ID=sa;Password=Vistar2024.", // Sqlite 123456
"ConnectionString": "Data Source=192.168.10.101;Initial Catalog=VistarStarDataManage;User ID=sa;Password=Vistar2024.;MultipleActiveResultSets=true",
//"ConnectionString": "Data Source=192.168.10.74;Initial Catalog=VistarStarDataManage;User ID=sa;Password=Aa123456;MultipleActiveResultSets=true", // Sqlite 123456
//"ConnectionString": "PORT=5432;DATABASE=xxx;HOST=localhost;PASSWORD=xxx;USER ID=xxx", // PostgreSQL
//"ConnectionString": "Server=localhost;Database=xxx;Uid=xxx;Pwd=xxx;SslMode=None;", // MySql ",
//"ConnectionString": "User Id=xxx; Password=xxx; Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)))", // Oracle
@ -62,7 +63,8 @@
{
"ConfigId": "启威星 1.94.4.74", //
"DbType": "SqlServer", //
"ConnectionString": "Data Source=192.168.10.101;Initial Catalog=SWManage_Vistar;User ID=sa;Password=Vistar2024.", // ASDzxc123.
"ConnectionString": "Data Source=192.168.10.101;Initial Catalog=SWManage_Vistar;User ID=sa;Password=Vistar2024.;MultipleActiveResultSets=true",
//"ConnectionString": "Data Source=192.168.10.74;Initial Catalog=SWManage_Vistar;User ID=sa;Password=Aa123456;MultipleActiveResultSets=true", // ASDzxc123.
"DbSettings": {
"EnableInitDb": false, //
"EnableDiffLog": false, //

View File

@ -461,5 +461,6 @@ public class Obj119
/// </summary>
[SugarColumn(ColumnName = "fld006416", ColumnDescription = "", Length = -1)]
public string? fld006416 { get; set; }
public string? fld007052 { get; set; }
}

View File

@ -483,5 +483,18 @@ public class Obj140
public string? fld006063_Rec { get; set; }
public long ? fld006064 { get; set; }
public string? fld006064_Rec { get; set; }
public string? fld007040 { get; set; }
/// <summary>
///
/// </summary>
[SugarColumn(ColumnName = "fld007039", ColumnDescription = "")]
public long? fld007039 { get; set; }
/// <summary>
///
/// </summary>
[SugarColumn(ColumnName = "fld007039_Rec", ColumnDescription = "", Length = -1)]
public string? fld007039_Rec { get; set; }
}

View File

@ -0,0 +1,46 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Vistar.Application.Entity;
/// <summary>
/// 定时任务日志表
/// </summary>
[SugarTable(null, "定时任务日志表")]
[SysTable]
[LogTable]
public class ScheduledTaskLog
{
public long Id { get; set; }
/// <summary>
/// 日志时间
/// </summary>
public DateTime LogDateTime { get; set; }
/// <summary>
/// 任务名称
/// </summary>
public string? TaskName { get; set; }
/// <summary>
/// 返回结果
/// </summary>
public string? ReturnResult { get; set; }
/// <summary>
/// 操作用时(毫秒)
/// </summary>
public long Elapsed { get; set; }
}

View File

@ -0,0 +1,56 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Furion.Schedule;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vistar.Application.Entity;
using Vistar.Application.Service.ChangeNoticeEcn;
namespace Vistar.Application.Job.ChangeNoticeEcn;
[JobDetail("job_EcnVarianceList", Description = "生成ECN差异清单", GroupName = "default", Concurrent = false)]
[PeriodMinutes(3, TriggerId = "trigger_EcnVarianceList", Description = "生成ECN差异清单", RunOnStart = false)]
public class EcnVarianceList : IJob
{
private readonly IServiceScopeFactory _scopeFactory;
public ChangeNoticeEcnService _changeNoticeEcn;
public EcnVarianceList(IServiceScopeFactory scopeFactory, ChangeNoticeEcnService changeNoticeEcn)
{
_scopeFactory = scopeFactory;
_changeNoticeEcn = changeNoticeEcn;
}
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
{
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
DateTime startTime = DateTime.Now;
var sapOutputs = await _changeNoticeEcn.EcnVarianceList();
var json = JsonConvert.SerializeObject(sapOutputs);
string output = json;
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
db.CopyNew().Insertable<ScheduledTaskLog>(new
{
TaskName = "生成ECN差异清单",
LogDateTime = DateTime.Now,
ReturnResult = output,
Elapsed = elapsedMilliseconds.ToLong()
}).ExecuteCommand();
}
}

View File

@ -0,0 +1,70 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Furion.Schedule;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vistar.Application.Entity;
using Vistar.Application.Service.ChangeNoticeEcn;
namespace Vistar.Application.Job.ChangeNoticeEcn;
[JobDetail("job_SyncEcnToSap", Description = "Ecn同步到SAP", GroupName = "default", Concurrent = false)]
[PeriodMinutes(5, TriggerId = "trigger_SyncEcnToSap", Description = "Ecn同步到SAP", RunOnStart = false)]
public class SyncEcnToSap : IJob
{
private readonly IServiceScopeFactory _scopeFactory;
public ChangeNoticeEcnService _changeNoticeEcn;
public SyncEcnToSap(IServiceScopeFactory scopeFactory, ChangeNoticeEcnService changeNoticeEcn)
{
_scopeFactory = scopeFactory;
_changeNoticeEcn = changeNoticeEcn;
}
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
{
DateTime startTime = DateTime.Now;
using var serviceScope = _scopeFactory.CreateScope();
var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
var dbMain = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
var sapOutputs = await _changeNoticeEcn.TimingSyncToSAP();
var json = JsonConvert.SerializeObject(sapOutputs);
string output = json;
if (sapOutputs.Count == 0||sapOutputs==null)
{
output = "未查询到符合条件的记录";
}
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
{
TaskName = "Ecn同步到SAP",
LogDateTime = DateTime.Now,
ReturnResult = output,
Elapsed = elapsedMilliseconds.ToLong()
}).ExecuteCommand();
}
}

View File

@ -0,0 +1,59 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Furion.Schedule;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vistar.Application.Entity;
using Vistar.Application.Service.OaOpenInterface;
namespace Vistar.Application.Job.OaOpenInterface;
[JobDetail("job_SyncEcnAttachToOA", Description = "同步ECN文件到OA", GroupName = "default", Concurrent = false)]
[PeriodMinutes(10, TriggerId = "trigger_SyncEcnAttachToOAJob", Description = "同步ECN文件到OA", RunOnStart = false)]
public class SyncEcnAttachToOA : IJob
{
private readonly IServiceScopeFactory _scopeFactory;
public OaOpenInterfaceService _oaOpenInterface;
public SyncEcnAttachToOA(IServiceScopeFactory scopeFactory, OaOpenInterfaceService oaOpenInterface)
{
_scopeFactory = scopeFactory;
_oaOpenInterface = oaOpenInterface;
}
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
{
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
DateTime startTime = DateTime.Now;
var sapOutputs = await _oaOpenInterface.SyncEcnAttach();
var json = JsonConvert.SerializeObject(sapOutputs);
string output = json;
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
if (sapOutputs.Count == 0)
{
output = "未查询到符合条件的记录";
}
db.CopyNew().Insertable<ScheduledTaskLog>(new
{
TaskName = "同步ECN文件到OA",
LogDateTime = DateTime.Now,
ReturnResult = output,
Elapsed = elapsedMilliseconds.ToLong()
}).ExecuteCommand();
}
}

View File

@ -0,0 +1,164 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Furion.Schedule;
using Furion.TimeCrontab;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using OfficeOpenXml.FormulaParsing.Logging;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vistar.Application.Entity;
using Vistar.Application.Service.ProductDesignLibrary;
using Vistar.Application.Util;
namespace Vistar.Application.Job.ProductDesignLibrary;
[JobDetail("job_SyncProductDesignBomToSap", Description = "产品设计库同步bom到SAP", GroupName = "default", Concurrent = false)]
[PeriodMinutes(5, TriggerId = "trigger_SyncProductDesignBomToSapJob", Description = "产品设计库同步bom到SAP", RunOnStart = false)]
public class SyncProductDesignBomToSap : IJob
{
private readonly IServiceScopeFactory _scopeFactory;
public ProductDesignLibraryService _productDesignLibrary;
public SyncProductDesignBomToSap(IServiceScopeFactory scopeFactory, ProductDesignLibraryService productDesignLibrary)
{
_scopeFactory = scopeFactory;
_productDesignLibrary = productDesignLibrary;
}
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
{
DateTime startTime = DateTime.Now;
using var serviceScope = _scopeFactory.CreateScope();
//var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var syncData = await db.CopyNew().Queryable<Obj137>()
.InnerJoin<ConfigurationData>((x, y) => x.RecordGuid == y.ParentGuid && x.VersionIndex == y.ParentVersion)
//.InnerJoin<Obj118>((x, y, z) => x.fld005679_Rec == z.RecordGuid)
.Where((x, y) => x.CheckedStatus == 0 && x.deleted == false && x.IsLatestVersion == true && (x._SWPDM_1202_SW_____ != "不展开" || x._SWPDM_1202_SW_____ == null) && x.fld005530 == "N" && x.fld005529 == "成功" && (x.fld005534 == "A" || x.fld005534 == "M") && x._system_objConfigurationName == "默认" && !x.SWPDMFileName.Contains("SLDDRW") && y.isDeleted == false && y.ConfigId == 8 && (y.fld005577 != "不包含" || y.fld005577 == null) && y.isSuppressed == false && y.inContext == false && !(y.ParentSwFileType == 1 && y.isAddedFromSW == false))
.Select((x, y) => new
{
x.idRecord,
x.VersionIndex,
x._System_objNBS,
x.RecordGuid,
x.fld005679_Rec,
x.fld005686,
x.fld005678,
x._SWPDM_1187_SAP___,
x.fld005680,
y.ParentGuid,
y.ParentVersion,
y.ChildGuid,
y.ChildObjID,
y.childVersion,
y.ConfigId,
y.QtyManual,
y.PartNumber,
y.fld005541,
y.fld005542,
y.fld005543,
y.fld005544,
y.fld004940,
y.fld005546,
y.fld005547,
//ecn = z._System_objNBS
})
.ToListAsync();
var syncList = syncData.GroupBy(record => record.RecordGuid)
.Select(group => new SyncBomData
{
Id = group.FirstOrDefault()?.idRecord,
MaterialCode = group.FirstOrDefault()?._System_objNBS,
RecordGuid = group.FirstOrDefault()?.RecordGuid,
SyncVersion = group.FirstOrDefault()?.fld005686,
Bmeng = group.FirstOrDefault()?.fld005678,
Werks = group.FirstOrDefault()?._SWPDM_1187_SAP___,
Datuv = group.FirstOrDefault()?.fld005680,
VersionIndex = group.FirstOrDefault()?.VersionIndex,
//Ecn = group.FirstOrDefault()?.ecn,
ecnGuid = group.FirstOrDefault()?.fld005679_Rec,
Bom = group.Select(g => new BomData
{
PartNumber = g.PartNumber,
ParentGuid = g.ParentGuid,
ChildGuid = g.ChildGuid,
ChildObjID = g.ChildObjID,
ConfigId = g.ConfigId,
childVersion = g.childVersion,
ParentVersion = g.VersionIndex,
QtyManual = g.QtyManual,
SORTF = g.fld005541,
ITISOB = g.fld005542,
ALPGR = g.fld005543,
ALPRF = g.fld005544,
ZDELETE = g.fld004940,
POSTP = g.fld005546,
ZYFMK = g.fld005547
}).ToList()
});
List<SapOutput> sapOutputs = new List<SapOutput>();
int batchSize = 20; // 每批的大小
int totalCount = syncList.ToList().Count;
for (int i = 0; i < totalCount; i += batchSize)
{
var batch = syncList.Skip(i).Take(batchSize); // 分批获取数据
// 处理当前批次的数据
var tasks = batch.Select(async item =>
{
var output = await _productDesignLibrary.SyncBomToSap(item);
return output;
}).ToList();
var bomStockInquiryOutput = await Task.WhenAll(tasks); // 等待当前批次的所有任务完成
// 合并当前批次的结果
sapOutputs.AddRange(bomStockInquiryOutput);
// 如果需要暂停或者处理频率,可以在此处插入适当的延迟。
// await Task.Delay(1000); // 如果需要等待1秒可以启用此行代码。
}
var json = JsonConvert.SerializeObject(sapOutputs);
//var tasks = syncList.Select(async item =>
//{
// var output = await _productDesignLibrary.SyncBomToSap(item);
// return output;
//});
//var bomStockInquiryOutput = await Task.WhenAll(tasks);
//var json = JsonConvert.SerializeObject(bomStockInquiryOutput.ToList());
var dbMain = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
string output = json;
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
if (totalCount == 0)
{
output = "未查询到符合条件的记录";
}
dbMain.CopyNew().Insertable<ScheduledTaskLog>(new
{
TaskName = "产品设计库同步bom到SAP",
LogDateTime = DateTime.Now,
ReturnResult = output,
Elapsed = elapsedMilliseconds.ToLong()
}).ExecuteCommand();
}
}

View File

@ -0,0 +1,167 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Furion.Schedule;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data.OscarClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vistar.Application.Entity;
using Vistar.Application.SapService.Dto;
using Vistar.Application.Util;
namespace Vistar.Application.Job.ProductDesignLibrary;
[JobDetail("job_SyncProductDesignMaterialToSap", Description = "产品设计库同步物料到SAP", GroupName = "default", Concurrent = false)]
[PeriodMinutes(3, TriggerId = "trigger_SyncProductDesignMaterialToSapJob", Description = "产品设计库同步物料到SAP", RunOnStart = false)]
public class SyncProductDesignMaterialToSap : IJob
{
private readonly IServiceScopeFactory _scopeFactory;
public SapService.SapService _sapService;
private readonly SysConfigService _sysConfigService;
public SyncProductDesignMaterialToSap(IServiceScopeFactory scopeFactory, SapService.SapService sapService, SysConfigService sysConfigService)
{
_scopeFactory = scopeFactory;
_scopeFactory = scopeFactory;
_sysConfigService = sysConfigService;
_sapService = sapService;
}
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
{
DateTime startTime = DateTime.Now;
using var serviceScope = _scopeFactory.CreateScope();
//var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
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"))
.ToList();
const string lengthError = "物料描述长度大于40请检查";
var SapOutputList = new List<SapOutput>();
var Requser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
int batchSize = 20;
int totalCount = input.Count;
for (int i = 0; i < totalCount; i += batchSize)
{
var batch = input.Skip(i).Take(batchSize);
var tasks = batch.Select(async item =>
{
if (item._SWPDM_1188_SAP___ != null && item._SWPDM_1188_SAP___.Length > 40)
{
db.CopyNew().Updateable<Obj137>()
.SetColumns(it => new Obj137
{
fld005532 = DateTime.Now,
fld005530 = "N",
fld005531 = lengthError,
fld005529 = "失败"
})
.Where(it => it.idRecord == item.idRecord)
.ExecuteCommand();
return new SapOutput
{
materialCode = item._System_objNBS,
code = "失败",
msg = lengthError,
result = lengthError
};
}
//获取时间戳精确到毫秒sap要求每次调用生成不重复guid
string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
var sapMaterialInput = new SapMaterialInput()
{
Reqkeyid = "",
Businessid = "",
Messageid = "",
Sndprn = "PLM",
Rcvprn = "SAP",
Requser = Requser,
Note1 = "",
Note2 = "",
Note3 = "",
Zwbid = millisecondTimestamp,
Matnr = item._System_objNBS,
Mbrsh = item._SWPDM_1185_SAP___,
Mtart = item._SWPDM_1186_SAP_____,
Maktx = item._SWPDM_1188_SAP___,
Meins = item._SWPDM_126_SW___,
Matkl = item._SWPDM_1203_SAP____,
Bismt = item._SWPDM_64_SW___,
Groes = item._SWPDM_125_SW___,
Normt = item._SWPDM_65_SW___,
Ferth = item._SWPDM_62_SW___,
Zeinr = item._SWPDM_61_SW_____,
Mstae = item._SWPDM_1209_SAP_____,
Raube = "",
Mhdrz = "",
Mhdhb = "",
Werks = item._SWPDM_1187_SAP___,
Beskz = item._SWPDM_1196_SAP_____,
Sobsl = item._SWPDM_1198_SAP_____,
Schgt = item._SWPDM_1197_SAP_____,
Rgekz = item._SWPDM_1199_SAP___,
Zbom = item._SWPDM_1208_SAP___BOM___
};
var sapOutput = await _sapService.SapMaterialApi(sapMaterialInput);
string codeVal = sapOutput.code == "S" ? "成功" : "失败";
string msg = sapOutput.msg;
if (sapOutput.msg == "")
{
msg = "同步成功";
}
db.CopyNew().Updateable<Obj137>()
.SetColumns(it => new Obj137
{
fld005532 = DateTime.Now,
fld005529 = codeVal,
fld005530 = "N",
fld005531 = msg
})
.Where(it => it.idRecord == item.idRecord)
.ExecuteCommand();
return new SapOutput()
{
parameter = sapOutput.parameter,
materialCode = item._System_objNBS,
code = codeVal,
msg = msg,
result = sapOutput.result
};
}).ToList();
var MateriaStockInquiryOutput = await Task.WhenAll(tasks);
SapOutputList.AddRange(MateriaStockInquiryOutput);
}
var json = JsonConvert.SerializeObject(SapOutputList);
var dbMain = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
string output = json;
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
if (totalCount == 0)
{
output = "未查询到符合条件的记录";
}
dbMain.CopyNew().Insertable<ScheduledTaskLog>(new
{
TaskName = "产品设计库同步物料到SAP",
LogDateTime = DateTime.Now,
ReturnResult = output,
Elapsed = elapsedMilliseconds.ToLong()
}).ExecuteCommand();
}
}

View File

@ -0,0 +1,125 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Furion.Schedule;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vistar.Application.Entity;
using Vistar.Application.Service.ProductDesignLibrary;
using Vistar.Application.Util;
namespace Vistar.Application.Job.ProductDesignLibrary;
[JobDetail("job_SyncProductDesignProcessRouteToSap", Description = "产品设计库同步工艺路线到SAP", GroupName = "default", Concurrent = false)]
[PeriodMinutes(5, TriggerId = "trigger_SyncProductDesignProcessRouteToSapJob", Description = "产品设计库同步工艺路线到SAP", RunOnStart = false)]
public class SyncProductDesignProcessRouteToSap : IJob
{
private readonly IServiceScopeFactory _scopeFactory;
public ProductDesignLibraryService _productDesignLibrary;
public SyncProductDesignProcessRouteToSap(IServiceScopeFactory scopeFactory, ProductDesignLibraryService productDesignLibrary)
{
_scopeFactory = scopeFactory;
_productDesignLibrary = productDesignLibrary;
}
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
{
DateTime startTime = DateTime.Now;
using var serviceScope = _scopeFactory.CreateScope();
//var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var syncPbom = db.CopyNew().Queryable<Obj137>()
.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)
.Select((x, y) => new
{
x.idRecord,
x.VersionIndex,
x.RecordGuid,
x._System_objNBS,
x._SWPDM_1187_SAP___,
x.fld005680,
y.ParentGuid,
y.ChildGuid,
y.ChildObjID,
y.PartNumber,
y.Marker,
y.fld005571,
y.fld005572,
y.fld005573,
y.fld005575,
}).ToList();
var syncList = syncPbom.GroupBy(record => record.RecordGuid)
.Select(group => new SyncProcessRouteData
{
idRecord = group.FirstOrDefault()?.idRecord,
_System_objNBS = group.FirstOrDefault()?._System_objNBS,
VersionIndex = group.FirstOrDefault()?.VersionIndex,
Werks= group.FirstOrDefault()?._SWPDM_1187_SAP___,
Datuv = group.FirstOrDefault()?.fld005680,
ProcessRouteList = group.Select(g => new ProcessRouteList
{
ParentGuid = g.ParentGuid,
ChildGuid = g.ChildGuid,
ChildObjID = g.ChildObjID,
PartNumber = g.PartNumber,
VORNR = g.Marker,
VGW01 = g.fld005571,
VGE01 = g.fld005572,
STEUS = g.fld005573,
BMSCH = g.fld005575
}).ToList()
});
List<SapOutput> sapOutputs = new List<SapOutput>();
int batchSize = 20; // 每批的大小
int totalCount = syncList.ToList().Count;
for (int i = 0; i < totalCount; i += batchSize)
{
var batch = syncList.Skip(i).Take(batchSize); // 分批获取数据
// 处理当前批次的数据
var tasks = batch.Select(async item =>
{
var output = await _productDesignLibrary.SyncProcessRouteToSap(item);
return output;
}).ToList();
var processRouteStockInquiryOutput = await Task.WhenAll(tasks); // 等待当前批次的所有任务完成
// 合并当前批次的结果
sapOutputs.AddRange(processRouteStockInquiryOutput);
}
var json = JsonConvert.SerializeObject(sapOutputs);
var dbMain = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
string output = json;
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
if (totalCount == 0)
{
output = "未查询到符合条件的记录";
}
dbMain.CopyNew().Insertable<ScheduledTaskLog>(new
{
TaskName = "产品设计库同步工艺路线到SAP",
LogDateTime = DateTime.Now,
ReturnResult = output,
Elapsed = elapsedMilliseconds.ToLong()
}).ExecuteCommand();
}
}

View File

@ -0,0 +1,156 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Furion.Schedule;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vistar.Application.Entity;
using Vistar.Application.Service.MaterialManagement;
using Vistar.Application.Util;
namespace Vistar.Application.Job.ProductManagement;
[JobDetail("job_SyncProductManagementBomToSap", Description = "产品管理同步bom到SAP", GroupName = "default", Concurrent = false)]
[PeriodMinutes(5, TriggerId = "trigger_SyncProductManagementBomToSapJob", Description = "产品管理同步bom到SAP", RunOnStart = false)]
public class SyncProductManagementBomToSap : IJob
{
private readonly IServiceScopeFactory _scopeFactory;
public ProductManagementService _productManagement;
public SyncProductManagementBomToSap(IServiceScopeFactory scopeFactory, ProductManagementService productManagement)
{
_scopeFactory = scopeFactory;
_productManagement = productManagement;
}
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
{
DateTime startTime = DateTime.Now;
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var syncData = db.CopyNew().Queryable<Obj110>()
.InnerJoin<ConfigurationData>((x, y) => x.RecordGuid == y.ParentGuid && x.VersionIndex == y.ParentVersion)
.Where((x, y) => (x.CheckedStatus == 0 || x.CheckedStatus == 1) && x.fld005324 == "发布" && x.deleted == false && x.IsLatestVersion == true && x.fld004311 == "成功" && x.fld004312 == "N" && (x.fld004316 == "A" || x.fld004316 == "M") && y.ConfigId == 1 && y.isDeleted == false && (y.fld005586 != "不包含" || y.fld005586 == null))
.Select((x, y) => new {
x.idRecord,
x.VersionIndex,
x._System_objNBS,
x.RecordGuid,
x.fld004944_Rec,
x.fld005288,
x.fld004942,
x.fld004325,
x.fld004945,
y.ParentGuid,
y.ParentVersion,
y.ChildGuid,
y.ChildObjID,
y.childVersion,
y.ConfigId,
y.Quantity,
y.PartNumber,
y.fld004936,
y.fld004937,
y.fld004938,
y.fld004939,
y.fld004940,
y.fld004492,
y.fld004941
}).ToList();
var syncList = syncData.GroupBy(record => record.RecordGuid)
.Select(group => new SyncBomData
{
Id = group.FirstOrDefault()?.idRecord,
MaterialCode = group.FirstOrDefault()?._System_objNBS,
RecordGuid = group.FirstOrDefault()?.RecordGuid,
SyncVersion = group.FirstOrDefault()?.fld005288,
Bmeng = group.FirstOrDefault()?.fld004942 != null ? (int?)(float)group.FirstOrDefault()?.fld004942 : null,
Werks = group.FirstOrDefault()?.fld004325,
Datuv = group.FirstOrDefault()?.fld004945,
VersionIndex = group.FirstOrDefault()?.VersionIndex,
//Ecn = group.FirstOrDefault()?.ecn,
ecnGuid = group.FirstOrDefault()?.fld004944_Rec,
Bom = group.Select(g => new BomData
{
PartNumber = g.PartNumber,
ParentGuid = g.ParentGuid,
ChildGuid = g.ChildGuid,
ChildObjID = g.ChildObjID,
ConfigId = g.ConfigId,
childVersion = g.childVersion,
ParentVersion = g.VersionIndex,
Quantity = g.Quantity,
SORTF = g.fld004936,
ITISOB = g.fld004937,
ALPGR = g.fld004938,
ALPRF = g.fld004939,
ZDELETE = g.fld004940,
POSTP = g.fld004492,
ZYFMK = g.fld004941
}).ToList()
});
List<SapOutput> sapOutputs = new List<SapOutput>();
int batchSize = 20; // 每批的大小
int totalCount = syncList.ToList().Count;
for (int i = 0; i < totalCount; i += batchSize)
{
var batch = syncList.Skip(i).Take(batchSize); // 分批获取数据
// 处理当前批次的数据
var tasks = batch.Select(async item =>
{
var output = await _productManagement.SyncBomToSap(item);
return output;
}).ToList();
var bomStockInquiryOutput = await Task.WhenAll(tasks); // 等待当前批次的所有任务完成
// 合并当前批次的结果
sapOutputs.AddRange(bomStockInquiryOutput);
// 如果需要暂停或者处理频率,可以在此处插入适当的延迟。
// await Task.Delay(1000); // 如果需要等待1秒可以启用此行代码。
}
var json = JsonConvert.SerializeObject(sapOutputs);
//var tasks = syncList.Select(async item =>
//{
// var output = await _productDesignLibrary.SyncBomToSap(item);
// return output;
//});
//var bomStockInquiryOutput = await Task.WhenAll(tasks);
//var json = JsonConvert.SerializeObject(bomStockInquiryOutput.ToList());
var dbMain = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
string output = json;
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
if (totalCount == 0)
{
output = "未查询到符合条件的记录";
}
dbMain.CopyNew().Insertable<ScheduledTaskLog>(new
{
TaskName = "产品管理同步bom到SAP",
LogDateTime = DateTime.Now,
ReturnResult = output,
Elapsed = elapsedMilliseconds.ToLong()
}).ExecuteCommand();
}
}

View File

@ -0,0 +1,166 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Furion.Schedule;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vistar.Application.Entity;
using Vistar.Application.SapService.Dto;
using Vistar.Application.Util;
namespace Vistar.Application.Job.ProductManagement;
[JobDetail("job_SyncProductManagementMaterialToSap", Description = "产品管理同步物料到SAP", GroupName = "default", Concurrent = false)]
[PeriodMinutes(3, TriggerId = "trigger_SyncProductManagementMaterialToSapJob", Description = "产品管理同步物料到SAP", RunOnStart = false)]
public class SyncProductManagementMaterialToSap : IJob
{
private readonly IServiceScopeFactory _scopeFactory;
public SapService.SapService _sapService;
private readonly SysConfigService _sysConfigService;
public SyncProductManagementMaterialToSap(IServiceScopeFactory scopeFactory, SapService.SapService sapService, SysConfigService sysConfigService)
{
_scopeFactory = scopeFactory;
_sysConfigService = sysConfigService;
_sapService = sapService;
}
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
{
DateTime startTime = DateTime.Now;
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var input = db.CopyNew().Queryable<Obj110>()
.Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1) && x.fld005324 == "发布" && x.deleted == false && x.IsLatestVersion == true && (x.fld004312 == "A" || x.fld004312 == "M"))
.ToList();
var SapOutputList = new List<SapOutput>();
var Requser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
const string lengthError = "物料描述长度大于40请检查";
int batchSize = 20; // 每批的大小
int totalCount = input.Count;
for (int i = 0; i < totalCount; i += batchSize)
{
var batch = input.Skip(i).Take(batchSize); // 分批获取数据
var tasks = batch.Select(async item =>
{
if (item.fld004484.Length > 40)
{
db.CopyNew().Updateable<Obj110>()
.SetColumns(it => new Obj110
{
fld004629 = DateTime.Now,
fld004312 = "N",
fld004313 = lengthError,
fld004311 = "失败"
})
.Where(it => it.idRecord == item.idRecord)
.ExecuteCommand();
return new SapOutput
{
materialCode = item._System_objNBS,
code = "失败",
msg = lengthError,
result = lengthError
};
}
//获取时间戳精确到毫秒sap要求每次调用生成不重复guid
string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
var sapMaterialInput = new SapMaterialInput()
{
Reqkeyid = "",
Businessid = "",
Messageid = "",
Sndprn = "PLM",
Rcvprn = "SAP",
Requser = Requser,
Note1 = "",
Note2 = "",
Note3 = "",
Zwbid = millisecondTimestamp,
Matnr = item._System_objNBS,
Mbrsh = item.fld004323,
Mtart = item.fld004324,
Maktx = item.fld004484,
Meins = item.fld004861,
Matkl = item.fld004485,
Bismt = item._System_ObjDescription,
Groes = item._System_objNBS,
Normt = item.fld004887,
Ferth = item.fld004882,
Zeinr = item.fld004881,
Mstae = item.fld004699,
Raube = item.fld004877,
Mhdrz = item.fld004876.ToString(),
Mhdhb = item.fld004895.ToString(),
Werks = item.fld004325,
Beskz = item.fld004490,
Sobsl = item.fld004491,
Schgt = item.fld004873,
Rgekz = item.fld004872,
Zbom = item.fld004698
};
var sapOutput = await _sapService.SapMaterialApi(sapMaterialInput);
string codeVal = sapOutput.code == "S" ? "成功" : "失败";
string msg = sapOutput.msg;
if (sapOutput.msg == "")
{
msg = "同步成功";
}
db.CopyNew().Updateable<Obj110>()
.SetColumns(it => new Obj110
{
fld004629 = DateTime.Now,
fld004311 = codeVal,
fld004312 = "N",
fld004313 = msg
})
.Where(it => it.idRecord == item.idRecord)
.ExecuteCommand();
return new SapOutput
{
parameter = sapOutput.parameter,
materialCode = item._System_objNBS,
code = codeVal,
msg = msg,
result = sapOutput.result
};
}).ToList();
var MateriaStockInquiryOutput = await Task.WhenAll(tasks);
SapOutputList.AddRange(MateriaStockInquiryOutput);
}
var json = JsonConvert.SerializeObject(SapOutputList);
var dbMain = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
string output = json;
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
if (totalCount == 0)
{
output = "未查询到符合条件的记录";
}
dbMain.CopyNew().Insertable<ScheduledTaskLog>(new
{
TaskName = "产品管理同步物料到SAP",
LogDateTime = DateTime.Now,
ReturnResult = output,
Elapsed = elapsedMilliseconds.ToLong()
}).ExecuteCommand();
}
}

View File

@ -0,0 +1,124 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Furion.Schedule;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vistar.Application.Entity;
using Vistar.Application.Service.MaterialManagement;
using Vistar.Application.Util;
namespace Vistar.Application.Job.ProductManagement;
[JobDetail("job_SyncProductManagementProcessRouteToSap", Description = "产品管理同步工艺路线到SAP", GroupName = "default", Concurrent = false)]
[PeriodMinutes(5, TriggerId = "trigger_SyncProductManagementProcessRouteToSapJob", Description = "产品管理同步工艺路线到SAP", RunOnStart = false)]
public class SyncProductManagementProcessRouteToSap : IJob
{
private readonly IServiceScopeFactory _scopeFactory;
public ProductManagementService _productManagement;
public SyncProductManagementProcessRouteToSap(IServiceScopeFactory scopeFactory, ProductManagementService productManagement)
{
_scopeFactory = scopeFactory;
_productManagement = productManagement;
}
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
{
DateTime startTime = DateTime.Now;
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var syncPbom = db.CopyNew().Queryable<Obj110>()
.InnerJoin<ConfigurationData>((x, y) => x.RecordGuid == y.ParentGuid && x.VersionIndex == y.ParentVersion)
.Where((x, y) => (x.CheckedStatus == 0 || x.CheckedStatus == 1) && x.fld005324 == "发布" && x.deleted == false && x.IsLatestVersion == true && x.fld004311 == "成功" && x.fld004312 == "N" && (x.fld004320 == "A" || x.fld004320 == "M") && y.ConfigId == 4 && y.isDeleted == false)
.Select((x, y) => new
{
x.idRecord,
x.VersionIndex,
x.RecordGuid,
x._System_objNBS,
x.fld004325,//工厂
x.fld004945,//有效日期
y.ParentGuid,
y.ChildGuid,
y.ChildObjID,
y.PartNumber,
y.Marker,
y.fld004994,
y.fld004995,
y.fld004996,
y.fld005296,
}).ToList();
var syncList = syncPbom.GroupBy(record => record.RecordGuid)
.Select(group => new SyncProcessRouteData
{
idRecord = group.FirstOrDefault()?.idRecord,
_System_objNBS = group.FirstOrDefault()?._System_objNBS,
VersionIndex = group.FirstOrDefault()?.VersionIndex,
Werks= group.FirstOrDefault()?.fld004325,
Datuv = group.FirstOrDefault()?.fld004945,
ProcessRouteList = group.Select(g => new ProcessRouteList
{
ParentGuid = g.ParentGuid,
ChildGuid = g.ChildGuid,
ChildObjID = g.ChildObjID,
PartNumber = g.PartNumber,
VORNR = g.Marker,
VGW01 = g.fld004994 !=null ?g.fld004994.ToString():"",
VGE01 = g.fld004995,
STEUS = g.fld004996,
BMSCH = g.fld005296 != null ? g.fld005296.ToString() : ""
}).ToList()
});
List<SapOutput> sapOutputs = new List<SapOutput>();
int batchSize = 20; // 每批的大小
int totalCount = syncList.ToList().Count;
for (int i = 0; i < totalCount; i += batchSize)
{
var batch = syncList.Skip(i).Take(batchSize); // 分批获取数据
// 处理当前批次的数据
var tasks = batch.Select(async item =>
{
var output = await _productManagement.SyncProcessRouteToSap(item);
return output;
}).ToList();
var processRouteStockInquiryOutput = await Task.WhenAll(tasks); // 等待当前批次的所有任务完成
// 合并当前批次的结果
sapOutputs.AddRange(processRouteStockInquiryOutput);
}
var json = JsonConvert.SerializeObject(sapOutputs);
var dbMain = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
string output = json;
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
if (totalCount == 0)
{
output = "未查询到符合条件的记录";
}
dbMain.CopyNew().Insertable<ScheduledTaskLog>(new
{
TaskName = "产品管理同步工艺路线到SAP",
LogDateTime = DateTime.Now,
ReturnResult = output,
Elapsed = elapsedMilliseconds.ToLong()
}).ExecuteCommand();
}
}

View File

@ -0,0 +1,171 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using Admin.NET.Core.Service;
using DocumentFormat.OpenXml.Drawing;
using Furion.Schedule;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data.OscarClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vistar.Application.Entity;
using Vistar.Application.SapService.Dto;
using Vistar.Application.Util;
namespace Vistar.Application.Job.ProductionMaterials;
[JobDetail("job_SyncProductionMaterialsToSap", Description = "生产物料同步到SAP", GroupName = "default", Concurrent = false)]
[PeriodMinutes(5, TriggerId = "trigger_SyncProductionMaterialsToSapJob", Description = "生产物料同步到SAP", RunOnStart = false)]
public class SyncProductionMaterialsToSap : IJob
{
private readonly IServiceScopeFactory _scopeFactory;
public SapService.SapService _sapService;
private readonly SysConfigService _sysConfigService;
public SyncProductionMaterialsToSap(IServiceScopeFactory scopeFactory, SapService.SapService sapService, SysConfigService sysConfigService)
{
_scopeFactory = scopeFactory;
_sysConfigService = sysConfigService;
_sapService=sapService;
}
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
{
DateTime startTime = DateTime.Now;
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var input = db.CopyNew().Queryable<Obj112>()
.Where(x => (x.CheckedStatus == 7 || x.CheckedStatus == 8) && x.deleted == false && x.IsLatestVersion == true && (x.fld004607 == "A" || x.fld004607 == "M") && x.fld004973 == "发布")
.ToList();
const string lengthError = "物料描述长度大于40请检查";
var SapOutputList = new List<SapOutput>();
var Requser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
int batchSize = 20; // 每批的大小
int totalCount = input.Count;
for (int i = 0; i < totalCount; i += batchSize)
{
var batch = input.Skip(i).Take(batchSize); // 分批获取数据
var tasks = batch.Select(async item =>
{
if (item.fld004598.Length > 40)
{
db.CopyNew().Updateable<Obj112>()
.SetColumns(it => new Obj112
{
fld004606 = DateTime.Now,
fld004607 = "N",
fld004605 = lengthError,
fld004604 = "失败"
})
.Where(it => it.idRecord == item.idRecord)
.ExecuteCommand();
return new SapOutput
{
materialCode = item._System_objNBS,
code = "失败",
msg = lengthError,
result = lengthError
};
}
//获取时间戳精确到毫秒sap要求每次调用生成不重复guid
string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
var sapMaterialInput = new SapMaterialInput()
{
Reqkeyid = "",
Businessid = "",
Messageid = "",
Sndprn = "PLM",
Rcvprn = "SAP",
Requser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName),
Note1 = "",
Note2 = "",
Note3 = "",
Zwbid = millisecondTimestamp,
Matnr = item._System_objNBS,
Mbrsh = item.fld004595,
Mtart = item.fld004596,
Maktx = item.fld004598,
Meins = item.fld004594,
Matkl = item.fld004599,
Bismt = item._System_ObjDescription,
Groes = item.fld005323,
Normt = item.fld004592,
Ferth = item.fld004593,
Zeinr = item.fld004903,
Mstae = item.fld004696,
Raube = item.fld004904,
Mhdrz = item.fld004905.ToString(),
Mhdhb = item.fld004907.ToString(),
Werks = item.fld004597,
Beskz = item.fld004600,
Sobsl = item.fld004601,
Schgt = item.fld004602,
Rgekz = item.fld004603,
Zbom = item.fld004695
};
var sapOutput = await _sapService.SapMaterialApi(sapMaterialInput);
string codeVal = sapOutput.code == "S" ? "成功" : "失败";
string msg = sapOutput.msg;
if (sapOutput.msg == "")
{
msg = "同步成功";
}
db.CopyNew().Updateable<Obj112>()
.SetColumns(it => new Obj112
{
fld004606 = DateTime.Now,
fld004604 = codeVal,
fld004607 = "N",
fld004605 = msg
})
.Where(it => it.idRecord == item.idRecord)
.ExecuteCommand();
return new SapOutput()
{
parameter = sapOutput.parameter,
materialCode = item._System_objNBS,
code = codeVal,
msg = msg,
result = sapOutput.result
};
}).ToList();
var MateriaStockInquiryOutput = await Task.WhenAll(tasks);
SapOutputList.AddRange(MateriaStockInquiryOutput);
}
var json = JsonConvert.SerializeObject(SapOutputList);
var dbMain = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
string output = json;
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
if (totalCount == 0)
{
output = "未查询到符合条件的记录";
}
dbMain.CopyNew().Insertable<ScheduledTaskLog>(new
{
TaskName = "生产物料同步到SAP",
LogDateTime = DateTime.Now,
ReturnResult = output,
Elapsed = elapsedMilliseconds.ToLong()
}).ExecuteCommand();
}
}

View File

@ -0,0 +1,58 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using Admin.NET.Core.Service;
using DocumentFormat.OpenXml.Drawing;
using Furion.Schedule;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vistar.Application.Entity;
using Vistar.Application.Service.ProjectManagement;
namespace Vistar.Application.Job.ProjectManagement;
[JobDetail("job_SyncCreateWbsToSap", Description = "创建Wbs到SAP", GroupName = "default", Concurrent = false)]
[PeriodMinutes(30, TriggerId = "trigger_SyncCreateWbsToSapJob", Description = "创建Wbs到SAP", RunOnStart = false)]
public class SyncCreateWbsToSap : IJob
{
private readonly IServiceScopeFactory _scopeFactory;
public ProjectManagementService _projectManagement;
public SyncCreateWbsToSap(IServiceScopeFactory scopeFactory, ProjectManagementService projectManagement)
{
_scopeFactory = scopeFactory;
_projectManagement = projectManagement;
}
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
{
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
DateTime startTime = DateTime.Now;
var sapOutputs = await _projectManagement.WbsInSapCreate();
var json = JsonConvert.SerializeObject(sapOutputs);
string output = json;
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
if (sapOutputs.Count==0)
{
output= "未查询到符合条件的记录";
}
db.CopyNew().Insertable<ScheduledTaskLog>(new
{
TaskName = "创建Wbs到SAP",
LogDateTime = DateTime.Now,
ReturnResult = output,
Elapsed = elapsedMilliseconds.ToLong()
}).ExecuteCommand();
}
}

View File

@ -0,0 +1,66 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Furion.Schedule;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vistar.Application.Entity;
using Vistar.Application.Service.ProjectManagement;
using Vistar.Application.Util;
namespace Vistar.Application.Job.ProjectManagement;
[JobDetail("job_SyncProjectManagementBomToSap", Description = "项目管理同步Bom到SAP", GroupName = "default", Concurrent = false)]
[PeriodMinutes(5, TriggerId = "trigger_SyncProjectManagementBomToSap", Description = "项目管理同步Bom到SAP", RunOnStart = false)]
public class SyncProjectManagementBomToSap : IJob
{
private readonly IServiceScopeFactory _scopeFactory;
public ProjectManagementService _projectManagement;
public SyncProjectManagementBomToSap(IServiceScopeFactory scopeFactory, ProjectManagementService projectManagement)
{
_scopeFactory = scopeFactory;
_projectManagement = projectManagement;
}
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
{
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
DateTime startTime = DateTime.Now;
var sapOutputs = await _projectManagement.TimingSyncToSAPBom();
var json = JsonConvert.SerializeObject(sapOutputs);
string output = json;
if (sapOutputs.Count == 0 || sapOutputs == null)
{
output = "未查询到符合条件的记录";
}
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
db.CopyNew().Insertable<ScheduledTaskLog>(new
{
TaskName = "项目管理同步Bom到SAP",
LogDateTime = DateTime.Now,
ReturnResult = output,
Elapsed = elapsedMilliseconds.ToLong()
}).ExecuteCommand();
}
}

View File

@ -0,0 +1,60 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Furion.Schedule;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vistar.Application.Entity;
using Vistar.Application.Service.ProjectManagement;
namespace Vistar.Application.Job.ProjectManagement;
[JobDetail("job_SyncProjectManagementMaterialToSap", Description = "项目管理同步物料到SAP", GroupName = "default", Concurrent = false)]
[PeriodMinutes(3, TriggerId = "trigger_SyncProjectManagementMaterialToSap", Description = "项目管理同步物料到SAP", RunOnStart = false)]
public class SyncProjectManagementMaterialToSap : IJob
{
private readonly IServiceScopeFactory _scopeFactory;
public ProjectManagementService _projectManagement;
public SyncProjectManagementMaterialToSap(IServiceScopeFactory scopeFactory, ProjectManagementService projectManagement)
{
_scopeFactory = scopeFactory;
_projectManagement = projectManagement;
}
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
{
using var serviceScope = _scopeFactory.CreateScope();
var dbMain = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
DateTime startTime = DateTime.Now;
var sapOutputs = await _projectManagement.TimingSyncToSAP();
var json = JsonConvert.SerializeObject(sapOutputs);
string output = json;
if (sapOutputs.Count == 0)
{
output = "未查询到符合条件的记录";
}
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
dbMain.CopyNew().Insertable<ScheduledTaskLog>(new
{
TaskName = "项目管理同步物料到SAP",
LogDateTime = DateTime.Now,
ReturnResult = output,
Elapsed = elapsedMilliseconds.ToLong()
}).ExecuteCommand();
}
}

View File

@ -0,0 +1,63 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Furion.Schedule;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vistar.Application.Entity;
using Vistar.Application.Service.ProjectManagement;
namespace Vistar.Application.Job.ProjectManagement;
[JobDetail("job_SyncProjectManagementProcessRouteToSap", Description = "项目管理同步工艺路线到SAP", GroupName = "default", Concurrent = false)]
[PeriodMinutes(5, TriggerId = "trigger_SyncProjectManagementProcessRouteToSap", Description = "项目管理同步工艺路线到SAP", RunOnStart = false)]
public class SyncProjectManagementProcessRouteToSap : IJob
{
private readonly IServiceScopeFactory _scopeFactory;
public ProjectManagementService _projectManagement;
public SyncProjectManagementProcessRouteToSap(IServiceScopeFactory scopeFactory, ProjectManagementService projectManagement)
{
_scopeFactory = scopeFactory;
_projectManagement = projectManagement;
}
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
{
DateTime startTime = DateTime.Now;
using var serviceScope = _scopeFactory.CreateScope();
var dbMain = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
var sapOutputs = await _projectManagement.TimingSyncToSAPProcessRoute();
var json = JsonConvert.SerializeObject(sapOutputs);
string output = json;
if (sapOutputs.Count == 0 || sapOutputs == null)
{
output = "未查询到符合条件的记录";
}
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
dbMain.CopyNew().Insertable<ScheduledTaskLog>(new
{
TaskName = "项目管理同步工艺路线到SAP",
LogDateTime = DateTime.Now,
ReturnResult = output,
Elapsed = elapsedMilliseconds.ToLong()
}).ExecuteCommand();
}
}

View File

@ -0,0 +1,59 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Furion.Schedule;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vistar.Application.Entity;
using Vistar.Application.Service.ProjectManagement;
namespace Vistar.Application.Job.ProjectManagement;
[JobDetail("job_SyncUpdateWbsToSap", Description = "更新Wbs到SAP", GroupName = "default", Concurrent = false)]
[PeriodMinutes(30, TriggerId = "trigger_SyncUpdateWbsJob", Description = "更新Wbs到SAP", RunOnStart = false)]
public class SyncUpdateWbsToSap : IJob
{
private readonly IServiceScopeFactory _scopeFactory;
public ProjectManagementService _projectManagement;
public SyncUpdateWbsToSap(IServiceScopeFactory scopeFactory, ProjectManagementService projectManagement)
{
_scopeFactory = scopeFactory;
_projectManagement = projectManagement;
}
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
{
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
DateTime startTime = DateTime.Now;
var sapOutputs = await _projectManagement.WbsInSapUpdate();
var json = JsonConvert.SerializeObject(sapOutputs);
string output = json;
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
if (sapOutputs.Count == 0)
{
output = "未查询到符合条件的记录";
}
db.CopyNew().Insertable<ScheduledTaskLog>(new
{
TaskName = "更新Wbs到SAP",
LogDateTime = DateTime.Now,
ReturnResult = output,
Elapsed = elapsedMilliseconds.ToLong()
}).ExecuteCommand();
}
}

View File

@ -0,0 +1,57 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core.Service;
using Furion.Schedule;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vistar.Application.Entity;
using Vistar.Application.Service.PurchasingRequisition;
namespace Vistar.Application.Job.PurchasingRequisition;
[JobDetail("job_PurchasingRequisitionToSap", Description = "采购申请同步到SAP", GroupName = "default", Concurrent = false)]
[PeriodMinutes(30, TriggerId = "trigger_PurchasingRequisitionToSap", Description = "采购申请同步到SAP", RunOnStart = false)]
public class PurchasingRequisitionToSap : IJob
{
private readonly IServiceScopeFactory _scopeFactory;
public PurchasingRequisitionService _purchasingRequisition;
public PurchasingRequisitionToSap(IServiceScopeFactory scopeFactory, PurchasingRequisitionService purchasingRequisition)
{
_scopeFactory = scopeFactory;
_purchasingRequisition = purchasingRequisition;
}
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
{
DateTime startTime = DateTime.Now;
var sapOutputs = await _purchasingRequisition.TimingSyncToSAPPurchasingRequisition();
var json = JsonConvert.SerializeObject(sapOutputs);
using var serviceScope = _scopeFactory.CreateScope();
var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
var dbMain = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
string output = json;
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
if (sapOutputs.Count == 0)
{
output = "未查询到符合条件的记录";
}
dbMain.Insertable<ScheduledTaskLog>(new
{
TaskName = "采购申请同步到SAP",
LogDateTime = DateTime.Now,
ReturnResult = output,
Elapsed = elapsedMilliseconds.ToLong()
}).ExecuteCommand();
}
}

View File

@ -0,0 +1,50 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Furion.Schedule;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vistar.Application.Entity;
namespace Vistar.Application.Job.SolidWorksManage;
[JobDetail("job_RefreshManageToKen", Description = "刷新ManageToKen", GroupName = "default", Concurrent = false)]
[PeriodHours(6, TriggerId = "trigger_RefreshManageToKen", Description = "刷新ManageToKen", RunOnStart = false)]
public class RefreshManageToKen : IJob
{
private readonly IServiceScopeFactory _scopeFactory;
public SolidWorksManageService.SolidWorksManageService _solidWorksManage;
public RefreshManageToKen(IServiceScopeFactory scopeFactory, SolidWorksManageService.SolidWorksManageService solidWorksManage)
{
_scopeFactory = scopeFactory;
_solidWorksManage = solidWorksManage;
}
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
{
DateTime startTime = DateTime.Now;
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("1300000000001").CopyNew();
var outputs = await _solidWorksManage.Authenticate();
var json = JsonConvert.SerializeObject(outputs);
string output = json;
var elapsedMilliseconds = (DateTime.Now - startTime).TotalMilliseconds;
db.CopyNew().Insertable<ScheduledTaskLog>(new
{
TaskName = "刷新ManageToKen",
LogDateTime = DateTime.Now,
ReturnResult = output,
Elapsed = elapsedMilliseconds.ToLong()
}).ExecuteCommand();
}
}

View File

@ -184,4 +184,9 @@ public class SapPurchasingRequisitionItem
/// </summary>
public string Loekz { get; set; }
/// <summary>
/// 项目描述
/// </summary>
public string Ztext { get; set; }
}

View File

@ -32,6 +32,7 @@ public class SapService : IDynamicApiController, ITransient
{
_sysConfigService = sysConfigService;
}
/// <summary>
/// SAP同步物料
/// </summary>
@ -111,7 +112,12 @@ public class SapService : IDynamicApiController, ITransient
content.Headers.ContentType = new MediaTypeHeaderValue("text/xml");
httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh");
// 设置 SAP Web 服务的 URL
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zmmfm012/100/zmmfm012/zmmfm012";
//sap正式地址
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zmmfm012/800/zmmfm012/zmmfm012";//正式sap地址
//sap测试地址
//var url = "https://vhjqeds4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zmmfm012/130/zmmfm012/zmmfm012";//测试sap地址
// 发起 POST 请求到 SAP Web 服务
var response = await httpClient.PostAsync(url, content);
@ -223,7 +229,11 @@ public class SapService : IDynamicApiController, ITransient
content.Headers.ContentType = new MediaTypeHeaderValue("text/xml");
httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh");
// 设置 SAP Web 服务的 URL
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zppfm001/100/zppfm001/zppfm001";
//sap正式地址
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zppfm001/800/zppfm001/zppfm001";
//sap测试地址
//var url = "https://vhjqeds4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zppfm001/130/zppfm001/zppfm001";
// 发起 POST 请求到 SAP Web 服务
var response = await httpClient.PostAsync(url, content);
@ -278,6 +288,7 @@ public class SapService : IDynamicApiController, ITransient
Console.WriteLine("发生错误: " + ex.Message);
var output = new SapOutput()
{
parameter= soapEnvelope.ToString(),
code = "失败",
msg = "发生错误" + ex.Message,
result = "发生错误" + ex
@ -397,7 +408,11 @@ public class SapService : IDynamicApiController, ITransient
content.Headers.ContentType = new MediaTypeHeaderValue("text/xml");
httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh");
// 设置 SAP Web 服务的 URL
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zppfm003/100/zppfm003/zppfm003";
//sap正式地址
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zppfm003/800/zppfm003/zppfm003";
//sap测试地址
//var url = "https://vhjqeds4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zppfm003/130/zppfm003/zppfm003";
// 发起 POST 请求到 SAP Web 服务
var response = await httpClient.PostAsync(url, content);
@ -507,7 +522,11 @@ public class SapService : IDynamicApiController, ITransient
content.Headers.ContentType = new MediaTypeHeaderValue("text/xml");
httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh");
// 设置 SAP Web 服务的 URL
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zppfm004/100/zppfm004/zppfm004";
//sap正式地址
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zppfm004/800/zppfm004/zppfm004";
//sap测试地址
//var url = "https://vhjqeds4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zppfm004/130/zppfm004/zppfm004";
// 发起 POST 请求到 SAP Web 服务
var response = await httpClient.PostAsync(url, content);
@ -661,7 +680,12 @@ public class SapService : IDynamicApiController, ITransient
content.Headers.ContentType = new MediaTypeHeaderValue("text/xml");
httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh");
// 设置 SAP Web 服务的 URL
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zmmfm013/100/zmmfm013/zmmfm013";
//sap正式地址
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zmmfm013/800/zmmfm013/zmmfm013";
//sap测试地址
//var url = "https://vhjqeds4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zmmfm013/130/zmmfm013/zmmfm013";
// 发起 POST 请求到 SAP Web 服务
var response = await httpClient.PostAsync(url, content);
@ -760,7 +784,8 @@ public class SapService : IDynamicApiController, ITransient
new XElement("Ekorg", item.Ekorg),
new XElement("Zzpspnr", item.Zzpspnr),
new XElement("Afnam", item.Afnam),
new XElement("Loekz", item.Loekz)
new XElement("Loekz", item.Loekz),
new XElement("Ztext", item.Ztext)
);
itemElements.Add(element);
@ -827,7 +852,11 @@ public class SapService : IDynamicApiController, ITransient
content.Headers.ContentType = new MediaTypeHeaderValue("text/xml");
httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh");
// 设置 SAP Web 服务的 URL
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zppfm005/100/zppfm005/zppfm005";
//sap正式地址
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zppfm005/800/zppfm005/zppfm005";
//sap测试地址
//var url = "https://vhjqeds4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zppfm005/130/zppfm005/zppfm005";
// 发起 POST 请求到 SAP Web 服务
var response = await httpClient.PostAsync(url, content);
@ -970,7 +999,11 @@ public class SapService : IDynamicApiController, ITransient
content.Headers.ContentType = new MediaTypeHeaderValue("text/xml");
httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh");
// 设置 SAP Web 服务的 URL
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zpsfm005/100/zpsfm005/zpsfm005";
//sap正式地址
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zpsfm005/800/zpsfm005/zpsfm005";
//sap测试地址
//var url = "https://vhjqeds4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zpsfm005/130/zpsfm005/zpsfm005";
// 发起 POST 请求到 SAP Web 服务
var response = await httpClient.PostAsync(url, content);
@ -1113,7 +1146,11 @@ public class SapService : IDynamicApiController, ITransient
content.Headers.ContentType = new MediaTypeHeaderValue("text/xml");
httpClient.DefaultRequestHeaders.Add("Accept-Language", "zh");
// 设置 SAP Web 服务的 URL
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zpsfm006/100/zpsfm006/zpsfm006";
//sap正式地址
var url = "https://vhjqeps4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zpsfm006/800/zpsfm006/zpsfm006";
//sap测试地址
//var url = "https://vhjqeds4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zpsfm006/130/zpsfm006/zpsfm006";
// 发起 POST 请求到 SAP Web 服务
var response = await httpClient.PostAsync(url, content);

View File

@ -13,7 +13,10 @@ using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using RazorEngine;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -46,6 +49,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
private readonly SysConfigService _sysConfigService;
public Common.DataValidationService _dataValidationService;
public SapService.SapService _sapService;
private readonly IServiceScopeFactory _scopeFactory;
public ChangeNoticeEcnService(
SqlSugarRepository<Obj118> obj118Rep,
@ -55,7 +59,8 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
SqlSugarRepository<ProcessesRequestItems> processesRequestItemsRep,
SysConfigService sysConfigService,
DataValidationService dataValidationService,
SapService.SapService sapService
SapService.SapService sapService,
IServiceScopeFactory scopeFactory
)
{
@ -67,6 +72,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
_sysConfigService = sysConfigService;
_dataValidationService = dataValidationService;
_sapService = sapService;
_scopeFactory = scopeFactory;
}
/// <summary>
@ -218,7 +224,10 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
[AllowAnonymous]
public async Task<List<SapOutput>> TimingSyncToSAP()
{
var input = await _obj118Rep.AsQueryable()
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var input = await db.CopyNew().Queryable<Obj118>()
.Where(x => x.CheckedStatus == 1 && x._System_CurrentStage == "标准化审核" && x.deleted == false && x.IsLatestVersion == true && x.fld005292 == "A")
.ToListAsync();
var SapOutputList = new List<SapOutput>();
@ -253,7 +262,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
{
msg = "同步成功";
}
await _obj118Rep.AsUpdateable()
await db.Updateable<Obj118>()
.SetColumns(it => new Obj118
{
fld005293 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
@ -280,11 +289,15 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
/// 生成ECN差异清单
/// </summary>
/// <returns></returns>
[AllowAnonymous]
[ApiDescriptionSettings(Name = "EcnVarianceList"), HttpGet]
[DisplayName("生成ECN差异清单")]
public async Task<string> EcnVarianceList()
{
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
//获取符合条件的变更通知Ecn数据
var list = await _obj118Rep.AsQueryable()
var list = await db.CopyNew().Queryable<Obj118>()
.Where(x => x.CheckedStatus == 1 && x.deleted == false && x.fld006576 == "A" && x._System_CurrentStage == "差异清单对比中" && x.IsLatestVersion == true)
.ToListAsync();
@ -307,7 +320,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
//最新版本
var ecnVersionIndex = ecnListItem.VersionIndex;
//获取条目记录
var listOfDrawing = await _processesRequestItemsRep.AsQueryable()
var listOfDrawing = await db.CopyNew().Queryable<ProcessesRequestItems>()
.Where(x => x.ProcObjId == 118 && x.fld006573 == "A" && x.ProcRecGuid == ecnRecordGuid)
.ToListAsync();
foreach (var listOfDrawingItem in listOfDrawing)
@ -316,7 +329,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
var listOfDrawingRequestItemsId = listOfDrawingItem.RequestItemsId;
//获取137表记录
var recordData = await _obj137Rep.AsQueryable()
var recordData = await db.CopyNew().Queryable<Obj137>()
.Where(x => x.RecordGuid == listOfDrawingRecordGuid && x.SWPDMConfigurationName == "默认" && x.deleted == false && !string.IsNullOrEmpty(x.fld005686)).OrderByDescending(x => x.idRecord)
.FirstAsync();
if (recordData == null)
@ -359,15 +372,15 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
isAddedFromSW = true
};
var addParentBom = await _configurationDataRep.AsInsertable(parentBom)
var addParentBom = db.CopyNew().Insertable(parentBom)
.InsertColumns(x => new { x.ParentGuid, x.ChildGuid, x.ChildObjID, x.ConfigId, x.childVersion, x.ParentVersion, x.isDeleted, x.Quantity, x.Description, x.OrderIndex, x.PartNumber, x.BOMGuid, x.fld006567, x.CreatedDate, x.ModifiedDate, x.EffectiveFrom, x.EffectiveTo, x.ChildSwFileType, x.ParentSwFileType, x.ParentObjectID, x.CreatedUserID, x.ModifiedUserID, x.ChildConfigID, x.isAddedFromSW })
.ExecuteReturnEntityAsync();
.ExecuteReturnEntity();
//当前版本BOM
var bomList = await _configurationDataRep.AsQueryable().Where(x => x.ParentGuid == recordRecordGuid && x.ParentVersion == recordVersionIndex && x.isDeleted == false && x.ConfigId == 8 && (x.fld005577 != "不包含" || x.fld005577 == null) && x.isSuppressed == false && x.inContext == false).ToListAsync();
var bomList = await db.CopyNew().Queryable<ConfigurationData>().Where(x => x.ParentGuid == recordRecordGuid && x.ParentVersion == recordVersionIndex && x.isDeleted == false && x.ConfigId == 8 && (x.fld005577 != "不包含" || x.fld005577 == null) && x.isSuppressed == false && x.inContext == false && (!(x.ParentSwFileType == 1 && x.isAddedFromSW == false))).ToListAsync();
//旧版本BOM
var historyBomList = await _configurationDataRep.AsQueryable().Where(x => x.ParentGuid == recordRecordGuid && x.ParentVersion == Convert.ToInt32(fld005686) && x.isDeleted == false && x.ConfigId == 8 && (x.fld005577 != "不包含" || x.fld005577 == null) && x.isSuppressed == false && x.inContext == false).ToListAsync();
var historyBomList = await db.CopyNew().Queryable<ConfigurationData>().Where(x => x.ParentGuid == recordRecordGuid && x.ParentVersion == Convert.ToInt32(fld005686) && x.isDeleted == false && x.ConfigId == 8 && (x.fld005577 != "不包含" || x.fld005577 == null) && x.isSuppressed == false && x.inContext == false && (!(x.ParentSwFileType == 1 && x.isAddedFromSW == false))).ToListAsync();
//遍历新BOM
foreach (var bomListItem in bomList)
{
@ -433,7 +446,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
fld006566 = bomListQuantity.ToString()
};
var addChildBomBom = await _configurationDataRep.AsInsertable(childBom).InsertColumns(x => new{ x.ParentGuid, x.ChildGuid, x.ChildObjID, x.ConfigId, x.childVersion, x.ParentVersion, x.isDeleted, x.Quantity, x.Description, x.OrderIndex, x.PartNumber, x.BOMGuid, x.CreatedDate, x.ModifiedDate, x.EffectiveFrom, x.EffectiveTo, x.ChildSwFileType, x.ParentSwFileType, x.ParentObjectID, x.CreatedUserID, x.ModifiedUserID, x.ChildConfigID, x.fld006567, x.fld006581, x.fld006565, x.fld006564, x.fld006566,x.isAddedFromSW,x.fld006586 }).ExecuteReturnEntityAsync();
var addChildBomBom = db.CopyNew().Insertable(childBom).InsertColumns(x => new { x.ParentGuid, x.ChildGuid, x.ChildObjID, x.ConfigId, x.childVersion, x.ParentVersion, x.isDeleted, x.Quantity, x.Description, x.OrderIndex, x.PartNumber, x.BOMGuid, x.CreatedDate, x.ModifiedDate, x.EffectiveFrom, x.EffectiveTo, x.ChildSwFileType, x.ParentSwFileType, x.ParentObjectID, x.CreatedUserID, x.ModifiedUserID, x.ChildConfigID, x.fld006567, x.fld006581, x.fld006565, x.fld006564, x.fld006566, x.isAddedFromSW, x.fld006586 }).ExecuteReturnEntity();
}
var bomChangeVersion = historyBomList.Where(x => x.ChildGuid == bomListChildGuid && x.QtyManual == bomListQuantity && x.childVersion != bomListItem.childVersion).ToList();
@ -481,7 +494,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
fld006566 = bomListQuantity.ToString()
};
var addChildBomBom = await _configurationDataRep.AsInsertable(childBom).InsertColumns(x => new { x.ParentGuid, x.ChildGuid, x.ChildObjID, x.ConfigId, x.childVersion, x.ParentVersion, x.isDeleted, x.Quantity, x.Description, x.OrderIndex, x.PartNumber, x.BOMGuid, x.CreatedDate, x.ModifiedDate, x.EffectiveFrom, x.EffectiveTo, x.ChildSwFileType, x.ParentSwFileType, x.ParentObjectID, x.CreatedUserID, x.ModifiedUserID, x.ChildConfigID, x.fld006567, x.fld006581, x.fld006565, x.fld006564, x.fld006566, x.isAddedFromSW ,x.fld006586 }).ExecuteReturnEntityAsync();
var addChildBomBom = db.CopyNew().Insertable(childBom).InsertColumns(x => new { x.ParentGuid, x.ChildGuid, x.ChildObjID, x.ConfigId, x.childVersion, x.ParentVersion, x.isDeleted, x.Quantity, x.Description, x.OrderIndex, x.PartNumber, x.BOMGuid, x.CreatedDate, x.ModifiedDate, x.EffectiveFrom, x.EffectiveTo, x.ChildSwFileType, x.ParentSwFileType, x.ParentObjectID, x.CreatedUserID, x.ModifiedUserID, x.ChildConfigID, x.fld006567, x.fld006581, x.fld006565, x.fld006564, x.fld006566, x.isAddedFromSW, x.fld006586 }).ExecuteReturnEntity();
}
//BOM对比-新增
@ -524,7 +537,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
fld006566 = bomListQuantity.ToString()
};
var addChildBomBom = await _configurationDataRep.AsInsertable(childBom).InsertColumns(x => new { x.ParentGuid, x.ChildGuid, x.ChildObjID, x.ConfigId, x.childVersion, x.ParentVersion, x.isDeleted, x.Quantity, x.Description, x.OrderIndex, x.PartNumber, x.BOMGuid, x.CreatedDate, x.ModifiedDate, x.EffectiveFrom, x.EffectiveTo, x.ChildSwFileType, x.ParentSwFileType, x.ParentObjectID, x.CreatedUserID, x.ModifiedUserID, x.ChildConfigID, x.fld006567, x.fld006581, x.fld006565, x.fld006564, x.fld006566 ,x.isAddedFromSW }).ExecuteReturnEntityAsync();
var addChildBomBom = db.CopyNew().Insertable(childBom).InsertColumns(x => new { x.ParentGuid, x.ChildGuid, x.ChildObjID, x.ConfigId, x.childVersion, x.ParentVersion, x.isDeleted, x.Quantity, x.Description, x.OrderIndex, x.PartNumber, x.BOMGuid, x.CreatedDate, x.ModifiedDate, x.EffectiveFrom, x.EffectiveTo, x.ChildSwFileType, x.ParentSwFileType, x.ParentObjectID, x.CreatedUserID, x.ModifiedUserID, x.ChildConfigID, x.fld006567, x.fld006581, x.fld006565, x.fld006564, x.fld006566, x.isAddedFromSW }).ExecuteReturnEntity();
}
}
@ -584,11 +597,11 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
fld006564 = historyBomQuantity.ToString(),
fld006566 = "0"
};
var addChildBomBom = await _configurationDataRep.AsInsertable(childBom).InsertColumns(x => new { x.ParentGuid, x.ChildGuid, x.ChildObjID, x.ConfigId, x.childVersion, x.ParentVersion, x.isDeleted, x.Quantity, x.Description, x.OrderIndex, x.PartNumber, x.BOMGuid, x.CreatedDate, x.ModifiedDate, x.EffectiveFrom, x.EffectiveTo, x.ChildSwFileType, x.ParentSwFileType, x.ParentObjectID, x.CreatedUserID, x.ModifiedUserID, x.ChildConfigID, x.fld006567, x.fld006581, x.fld006565, x.fld006564, x.fld006566,x.isAddedFromSW }).ExecuteReturnEntityAsync();
var addChildBomBom = db.CopyNew().Insertable(childBom).InsertColumns(x => new { x.ParentGuid, x.ChildGuid, x.ChildObjID, x.ConfigId, x.childVersion, x.ParentVersion, x.isDeleted, x.Quantity, x.Description, x.OrderIndex, x.PartNumber, x.BOMGuid, x.CreatedDate, x.ModifiedDate, x.EffectiveFrom, x.EffectiveTo, x.ChildSwFileType, x.ParentSwFileType, x.ParentObjectID, x.CreatedUserID, x.ModifiedUserID, x.ChildConfigID, x.fld006567, x.fld006581, x.fld006565, x.fld006564, x.fld006566, x.isAddedFromSW }).ExecuteReturnEntity();
}
}
await _processesRequestItemsRep.AsUpdateable()
db.CopyNew().Updateable<ProcessesRequestItems>()
.SetColumns(it => new ProcessesRequestItems
{
fld006574 = itemComparisonResult,
@ -596,12 +609,12 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
fld006573 = "N"
})
.Where(it => it.RequestItemsId == listOfDrawingRequestItemsId)
.ExecuteCommandAsync();
.ExecuteCommand();
ecnComparisonResult = ecnComparisonResult + itemComparisonResult;
}
await _obj118Rep.AsUpdateable()
db.CopyNew().Updateable<Obj118>()
.SetColumns(it => new Obj118
{
fld006577 = ecnComparisonResult,
@ -609,7 +622,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
fld006576 = "N"
})
.Where(it => it.idRecord == ecnListItem.idRecord)
.ExecuteCommandAsync();
.ExecuteCommand();
}
return "对比完成,请到前端查看结果";
}

View File

@ -0,0 +1,28 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Vistar.Application.Service.Log.Dto;
public class PageTaskLogInput : BasePageInput
{
/// <summary>
/// 开始时间
/// </summary>
public DateTime? StartTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public DateTime? EndTime { get; set; }
public string TaskName { get; set; }
}

View File

@ -0,0 +1,63 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vistar.Application.Entity;
using Vistar.Application.Service.Log.Dto;
namespace Vistar.Application.Service.Log;
/// <summary>
/// 定时任务日志服务 🧩
/// </summary>
[ApiDescriptionSettings(Order = 360, Description = "定时任务日志服务")]
public class ScheduledTaskLogService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<ScheduledTaskLog> _scheduledTaskLogRep;
public ScheduledTaskLogService(SqlSugarRepository<ScheduledTaskLog> scheduledTaskLogRep)
{
_scheduledTaskLogRep = scheduledTaskLogRep;
}
/// <summary>
/// 获取操作日志分页列表 🔖
/// </summary>
/// <returns></returns>
[SuppressMonitor]
[DisplayName("获取操作日志分页列表")]
public async Task<SqlSugarPagedList<ScheduledTaskLog>> Page(PageTaskLogInput input)
{
return await _scheduledTaskLogRep.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(input.StartTime.ToString()), u => u.LogDateTime >= input.StartTime)
.WhereIF(!string.IsNullOrWhiteSpace(input.EndTime.ToString()), u => u.LogDateTime <= input.EndTime)
.WhereIF(!string.IsNullOrWhiteSpace(input.TaskName), u => u.TaskName == input.TaskName)
.ToPagedListAsync(input.Page, input.PageSize);
}
/// <summary>
/// 获取日志详情 🔖
/// </summary>
/// <returns></returns>
[SuppressMonitor]
[DisplayName("获取日志详情")]
public async Task<string> GetDetail(long id)
{
var data= await _scheduledTaskLogRep.AsQueryable().Where(x => x.Id == id).FirstAsync();
return data.ReturnResult;
}
}

View File

@ -505,7 +505,7 @@ public class ProductManagementBaseInput
/// <summary>
///
/// </summary>
public string? fld004876 { get; set; }
public double? fld004876 { get; set; }
/// <summary>
///

View File

@ -14,6 +14,8 @@ using Vistar.Application.Common;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using static Elastic.Clients.Elasticsearch.JoinField;
using Qiniu.CDN;
using SqlSugar;
using Microsoft.Extensions.DependencyInjection;
namespace Vistar.Application.Service.MaterialManagement;
@ -32,6 +34,7 @@ public class ProductManagementService : IDynamicApiController, ITransient
public Common.DataValidationService _dataValidationService;
public SqlSugarRepository<Obj122> _obj122Rep;
public SqlSugarRepository<Obj121> _obj121Rep;
private readonly IServiceScopeFactory _scopeFactory;
public ProductManagementService(
SqlSugarRepository<Obj110> obj110Rep,
@ -42,7 +45,8 @@ public class ProductManagementService : IDynamicApiController, ITransient
SqlSugarRepository<Obj118> obj118Rep,
DataValidationService dataValidationService,
SqlSugarRepository<Obj122> obj122Rep,
SqlSugarRepository<Obj121> obj121Rep
SqlSugarRepository<Obj121> obj121Rep,
IServiceScopeFactory scopeFactory
)
{
@ -55,6 +59,7 @@ public class ProductManagementService : IDynamicApiController, ITransient
_dataValidationService = dataValidationService;
_obj122Rep = obj122Rep;
_obj121Rep = obj121Rep;
_scopeFactory = scopeFactory;
}
/// <summary>
/// 分页查询产品管理
@ -136,7 +141,7 @@ public class ProductManagementService : IDynamicApiController, ITransient
Zeinr = input.fld004881,
Mstae = input.fld004699,
Raube = input.fld004877,
Mhdrz = input.fld004876,
Mhdrz = input.fld004876.ToString(),
Mhdhb = input.fld004895.ToString(),
Werks = input.fld004325,
Beskz = input.fld004490,
@ -344,16 +349,20 @@ public class ProductManagementService : IDynamicApiController, ITransient
[DisplayName("产品管理-批量同步到SAP")]
public async Task<List<SapOutput>> BatchSyncToSAP(List<ProductManagementBaseInput> input)
{
using var serviceScope = _scopeFactory.CreateScope();
var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
const string lengthError = "物料描述长度大于40请检查";
const string synchronized = "该物料编码已同步或已停用!";
var SapOutputList = new List<SapOutput>();
var Requser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
for (int i = 0; i < input.Count; i++)
var tasks = input.Select(async item =>
{
// 验证物料描述长度
if (input[i].fld004484.Length > 40)
if (item.fld004484.Length > 40)
{
await _obj110Rep.AsUpdateable()
db.CopyNew().Updateable<Obj110>()
.SetColumns(it => new Obj110
{
fld004629 = DateTime.Now,
@ -361,29 +370,29 @@ public class ProductManagementService : IDynamicApiController, ITransient
fld004313 = lengthError,
fld004311 = "失败"
})
.Where(it => it.idRecord == input[i].idRecord)
.ExecuteCommandAsync().ConfigureAwait(false);
.Where(it => it.idRecord == item.idRecord)
.ExecuteCommand();
SapOutputList.Add(new SapOutput()
return new SapOutput
{
materialCode = input[i]._System_objNBS,
materialCode = item._System_objNBS,
code = "失败",
msg = lengthError,
result = lengthError
});
continue;
};
}
if (input[i].fld004312 == "N" || input[i].fld004312 == "D" || input[i].fld004312 == null)
if (item.fld004312 == "N" || item.fld004312 == "D" || item.fld004312 == null)
{
SapOutputList.Add(new SapOutput()
return new SapOutput
{
materialCode = input[i]._System_objNBS,
materialCode = item._System_objNBS,
code = "失败",
msg = synchronized,
result = synchronized
});
continue;
};
}
//获取时间戳精确到毫秒sap要求每次调用生成不重复guid
string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
var sapMaterialInput = new SapMaterialInput()
@ -398,27 +407,27 @@ public class ProductManagementService : IDynamicApiController, ITransient
Note2 = "",
Note3 = "",
Zwbid = millisecondTimestamp,
Matnr = input[i]._System_objNBS,
Mbrsh = input[i].fld004323,
Mtart = input[i].fld004324,
Maktx = input[i].fld004484,
Meins = input[i].fld004861,
Matkl = input[i].fld004485,
Bismt = input[i]._System_ObjDescription,
Groes = input[i]._System_objNBS,
Normt = input[i].fld004887,
Ferth = input[i].fld004882,
Zeinr = input[i].fld004881,
Mstae = input[i].fld004699,
Raube = input[i].fld004877,
Mhdrz = input[i].fld004876,
Mhdhb = input[i].fld004895.ToString(),
Werks = input[i].fld004325,
Beskz = input[i].fld004490,
Sobsl = input[i].fld004491,
Schgt = input[i].fld004873,
Rgekz = input[i].fld004872,
Zbom = input[i].fld004698
Matnr = item._System_objNBS,
Mbrsh = item.fld004323,
Mtart = item.fld004324,
Maktx = item.fld004484,
Meins = item.fld004861,
Matkl = item.fld004485,
Bismt = item._System_ObjDescription,
Groes = item._System_objNBS,
Normt = item.fld004887,
Ferth = item.fld004882,
Zeinr = item.fld004881,
Mstae = item.fld004699,
Raube = item.fld004877,
Mhdrz = item.fld004876.ToString(),
Mhdhb = item.fld004895.ToString(),
Werks = item.fld004325,
Beskz = item.fld004490,
Sobsl = item.fld004491,
Schgt = item.fld004873,
Rgekz = item.fld004872,
Zbom = item.fld004698
};
var sapOutput = await _sapService.SapMaterialApi(sapMaterialInput);
string codeVal = sapOutput.code == "S" ? "成功" : "失败";
@ -428,6 +437,7 @@ public class ProductManagementService : IDynamicApiController, ITransient
{
msg = "同步成功";
}
await _obj110Rep.AsUpdateable()
.SetColumns(it => new Obj110
{
@ -436,20 +446,124 @@ public class ProductManagementService : IDynamicApiController, ITransient
fld004312 = "N",
fld004313 = msg
})
.Where(it => it.idRecord == input[i].idRecord)
.Where(it => it.idRecord == item.idRecord)
.ExecuteCommandAsync();
var output = new SapOutput()
return new SapOutput
{
parameter = sapOutput.parameter,
materialCode = input[0]._System_objNBS,
materialCode = item._System_objNBS,
code = codeVal,
msg = msg,
result = sapOutput.result
};
SapOutputList.Add(output);
}
return SapOutputList;
});
var materialOutput = await Task.WhenAll(tasks);
return materialOutput.ToList();
//for (int i = 0; i < input.Count; i++)
//{
// // 验证物料描述长度
// if (input[i].fld004484.Length > 40)
// {
// await _obj110Rep.AsUpdateable()
// .SetColumns(it => new Obj110
// {
// fld004629 = DateTime.Now,
// fld004312 = "N",
// fld004313 = lengthError,
// fld004311 = "失败"
// })
// .Where(it => it.idRecord == input[i].idRecord)
// .ExecuteCommandAsync().ConfigureAwait(false);
// SapOutputList.Add(new SapOutput()
// {
// materialCode = input[i]._System_objNBS,
// code = "失败",
// msg = lengthError,
// result = lengthError
// });
// continue;
// }
// if (input[i].fld004312 == "N" || input[i].fld004312 == "D" || input[i].fld004312 == null)
// {
// SapOutputList.Add(new SapOutput()
// {
// materialCode = input[i]._System_objNBS,
// code = "失败",
// msg = synchronized,
// result = synchronized
// });
// continue;
// }
// //获取时间戳精确到毫秒sap要求每次调用生成不重复guid
// string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
// var sapMaterialInput = new SapMaterialInput()
// {
// Reqkeyid = "",
// Businessid = "",
// Messageid = "",
// Sndprn = "PLM",
// Rcvprn = "SAP",
// Requser = Requser,
// Note1 = "",
// Note2 = "",
// Note3 = "",
// Zwbid = millisecondTimestamp,
// Matnr = input[i]._System_objNBS,
// Mbrsh = input[i].fld004323,
// Mtart = input[i].fld004324,
// Maktx = input[i].fld004484,
// Meins = input[i].fld004861,
// Matkl = input[i].fld004485,
// Bismt = input[i]._System_ObjDescription,
// Groes = input[i]._System_objNBS,
// Normt = input[i].fld004887,
// Ferth = input[i].fld004882,
// Zeinr = input[i].fld004881,
// Mstae = input[i].fld004699,
// Raube = input[i].fld004877,
// Mhdrz = input[i].fld004876,
// Mhdhb = input[i].fld004895.ToString(),
// Werks = input[i].fld004325,
// Beskz = input[i].fld004490,
// Sobsl = input[i].fld004491,
// Schgt = input[i].fld004873,
// Rgekz = input[i].fld004872,
// Zbom = input[i].fld004698
// };
// var sapOutput = await _sapService.SapMaterialApi(sapMaterialInput);
// string codeVal = sapOutput.code == "S" ? "成功" : "失败";
// string msg = sapOutput.msg;
// if (sapOutput.msg == "")
// {
// msg = "同步成功";
// }
// db.CopyNew().Updateable<Obj110>()
// .SetColumns(it => new Obj110
// {
// fld004629 = DateTime.Now,
// fld004311 = codeVal,
// fld004312 = "N",
// fld004313 = msg
// })
// .Where(it => it.idRecord == input[i].idRecord)
// .ExecuteCommand();
// var output = new SapOutput()
// {
// parameter = sapOutput.parameter,
// materialCode = input[0]._System_objNBS,
// code = codeVal,
// msg = msg,
// result = sapOutput.result
// };
// SapOutputList.Add(output);
//}
//return SapOutputList;
}
/// <summary>
/// 产品管理-定时同步到SAP
@ -460,22 +574,22 @@ public class ProductManagementService : IDynamicApiController, ITransient
[AllowAnonymous]
public async Task<List<SapOutput>> TimingSyncToSAP()
{
var input = await _obj110Rep.AsQueryable()
.Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1)
&& x.fld005324 == "发布"
&& x.deleted == false
&& x.IsLatestVersion == true
&& (x.fld004312 == "A" || x.fld004312 == "M"))
.ToListAsync();
using var serviceScope = _scopeFactory.CreateScope();
var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var input = db.Queryable<Obj110>()
.Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1) && x.fld005324 == "发布" && x.deleted == false && x.IsLatestVersion == true && (x.fld004312 == "A" || x.fld004312 == "M"))
.ToList();
const string lengthError = "物料描述长度大于40请检查";
var SapOutputList = new List<SapOutput>();
var Requser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
for (int i = 0; i < input.Count; i++)
var tasks = input.Select(async item =>
{
// 验证物料描述长度
if (input[i].fld004484.Length > 40)
if (item.fld004484.Length > 40)
{
await _obj110Rep.AsUpdateable()
db.CopyNew().Updateable<Obj110>()
.SetColumns(it => new Obj110
{
fld004629 = DateTime.Now,
@ -483,17 +597,16 @@ public class ProductManagementService : IDynamicApiController, ITransient
fld004313 = lengthError,
fld004311 = "失败"
})
.Where(it => it.idRecord == input[i].idRecord)
.ExecuteCommandAsync().ConfigureAwait(false);
.Where(it => it.idRecord == item.idRecord)
.ExecuteCommand();
SapOutputList.Add(new SapOutput()
return new SapOutput
{
materialCode = input[i]._System_objNBS,
materialCode = item._System_objNBS,
code = "失败",
msg = lengthError,
result = lengthError
});
continue;
};
}
//获取时间戳精确到毫秒sap要求每次调用生成不重复guid
@ -510,27 +623,27 @@ public class ProductManagementService : IDynamicApiController, ITransient
Note2 = "",
Note3 = "",
Zwbid = millisecondTimestamp,
Matnr = input[i]._System_objNBS,
Mbrsh = input[i].fld004323,
Mtart = input[i].fld004324,
Maktx = input[i].fld004484,
Meins = input[i].fld004861,
Matkl = input[i].fld004485,
Bismt = input[i]._System_ObjDescription,
Groes = input[i]._System_objNBS,
Normt = input[i].fld004887,
Ferth = input[i].fld004882,
Zeinr = input[i].fld004881,
Mstae = input[i].fld004699,
Raube = input[i].fld004877,
Mhdrz = input[i].fld004876.ToString(),
Mhdhb = input[i].fld004895.ToString(),
Werks = input[i].fld004325,
Beskz = input[i].fld004490,
Sobsl = input[i].fld004491,
Schgt = input[i].fld004873,
Rgekz = input[i].fld004872,
Zbom = input[i].fld004698
Matnr = item._System_objNBS,
Mbrsh = item.fld004323,
Mtart = item.fld004324,
Maktx = item.fld004484,
Meins = item.fld004861,
Matkl = item.fld004485,
Bismt = item._System_ObjDescription,
Groes = item._System_objNBS,
Normt = item.fld004887,
Ferth = item.fld004882,
Zeinr = item.fld004881,
Mstae = item.fld004699,
Raube = item.fld004877,
Mhdrz = item.fld004876.ToString(),
Mhdhb = item.fld004895.ToString(),
Werks = item.fld004325,
Beskz = item.fld004490,
Sobsl = item.fld004491,
Schgt = item.fld004873,
Rgekz = item.fld004872,
Zbom = item.fld004698
};
var sapOutput = await _sapService.SapMaterialApi(sapMaterialInput);
string codeVal = sapOutput.code == "S" ? "成功" : "失败";
@ -540,7 +653,8 @@ public class ProductManagementService : IDynamicApiController, ITransient
{
msg = "同步成功";
}
await _obj110Rep.AsUpdateable()
db.CopyNew().Updateable<Obj110>()
.SetColumns(it => new Obj110
{
fld004629 = DateTime.Now,
@ -548,20 +662,115 @@ public class ProductManagementService : IDynamicApiController, ITransient
fld004312 = "N",
fld004313 = msg
})
.Where(it => it.idRecord == input[i].idRecord)
.ExecuteCommandAsync();
var output = new SapOutput()
.Where(it => it.idRecord == item.idRecord)
.ExecuteCommand();
return new SapOutput
{
parameter = sapOutput.parameter,
materialCode = input[0]._System_objNBS,
materialCode = item._System_objNBS,
code = codeVal,
msg = msg,
result = sapOutput.result
};
SapOutputList.Add(output);
}
return SapOutputList;
});
var materialOutput = await Task.WhenAll(tasks);
return materialOutput.ToList();
//for (int i = 0; i < input.Count; i++)
//{
// // 验证物料描述长度
// if (input[i].fld004484.Length > 40)
// {
// await _obj110Rep.AsUpdateable()
// .SetColumns(it => new Obj110
// {
// fld004629 = DateTime.Now,
// fld004312 = "N",
// fld004313 = lengthError,
// fld004311 = "失败"
// })
// .Where(it => it.idRecord == input[i].idRecord)
// .ExecuteCommandAsync().ConfigureAwait(false);
// SapOutputList.Add(new SapOutput()
// {
// materialCode = input[i]._System_objNBS,
// code = "失败",
// msg = lengthError,
// result = lengthError
// });
// continue;
// }
// //获取时间戳精确到毫秒sap要求每次调用生成不重复guid
// string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
// var sapMaterialInput = new SapMaterialInput()
// {
// Reqkeyid = "",
// Businessid = "",
// Messageid = "",
// Sndprn = "PLM",
// Rcvprn = "SAP",
// Requser = Requser,
// Note1 = "",
// Note2 = "",
// Note3 = "",
// Zwbid = millisecondTimestamp,
// Matnr = input[i]._System_objNBS,
// Mbrsh = input[i].fld004323,
// Mtart = input[i].fld004324,
// Maktx = input[i].fld004484,
// Meins = input[i].fld004861,
// Matkl = input[i].fld004485,
// Bismt = input[i]._System_ObjDescription,
// Groes = input[i]._System_objNBS,
// Normt = input[i].fld004887,
// Ferth = input[i].fld004882,
// Zeinr = input[i].fld004881,
// Mstae = input[i].fld004699,
// Raube = input[i].fld004877,
// Mhdrz = input[i].fld004876.ToString(),
// Mhdhb = input[i].fld004895.ToString(),
// Werks = input[i].fld004325,
// Beskz = input[i].fld004490,
// Sobsl = input[i].fld004491,
// Schgt = input[i].fld004873,
// Rgekz = input[i].fld004872,
// Zbom = input[i].fld004698
// };
// var sapOutput = await _sapService.SapMaterialApi(sapMaterialInput);
// string codeVal = sapOutput.code == "S" ? "成功" : "失败";
// string msg = sapOutput.msg;
// if (sapOutput.msg == "")
// {
// msg = "同步成功";
// }
// await _obj110Rep.AsUpdateable()
// .SetColumns(it => new Obj110
// {
// fld004629 = DateTime.Now,
// fld004311 = codeVal,
// fld004312 = "N",
// fld004313 = msg
// })
// .Where(it => it.idRecord == input[i].idRecord)
// .ExecuteCommandAsync();
// var output = new SapOutput()
// {
// parameter = sapOutput.parameter,
// materialCode = input[0]._System_objNBS,
// code = codeVal,
// msg = msg,
// result = sapOutput.result
// };
// SapOutputList.Add(output);
//}
//return SapOutputList;
}
/// <summary>
/// 产品管理-定时同步 BOM 到 SAP
@ -575,7 +784,7 @@ public class ProductManagementService : IDynamicApiController, ITransient
var sapOutputList = new List<SapOutput>();
var sapUserName = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
// 配置
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 110 && x.ConfigSystemName == "mBOM").FirstAsync();
var configid = 1;
var materialData = await _obj110Rep.AsQueryable()
.Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1) && x.fld005324 == "发布" && x.deleted == false && x.IsLatestVersion == true && x.fld004311 == "成功" && x.fld004312 == "N" && (x.fld004316 == "A" || x.fld004316 == "M"))
@ -586,14 +795,13 @@ public class ProductManagementService : IDynamicApiController, ITransient
foreach (var item in groupedData)
{
// 获取版本号
var versionIndex = item.VersionIndex;
// 获取 ECN guid
var ecnGuid = item.fld004944_Rec;
// 查询 BOM
var bomData = await _configurationDataRep.AsQueryable()
.Where(x => x.ConfigId == configid.ConfigID && x.ParentGuid == item.RecordGuid && x.isDeleted == false && x.ParentVersion == versionIndex && (x.fld005586 != "不包含" || x.fld005586 == null)).ToListAsync();
.Where(x => x.ConfigId == configid && x.ParentGuid == item.RecordGuid && x.isDeleted == false && x.ParentVersion == versionIndex && (x.fld005586 != "不包含" || x.fld005586 == null)).ToListAsync();
if (bomData.Count == 0)
{
continue;
@ -738,6 +946,144 @@ public class ProductManagementService : IDynamicApiController, ITransient
}
return sapOutputList;
}
/// <summary>
///产品管理同步Bom到SAP
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public async Task<SapOutput> SyncBomToSap(SyncBomData data)
{
var sapUserName = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var ecn = db.CopyNew().Queryable<Obj118>().Where(x => x.RecordGuid == data.ecnGuid).OrderByDescending(x => x.idRecord).First();
if (ecn != null)
{
data.Ecn = ecn._System_objNBS;
}
var itemDataList = new List<ItemData>();
foreach (var item in data.Bom)
{
var verification = await _dataValidationService.VerificationMaterial(item.ChildObjID, item.PartNumber, item.ChildGuid);
if (verification == "不存在")
{
continue;
}
var itemData = new ItemData
{
POSNR = (data.Bom.IndexOf(item) + 1).ToString(),
IDNRK = item.PartNumber,
MENGE = item.Quantity.ToString(),
SORTF = item.SORTF,
ITISOB = item.ITISOB,
ALPGR = item.ALPGR,
ALPRF = item.ALPRF,
ZDELETE = item.ZDELETE,
POSTP = item.POSTP,
ZYFMK = item.ZYFMK
};
itemDataList.Add(itemData);
}
if (!string.IsNullOrEmpty(data.SyncVersion))
{
var BomData = db.CopyNew().Queryable<ConfigurationData>().Where(x => x.ConfigId == 1 && x.ParentGuid == data.RecordGuid && x.isDeleted == false && x.ParentVersion == Convert.ToInt32(data.SyncVersion) && (x.fld005586 != "不包含" || x.fld005586 == null)).ToList();
foreach (var item in BomData)
{
var itemList = itemDataList.Where(x => x.IDNRK == item.PartNumber).ToList();
if (itemList.Count == 0)
{
var Verification = await _dataValidationService.VerificationMaterial(item.ChildObjID, item.PartNumber, item.ChildGuid);
if (Verification == "不存在")
{
continue;
}
var itemData = new ItemData()
{
POSNR = "",//组件序号 sun.ToString()
IDNRK = item.PartNumber,//组件物料号
MENGE = item.Quantity.ToString(),//组件数量
SORTF = item.fld004936,
ITISOB = item.fld004937,
ALPGR = item.fld004938,
ALPRF = item.fld004939,
ZDELETE = "X",
POSTP = item.fld004492,
ZYFMK = item.fld004941
};
itemDataList.Add(itemData);
}
}
}
// 获取时间戳精确到毫秒sap 要求每次调用生成不重复 guid
string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
var isreq = new IS_REQ
{
ReqKeyId = "",
BusinessId = "",
MessageId = "",
SndPrn = "PLM",
RcvPrn = "SAP",
ReqUser = sapUserName,
Note1 = "",
Note2 = "",
Note3 = "",
Zwbid = millisecondTimestamp,
Matnr = data.MaterialCode,
Werks = data.Werks,
Bmeng = data.Bmeng.ToString(),
Aennr = data.Ecn,
Datuv = data.Datuv.ToString(),
ItemList = itemDataList
};
var apiOutput = await _sapService.SapBomApi(isreq);
string codeVal = apiOutput.code == "S" ? "成功" : "失败";
if (codeVal == "成功")
{
db.CopyNew().Updateable<Obj110>()
.SetColumns(it => new Obj110
{
fld004631 = DateTime.Now,
fld004315 = codeVal,
fld004316 = "N",
fld004317 = apiOutput.msg,
fld005288 = data.VersionIndex.ToString()
})
.Where(it => it.idRecord == data.Id)
.ExecuteCommand();
}
else
{
db.CopyNew().Updateable<Obj110>()
.SetColumns(it => new Obj110
{
fld004631 = DateTime.Now,
fld004315 = codeVal,
fld004316 = "N",
fld004317 = apiOutput.msg
})
.Where(it => it.idRecord == data.Id)
.ExecuteCommand();
}
var msg = apiOutput.msg;
if (string.IsNullOrEmpty(msg))
{
msg = "同步成功";
}
var output = new SapOutput
{
parameter = apiOutput.parameter,
materialCode = data.MaterialCode,
code = codeVal,
msg = msg,
result = apiOutput.result
};
return output;
}
/// <summary>
/// 产品管理-获取工艺路线
@ -972,4 +1318,102 @@ public class ProductManagementService : IDynamicApiController, ITransient
return sapOutputList;
}
/// <summary>
/// 产品管理同步工艺路线到sap
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public async Task<SapOutput> SyncProcessRouteToSap(SyncProcessRouteData data)
{
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var itemDataList = new List<SapProcessRouteItemData>();
foreach (var item in data.ProcessRouteList)
{
var verification = await _dataValidationService.VerificationMaterial(item.ChildObjID, item.PartNumber, item.ChildGuid);
if (verification == "不存在")
{
continue;
}
//获取工序描述
var procedureDescription = db.CopyNew().Queryable<Obj122>().Where(x => x.RecordGuid == item.ChildGuid).First(); ;
//获取工作中心
var workCenter = db.CopyNew().Queryable<Obj121>().Where(x => x.RecordGuid == procedureDescription.fld005059_Rec).First();
var itemData = new SapProcessRouteItemData()
{
VORNR = item.VORNR,
LTXA1 = procedureDescription._System_ObjDescription,
ARBPL = workCenter._System_objNBS,
VGW01 = item.VGW01.ToString(),
VGE01 = item.VGE01,
STEUS = item.STEUS,
BMSCH = item.BMSCH.ToString()
};
itemDataList.Add(itemData);
}
var Datuv = data.Datuv.ToString();
if (!string.IsNullOrEmpty(Datuv))
{
Datuv = data.Datuv.ToDateTime().ToString("yyyy-MM-dd");
}
//获取时间戳精确到毫秒sap要求每次调用生成不重复guid
string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
var isreq = new SapProcessRouteIS_REQ()
{
ReqKeyId = "",
BusinessId = "",
MessageId = "",
SndPrn = "PLM",
RcvPrn = "SAP",
ReqUser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName),
Note1 = "",
Note2 = "",
Note3 = "",
Zwbid = millisecondTimestamp,
Matnr = data._System_objNBS,
Werks = data.Werks,
Datuv = Datuv,
Plnal = "",
ItemList = itemDataList
};
var apiOutput = await _sapService.SapProcessRouteApi(isreq);
string codeVal = apiOutput.code == "S" ? "成功" : "失败";
db.CopyNew().Updateable<Obj110>()
.SetColumns(it => new Obj110
{
fld004632 = DateTime.Now,
fld004319 = codeVal,
fld004320 = "N",
fld004321 = apiOutput.msg
})
.Where(it => it.idRecord == data.idRecord)
.ExecuteCommand();
var msg = apiOutput.msg;
if (apiOutput.msg == "")
{
msg = "同步成功";
}
var output = new SapOutput()
{
parameter = apiOutput.parameter,
code = codeVal,
msg = msg,
result = apiOutput.result
};
return output;
}
}

View File

@ -132,4 +132,9 @@ public class OaCreateProcessInput
/// 软件问题处理人员
/// </summary>
public string fld006062 { get; set; }
/// <summary>
/// 上位负责人OA工号
/// </summary>
public string fld007040 { get; set; }
}

View File

@ -15,8 +15,10 @@ using Furion.DynamicApiController;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using NewLife.Xml;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -44,6 +46,7 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient
public SqlSugarRepository<FieldGroupDefault> _fieldGroupDefaultRep;
public SqlSugarRepository<Obj81> _obj81Rep;
public SqlSugarRepository<Obj118> _obj118Rep;
private readonly IServiceScopeFactory _scopeFactory;
public OaOpenInterfaceService(
SqlSugarRepository<Obj109> obj109Rep,
@ -52,7 +55,8 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient
SolidWorksManageService.SolidWorksManageService solidWorksManageService,
SqlSugarRepository<ObjectFieldsGroups> objectFieldsGroupsRep,
SqlSugarRepository<FieldGroupDefault> fieldGroupDefaultRep,
SqlSugarRepository<Obj118> obj118Rep
SqlSugarRepository<Obj118> obj118Rep,
IServiceScopeFactory scopeFactory
)
{
@ -63,6 +67,7 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient
_fieldGroupDefaultRep = fieldGroupDefaultRep;
_obj81Rep= obj81Rep;
_obj118Rep= obj118Rep;
_scopeFactory = scopeFactory;
}
/// <summary>
@ -223,6 +228,7 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient
fieldList.Add(new Field { key = "fld005852", value = input.fld005852.ToString("yyyy-MM-dd HH:mm:ss") });
fieldList.Add(new Field { key = "fld005853", value = input.fld005853 });
fieldList.Add(new Field { key = "fld005855", value = "OA" });
fieldList.Add(new Field { key = "fld007040", value = input.fld007040 });
if (!string.IsNullOrWhiteSpace(input.fld005838))
{
@ -278,12 +284,31 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient
var projectData = await _obj140Rep.AsQueryable().Where(x => x._System_objNBS == input._System_objNBS && x.deleted == false).OrderByDescending(x=>x.VersionIndex).FirstAsync();
long? fld005835 = null;
string fld005835_Rec = "";
var responsiblePersonOaData = await _obj81Rep.AsQueryable().Where(x => x.fld004900 == input.fld005836 && x.deleted == false).ToListAsync();
if (responsiblePersonOaData.Count != 0)
{
fld005835 = 81;
fld005835_Rec = responsiblePersonOaData[0].RecordGuid;
}
long? fld007039 = null;
string fld007039_Rec = "";
if (!string.IsNullOrEmpty(input.fld007040))
{
var responsiblePersonData = await _obj81Rep.AsQueryable().Where(x => x.fld004900 == input.fld007040 && x.deleted == false).ToListAsync();
if (responsiblePersonData.Count != 0)
{
fld007039 = 81;
fld007039_Rec = responsiblePersonData[0].RecordGuid;
}
}
long? fld005848 = null;
string fld005848_Rec = "";
var createPersonOaData = await _obj81Rep.AsQueryable().Where(x => x.fld004900 == input.fld005847 && x.deleted == false).ToListAsync();
@ -343,6 +368,8 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient
{
fld005835 = fld005835,
fld005835_Rec= fld005835_Rec,
fld007039 = fld007039,
fld007039_Rec = fld007039_Rec,
fld005848 = fld005848,
fld005848_Rec = fld005848_Rec,
fld005851 = fld005851,
@ -439,7 +466,10 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient
[AllowAnonymous]
public async Task<List<OaUploadFileOutput>> SyncEcnAttach()
{
var data=await _obj118Rep.AsQueryable().Where(x=>x.deleted==false&&x.fld006778=="A"&&x._System_CurrentStage=="结束"&&!string.IsNullOrEmpty(x.fld006310_Rec)).ToListAsync();
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var data=await db.CopyNew().Queryable<Obj118>().Where(x=>x.deleted==false&&x.fld006778=="A"&&x._System_CurrentStage=="结束"&&!string.IsNullOrEmpty(x.fld006310_Rec)).ToListAsync();
var groupedData = data.GroupBy(item => item.RecordGuid)
.Select(group => group.OrderByDescending(item => item.idRecord).First())
@ -456,19 +486,20 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient
var manageOutput= await _solidWorksManageService.ExportRelatedFiles(input);
if (manageOutput.State=="成功")
{
var problemReport= await _obj140Rep.AsQueryable().Where(x=>x.RecordGuid==item.fld006310_Rec&&x.deleted==false).FirstAsync();
var problemReport= await db.CopyNew().Queryable<Obj140>().Where(x=>x.RecordGuid==item.fld006310_Rec&&x.deleted==false).FirstAsync();
if (problemReport != null)
{
var oaUploadFileOutput = await OaUploadFile(problemReport._System_objNBS, manageOutput);
output.Add(oaUploadFileOutput);
await _obj118Rep.AsUpdateable().SetColumns(it => new Obj118
db.CopyNew().Updateable<Obj118>()
.SetColumns(it => new Obj118
{
fld006778="N",
fld006780=DateTime.Now,
fld006779= oaUploadFileOutput.message
})
.Where(it => it.idRecord == id)
.ExecuteCommandAsync();
.ExecuteCommand();
}
}
}
@ -483,7 +514,8 @@ public class OaOpenInterfaceService : IDynamicApiController, ITransient
/// <returns></returns>
public async Task<OaUploadFileOutput> OaUploadFile(string problemNum, ExportRelatedFilesOutput input)
{
string url = "http://223.113.253.60:8000/papi/secondev/workflow/uploadFileByReportNo";
//string url = "http://223.113.253.60:8000/papi/secondev/workflow/uploadFileByReportNo";
string url = "http://192.168.10.35:8000/papi/secondev/workflow/uploadFileByReportNo";
// 构建请求参数字典
var requestData = new
{

View File

@ -27,190 +27,190 @@ public class ProductDesignLibraryInput
public bool? IsLatestVersion { get; set; }
public DateTime? CreatedDate { get; set; }
//public DateTime? CreatedDate { get; set; }
public DateTime? VersionCreatedDate { get; set; }
//public DateTime? VersionCreatedDate { get; set; }
public DateTime? dateModified { get; set; }
//public DateTime? dateModified { get; set; }
public long? UserCreatedId { get; set; }
//public long? UserCreatedId { get; set; }
public long? VersionUserCreatedId { get; set; }
//public long? VersionUserCreatedId { get; set; }
public long? UserModifiedId { get; set; }
//public long? UserModifiedId { get; set; }
public string? RecordGuid { get; set; }
public bool? isVisibilityNormal { get; set; }
//public bool? isVisibilityNormal { get; set; }
public bool? deleted { get; set; }
public string? SubObjectGuid { get; set; }
//public string? SubObjectGuid { get; set; }
public bool? PreviousStatus { get; set; }
//public bool? PreviousStatus { get; set; }
public string? revision { get; set; }
public byte[]? Record_image160_160 { get; set; }
//public byte[]? Record_image160_160 { get; set; }
public byte[]? Record_Image320_240 { get; set; }
//public byte[]? Record_Image320_240 { get; set; }
public byte[]? Record_ImageMax { get; set; }
//public byte[]? Record_ImageMax { get; set; }
public string? _System_objNBS { get; set; }
public string? _System_ObjDescription { get; set; }
public DateTime? _System_Effectivity_Begin { get; set; }
//public DateTime? _System_Effectivity_Begin { get; set; }
public DateTime? _System_Effectivity_End { get; set; }
//public DateTime? _System_Effectivity_End { get; set; }
public string? CheckedOutPc { get; set; }
//public string? CheckedOutPc { get; set; }
public long? StageId { get; set; }
//public long? StageId { get; set; }
public long? ProjectManager { get; set; }
//public long? ProjectManager { get; set; }
public long? ProjectManager_Rec { get; set; }
//public long? ProjectManager_Rec { get; set; }
public bool? EnableNotifications { get; set; }
//public bool? EnableNotifications { get; set; }
public long? GroupObjId { get; set; }
//public long? GroupObjId { get; set; }
public bool? _CheckOutInProgress { get; set; }
//public bool? _CheckOutInProgress { get; set; }
public string? ParentRecordGuid { get; set; }
//public string? ParentRecordGuid { get; set; }
public string? MaterialType { get; set; }
//public string? MaterialType { get; set; }
public bool? _System_NeedSWRebuild { get; set; }
//public bool? _System_NeedSWRebuild { get; set; }
public string? _system_objConfigurationName { get; set; }
//public string? _system_objConfigurationName { get; set; }
public bool? _system_objConfigurationType { get; set; }
//public bool? _system_objConfigurationType { get; set; }
public string? _system_objConfigurationGuid { get; set; }
//public string? _system_objConfigurationGuid { get; set; }
public string ShowBomFromConfiguration { get; set; }
//public string ShowBomFromConfiguration { get; set; }
public string _System_ObjNbsAuto { get; set; }
//public string _System_ObjNbsAuto { get; set; }
public long? PreviousIdRecord { get; set; }
//public long? PreviousIdRecord { get; set; }
public string? _System_DerivedFrom { get; set; }
//public string? _System_DerivedFrom { get; set; }
public bool? _system_objLinkedCompare { get; set; }
//public bool? _system_objLinkedCompare { get; set; }
public string? _System_WebLink { get; set; }
//public string? _System_WebLink { get; set; }
public bool? isReleasedVersion { get; set; }
//public bool? isReleasedVersion { get; set; }
public string? _System_DerivedFrom_RecordGuid { get; set; }
//public string? _System_DerivedFrom_RecordGuid { get; set; }
public long? SWPDMDocumentId { get; set; }
//public long? SWPDMDocumentId { get; set; }
public long? SWPDMConfigurationID { get; set; }
//public long? SWPDMConfigurationID { get; set; }
public string? SWPDMConfigurationName { get; set; }
//public string? SWPDMConfigurationName { get; set; }
public long? SWPDMActiveConfigurationId { get; set; }
//public long? SWPDMActiveConfigurationId { get; set; }
public string? SWPDMActiveConfigurationName { get; set; }
//public string? SWPDMActiveConfigurationName { get; set; }
public string? SWPDMFileName { get; set; }
//public string? SWPDMFileName { get; set; }
public long? SWPDMConfigPersistID { get; set; }
//public long? SWPDMConfigPersistID { get; set; }
public int? SWPDMStatusId { get; set; }
//public int? SWPDMStatusId { get; set; }
public string? SWPDMStatusName { get; set; }
//public string? SWPDMStatusName { get; set; }
public bool? _SWPDM_1179__SW_Detailing_Mode_ { get; set; }
//public bool? _SWPDM_1179__SW_Detailing_Mode_ { get; set; }
public string? _SWPDM_2__SW_Last_Saved_With_ { get; set; }
//public string? _SWPDM_2__SW_Last_Saved_With_ { get; set; }
public string? _SWPDM_111_A___ { get; set; }
//public string? _SWPDM_111_A___ { get; set; }
public string? _SWPDM_1172_BOM_BOM__ { get; set; }
//public string? _SWPDM_1172_BOM_BOM__ { get; set; }
public string? _SWPDM_112_BOM___2 { get; set; }
//public string? _SWPDM_112_BOM___2 { get; set; }
public string? _SWPDM_113_BOM___ { get; set; }
//public string? _SWPDM_113_BOM___ { get; set; }
public string? _SWPDM_115_BOM___ { get; set; }
//public string? _SWPDM_115_BOM___ { get; set; }
public string? _SWPDM_116_BOM___ { get; set; }
//public string? _SWPDM_116_BOM___ { get; set; }
public string? _SWPDM_117_BOM_____ { get; set; }
//public string? _SWPDM_117_BOM_____ { get; set; }
public string? _SWPDM_51_BOM_____ { get; set; }
//public string? _SWPDM_51_BOM_____ { get; set; }
public string? _SWPDM_118_BOM_____ { get; set; }
//public string? _SWPDM_118_BOM_____ { get; set; }
public string? _SWPDM_119_BOM___ { get; set; }
//public string? _SWPDM_119_BOM___ { get; set; }
public string? _SWPDM_114_BOM_____ { get; set; }
//public string? _SWPDM_114_BOM_____ { get; set; }
public string? _SWPDM_120_BOM______ { get; set; }
//public string? _SWPDM_120_BOM______ { get; set; }
public string? _SWPDM_121_BOM___ { get; set; }
//public string? _SWPDM_121_BOM___ { get; set; }
public string? _SWPDM_122_BOW___1 { get; set; }
//public string? _SWPDM_122_BOW___1 { get; set; }
public string? _SWPDM_123_BOW___ { get; set; }
//public string? _SWPDM_123_BOW___ { get; set; }
public string? _SWPDM_84_DWG___ { get; set; }
//public string? _SWPDM_84_DWG___ { get; set; }
public string? _SWPDM_82_DWG___ { get; set; }
//public string? _SWPDM_82_DWG___ { get; set; }
public string? _SWPDM_80_DWG_____ { get; set; }
//public string? _SWPDM_80_DWG_____ { get; set; }
public string? _SWPDM_76_DWG___ { get; set; }
//public string? _SWPDM_76_DWG___ { get; set; }
public string? _SWPDM_77_DWG___ { get; set; }
//public string? _SWPDM_77_DWG___ { get; set; }
public string? _SWPDM_78_DWG___ { get; set; }
//public string? _SWPDM_78_DWG___ { get; set; }
public string? _SWPDM_79_DWG___ { get; set; }
//public string? _SWPDM_79_DWG___ { get; set; }
public string? _SWPDM_83_DWG___ { get; set; }
//public string? _SWPDM_83_DWG___ { get; set; }
public string? _SWPDM_81_DWG___ { get; set; }
//public string? _SWPDM_81_DWG___ { get; set; }
public string? _SWPDM_92_FB___ { get; set; }
//public string? _SWPDM_92_FB___ { get; set; }
public string? _SWPDM_86_FB_____ { get; set; }
//public string? _SWPDM_86_FB_____ { get; set; }
public string? _SWPDM_87_FB_____ { get; set; }
//public string? _SWPDM_87_FB_____ { get; set; }
public string? _SWPDM_88_FB_____ { get; set; }
//public string? _SWPDM_88_FB_____ { get; set; }
public string? _SWPDM_89_FB_____ { get; set; }
//public string? _SWPDM_89_FB_____ { get; set; }
public string? _SWPDM_90_FB______ { get; set; }
//public string? _SWPDM_90_FB______ { get; set; }
public string? _SWPDM_85_FB____ { get; set; }
//public string? _SWPDM_85_FB____ { get; set; }
public string? _SWPDM_91_FB_____ { get; set; }
public string? _SWPDM_94_PDF___ { get; set; }
//public string? _SWPDM_91_FB_____ { get; set; }
//public string? _SWPDM_94_PDF___ { get; set; }
public string? _SWPDM_101_PDF___ { get; set; }
//public string? _SWPDM_101_PDF___ { get; set; }
public string? _SWPDM_95_PDF_____ { get; set; }
//public string? _SWPDM_95_PDF_____ { get; set; }
public string? _SWPDM_96_PDF___ { get; set; }
//public string? _SWPDM_96_PDF___ { get; set; }
public string? _SWPDM_97_PDF___ { get; set; }
//public string? _SWPDM_97_PDF___ { get; set; }
public string? _SWPDM_98_PDF___ { get; set; }
//public string? _SWPDM_98_PDF___ { get; set; }
public string? _SWPDM_93_PDF___ { get; set; }
//public string? _SWPDM_93_PDF___ { get; set; }
public string? _SWPDM_99_PDF___ { get; set; }
//public string? _SWPDM_99_PDF___ { get; set; }
public string? _SWPDM_100_PDF___ { get; set; }
//public string? _SWPDM_100_PDF___ { get; set; }
public string? _SWPDM_1194_q { get; set; }
//public string? _SWPDM_1194_q { get; set; }
public string? _SWPDM_1196_SAP_____ { get; set; }
@ -218,28 +218,28 @@ public class ProductDesignLibraryInput
public string? _SWPDM_1187_SAP___ { get; set; }
public double? _SWPDM_1190_SAP___ { get; set; }
//public double? _SWPDM_1190_SAP___ { get; set; }
public string? _SWPDM_1191_SAP___ { get; set; }
//public string? _SWPDM_1191_SAP___ { get; set; }
public string? _SWPDM_1188_SAP___ { get; set; }
public string? _SWPDM_1197_SAP_____ { get; set; }
public string? _SWPDM_1210_SAP_____ { get; set; }
//public string? _SWPDM_1210_SAP_____ { get; set; }
public string? _SWPDM_1189_SAP___ID_____ { get; set; }
//public string? _SWPDM_1189_SAP___ID_____ { get; set; }
public string? _SWPDM_1200_SAP_____ { get; set; }
//public string? _SWPDM_1200_SAP_____ { get; set; }
public string? _SWPDM_1208_SAP___BOM___ { get; set; }
public string? _SWPDM_1201_SAP_____ { get; set; }
// public string? _SWPDM_1201_SAP_____ { get; set; }
public string? _SWPDM_1198_SAP_____ { get; set; }
public string? _SWPDM_1193_SAP___ { get; set; }
//public string? _SWPDM_1193_SAP___ { get; set; }
public string? _SWPDM_1195_SAP_____ { get; set; }
//public string? _SWPDM_1195_SAP_____ { get; set; }
public string? _SWPDM_1186_SAP_____ { get; set; }
@ -249,27 +249,27 @@ public class ProductDesignLibraryInput
public string? _SWPDM_1185_SAP___ { get; set; }
public string? _SWPDM_1192_SAP_____ { get; set; }
//public string? _SWPDM_1192_SAP_____ { get; set; }
public string? _SWPDM_1184_SIP_____ { get; set; }
//public string? _SWPDM_1184_SIP_____ { get; set; }
public string? _SWPDM_1183_SIP_____ { get; set; }
//public string? _SWPDM_1183_SIP_____ { get; set; }
public string? _SWPDM_1182_SOP_____ { get; set; }
//public string? _SWPDM_1182_SOP_____ { get; set; }
public string? _SWPDM_1181_SOP_____ { get; set; }
//public string? _SWPDM_1181_SOP_____ { get; set; }
public string? _SWPDM_46_SW___ { get; set; }
//public string? _SWPDM_46_SW___ { get; set; }
public string? _SWPDM_60_SW___ { get; set; }
//public string? _SWPDM_60_SW___ { get; set; }
public string? _SWPDM_124_SW___ { get; set; }
//public string? _SWPDM_124_SW___ { get; set; }
public string? _SWPDM_102_SW___ { get; set; }
//public string? _SWPDM_102_SW___ { get; set; }
public string? _SWPDM_56_SW____ { get; set; }
//public string? _SWPDM_56_SW____ { get; set; }
public string? _SWPDM_57_SW______ { get; set; }
//public string? _SWPDM_57_SW______ { get; set; }
public string? _SWPDM_61_SW_____ { get; set; }
@ -279,181 +279,181 @@ public class ProductDesignLibraryInput
public string? _SWPDM_126_SW___ { get; set; }
public string? _SWPDM_127_SW_____ { get; set; }
//public string? _SWPDM_127_SW_____ { get; set; }
public string? _SWPDM_1205_SW_______ { get; set; }
//public string? _SWPDM_1205_SW_______ { get; set; }
public string? _SWPDM_47_SW___ { get; set; }
//public string? _SWPDM_47_SW___ { get; set; }
public string? _SWPDM_48_SW_____ { get; set; }
//public string? _SWPDM_48_SW_____ { get; set; }
public string? _SWPDM_54_SW___ { get; set; }
//public string? _SWPDM_54_SW___ { get; set; }
public string? _SWPDM_55_SW_____ { get; set; }
//public string? _SWPDM_55_SW_____ { get; set; }
public string? _SWPDM_66_SW___ { get; set; }
//public string? _SWPDM_66_SW___ { get; set; }
public string? _SWPDM_154_SW_____ { get; set; }
//public string? _SWPDM_154_SW_____ { get; set; }
public string? _SWPDM_63_SW___ { get; set; }
//public string? _SWPDM_63_SW___ { get; set; }
public string? _SWPDM_64_SW___ { get; set; }
public string? _SWPDM_65_SW___ { get; set; }
public string? _SWPDM_128_SW_____ { get; set; }
//public string? _SWPDM_128_SW_____ { get; set; }
public string? _SWPDM_1206_SW_______ { get; set; }
//public string? _SWPDM_1206_SW_______ { get; set; }
public string? _SWPDM_52_SW___ { get; set; }
//public string? _SWPDM_52_SW___ { get; set; }
public string? _SWPDM_53_SW_____ { get; set; }
//public string? _SWPDM_53_SW_____ { get; set; }
public string? _SWPDM_58_SW___ { get; set; }
//public string? _SWPDM_58_SW___ { get; set; }
public string? _SWPDM_59_SW_____ { get; set; }
//public string? _SWPDM_59_SW_____ { get; set; }
public string? _SWPDM_1178_SW_____ { get; set; }
//public string? _SWPDM_1178_SW_____ { get; set; }
public string? _SWPDM_1202_SW_____ { get; set; }
//public string? _SWPDM_1202_SW_____ { get; set; }
public string? _SWPDM_49_SW___ { get; set; }
//public string? _SWPDM_49_SW___ { get; set; }
public string? _SWPDM_129_SW_____ { get; set; }
//public string? _SWPDM_129_SW_____ { get; set; }
public string? _SWPDM_1207_SW_______ { get; set; }
//public string? _SWPDM_1207_SW_______ { get; set; }
public string? _SWPDM_130_SW___ { get; set; }
//public string? _SWPDM_130_SW___ { get; set; }
public string? _SWPDM_50_SW_____ { get; set; }
//public string? _SWPDM_50_SW_____ { get; set; }
public string? _SWPDM_131_SW_____ { get; set; }
//public string? _SWPDM_131_SW_____ { get; set; }
public string? _SWPDM_155_SW_____ { get; set; }
//public string? _SWPDM_155_SW_____ { get; set; }
public string? _SWPDM_1175_SW_____ { get; set; }
//public string? _SWPDM_1175_SW_____ { get; set; }
public string? _SWPDM_1177_SW_____ { get; set; }
//public string? _SWPDM_1177_SW_____ { get; set; }
public string? _SWPDM_1170_SW___ { get; set; }
//public string? _SWPDM_1170_SW___ { get; set; }
public string? _SWPDM_1171_SW_____ { get; set; }
//public string? _SWPDM_1171_SW_____ { get; set; }
public string? _SWPDM_1173_SW____ { get; set; }
//public string? _SWPDM_1173_SW____ { get; set; }
public string? _SWPDM_132_SW_____ { get; set; }
//public string? _SWPDM_132_SW_____ { get; set; }
public string? _SWPDM_1204_SW_______ { get; set; }
//public string? _SWPDM_1204_SW_______ { get; set; }
public string? _SWPDM_133_SW____ { get; set; }
//public string? _SWPDM_133_SW____ { get; set; }
public string? _SWPDM_67_SW___ { get; set; }
//public string? _SWPDM_67_SW___ { get; set; }
public string? _SWPDM_1174_SW___ { get; set; }
//public string? _SWPDM_1174_SW___ { get; set; }
public string? _SWPDM_1168_TEMP_____ { get; set; }
//public string? _SWPDM_1168_TEMP_____ { get; set; }
public string? _SWPDM_1167_TEMP_____ { get; set; }
//public string? _SWPDM_1167_TEMP_____ { get; set; }
public string? _SWPDM_1166_TEMP_____ { get; set; }
//public string? _SWPDM_1166_TEMP_____ { get; set; }
public string? _SWPDM_1165_TEMP____ { get; set; }
//public string? _SWPDM_1165_TEMP____ { get; set; }
public string? _SWPDM_1164_TEMP_______ { get; set; }
//public string? _SWPDM_1164_TEMP_______ { get; set; }
public string? _SWPDM_1163_TEMP_______ { get; set; }
//public string? _SWPDM_1163_TEMP_______ { get; set; }
public string? _SWPDM_1162_TEMP_____ { get; set; }
//public string? _SWPDM_1162_TEMP_____ { get; set; }
public string? _SWPDM_1161_TEMP_____ { get; set; }
//public string? _SWPDM_1161_TEMP_____ { get; set; }
public string? _SWPDM_1160_TEMP_______ { get; set; }
//public string? _SWPDM_1160_TEMP_______ { get; set; }
public string? _SWPDM_1159_TEMP_______ { get; set; }
//public string? _SWPDM_1159_TEMP_______ { get; set; }
public string? _SWPDM_1176_TEMP_____ { get; set; }
//public string? _SWPDM_1176_TEMP_____ { get; set; }
public string? _SWPDM_1158_TEMP____ { get; set; }
//public string? _SWPDM_1158_TEMP____ { get; set; }
public string? _SWPDM_134_TY___ { get; set; }
//public string? _SWPDM_134_TY___ { get; set; }
public string? _SWPDM_135_TY______ { get; set; }
//public string? _SWPDM_135_TY______ { get; set; }
public string? _SWPDM_136_TY_____ { get; set; }
//public string? _SWPDM_136_TY_____ { get; set; }
public string? _SWPDM_137_TY_____ { get; set; }
//public string? _SWPDM_137_TY_____ { get; set; }
public string? _SWPDM_138_TY_____ { get; set; }
//public string? _SWPDM_138_TY_____ { get; set; }
public string? _SWPDM_139_WD_____ { get; set; }
//public string? _SWPDM_139_WD_____ { get; set; }
public string? _SWPDM_140_WD____ { get; set; }
//public string? _SWPDM_140_WD____ { get; set; }
public string? _SWPDM_141_WD___ { get; set; }
//public string? _SWPDM_141_WD___ { get; set; }
public string? _SWPDM_142_WJJ_____ { get; set; }
//public string? _SWPDM_142_WJJ_____ { get; set; }
public string? _SWPDM_143_WJJ____ { get; set; }
//public string? _SWPDM_143_WJJ____ { get; set; }
public string? _SWPDM_144_WJJ___ { get; set; }
//public string? _SWPDM_144_WJJ___ { get; set; }
public string? _SWPDM_68_XM___ { get; set; }
//public string? _SWPDM_68_XM___ { get; set; }
public string? _SWPDM_69_XM_____ { get; set; }
//public string? _SWPDM_69_XM_____ { get; set; }
public string? _SWPDM_70_XM_____ { get; set; }
//public string? _SWPDM_70_XM_____ { get; set; }
public string? _SWPDM_1169_XM_____ { get; set; }
//public string? _SWPDM_1169_XM_____ { get; set; }
public string? _SWPDM_145_XM_____ { get; set; }
//public string? _SWPDM_145_XM_____ { get; set; }
public string? _SWPDM_146_XM_____ { get; set; }
//public string? _SWPDM_146_XM_____ { get; set; }
public string? _SWPDM_73_XM_____ { get; set; }
//public string? _SWPDM_73_XM_____ { get; set; }
public string? _SWPDM_74_XM_____ { get; set; }
//public string? _SWPDM_74_XM_____ { get; set; }
public string? _SWPDM_71_XM______ { get; set; }
//public string? _SWPDM_71_XM______ { get; set; }
public string? _SWPDM_72_XM____ { get; set; }
//public string? _SWPDM_72_XM____ { get; set; }
public string? _SWPDM_75_XM_____ { get; set; }
//public string? _SWPDM_75_XM_____ { get; set; }
public string? _SWPDM_1155_XM_________ { get; set; }
//public string? _SWPDM_1155_XM_________ { get; set; }
public string? _SWPDM_103___ { get; set; }
//public string? _SWPDM_103___ { get; set; }
public string? _SWPDM_104___ { get; set; }
//public string? _SWPDM_104___ { get; set; }
public string? _SWPDM_147_____ { get; set; }
//public string? _SWPDM_147_____ { get; set; }
public string? _SWPDM_1211_____ { get; set; }
//public string? _SWPDM_1211_____ { get; set; }
public string? _SWPDM_1212_______ { get; set; }
//public string? _SWPDM_1212_______ { get; set; }
public string? _SWPDM_107___ { get; set; }
//public string? _SWPDM_107___ { get; set; }
public string? _SWPDM_148_____ { get; set; }
//public string? _SWPDM_148_____ { get; set; }
public string? _SWPDM_108______ { get; set; }
//public string? _SWPDM_108______ { get; set; }
public string? _SWPDM_149_______ { get; set; }
//public string? _SWPDM_149_______ { get; set; }
public string? _SWPDM_110_______ { get; set; }
//public string? _SWPDM_110_______ { get; set; }
public string? _SWPDM_150________ { get; set; }
//public string? _SWPDM_150________ { get; set; }
public string? _SWPDM_151________ { get; set; }
//public string? _SWPDM_151________ { get; set; }
public string? _SWPDM_152________ { get; set; }
//public string? _SWPDM_152________ { get; set; }
public string? _SWPDM_109______ { get; set; }
//public string? _SWPDM_109______ { get; set; }
public string? _SWPDM_105___ { get; set; }
//public string? _SWPDM_105___ { get; set; }
public string? _SWPDM_106_____ { get; set; }
//public string? _SWPDM_106_____ { get; set; }
public string? _SWPDM_153_____ { get; set; }
//public string? _SWPDM_153_____ { get; set; }
public string? fld005529 { get; set; }

View File

@ -24,186 +24,190 @@ public class ProductDesignLibraryOutput
public bool? IsLatestVersion { get; set; }
public DateTime? CreatedDate { get; set; }
//public DateTime? CreatedDate { get; set; }
public DateTime? VersionCreatedDate { get; set; }
//public DateTime? VersionCreatedDate { get; set; }
public DateTime? dateModified { get; set; }
//public DateTime? dateModified { get; set; }
public long? UserCreatedId { get; set; }
//public long? UserCreatedId { get; set; }
public long? VersionUserCreatedId { get; set; }
//public long? VersionUserCreatedId { get; set; }
public long? UserModifiedId { get; set; }
//public long? UserModifiedId { get; set; }
public string? RecordGuid { get; set; }
public bool? isVisibilityNormal { get; set; }
//public bool? isVisibilityNormal { get; set; }
public bool? deleted { get; set; }
public string? SubObjectGuid { get; set; }
//public string? SubObjectGuid { get; set; }
public bool? PreviousStatus { get; set; }
//public bool? PreviousStatus { get; set; }
public string? revision { get; set; }
public byte[]? Record_image160_160 { get; set; }
//public byte[]? Record_image160_160 { get; set; }
public byte[]? Record_Image320_240 { get; set; }
//public byte[]? Record_Image320_240 { get; set; }
public byte[]? Record_ImageMax { get; set; }
//public byte[]? Record_ImageMax { get; set; }
public string? _System_objNBS { get; set; }
public string? _System_ObjDescription { get; set; }
public DateTime? _System_Effectivity_Begin { get; set; }
//public DateTime? _System_Effectivity_Begin { get; set; }
public DateTime? _System_Effectivity_End { get; set; }
//public DateTime? _System_Effectivity_End { get; set; }
public string? CheckedOutPc { get; set; }
//public string? CheckedOutPc { get; set; }
public long? StageId { get; set; }
//public long? StageId { get; set; }
public long? ProjectManager { get; set; }
//public long? ProjectManager { get; set; }
public long? ProjectManager_Rec { get; set; }
//public long? ProjectManager_Rec { get; set; }
public bool? EnableNotifications { get; set; }
//public bool? EnableNotifications { get; set; }
public long? GroupObjId { get; set; }
//public long? GroupObjId { get; set; }
public bool? _CheckOutInProgress { get; set; }
//public bool? _CheckOutInProgress { get; set; }
public string? ParentRecordGuid { get; set; }
//public string? ParentRecordGuid { get; set; }
public string? MaterialType { get; set; }
//public string? MaterialType { get; set; }
public bool? _System_NeedSWRebuild { get; set; }
//public bool? _System_NeedSWRebuild { get; set; }
public string? _system_objConfigurationName { get; set; }
//public string? _system_objConfigurationName { get; set; }
public bool? _system_objConfigurationType { get; set; }
//public bool? _system_objConfigurationType { get; set; }
public string? _system_objConfigurationGuid { get; set; }
//public string? _system_objConfigurationGuid { get; set; }
public string ShowBomFromConfiguration { get; set; }
//public string ShowBomFromConfiguration { get; set; }
public string _System_ObjNbsAuto { get; set; }
//public string _System_ObjNbsAuto { get; set; }
public long? PreviousIdRecord { get; set; }
//public long? PreviousIdRecord { get; set; }
public string? _System_DerivedFrom { get; set; }
//public string? _System_DerivedFrom { get; set; }
public bool? _system_objLinkedCompare { get; set; }
//public bool? _system_objLinkedCompare { get; set; }
public string? _System_WebLink { get; set; }
//public string? _System_WebLink { get; set; }
public bool? isReleasedVersion { get; set; }
//public bool? isReleasedVersion { get; set; }
public string? _System_DerivedFrom_RecordGuid { get; set; }
//public string? _System_DerivedFrom_RecordGuid { get; set; }
public long? SWPDMDocumentId { get; set; }
//public long? SWPDMDocumentId { get; set; }
public long? SWPDMConfigurationID { get; set; }
//public long? SWPDMConfigurationID { get; set; }
public string? SWPDMConfigurationName { get; set; }
//public string? SWPDMConfigurationName { get; set; }
public long? SWPDMActiveConfigurationId { get; set; }
//public long? SWPDMActiveConfigurationId { get; set; }
public string? SWPDMActiveConfigurationName { get; set; }
//public string? SWPDMActiveConfigurationName { get; set; }
public string? SWPDMFileName { get; set; }
//public string? SWPDMFileName { get; set; }
public long? SWPDMConfigPersistID { get; set; }
//public long? SWPDMConfigPersistID { get; set; }
public int? SWPDMStatusId { get; set; }
//public int? SWPDMStatusId { get; set; }
public string? SWPDMStatusName { get; set; }
//public string? SWPDMStatusName { get; set; }
public bool? _SWPDM_1179__SW_Detailing_Mode_ { get; set; }
//public bool? _SWPDM_1179__SW_Detailing_Mode_ { get; set; }
public string? _SWPDM_2__SW_Last_Saved_With_ { get; set; }
//public string? _SWPDM_2__SW_Last_Saved_With_ { get; set; }
public string? _SWPDM_111_A___ { get; set; }
//public string? _SWPDM_111_A___ { get; set; }
public string? _SWPDM_1172_BOM_BOM__ { get; set; }
//public string? _SWPDM_1172_BOM_BOM__ { get; set; }
public string? _SWPDM_112_BOM___2 { get; set; }
//public string? _SWPDM_112_BOM___2 { get; set; }
public string? _SWPDM_113_BOM___ { get; set; }
//public string? _SWPDM_113_BOM___ { get; set; }
public string? _SWPDM_115_BOM___ { get; set; }
//public string? _SWPDM_115_BOM___ { get; set; }
public string? _SWPDM_116_BOM___ { get; set; }
//public string? _SWPDM_116_BOM___ { get; set; }
public string? _SWPDM_117_BOM_____ { get; set; }
//public string? _SWPDM_117_BOM_____ { get; set; }
public string? _SWPDM_51_BOM_____ { get; set; }
//public string? _SWPDM_51_BOM_____ { get; set; }
public string? _SWPDM_118_BOM_____ { get; set; }
//public string? _SWPDM_118_BOM_____ { get; set; }
public string? _SWPDM_119_BOM___ { get; set; }
//public string? _SWPDM_119_BOM___ { get; set; }
public string? _SWPDM_114_BOM_____ { get; set; }
//public string? _SWPDM_114_BOM_____ { get; set; }
public string? _SWPDM_120_BOM______ { get; set; }
//public string? _SWPDM_120_BOM______ { get; set; }
public string? _SWPDM_121_BOM___ { get; set; }
//public string? _SWPDM_121_BOM___ { get; set; }
public string? _SWPDM_122_BOW___1 { get; set; }
//public string? _SWPDM_122_BOW___1 { get; set; }
public string? _SWPDM_123_BOW___ { get; set; }
//public string? _SWPDM_123_BOW___ { get; set; }
public string? _SWPDM_84_DWG___ { get; set; }
//public string? _SWPDM_84_DWG___ { get; set; }
public string? _SWPDM_82_DWG___ { get; set; }
//public string? _SWPDM_82_DWG___ { get; set; }
public string? _SWPDM_80_DWG_____ { get; set; }
//public string? _SWPDM_80_DWG_____ { get; set; }
public string? _SWPDM_76_DWG___ { get; set; }
//public string? _SWPDM_76_DWG___ { get; set; }
public string? _SWPDM_77_DWG___ { get; set; }
//public string? _SWPDM_77_DWG___ { get; set; }
public string? _SWPDM_78_DWG___ { get; set; }
//public string? _SWPDM_78_DWG___ { get; set; }
public string? _SWPDM_79_DWG___ { get; set; }
//public string? _SWPDM_79_DWG___ { get; set; }
public string? _SWPDM_83_DWG___ { get; set; }
//public string? _SWPDM_83_DWG___ { get; set; }
public string? _SWPDM_81_DWG___ { get; set; }
//public string? _SWPDM_81_DWG___ { get; set; }
public string? _SWPDM_92_FB___ { get; set; }
//public string? _SWPDM_92_FB___ { get; set; }
public string? _SWPDM_86_FB_____ { get; set; }
//public string? _SWPDM_86_FB_____ { get; set; }
public string? _SWPDM_87_FB_____ { get; set; }
//public string? _SWPDM_87_FB_____ { get; set; }
public string? _SWPDM_88_FB_____ { get; set; }
//public string? _SWPDM_88_FB_____ { get; set; }
public string? _SWPDM_89_FB_____ { get; set; }
//public string? _SWPDM_89_FB_____ { get; set; }
public string? _SWPDM_90_FB______ { get; set; }
//public string? _SWPDM_90_FB______ { get; set; }
public string? _SWPDM_85_FB____ { get; set; }
//public string? _SWPDM_85_FB____ { get; set; }
public string? _SWPDM_91_FB_____ { get; set; }
public string? _SWPDM_94_PDF___ { get; set; }
//public string? _SWPDM_91_FB_____ { get; set; }
//public string? _SWPDM_94_PDF___ { get; set; }
//public string? _SWPDM_101_PDF___ { get; set; }
public string? _SWPDM_95_PDF_____ { get; set; }
//public string? _SWPDM_95_PDF_____ { get; set; }
public string? _SWPDM_96_PDF___ { get; set; }
//public string? _SWPDM_96_PDF___ { get; set; }
//public string? _SWPDM_97_PDF___ { get; set; }
//public string? _SWPDM_98_PDF___ { get; set; }
public string? _SWPDM_93_PDF___ { get; set; }
//public string? _SWPDM_93_PDF___ { get; set; }
public string? _SWPDM_99_PDF___ { get; set; }
//public string? _SWPDM_99_PDF___ { get; set; }
//public string? _SWPDM_100_PDF___ { get; set; }
public string? _SWPDM_1194_q { get; set; }
//public string? _SWPDM_1194_q { get; set; }
public string? _SWPDM_1196_SAP_____ { get; set; }
@ -211,28 +215,28 @@ public class ProductDesignLibraryOutput
public string? _SWPDM_1187_SAP___ { get; set; }
public double? _SWPDM_1190_SAP___ { get; set; }
//public double? _SWPDM_1190_SAP___ { get; set; }
public string? _SWPDM_1191_SAP___ { get; set; }
//public string? _SWPDM_1191_SAP___ { get; set; }
public string? _SWPDM_1188_SAP___ { get; set; }
public string? _SWPDM_1197_SAP_____ { get; set; }
public string? _SWPDM_1210_SAP_____ { get; set; }
//public string? _SWPDM_1210_SAP_____ { get; set; }
public string? _SWPDM_1189_SAP___ID_____ { get; set; }
//public string? _SWPDM_1189_SAP___ID_____ { get; set; }
public string? _SWPDM_1200_SAP_____ { get; set; }
//public string? _SWPDM_1200_SAP_____ { get; set; }
public string? _SWPDM_1208_SAP___BOM___ { get; set; }
public string? _SWPDM_1201_SAP_____ { get; set; }
// public string? _SWPDM_1201_SAP_____ { get; set; }
public string? _SWPDM_1198_SAP_____ { get; set; }
public string? _SWPDM_1193_SAP___ { get; set; }
//public string? _SWPDM_1193_SAP___ { get; set; }
public string? _SWPDM_1195_SAP_____ { get; set; }
//public string? _SWPDM_1195_SAP_____ { get; set; }
public string? _SWPDM_1186_SAP_____ { get; set; }
@ -242,23 +246,27 @@ public class ProductDesignLibraryOutput
public string? _SWPDM_1185_SAP___ { get; set; }
public string? _SWPDM_1192_SAP_____ { get; set; }
//public string? _SWPDM_1192_SAP_____ { get; set; }
public string? _SWPDM_1184_SIP_____ { get; set; }
//public string? _SWPDM_1184_SIP_____ { get; set; }
public string? _SWPDM_1183_SIP_____ { get; set; }
//public string? _SWPDM_1183_SIP_____ { get; set; }
public string? _SWPDM_1182_SOP_____ { get; set; }
//public string? _SWPDM_1182_SOP_____ { get; set; }
public string? _SWPDM_1181_SOP_____ { get; set; }
//public string? _SWPDM_1181_SOP_____ { get; set; }
public string? _SWPDM_46_SW___ { get; set; }
//public string? _SWPDM_46_SW___ { get; set; }
public string? _SWPDM_60_SW___ { get; set; }
//public string? _SWPDM_60_SW___ { get; set; }
public string? _SWPDM_56_SW____ { get; set; }
//public string? _SWPDM_124_SW___ { get; set; }
public string? _SWPDM_57_SW______ { get; set; }
//public string? _SWPDM_102_SW___ { get; set; }
//public string? _SWPDM_56_SW____ { get; set; }
//public string? _SWPDM_57_SW______ { get; set; }
public string? _SWPDM_61_SW_____ { get; set; }
@ -268,180 +276,181 @@ public class ProductDesignLibraryOutput
public string? _SWPDM_126_SW___ { get; set; }
public string? _SWPDM_127_SW_____ { get; set; }
//public string? _SWPDM_127_SW_____ { get; set; }
public string? _SWPDM_1205_SW_______ { get; set; }
//public string? _SWPDM_1205_SW_______ { get; set; }
public string? _SWPDM_47_SW___ { get; set; }
//public string? _SWPDM_47_SW___ { get; set; }
public string? _SWPDM_48_SW_____ { get; set; }
//public string? _SWPDM_48_SW_____ { get; set; }
public string? _SWPDM_54_SW___ { get; set; }
//public string? _SWPDM_54_SW___ { get; set; }
public string? _SWPDM_55_SW_____ { get; set; }
//public string? _SWPDM_55_SW_____ { get; set; }
public string? _SWPDM_66_SW___ { get; set; }
//public string? _SWPDM_66_SW___ { get; set; }
public string? _SWPDM_154_SW_____ { get; set; }
//public string? _SWPDM_154_SW_____ { get; set; }
public string? _SWPDM_63_SW___ { get; set; }
//public string? _SWPDM_63_SW___ { get; set; }
public string? _SWPDM_64_SW___ { get; set; }
public string? _SWPDM_65_SW___ { get; set; }
public string? _SWPDM_128_SW_____ { get; set; }
//public string? _SWPDM_128_SW_____ { get; set; }
public string? _SWPDM_1206_SW_______ { get; set; }
//public string? _SWPDM_1206_SW_______ { get; set; }
public string? _SWPDM_52_SW___ { get; set; }
//public string? _SWPDM_52_SW___ { get; set; }
public string? _SWPDM_53_SW_____ { get; set; }
//public string? _SWPDM_53_SW_____ { get; set; }
public string? _SWPDM_58_SW___ { get; set; }
//public string? _SWPDM_58_SW___ { get; set; }
public string? _SWPDM_59_SW_____ { get; set; }
//public string? _SWPDM_59_SW_____ { get; set; }
public string? _SWPDM_1178_SW_____ { get; set; }
//public string? _SWPDM_1178_SW_____ { get; set; }
public string? _SWPDM_1202_SW_____ { get; set; }
//public string? _SWPDM_1202_SW_____ { get; set; }
//public string? _SWPDM_49_SW___ { get; set; }
public string? _SWPDM_129_SW_____ { get; set; }
//public string? _SWPDM_129_SW_____ { get; set; }
public string? _SWPDM_1207_SW_______ { get; set; }
//public string? _SWPDM_1207_SW_______ { get; set; }
public string? _SWPDM_130_SW___ { get; set; }
//public string? _SWPDM_130_SW___ { get; set; }
public string? _SWPDM_50_SW_____ { get; set; }
//public string? _SWPDM_50_SW_____ { get; set; }
public string? _SWPDM_131_SW_____ { get; set; }
//public string? _SWPDM_131_SW_____ { get; set; }
public string? _SWPDM_155_SW_____ { get; set; }
//public string? _SWPDM_155_SW_____ { get; set; }
public string? _SWPDM_1175_SW_____ { get; set; }
//public string? _SWPDM_1175_SW_____ { get; set; }
public string? _SWPDM_1177_SW_____ { get; set; }
//public string? _SWPDM_1177_SW_____ { get; set; }
public string? _SWPDM_1170_SW___ { get; set; }
//public string? _SWPDM_1170_SW___ { get; set; }
public string? _SWPDM_1171_SW_____ { get; set; }
//public string? _SWPDM_1171_SW_____ { get; set; }
public string? _SWPDM_1173_SW____ { get; set; }
//public string? _SWPDM_1173_SW____ { get; set; }
public string? _SWPDM_132_SW_____ { get; set; }
//public string? _SWPDM_132_SW_____ { get; set; }
public string? _SWPDM_1204_SW_______ { get; set; }
//public string? _SWPDM_1204_SW_______ { get; set; }
public string? _SWPDM_133_SW____ { get; set; }
//public string? _SWPDM_133_SW____ { get; set; }
public string? _SWPDM_67_SW___ { get; set; }
//public string? _SWPDM_67_SW___ { get; set; }
public string? _SWPDM_1174_SW___ { get; set; }
//public string? _SWPDM_1174_SW___ { get; set; }
public string? _SWPDM_1168_TEMP_____ { get; set; }
//public string? _SWPDM_1168_TEMP_____ { get; set; }
public string? _SWPDM_1167_TEMP_____ { get; set; }
//public string? _SWPDM_1167_TEMP_____ { get; set; }
public string? _SWPDM_1166_TEMP_____ { get; set; }
//public string? _SWPDM_1166_TEMP_____ { get; set; }
public string? _SWPDM_1165_TEMP____ { get; set; }
//public string? _SWPDM_1165_TEMP____ { get; set; }
public string? _SWPDM_1164_TEMP_______ { get; set; }
//public string? _SWPDM_1164_TEMP_______ { get; set; }
public string? _SWPDM_1163_TEMP_______ { get; set; }
//public string? _SWPDM_1163_TEMP_______ { get; set; }
public string? _SWPDM_1162_TEMP_____ { get; set; }
//public string? _SWPDM_1162_TEMP_____ { get; set; }
public string? _SWPDM_1161_TEMP_____ { get; set; }
//public string? _SWPDM_1161_TEMP_____ { get; set; }
public string? _SWPDM_1160_TEMP_______ { get; set; }
//public string? _SWPDM_1160_TEMP_______ { get; set; }
public string? _SWPDM_1159_TEMP_______ { get; set; }
//public string? _SWPDM_1159_TEMP_______ { get; set; }
public string? _SWPDM_1176_TEMP_____ { get; set; }
//public string? _SWPDM_1176_TEMP_____ { get; set; }
public string? _SWPDM_1158_TEMP____ { get; set; }
//public string? _SWPDM_1158_TEMP____ { get; set; }
public string? _SWPDM_134_TY___ { get; set; }
//public string? _SWPDM_134_TY___ { get; set; }
public string? _SWPDM_135_TY______ { get; set; }
//public string? _SWPDM_135_TY______ { get; set; }
public string? _SWPDM_136_TY_____ { get; set; }
//public string? _SWPDM_136_TY_____ { get; set; }
public string? _SWPDM_137_TY_____ { get; set; }
//public string? _SWPDM_137_TY_____ { get; set; }
public string? _SWPDM_138_TY_____ { get; set; }
//public string? _SWPDM_138_TY_____ { get; set; }
public string? _SWPDM_139_WD_____ { get; set; }
//public string? _SWPDM_139_WD_____ { get; set; }
public string? _SWPDM_140_WD____ { get; set; }
//public string? _SWPDM_140_WD____ { get; set; }
public string? _SWPDM_141_WD___ { get; set; }
//public string? _SWPDM_141_WD___ { get; set; }
public string? _SWPDM_142_WJJ_____ { get; set; }
//public string? _SWPDM_142_WJJ_____ { get; set; }
public string? _SWPDM_143_WJJ____ { get; set; }
//public string? _SWPDM_143_WJJ____ { get; set; }
public string? _SWPDM_144_WJJ___ { get; set; }
//public string? _SWPDM_144_WJJ___ { get; set; }
public string? _SWPDM_68_XM___ { get; set; }
//public string? _SWPDM_68_XM___ { get; set; }
public string? _SWPDM_69_XM_____ { get; set; }
//public string? _SWPDM_69_XM_____ { get; set; }
public string? _SWPDM_70_XM_____ { get; set; }
//public string? _SWPDM_70_XM_____ { get; set; }
public string? _SWPDM_1169_XM_____ { get; set; }
//public string? _SWPDM_1169_XM_____ { get; set; }
public string? _SWPDM_145_XM_____ { get; set; }
//public string? _SWPDM_145_XM_____ { get; set; }
public string? _SWPDM_146_XM_____ { get; set; }
//public string? _SWPDM_146_XM_____ { get; set; }
public string? _SWPDM_73_XM_____ { get; set; }
//public string? _SWPDM_73_XM_____ { get; set; }
public string? _SWPDM_74_XM_____ { get; set; }
//public string? _SWPDM_74_XM_____ { get; set; }
public string? _SWPDM_71_XM______ { get; set; }
//public string? _SWPDM_71_XM______ { get; set; }
public string? _SWPDM_72_XM____ { get; set; }
//public string? _SWPDM_72_XM____ { get; set; }
public string? _SWPDM_75_XM_____ { get; set; }
//public string? _SWPDM_75_XM_____ { get; set; }
public string? _SWPDM_1155_XM_________ { get; set; }
//public string? _SWPDM_1155_XM_________ { get; set; }
public string? _SWPDM_103___ { get; set; }
//public string? _SWPDM_103___ { get; set; }
public string? _SWPDM_104___ { get; set; }
//public string? _SWPDM_104___ { get; set; }
public string? _SWPDM_147_____ { get; set; }
//public string? _SWPDM_147_____ { get; set; }
public string? _SWPDM_1211_____ { get; set; }
//public string? _SWPDM_1211_____ { get; set; }
public string? _SWPDM_1212_______ { get; set; }
//public string? _SWPDM_1212_______ { get; set; }
public string? _SWPDM_107___ { get; set; }
//public string? _SWPDM_107___ { get; set; }
public string? _SWPDM_148_____ { get; set; }
//public string? _SWPDM_148_____ { get; set; }
public string? _SWPDM_108______ { get; set; }
//public string? _SWPDM_108______ { get; set; }
public string? _SWPDM_149_______ { get; set; }
//public string? _SWPDM_149_______ { get; set; }
public string? _SWPDM_110_______ { get; set; }
//public string? _SWPDM_110_______ { get; set; }
public string? _SWPDM_150________ { get; set; }
//public string? _SWPDM_150________ { get; set; }
public string? _SWPDM_151________ { get; set; }
//public string? _SWPDM_151________ { get; set; }
public string? _SWPDM_152________ { get; set; }
//public string? _SWPDM_152________ { get; set; }
public string? _SWPDM_109______ { get; set; }
//public string? _SWPDM_109______ { get; set; }
public string? _SWPDM_105___ { get; set; }
//public string? _SWPDM_105___ { get; set; }
public string? _SWPDM_106_____ { get; set; }
//public string? _SWPDM_106_____ { get; set; }
public string? _SWPDM_153_____ { get; set; }
//public string? _SWPDM_153_____ { get; set; }
public string? fld005529 { get; set; }
@ -466,6 +475,7 @@ public class ProductDesignLibraryOutput
public DateTime? fld005539 { get; set; }
public DateTime? fld005540 { get; set; }
public int? fld005678 { get; set; }
public int? fld005679 { get; set; }
public string? fld005679_Rec { get; set; }

View File

@ -10,6 +10,8 @@ using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -34,13 +36,15 @@ public class ProductionMaterialsManagementService : IDynamicApiController, ITran
public SapService.SapService _sapService;
private readonly SqlSugarRepository<Configurations> _configurationsRep;
private readonly SqlSugarRepository<ConfigurationData> _configurationDataRep;
private readonly IServiceScopeFactory _scopeFactory;
public ProductionMaterialsManagementService(
SqlSugarRepository<Obj112> obj112Rep,
SysConfigService sysConfigService,
SapService.SapService sapService,
SqlSugarRepository<Configurations> configurationsRep,
SqlSugarRepository<ConfigurationData> configurationDataRep
SqlSugarRepository<ConfigurationData> configurationDataRep,
IServiceScopeFactory scopeFactory
)
{
_obj112Rep = obj112Rep;
@ -48,6 +52,7 @@ public class ProductionMaterialsManagementService : IDynamicApiController, ITran
_sapService = sapService;
_configurationsRep = configurationsRep;
_configurationDataRep = configurationDataRep;
_scopeFactory = scopeFactory;
}
/// <summary>
/// 分页查询生产物料管理
@ -175,16 +180,20 @@ public class ProductionMaterialsManagementService : IDynamicApiController, ITran
[DisplayName("生产物料管理-批量同步到SAP")]
public async Task<List<SapOutput>> BatchSyncToSAP(List<ProductionMaterialsManagementInput> input)
{
using var serviceScope = _scopeFactory.CreateScope();
var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
const string lengthError = "物料描述长度大于40请检查";
const string synchronized = "该项目编号已同步或已停用!";
var SapOutputList = new List<SapOutput>();
var Requser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
for (int i = 0; i < input.Count; i++)
var tasks = input.Select(async item =>
{
// 验证物料描述长度
if (input[i].fld004598.Length > 40)
if (item.fld004598.Length > 40)
{
await _obj112Rep.AsUpdateable()
db.CopyNew().Updateable<Obj112>()
.SetColumns(it => new Obj112
{
fld004606 = DateTime.Now,
@ -192,29 +201,29 @@ public class ProductionMaterialsManagementService : IDynamicApiController, ITran
fld004605 = lengthError,
fld004604 = "失败"
})
.Where(it => it.idRecord == input[i].idRecord)
.ExecuteCommandAsync().ConfigureAwait(false);
.Where(it => it.idRecord == item.idRecord)
.ExecuteCommand();
SapOutputList.Add(new SapOutput()
return new SapOutput
{
materialCode = input[i]._System_objNBS,
materialCode = item._System_objNBS,
code = "失败",
msg = lengthError,
result = lengthError
});
continue;
};
}
if (input[i].fld004607 == "N" || input[i].fld004607 == "D" || input[i].fld004607 == null)
if (item.fld004607 == "N" || item.fld004607 == "D" || item.fld004607 == null)
{
SapOutputList.Add(new SapOutput()
return new SapOutput
{
materialCode = input[i]._System_objNBS,
materialCode = item._System_objNBS,
code = "失败",
msg = synchronized,
result = synchronized
});
continue;
};
}
//获取时间戳精确到毫秒sap要求每次调用生成不重复guid
string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
var sapMaterialInput = new SapMaterialInput()
@ -229,27 +238,27 @@ public class ProductionMaterialsManagementService : IDynamicApiController, ITran
Note2 = "",
Note3 = "",
Zwbid = millisecondTimestamp,
Matnr = input[i]._System_objNBS,
Mbrsh = input[i].fld004595,
Mtart = input[i].fld004596,
Maktx = input[i].fld004598,
Meins = input[i].fld004594,
Matkl = input[i].fld004599,
Bismt = input[i]._System_ObjDescription,
Groes = input[i].fld005323,
Normt = input[i].fld004592,
Ferth = input[i].fld004593,
Zeinr = input[i].fld004903,
Mstae = input[i].fld004696,
Raube = input[i].fld004904,
Mhdrz = input[i].fld004905.ToString(),
Mhdhb = input[i].fld004907.ToString(),
Werks = input[i].fld004597,
Beskz = input[i].fld004600,
Sobsl = input[i].fld004601,
Schgt = input[i].fld004602,
Rgekz = input[i].fld004603,
Zbom = input[i].fld004695
Matnr = item._System_objNBS,
Mbrsh = item.fld004595,
Mtart = item.fld004596,
Maktx = item.fld004598,
Meins = item.fld004594,
Matkl = item.fld004599,
Bismt = item._System_ObjDescription,
Groes = item.fld005323,
Normt = item.fld004592,
Ferth = item.fld004593,
Zeinr = item.fld004903,
Mstae = item.fld004696,
Raube = item.fld004904,
Mhdrz = item.fld004905.ToString(),
Mhdhb = item.fld004907.ToString(),
Werks = item.fld004597,
Beskz = item.fld004600,
Sobsl = item.fld004601,
Schgt = item.fld004602,
Rgekz = item.fld004603,
Zbom = item.fld004695
};
var sapOutput = await _sapService.SapMaterialApi(sapMaterialInput);
string codeVal = sapOutput.code == "S" ? "成功" : "失败";
@ -259,7 +268,7 @@ public class ProductionMaterialsManagementService : IDynamicApiController, ITran
{
msg = "同步成功";
}
await _obj112Rep.AsUpdateable()
db.CopyNew().Updateable<Obj112>()
.SetColumns(it => new Obj112
{
fld004606 = DateTime.Now,
@ -267,19 +276,122 @@ public class ProductionMaterialsManagementService : IDynamicApiController, ITran
fld004607 = "N",
fld004605 = msg
})
.Where(it => it.idRecord == input[i].idRecord)
.ExecuteCommandAsync();
var output = new SapOutput()
.Where(it => it.idRecord == item.idRecord)
.ExecuteCommand();
return new SapOutput()
{
parameter = sapOutput.parameter,
materialCode = input[0]._System_objNBS,
materialCode = item._System_objNBS,
code = codeVal,
msg = msg,
result = sapOutput.result
};
SapOutputList.Add(output);
}
return SapOutputList;
});
var materialOutput = await Task.WhenAll(tasks);
return materialOutput.ToList();
//for (int i = 0; i < input.Count; i++)
//{
// // 验证物料描述长度
// if (input[i].fld004598.Length > 40)
// {
// await _obj112Rep.AsUpdateable()
// .SetColumns(it => new Obj112
// {
// fld004606 = DateTime.Now,
// fld004607 = "N",
// fld004605 = lengthError,
// fld004604 = "失败"
// })
// .Where(it => it.idRecord == input[i].idRecord)
// .ExecuteCommandAsync().ConfigureAwait(false);
// SapOutputList.Add(new SapOutput()
// {
// materialCode = input[i]._System_objNBS,
// code = "失败",
// msg = lengthError,
// result = lengthError
// });
// continue;
// }
// if (input[i].fld004607 == "N" || input[i].fld004607 == "D" || input[i].fld004607 == null)
// {
// SapOutputList.Add(new SapOutput()
// {
// materialCode = input[i]._System_objNBS,
// code = "失败",
// msg = synchronized,
// result = synchronized
// });
// continue;
// }
// //获取时间戳精确到毫秒sap要求每次调用生成不重复guid
// string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
// var sapMaterialInput = new SapMaterialInput()
// {
// Reqkeyid = "",
// Businessid = "",
// Messageid = "",
// Sndprn = "PLM",
// Rcvprn = "SAP",
// Requser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName),
// Note1 = "",
// Note2 = "",
// Note3 = "",
// Zwbid = millisecondTimestamp,
// Matnr = input[i]._System_objNBS,
// Mbrsh = input[i].fld004595,
// Mtart = input[i].fld004596,
// Maktx = input[i].fld004598,
// Meins = input[i].fld004594,
// Matkl = input[i].fld004599,
// Bismt = input[i]._System_ObjDescription,
// Groes = input[i].fld005323,
// Normt = input[i].fld004592,
// Ferth = input[i].fld004593,
// Zeinr = input[i].fld004903,
// Mstae = input[i].fld004696,
// Raube = input[i].fld004904,
// Mhdrz = input[i].fld004905.ToString(),
// Mhdhb = input[i].fld004907.ToString(),
// Werks = input[i].fld004597,
// Beskz = input[i].fld004600,
// Sobsl = input[i].fld004601,
// Schgt = input[i].fld004602,
// Rgekz = input[i].fld004603,
// Zbom = input[i].fld004695
// };
// var sapOutput = await _sapService.SapMaterialApi(sapMaterialInput);
// string codeVal = sapOutput.code == "S" ? "成功" : "失败";
// string msg = sapOutput.msg;
// if (sapOutput.msg == "")
// {
// msg = "同步成功";
// }
// await _obj112Rep.AsUpdateable()
// .SetColumns(it => new Obj112
// {
// fld004606 = DateTime.Now,
// fld004604 = codeVal,
// fld004607 = "N",
// fld004605 = msg
// })
// .Where(it => it.idRecord == input[i].idRecord)
// .ExecuteCommandAsync();
// var output = new SapOutput()
// {
// parameter = sapOutput.parameter,
// materialCode = input[0]._System_objNBS,
// code = codeVal,
// msg = msg,
// result = sapOutput.result
// };
// SapOutputList.Add(output);
//}
//return SapOutputList;
}
/// <summary>
@ -291,18 +403,22 @@ public class ProductionMaterialsManagementService : IDynamicApiController, ITran
[AllowAnonymous]
public async Task<List<SapOutput>> TimingSyncToSAP()
{
var input = await _obj112Rep.AsQueryable()
using var serviceScope = _scopeFactory.CreateScope();
var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var input = db.Queryable<Obj112>()
.Where(x => (x.CheckedStatus == 7 || x.CheckedStatus == 8) && x.deleted == false && x.IsLatestVersion == true && (x.fld004607 == "A" || x.fld004607 == "M") && x.fld004973 == "发布")
.ToListAsync();
.ToList();
const string lengthError = "物料描述长度大于40请检查";
var SapOutputList = new List<SapOutput>();
var Requser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
for (int i = 0; i < input.Count; i++)
var tasks = input.Select(async item =>
{
// 验证物料描述长度
if (input[i].fld004598.Length > 40)
if (item.fld004598.Length > 40)
{
await _obj112Rep.AsUpdateable()
db.CopyNew().Updateable<Obj112>()
.SetColumns(it => new Obj112
{
fld004606 = DateTime.Now,
@ -310,17 +426,16 @@ public class ProductionMaterialsManagementService : IDynamicApiController, ITran
fld004605 = lengthError,
fld004604 = "失败"
})
.Where(it => it.idRecord == input[i].idRecord)
.ExecuteCommandAsync().ConfigureAwait(false);
.Where(it => it.idRecord == item.idRecord)
.ExecuteCommand();
SapOutputList.Add(new SapOutput()
return new SapOutput
{
materialCode = input[i]._System_objNBS,
materialCode = item._System_objNBS,
code = "失败",
msg = lengthError,
result = lengthError
});
continue;
};
}
//获取时间戳精确到毫秒sap要求每次调用生成不重复guid
@ -337,27 +452,27 @@ public class ProductionMaterialsManagementService : IDynamicApiController, ITran
Note2 = "",
Note3 = "",
Zwbid = millisecondTimestamp,
Matnr = input[i]._System_objNBS,
Mbrsh = input[i].fld004595,
Mtart = input[i].fld004596,
Maktx = input[i].fld004598,
Meins = input[i].fld004594,
Matkl = input[i].fld004599,
Bismt = input[i]._System_ObjDescription,
Groes = input[i].fld005323,
Normt = input[i].fld004592,
Ferth = input[i].fld004593,
Zeinr = input[i].fld004903,
Mstae = input[i].fld004696,
Raube = input[i].fld004904,
Mhdrz = input[i].fld004905.ToString(),
Mhdhb = input[i].fld004907.ToString(),
Werks = input[i].fld004597,
Beskz = input[i].fld004600,
Sobsl = input[i].fld004601,
Schgt = input[i].fld004602,
Rgekz = input[i].fld004603,
Zbom = input[i].fld004695
Matnr = item._System_objNBS,
Mbrsh = item.fld004595,
Mtart = item.fld004596,
Maktx = item.fld004598,
Meins = item.fld004594,
Matkl = item.fld004599,
Bismt = item._System_ObjDescription,
Groes = item.fld005323,
Normt = item.fld004592,
Ferth = item.fld004593,
Zeinr = item.fld004903,
Mstae = item.fld004696,
Raube = item.fld004904,
Mhdrz = item.fld004905.ToString(),
Mhdhb = item.fld004907.ToString(),
Werks = item.fld004597,
Beskz = item.fld004600,
Sobsl = item.fld004601,
Schgt = item.fld004602,
Rgekz = item.fld004603,
Zbom = item.fld004695
};
var sapOutput = await _sapService.SapMaterialApi(sapMaterialInput);
string codeVal = sapOutput.code == "S" ? "成功" : "失败";
@ -367,7 +482,7 @@ public class ProductionMaterialsManagementService : IDynamicApiController, ITran
{
msg = "同步成功";
}
await _obj112Rep.AsUpdateable()
db.CopyNew().Updateable<Obj112>()
.SetColumns(it => new Obj112
{
fld004606 = DateTime.Now,
@ -375,20 +490,114 @@ public class ProductionMaterialsManagementService : IDynamicApiController, ITran
fld004607 = "N",
fld004605 = msg
})
.Where(it => it.idRecord == input[i].idRecord)
.ExecuteCommandAsync();
var output = new SapOutput()
.Where(it => it.idRecord == item.idRecord)
.ExecuteCommand();
return new SapOutput()
{
parameter = sapOutput.parameter,
materialCode = input[0]._System_objNBS,
materialCode = item._System_objNBS,
code = codeVal,
msg = msg,
result = sapOutput.result
};
SapOutputList.Add(output);
}
return SapOutputList;
});
var materialOutput = await Task.WhenAll(tasks);
return materialOutput.ToList();
//for (int i = 0; i < input.Count; i++)
//{
// // 验证物料描述长度
// if (input[i].fld004598.Length > 40)
// {
// await _obj112Rep.AsUpdateable()
// .SetColumns(it => new Obj112
// {
// fld004606 = DateTime.Now,
// fld004607 = "N",
// fld004605 = lengthError,
// fld004604 = "失败"
// })
// .Where(it => it.idRecord == input[i].idRecord)
// .ExecuteCommandAsync().ConfigureAwait(false);
// SapOutputList.Add(new SapOutput()
// {
// materialCode = input[i]._System_objNBS,
// code = "失败",
// msg = lengthError,
// result = lengthError
// });
// continue;
// }
// //获取时间戳精确到毫秒sap要求每次调用生成不重复guid
// string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
// var sapMaterialInput = new SapMaterialInput()
// {
// Reqkeyid = "",
// Businessid = "",
// Messageid = "",
// Sndprn = "PLM",
// Rcvprn = "SAP",
// Requser = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName),
// Note1 = "",
// Note2 = "",
// Note3 = "",
// Zwbid = millisecondTimestamp,
// Matnr = input[i]._System_objNBS,
// Mbrsh = input[i].fld004595,
// Mtart = input[i].fld004596,
// Maktx = input[i].fld004598,
// Meins = input[i].fld004594,
// Matkl = input[i].fld004599,
// Bismt = input[i]._System_ObjDescription,
// Groes = input[i].fld005323,
// Normt = input[i].fld004592,
// Ferth = input[i].fld004593,
// Zeinr = input[i].fld004903,
// Mstae = input[i].fld004696,
// Raube = input[i].fld004904,
// Mhdrz = input[i].fld004905.ToString(),
// Mhdhb = input[i].fld004907.ToString(),
// Werks = input[i].fld004597,
// Beskz = input[i].fld004600,
// Sobsl = input[i].fld004601,
// Schgt = input[i].fld004602,
// Rgekz = input[i].fld004603,
// Zbom = input[i].fld004695
// };
// var sapOutput = await _sapService.SapMaterialApi(sapMaterialInput);
// string codeVal = sapOutput.code == "S" ? "成功" : "失败";
// string msg = sapOutput.msg;
// if (sapOutput.msg == "")
// {
// msg = "同步成功";
// }
// await _obj112Rep.AsUpdateable()
// .SetColumns(it => new Obj112
// {
// fld004606 = DateTime.Now,
// fld004604 = codeVal,
// fld004607 = "N",
// fld004605 = msg
// })
// .Where(it => it.idRecord == input[i].idRecord)
// .ExecuteCommandAsync();
// var output = new SapOutput()
// {
// parameter = sapOutput.parameter,
// materialCode = input[0]._System_objNBS,
// code = codeVal,
// msg = msg,
// result = sapOutput.result
// };
// SapOutputList.Add(output);
//}
//return SapOutputList;
}
}

View File

@ -6,6 +6,7 @@ using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
using RazorEngine;
@ -423,10 +424,12 @@ public class ProjectManagementService : IDynamicApiController, ITransient
/// <returns></returns>
[ApiDescriptionSettings(Name = "TimingSyncToSAP"), HttpGet]
[DisplayName("项目管理-定时同步到SAP")]
[AllowAnonymous]
public async Task<List<SapOutput>> TimingSyncToSAP()
{
var input = await _obj109Rep.AsQueryable()
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var input = await db.CopyNew().Queryable<Obj109>()
.Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1) && x.deleted == false && x.IsLatestVersion == true && x.fld005040 == "发布" && (x.fld004510 == "A" || x.fld004510 == "M"))
.ToListAsync();
const string lengthError = "物料描述长度大于40请检查";
@ -437,7 +440,7 @@ public class ProjectManagementService : IDynamicApiController, ITransient
// 验证物料描述长度
if (input[i].fld004502.Length > 40)
{
await _obj109Rep.AsUpdateable()
db.CopyNew().Updateable<Obj109>()
.SetColumns(it => new Obj109
{
fld004508 = DateTime.Now,
@ -446,7 +449,7 @@ public class ProjectManagementService : IDynamicApiController, ITransient
fld004509 = "失败"
})
.Where(it => it.idRecord == input[i].idRecord)
.ExecuteCommandAsync().ConfigureAwait(false);
.ExecuteCommand();
SapOutputList.Add(new SapOutput()
{
@ -502,7 +505,7 @@ public class ProjectManagementService : IDynamicApiController, ITransient
{
msg = "同步成功";
}
await _obj109Rep.AsUpdateable()
db.CopyNew().Updateable<Obj109>()
.SetColumns(it => new Obj109
{
fld004508 = DateTime.Now,
@ -511,7 +514,7 @@ public class ProjectManagementService : IDynamicApiController, ITransient
fld004507 = msg
})
.Where(it => it.idRecord == input[i].idRecord)
.ExecuteCommandAsync();
.ExecuteCommand();
var output = new SapOutput()
{
parameter = sapOutput.parameter,
@ -535,12 +538,13 @@ public class ProjectManagementService : IDynamicApiController, ITransient
[AllowAnonymous]
public async Task<List<SapOutput>> TimingSyncToSAPBom()
{
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var sapOutputList = new List<SapOutput>();
var sapUserName = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
// 配置
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 109 && x.ConfigSystemName == "mBOM").FirstAsync();
var materialData = await _obj109Rep.AsQueryable()
var materialData = await db.CopyNew().Queryable<Obj109>()
.Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1) && x.deleted == false && x.IsLatestVersion == true && x.fld005040 == "发布" && x.fld004510 == "N" && x.fld004509 == "成功" && (x.fld004514 == "A" || x.fld004514 == "M"))
.ToListAsync();
var groupedData = materialData.GroupBy(item => item.RecordGuid)
@ -554,14 +558,14 @@ public class ProjectManagementService : IDynamicApiController, ITransient
// 获取 ECN guid
var ecnGuid = item.fld004947_Rec;
// 查询 BOM
var bomData = await _configurationDataRep.AsQueryable()
.Where(x => x.ConfigId == configid.ConfigID && x.ParentGuid == item.RecordGuid && x.isDeleted == false && x.ParentVersion == versionIndex).ToListAsync();
var bomData = await db.CopyNew().Queryable<ConfigurationData>()
.Where(x => x.ConfigId == 2 && x.ParentGuid == item.RecordGuid && x.isDeleted == false && x.ParentVersion == versionIndex).ToListAsync();
if (bomData.Count == 0)
{
continue;
}
// 查询 ECN 编码
var ecnData = await _obj118Rep.AsQueryable().Where(x => x.RecordGuid == ecnGuid && x.deleted == false).OrderByDescending(x => x.VersionIndex).FirstAsync();
var ecnData = await db.CopyNew().Queryable<Obj118>().Where(x => x.RecordGuid == ecnGuid && x.deleted == false).OrderByDescending(x => x.VersionIndex).FirstAsync();
var ecn = ecnData != null ? ecnData._System_objNBS : "";
var itemDataList = new List<ItemData>();
@ -613,7 +617,7 @@ public class ProjectManagementService : IDynamicApiController, ITransient
var apiOutput = await _sapService.SapBomApi(isreq);
string codeVal = apiOutput.code == "S" ? "成功" : "失败";
await _obj109Rep.AsUpdateable()
db.CopyNew().Updateable<Obj109>()
.SetColumns(it => new Obj109
{
fld004513 = DateTime.Now,
@ -622,7 +626,7 @@ public class ProjectManagementService : IDynamicApiController, ITransient
fld004512 = apiOutput.msg
})
.Where(it => it.idRecord == item.idRecord)
.ExecuteCommandAsync();
.ExecuteCommand();
var msg = apiOutput.msg;
if (string.IsNullOrEmpty(msg))
@ -761,16 +765,17 @@ public class ProjectManagementService : IDynamicApiController, ITransient
/// <returns></returns>
[ApiDescriptionSettings(Name = "TimingSyncToSAPProcessRoute"), HttpGet]
[DisplayName("项目管理-定时同步工艺路线到SAP")]
[AllowAnonymous]
public async Task<List<SapOutput>> TimingSyncToSAPProcessRoute()
{
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var sapOutputList = new List<SapOutput>();
var sapUserName = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
// 配置
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 109 && x.ConfigSystemName == "pBOM").FirstAsync();
//查询需要同步的产品
var materialData = await _obj109Rep.AsQueryable()
var materialData = await db.CopyNew().Queryable<Obj109>()
.Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1) && x.deleted == false && x.IsLatestVersion == true && x.fld005040 == "发布" && x.fld004510 == "N" && x.fld004509 == "成功" && (x.fld004514 == "A" || x.fld004514 == "M"))
.ToListAsync();
//分组查询最大版本的物料
@ -783,8 +788,8 @@ public class ProjectManagementService : IDynamicApiController, ITransient
// 获取版本号
var versionIndex = item.VersionIndex;
// 查询 BOM
var processRouteData = await _configurationDataRep.AsQueryable()
.Where(x => x.ConfigId == configid.ConfigID && x.ParentGuid == item.RecordGuid && x.isDeleted == false && x.ParentVersion == versionIndex).ToListAsync();
var processRouteData = await db.CopyNew().Queryable<ConfigurationData>()
.Where(x => x.ConfigId == 5 && x.ParentGuid == item.RecordGuid && x.isDeleted == false && x.ParentVersion == versionIndex).ToListAsync();
if (processRouteData.Count == 0)
{
continue;
@ -799,9 +804,9 @@ public class ProjectManagementService : IDynamicApiController, ITransient
continue;
}
//获取工序描述
var procedureDescription = await _obj122Rep.AsQueryable().Where(x => x.RecordGuid == processRouteItem.ChildGuid).ToListAsync();
var procedureDescription = await db.CopyNew().Queryable<Obj122>().Where(x => x.RecordGuid == processRouteItem.ChildGuid).ToListAsync();
//获取工作中心
var workCenter = await _obj121Rep.AsQueryable().Where(x => x.RecordGuid == procedureDescription[0].fld005059_Rec).ToListAsync();
var workCenter = await db.CopyNew().Queryable<Obj121>().Where(x => x.RecordGuid == procedureDescription[0].fld005059_Rec).ToListAsync();
var itemData = new SapProcessRouteItemData()
{
VORNR = processRouteItem.Marker,
@ -846,7 +851,7 @@ public class ProjectManagementService : IDynamicApiController, ITransient
var apiOutput = await _sapService.SapProcessRouteApi(isreq);
string codeVal = apiOutput.code == "S" ? "成功" : "失败";
await _obj109Rep.AsUpdateable()
db.CopyNew().Updateable<Obj109>()
.SetColumns(it => new Obj109
{
fld004518 = DateTime.Now,
@ -855,7 +860,7 @@ public class ProjectManagementService : IDynamicApiController, ITransient
fld004516 = apiOutput.msg
})
.Where(it => it.idRecord == item.idRecord)
.ExecuteCommandAsync();
.ExecuteCommand();
var msg = apiOutput.msg;
if (apiOutput.msg == "")
{
@ -881,9 +886,8 @@ public class ProjectManagementService : IDynamicApiController, ITransient
public async Task<List<SapOutput>> WbsInSapCreate()
{
using var serviceScope = _scopeFactory.CreateScope();
var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var syncData = db.Queryable<Obj109>()
var syncData = await db.CopyNew().Queryable<Obj109>()
.InnerJoin<CasesStagesMain>((x, y) => x.RecordGuid == y.RecordGuid)
.InnerJoin<Obj126>((x, y, z) => y.ChildRecordGuid == z.RecordGuid)
.Where((x, y) => x.deleted == false && x.fld006774 == "A" && (x.fld006993 == "" || x.fld006993 == null) && (x.CheckedStatus == 0 || x.CheckedStatus == 1) && y.indentLevel < 4)
@ -908,7 +912,7 @@ public class ProjectManagementService : IDynamicApiController, ITransient
System_objNBS109 = x._System_objNBS
})
.ToList();
.ToListAsync();
var syncList = syncData.GroupBy(record => record.RecordGuid)
.Select(group => new
{
@ -1157,9 +1161,13 @@ public class ProjectManagementService : IDynamicApiController, ITransient
}
private async Task UpdateObj109(long idRecord, string msg, string creationState)
{
await Task.Delay(0);
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
if (creationState == "创建成功")
{
await _obj109Rep.AsUpdateable()
db.CopyNew().Updateable<Obj109>()
.SetColumns(it => new Obj109
{
fld006775 = DateTime.Now,
@ -1168,11 +1176,11 @@ public class ProjectManagementService : IDynamicApiController, ITransient
fld006993 = "成功"
})
.Where(it => it.idRecord == idRecord)
.ExecuteCommandAsync();
.ExecuteCommand();
}
if (creationState == "修改成功" || creationState == "创建失败" || creationState == "修改失败")
{
await _obj109Rep.AsUpdateable()
db.CopyNew().Updateable<Obj109>()
.SetColumns(it => new Obj109
{
fld006775 = DateTime.Now,
@ -1180,16 +1188,20 @@ public class ProjectManagementService : IDynamicApiController, ITransient
fld006776 = msg
})
.Where(it => it.idRecord == idRecord)
.ExecuteCommandAsync();
.ExecuteCommand();
}
}
private async Task UpdateObj126(long idRecord, string msg, string creationState)
{
await Task.Delay(0);
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
if (creationState == "创建成功")
{
await _obj126Rep.AsUpdateable()
db.CopyNew().Updateable<Obj126>()
.SetColumns(it => new Obj126
{
fld006772 = DateTime.Now,
@ -1198,11 +1210,11 @@ public class ProjectManagementService : IDynamicApiController, ITransient
fld006990 = creationState
})
.Where(it => it.idRecord == idRecord)
.ExecuteCommandAsync();
.ExecuteCommand();
}
if (creationState == "创建失败" || creationState == "修改成功"|| creationState == "修改失败")
{
await _obj126Rep.AsUpdateable()
db.CopyNew().Updateable<Obj126>()
.SetColumns(it => new Obj126
{
fld006772 = DateTime.Now,
@ -1210,7 +1222,7 @@ public class ProjectManagementService : IDynamicApiController, ITransient
fld006773 = msg
})
.Where(it => it.idRecord == idRecord)
.ExecuteCommandAsync();
.ExecuteCommand();
}
}
@ -1221,9 +1233,8 @@ public class ProjectManagementService : IDynamicApiController, ITransient
public async Task<List<SapOutput>> WbsInSapUpdate()
{
using var serviceScope = _scopeFactory.CreateScope();
var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var syncData = db.Queryable<Obj109>()
var syncData = await db.CopyNew().Queryable<Obj109>()
.InnerJoin<CasesStagesMain>((x, y) => x.RecordGuid == y.RecordGuid)
.InnerJoin<Obj126>((x, y, z) => y.ChildRecordGuid == z.RecordGuid)
.Where((x, y) => x.deleted == false && x.fld006774 == "A" && (x.CheckedStatus == 0 || x.CheckedStatus == 1) && x.fld006993 == "成功" && y.indentLevel < 4) //&& (x.fld006776 == "" || x.fld006776 == null)
@ -1251,7 +1262,7 @@ public class ProjectManagementService : IDynamicApiController, ITransient
fld006771=z.fld006771
})
.ToList();
.ToListAsync();
var syncList = syncData.GroupBy(record => record.RecordGuid)
.Select(group => new
{

View File

@ -9,7 +9,10 @@ using Admin.NET.Core.Service;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using NewLife.Xml;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
@ -41,6 +44,7 @@ public class PurchasingRequisitionService : IDynamicApiController, ITransient
public SqlSugarRepository<Obj122> _obj122Rep;
public SqlSugarRepository<Obj121> _obj121Rep;
public SqlSugarRepository<Obj81> _obj81Rep;
private readonly IServiceScopeFactory _scopeFactory;
public PurchasingRequisitionService(
SqlSugarRepository<Obj119> obj119Rep,
@ -53,7 +57,8 @@ public class PurchasingRequisitionService : IDynamicApiController, ITransient
SqlSugarRepository<Obj122> obj122Rep,
SqlSugarRepository<Obj121> obj121Rep,
SqlSugarRepository<Obj109> obj109Rep,
SqlSugarRepository<Obj81> obj81Rep
SqlSugarRepository<Obj81> obj81Rep,
IServiceScopeFactory scopeFactory
)
{
@ -68,6 +73,7 @@ public class PurchasingRequisitionService : IDynamicApiController, ITransient
_obj121Rep = obj121Rep;
_obj109Rep = obj109Rep;
_obj81Rep = obj81Rep;
_scopeFactory = scopeFactory;
}
/// <summary>
/// 创建研发采购申请
@ -75,6 +81,9 @@ public class PurchasingRequisitionService : IDynamicApiController, ITransient
/// <returns></returns>
public async Task<List<SapOutput>> TimingSyncToSAPPurchasingRequisition()
{
using var serviceScope = _scopeFactory.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var sapOutputList = new List<SapOutput>();
//获取Sap用户名
var sapUserName = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
@ -83,7 +92,7 @@ public class PurchasingRequisitionService : IDynamicApiController, ITransient
var configid = 10;
// 获取符合条件的采购申请单
var PurchasingRequisitionList = await _obj119Rep.AsQueryable().Where(x => x.fld006416 == "A" && x.deleted == false && x.CheckedStatus == false && x._System_CurrentStage == "结束").ToListAsync();
var PurchasingRequisitionList = await db.CopyNew().Queryable<Obj119>().Where(x => x.fld006416 == "A" && x.deleted == false && x.CheckedStatus == false && x._System_CurrentStage == "结束").ToListAsync();
foreach (var item in PurchasingRequisitionList)
{
@ -110,8 +119,8 @@ public class PurchasingRequisitionService : IDynamicApiController, ITransient
};
//查询BOM
var bomData = await _configurationDataRep.AsQueryable().Where(x => x.ConfigId == configid && x.ParentGuid == item.RecordGuid && x.isDeleted == false && x.ParentVersion == item.VersionIndex).ToListAsync();
var project = await _obj109Rep.AsQueryable().Where(x => x.RecordGuid == item.fld004639_Rec && x.deleted == false).OrderByDescending(x => x.VersionIndex).FirstAsync();
var bomData = await db.CopyNew().Queryable<ConfigurationData>().Where(x => x.ConfigId == configid && x.ParentGuid == item.RecordGuid && x.isDeleted == false && x.ParentVersion == item.VersionIndex).ToListAsync();
var project = await db.CopyNew().Queryable<Obj119>().Where(x => x.RecordGuid == item.fld004639_Rec && x.deleted == false).OrderByDescending(x => x.VersionIndex).FirstAsync();
foreach (var bomItem in bomData)
{
var unit = await _dataValidationService.GetUnit(bomItem.ChildObjID, bomItem.ChildGuid);
@ -133,7 +142,9 @@ public class PurchasingRequisitionService : IDynamicApiController, ITransient
Ekorg = bomItem.fld006147,
Zzpspnr = project._System_objNBS,
Afnam = item.fld006125,
Loekz = bomItem.fld006141
Loekz = bomItem.fld006141,
Ztext = item.fld007052
};
itemList.Add(Item);
}
@ -148,7 +159,7 @@ public class PurchasingRequisitionService : IDynamicApiController, ITransient
}
if (item.fld006139 == "I")
{
await _obj119Rep.AsUpdateable()
db.CopyNew().Updateable<Obj119>()
.SetColumns(it => new Obj119
{
fld005934 = DateTime.Now,//同步日期
@ -158,11 +169,11 @@ public class PurchasingRequisitionService : IDynamicApiController, ITransient
fld006138 = sapOutput.banfn//采购申请编号
})
.Where(it => it.idRecord == item.idRecord)
.ExecuteCommandAsync();
.ExecuteCommand();
}
if (item.fld006139 == "U")
{
await _obj119Rep.AsUpdateable()
db.CopyNew().Updateable<Obj119>()
.SetColumns(it => new Obj119
{
fld005934 = DateTime.Now,//同步日期
@ -171,7 +182,7 @@ public class PurchasingRequisitionService : IDynamicApiController, ITransient
fld005935 = msg//同步信息
})
.Where(it => it.idRecord == item.idRecord)
.ExecuteCommandAsync();
.ExecuteCommand();
}
var output = new SapOutput()
{

View File

@ -49,8 +49,8 @@ public class SolidWorksManageService : IDynamicApiController, ITransient
var SolidWorksManageUserName = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SolidWorksManageUserName);
var SolidWorksManagePassword = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SolidWorksManagePassword);
var SolidWorksManageLicenseId = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SolidWorksManageLicenseId);
var SolidWorksManageApiKey = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SolidWorksManageApiKey);
var SolidWorksManageLicenseId = "190";
var SolidWorksManageApiKey = "zesywsWf1dthwXoqd4DJKasEihcuOArxiImrvu8jOUB7oqryVhFAdydL1nPpC5/0gkhIWm6TdPBolBFx+V/FPgcoG370JXnRp/DZ350wi70=";
// 构建请求参数字典
var parameter = new Dictionary<string, string>
{

View File

@ -0,0 +1,19 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Vistar.Application.Util;
public class IsBomAndProcessRouteExistOutput
{
public int objId { get; set; }
public string materialCode { get; set; }
public string isSuccess { get; set; }
}

View File

@ -0,0 +1,123 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Vistar.Application.Util;
public class SyncBomData
{
/// <summary>
/// 主表Id
/// </summary>
public long? Id { get; set; }
/// <summary>
/// 物料编码
/// </summary>
public string MaterialCode { get; set; }
/// <summary>
/// guid
/// </summary>
public string RecordGuid { get; set; }
/// <summary>
/// Sap同步版本
/// </summary>
public string SyncVersion { get; set; }
/// <summary>
/// 工厂
/// </summary>
public string Werks { get; set; }
/// <summary>
/// 基本数量
/// </summary>
public int? Bmeng { get; set; }
/// <summary>
/// 有效日期
/// </summary>
public DateTime? Datuv { get; set; }
/// <summary>
/// 版本
/// </summary>
public int? VersionIndex { get; set; }
/// <summary>
/// ecn
/// </summary>
public string Ecn { get; set; }
/// <summary>
/// ecn Guid
/// </summary>
public string ecnGuid { get; set; }
public List<BomData> Bom { get; set; }
}
public class BomData
{
public string PartNumber { get; set; }
public string ParentGuid { get; set; }
public string ChildGuid { get; set; }
public long ChildObjID { get; set; }
public long ConfigId { get; set; }
public int? childVersion { get; set; }
public int? ParentVersion { get; set; }
/// <summary>
/// 手动数量
/// </summary>
public double? QtyManual { get; set; }
/// <summary>
/// 数量
/// </summary>
public double? Quantity { get; set; }
/// <summary>
/// 排序字符串
/// </summary>
public string SORTF { get; set; }
/// <summary>
/// 是否虚拟
/// </summary>
public string ITISOB { get; set; }
/// <summary>
/// 替代组
/// </summary>
public string ALPGR { get; set; }
/// <summary>
/// 优先级
/// </summary>
public string ALPRF { get; set; }
/// <summary>
/// 是否删除
/// </summary>
public string ZDELETE { get; set; }
/// <summary>
/// 行项目类别
/// </summary>
public string POSTP { get; set; }
/// <summary>
/// 研发模块
/// </summary>
public string ZYFMK { get; set; }
}

View File

@ -0,0 +1,37 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Vistar.Application.Util;
public class SyncProcessRouteData
{
public long? idRecord { get; set; }
public int? VersionIndex { get; set; }
public string _System_objNBS { get; set; }
public string Werks { get; set; }
public DateTime? Datuv { get; set; }
public List<ProcessRouteList> ProcessRouteList { get; set; }
}
public class ProcessRouteList
{
public string ParentGuid { get; set; }
public string ChildGuid { get; set; }
public long ChildObjID { get; set; }
public string PartNumber { get; set; }
public string VORNR { get; set; }
public string LTXA1 { get; set; }
public string ARBPL { get; set; }
public string VGW01 { get; set; }
public string VGE01 { get; set; }
public string STEUS { get; set; }
public string BMSCH { get; set; }
}

View File

@ -37,7 +37,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Entity\" />
<Folder Include="Service\PurchasingRequisition\Dto\" />
</ItemGroup>

View File

@ -0,0 +1,18 @@
import request from '/@/utils/request';
enum Api {
PageScheduledTaskLog = '/api/scheduledTaskLog/page',
Detail = '/api/scheduledTaskLog/detail',
}
export const PageScheduledTaskLog = (params?: any) =>
request({
url: Api.PageScheduledTaskLog,
method: 'post',
data: params,
});
export const Detail = (id?: any) =>
request({
url: Api.Detail+"/"+id,
method: 'Get',
data: id,
});

View File

@ -0,0 +1,185 @@
<template>
<div class="scheduledTaskLog-container">
<el-card shadow="hover"
:body-style="{ padding: '5px 5px 0 5px', display: 'flex', width: '100%', height: '100%', alignItems: 'start' }">
<el-form :model="state.queryParams" ref="queryForm" :show-message="false" :inlineMessage="true"
label-width="auto" style="flex: 1 1 0%">
<el-row :gutter="10">
<el-col class="mb5" :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
<el-form-item label="开始时间" prop="name">
<el-date-picker v-model="state.queryParams.startTime" type="datetime" placeholder="开始时间"
:shortcuts="shortcuts" class="w100" />
</el-form-item>
</el-col>
<el-col class="mb5" :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
<el-form-item label="结束时间" prop="code">
<el-date-picker v-model="state.queryParams.endTime" type="datetime" placeholder="结束时间"
:shortcuts="shortcuts" class="w100" />
</el-form-item>
</el-col>
<el-col class="mb5" :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
<el-form-item label="任务名称">
<el-input v-model="state.queryParams.taskName" placeholder="任务名称" clearable />
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-divider style="height: calc(100% - 5px); margin: 0 10px" direction="vertical" />
<el-row>
<el-col>
<el-button-group>
<el-button type="primary" icon="ele-Search" @click="handleQuery"
v-auth="'scheduledTaskLog/page'" :loading="options.loading"> 查询 </el-button>
<el-button icon="ele-Refresh" @click="resetQuery" :loading="options.loading"> 重置 </el-button>
</el-button-group>
</el-col>
</el-row>
</el-card>
<el-dialog v-model="state.visible" draggable overflow destroy-on-close>
<template #header>
<div style="color: #fff">
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle">
<ele-Document /> </el-icon>
<span> 日志详情 </span>
</div>
</template>
<el-tabs v-model="state.activeTab">
<el-scrollbar height="calc(100vh - 250px)">
<vue-json-pretty :data="state.detail.returnResult" showLength showIcon showLineNumber showSelectController />
</el-scrollbar>
</el-tabs>
</el-dialog>
<el-card class="full-table" shadow="hover" style="margin-top: 5px">
<vxe-grid ref="xGrid" class="xGrid-style" v-bind="options" v-on="gridEvents">
<template #toolbar_tools> </template>
<template #empty>
<el-empty :image-size="200" />
</template>
<template #row_buttons="{ row }">
<el-button icon="ele-InfoFilled" text type="primary" @click="handleView({ row })">日志详情</el-button>
</template>
</vxe-grid>
</el-card>
</div>
</template>
<script lang="ts" setup name="scheduledTaskLog">
import { onMounted, reactive, ref } from 'vue';
import { VxeGridInstance, VxeGridListeners, VxeGridPropTypes } from 'vxe-table';
import { useVxeTable } from '/@/hooks/useVxeTableOptionsHook';
import { Local } from '/@/utils/storage';
import { useDateTimeShortCust } from '/@/hooks/dateTimeShortCust';
import { PageScheduledTaskLog, Detail } from '/@/api/log/scheduledTaskLog';
import { StringToObj } from '/@/utils/json-utils';
import VueJsonPretty from 'vue-json-pretty';
import 'vue-json-pretty/lib/styles.css';
const xGrid = ref<VxeGridInstance>();
//
const localPageParamKey = 'localPageParam:productDesignLibrary';
//
const gridEvents: VxeGridListeners = {
// pager-config
async pageChange({ pageSize }) {
state.localPageParam.pageSize = pageSize;
Local.set(localPageParamKey, state.localPageParam);
},
//
async sortChange({ field, order }) {
state.localPageParam.defaultSort = { field: field, order: order!, descStr: 'desc' };
Local.set(localPageParamKey, state.localPageParam);
},
};
const shortcuts = useDateTimeShortCust();
const state = reactive({
queryParams: {
startTime: undefined,
endTime: undefined,
taskName: undefined
},
localPageParam: {
pageSize: 50 as number,
defaultSort: { field: 'id', order: 'desc', descStr: 'desc' },
},
visible: false,
activeTab: 'message',
detail: {
returnResult: undefined
}
});
//
const resetQuery = async () => {
state.queryParams.startTime = undefined;
state.queryParams.endTime = undefined;
state.queryParams.taskName = undefined;
await xGrid.value?.commitProxy('reload');
};
const options = useVxeTable({
id: 'scheduledTaskLog',
name: '产品设计库管理',
columns: [
{ type: 'seq', title: '序号', width: 60 },
{ field: 'taskName', title: '任务名称', minWidth: 100, showOverflow: 'tooltip', sortable: false },
{ field: 'logDateTime', title: '日志时间', minWidth: 100, showOverflow: 'tooltip', sortable: false },
{ field: 'elapsed', title: '操作用时(毫秒)', minWidth: 100, showOverflow: 'tooltip', sortable: false },
{ title: '操作', fixed: 'right', width: 300, showOverflow: true, slots: { default: 'row_buttons' } },
],
},
{
//
proxyConfig: { autoLoad: true, ajax: { query: ({ page, sort }) => handleQueryApi(page, sort) } },
//
sortConfig: { defaultSort: Local.get(localPageParamKey)?.defaultSort || state.localPageParam.defaultSort },
//
pagerConfig: { pageSize: Local.get(localPageParamKey)?.pageSize || state.localPageParam.pageSize },
//
toolbarConfig: { export: false },
//
// rowConfig: { height: 80 },
}
)
//
onMounted(() => {
state.localPageParam = Local.get(localPageParamKey) || state.localPageParam;
});
// api
const handleQueryApi = async (page: VxeGridPropTypes.ProxyAjaxQueryPageParams, sort: VxeGridPropTypes.ProxyAjaxQuerySortCheckedParams) => {
const params = Object.assign(state.queryParams, { page: page.currentPage, pageSize: page.pageSize, field: sort.field, order: sort.order, descStr: 'desc' });
var data = PageScheduledTaskLog(params)
return data;
};
//
const handleQuery = async (reset = false) => {
options.loading = true;
await xGrid.value?.commitProxy('query');
options.loading = false;
};
const handleView = async ({ row }: any) => {
var data = await Detail(row.id);
state.activeTab = 'message';
// JSONJSON
state.detail.returnResult = StringToObj(data?.data?.result);
state.visible = true;
console.log('aa', state.detail.returnResult)
};
</script>