😎修改查询判断条件
This commit is contained in:
parent
2fbed8bdb6
commit
09b00b1f88
@ -205,7 +205,7 @@ public class AdministrativeMaterialManagementService : IDynamicApiController, IT
|
||||
});
|
||||
continue;
|
||||
}
|
||||
if (input[i].fld004922 != "A" && input[i].fld004922 != "M")
|
||||
if (input[i].fld004922 != "A"|| input[i].fld004922 != "M"|| input[i].fld004922==null)
|
||||
{
|
||||
SapOutputList.Add(new SapOutput()
|
||||
{
|
||||
|
@ -182,10 +182,10 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
[DisplayName("获取BOM")]
|
||||
public async Task<SqlSugarPagedList<ProductManagementBomOutput>> GetBOM(BomPageProductManagementInput input)
|
||||
{
|
||||
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 110 && x.ConfigLabel == "mBOM").FirstAsync();
|
||||
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).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 !="不包含")
|
||||
.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<ProductManagementBomOutput>().ToPagedListAsync(input.Page, input.PageSize);
|
||||
@ -236,8 +236,8 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
|
||||
if (!string.IsNullOrEmpty(ParentData.fld005288))
|
||||
{
|
||||
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 110 && x.ConfigLabel == "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!="不包含").ToListAsync();
|
||||
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();
|
||||
for (int i = 0; i < BomData.Count; i++)
|
||||
{
|
||||
|
||||
@ -300,7 +300,7 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
fld004315 = codeVal,
|
||||
fld004316 = "N",
|
||||
fld004317 = apiOutput.msg,
|
||||
fld005288 = input[0].ParentVersion.ToString()////////////////////////////////////////////////////////////xinixnixn
|
||||
fld005288 = input[0].ParentVersion.ToString()
|
||||
})
|
||||
.Where(it => it.idRecord == ParentData.idRecord)
|
||||
.ExecuteCommandAsync();
|
||||
@ -356,7 +356,7 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
});
|
||||
continue;
|
||||
}
|
||||
if (input[i].fld004312 != "A" && input[i].fld004312 != "M")
|
||||
if (input[i].fld004312 != "A" || input[i].fld004312 != "M" || input[i].fld004312==null)
|
||||
{
|
||||
SapOutputList.Add(new SapOutput()
|
||||
{
|
||||
@ -554,7 +554,7 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
var sapOutputList = new List<SapOutput>();
|
||||
var sapUserName = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
|
||||
// 配置
|
||||
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 110 && x.ConfigLabel == "mBOM").FirstAsync();
|
||||
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.fld004316 == "A" || x.fld004316 == "M"))
|
||||
@ -565,17 +565,19 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
|
||||
foreach (var item in groupedData)
|
||||
{
|
||||
|
||||
// 获取版本号
|
||||
var versionIndex = item.VersionIndex;
|
||||
// 获取 ECN guid
|
||||
var ecnGuid = item.fld004944_Rec;
|
||||
// 查询 BOM
|
||||
var bomData = await _configurationDataRep.AsQueryable()
|
||||
.Where(x => x.ConfigId == configid.ConfigID && x.ParentGuid == item.RecordGuid && x.isDeleted == false && x.ParentVersion == versionIndex && x.fld005586 != "不包含").ToListAsync();
|
||||
.Where(x => x.ConfigId == configid.ConfigID && x.ParentGuid == item.RecordGuid && x.isDeleted == false && x.ParentVersion == versionIndex && (x.fld005586 != "不包含" || x.fld005586 == null)).ToListAsync();
|
||||
if (bomData.Count == 0)
|
||||
{
|
||||
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 : "";
|
||||
@ -605,6 +607,45 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
itemDataList.Add(itemData);
|
||||
|
||||
}
|
||||
|
||||
var ParentData = await _obj110Rep.AsQueryable().Where(x => x.RecordGuid == bomData[0].ParentGuid && x.deleted == false && x.VersionIndex == bomData[0].ParentVersion).FirstAsync();
|
||||
|
||||
//对比上个版本
|
||||
if (!string.IsNullOrEmpty(ParentData.fld005288))
|
||||
{
|
||||
var configidold = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 110 && x.ConfigSystemName == "mBOM").FirstAsync();
|
||||
var BomDataold = await _configurationDataRep.AsQueryable().Where(x => x.ConfigId == configidold.ConfigID && x.ParentGuid == bomData[0].ParentGuid && x.isDeleted == false && x.ParentVersion == Convert.ToInt32(ParentData.fld005288) && (x.fld005586 != "不包含" || x.fld005586 == null)).ToListAsync();
|
||||
for (int i = 0; i < BomDataold.Count; i++)
|
||||
{
|
||||
|
||||
var itemList = itemDataList.Where(x => x.IDNRK == BomDataold[i].PartNumber).ToList();
|
||||
if (itemList.Count == 0)
|
||||
{
|
||||
var Verification = await _dataValidationService.VerificationMaterial(BomDataold[i].ChildObjID, BomDataold[i].PartNumber, BomDataold[i].ChildGuid);
|
||||
if (Verification == "不存在")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
//int sun = i + 1;
|
||||
var itemData = new ItemData()
|
||||
{
|
||||
POSNR = "",//组件序号 sun.ToString()
|
||||
IDNRK = BomDataold[i].PartNumber,//组件物料号
|
||||
MENGE = BomDataold[i].Quantity.ToString(),//组件数量
|
||||
SORTF = BomDataold[i].fld004936,
|
||||
ITISOB = BomDataold[i].fld004937,
|
||||
ALPGR = BomDataold[i].fld004938,
|
||||
ALPRF = BomDataold[i].fld004939,
|
||||
ZDELETE = "X",
|
||||
POSTP = BomDataold[i].fld004492,
|
||||
ZYFMK = BomDataold[i].fld004941
|
||||
};
|
||||
itemDataList.Add(itemData);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 获取时间戳精确到毫秒,sap 要求每次调用生成不重复 guid
|
||||
string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
|
||||
var isreq = new IS_REQ
|
||||
@ -668,7 +709,7 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
[DisplayName("获取工艺路线")]
|
||||
public async Task<SqlSugarPagedList<ProductManagementBomOutput>> GetProcessRoute(BomPageProductManagementInput input)
|
||||
{
|
||||
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 110 && x.ConfigLabel == "pBOM").FirstAsync();
|
||||
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 110 && x.ConfigSystemName == "pBOM").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)
|
||||
@ -785,7 +826,7 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
var sapOutputList = new List<SapOutput>();
|
||||
var sapUserName = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
|
||||
// 配置
|
||||
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 110 && x.ConfigLabel == "pBOM").FirstAsync();
|
||||
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 110 && x.ConfigSystemName == "pBOM").FirstAsync();
|
||||
|
||||
//查询需要同步的产品
|
||||
var materialData = await _obj110Rep.AsQueryable()
|
||||
|
@ -204,7 +204,7 @@ public class ProductionMaterialsManagementService : IDynamicApiController, ITran
|
||||
});
|
||||
continue;
|
||||
}
|
||||
if (input[i].fld004607 != "A"&& input[i].fld004607 != "M")
|
||||
if (input[i].fld004607 != "A" || input[i].fld004607 != "M" || input[i].fld004607 == null)
|
||||
{
|
||||
SapOutputList.Add(new SapOutput()
|
||||
{
|
||||
|
@ -212,7 +212,7 @@ public class ProjectManagementService : IDynamicApiController, ITransient
|
||||
});
|
||||
continue;
|
||||
}
|
||||
if (input[i].fld004510 != "A" && input[i].fld004510 != "M")
|
||||
if (input[i].fld004510 != "A" || input[i].fld004510 != "M" || input[i].fld004510 == null)
|
||||
{
|
||||
SapOutputList.Add(new SapOutput()
|
||||
{
|
||||
@ -300,7 +300,7 @@ public class ProjectManagementService : IDynamicApiController, ITransient
|
||||
[DisplayName("获取BOM")]
|
||||
public async Task<SqlSugarPagedList<ProjectManagementBomOutput>> GetBOM(BomProjectManagementInput input)
|
||||
{
|
||||
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 109 && x.ConfigLabel == "mBOM").FirstAsync();
|
||||
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 109 && x.ConfigSystemName == "mBOM").FirstAsync();
|
||||
var parent = await _obj109Rep.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)
|
||||
@ -523,7 +523,7 @@ public class ProjectManagementService : IDynamicApiController, ITransient
|
||||
var sapOutputList = new List<SapOutput>();
|
||||
var sapUserName = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
|
||||
// 配置
|
||||
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 109 && x.ConfigLabel == "mBOM").FirstAsync();
|
||||
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 109 && x.ConfigSystemName == "mBOM").FirstAsync();
|
||||
|
||||
var materialData = await _obj109Rep.AsQueryable()
|
||||
.Where(x => (x.CheckedStatus == 0 || x.CheckedStatus == 1) && x.deleted == false && x.IsLatestVersion == true && x.fld005040 == "发布" && x.fld004511 == "成功" && (x.fld004514 == "A" || x.fld004514 == "M"))
|
||||
@ -637,7 +637,7 @@ public class ProjectManagementService : IDynamicApiController, ITransient
|
||||
[DisplayName("获取工艺路线")]
|
||||
public async Task<SqlSugarPagedList<ProductManagementBomOutput>> GetProcessRoute(BomPageProductManagementInput input)
|
||||
{
|
||||
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 109 && x.ConfigLabel == "pBOM").FirstAsync();
|
||||
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 109 && x.ConfigSystemName == "pBOM").FirstAsync();
|
||||
var parent = await _obj109Rep.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)
|
||||
@ -752,7 +752,7 @@ public class ProjectManagementService : IDynamicApiController, ITransient
|
||||
var sapOutputList = new List<SapOutput>();
|
||||
var sapUserName = await _sysConfigService.GetConfigValueByCode<string>(ConfigConst.SapUserName);
|
||||
// 配置
|
||||
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 109 && x.ConfigLabel == "pBOM").FirstAsync();
|
||||
var configid = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 109 && x.ConfigSystemName == "pBOM").FirstAsync();
|
||||
|
||||
//查询需要同步的产品
|
||||
var materialData = await _obj109Rep.AsQueryable()
|
||||
|
Loading…
Reference in New Issue
Block a user