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 664e3d0..50e036e 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 @@ -298,11 +298,34 @@ public class ProductManagementService : IDynamicApiController, ITransient var itemList = itemDataList.Where(x => x.ChildGuid == BomData[i].ChildGuid).ToList(); if (itemList.Count == 0) { - var Verification = await _dataValidationService.VerificationMaterial(BomData[i].ChildObjID, BomData[i].PartNumber, BomData[i].ChildGuid); - if (Verification == "不存在") + //var Verification = await _dataValidationService.VerificationMaterial(BomData[i].ChildObjID, BomData[i].PartNumber, BomData[i].ChildGuid); + //if (Verification == "不存在") + //{ + // continue; + //} + + if (BomData[i].ChildObjID == 137) { - continue; + var data137 = await _obj137Rep.AsQueryable().Where(x => x.deleted == false && x.RecordGuid == BomData[i].ChildGuid && x._system_objConfigurationName == "默认").OrderByDescending(x => x.idRecord).FirstAsync(); + if (data137 != null) + { + BomData[i].PartNumber = data137._System_objNBS; + } + else + { + continue; + } } + else + { + var Verification = await _dataValidationService.VerificationMaterial(BomData[i].ChildObjID, BomData[i].PartNumber, BomData[i].ChildGuid); + if (Verification == "不存在") + { + + continue; + } + } + //int sun = i + 1; var itemData = new ItemData() { @@ -838,7 +861,7 @@ public class ProductManagementService : IDynamicApiController, ITransient string verification = "不存在"; if (item.ChildObjID == 137) { - var data137 = await db.CopyNew().Queryable().Where(x => x._System_objNBS == item.PartNumber && x.deleted == false && x.RecordGuid == item.ChildGuid && x._system_objConfigurationName == "默认").OrderByDescending(x=>x.idRecord).FirstAsync(); + var data137 = await db.CopyNew().Queryable().Where(x => x.deleted == false && x.RecordGuid == item.ChildGuid && x._system_objConfigurationName == "默认").OrderByDescending(x=>x.idRecord).FirstAsync(); if (data137 == null) { verification = "不存在"; @@ -854,28 +877,8 @@ public class ProductManagementService : IDynamicApiController, ITransient if (verification == "不存在") { - if (item.ChildObjID == 137) - { - string partNumber = item.PartNumber.Replace("默认 ", "");//过滤BOM表PartNumber字段存在“默认 ” - if (partNumber == item.PartNumber)//判断过滤后,物料编码是否和原料相同,相同的话跳出循环 - { - continue; - } - var data137 = db.CopyNew().Queryable().Where(x => x._System_objNBS == item.ChildGuid && x.deleted == false && x._system_objConfigurationName == "默认").OrderByDescending(x => x.idRecord).First(); - - if (data137 != null) - { - item.PartNumber = data137._System_objNBS; - } - else - { - continue; - } - } - else - { continue; - } + } var itemData = new ItemData { @@ -902,32 +905,55 @@ public class ProductManagementService : IDynamicApiController, ITransient var itemList = itemDataList.Where(x => x.ChildGuid == item.ChildGuid).ToList(); if (itemList.Count == 0) { - var Verification = await _dataValidationService.VerificationMaterial(item.ChildObjID, item.PartNumber, item.ChildGuid); - if (Verification == "不存在") + if (item.ChildObjID == 137) { - if (item.ChildObjID == 137) + var data137 = await _obj137Rep.AsQueryable().Where(x => x.deleted == false && x.RecordGuid == item.ChildGuid && x._system_objConfigurationName == "默认").OrderByDescending(x => x.idRecord).FirstAsync(); + if (data137 != null) { - string partNumber = item.PartNumber.Replace("默认 ", "");//过滤BOM表PartNumber字段存在“默认 ” - if (partNumber == item.PartNumber)//判断过滤后,物料编码是否和原料相同,相同的话跳出循环 - { - continue; - } - var data137 = db.CopyNew().Queryable().Where(x => x._System_objNBS == partNumber && x.deleted == false).OrderByDescending(x => x.idRecord).First(); - - if (data137 != null) - { - item.PartNumber = data137._System_objNBS; - } - else - { - continue; - } + item.PartNumber = data137._System_objNBS; } else { continue; } } + else + { + var Verification = await _dataValidationService.VerificationMaterial(item.ChildObjID, item.PartNumber, item.ChildGuid); + if (Verification == "不存在") + { + + continue; + } + } + + + //var Verification = await _dataValidationService.VerificationMaterial(item.ChildObjID, item.PartNumber, item.ChildGuid); + //if (Verification == "不存在") + //{ + // if (item.ChildObjID == 137) + // { + // string partNumber = item.PartNumber.Replace("默认 ", "");//过滤BOM表PartNumber字段存在“默认 ” + // if (partNumber == item.PartNumber)//判断过滤后,物料编码是否和原料相同,相同的话跳出循环 + // { + // continue; + // } + // var data137 = db.CopyNew().Queryable().Where(x => x._System_objNBS == partNumber && x.deleted == false).OrderByDescending(x => x.idRecord).First(); + + // if (data137 != null) + // { + // item.PartNumber = data137._System_objNBS; + // } + // else + // { + // continue; + // } + // } + // else + // { + // continue; + // } + //} var itemData = new ItemData() { POSNR = "",//组件序号 sun.ToString() 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 a9a6385..847ba3c 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 @@ -217,7 +217,7 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient .Select().ToListAsync(); foreach (var item in BomData) { - if (item.ChildObjID==137) + if (item.ChildObjID == 137) { if (item.PartNumber != null && Regex.IsMatch(item.PartNumber, "默认")) { @@ -225,12 +225,12 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient if (data137 != null) { item.PartNumber = data137._System_objNBS; - item.Description=data137._System_ObjDescription; + item.Description = data137._System_ObjDescription; } } } } - var data= BomData.ToPagedList(input.Page, input.PageSize); + var data = BomData.ToPagedList(input.Page, input.PageSize); //.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); @@ -651,7 +651,7 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient string verification = "不存在"; if (item.ChildObjID == 137) { - var data137 = await db.CopyNew().Queryable().Where(x => x._System_objNBS == item.PartNumber && x.deleted == false && x.RecordGuid == item.ChildGuid && x._system_objConfigurationName == "默认").OrderByDescending(x => x.idRecord).FirstAsync(); + var data137 = await db.CopyNew().Queryable().Where(x => x.deleted == false && x.deleted == false && x.RecordGuid == item.ChildGuid && x._system_objConfigurationName == "默认").OrderByDescending(x => x.idRecord).FirstAsync(); if (data137 == null) { verification = "不存在"; @@ -668,28 +668,30 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient } if (verification == "不存在") { - if (item.ChildObjID == 137) - { - string partNumber = item.PartNumber.Replace("默认 ", "");//过滤BOM表PartNumber字段存在“默认 ” - if (partNumber == item.PartNumber)//判断过滤后,物料编码是否和原料相同,相同的话跳出循环 - { - continue; - } - var data137 = db.CopyNew().Queryable().Where(x => x._System_objNBS == item.ChildGuid && x.deleted == false && x._system_objConfigurationName == "默认").OrderByDescending(x => x.idRecord).First(); - if (data137 != null) - { - item.PartNumber = data137._System_objNBS; - } - else - { - continue; - } - } - else - { - continue; - } + continue; + //if (item.ChildObjID == 137) + //{ + // string partNumber = item.PartNumber.Replace("默认 ", "");//过滤BOM表PartNumber字段存在“默认 ” + // if (partNumber == item.PartNumber)//判断过滤后,物料编码是否和原料相同,相同的话跳出循环 + // { + // continue; + // } + // var data137 = db.CopyNew().Queryable().Where(x => x._System_objNBS == item.ChildGuid && x.deleted == false && x._system_objConfigurationName == "默认").OrderByDescending(x => x.idRecord).First(); + + // if (data137 != null) + // { + // item.PartNumber = data137._System_objNBS; + // } + // else + // { + // continue; + // } + //} + //else + //{ + // continue; + //} } var itemData = new ItemData @@ -703,7 +705,8 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient ALPRF = item.ALPRF, ZDELETE = item.ZDELETE, POSTP = item.POSTP, - ZYFMK = item.ZYFMK + ZYFMK = item.ZYFMK, + ChildGuid = item.ChildGuid }; itemDataList.Add(itemData); @@ -717,35 +720,32 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient foreach (var item in BomData) { - var itemList = itemDataList.Where(x => x.IDNRK == item.PartNumber).ToList(); + var itemList = itemDataList.Where(x => x.ChildGuid == item.ChildGuid).ToList(); if (itemList.Count == 0) { - var Verification = await _dataValidationService.VerificationMaterial(item.ChildObjID, item.PartNumber, item.ChildGuid); - if (Verification == "不存在") + if (item.ChildObjID == 137) { - if (item.ChildObjID == 137) + var data137 = db.CopyNew().Queryable().Where(x => x.RecordGuid == item.ChildGuid && x.deleted == false).OrderByDescending(x => x.idRecord).First(); + if (data137 != null) { - string partNumber = item.PartNumber.Replace("默认 ", "");//过滤BOM表PartNumber字段存在“默认 ” - if (partNumber == item.PartNumber)//判断过滤后,物料编码是否和原料相同,相同的话跳出循环 - { - continue; - } - var data137 = db.CopyNew().Queryable().Where(x => x._System_objNBS == partNumber && x.deleted == false).OrderByDescending(x => x.idRecord).First(); - - if (data137 != null) - { - item.PartNumber = data137._System_objNBS; - } - else - { - continue; - } + item.PartNumber = data137._System_objNBS; } else { continue; } } + else + { + var Verification = await _dataValidationService.VerificationMaterial(item.ChildObjID, item.PartNumber, item.ChildGuid); + if (Verification == "不存在") + { + + continue; + } + } + + //int sun = i + 1; var itemData = new ItemData() {