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 d5210f9..b6da171 100644 --- a/admin.net.pro/Admin.NET/Vistar.Application/Entity/ConfigurationData.cs +++ b/admin.net.pro/Admin.NET/Vistar.Application/Entity/ConfigurationData.cs @@ -598,4 +598,13 @@ public class ConfigurationData /// 基本数量 /// public string fld005575 { get; set; } + + public string fld006140 { get; set; } + public string fld006141 { get; set; } + public string fld006142 { get; set; } + public string fld006143 { get; set; } + public DateTime fld006144 { get; set; } + public string fld006145 { get; set; } + public string fld006146 { get; set; } + public string fld006147 { get; set; } } diff --git a/admin.net.pro/Admin.NET/Vistar.Application/SapService/Dto/SapPurchasingRequisitionInput.cs b/admin.net.pro/Admin.NET/Vistar.Application/SapService/Dto/SapPurchasingRequisitionInput.cs new file mode 100644 index 0000000..1e4c321 --- /dev/null +++ b/admin.net.pro/Admin.NET/Vistar.Application/SapService/Dto/SapPurchasingRequisitionInput.cs @@ -0,0 +1,187 @@ +// 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.SapService.Dto; +public class SapPurchasingRequisitionInput +{ + /// + /// 接口唯一ID + /// + public string Reqkeyid { get; set; } + + /// + /// 业务唯一ID + /// + public string Businessid { get; set; } + + /// + /// 传入消息ID + /// + public string Messageid { get; set; } + + /// + /// 发送方的合作伙伴编号 + /// + public string Sndprn { get; set; } + + /// + /// 接收方的合作伙伴编号 + /// + public string Rcvprn { get; set; } + + /// + /// 用户名 + /// + public string Requser { get; set; } + + /// + /// 备注 + /// + public string Note1 { get; set; } + + /// + /// 备注 + /// + public string Note2 { get; set; } + + /// + /// 备注 + /// + public string Note3 { get; set; } + + /// + /// 外部唯一ID + /// + public string Zwbid { get; set; } + + /// + /// 采购申请编号 + /// + public string Banfn { get; set; } + + /// + /// 采购申请凭证类型 + /// + public string Bsart { get; set; } + + /// + /// 业务修改类型I/U + /// + public string Zoperate { get; set; } + + /// + /// 抬头备用1 + /// + public string Zttby1 { get; set; } + + /// + /// 抬头备用2 + /// + public string Zttby2 { get; set; } + + /// + /// 抬头备用3 + /// + public string Zttby3 { get; set; } + + + public List Item { get; set; } +} + +public class SapPurchasingRequisitionItem +{ + /// + /// 采购申请的项目编号 + /// + public string Bnfpo { get; set; } + + /// + /// 紧急标识 + /// + public string Zzjjbs { get; set; } + + /// + /// 科目分配类别 + /// + public string Knttp { get; set; } + + /// + /// 采购凭证中的项目类别 + /// + public string Pstyp { get; set; } + + /// + /// 物料编号 + /// + public string Matnr { get; set; } + + /// + /// 短文本 + /// + public string Txz01 { get; set; } + + /// + /// 数量 + /// + public string Menge { get; set; } + + /// + /// 基本计量单位 + /// + public string Meins { get; set; } + + /// + /// 项目交货日期 + /// + public string Lfdat { get; set; } + + /// + /// 物料组 + /// + public string Matkl { get; set; } + + /// + /// 工厂 + /// + public string Werks { get; set; } + + /// + /// 存储地点 + /// + public string Lgort { get; set; } + + /// + /// 采购组 + /// + public string Ekgrp { get; set; } + + /// + /// 采购组织 + /// + public string Ekorg { get; set; } + + /// + /// 项目号 + /// + public string Zzpspnr { get; set; } + + /// + /// 申请人姓名 + /// + public string Afnam { get; set; } + + /// + /// 采购凭证中的删除标识 + /// + public string Loekz { 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 4f1f4be..e95d745 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 @@ -67,7 +67,7 @@ public class ProductManagementService : IDynamicApiController, ITransient public async Task> Page(PageProductManagementInput input) { var query = await _obj110Rep.AsQueryable() - .Where(x => (x.CheckedStatus == 0||x.CheckedStatus==1) && x.fld005324 == "发布" && x.deleted == false && x.IsLatestVersion == true) + .Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1) && x.fld005324 == "发布" && 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]) @@ -185,7 +185,7 @@ public class ProductManagementService : IDynamicApiController, ITransient var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 110 && x.ConfigSystemName == "mBOM").FirstAsync(); var parent = await _obj110Rep.AsQueryable().Where(x => x.RecordGuid == input.ParentGuid && x.deleted == false && x.fld004311 == "成功" && x.fld004312 == "N").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 && (x.fld005586 !="不包含"|| x.fld005586==null)) + .Where(x => x.ConfigId == configid.ConfigID && x.ParentGuid == input.ParentGuid && x.isDeleted == false && x.ParentVersion == parent && (x.fld005586 != "不包含" || x.fld005586 == null)) .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); @@ -237,7 +237,7 @@ public class ProductManagementService : IDynamicApiController, ITransient if (!string.IsNullOrEmpty(ParentData.fld005288)) { var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 110 && x.ConfigSystemName == "mBOM").FirstAsync(); - var BomData = await _configurationDataRep.AsQueryable().Where(x => x.ConfigId == configid.ConfigID && x.ParentGuid == input[0].ParentGuid && x.isDeleted == false && x.ParentVersion == Convert.ToInt32(ParentData.fld005288)&&(x.fld005586!="不包含"|| x.fld005586==null)).ToListAsync(); + var BomData = await _configurationDataRep.AsQueryable().Where(x => x.ConfigId == configid.ConfigID && x.ParentGuid == input[0].ParentGuid && x.isDeleted == false && x.ParentVersion == Convert.ToInt32(ParentData.fld005288) && (x.fld005586 != "不包含" || x.fld005586 == null)).ToListAsync(); for (int i = 0; i < BomData.Count; i++) { @@ -293,7 +293,9 @@ public class ProductManagementService : IDynamicApiController, ITransient }; var apiOutput = await _sapService.SapBomApi(isreq); string codeVal = apiOutput.code == "S" ? "成功" : "失败"; - await _obj110Rep.AsUpdateable() + if (codeVal == "成功") + { + await _obj110Rep.AsUpdateable() .SetColumns(it => new Obj110 { fld004631 = DateTime.Now, @@ -304,6 +306,21 @@ public class ProductManagementService : IDynamicApiController, ITransient }) .Where(it => it.idRecord == ParentData.idRecord) .ExecuteCommandAsync(); + } + else + { + 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 == "") { @@ -356,7 +373,7 @@ public class ProductManagementService : IDynamicApiController, ITransient }); continue; } - if (input[i].fld004312 == "N" || input[i].fld004312 == "D" || input[i].fld004312==null) + if (input[i].fld004312 == "N" || input[i].fld004312 == "D" || input[i].fld004312 == null) { SapOutputList.Add(new SapOutput() { @@ -444,10 +461,10 @@ public class ProductManagementService : IDynamicApiController, ITransient public async Task> TimingSyncToSAP() { var input = await _obj110Rep.AsQueryable() - .Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1) - && x.fld005324 == "发布" - && x.deleted == false - && x.IsLatestVersion == true + .Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1) + && x.fld005324 == "发布" + && x.deleted == false + && x.IsLatestVersion == true && (x.fld004312 == "A" || x.fld004312 == "M")) .ToListAsync(); const string lengthError = "物料描述长度大于40,请检查!"; @@ -561,7 +578,7 @@ public class ProductManagementService : IDynamicApiController, ITransient var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 110 && x.ConfigSystemName == "mBOM").FirstAsync(); var materialData = await _obj110Rep.AsQueryable() - .Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1) && x.fld005324 == "发布" && x.deleted == false && x.IsLatestVersion == true && x.fld004311 == "成功" && x.fld004312=="N" && (x.fld004316 == "A" || x.fld004316 == "M")) + .Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1) && x.fld005324 == "发布" && x.deleted == false && x.IsLatestVersion == true && x.fld004311 == "成功" && x.fld004312 == "N" && (x.fld004316 == "A" || x.fld004316 == "M")) .ToListAsync(); var groupedData = materialData.GroupBy(item => item.RecordGuid) .Select(group => group.OrderByDescending(item => item.VersionIndex).First()) @@ -569,7 +586,7 @@ public class ProductManagementService : IDynamicApiController, ITransient foreach (var item in groupedData) { - + // 获取版本号 var versionIndex = item.VersionIndex; // 获取 ECN guid @@ -581,7 +598,7 @@ public class ProductManagementService : IDynamicApiController, ITransient { 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 : ""; @@ -674,16 +691,34 @@ public class ProductManagementService : IDynamicApiController, ITransient var apiOutput = await _sapService.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 == item.idRecord) - .ExecuteCommandAsync(); + + if (codeVal == "成功") + { + await _obj110Rep.AsUpdateable() + .SetColumns(it => new Obj110 + { + fld004631 = DateTime.Now, + fld004315 = codeVal, + fld004316 = "N", + fld004317 = apiOutput.msg, + fld005288 = versionIndex.ToString() + }) + .Where(it => it.idRecord == item.idRecord) + .ExecuteCommandAsync(); + } + else + { + await _obj110Rep.AsUpdateable() + .SetColumns(it => new Obj110 + { + fld004631 = DateTime.Now, + fld004315 = codeVal, + fld004316 = "N", + fld004317 = apiOutput.msg + }) + .Where(it => it.idRecord == item.idRecord) + .ExecuteCommandAsync(); + } var msg = apiOutput.msg; if (string.IsNullOrEmpty(msg)) @@ -847,7 +882,7 @@ public class ProductManagementService : IDynamicApiController, ITransient var versionIndex = item.VersionIndex; // 查询 BOM var processRouteData = await _configurationDataRep.AsQueryable() - .Where(x => x.ConfigId == configid.ConfigID && x.ParentGuid == item.RecordGuid && x.isDeleted == false && x.ParentVersion == versionIndex ).ToListAsync(); + .Where(x => x.ConfigId == configid.ConfigID && x.ParentGuid == item.RecordGuid && x.isDeleted == false && x.ParentVersion == versionIndex).ToListAsync(); if (processRouteData.Count == 0) { continue; diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Service/ProductDesignLibrary/ProductDesignLibraryService.cs b/admin.net.pro/Admin.NET/Vistar.Application/Service/ProductDesignLibrary/ProductDesignLibraryService.cs index bc3534b..8df489e 100644 --- a/admin.net.pro/Admin.NET/Vistar.Application/Service/ProductDesignLibrary/ProductDesignLibraryService.cs +++ b/admin.net.pro/Admin.NET/Vistar.Application/Service/ProductDesignLibrary/ProductDesignLibraryService.cs @@ -300,17 +300,33 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient }; var apiOutput = await _sapService.SapBomApi(isreq); string codeVal = apiOutput.code == "S" ? "成功" : "失败"; - await _obj137Rep.AsUpdateable() - .SetColumns(it => new Obj137 - { - fld005539 = DateTime.Now, - fld005533 = codeVal, - fld005534 = "N", - fld005535 = apiOutput.msg, - fld005686 = input[0].ParentVersion.ToString() - }) - .Where(it => it.idRecord == ParentData.idRecord) - .ExecuteCommandAsync(); + if (codeVal == "成功") + { + await _obj137Rep.AsUpdateable() + .SetColumns(it => new Obj137 + { + fld005539 = DateTime.Now, + fld005533 = codeVal, + fld005534 = "N", + fld005535 = apiOutput.msg, + fld005686 = input[0].ParentVersion.ToString() + }) + .Where(it => it.idRecord == ParentData.idRecord) + .ExecuteCommandAsync(); + } + else { + await _obj137Rep.AsUpdateable() + .SetColumns(it => new Obj137 + { + fld005539 = DateTime.Now, + fld005533 = codeVal, + fld005534 = "N", + fld005535 = apiOutput.msg + }) + .Where(it => it.idRecord == ParentData.idRecord) + .ExecuteCommandAsync(); + } + var msg = apiOutput.msg; if (apiOutput.msg == "") { @@ -681,17 +697,34 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient var apiOutput = await _sapService.SapBomApi(isreq); string codeVal = apiOutput.code == "S" ? "成功" : "失败"; - await _obj137Rep.AsUpdateable() - .SetColumns(it => new Obj137 - { - fld005539 = DateTime.Now, - fld005533 = codeVal, - fld005534 = "N", - fld005535 = apiOutput.msg, - fld005686 = bomData[0].ParentVersion.ToString() - }) - .Where(it => it.idRecord == item.idRecord) - .ExecuteCommandAsync(); + + if (codeVal == "成功") + { + await _obj137Rep.AsUpdateable() + .SetColumns(it => new Obj137 + { + fld005539 = DateTime.Now, + fld005533 = codeVal, + fld005534 = "N", + fld005535 = apiOutput.msg, + fld005686 = versionIndex.ToString() + }) + .Where(it => it.idRecord == item.idRecord) + .ExecuteCommandAsync(); + } + else + { + await _obj137Rep.AsUpdateable() + .SetColumns(it => new Obj137 + { + fld005539 = DateTime.Now, + fld005533 = codeVal, + fld005534 = "N", + fld005535 = apiOutput.msg + }) + .Where(it => it.idRecord == item.idRecord) + .ExecuteCommandAsync(); + } var msg = apiOutput.msg; if (string.IsNullOrEmpty(msg))