From 1ba505ed19ada59bcbda03c42c40b7fbc3f49acb Mon Sep 17 00:00:00 2001 From: bairubing Date: Thu, 26 Sep 2024 00:21:59 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=98=8E=E9=A1=B9=E7=9B=AE=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=8A=9F=E8=83=BD=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Vistar.Application/Entity/Obj109.cs | 2 +- .../Dto/ProductManagementBomOutput.cs | 11 - .../ProductManagementService.cs | 72 +- .../Dto/BomProjectManagementInput.cs | 199 ++++++ .../Dto/ProjectManagementBomOutput.cs | 446 +++++++++++++ .../Dto/ProjectManagementInput.cs | 399 +++++++++++ .../Dto/ProjectManagementOutput.cs | 373 +++++++++++ .../ProjectManagementService.cs | 624 ++++++++++++++++++ .../materialManagement/productManagement.ts | 8 - .../materialManagement/projectManagement.ts | 46 ++ .../productManagement/index.vue | 16 +- .../projectManagement/index.vue | 353 ++++++++++ 12 files changed, 2460 insertions(+), 89 deletions(-) create mode 100644 admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/Dto/BomProjectManagementInput.cs create mode 100644 admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/Dto/ProjectManagementBomOutput.cs create mode 100644 admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/Dto/ProjectManagementInput.cs create mode 100644 admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/Dto/ProjectManagementOutput.cs create mode 100644 admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/ProjectManagementService.cs create mode 100644 admin.net.pro/Web/src/api/materialManagement/projectManagement.ts create mode 100644 admin.net.pro/Web/src/views/materialManagement/projectManagement/index.vue 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 3addfad..0a79c64 100644 --- a/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj109.cs +++ b/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj109.cs @@ -27,7 +27,7 @@ public class Obj109 /// /// [SugarColumn(ColumnName = "CheckedStatus", ColumnDescription = "")] - public bool? CheckedStatus { get; set; } + public int? CheckedStatus { get; set; } /// /// diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Service/MaterialManagement/Dto/ProductManagementBomOutput.cs b/admin.net.pro/Admin.NET/Vistar.Application/Service/MaterialManagement/Dto/ProductManagementBomOutput.cs index 222058c..92a2510 100644 --- a/admin.net.pro/Admin.NET/Vistar.Application/Service/MaterialManagement/Dto/ProductManagementBomOutput.cs +++ b/admin.net.pro/Admin.NET/Vistar.Application/Service/MaterialManagement/Dto/ProductManagementBomOutput.cs @@ -178,7 +178,6 @@ public class ProductManagementBomOutput /// /// /// - [Required] public long ParentObjectID { get; set; } /// @@ -300,7 +299,6 @@ public class ProductManagementBomOutput /// /// /// - [Required] public bool isAddedFromSW { get; set; } /// @@ -321,19 +319,16 @@ public class ProductManagementBomOutput /// /// /// - [Required] public bool inContext { get; set; } /// /// /// - [Required] public string PrimaryFile { get; set; } /// /// /// - [Required] public bool bKeepQuantityInSync { get; set; } /// @@ -344,7 +339,6 @@ public class ProductManagementBomOutput /// /// /// - [Required] public bool IsPDMReference { get; set; } /// @@ -453,11 +447,6 @@ public class ProductManagementBomOutput public string? fld005020 { get; set; } } -//public class ProductManagementBomTypeOutput -//{ -// public long Id { get; set; } -// public string Name { get; set; } -//} diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Service/MaterialManagement/ProductManagementService.cs b/admin.net.pro/Admin.NET/Vistar.Application/Service/MaterialManagement/ProductManagementService.cs index dbaed07..fc9276b 100644 --- a/admin.net.pro/Admin.NET/Vistar.Application/Service/MaterialManagement/ProductManagementService.cs +++ b/admin.net.pro/Admin.NET/Vistar.Application/Service/MaterialManagement/ProductManagementService.cs @@ -1,49 +1,16 @@ using Admin.NET.Core; -using COSXML.Model.Tag; -using DocumentFormat.OpenXml.Drawing.Diagrams; -using Elastic.Clients.Elasticsearch; using Furion.DependencyInjection; using Furion.DynamicApiController; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using NewLife.Remoting; -using System; -using System.Collections.Generic; using System.ComponentModel; -using System.Linq; -using System.Net; -using System.Net.Http.Headers; -using System.Security.Cryptography.X509Certificates; -using System.ServiceModel; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; using Vistar.Application.Const; using Vistar.Application.Entity; using Vistar.Application.Service.MaterialManagement.Dto; -using System.Net.Security; -using Org.BouncyCastle.Ocsp; -using System.Net.Http; -using NewLife.Configuration; -using Furion; using Admin.NET.Core.Service; using Vistar.Application.Util; -using Microsoft.Extensions.Options; using Vistar.Application.SapService.Dto; -using DocumentFormat.OpenXml.ExtendedProperties; -using Vistar.Application.SapService; -using static SKIT.FlurlHttpClient.Wechat.Api.Models.ComponentTCBBatchCreateContainerServiceVersionRequest.Types; -using DocumentFormat.OpenXml.Office2010.ExcelAc; -using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; -using static COSXML.Model.Object.SelectObjectResult; -using OfficeOpenXml.FormulaParsing.Excel.Functions.Information; using Vistar.Application.Common; -using static Elastic.Clients.Elasticsearch.JoinField; -using OfficeOpenXml.FormulaParsing.Logging; -using Furion.Logging; -using static Org.BouncyCastle.Math.Primes; - - namespace Vistar.Application.Service.MaterialManagement; @@ -66,7 +33,7 @@ public class ProductManagementService : IDynamicApiController, ITransient SqlSugarRepository configurationsRep, SysConfigService sysConfigService, SqlSugarRepository configurationDataRep, - SapService.SapService sapBomService, + SapService.SapService sapService, SqlSugarRepository obj118Rep, DataValidationService dataValidationService @@ -76,7 +43,7 @@ public class ProductManagementService : IDynamicApiController, ITransient _configurationsRep = configurationsRep; _sysConfigService = sysConfigService; _configurationDataRep = configurationDataRep; - _sapService = sapBomService; + _sapService = sapService; _obj118Rep = obj118Rep; _dataValidationService = dataValidationService; } @@ -99,26 +66,6 @@ public class ProductManagementService : IDynamicApiController, ITransient .ToPagedListAsync(input.Page, input.PageSize); return query; } - ///// - ///// 获取BOM类型 - ///// - ///// - //[HttpGet] - //public async Task> BomType() - //{ - // var BomType = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 110).ToListAsync(); - // var BomTypeData = new List(); - // for (int i = 0; i < BomType.Count; i++) - // { - // var data = new ProductManagementBomTypeOutput() - // { - // Id = BomType[i].ConfigID, - // Name = BomType[i].ConfigLabel - // }; - // BomTypeData.Add(data); - // } - // return BomTypeData; - //} /// /// 产品管理-同步到 SAP @@ -128,7 +75,7 @@ public class ProductManagementService : IDynamicApiController, ITransient [DisplayName("产品管理-同步到 SAP")] public async Task SyncToSAP(ProductManagementBaseInput input) { - const string lengthError = "物料编码长度大于40,请检查!"; + const string lengthError = "物料描述长度大于40,请检查!"; // 验证物料描述长度 if (input.fld004484.Length > 40) @@ -138,7 +85,8 @@ public class ProductManagementService : IDynamicApiController, ITransient { fld004629 = DateTime.Now, fld004312 = "N", - fld004313 = lengthError + fld004313 = lengthError, + fld004311="失败" }) .Where(it => it.idRecord == input.idRecord) .ExecuteCommandAsync().ConfigureAwait(false); @@ -334,7 +282,7 @@ public class ProductManagementService : IDynamicApiController, ITransient [DisplayName("产品管理-批量同步到SAP")] public async Task> BatchSyncToSAP(List input) { - const string lengthError = "物料编码长度大于40,请检查!"; + const string lengthError = "物料描述长度大于40,请检查!"; const string synchronized = "该物料编码已同步!"; var SapOutputList = new List(); var Requser = await _sysConfigService.GetConfigValueByCode(ConfigConst.SapUserName); @@ -348,7 +296,8 @@ public class ProductManagementService : IDynamicApiController, ITransient { fld004629 = DateTime.Now, fld004312 = "N", - fld004313 = lengthError + fld004313 = lengthError, + fld004311 = "失败" }) .Where(it => it.idRecord == input[i].idRecord) .ExecuteCommandAsync().ConfigureAwait(false); @@ -452,7 +401,7 @@ public class ProductManagementService : IDynamicApiController, ITransient var input = await _obj110Rep.AsQueryable() .Where(x => x.CheckedStatus == false && x.deleted == false && x.IsLatestVersion == true && (x.fld004312 == "A" || x.fld004312 == "M")) .ToListAsync(); - const string lengthError = "物料编码长度大于40,请检查!"; + const string lengthError = "物料描述长度大于40,请检查!"; var SapOutputList = new List(); var Requser = await _sysConfigService.GetConfigValueByCode(ConfigConst.SapUserName); for (int i = 0; i < input.Count; i++) @@ -465,7 +414,8 @@ public class ProductManagementService : IDynamicApiController, ITransient { fld004629 = DateTime.Now, fld004312 = "N", - fld004313 = lengthError + fld004313 = lengthError, + fld004311 = "失败" }) .Where(it => it.idRecord == input[i].idRecord) .ExecuteCommandAsync().ConfigureAwait(false); diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/Dto/BomProjectManagementInput.cs b/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/Dto/BomProjectManagementInput.cs new file mode 100644 index 0000000..438f27e --- /dev/null +++ b/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/Dto/BomProjectManagementInput.cs @@ -0,0 +1,199 @@ +// 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.ProjectManagement.Dto; +public class BomProjectManagementInput : BasePageInput +{ + /// + /// 子物料描述 + /// + public string? Description { get; set; } + + /// + /// 子物料编码 + /// + public string? PartNumber { get; set; } + + /// + /// 父Guid + /// + 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; } + + public bool? isDeleted { get; set; } + + public long ConfigInstanceID { get; set; } + + public long? ChildConfigID { get; set; } + + public long? CreatedUserID { get; set; } + + public long? ModifiedUserID { get; set; } + + public DateTime? CreatedDate { get; set; } + + public DateTime? ModifiedDate { get; set; } + + public double? Quantity { get; set; } + + public DateTime? EffectiveFrom { get; set; } + + public DateTime? EffectiveTo { get; set; } + + public string? Revision { get; set; } + + public string? Marker { get; set; } + + public string Type { get; set; } + + public long? ConfigParent { get; set; } + + public long? OrderIndex { get; set; } + + + public string? _conf_24_tralala { get; set; } + + public string? _conf_28_hello { get; set; } + + public string? _conf_28_sss { get; set; } + + public string? conf_29_sss { get; set; } + + public byte[]? RecordImage { get; set; } + + public string? Folder { get; set; } + + public int? CheckedStatus { get; set; } + + public string? _TestConfigurimi_tralala { get; set; } + + public string? _TestConfigurimi_asfasd { get; set; } + + public long ParentObjectID { get; set; } + + public string? conf_30_somefields { get; set; } + + public string? conf_30_TestNBS { get; set; } + + public DateTime? conf_30_testDate { get; set; } + + public long? conf_30_testNumber { get; set; } + + public string? conf_30_TestList { get; set; } + + public long? conf_30_testListNo { get; set; } + + public double? conf_30_testListdecimal { get; set; } + + public string? conf_33_Comments { get; set; } + + //public string? conf_33_SerialNo. { get; set; } + public string? conf_33_SerialNo { get; set; } + + public long? conf_33_TestContacts2 { get; set; } + + public long? conf_33_TestContacts2_Rec { get; set; } + + public string? conf_6_Comments { get; set; } + + public string? conf_6_SerialNumber { get; set; } + + public int? ChildSwFileType { get; set; } + + public int? ParentSwFileType { get; set; } + + public string? conf_19_Serial { get; set; } + + public string? conf_19_Comments { get; set; } + + public string? conf_21_Comments { get; set; } + + public string? conf_19_testList { get; set; } + + public string? conf_21_BuyStage { get; set; } + + public string? conf_19_testconfigfieldnbs { get; set; } + + public string? conf_32_Comments { get; set; } + + public bool? isSuppressed { get; set; } + + public bool isAddedFromSW { get; set; } + + public double? QtyManual { get; set; } + + public long? SWPDMXrefId { get; set; } + + public string? SwConfiguration { get; set; } + + public bool inContext { get; set; } + + public string PrimaryFile { get; set; } + + public bool bKeepQuantityInSync { get; set; } + + public string? BOMGuid { get; set; } + + public bool IsPDMReference { get; set; } + + public string? BOMGuidCopiedFrom { get; set; } + + public int? SWPDMXRefConfigurationID { get; set; } + + public string? SWPDMXRefConfigurationName { get; set; } + + public string? fld004492 { get; set; } + + public string? fld004670 { get; set; } + + public string? fld004671 { get; set; } + + public string? fld004691 { get; set; } + + public string? fld004936 { get; set; } + + public string? fld004937 { get; set; } + + public string? fld004938 { get; set; } + + public string? fld004939 { get; set; } + + public string? fld004940 { get; set; } + + public string? fld004941 { get; set; } + + public double? fld004994 { get; set; } + + public string? fld004995 { get; set; } + + public string? fld004996 { get; set; } + + public string? fld004997 { get; set; } + + public double? fld005017 { get; set; } + + public string? fld005018 { get; set; } + + public string? fld005019 { get; set; } + + public string? fld005020 { get; set; } +} diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/Dto/ProjectManagementBomOutput.cs b/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/Dto/ProjectManagementBomOutput.cs new file mode 100644 index 0000000..848f88a --- /dev/null +++ b/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/Dto/ProjectManagementBomOutput.cs @@ -0,0 +1,446 @@ +// 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 ProjectManagementBomOutput +{ + /// + /// + /// + 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; } + + /// + /// + /// + public bool? isDeleted { get; set; } + + /// + /// + /// + public long ConfigInstanceID { get; set; } + + /// + /// + /// + public long? ChildConfigID { get; set; } + + /// + /// + /// + public long? CreatedUserID { get; set; } + + /// + /// + /// + public long? ModifiedUserID { get; set; } + + /// + /// + /// + public DateTime? CreatedDate { get; set; } + + /// + /// + /// + public DateTime? ModifiedDate { get; set; } + + /// + /// + /// + public double? Quantity { get; set; } + + /// + /// + /// + public string? Description { get; set; } + + /// + /// + /// + public DateTime? EffectiveFrom { get; set; } + + /// + /// + /// + public DateTime? EffectiveTo { get; set; } + + /// + /// + /// + public string? Revision { get; set; } + + /// + /// + /// + public string? Marker { get; set; } + + /// + /// + /// + public string Type { get; set; } + + /// + /// + /// + public long? ConfigParent { get; set; } + + /// + /// + /// + public long? OrderIndex { get; set; } + + /// + /// + /// + public string? PartNumber { get; set; } + + /// + /// + /// + public string? _conf_24_tralala { get; set; } + + /// + /// + /// + public string? _conf_28_hello { get; set; } + + /// + /// + /// + public string? _conf_28_sss { get; set; } + + /// + /// + /// + public string? conf_29_sss { get; set; } + + /// + /// + /// + public byte[]? RecordImage { get; set; } + + /// + /// + /// + public string? Folder { get; set; } + + /// + /// + /// + public int? CheckedStatus { get; set; } + + /// + /// + /// + public string? _TestConfigurimi_tralala { get; set; } + + /// + /// + /// + public string? _TestConfigurimi_asfasd { get; set; } + + /// + /// + /// + public long ParentObjectID { get; set; } + + /// + /// + /// + public string? conf_30_somefields { get; set; } + + /// + /// + /// + public string? conf_30_TestNBS { get; set; } + + /// + /// + /// + public DateTime? conf_30_testDate { get; set; } + + /// + /// + /// + public long? conf_30_testNumber { get; set; } + + /// + /// + /// + public string? conf_30_TestList { get; set; } + + /// + /// + /// + public long? conf_30_testListNo { get; set; } + + /// + /// + /// + public double? conf_30_testListdecimal { get; set; } + + /// + /// + /// + public string? conf_33_Comments { get; set; } + + /// + /// + /// + //public string? conf_33_SerialNo. { get; set; } + public string? conf_33_SerialNo { get; set; } + + /// + /// + /// + public long? conf_33_TestContacts2 { get; set; } + + /// + /// + /// + public long? conf_33_TestContacts2_Rec { get; set; } + + /// + /// + /// + public string? conf_6_Comments { get; set; } + + /// + /// + /// + public string? conf_6_SerialNumber { get; set; } + + /// + /// + /// + public int? ChildSwFileType { get; set; } + + /// + /// + /// + public int? ParentSwFileType { get; set; } + + /// + /// + /// + public string? conf_19_Serial { get; set; } + + /// + /// + /// + public string? conf_19_Comments { get; set; } + + /// + /// + /// + public string? conf_21_Comments { get; set; } + + /// + /// + /// + public string? conf_19_testList { get; set; } + + /// + /// + /// + public string? conf_21_BuyStage { get; set; } + + /// + /// + /// + public string? conf_19_testconfigfieldnbs { get; set; } + + /// + /// + /// + public string? conf_32_Comments { get; set; } + + /// + /// + /// + public bool? isSuppressed { get; set; } + + /// + /// + /// + public bool isAddedFromSW { get; set; } + + /// + /// + /// + public double? QtyManual { get; set; } + + /// + /// + /// + public long? SWPDMXrefId { get; set; } + + /// + /// + /// + public string? SwConfiguration { get; set; } + + /// + /// + /// + public bool inContext { get; set; } + + /// + /// + /// + public string PrimaryFile { get; set; } + + /// + /// + /// + public bool bKeepQuantityInSync { get; set; } + + /// + /// + /// + public string? BOMGuid { get; set; } + + /// + /// + /// + public bool IsPDMReference { get; set; } + + /// + /// + /// + public string? BOMGuidCopiedFrom { get; set; } + + /// + /// + /// + public int? SWPDMXRefConfigurationID { get; set; } + + /// + /// + /// + public string? SWPDMXRefConfigurationName { get; set; } + + /// + /// + /// + public string? fld004492 { get; set; } + + /// + /// + /// + public string? fld004670 { get; set; } + + /// + /// + /// + public string? fld004671 { get; set; } + + /// + /// + /// + public string? fld004691 { get; set; } + + /// + /// + /// + public string? fld004936 { get; set; } + + /// + /// + /// + public string? fld004937 { get; set; } + + /// + /// + /// + public string? fld004938 { get; set; } + + /// + /// + /// + public string? fld004939 { get; set; } + + /// + /// + /// + public string? fld004940 { get; set; } + + /// + /// + /// + public string? fld004941 { get; set; } + + /// + /// + /// + public double? fld004994 { get; set; } + + /// + /// + /// + public string? fld004995 { get; set; } + + /// + /// + /// + public string? fld004996 { get; set; } + + /// + /// + /// + public string? fld004997 { get; set; } + + /// + /// + /// + public double? fld005017 { get; set; } + + /// + /// + /// + public string? fld005018 { get; set; } + + /// + /// + /// + public string? fld005019 { get; set; } + + /// + /// + /// + public string? fld005020 { get; set; } +} diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/Dto/ProjectManagementInput.cs b/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/Dto/ProjectManagementInput.cs new file mode 100644 index 0000000..1b25015 --- /dev/null +++ b/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/Dto/ProjectManagementInput.cs @@ -0,0 +1,399 @@ +using Admin.NET.Core; +using DocumentFormat.OpenXml.Office2010.Word; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Vistar.Application.Service.ProjectManagement.Dto; +/// +/// 项目管理基础输入参数 +/// +public class ProjectManagementInput +{ + public long idRecord { get; set; } + + public int? CheckedStatus { get; set; } + + public int? VersionIndex { get; set; } + + public bool? IsLatestVersion { get; set; } + + public DateTime? CreatedDate { get; set; } + + public DateTime? VersionCreatedDate { get; set; } + + public DateTime? dateModified { get; set; } + + public long? UserCreatedId { get; set; } + + public long? VersionUserCreatedId { get; set; } + + public long? UserModifiedId { get; set; } + public string? RecordGuid { get; set; } + public bool? isVisibilityNormal { get; set; } + public bool? deleted { get; set; } + public string? SubObjectGuid { get; set; } + + public bool? PreviousStatus { get; set; } + + public string? revision { get; set; } + + public byte[]? Record_image160_160 { get; set; } + + public byte[]? Record_Image320_240 { 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_End { get; set; } + + public string? CheckedOutPc { get; set; } + + public long? StageId { get; set; } + + public long? ProjectManager { get; set; } + + public string? ProjectManager_Rec { get; set; } + + public long? GroupObjId { get; set; } + + public bool? EnableNotifications { get; set; } + + public bool? _CheckOutInProgress { get; set; } + + public string _System_ObjNbsAuto { get; set; } + + public double? WorkHoursMon { get; set; } + + public double? WorkHoursTue { get; set; } + + public double? WorkHoursWed { get; set; } + + public double? WorkHoursThu { get; set; } + + public double? WorkHoursFri { get; set; } + + public double? WorkHoursSat { get; set; } + + public double? WorkHoursSun { get; set; } + + public string? DefaultStartTime { get; set; } + public bool? WeekStartDay { get; set; } + + public bool? DurationUnits { get; set; } + + public bool? MoveUnEditedTask { get; set; } + + public bool? MoveEditedTask { get; set; } + + public bool? UpdateProgressFromTasks { get; set; } + + public bool IsAutomaticScheduling { get; set; } + + public string? _System_DerivedFrom { get; set; } + + public string? _System_DerivedFrom_RecordGuid { get; set; } + + public string? _System_WebLink { get; set; } + + public double? _System_Progress { get; set; } + + public bool? isReleasedVersion { get; set; } + + public bool ShowHoursInDates { get; set; } + + public double TimeIncrement { get; set; } + + /// + /// 业务类型 + /// + public string? fld004481 { get; set; } + + /// + /// 公司缩写 + /// + public string? fld004482 { get; set; } + + /// + /// 项目编号(设计) + /// + public string? fld004483 { get; set; } + + /// + /// 项目描述 + /// + public string? fld004502 { get; set; } + + /// + /// 开始日期 + /// + public DateTime? fld004503 { get; set; } + + /// + /// 预计完成日期 + /// + public DateTime? fld004504 { get; set; } + + /// + /// 实际完成日期 + /// + public DateTime? fld004505 { get; set; } + + /// + /// 项目状态 + /// + public string? fld004506 { get; set; } + + /// + /// 物料同步信息 + /// + public string? fld004507 { get; set; } + + /// + /// 物料同步日期 + /// + public DateTime? fld004508 { get; set; } + + /// + /// 物料同步状态 + /// + public string? fld004509 { get; set; } + + /// + /// 物料同步标识 A:新增 M:修改 D:停用 N:已处理 + /// + public string? fld004510 { get; set; } + + /// + /// BOM同步状态 + /// + public string? fld004511 { get; set; } + + /// + /// BOM同步信息 + /// + public string? fld004512 { get; set; } + + /// + /// BOM同步日期 + /// + public DateTime? fld004513 { get; set; } + + /// + /// BOM同步标识 A:新增 M:修改 D:停用 N:已处理 + /// + public string? fld004514 { get; set; } + + /// + /// 工艺同步状态 + /// + public string? fld004515 { get; set; } + + /// + /// 工艺同步标识 A:新增 M:修改 D:停用 N:已处理 + /// + public string? fld004516 { get; set; } + + /// + /// 工艺同步标识 + /// + public string? fld004517 { get; set; } + + /// + /// 工艺同步日期 + /// + public DateTime? fld004518 { get; set; } + + /// + /// 物料类型 + /// + public string? fld004519 { get; set; } + + /// + /// 物料组 + /// + public string? fld004520 { get; set; } + + /// + /// 行业领域 + /// + public string? fld004521 { get; set; } + + /// + /// 工厂 + /// + public string? fld004522 { get; set; } + + /// + /// 毛重 + /// + public double? fld004523 { get; set; } + + /// + /// 预算总额 + /// + public double? fld004524 { get; set; } + + /// + /// 已花费金额 + /// + public double? fld004525 { get; set; } + + /// + /// 剩余预算 + /// + public string? fld004526 { get; set; } + + /// + /// 客户编号 + /// + public long? fld004545 { get; set; } + + /// + /// 客户编号ID + /// + public string? fld004545_Rec { get; set; } + + /// + /// 客户名称 + /// + public string? fld004546 { get; set; } + + /// + /// 项目经理 + /// + public string? fld004547 { get; set; } + + public long? fld004682 { get; set; } + + public string? fld004682_Rec { get; set; } + + public DateTime? fld004683 { get; set; } + + public string? fld004684 { get; set; } + + public string? fld004685 { get; set; } + + public string? fld004686 { get; set; } + + public long? fld004687 { get; set; } + + public string? fld004687_Rec { get; set; } + + public DateTime? fld004688 { get; set; } + + public long? fld004689 { get; set; } + + public string? fld004689_Rec { get; set; } + + public DateTime? fld004690 { get; set; } + + public string? fld004728 { get; set; } + + public long? fld004866 { get; set; } + + public string? fld004866_Rec { get; set; } + + public long? fld004867 { get; set; } + + public string? fld004867_Rec { get; set; } + + public long? fld004868 { get; set; } + + public string? fld004868_Rec { get; set; } + + public DateTime? fld004869 { get; set; } + + public DateTime? fld004870 { get; set; } + + public DateTime? fld004871 { get; set; } + + public long? fld004883 { get; set; } + + public string? fld004883_Rec { get; set; } + + public long? fld004884 { get; set; } + + public string? fld004884_Rec { get; set; } + + public long? fld004885 { get; set; } + + public string? fld004885_Rec { get; set; } + + public long? fld004886 { get; set; } + + public string? fld004886_Rec { get; set; } + + public string? fld004924 { get; set; } + + public string? fld004925 { get; set; } + + public string? fld004926 { get; set; } + + public string? fld004927 { get; set; } + + public string? fld004928 { get; set; } + + public string? fld004929 { get; set; } + + public string? fld004930 { get; set; } + + public string? fld004931 { get; set; } + + public string? fld004932 { get; set; } + + public double? fld004933 { get; set; } + + public double? fld004934 { get; set; } + + public string? fld004935 { get; set; } + + public long? fld004946 { get; set; } + + public long? fld004947 { get; set; } + + public string? fld004947_Rec { get; set; } + + public string? fld004948 { get; set; } + + public DateTime? fld004949 { get; set; } + + public string? fld005040 { get; set; } +} + +/// +/// 产品管理分页查询输入参数 +/// +public class PageProjectManagementInput : BasePageInput +{ + /// + /// 项目编号 + /// + public string? _System_objNBS { get; set; } + + /// + /// 项目描述 + /// + public string? fld004502 { get; set; } + + /// + /// 创建时间 + /// + public DateTime? fld004683 { get; set; } + + /// + /// 创建时间范围 + /// + public DateTime?[] fld004683Range { get; set; } + + +} diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/Dto/ProjectManagementOutput.cs b/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/Dto/ProjectManagementOutput.cs new file mode 100644 index 0000000..f3c79a4 --- /dev/null +++ b/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/Dto/ProjectManagementOutput.cs @@ -0,0 +1,373 @@ +// 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 ProjectManagementOutput +{ + public long idRecord { get; set; } + + public int? CheckedStatus { get; set; } + + public int? VersionIndex { get; set; } + + public bool? IsLatestVersion { get; set; } + + public DateTime? CreatedDate { get; set; } + + public DateTime? VersionCreatedDate { get; set; } + + public DateTime? dateModified { get; set; } + + public long? UserCreatedId { get; set; } + + public long? VersionUserCreatedId { get; set; } + + public long? UserModifiedId { get; set; } + public string? RecordGuid { get; set; } + public bool? isVisibilityNormal { get; set; } + public bool? deleted { get; set; } + public string? SubObjectGuid { get; set; } + + public bool? PreviousStatus { get; set; } + + public string? revision { get; set; } + + public byte[]? Record_image160_160 { get; set; } + + public byte[]? Record_Image320_240 { 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_End { get; set; } + + public string? CheckedOutPc { get; set; } + + public long? StageId { get; set; } + + public long? ProjectManager { get; set; } + + public string? ProjectManager_Rec { get; set; } + + public long? GroupObjId { get; set; } + + public bool? EnableNotifications { get; set; } + + public bool? _CheckOutInProgress { get; set; } + + public string _System_ObjNbsAuto { get; set; } + + public double? WorkHoursMon { get; set; } + + public double? WorkHoursTue { get; set; } + + public double? WorkHoursWed { get; set; } + + public double? WorkHoursThu { get; set; } + + public double? WorkHoursFri { get; set; } + + public double? WorkHoursSat { get; set; } + + public double? WorkHoursSun { get; set; } + + public string? DefaultStartTime { get; set; } + public bool? WeekStartDay { get; set; } + + public bool? DurationUnits { get; set; } + + public bool? MoveUnEditedTask { get; set; } + + public bool? MoveEditedTask { get; set; } + + public bool? UpdateProgressFromTasks { get; set; } + + public bool IsAutomaticScheduling { get; set; } + + public string? _System_DerivedFrom { get; set; } + + public string? _System_DerivedFrom_RecordGuid { get; set; } + + public string? _System_WebLink { get; set; } + + public double? _System_Progress { get; set; } + + public bool? isReleasedVersion { get; set; } + + public bool ShowHoursInDates { get; set; } + + public double TimeIncrement { get; set; } + + /// + /// 业务类型 + /// + public string? fld004481 { get; set; } + + /// + /// 公司缩写 + /// + public string? fld004482 { get; set; } + + /// + /// 项目编号(设计) + /// + public string? fld004483 { get; set; } + + /// + /// 项目描述 + /// + public string? fld004502 { get; set; } + + /// + /// 开始日期 + /// + public DateTime? fld004503 { get; set; } + + /// + /// 预计完成日期 + /// + public DateTime? fld004504 { get; set; } + + /// + /// 实际完成日期 + /// + public DateTime? fld004505 { get; set; } + + /// + /// 项目状态 + /// + public string? fld004506 { get; set; } + + /// + /// 物料同步信息 + /// + public string? fld004507 { get; set; } + + /// + /// 物料同步日期 + /// + public DateTime? fld004508 { get; set; } + + /// + /// 物料同步状态 + /// + public string? fld004509 { get; set; } + + /// + /// 物料同步标识 A:新增 M:修改 D:停用 N:已处理 + /// + public string? fld004510 { get; set; } + + /// + /// BOM同步状态 + /// + public string? fld004511 { get; set; } + + /// + /// BOM同步信息 + /// + public string? fld004512 { get; set; } + + /// + /// BOM同步日期 + /// + public DateTime? fld004513 { get; set; } + + /// + /// BOM同步标识 A:新增 M:修改 D:停用 N:已处理 + /// + public string? fld004514 { get; set; } + + /// + /// 工艺同步状态 + /// + public string? fld004515 { get; set; } + + /// + /// 工艺同步标识 A:新增 M:修改 D:停用 N:已处理 + /// + public string? fld004516 { get; set; } + + /// + /// 工艺同步标识 + /// + public string? fld004517 { get; set; } + + /// + /// 工艺同步日期 + /// + public DateTime? fld004518 { get; set; } + + /// + /// 物料类型 + /// + public string? fld004519 { get; set; } + + /// + /// 物料组 + /// + public string? fld004520 { get; set; } + + /// + /// 行业领域 + /// + public string? fld004521 { get; set; } + + /// + /// 工厂 + /// + public string? fld004522 { get; set; } + + /// + /// 毛重 + /// + public double? fld004523 { get; set; } + + /// + /// 预算总额 + /// + public double? fld004524 { get; set; } + + /// + /// 已花费金额 + /// + public double? fld004525 { get; set; } + + /// + /// 剩余预算 + /// + public string? fld004526 { get; set; } + + /// + /// 客户编号 + /// + public long? fld004545 { get; set; } + + /// + /// 客户编号ID + /// + public string? fld004545_Rec { get; set; } + + /// + /// 客户名称 + /// + public string? fld004546 { get; set; } + + /// + /// 项目经理 + /// + public string? fld004547 { get; set; } + + public long? fld004682 { get; set; } + + public string? fld004682_Rec { get; set; } + + public DateTime? fld004683 { get; set; } + + public string? fld004684 { get; set; } + + public string? fld004685 { get; set; } + + public string? fld004686 { get; set; } + + public long? fld004687 { get; set; } + + public string? fld004687_Rec { get; set; } + + public DateTime? fld004688 { get; set; } + + public long? fld004689 { get; set; } + + public string? fld004689_Rec { get; set; } + + public DateTime? fld004690 { get; set; } + + public string? fld004728 { get; set; } + + public long? fld004866 { get; set; } + + public string? fld004866_Rec { get; set; } + + public long? fld004867 { get; set; } + + public string? fld004867_Rec { get; set; } + + public long? fld004868 { get; set; } + + public string? fld004868_Rec { get; set; } + + public DateTime? fld004869 { get; set; } + + public DateTime? fld004870 { get; set; } + + public DateTime? fld004871 { get; set; } + + public long? fld004883 { get; set; } + + public string? fld004883_Rec { get; set; } + + public long? fld004884 { get; set; } + + public string? fld004884_Rec { get; set; } + + public long? fld004885 { get; set; } + + public string? fld004885_Rec { get; set; } + + public long? fld004886 { get; set; } + + public string? fld004886_Rec { get; set; } + + public string? fld004924 { get; set; } + + public string? fld004925 { get; set; } + + public string? fld004926 { get; set; } + + public string? fld004927 { get; set; } + + public string? fld004928 { get; set; } + + public string? fld004929 { get; set; } + + public string? fld004930 { get; set; } + + public string? fld004931 { get; set; } + + public string? fld004932 { get; set; } + + public double? fld004933 { get; set; } + + public double? fld004934 { get; set; } + + public string? fld004935 { get; set; } + + public long? fld004946 { get; set; } + + public long? fld004947 { get; set; } + + public string? fld004947_Rec { get; set; } + + public string? fld004948 { get; set; } + + public DateTime? fld004949 { get; set; } + + public string? fld005040 { 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 new file mode 100644 index 0000000..42c3310 --- /dev/null +++ b/admin.net.pro/Admin.NET/Vistar.Application/Service/ProjectManagement/ProjectManagementService.cs @@ -0,0 +1,624 @@ +using Admin.NET.Core; +using Admin.NET.Core.Service; +using Furion.DependencyInjection; +using Furion.DynamicApiController; +using Microsoft.AspNetCore.Authorization; +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.Common; +using Vistar.Application.Const; +using Vistar.Application.Entity; +using Vistar.Application.SapService.Dto; +using Vistar.Application.Service.ProjectManagement.Dto; +using Vistar.Application.Util; + +namespace Vistar.Application.Service.ProjectManagement; +/// +/// 项目管理服务 +/// +[ApiDescriptionSettings(ApplicationConst.GroupName, Name = "ProjectManagement", Order = 100)] +public class ProjectManagementService : IDynamicApiController, ITransient +{ + private readonly SqlSugarRepository _obj109Rep; + private readonly SysConfigService _sysConfigService; + public SapService.SapService _sapService; + private readonly SqlSugarRepository _configurationsRep; + private readonly SqlSugarRepository _configurationDataRep; + public SqlSugarRepository _obj118Rep; + public Common.DataValidationService _dataValidationService; + + public ProjectManagementService( + SqlSugarRepository obj109Rep, + SysConfigService sysConfigService, + SapService.SapService sapService, + SqlSugarRepository configurationsRep, + SqlSugarRepository configurationDataRep, + SqlSugarRepository obj118Rep, + DataValidationService dataValidationService + ) + { + _obj109Rep = obj109Rep; + _sysConfigService = sysConfigService; + _sapService = sapService; + _configurationsRep = configurationsRep; + _configurationDataRep = configurationDataRep; + _obj118Rep = obj118Rep; + _dataValidationService = dataValidationService; + } + /// + /// 分页查询项目管理 + /// + /// + /// + [ApiDescriptionSettings(Name = "page", Description = "分页查询", Order = 1000), HttpPost] + [DisplayName("分页查询项目管理")] + public async Task> Page(PageProjectManagementInput input) + { + var query = await _obj109Rep.AsQueryable() + .Where(x => (x.CheckedStatus == 0||x.CheckedStatus==1) && x.deleted == false && x.IsLatestVersion == true&&x.fld005040=="发布") + .WhereIF(!string.IsNullOrWhiteSpace(input._System_objNBS), u => u._System_objNBS.Contains(input._System_objNBS.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.fld004502), u => u.fld004502.Contains(input.fld004502.Trim())) + .WhereIF(input.fld004683Range != null && input.fld004683Range.Length == 2, u => u.fld004683 >= input.fld004683Range[0] && u.fld004683 <= input.fld004683Range[1]) + .Select() + .ToPagedListAsync(input.Page, input.PageSize); + return query; + } + + /// + /// 项目管理-同步到 SAP + /// + /// + [ApiDescriptionSettings(Name = "syncToSAP"), HttpPost] + [DisplayName("项目管理-同步到 SAP")] + public async Task SyncToSAP(ProjectManagementInput input) + { + const string lengthError = "项目描述长度大于40,请检查!"; + + // 验证物料描述长度 + if (input.fld004502.Length > 40) + { + await _obj109Rep.AsUpdateable() + .SetColumns(it => new Obj109 + { + fld004508 = DateTime.Now, + fld004510 = "N", + fld004507 = lengthError, + fld004509="失败" + }) + .Where(it => it.idRecord == input.idRecord) + .ExecuteCommandAsync().ConfigureAwait(false); + + return new SapOutput + { + 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(ConfigConst.SapUserName), + Note1 = "", + Note2 = "", + Note3 = "", + Zwbid = millisecondTimestamp, + Matnr = input._System_objNBS, + Mbrsh = input.fld004521, + Mtart = input.fld004519, + Maktx = input.fld004502, + Meins = "",//sssssssss基本计量单位 + Matkl = input.fld004520, + Bismt = input.fld004684, + Groes = input.fld004685, + Normt = input.fld004924, + Ferth = input.fld004925, + Zeinr = input.fld004926, + Mstae = "",//sssssssssss跨工厂物料状态 + Raube = input.fld004932, + Mhdrz = input.fld004933.ToString(), + Mhdhb = input.fld004934.ToString(), + Werks = input.fld004522, + Beskz = input.fld004929, + Sobsl = input.fld004928, + Schgt = input.fld004930, + Rgekz = input.fld004931, + Zbom = input.fld004935 + }; + + var apiOutput = await _sapService.SapMaterialApi(sapMaterialInput); + string codeVal = apiOutput.code == "S" ? "成功" : "失败"; + var msg = apiOutput.msg; + if (apiOutput.msg == "") + { + msg = "同步成功"; + } + + await _obj109Rep.AsUpdateable() + .SetColumns(it => new Obj109 + { + fld004508 = DateTime.Now, + fld004510 = codeVal, + fld004507 = "N", + fld004509 = msg + }) + .Where(it => it.idRecord == input.idRecord) + .ExecuteCommandAsync(); + var output = new SapOutput() + { + parameter = apiOutput.parameter, + code = codeVal, + msg = msg, + result = apiOutput.result + }; + return output; + } + + /// + /// 项目管理-批量同步到SAP + /// + /// + /// + [ApiDescriptionSettings(Name = "BatchSyncToSAP"), HttpPost] + [DisplayName("项目管理-批量同步到SAP")] + public async Task> BatchSyncToSAP(List input) + { + const string lengthError = "物料描述长度大于40,请检查!"; + const string synchronized = "该项目编号已同步!"; + var SapOutputList = new List(); + var Requser = await _sysConfigService.GetConfigValueByCode(ConfigConst.SapUserName); + for (int i = 0; i < input.Count; i++) + { + // 验证物料描述长度 + if (input[i].fld004502.Length > 40) + { + await _obj109Rep.AsUpdateable() + .SetColumns(it => new Obj109 + { + fld004508 = DateTime.Now, + fld004510 = "N", + fld004507 = lengthError, + fld004509 = "失败" + }) + .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].fld004510 == "N") + { + 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(ConfigConst.SapUserName), + Note1 = "", + Note2 = "", + Note3 = "", + Zwbid = millisecondTimestamp, + Matnr = input[i]._System_objNBS, + Mbrsh = input[i].fld004521, + Mtart = input[i].fld004519, + Maktx = input[i].fld004502, + Meins = "",//sssssssss基本计量单位 + Matkl = input[i].fld004520, + Bismt = input[i].fld004684, + Groes = input[i].fld004685, + Normt = input[i].fld004924, + Ferth = input[i].fld004925, + Zeinr = input[i].fld004926, + Mstae = "",//sssssssssss跨工厂物料状态 + Raube = input[i].fld004932, + Mhdrz = input[i].fld004933.ToString(), + Mhdhb = input[i].fld004934.ToString(), + Werks = input[i].fld004522, + Beskz = input[i].fld004929, + Sobsl = input[i].fld004928, + Schgt = input[i].fld004930, + Rgekz = input[i].fld004931, + Zbom = input[i].fld004935 + }; + var sapOutput = await _sapService.SapMaterialApi(sapMaterialInput); + string codeVal = sapOutput.code == "S" ? "成功" : "失败"; + string msg = sapOutput.msg; + + if (sapOutput.msg == "") + { + msg = "同步成功"; + } + await _obj109Rep.AsUpdateable() + .SetColumns(it => new Obj109 + { + fld004508 = DateTime.Now, + fld004510 = "N", + fld004507 = lengthError, + fld004509 = "失败" + }) + .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; + } + + /// + /// 获取BOM + /// + /// + /// + [ApiDescriptionSettings(Name = "GetBOM", Description = "获取BOM", Order = 1000), HttpPost] + [DisplayName("获取BOM")] + public async Task> GetBOM(BomProjectManagementInput input) + { + var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 109 && x.ConfigLabel == "mBOM").FirstAsync(); + var parent = await _obj109Rep.AsQueryable().Where(x => x.RecordGuid == input.ParentGuid && x.deleted == false).MaxAsync(x => x.VersionIndex); + var BomData = await _configurationDataRep.AsQueryable() + .Where(x => x.ConfigId == configid.ConfigID && x.ParentGuid == input.ParentGuid && x.isDeleted == false && x.ParentVersion == parent) + .WhereIF(!string.IsNullOrWhiteSpace(input.Description), u => u.Description.Contains(input.Description.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.PartNumber), u => u.PartNumber.Contains(input.PartNumber.Trim())) + .Select().ToPagedListAsync(input.Page, input.PageSize); + return BomData; + } + + /// + /// 项目管理-Bom同步到SAP + /// + /// + /// + [ApiDescriptionSettings(Name = "SyncToSAPBom"), HttpPost] + [DisplayName("项目管理-Bom同步到SAP")] + public async Task SyncToSAPBom(List input) + { + var ParentData = await _obj109Rep.AsQueryable().Where(x => x.RecordGuid == input[0].ParentGuid && x.deleted == false && x.VersionIndex == input[0].ParentVersion).FirstAsync(); + var EcnData = await _obj118Rep.AsQueryable().Where(x => x.RecordGuid == ParentData.fld004947_Rec && x.deleted == false).OrderByDescending(x => x.VersionIndex).FirstAsync(); + var ecn = ""; + if (EcnData != null) + { + ecn = EcnData._System_objNBS; + } + + var itemDataList = new List(); + + for (int i = 0; i < input.Count; i++) + { + var Verification = await _dataValidationService.VerificationMaterial(input[i].ChildObjID, input[i].PartNumber, input[i].ChildGuid); + if (Verification == "不存在") + { + continue; + } + int sun = i + 1; + var itemData = new ItemData() + { + POSNR = sun.ToString(),//组件序号 + IDNRK = input[i].PartNumber,//组件物料号 + MENGE = input[i].Quantity.ToString(),//组件数量 + SORTF = input[i].fld004936, + ITISOB = input[i].fld004937, + ALPGR = input[i].fld004938, + ALPRF = input[i].fld004939, + ZDELETE = input[i].fld004940, + POSTP = input[i].fld004492, + ZYFMK = input[i].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 = await _sysConfigService.GetConfigValueByCode(ConfigConst.SapUserName), + Note1 = "", + Note2 = "", + Note3 = "", + Zwbid = millisecondTimestamp, + Matnr = ParentData._System_objNBS,//父物料编码 + Werks = ParentData.fld004522,//工厂 + Bmeng = ParentData.fld004946.ToString(), + Aennr = ecn, + Datuv = ParentData.fld004949.ToString(), + ItemList = itemDataList + }; + var apiOutput = await _sapService.SapBomApi(isreq); + string codeVal = apiOutput.code == "S" ? "成功" : "失败"; + await _obj109Rep.AsUpdateable() + .SetColumns(it => new Obj109 + { + fld004513 = DateTime.Now, + fld004511 = codeVal, + fld004514 = "N", + fld004512 = apiOutput.msg + }) + .Where(it => it.idRecord == ParentData.idRecord) + .ExecuteCommandAsync(); + var msg = apiOutput.msg; + if (apiOutput.msg == "") + { + msg = "同步成功"; + } + var output = new SapOutput() + { + parameter = apiOutput.parameter, + code = codeVal, + msg = msg, + result = apiOutput.result + }; + return output; + } + + /// + /// 项目管理-定时同步到SAP + /// + /// + [ApiDescriptionSettings(Name = "TimingSyncToSAP"), HttpGet] + [DisplayName("项目管理-定时同步到SAP")] + [AllowAnonymous] + public async Task> TimingSyncToSAP() + { + var input = await _obj109Rep.AsQueryable() + .Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1) && x.deleted == false && x.IsLatestVersion == true && x.fld005040 == "发布") + .ToListAsync(); + const string lengthError = "物料描述长度大于40,请检查!"; + var SapOutputList = new List(); + var Requser = await _sysConfigService.GetConfigValueByCode(ConfigConst.SapUserName); + for (int i = 0; i < input.Count; i++) + { + // 验证物料描述长度 + if (input[i].fld004502.Length > 40) + { + await _obj109Rep.AsUpdateable() + .SetColumns(it => new Obj109 + { + fld004508 = DateTime.Now, + fld004510 = "N", + fld004507 = lengthError, + fld004509 = "失败" + }) + .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(ConfigConst.SapUserName), + Note1 = "", + Note2 = "", + Note3 = "", + Zwbid = millisecondTimestamp, + Matnr = input[i]._System_objNBS, + Mbrsh = input[i].fld004521, + Mtart = input[i].fld004519, + Maktx = input[i].fld004502, + Meins = "",//sssssssss基本计量单位 + Matkl = input[i].fld004520, + Bismt = input[i].fld004684, + Groes = input[i].fld004685, + Normt = input[i].fld004924, + Ferth = input[i].fld004925, + Zeinr = input[i].fld004926, + Mstae = "",//sssssssssss跨工厂物料状态 + Raube = input[i].fld004932, + Mhdrz = input[i].fld004933.ToString(), + Mhdhb = input[i].fld004934.ToString(), + Werks = input[i].fld004522, + Beskz = input[i].fld004929, + Sobsl = input[i].fld004928, + Schgt = input[i].fld004930, + Rgekz = input[i].fld004931, + Zbom = input[i].fld004935 + }; + var sapOutput = await _sapService.SapMaterialApi(sapMaterialInput); + string codeVal = sapOutput.code == "S" ? "成功" : "失败"; + string msg = sapOutput.msg; + + if (sapOutput.msg == "") + { + msg = "同步成功"; + } + await _obj109Rep.AsUpdateable() + .SetColumns(it => new Obj109 + { + fld004508 = DateTime.Now, + fld004509 = codeVal, + fld004510 = "N", + fld004507 = 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; + } + + /// + /// 项目管理-定时同步 BOM 到 SAP + /// + /// + [ApiDescriptionSettings(Name = "TimingSyncToSAPBom"), HttpGet] + [DisplayName("项目管理-定时同步 Bom 到 SAP")] + [AllowAnonymous] + public async Task> TimingSyncToSAPBom() + { + var sapOutputList = new List(); + var sapUserName = await _sysConfigService.GetConfigValueByCode(ConfigConst.SapUserName); + // 配置 + var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 110 && x.ConfigLabel == "mBOM").FirstAsync(); + + var materialData = await _obj109Rep.AsQueryable() + .Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1) && x.deleted == false && x.IsLatestVersion == true && x.fld005040 == "发布"&& x.fld004511 == "成功" && (x.fld004514 == "A" || x.fld004514 == "M")) + .ToListAsync(); + var groupedData = materialData.GroupBy(item => item.RecordGuid) + .Select(group => group.OrderByDescending(item => item.VersionIndex).First()) + .ToList(); + + foreach (var item in groupedData) + { + // 获取版本号 + var versionIndex = item.VersionIndex; + // 获取 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(); + 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 ecn = ecnData != null ? ecnData._System_objNBS : ""; + + var itemDataList = new List(); + foreach (var bomItem in bomData) + { + var verification = await _dataValidationService.VerificationMaterial(bomItem.ChildObjID, bomItem.PartNumber, bomItem.ChildGuid); + if (verification == "不存在") + { + continue; + } + + var itemData = new ItemData + { + POSNR = (bomData.IndexOf(bomItem) + 1).ToString(), + IDNRK = bomItem.PartNumber, + MENGE = bomItem.Quantity.ToString(), + SORTF = bomItem.fld004936, + ITISOB = bomItem.fld004937, + ALPGR = bomItem.fld004938, + ALPRF = bomItem.fld004939, + ZDELETE = bomItem.fld004940, + POSTP = bomItem.fld004492, + ZYFMK = bomItem.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 = item._System_objNBS, + Werks = item.fld004522, + Bmeng = item.fld004946.ToString(), + Aennr = ecn, + Datuv = item.fld004949.ToString(), + ItemList = itemDataList + }; + + var apiOutput = await _sapService.SapBomApi(isreq); + string codeVal = apiOutput.code == "S" ? "成功" : "失败"; + await _obj109Rep.AsUpdateable() + .SetColumns(it => new Obj109 + { + fld004513 = DateTime.Now, + fld004511 = codeVal, + fld004514 = "N", + fld004512 = apiOutput.msg + }) + .Where(it => it.idRecord == item.idRecord) + .ExecuteCommandAsync(); + + var msg = apiOutput.msg; + if (string.IsNullOrEmpty(msg)) + { + msg = "同步成功"; + } + + var output = new SapOutput + { + parameter = apiOutput.parameter, + materialCode = item._System_objNBS, + code = codeVal, + msg = msg, + result = apiOutput.result + }; + sapOutputList.Add(output); + } + return sapOutputList; + } + +} diff --git a/admin.net.pro/Web/src/api/materialManagement/productManagement.ts b/admin.net.pro/Web/src/api/materialManagement/productManagement.ts index 5cca365..266275f 100644 --- a/admin.net.pro/Web/src/api/materialManagement/productManagement.ts +++ b/admin.net.pro/Web/src/api/materialManagement/productManagement.ts @@ -1,7 +1,6 @@ import request from '/@/utils/request'; enum Api { PageProductManagement = '/api/productManagement/page', - BomTypeProductManagement = '/api/productManagement/bomType', SyncToSAPProductManagement = '/api/productManagement/SyncToSAP', GetetBOMProductManagement = '/api/productManagement/getBOM', SyncToSAPBomProductManagement = '/api/productManagement/syncToSAPBom', @@ -16,13 +15,6 @@ export const PageProductManagement = (params?: any) => data: params, }); -// BOM类型 -export const BomTypeProductManagement = () => - request({ - url: Api.BomTypeProductManagement, - method: 'get', - data: {}, - }); // 同步到SAP export const SyncToSAPProductManagement = (params?: any) => request({ diff --git a/admin.net.pro/Web/src/api/materialManagement/projectManagement.ts b/admin.net.pro/Web/src/api/materialManagement/projectManagement.ts new file mode 100644 index 0000000..04e8f8b --- /dev/null +++ b/admin.net.pro/Web/src/api/materialManagement/projectManagement.ts @@ -0,0 +1,46 @@ +import request from '/@/utils/request'; +enum Api { + PageProjectManagement = '/api/projectManagement/page', + SyncToSAPProjectManagement = '/api/projectManagement/SyncToSAP', + GetBOMProjectManagement = '/api/projectManagement/getBOM', + SyncToSAPBomProjectManagement = '/api/projectManagement/syncToSAPBom', + BatchSyncToSAPProjectManagement = '/api/projectManagement/batchSyncToSAP' +} + +// 分页查询产品管理 +export const PageProjectManagement = (params?: any) => + request({ + url: Api.PageProjectManagement, + method: 'post', + data: params, + }); + +// 同步到SAP +export const SyncToSAPProjectManagement = (params?: any) => + request({ + url: Api.SyncToSAPProjectManagement, + method: 'post', + data: params, + }); +// 分页查询产品管理BOM +export const GetBOMProjectManagement = (params?: any) => + request({ + url: Api.GetBOMProjectManagement, + method: 'post', + data: params, + }); + +// BOM同步到sap +export const SyncToSAPBomProjectManagement = (params?: any) => + request({ + url: Api.SyncToSAPBomProjectManagement, + method: 'post', + data: params, + }); +// 批量同步到SAP +export const BatchSyncToSAPProjectManagement = (params?: any) => + request({ + url: Api.BatchSyncToSAPProjectManagement, + method: 'post', + data: params, + }); diff --git a/admin.net.pro/Web/src/views/materialManagement/productManagement/index.vue b/admin.net.pro/Web/src/views/materialManagement/productManagement/index.vue index 8b43ec6..d1a9d84 100644 --- a/admin.net.pro/Web/src/views/materialManagement/productManagement/index.vue +++ b/admin.net.pro/Web/src/views/materialManagement/productManagement/index.vue @@ -37,7 +37,7 @@