😭变更通知ecn查询条件标准化审核改为标准化审核中

This commit is contained in:
bairubing 2025-05-19 14:00:46 +08:00
parent d1f98addd8
commit a01b71b1ed
5 changed files with 92 additions and 14 deletions

View File

@ -44,7 +44,7 @@ public class SyncProductDesignBomToSap : IJob
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().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类的实例

View File

@ -42,7 +42,7 @@ public class SyncProductDesignMaterialToSap : IJob
//var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().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类的实例

View File

@ -41,7 +41,7 @@ public class SyncProductDesignProcessRouteToSap : IJob
//var sysEnumService = serviceScope.ServiceProvider.GetRequiredService<SysEnumService>();
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().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类的实例

View File

@ -85,7 +85,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
public async Task<SqlSugarPagedList<ChangeNoticeEcnOutput>> 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<ChangeNoticeEcnOutput>()
@ -228,7 +228,7 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().AsTenant().GetConnectionScope("启威星 1.94.4.74").CopyNew();
var input = await db.CopyNew().Queryable<Obj118>()
.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<SapOutput>();
var Requser = await _sysConfigService.GetConfigValueByCode<string>(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<ConfigurationData>().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<ConfigurationData>().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<Obj137>().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<Obj137>().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<Obj118>()
@ -630,6 +708,6 @@ public class ChangeNoticeEcnService : IDynamicApiController, ITransient
.Where(it => it.idRecord == ecnListItem.idRecord)
.ExecuteCommand();
}
return output+"对比完成,请到前端查看结果";
return output + "对比完成,请到前端查看结果";
}
}

View File

@ -37,7 +37,7 @@
<template #row_buttons="{ row }">
<el-tooltip content="同步到ERP" placement="top">
<el-button icon="ele-Promotion" size="small" text="" type="success" @click="syncToSAP(row)"
v-auth="'changeNoticeEcn/syncToSAP'" v-if="row.fld005292 == 'A' && row._System_CurrentStage == '标准化审核'"> 同步到SAP </el-button>
v-auth="'changeNoticeEcn/syncToSAP'" v-if="row.fld005292 == 'A' && row._System_CurrentStage == '标准化审核'"> 同步到SAP </el-button>
</el-tooltip>
</template>
</vxe-grid>