From 5b0d28bba55a65fee8467318d9ee50d20567dae1 Mon Sep 17 00:00:00 2001 From: bairubing Date: Wed, 25 Sep 2024 11:21:29 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=98=8E=E5=AE=8C=E6=88=90=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E7=AE=A1=E7=90=86BOM=E5=90=8C=E6=AD=A5=EF=BC=8C?= =?UTF-8?q?=E7=89=A9=E6=96=99=E5=90=8C=E6=AD=A5=E9=80=BB=E8=BE=91=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/ConfigurationData.cs | 2 +- .../Vistar.Application/Entity/Obj110.cs | 39 +- .../Vistar.Application/Entity/Obj118.cs | 273 +++++++++++ .../Dto/BomPageProductManagementInput.cs | 201 ++++++++ .../Dto/ProductManagementBomOutput.cs | 451 +++++++++++++++++- .../Dto/ProductManagementOutput.cs | 373 +++------------ .../ProductManagementService.cs | 368 +++++++------- .../Vistar.Application/Util/SapOutput.cs | 4 +- .../materialManagement/productManagement.ts | 17 +- .../productManagement/index.vue | 184 ++++--- 10 files changed, 1355 insertions(+), 557 deletions(-) create mode 100644 admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj118.cs create mode 100644 admin.net.pro/Admin.NET/Vistar.Application/Service/MaterialManagement/Dto/BomPageProductManagementInput.cs diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Entity/ConfigurationData.cs b/admin.net.pro/Admin.NET/Vistar.Application/Entity/ConfigurationData.cs index 32d8482..6c314a7 100644 --- a/admin.net.pro/Admin.NET/Vistar.Application/Entity/ConfigurationData.cs +++ b/admin.net.pro/Admin.NET/Vistar.Application/Entity/ConfigurationData.cs @@ -14,7 +14,7 @@ namespace Vistar.Application.Entity; /// [SugarTable("ConfigurationData","")] [Tenant("启威星 1.94.4.74")] -public class ConfigurationData : EntityBase +public class ConfigurationData { /// /// diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj110.cs b/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj110.cs index db678fa..1da226d 100644 --- a/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj110.cs +++ b/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj110.cs @@ -14,7 +14,7 @@ namespace Vistar.Application.Entity; /// [SugarTable("OBJ110","产品管理")] [Tenant("启威星 1.94.4.74")] -public class Obj110 : EntityBase +public class Obj110 { /// /// @@ -709,5 +709,40 @@ public class Obj110 : EntityBase /// [SugarColumn(ColumnName = "fld004887", ColumnDescription = "", Length = -1)] public string? fld004887 { get; set; } - + + /// + /// + /// + [SugarColumn(ColumnName = "fld004895", ColumnDescription = "", Length = -1)] + public long? fld004895 { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "fld004942", ColumnDescription = "", Length = -1)] + public float? fld004942 { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "fld004943", ColumnDescription = "", Length = -1)] + public string? fld004943 { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "fld004944", ColumnDescription = "", Length = -1)] + public long? fld004944 { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "fld004944_Rec", ColumnDescription = "", Length = -1)] + public string? fld004944_Rec { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "fld004945", ColumnDescription = "", Length = -1)] + public DateTime? fld004945 { get; set; } } diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj118.cs b/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj118.cs new file mode 100644 index 0000000..d1fac90 --- /dev/null +++ b/admin.net.pro/Admin.NET/Vistar.Application/Entity/Obj118.cs @@ -0,0 +1,273 @@ +// 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("OBJ118","")] +[Tenant("启威星 1.94.4.74")] +public class Obj118 +{ + /// + /// + /// + [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 = "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 = 50)] + 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 = "CheckedOutPc", ColumnDescription = "", Length = 255)] + public string? CheckedOutPc { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "StageId", ColumnDescription = "")] + public long? StageId { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "ProjectManager", ColumnDescription = "")] + public long? ProjectManager { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "ProjectManager_Rec", ColumnDescription = "")] + public long? ProjectManager_Rec { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "EnableNotifications", ColumnDescription = "")] + public bool? EnableNotifications { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "GroupObjId", ColumnDescription = "")] + public long? GroupObjId { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "_CheckOutInProgress", ColumnDescription = "")] + public bool? _CheckOutInProgress { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "_System_CurrentStage", ColumnDescription = "", Length = 250)] + public string? _System_CurrentStage { get; set; } + + /// + /// + /// + [Required] + [SugarColumn(ColumnName = "_System_ObjNbsAuto", ColumnDescription = "", Length = 50)] + public string _System_ObjNbsAuto { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "isReleasedVersion", ColumnDescription = "")] + public bool? isReleasedVersion { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "_System_WebLink", ColumnDescription = "", Length = 500)] + public string? _System_WebLink { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "_System_ObjParentProcess", ColumnDescription = "")] + public long? _System_ObjParentProcess { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "_System_ObjParentProcess_Rec", ColumnDescription = "", Length = 40)] + public string? _System_ObjParentProcess_Rec { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "fld004638", ColumnDescription = "")] + public long? fld004638 { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "fld004638_Rec", ColumnDescription = "", Length = -1)] + public string? fld004638_Rec { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "fld004692", ColumnDescription = "")] + public long? fld004692 { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "fld004692_Rec", ColumnDescription = "", Length = -1)] + public string? fld004692_Rec { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "fld004693", ColumnDescription = "")] + public DateTime? fld004693 { get; set; } + + /// + /// + /// + [SugarColumn(ColumnName = "fld004694", ColumnDescription = "", Length = -1)] + public string? fld004694 { get; set; } + +} diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Service/MaterialManagement/Dto/BomPageProductManagementInput.cs b/admin.net.pro/Admin.NET/Vistar.Application/Service/MaterialManagement/Dto/BomPageProductManagementInput.cs new file mode 100644 index 0000000..f5e5935 --- /dev/null +++ b/admin.net.pro/Admin.NET/Vistar.Application/Service/MaterialManagement/Dto/BomPageProductManagementInput.cs @@ -0,0 +1,201 @@ +// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。 +// +// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。 +// +// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! + +using Admin.NET.Core; +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.MaterialManagement.Dto; +public class BomPageProductManagementInput : 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/MaterialManagement/Dto/ProductManagementBomOutput.cs b/admin.net.pro/Admin.NET/Vistar.Application/Service/MaterialManagement/Dto/ProductManagementBomOutput.cs index 84010ce..222058c 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 @@ -4,8 +4,10 @@ // // 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! +using SqlSugar; using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -13,10 +15,449 @@ using System.Threading.Tasks; namespace Vistar.Application.Service.MaterialManagement.Dto; public class ProductManagementBomOutput { + /// + /// + /// + 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; } + + /// + /// + /// + [Required] + 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; } + + /// + /// + /// + [Required] + public bool isAddedFromSW { get; set; } + + /// + /// + /// + public double? QtyManual { get; set; } + + /// + /// + /// + public long? SWPDMXrefId { get; set; } + + /// + /// + /// + public string? SwConfiguration { get; set; } + + /// + /// + /// + [Required] + public bool inContext { get; set; } + + /// + /// + /// + [Required] + public string PrimaryFile { get; set; } + + /// + /// + /// + [Required] + public bool bKeepQuantityInSync { get; set; } + + /// + /// + /// + public string? BOMGuid { get; set; } + + /// + /// + /// + [Required] + 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; } } -public class ProductManagementBomTypeOutput -{ - public long Id { get; set; } - public string Name { 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/Dto/ProductManagementOutput.cs b/admin.net.pro/Admin.NET/Vistar.Application/Service/MaterialManagement/Dto/ProductManagementOutput.cs index c82ef65..78499da 100644 --- a/admin.net.pro/Admin.NET/Vistar.Application/Service/MaterialManagement/Dto/ProductManagementOutput.cs +++ b/admin.net.pro/Admin.NET/Vistar.Application/Service/MaterialManagement/Dto/ProductManagementOutput.cs @@ -1,5 +1,7 @@ -using System; +using SqlSugar; +using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -12,503 +14,244 @@ public class ProductManagementOutput { public long idRecord { get; set; } - /// - /// - /// public bool? 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? GroupObjId { get; set; } - /// - /// - /// public bool? _CheckOutInProgress { get; set; } - /// - /// - /// public bool? EnableNotifications { get; set; } - /// - /// - /// public string? _system_objConfigurationName { get; set; } - /// - /// - /// public bool? _system_objConfigurationType { get; set; } - /// - /// - /// public string? _system_objConfigurationGuid { get; set; } - /// - /// - /// public string ShowBomFromConfiguration { get; set; } - /// - /// - /// public string _System_ObjNbsAuto { get; set; } - /// - /// - /// public string? _System_DerivedFrom { get; set; } - /// - /// - /// public string? _System_DerivedFrom_RecordGuid { get; set; } - /// - /// - /// public bool? _system_objLinkedCompare { get; set; } - /// - /// - /// public bool? isReleasedVersion { get; set; } - /// - /// - /// public string? _System_WebLink { get; set; } - /// - /// - /// public bool? LinkDrw { get; set; } - /// - /// - /// public string? ParentRecordGuid { get; set; } - /// - /// - /// public string? fld004283 { get; set; } - /// - /// - /// public string? fld004284 { get; set; } - /// - /// - /// public string? fld004285 { get; set; } - /// - /// - /// public string? fld004286 { get; set; } - /// - /// - /// public long? fld004287 { get; set; } - /// - /// - /// public string? fld004287_Rec { get; set; } - /// - /// - /// public string? fld004288 { get; set; } - /// - /// - /// public string? fld004289 { get; set; } - /// - /// - /// public string? fld004290 { get; set; } - /// - /// - /// public string? fld004291 { get; set; } - /// - /// - /// public string? fld004311 { get; set; } - /// - /// - /// public string? fld004312 { get; set; } - /// - /// - /// public string? fld004313 { get; set; } - /// - /// - /// public string? fld004314 { get; set; } - /// - /// - /// public string? fld004315 { get; set; } - /// - /// - /// public string? fld004316 { get; set; } - /// - /// - /// public string? fld004317 { get; set; } - /// - /// - /// public string? fld004318 { get; set; } - /// - /// - /// public string? fld004319 { get; set; } - /// - /// - /// public string? fld004320 { get; set; } - /// - /// - /// public string? fld004321 { get; set; } - /// - /// - /// public string? fld004322 { get; set; } - /// - /// - /// public string? fld004323 { get; set; } - /// - /// - /// public string? fld004324 { get; set; } - /// - /// - /// public string? fld004325 { get; set; } - /// - /// - /// public long? fld004326 { get; set; } - /// - /// - /// public string? fld004326_Rec { get; set; } - /// - /// - /// public string? fld004327 { get; set; } - /// - /// 物料描述 - /// public string? fld004484 { get; set; } - /// - /// - /// public string? fld004485 { get; set; } - /// - /// - /// public double? fld004486 { get; set; } - /// - /// - /// public string? fld004487 { get; set; } - /// - /// - /// public double? fld004488 { get; set; } - /// - /// - /// public string? fld004489 { get; set; } - /// - /// - /// public string? fld004490 { get; set; } - /// - /// - /// public string? fld004491 { get; set; } - /// - /// - /// public long? fld004493 { get; set; } - /// - /// - /// public string? fld004493_Rec { get; set; } - /// - /// 创建时间 - /// public DateTime? fld004494 { get; set; } - /// - /// - /// public long? fld004495 { get; set; } - /// - /// - /// public string? fld004495_Rec { get; set; } - /// - /// - /// public DateTime? fld004496 { get; set; } - /// - /// - /// public long? fld004497 { get; set; } - /// - /// - /// public string? fld004497_Rec { get; set; } - /// - /// - /// public string? fld004498 { get; set; } - /// - /// - /// public DateTime? fld004499 { get; set; } - /// - /// - /// public long? fld004500 { get; set; } - /// - /// - /// public string? fld004500_Rec { get; set; } - /// - /// - /// public string? fld004501 { get; set; } - /// - /// - /// - public string? fld004879 { get; set; } - /// - /// - /// - public string? fld004880 { get; set; } + public DateTime? fld004629 { get; set; } - /// - /// - /// - public string? fld004887 { get; set; } + public string? fld004630 { get; set; } - /// - /// - /// - public string? fld004882 { get; set; } + public DateTime? fld004631 { get; set; } - /// - /// - /// - public string? fld004881 { get; set; } + public DateTime? fld004632 { get; set; } - /// - /// - /// - public string? fld004895 { get; set; } - - /// - /// - /// - public string? fld004873 { get; set; } - - /// - /// - /// - public string? fld004872 { get; set; } - - /// - /// - /// public string? fld004698 { get; set; } - /// - /// - /// + public string? fld004699 { get; set; } + + public string? fld004700 { get; set; } + + public long? fld004859 { get; set; } + + public string? fld004859_Rec { get; set; } + + public long? fld004860 { get; set; } + + public string? fld004860_Rec { get; set; } + public string? fld004861 { get; set; } - /// - /// - /// - public string? fld004876 { get; set; } + public DateTime? fld004862 { get; set; } + + public DateTime? fld004863 { get; set; } + + public long? fld004864 { get; set; } + + public string? fld004864_Rec { get; set; } + + public DateTime? fld004865 { get; set; } + + public string? fld004872 { get; set; } + + public string? fld004873 { get; set; } + + public double? fld004876 { get; set; } - /// - /// - /// public string? fld004877 { get; set; } - /// - /// - /// - public string? fld004699 { get; set; } - + public string? fld004878 { get; set; } + + public string? fld004879 { get; set; } + + public string? fld004880 { get; set; } + + public string? fld004881 { get; set; } + + public string? fld004882 { get; set; } + + public string? fld004887 { get; set; } + + public long? fld004895 { get; set; } + + public float? fld004942 { get; set; } + + public string? fld004943 { get; set; } + + public long? fld004944 { get; set; } + + public string? fld004944_Rec { get; set; } + + public DateTime? fld004945 { 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 d2a2138..582b454 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 @@ -28,6 +28,15 @@ 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; @@ -43,17 +52,25 @@ public class ProductManagementService : IDynamicApiController, ITransient private readonly SqlSugarRepository _configurationsRep; private readonly SysConfigService _sysConfigService; private readonly SqlSugarRepository _configurationDataRep; + public SapService.SapService _sapBomService; + public SqlSugarRepository _obj118Rep; public ProductManagementService( SqlSugarRepository obj110Rep, SqlSugarRepository configurationsRep, SysConfigService sysConfigService, - SqlSugarRepository configurationDataRep) + SqlSugarRepository configurationDataRep, + SapService.SapService sapBomService, + SqlSugarRepository obj118Rep + + ) { _obj110Rep = obj110Rep; _configurationsRep = configurationsRep; _sysConfigService = sysConfigService; _configurationDataRep = configurationDataRep; + _sapBomService = sapBomService; + _obj118Rep = obj118Rep; } /// /// 分页查询产品管理 @@ -65,34 +82,35 @@ public class ProductManagementService : IDynamicApiController, ITransient //[Authorize(AuthenticationSchemes = SignatureAuthenticationDefaults.AuthenticationScheme)] public async Task> Page(PageProductManagementInput input) { - var query = _obj110Rep.AsQueryable() + var query = await _obj110Rep.AsQueryable() .Where(x => x.CheckedStatus == false && x.deleted == false && x.IsLatestVersion == true) .WhereIF(!string.IsNullOrWhiteSpace(input._System_objNBS), u => u._System_objNBS.Contains(input._System_objNBS.Trim())) .WhereIF(!string.IsNullOrWhiteSpace(input.fld004484), u => u.fld004484.Contains(input.fld004484.Trim())) .WhereIF(input.fld004494Range != null && input.fld004494Range.Length == 2, u => u.fld004494 >= input.fld004494Range[0] && u.fld004494 <= input.fld004494Range[1]) - .Select(); - return await query.ToPagedListAsync(input.Page, input.PageSize); - } - /// - /// 获取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; + .Select() + .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 @@ -100,7 +118,7 @@ public class ProductManagementService : IDynamicApiController, ITransient /// [ApiDescriptionSettings(Name = "syncToSAP"), HttpPost] [DisplayName("产品管理-同步到 SAP")] - public async Task SyncToSAP(ProductManagementBaseInput input) + public async Task SyncToSAP(ProductManagementBaseInput input) { const string lengthError = "物料编码长度大于40,请检查!"; @@ -118,153 +136,179 @@ public class ProductManagementService : IDynamicApiController, ITransient .Where(it => it.idRecord == input.idRecord) .ExecuteCommandAsync().ConfigureAwait(false); - return new SapMaterialOutput + return new SapOutput { code = "失败", msg = lengthError, result = lengthError }; } - try + + //获取时间戳精确到毫秒,sap要求每次调用生成不重复guid + string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString(); + + var sapMaterialInput = new SapMaterialInput() { - var httpClientHandler = new HttpClientHandler - { - ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => true, - ClientCertificateOptions = ClientCertificateOption.Manual - }; + Reqkeyid = "", + Businessid = "", + Messageid = "", + Sndprn = "PLM", + Rcvprn = "SAP", + Requser = await _sysConfigService.GetConfigValueByCode(ConfigConst.SapUserName), + Note1 = "", + Note2 = "", + Note3 = "", + Zwbid = millisecondTimestamp, + Matnr = input._System_objNBS, + Mbrsh = input.fld004323, + Mtart = input.fld004324, + Maktx = input.fld004484, + Meins = input.fld004861, + Matkl = input.fld004485, + Bismt = input.fld004880, + Groes = input.fld004879, + Normt = input.fld004887, + Ferth = input.fld004882, + Zeinr = input.fld004881, + Mstae = input.fld004699, + Raube = input.fld004877, + Mhdrz = input.fld004876, + Mhdhb = input.fld004895, + Werks = input.fld004325, + Beskz = input.fld004490, + Sobsl = input.fld004491, + Schgt = input.fld004873, + Rgekz = input.fld004872, + Zbom = input.fld004698 + }; - // 使用 HttpClientHandler 创建 HttpClient - using (var httpClient = new HttpClient(httpClientHandler)) - { - // 设置基本身份验证信息 - var username = await _sysConfigService.GetConfigValueByCode(ConfigConst.SapUserName); - var password = await _sysConfigService.GetConfigValueByCode(ConfigConst.SapPassword); - var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}")); - httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", credentials); - - // 定义命名空间 - XNamespace soapenv = "http://schemas.xmlsoap.org/soap/envelope/"; - XNamespace urn = "urn:sap-com:document:sap:soap:functions:mc-style"; - //获取时间戳精确到毫秒,sap要求每次调用生成不重复guid - string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString(); - // 创建 SOAP 请求的 XML 内容 - XElement envelope = new XElement(soapenv + "Envelope", - new XElement(soapenv + "Header"), - new XElement(soapenv + "Body", - new XElement(urn + "Zmmfm012", - new XElement("IsReq", - new XElement("Reqkeyid"), - new XElement("Businessid"), - new XElement("Messageid"), - new XElement("Sndprn", "plm"), - new XElement("Rcvprn", "sap"), - new XElement("Requser", "111"), - new XElement("Note1"), - new XElement("Note2"), - new XElement("Note3") - ), - new XElement("ItData", - new XElement("item", - new XElement("Zwbid", millisecondTimestamp), - new XElement("Matnr", input._System_objNBS), - new XElement("Mbrsh", input.fld004323), - new XElement("Mtart", input.fld004324), - new XElement("Maktx", input.fld004484), - new XElement("Meins", input.fld004861), - new XElement("Matkl", input.fld004485), - new XElement("Bismt", input.fld004880), - new XElement("Groes", input.fld004879), - new XElement("Normt", input.fld004887), - new XElement("Ferth", input.fld004882), - new XElement("Zeinr", input.fld004881), - new XElement("Mstae", input.fld004699), - new XElement("Raube", input.fld004877), - new XElement("Mhdrz", input.fld004876), - new XElement("Mhdhb", input.fld004895), - new XElement("PlantView", - new XElement("item", - new XElement("Werks", input.fld004325), - new XElement("Beskz", input.fld004490), - new XElement("Sobsl", input.fld004491), - new XElement("Schgt", input.fld004873), - new XElement("Rgekz", input.fld004872), - new XElement("Zbom", input.fld004698) - ) - ) - ) - ) - ) - ) - ); - - // 将 XML 内容转换为字符串并设置请求内容类型为 text/xml - var content = new StringContent(envelope.ToString(), Encoding.UTF8, "text/xml"); - content.Headers.ContentType = new MediaTypeHeaderValue("text/xml"); - - // 设置 SAP Web 服务的 URL - var url = "https://vhjqeds4ci.sap.vistar-eq.com:44300/sap/bc/srt/rfc/sap/zmmfm012/120/zmmfm012/zmmfm012"; - - // 发起 POST 请求到 SAP Web 服务 - var response = await httpClient.PostAsync(url, content); - - // 处理响应结果 - if (response.IsSuccessStatusCode) - { - var result = await response.Content.ReadAsStringAsync(); - XDocument doc = XDocument.Parse(result); - var item = doc.Descendants("item").FirstOrDefault(); - var zwbid = item?.Element("Zwbid")?.Value; - var matnr = item?.Element("Matnr")?.Value; - var code = item?.Element("Code")?.Value; - var msg = item?.Element("Msg")?.Value; - - string codeVal = code == "S" ? "成功" : "失败"; - - await _obj110Rep.AsUpdateable() - .SetColumns(it => new Obj110 - { - fld004629 = DateTime.Now, - fld004311 = codeVal, - fld004312 = "N", - fld004313 = msg - }) - .Where(it => it.idRecord == input.idRecord) - .ExecuteCommandAsync(); - var output = new SapMaterialOutput() - { - code = codeVal, - msg = msg, - result = result - }; - return output; - } - else - { - var result = await response.Content.ReadAsStringAsync(); - Console.WriteLine("调用失败,状态码: " + response.StatusCode); - var output = new SapMaterialOutput() - { - code = "失败", - msg="", - result = result - }; - return output; - } - } - } - catch (Exception ex) + var apiOutput = await _sapBomService.SapMaterialApi(sapMaterialInput); + string codeVal = apiOutput.code == "S" ? "成功" : "失败"; + var msg = apiOutput.msg; + if (apiOutput.msg=="") { - // 记录错误日志 - Console.WriteLine("发生错误: " + ex.Message); - var output = new SapMaterialOutput() - { - code = "失败", - msg = "发生错误", - result = "发生错误" - }; - return output; + msg = "同步成功"; } + + await _obj110Rep.AsUpdateable() + .SetColumns(it => new Obj110 + { + fld004629 = DateTime.Now, + fld004311 = codeVal, + fld004312 = "N", + fld004313 = msg + }) + .Where(it => it.idRecord == input.idRecord) + .ExecuteCommandAsync(); + var output = new SapOutput() + { + code = codeVal, + msg = msg, + result = apiOutput.result + }; + return output; + } + /// + /// 获取BOM + /// + /// + /// + [ApiDescriptionSettings(Name = "GetBOM", Description = "分页查询", Order = 1000), HttpPost] + [DisplayName("分页查询产品管理")] + public async Task> GetBOM(BomPageProductManagementInput input) + { + var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 110 && x.ConfigLabel == "mBOM").FirstAsync(); + var parent = await _obj110Rep.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 + /// + /// + /// + public async Task SyncToSAPBom(List input) + { + var ParentData = await _obj110Rep.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.fld004944_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++) + { + 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.fld004325,//工厂 + Bmeng = ParentData.fld004942.ToString(), + Aennr = ecn, + Datuv = ParentData.fld004945.ToString(), + ItemList = itemDataList + }; + var apiOutput = await _sapBomService.SapBomApi(isreq); + string codeVal = apiOutput.code == "S" ? "成功" : "失败"; + await _obj110Rep.AsUpdateable() + .SetColumns(it => new Obj110 + { + fld004631 = DateTime.Now, + fld004315 = codeVal, + fld004316 = "N", + fld004317 = apiOutput.msg + }) + .Where(it => it.idRecord == ParentData.idRecord) + .ExecuteCommandAsync(); + var msg = apiOutput.msg; + if (apiOutput.msg == "") + { + msg = "同步成功"; + } + var output = new SapOutput() + { + code = codeVal, + msg = msg, + result = apiOutput.result + }; + return output; } - } 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 58fcfcf..44355fd 100644 --- a/admin.net.pro/Admin.NET/Vistar.Application/Util/SapOutput.cs +++ b/admin.net.pro/Admin.NET/Vistar.Application/Util/SapOutput.cs @@ -12,9 +12,9 @@ using System.Threading.Tasks; namespace Vistar.Application.Util; /// -/// 同步物料输出参数 +/// SAP服务输出参数 /// -public class SapMaterialOutput +public class SapOutput { public string code { get; set; } public string msg { get; set; } diff --git a/admin.net.pro/Web/src/api/materialManagement/productManagement.ts b/admin.net.pro/Web/src/api/materialManagement/productManagement.ts index 22fd355..a7772d5 100644 --- a/admin.net.pro/Web/src/api/materialManagement/productManagement.ts +++ b/admin.net.pro/Web/src/api/materialManagement/productManagement.ts @@ -3,6 +3,8 @@ enum Api { PageProductManagement = '/api/productManagement/page', BomTypeProductManagement = '/api/productManagement/bomType', SyncToSAPProductManagement = '/api/productManagement/SyncToSAP', + GetetBOMProductManagement = '/api/productManagement/getBOM', + SyncToSAPBomProductManagement = '/api/productManagement/syncToSAPBom', } // 分页查询产品管理 @@ -27,6 +29,19 @@ export const SyncToSAPProductManagement = (params?: any) => method: 'post', data: params, }); +// 分页查询产品管理BOM +export const GetetBOMProductManagement = (params?: any) => + request({ + url: Api.GetetBOMProductManagement, + method: 'post', + data: params, + }); - +// BOM同步到sap +export const SyncToSAPBomProductManagement = (params?: any) => + request({ + url: Api.SyncToSAPBomProductManagement, + 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 4fa261f..7014ed6 100644 --- a/admin.net.pro/Web/src/views/materialManagement/productManagement/index.vue +++ b/admin.net.pro/Web/src/views/materialManagement/productManagement/index.vue @@ -35,10 +35,9 @@ - @@ -70,60 +70,18 @@ - - - - - - - - - - - - - 查询 - 重置 - - - - - - - - - + + + + + + - - @@ -142,7 +100,7 @@ import { useVxeTable } from '/@/hooks/useVxeTableOptionsHook'; import { Local } from '/@/utils/storage'; import { formatDate } from '/@/utils/formatTime'; -import { PageProductManagement, BomTypeProductManagement, SyncToSAPProductManagement } from '/@/api/materialManagement/productManagement'; +import { PageProductManagement, BomTypeProductManagement, SyncToSAPProductManagement, GetetBOMProductManagement,SyncToSAPBomProductManagement } from '/@/api/materialManagement/productManagement'; // 子窗口对象 const xGrid = ref(); @@ -229,7 +187,8 @@ onMounted(() => { // 查询api const handleQueryApi = async (page: VxeGridPropTypes.ProxyAjaxQueryPageParams, sort: VxeGridPropTypes.ProxyAjaxQuerySortCheckedParams) => { const params = Object.assign(state.queryParams, { page: page.currentPage, pageSize: page.pageSize, field: sort.field, order: sort.order, descStr: 'desc' }); - return PageProductManagement(params); + var data = PageProductManagement(params) + return data; }; // 查询操作 @@ -270,7 +229,6 @@ const gridEvents: VxeGridListeners = { // 同步到SAP const syncToSAP = async (row: any) => { options.loading = true; - ElMessageBox.confirm(`确定要同步物料吗?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', @@ -290,21 +248,109 @@ const syncToSAP = async (row: any) => { }; + + + +//Bom +// BOM查询操作 +//let bomTypeList: any; +//父Guid +const bomxGrid = ref(); // 查看BOM const showBomDrawer = async (row: any) => { + stateBom.queryParams.ParentGuid=row.recordGuid; showBom.value = true; - console.log("Bomrow",row.recordGuid) - try { - const response = await BomTypeProductManagement(); - bomTypeList = response.data.result; - console.log('sss', response); - } catch (error) { - console.error('Error fetching data:', error); - } + await handleQueryBom(); }; const showBom = ref(false); +// 变量 +const stateBom = reactive({ + showAdvanceQueryUI: false, + queryParams: { + PartNumber: undefined, + Description: undefined, + ParentGuid: undefined + }, + localPageParam: { + pageSize: 50 as number, + defaultSort: { field: 'createTime', order: 'asc', descStr: 'desc' }, + }, + visible: false, + title: '', +}); + +// 本地存储参数 +const localPageParamKeyBom = 'localPageParam:productManagementBom'; + +// 表格参数配置 +const bomOptions = useVxeTable( + { + id: 'productManagementBom', + name: '产品管理', + columns: [ + { type: 'seq', title: '序号', width: 60 }, + { field: 'partNumber', title: '物料编码', minWidth: 100, showOverflow: 'tooltip', sortable: false }, + { field: 'description', title: '物料描述', minWidth: 100, showOverflow: 'tooltip', sortable: false }, + { field: 'quantity', title: '数量', minWidth: 100, showOverflow: 'tooltip', sortable: false }, + ], + }, + // vxeGrid配置参数(此处可覆写任何参数),参考vxe-table官方文档 + { + // 代理配置 + proxyConfig: { autoLoad: true, ajax: { query: ({ page, sort }) => handleBOMQueryApi(page, sort) } }, + // 排序配置 + sortConfig: { defaultSort: Local.get(localPageParamKeyBom)?.defaultSort || stateBom.localPageParam.defaultSort }, + // 分页配置 + pagerConfig: { pageSize: Local.get(localPageParamKeyBom)?.pageSize || stateBom.localPageParam.pageSize }, + // 工具栏配置 + toolbarConfig: { export: false }, + // 行设置 + // rowConfig: { height: 80 }, + } +); + +// BOM 查询 API +const handleBOMQueryApi = async (page: VxeGridPropTypes.ProxyAjaxQueryPageParams, sort: VxeGridPropTypes.ProxyAjaxQuerySortCheckedParams) => { + const params = Object.assign(stateBom.queryParams, { page: page.currentPage, pageSize: page.pageSize, field: sort.field, order: sort.order, descStr: 'desc' }); + var data = GetetBOMProductManagement(params); + return data; +}; + +const handleQueryBom = async (reset = false) => { + bomOptions.loading = true; + await bomxGrid.value?.commitProxy('query'); + bomOptions.loading = false; +}; + +//Bom同步到sap +const syncToSAPBom = async () => { + //var data=bomxGrid.value?.getCheckboxRecords(); + options.loading = true; + var data=bomxGrid.value?.getTableData().fullData; + ElMessageBox.confirm(`确定要同步BOM吗?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + .then(async () => { + var output = await SyncToSAPBomProductManagement(data); + await handleQuery(); + if (output.data.result.code == "成功") { + ElMessage.success("同步成功"); + } else { + ElMessage.error("同步失败"); + } + }) + .catch(() => { }); + options.loading = false; +} +//物料批量同步到SAP +const batchSyncToSAP = async () =>{ + var data=xGrid.value?.getCheckboxRecords(); + console.log("datadatadata",data) +}