diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Entity/CasesStagesMain.cs b/admin.net.pro/Admin.NET/Vistar.Application/Entity/CasesStagesMain.cs
new file mode 100644
index 0000000..17db145
--- /dev/null
+++ b/admin.net.pro/Admin.NET/Vistar.Application/Entity/CasesStagesMain.cs
@@ -0,0 +1,301 @@
+// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
+//
+// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
+//
+// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
+
+using Admin.NET.Core;
+using SqlSugar;
+using System.ComponentModel.DataAnnotations;
+namespace Vistar.Application.Entity;
+
+///
+///
+///
+[SugarTable("CasesStagesMain","")]
+[Tenant("启威星 1.94.4.74")]
+public class CasesStagesMain
+{
+ ///
+ ///
+ ///
+ [Required]
+ [SugarColumn(ColumnName = "StageId", IsIdentity = true, ColumnDescription = "", IsPrimaryKey = true)]
+ public long StageId { get; set; }
+
+ ///
+ ///
+ ///
+ [Required]
+ [SugarColumn(ColumnName = "CaseId", ColumnDescription = "")]
+ public int CaseId { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "UsersInvolved", ColumnDescription = "", Length = -1)]
+ public string? UsersInvolved { get; set; }
+
+ ///
+ ///
+ ///
+ [Required]
+ [SugarColumn(ColumnName = "Description", ColumnDescription = "", Length = 250)]
+ public string Description { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "ResponsibleUser", ColumnDescription = "")]
+ public long? ResponsibleUser { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "lastUserModified", ColumnDescription = "")]
+ public int? lastUserModified { get; set; }
+
+ ///
+ ///
+ ///
+ [Required]
+ [SugarColumn(ColumnName = "OrderIndex", ColumnDescription = "")]
+ public long OrderIndex { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "Duration", ColumnDescription = "")]
+ public Single? Duration { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "Start", ColumnDescription = "")]
+ public DateTime? Start { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "Finish", ColumnDescription = "")]
+ public DateTime? Finish { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "DueDate", ColumnDescription = "")]
+ public DateTime? DueDate { get; set; }
+
+ ///
+ ///
+ ///
+ [Required]
+ [SugarColumn(ColumnName = "Progress", ColumnDescription = "")]
+ public int Progress { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "Predecessor", ColumnDescription = "", Length = 50)]
+ public string? Predecessor { get; set; }
+
+ ///
+ ///
+ ///
+ [Required]
+ [SugarColumn(ColumnName = "isFinished", ColumnDescription = "")]
+ public bool isFinished { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "BackStatus", ColumnDescription = "", Length = 255)]
+ public string? BackStatus { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "ForewordStatus", ColumnDescription = "", Length = 255)]
+ public string? ForewordStatus { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "BackStageId", ColumnDescription = "")]
+ public long? BackStageId { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "AllowToChooseUser", ColumnDescription = "")]
+ public bool? AllowToChooseUser { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "ActualStatus", ColumnDescription = "", Length = 255)]
+ public string? ActualStatus { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "Delay", ColumnDescription = "")]
+ public int? Delay { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "RecordGuid", ColumnDescription = "", Length = 40)]
+ public string? RecordGuid { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "WhoCanMoveForeword", ColumnDescription = "")]
+ public long? WhoCanMoveForeword { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "ParentStageId", ColumnDescription = "")]
+ public long? ParentStageId { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "StageType", ColumnDescription = "", Length = 50)]
+ public string? StageType { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "OriginalStage", ColumnDescription = "")]
+ public long? OriginalStage { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "ProgressType", ColumnDescription = "")]
+ public int? ProgressType { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "EnableNotifications", ColumnDescription = "")]
+ public bool? EnableNotifications { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "LongDescription", ColumnDescription = "", Length = -1)]
+ public string? LongDescription { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "indentLevel", ColumnDescription = "")]
+ public int? indentLevel { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "IconIndex", ColumnDescription = "")]
+ public int? IconIndex { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "work", ColumnDescription = "")]
+ public Single? work { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "CompletedWork", ColumnDescription = "")]
+ public Single? CompletedWork { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "Interruptions", ColumnDescription = "", Length = -1)]
+ public string? Interruptions { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "dueWork", ColumnDescription = "")]
+ public Single? dueWork { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "Markers", ColumnDescription = "", Length = -1)]
+ public string? Markers { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "DueCompletedWork", ColumnDescription = "")]
+ public Single? DueCompletedWork { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "ChildGroupObjId", ColumnDescription = "")]
+ public long? ChildGroupObjId { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "ChildObjId", ColumnDescription = "")]
+ public long? ChildObjId { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "ChildRecordGuid", ColumnDescription = "", Length = 40)]
+ public string? ChildRecordGuid { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "GroupObjId", ColumnDescription = "")]
+ public long? GroupObjId { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "splits", ColumnDescription = "", Length = 1000)]
+ public string? splits { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "IsAutoSchedule", ColumnDescription = "")]
+ public bool? IsAutoSchedule { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "PreferredStartDate", ColumnDescription = "")]
+ public object? PreferredStartDate { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "HasAConstraint", ColumnDescription = "")]
+ public bool? HasAConstraint { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "AnyUserCanAddTimeSheets", ColumnDescription = "")]
+ public bool? AnyUserCanAddTimeSheets { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "ExactWork", ColumnDescription = "")]
+ public double? ExactWork { get; set; }
+
+}
diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj109.cs b/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj109.cs
index 9786ee0..fde4f2c 100644
--- a/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj109.cs
+++ b/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj109.cs
@@ -817,4 +817,9 @@ public class Obj109
public string fld005300 { get; set; }
public string fld005753 { get; set; }
+ public string fld006774 { get; set; }
+ public DateTime fld006775 { get; set; }
+ public string fld006776 { get; set; }
+ public string fld006993 { get; set; }
+
}
diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj126.cs b/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj126.cs
new file mode 100644
index 0000000..480c514
--- /dev/null
+++ b/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj126.cs
@@ -0,0 +1,299 @@
+// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
+//
+// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
+//
+// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
+
+using Admin.NET.Core;
+using SqlSugar;
+using System.ComponentModel.DataAnnotations;
+namespace Vistar.Application.Entity;
+
+///
+///
+///
+[SugarTable("OBJ126","")]
+[Tenant("启威星 1.94.4.74")]
+public class Obj126
+{
+ ///
+ ///
+ ///
+ [Required]
+ [SugarColumn(ColumnName = "idRecord", IsIdentity = true, ColumnDescription = "", IsPrimaryKey = true)]
+ public long idRecord { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "CheckedStatus", ColumnDescription = "")]
+ public bool? CheckedStatus { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "VersionIndex", ColumnDescription = "")]
+ public int? VersionIndex { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "IsLatestVersion", ColumnDescription = "")]
+ public bool? IsLatestVersion { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "CreatedDate", ColumnDescription = "")]
+ public DateTime? CreatedDate { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "VersionCreatedDate", ColumnDescription = "")]
+ public DateTime? VersionCreatedDate { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "StageId", ColumnDescription = "")]
+ public long? StageId { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "dateModified", ColumnDescription = "")]
+ public DateTime? dateModified { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "UserCreatedId", ColumnDescription = "")]
+ public long? UserCreatedId { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "VersionUserCreatedId", ColumnDescription = "")]
+ public long? VersionUserCreatedId { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "UserModifiedId", ColumnDescription = "")]
+ public long? UserModifiedId { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "RecordGuid", ColumnDescription = "", Length = 40)]
+ public string? RecordGuid { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "isVisibilityNormal", ColumnDescription = "")]
+ public bool? isVisibilityNormal { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "deleted", ColumnDescription = "")]
+ public bool? deleted { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "SubObjectGuid", ColumnDescription = "", Length = 40)]
+ public string? SubObjectGuid { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "PreviousStatus", ColumnDescription = "")]
+ public bool? PreviousStatus { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "revision", ColumnDescription = "", Length = 10)]
+ public string? revision { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "Record_image160_160", ColumnDescription = "")]
+ public byte[]? Record_image160_160 { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "Record_Image320_240", ColumnDescription = "")]
+ public byte[]? Record_Image320_240 { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "Record_ImageMax", ColumnDescription = "")]
+ public byte[]? Record_ImageMax { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "_System_objNBS", ColumnDescription = "", Length = 100)]
+ public string? _System_objNBS { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "_System_ObjDescription", ColumnDescription = "", Length = 200)]
+ public string? _System_ObjDescription { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "_System_Effectivity_Begin", ColumnDescription = "")]
+ public DateTime? _System_Effectivity_Begin { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "_System_Effectivity_End", ColumnDescription = "")]
+ public DateTime? _System_Effectivity_End { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "ParentRecordId", ColumnDescription = "")]
+ public long? ParentRecordId { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "CheckedOutPc", ColumnDescription = "", Length = 255)]
+ public string? CheckedOutPc { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "EnableNotifications", ColumnDescription = "")]
+ public bool? EnableNotifications { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "GroupObjId", ColumnDescription = "")]
+ public long? GroupObjId { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "ParentStageId", ColumnDescription = "")]
+ public long? ParentStageId { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "_CheckOutInProgress", ColumnDescription = "")]
+ public bool? _CheckOutInProgress { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "Progress", ColumnDescription = "")]
+ public double? Progress { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "StartDate", ColumnDescription = "")]
+ public DateTime? StartDate { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "EndDate", ColumnDescription = "")]
+ public DateTime? EndDate { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "DueDate", ColumnDescription = "")]
+ public DateTime? DueDate { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "ProjectIdRecord", ColumnDescription = "")]
+ public long? ProjectIdRecord { get; set; }
+
+ ///
+ ///
+ ///
+ [Required]
+ [SugarColumn(ColumnName = "_System_ObjNbsAuto", ColumnDescription = "", Length = 50)]
+ public string _System_ObjNbsAuto { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "_System_WebLink", ColumnDescription = "", Length = 500)]
+ public string? _System_WebLink { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "isReleasedVersion", ColumnDescription = "")]
+ public bool? isReleasedVersion { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "fld006743", ColumnDescription = "", Length = -1)]
+ public string? fld006743 { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "fld006745", ColumnDescription = "", Length = -1)]
+ public string? fld006745 { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "fld006746", ColumnDescription = "")]
+ public DateTime? fld006746 { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "fld006747", ColumnDescription = "", Length = -1)]
+ public string? fld006747 { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "fld006770", ColumnDescription = "", Length = -1)]
+ public string? fld006770 { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "fld006771", ColumnDescription = "", Length = -1)]
+ public string? fld006771 { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "fld006772", ColumnDescription = "")]
+ public DateTime? fld006772 { get; set; }
+
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName = "fld006773", ColumnDescription = "", Length = -1)]
+ public string? fld006773 { get; set; }
+ public DateTime? fld006934 { get; set; }
+ public string? fld006990 { get; set; }
+
+}
diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/Dto/WbsInput.cs b/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/Dto/WbsInput.cs
new file mode 100644
index 0000000..54e9335
--- /dev/null
+++ b/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/Dto/WbsInput.cs
@@ -0,0 +1,36 @@
+// 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.Service.ProjectManagement.Dto;
+public class WbsInput
+{
+ public long projectIdRecord { get; set; }
+ public long stageIdRecord { get; set; }
+ public int? CheckedStatus { get; set; }
+ public string RecordGuid { get; set; }
+ public int? indentLevel { get; set; }
+ public long OrderIndex { get; set; }
+ public string Description { get; set; }
+ public string ChildRecordGuid { get; set; }
+ public string fld006745 { get; set; }
+ public string _System_objNBS { get; set; }
+ public DateTime? StartDate { get; set; }
+ public DateTime? EndDate { get; set; }
+ public DateTime? fld006934 { get; set; }
+ public DateTime? fld006746 { get; set; }
+ public string fld006770 { get; set; }
+ public string fld004502 { get; set; }
+ public string System_objNBS109 { get; set; }
+ public string fld004506 { get; set; }
+ public string fld006747 { get; set; }
+ public string fld006771 { get; set; }
+}
diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/ProjectManagementService.cs b/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/ProjectManagementService.cs
index 8b7de68..8f9a4d9 100644
--- a/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/ProjectManagementService.cs
+++ b/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/ProjectManagementService.cs
@@ -1,9 +1,15 @@
using Admin.NET.Core;
using Admin.NET.Core.Service;
+using COSXML.Network;
+using Elastic.Clients.Elasticsearch;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.DependencyInjection;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
+using RazorEngine;
+using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -34,6 +40,9 @@ public class ProjectManagementService : IDynamicApiController, ITransient
public Common.DataValidationService _dataValidationService;
public SqlSugarRepository _obj122Rep;
public SqlSugarRepository _obj121Rep;
+ public SqlSugarRepository _obj126Rep;
+ public SqlSugarRepository _casesStagesMainRep;
+ private readonly IServiceScopeFactory _scopeFactory;
public ProjectManagementService(
SqlSugarRepository obj109Rep,
@@ -44,7 +53,10 @@ public class ProjectManagementService : IDynamicApiController, ITransient
SqlSugarRepository obj118Rep,
DataValidationService dataValidationService,
SqlSugarRepository obj122Rep,
- SqlSugarRepository obj121Rep
+ SqlSugarRepository obj121Rep,
+ SqlSugarRepository obj126Rep,
+ SqlSugarRepository casesStagesMainRep,
+ IServiceScopeFactory scopeFactory
)
{
_obj109Rep = obj109Rep;
@@ -56,6 +68,9 @@ public class ProjectManagementService : IDynamicApiController, ITransient
_dataValidationService = dataValidationService;
_obj122Rep = obj122Rep;
_obj121Rep = obj121Rep;
+ _obj126Rep = obj126Rep;
+ _casesStagesMainRep = casesStagesMainRep;
+ _scopeFactory = scopeFactory;
}
///
/// 分页查询项目管理
@@ -526,7 +541,7 @@ public class ProjectManagementService : IDynamicApiController, ITransient
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 109 && x.ConfigSystemName == "mBOM").FirstAsync();
var materialData = await _obj109Rep.AsQueryable()
- .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"))
+ .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)
.Select(group => group.OrderByDescending(item => item.VersionIndex).First())
@@ -756,7 +771,7 @@ public class ProjectManagementService : IDynamicApiController, ITransient
//查询需要同步的产品
var materialData = await _obj109Rep.AsQueryable()
- .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"))
+ .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)
@@ -858,4 +873,808 @@ public class ProjectManagementService : IDynamicApiController, ITransient
}
return sapOutputList;
}
+
+ ///
+ /// 向SAP创建WBS
+ ///
+ ///
+ public async Task> WbsInSapCreate()
+ {
+ using var serviceScope = _scopeFactory.CreateScope();
+ var sysEnumService = serviceScope.ServiceProvider.GetRequiredService();
+ var db = serviceScope.ServiceProvider.GetRequiredService().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
+ var syncData = db.Queryable()
+ .InnerJoin((x, y) => x.RecordGuid == y.RecordGuid)
+ .InnerJoin((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)
+ //&& SqlFunc.Subqueryable().Where(x=>x.RecordGuid==x.RecordGuid).Max(s=>s.idRecord)==x.idRecord) (x.fld006776 == "" || x.fld006776 == null)
+ .Select((x, y, z) => new WbsInput
+ {
+ projectIdRecord = x.idRecord,
+ CheckedStatus = x.CheckedStatus,
+ RecordGuid = x.RecordGuid,
+ indentLevel = y.indentLevel,
+ OrderIndex = y.OrderIndex,
+ Description = y.Description,
+ ChildRecordGuid = y.ChildRecordGuid,
+ fld006745 = z.fld006745,
+ _System_objNBS = z._System_objNBS,
+ StartDate = z.StartDate,
+ EndDate = z.EndDate,
+ fld006934 = z.fld006934,
+ fld006746 = z.fld006746,
+ fld006770 = z.fld006770,
+ stageIdRecord = z.idRecord,
+ System_objNBS109 = x._System_objNBS
+
+ })
+ .ToList();
+ var syncList = syncData.GroupBy(record => record.RecordGuid)
+ .Select(group => new
+ {
+ WbsData = group.ToList()
+ });
+
+ var syncList2 = syncData.GroupBy(record => record.RecordGuid).ToList();
+ List sapOutputs = new List();
+ foreach (var item in syncList)
+ {
+ var output = await WbsSapParams(item.WbsData);
+ sapOutputs.Add(output);
+ }
+ return sapOutputs;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task WbsSapParams(List list)
+ {
+ var sapInputItem = new List();
+ List ints = new List();
+
+ string hierarchicalCoding1 = "";
+ string hierarchicalCoding2 = "";
+ string hierarchicalCoding3 = "";
+ string hierarchicalCoding4 = "";
+ int i = 0;
+ long projectIdRecord = 0;
+ var sortList = list.OrderBy(x => x.OrderIndex).ToList();
+ foreach (var item in sortList)
+ {
+ projectIdRecord = item.projectIdRecord;
+ //if (string.IsNullOrEmpty(item.fld006745))
+ //{
+ // var errParam = new SapOutput()
+ // {
+ // materialCode=item.System_objNBS109,
+ // code = "失败",
+ // msg = "请检查WBS标识",
+ // };
+ // return errParam;
+ //}
+
+ ints.Add(item.stageIdRecord);
+ i++;
+ string StartDate = "";
+ if (item.StartDate.HasValue)
+ {
+ StartDate = item.StartDate.ToDateTime().ToString("yyyy-MM-dd");
+ }
+ string EndDate = "";
+ if (item.EndDate.HasValue)
+ {
+ EndDate = item.EndDate.ToDateTime().ToString("yyyy-MM-dd");
+ }
+
+ string fld006934 = "";
+ if (item.fld006934.HasValue)
+ {
+ fld006934 = item.fld006934.ToDateTime().ToString("yyyy-MM-dd");
+ }
+
+ string fld006746 = "";
+ if (item.fld006746.HasValue)
+ {
+ fld006746 = item.fld006746.ToDateTime().ToString("yyyy-MM-dd");
+ }
+ string fld006770 = "";
+ if (!string.IsNullOrEmpty(item.fld006770))
+ {
+ string[] parts = item.fld006770.Split('-');
+ fld006770 = parts[0];
+ }
+
+ if (item.indentLevel == 0)
+ {
+ hierarchicalCoding1 = item.fld006745;
+
+ //var itemData = new SapCreateWBSItem
+ //{
+ // Zwbid = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + i.ToString(),
+ // Pspid = hierarchicalCoding1,
+ // Pspnr = "",
+ // Pspnr2 = hierarchicalCoding1,
+ // Post1 = item.Description,
+ // Pstrt = StartDate,
+ // Pende = EndDate,
+ // Istrt = fld006934,
+ // Iende = fld006746,
+ // Usr00 = "",
+ // Prart = fld006770,
+ // Zresv1 = "",
+ // Zresv2 = "",
+ // Zresv3 = "",
+ // Zresv4 = "",
+ // Zresv5 = ""
+ //};
+ //sapInputItem.Add(itemData);
+
+ }
+ if (item.indentLevel == 1)
+ {
+ hierarchicalCoding2 = item.fld006745;
+
+ var itemData = new SapCreateWBSItem
+ {
+ Zwbid = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + i.ToString(),
+ Pspid = hierarchicalCoding1,
+ Pspnr = hierarchicalCoding1,
+ Pspnr2 = hierarchicalCoding2,
+ Post1 = item.Description,
+ Pstrt = StartDate,
+ Pende = EndDate,
+ Istrt = fld006934,
+ Iende = fld006746,
+ Usr00 = "",
+ Prart = fld006770,
+ Zresv1 = "",
+ Zresv2 = "",
+ Zresv3 = "",
+ Zresv4 = "",
+ Zresv5 = ""
+ };
+ if (fld006770 == "6")
+ {
+ itemData.Pspnr = "";
+ }
+
+ if (!string.IsNullOrEmpty(item.fld006745))
+ {
+ sapInputItem.Add(itemData);
+ }
+ }
+ if (item.indentLevel == 2)
+ {
+ hierarchicalCoding3 = item.fld006745;
+ var itemData = new SapCreateWBSItem
+ {
+ Zwbid = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + i.ToString(),
+ Pspid = hierarchicalCoding1,
+ Pspnr = hierarchicalCoding2,
+ Pspnr2 = hierarchicalCoding3,
+ Post1 = item.Description,
+ Pstrt = StartDate,
+ Pende = EndDate,
+ Istrt = fld006934,
+ Iende = fld006746,
+ Usr00 = "",
+ Prart = fld006770,
+ Zresv1 = "",
+ Zresv2 = "",
+ Zresv3 = "",
+ Zresv4 = "",
+ Zresv5 = ""
+ };
+ if (fld006770 == "6")
+ {
+ itemData.Pspnr = "";
+ }
+ if (!string.IsNullOrEmpty(item.fld006745))
+ {
+ sapInputItem.Add(itemData);
+ }
+ }
+ if (item.indentLevel == 3)
+ {
+ hierarchicalCoding4 = item.fld006745;
+ var itemData = new SapCreateWBSItem
+ {
+ Zwbid = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + i.ToString(),
+ Pspid = hierarchicalCoding1,
+ Pspnr = hierarchicalCoding3,
+ Pspnr2 = hierarchicalCoding4,
+ Post1 = item.Description,
+ Pstrt = StartDate,
+ Pende = EndDate,
+ Istrt = fld006934,
+ Iende = fld006746,
+ Usr00 = "",
+ Prart = fld006770,
+ Zresv1 = "",
+ Zresv2 = "",
+ Zresv3 = "",
+ Zresv4 = "",
+ Zresv5 = ""
+ };
+ if (fld006770 == "6")
+ {
+ itemData.Pspnr = "";
+ }
+ if (!string.IsNullOrEmpty(item.fld006745))
+ {
+ sapInputItem.Add(itemData);
+ }
+ }
+ }
+ var sapInput = new SapCreateWBSInput
+ {
+ ReqKeyId = "",
+ BusinessId = "",
+ MessageId = "",
+ SndPrn = "PLM",
+ RcvPrn = "SAP",
+ ReqUser = await _sysConfigService.GetConfigValueByCode(ConfigConst.SapUserName),
+ Note1 = "",
+ Note2 = "",
+ Note3 = "",
+ SapCreateWBSItem = sapInputItem
+ };
+
+ var output = await _sapService.SapCreateWBS(sapInput);
+
+ if (output.code == "S")
+ {
+ //await _obj126Rep.AsUpdateable()
+ // .SetColumns(it => it.fld006772 == DateTime.Now && it.fld006771 == "N" && it.fld006773 == output.msg && it.fld006990 == "成功")
+ // .Where(it => ints.Contains(it.idRecord))
+ // .ExecuteCommandAsync();
+ //await _obj109Rep.AsUpdateable()
+ // .SetColumns(it => it.fld006775 == DateTime.Now && it.fld006774 == "N" && it.fld006776 == output.msg && it.fld006993 == "成功")
+ // .Where(it => it.idRecord == projectIdRecord)
+ // .ExecuteCommandAsync();
+
+ foreach (var item in ints)
+ {
+ await UpdateObj126(item, output.msg, "创建成功");
+ }
+ await UpdateObj109(projectIdRecord, output.msg, "创建成功");
+ }
+ else
+ {
+ //await _obj109Rep.AsUpdateable()
+ // .SetColumns(it => it.fld006775 == DateTime.Now && it.fld006774 == "N" && it.fld006776 == output.msg)
+ // .Where(it => it.idRecord == projectIdRecord)
+ // .ExecuteCommandAsync();
+ await UpdateObj109(projectIdRecord, output.msg, "创建失败");
+ }
+
+
+ return output;
+
+ }
+ private async Task UpdateObj109(long idRecord, string msg, string creationState)
+ {
+ if (creationState == "创建成功")
+ {
+ await _obj109Rep.AsUpdateable()
+ .SetColumns(it => new Obj109
+ {
+ fld006775 = DateTime.Now,
+ fld006774 = "N",
+ fld006776 = msg,
+ fld006993 = "成功"
+ })
+ .Where(it => it.idRecord == idRecord)
+ .ExecuteCommandAsync();
+ }
+ if (creationState == "修改成功" || creationState == "创建失败" || creationState == "修改失败")
+ {
+ await _obj109Rep.AsUpdateable()
+ .SetColumns(it => new Obj109
+ {
+ fld006775 = DateTime.Now,
+ fld006774 = "N",
+ fld006776 = msg
+ })
+ .Where(it => it.idRecord == idRecord)
+ .ExecuteCommandAsync();
+ }
+
+ }
+
+ private async Task UpdateObj126(long idRecord, string msg, string creationState)
+ {
+ if (creationState == "创建成功")
+ {
+ await _obj126Rep.AsUpdateable()
+ .SetColumns(it => new Obj126
+ {
+ fld006772 = DateTime.Now,
+ fld006771 = "N",
+ fld006773 = msg,
+ fld006990 = creationState
+ })
+ .Where(it => it.idRecord == idRecord)
+ .ExecuteCommandAsync();
+ }
+ if (creationState == "创建失败" || creationState == "修改成功"|| creationState == "修改失败")
+ {
+ await _obj126Rep.AsUpdateable()
+ .SetColumns(it => new Obj126
+ {
+ fld006772 = DateTime.Now,
+ fld006771 = "N",
+ fld006773 = msg
+ })
+ .Where(it => it.idRecord == idRecord)
+ .ExecuteCommandAsync();
+ }
+ }
+
+ ///
+ /// 向SAP更新WBS
+ ///
+ ///
+ public async Task> WbsInSapUpdate()
+ {
+ using var serviceScope = _scopeFactory.CreateScope();
+ var sysEnumService = serviceScope.ServiceProvider.GetRequiredService();
+ var db = serviceScope.ServiceProvider.GetRequiredService().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
+ var syncData = db.Queryable()
+ .InnerJoin((x, y) => x.RecordGuid == y.RecordGuid)
+ .InnerJoin((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)
+ .Select((x, y, z) => new WbsInput
+ {
+ projectIdRecord = x.idRecord,
+ CheckedStatus = x.CheckedStatus,
+ RecordGuid = x.RecordGuid,
+ indentLevel = y.indentLevel,
+ OrderIndex = y.OrderIndex,
+ Description = y.Description,
+ ChildRecordGuid = y.ChildRecordGuid,
+ fld006745 = z.fld006745,
+ _System_objNBS = z._System_objNBS,
+ StartDate = z.StartDate,
+ EndDate = z.EndDate,
+ fld006934 = z.fld006934,
+ fld006746 = z.fld006746,
+ fld006770 = z.fld006770,
+ stageIdRecord = z.idRecord,
+ fld004502 = x.fld004502,
+ System_objNBS109 = x._System_objNBS,
+ fld004506 = x.fld004506,
+ fld006747 = z.fld006747,
+ fld006771=z.fld006771
+
+ })
+ .ToList();
+ var syncList = syncData.GroupBy(record => record.RecordGuid)
+ .Select(group => new
+ {
+ WbsData = group.ToList()
+ });
+
+ var syncList2 = syncData.GroupBy(record => record.RecordGuid).ToList();
+
+ List sapOutputs = new List();
+ foreach (var item in syncList)
+ {
+ List output = await WbsSapUpdateParams(item.WbsData);
+ sapOutputs.AddRange(output);
+ }
+ return sapOutputs;
+
+ }
+
+ public async Task> WbsSapUpdateParams(List list)
+ {
+ var sapOutput = new List();
+ var sapUpdateInputItem = new List();
+ var sapCreateInputItem = new List();
+ List intsCreate = new List();
+ List intsUpdate = new List();
+
+
+ string hierarchicalCoding1 = "";
+ string hierarchicalCoding2 = "";
+ string hierarchicalCoding3 = "";
+ string hierarchicalCoding4 = "";
+ int i = 0;
+ long projectIdRecord = 0;
+ var sortList = list.OrderBy(x => x.OrderIndex).ToList();
+ foreach (var item in sortList)
+ {
+ projectIdRecord = item.projectIdRecord;
+ //if (string.IsNullOrEmpty(item.fld006745))
+ //{
+ // var errParam = new SapOutput()
+ // {
+ // materialCode=item.System_objNBS109,
+ // code = "失败",
+ // msg = "请检查WBS标识",
+ // };
+ // sapOutput.Add(errParam);
+ // return sapOutput;
+ //}
+
+ //if (item.fld006771 == "M")
+ //{
+ // intsUpdate.Add(item.stageIdRecord);
+ //}
+ //else
+ //{
+ // intsCreate.Add(item.stageIdRecord);
+ //}
+ i++;
+ string StartDate = "";
+ if (item.StartDate.HasValue)
+ {
+ StartDate = item.StartDate.ToDateTime().ToString("yyyy-MM-dd");
+ }
+ string EndDate = "";
+ if (item.EndDate.HasValue)
+ {
+ EndDate = item.EndDate.ToDateTime().ToString("yyyy-MM-dd");
+ }
+
+ string fld006934 = "";
+ if (item.fld006934.HasValue)
+ {
+ fld006934 = item.fld006934.ToDateTime().ToString("yyyy-MM-dd");
+ }
+
+ string fld006746 = "";
+ if (item.fld006746.HasValue)
+ {
+ fld006746 = item.fld006746.ToDateTime().ToString("yyyy-MM-dd");
+ }
+ string fld006770 = "";
+ if (!string.IsNullOrEmpty(item.fld006770))
+ {
+ string[] parts = item.fld006770.Split('-');
+ fld006770 = parts[0];
+ }
+ string fld004506 = "";
+ if (!string.IsNullOrEmpty(item.fld004506))
+ {
+ fld004506 = await _dataValidationService.ProjProcStatus(item.fld004506);
+ }
+ string fld006747 = "";
+ if (!string.IsNullOrEmpty(item.fld006747))
+ {
+ fld006747 = await _dataValidationService.ProjProcStatus(item.fld006747);
+ }
+ string System_objNBS109 = item.System_objNBS109;
+ if (item.indentLevel == 0)
+ {
+ hierarchicalCoding1 = item.fld006745;
+ if (item.fld006771 == "M")
+ {
+ intsUpdate.Add(item.stageIdRecord);
+ var itemData = new SapUpdateWBSItem
+ {
+ Zwbid = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + i.ToString(),
+ Pspid = System_objNBS109,
+ Post1Proj = item.fld004502,
+ Pspnr = hierarchicalCoding1,
+ Post1 = item.Description,
+ Pstrt = StartDate,
+ Pende = EndDate,
+ Istrt = fld006934,
+ Iende = fld006746,
+ Usr00 = "",
+ Prart = fld006770,
+ SystemStatus = fld004506,
+ SystemStatus2 = fld006747,
+ Zresv1 = "",
+ Zresv2 = "",
+ Zresv3 = "",
+ Zresv4 = "",
+ Zresv5 = ""
+ };
+ sapUpdateInputItem.Add(itemData);
+ }
+ //if (item.fld006771 == "" || item.fld006771 ==null)
+ //{
+ // var itemCreateData = new SapCreateWBSItem
+ // {
+ // Zwbid = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + i.ToString(),
+ // Pspid = System_objNBS109,
+ // Pspnr = "",
+ // Pspnr2 = hierarchicalCoding1,
+ // Post1 = item.Description,
+ // Pstrt = StartDate,
+ // Pende = EndDate,
+ // Istrt = fld006934,
+ // Iende = fld006746,
+ // Usr00 = "",
+ // Prart = fld006770,
+ // Zresv1 = "",
+ // Zresv2 = "",
+ // Zresv3 = "",
+ // Zresv4 = "",
+ // Zresv5 = ""
+ // };
+ // sapCreateInputItem.Add(itemCreateData);
+ //}
+
+ }
+ if (item.indentLevel == 1)
+ {
+ hierarchicalCoding2 = item.fld006745;
+ if (item.fld006771 == "M")
+ {
+ intsUpdate.Add(item.stageIdRecord);
+ var itemData = new SapUpdateWBSItem
+ {
+ Zwbid = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + i.ToString(),
+ Pspid = System_objNBS109,
+ Post1Proj = item.fld004502,
+ Pspnr = hierarchicalCoding2,
+ Post1 = item.Description,
+ Pstrt = StartDate,
+ Pende = EndDate,
+ Istrt = fld006934,
+ Iende = fld006746,
+ Usr00 = "",
+ Prart = fld006770,
+ SystemStatus = fld004506,
+ SystemStatus2 = fld006747,
+ Zresv1 = "",
+ Zresv2 = "",
+ Zresv3 = "",
+ Zresv4 = "",
+ Zresv5 = ""
+ };
+ sapUpdateInputItem.Add(itemData);
+ }
+ if (item.fld006771 == "" || item.fld006771 == null)
+ {
+ var itemData = new SapCreateWBSItem
+ {
+ Zwbid = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + i.ToString(),
+ Pspid = System_objNBS109,
+ Pspnr = hierarchicalCoding1,
+ Pspnr2 = hierarchicalCoding2,
+ Post1 = item.Description,
+ Pstrt = StartDate,
+ Pende = EndDate,
+ Istrt = fld006934,
+ Iende = fld006746,
+ Usr00 = "",
+ Prart = fld006770,
+ Zresv1 = "",
+ Zresv2 = "",
+ Zresv3 = "",
+ Zresv4 = "",
+ Zresv5 = ""
+ };
+ if (fld006770 == "6")
+ {
+ itemData.Pspnr = "";
+ }
+ if (!string.IsNullOrEmpty(item.fld006745))
+ {
+ intsCreate.Add(item.stageIdRecord);
+ sapCreateInputItem.Add(itemData);
+ }
+
+ }
+ }
+ if (item.indentLevel == 2)
+ {
+ hierarchicalCoding3 = item.fld006745;
+ if (item.fld006771 == "M")
+ {
+ intsUpdate.Add(item.stageIdRecord);
+ var itemData = new SapUpdateWBSItem
+ {
+ Zwbid = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + i.ToString(),
+ Pspid = System_objNBS109,
+ Post1Proj = item.fld004502,
+ Pspnr = hierarchicalCoding3,
+ Post1 = item.Description,
+ Pstrt = StartDate,
+ Pende = EndDate,
+ Istrt = fld006934,
+ Iende = fld006746,
+ Usr00 = "",
+ Prart = fld006770,
+ SystemStatus = fld004506,
+ SystemStatus2 = fld006747,
+ Zresv1 = "",
+ Zresv2 = "",
+ Zresv3 = "",
+ Zresv4 = "",
+ Zresv5 = ""
+ };
+ sapUpdateInputItem.Add(itemData);
+ }
+ if (item.fld006771 == "" || item.fld006771 == null)
+ {
+ var itemData = new SapCreateWBSItem
+ {
+ Zwbid = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + i.ToString(),
+ Pspid = System_objNBS109,
+ Pspnr = hierarchicalCoding2,
+ Pspnr2 = hierarchicalCoding3,
+ Post1 = item.Description,
+ Pstrt = StartDate,
+ Pende = EndDate,
+ Istrt = fld006934,
+ Iende = fld006746,
+ Usr00 = "",
+ Prart = fld006770,
+ Zresv1 = "",
+ Zresv2 = "",
+ Zresv3 = "",
+ Zresv4 = "",
+ Zresv5 = ""
+ };
+ if (fld006770 == "6")
+ {
+ itemData.Pspnr = "";
+ }
+ if (!string.IsNullOrEmpty(item.fld006745))
+ {
+ intsCreate.Add(item.stageIdRecord);
+ sapCreateInputItem.Add(itemData);
+ }
+ }
+
+
+ }
+ if (item.indentLevel == 3)
+ {
+ hierarchicalCoding4 = item.fld006745;
+ if (item.fld006771 == "M")
+ {
+ intsUpdate.Add(item.stageIdRecord);
+ var itemData = new SapUpdateWBSItem
+ {
+ Zwbid = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + i.ToString(),
+ Pspid = System_objNBS109,
+ Post1Proj = item.fld004502,
+ Pspnr = hierarchicalCoding4,
+ Post1 = item.Description,
+ Pstrt = StartDate,
+ Pende = EndDate,
+ Istrt = fld006934,
+ Iende = fld006746,
+ Usr00 = "",
+ Prart = fld006770,
+ SystemStatus = fld004506,
+ SystemStatus2 = fld006747,
+ Zresv1 = "",
+ Zresv2 = "",
+ Zresv3 = "",
+ Zresv4 = "",
+ Zresv5 = ""
+ };
+ sapUpdateInputItem.Add(itemData);
+ }
+ if (item.fld006771 == "" || item.fld006771 == null)
+ {
+ var itemData = new SapCreateWBSItem
+ {
+ Zwbid = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + i.ToString(),
+ Pspid = System_objNBS109,
+ Pspnr = hierarchicalCoding3,
+ Pspnr2 = hierarchicalCoding4,
+ Post1 = item.Description,
+ Pstrt = StartDate,
+ Pende = EndDate,
+ Istrt = fld006934,
+ Iende = fld006746,
+ Usr00 = "",
+ Prart = fld006770,
+ Zresv1 = "",
+ Zresv2 = "",
+ Zresv3 = "",
+ Zresv4 = "",
+ Zresv5 = ""
+ };
+ if (fld006770 == "6")
+ {
+ itemData.Pspnr = "";
+ }
+ if (!string.IsNullOrEmpty(item.fld006745))
+ {
+ intsCreate.Add(item.stageIdRecord);
+ sapCreateInputItem.Add(itemData);
+ }
+ }
+
+ }
+ }
+ if (sapCreateInputItem.Count > 0)
+ {
+ var sapInput = new SapCreateWBSInput
+ {
+ ReqKeyId = "",
+ BusinessId = "",
+ MessageId = "",
+ SndPrn = "PLM",
+ RcvPrn = "SAP",
+ ReqUser = await _sysConfigService.GetConfigValueByCode(ConfigConst.SapUserName),
+ Note1 = "",
+ Note2 = "",
+ Note3 = "",
+ SapCreateWBSItem = sapCreateInputItem
+ };
+ var output = await _sapService.SapCreateWBS(sapInput);
+ sapOutput.Add(output);
+ if (output.code == "S")
+ {
+ //await _obj126Rep.AsUpdateable()
+ // .SetColumns(it => it.fld006772 == DateTime.Now && it.fld006771 == "N" && it.fld006773 == output.msg && it.fld006990 == "成功")
+ // .Where(it => intsCreate.Contains(it.idRecord))
+ // .ExecuteCommandAsync();
+ //await _obj109Rep.AsUpdateable().SetColumns(it => it.fld006775 == DateTime.Now && it.fld006774 == "N" && it.fld006776 == output.msg).Where(it => it.idRecord == projectIdRecord).ExecuteCommandAsync();
+
+ foreach (var item in intsCreate)
+ {
+ await UpdateObj126(item, output.msg, "创建成功");
+ }
+ await UpdateObj109(projectIdRecord, output.msg, "修改成功");
+ }
+ else
+ {
+ foreach (var item in intsCreate)
+ {
+ await UpdateObj126(item, output.msg, "修改失败");
+ }
+ await UpdateObj109(projectIdRecord, output.msg, "创建失败");
+ }
+ //await _obj109Rep.AsUpdateable().SetColumns(it => it.fld006775 == DateTime.Now && it.fld006774 == "N" && it.fld006776 == output.msg).Where(it => it.idRecord == projectIdRecord).ExecuteCommandAsync();
+ }
+ if (sapUpdateInputItem.Count > 0)
+ {
+ var sapInput = new SapUpdateWBSInput
+ {
+ ReqKeyId = "",
+ BusinessId = "",
+ MessageId = "",
+ SndPrn = "PLM",
+ RcvPrn = "SAP",
+ ReqUser = await _sysConfigService.GetConfigValueByCode(ConfigConst.SapUserName),
+ Note1 = "",
+ Note2 = "",
+ Note3 = "",
+ SapUpdateWBSItem = sapUpdateInputItem
+ };
+ var output = await _sapService.SapUpdateWBS(sapInput);
+ sapOutput.Add(output);
+ if (output.code == "S")
+ {
+ //await _obj126Rep.AsUpdateable()
+ // .SetColumns(it => it.fld006772 == DateTime.Now && it.fld006771 == "N" && it.fld006773 == output.msg && it.fld006990 == "成功")
+ // .Where(it => intsUpdate.Contains(it.idRecord))
+ // .ExecuteCommandAsync();
+ //await _obj109Rep.AsUpdateable().SetColumns(it=>it.fld006775==DateTime.Now&&it.fld006774=="N"&&it.fld006776== output.msg).Where(it=>it.idRecord== projectIdRecord).ExecuteCommandAsync();
+
+ foreach (var item in intsUpdate)
+ {
+ await UpdateObj126(item, output.msg, "修改成功");
+ }
+ await UpdateObj109(projectIdRecord, output.msg, "修改成功");
+ }
+ else
+ {
+ foreach (var item in intsUpdate)
+ {
+ await UpdateObj126(item, output.msg, "修改失败");
+ }
+ await UpdateObj109(projectIdRecord, output.msg, "修改失败");
+ }
+ //await _obj109Rep.AsUpdateable().SetColumns(it => it.fld006775 == DateTime.Now && it.fld006774 == "N" && it.fld006776 == output.msg).Where(it => it.idRecord == projectIdRecord).ExecuteCommandAsync();
+ }
+ return sapOutput;
+
+ }
+
}
diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Util/SapOutput.cs b/admin.net.pro/Admin.NET/Vistar.Application/Util/SapOutput.cs
index 5bef659..f7664ff 100644
--- a/admin.net.pro/Admin.NET/Vistar.Application/Util/SapOutput.cs
+++ b/admin.net.pro/Admin.NET/Vistar.Application/Util/SapOutput.cs
@@ -16,11 +16,11 @@ namespace Vistar.Application.Util;
///
public class SapOutput
{
- public string parameter { get; set; }
+ public string? parameter { get; set; }
public string? materialCode { get; set; }
- public string code { get; set; }
- public string msg { get; set; }
- public string result { get; set; }
+ public string? code { get; set; }
+ public string? msg { get; set; }
+ public string? result { get; set; }
public string? banfn { get; set; }
}