diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Job/ProductDesignLibrary/SyncProductDesignBomToSap.cs b/admin.net.pro/Admin.NET/Vistar.Application/Job/ProductDesignLibrary/SyncProductDesignBomToSap.cs index 8d99711..832ff90 100644 --- a/admin.net.pro/Admin.NET/Vistar.Application/Job/ProductDesignLibrary/SyncProductDesignBomToSap.cs +++ b/admin.net.pro/Admin.NET/Vistar.Application/Job/ProductDesignLibrary/SyncProductDesignBomToSap.cs @@ -44,7 +44,7 @@ public class SyncProductDesignBomToSap : IJob var db = serviceScope.ServiceProvider.GetRequiredService().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew(); - DateTime cutoffTime = new DateTime(2025, 4, 30, 20, 0, 0); + DateTime cutoffTime = new DateTime(2025, 6, 30, 20, 0, 0); if (startTime > cutoffTime) { // 创建一个Random类的实例 diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Job/ProductDesignLibrary/SyncProductDesignMaterialToSap.cs b/admin.net.pro/Admin.NET/Vistar.Application/Job/ProductDesignLibrary/SyncProductDesignMaterialToSap.cs index cc18ac5..01d400f 100644 --- a/admin.net.pro/Admin.NET/Vistar.Application/Job/ProductDesignLibrary/SyncProductDesignMaterialToSap.cs +++ b/admin.net.pro/Admin.NET/Vistar.Application/Job/ProductDesignLibrary/SyncProductDesignMaterialToSap.cs @@ -42,7 +42,7 @@ public class SyncProductDesignMaterialToSap : IJob //var sysEnumService = serviceScope.ServiceProvider.GetRequiredService(); var db = serviceScope.ServiceProvider.GetRequiredService().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew(); - DateTime cutoffTime = new DateTime(2025, 4, 30, 20, 0, 0); + DateTime cutoffTime = new DateTime(2025, 6, 30, 20, 0, 0); if (startTime > cutoffTime) { // 创建一个Random类的实例 diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Job/ProductDesignLibrary/SyncProductDesignProcessRouteToSap.cs b/admin.net.pro/Admin.NET/Vistar.Application/Job/ProductDesignLibrary/SyncProductDesignProcessRouteToSap.cs index 6243a1b..284626b 100644 --- a/admin.net.pro/Admin.NET/Vistar.Application/Job/ProductDesignLibrary/SyncProductDesignProcessRouteToSap.cs +++ b/admin.net.pro/Admin.NET/Vistar.Application/Job/ProductDesignLibrary/SyncProductDesignProcessRouteToSap.cs @@ -41,7 +41,7 @@ public class SyncProductDesignProcessRouteToSap : IJob //var sysEnumService = serviceScope.ServiceProvider.GetRequiredService(); var db = serviceScope.ServiceProvider.GetRequiredService().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew(); - DateTime cutoffTime = new DateTime(2025, 4, 30, 20, 0, 0); + DateTime cutoffTime = new DateTime(2025, 6, 30, 20, 0, 0); if (startTime > cutoffTime) { // 创建一个Random类的实例 diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Service/ChangeNoticeEcn/ChangeNoticeEcnService.cs b/admin.net.pro/Admin.NET/Vistar.Application/Service/ChangeNoticeEcn/ChangeNoticeEcnService.cs index 3824ddb..e682e88 100644 --- a/admin.net.pro/Admin.NET/Vistar.Application/Service/ChangeNoticeEcn/ChangeNoticeEcnService.cs +++ b/admin.net.pro/Admin.NET/Vistar.Application/Service/ChangeNoticeEcn/ChangeNoticeEcnService.cs @@ -85,7 +85,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient public async Task> Page(PageChangeNoticeEcnInput input) { var query = await _obj118Rep.AsQueryable() - .Where(x => x.CheckedStatus == 1 && x.deleted == false && x.IsLatestVersion == true && x._System_CurrentStage == "标准化审核") + .Where(x => x.CheckedStatus == 1 && x.deleted == false && x.IsLatestVersion == true && x._System_CurrentStage == "标准化审核中") .WhereIF(!string.IsNullOrWhiteSpace(input._System_objNBS), u => u._System_objNBS.Contains(input._System_objNBS.Trim())) .WhereIF(input.fld004693Range != null && input.fld004693Range.Length == 2, u => u.fld004693 >= input.fld004693Range[0] && u.fld004693 <= input.fld004693Range[1]) .Select() @@ -228,7 +228,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient var db = serviceScope.ServiceProvider.GetRequiredService().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew(); var input = await db.CopyNew().Queryable() - .Where(x => x.CheckedStatus == 1 && x._System_CurrentStage == "标准化审核" && x.deleted == false && x.IsLatestVersion == true && x.fld005292 == "A") + .Where(x => x.CheckedStatus == 1 && x._System_CurrentStage == "标准化审核中" && x.deleted == false && x.IsLatestVersion == true && x.fld005292 == "A") .ToListAsync(); var SapOutputList = new List(); var Requser = await _sysConfigService.GetConfigValueByCode(ConfigConst.SapUserName); @@ -306,14 +306,14 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient var ecnList = list.GroupBy(x => x.RecordGuid) .Select(group => group.OrderByDescending(item => item.idRecord).First()) .ToList(); - if (ecnList.Count==0) + if (ecnList.Count == 0) { return "未查询到符合条件的记录"; } - string output=""; + string output = ""; foreach (var ecnListItem in ecnList) { - output = output+ecnListItem._System_objNBS+"、"; + output = output + ecnListItem._System_objNBS + "、"; //ecn表对比结果 var ecnComparisonResult = "成功"; //条目对比结果 @@ -378,15 +378,87 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient isAddedFromSW = true }; - var addParentBom = db.CopyNew().Insertable(parentBom) - .InsertColumns(x => new { x.ParentGuid, x.ChildGuid, x.ChildObjID, x.ConfigId, x.childVersion, x.ParentVersion, x.isDeleted, x.Quantity, x.Description, x.OrderIndex, x.PartNumber, x.BOMGuid, x.fld006567, x.CreatedDate, x.ModifiedDate, x.EffectiveFrom, x.EffectiveTo, x.ChildSwFileType, x.ParentSwFileType, x.ParentObjectID, x.CreatedUserID, x.ModifiedUserID, x.ChildConfigID, x.isAddedFromSW }) - .ExecuteReturnEntity(); + //当前版本BOM var bomList = await db.CopyNew().Queryable().Where(x => x.ParentGuid == recordRecordGuid && x.ParentVersion == recordVersionIndex && x.isDeleted == false && x.ConfigId == 8 && (x.fld005577 != "不包含" || x.fld005577 == null) && x.isSuppressed == false && x.inContext == false && (!(x.ParentSwFileType == 1 && x.isAddedFromSW == false))).ToListAsync(); //旧版本BOM var historyBomList = await db.CopyNew().Queryable().Where(x => x.ParentGuid == recordRecordGuid && x.ParentVersion == Convert.ToInt32(fld005686) && x.isDeleted == false && x.ConfigId == 8 && (x.fld005577 != "不包含" || x.fld005577 == null) && x.isSuppressed == false && x.inContext == false && (!(x.ParentSwFileType == 1 && x.isAddedFromSW == false))).ToListAsync(); + + bool isExist = false; + + foreach (var item in bomList) + { + var bomListChildGuid = item.ChildGuid; + var bomListQuantity = item.QtyManual; + //BOM对比-修改 + var bomChange = historyBomList.Where(x => x.ChildGuid == bomListChildGuid && x.QtyManual != bomListQuantity).ToList(); + if (bomChange.Count != 0) + { + isExist = true; + } + var bomChangeVersion = historyBomList.Where(x => x.ChildGuid == bomListChildGuid && x.QtyManual == bomListQuantity && x.childVersion != item.childVersion).ToList(); + if (bomChangeVersion.Count != 0) + { + bool isExistVersion = false; + for (var i = 0; i < bomChangeVersion.Count; i++) + { + if (bomChangeVersion[i].ChildObjID == 137) + { + var ParentData = db.CopyNew().Queryable().Where(x => x.RecordGuid == bomListChildGuid && x.SWPDMConfigurationName == "默认").OrderByDescending(x => x.idRecord).First(); + item.childVersion = ParentData.VersionIndex; + } + var versionChange = await _dataValidationService.ComparativeVersion(bomChangeVersion[i].ChildObjID, bomListChildGuid, (int)item.childVersion, (int)bomChangeVersion[i].childVersion); + if (string.IsNullOrWhiteSpace(versionChange)) + { + continue; + } + else + { + isExistVersion=true; + break; + } + } + if (isExistVersion==true) + { + isExist = true; + } + } + //BOM对比-新增 + var bomAdd = historyBomList.Where(x => x.ChildGuid == bomListChildGuid).ToList(); + if (bomAdd.Count == 0) + { + isExist = true; + } + + + } + foreach (var historyBomListItem in historyBomList) + { + var historyBomChildGuid = historyBomListItem.ChildGuid; + var deleteListData = bomList.Where(x => x.ChildGuid == historyBomChildGuid).ToList(); + if (deleteListData.Count == 0) + { + isExist = true; + } + } + + + if (isExist == true) + { + var addParentBom = db.CopyNew().Insertable(parentBom) + .InsertColumns(x => new { x.ParentGuid, x.ChildGuid, x.ChildObjID, x.ConfigId, x.childVersion, x.ParentVersion, x.isDeleted, x.Quantity, x.Description, x.OrderIndex, x.PartNumber, x.BOMGuid, x.fld006567, x.CreatedDate, x.ModifiedDate, x.EffectiveFrom, x.EffectiveTo, x.ChildSwFileType, x.ParentSwFileType, x.ParentObjectID, x.CreatedUserID, x.ModifiedUserID, x.ChildConfigID, x.isAddedFromSW }) + .ExecuteReturnEntity(); + } + else + { + continue; + } + + + + //遍历新BOM foreach (var bomListItem in bomList) { @@ -458,6 +530,12 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient var bomChangeVersion = historyBomList.Where(x => x.ChildGuid == bomListChildGuid && x.QtyManual == bomListQuantity && x.childVersion != bomListItem.childVersion).ToList(); for (var i = 0; i < bomChangeVersion.Count; i++) { + if (bomChangeVersion[i].ChildObjID==137) + { + var ParentData = db.CopyNew().Queryable().Where(x=>x.RecordGuid== bomListChildGuid && x.SWPDMConfigurationName=="默认").OrderByDescending(x=>x.idRecord).First(); + bomListItem.childVersion= ParentData.VersionIndex; + } + var versionChange = await _dataValidationService.ComparativeVersion(bomChangeVersion[i].ChildObjID, bomListChildGuid, (int)bomListItem.childVersion, (int)bomChangeVersion[i].childVersion); if (string.IsNullOrWhiteSpace(versionChange)) { @@ -617,7 +695,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient .Where(it => it.RequestItemsId == listOfDrawingRequestItemsId) .ExecuteCommand(); - ecnComparisonResult = ecnComparisonResult + itemComparisonResult; + //ecnComparisonResult = ecnComparisonResult + itemComparisonResult; } db.CopyNew().Updateable() @@ -630,6 +708,6 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient .Where(it => it.idRecord == ecnListItem.idRecord) .ExecuteCommand(); } - return output+"对比完成,请到前端查看结果"; + return output + "对比完成,请到前端查看结果"; } } diff --git a/admin.net.pro/Web/src/views/processManagement/changeNoticeEcn/index.vue b/admin.net.pro/Web/src/views/processManagement/changeNoticeEcn/index.vue index 8de0c3f..6465543 100644 --- a/admin.net.pro/Web/src/views/processManagement/changeNoticeEcn/index.vue +++ b/admin.net.pro/Web/src/views/processManagement/changeNoticeEcn/index.vue @@ -37,7 +37,7 @@