😎修改同步bom时物料取值方式
This commit is contained in:
parent
9d50065a75
commit
e5f2374772
@ -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)
|
||||
{
|
||||
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<Obj137>().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<Obj137>().Where(x => x.deleted == false && x.RecordGuid == item.ChildGuid && x._system_objConfigurationName == "默认").OrderByDescending(x=>x.idRecord).FirstAsync();
|
||||
if (data137 == null)
|
||||
{
|
||||
verification = "不存在";
|
||||
@ -853,29 +876,9 @@ 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<Obj137>().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
|
||||
{
|
||||
@ -901,19 +904,10 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
//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)
|
||||
{
|
||||
string partNumber = item.PartNumber.Replace("默认 ", "");//过滤BOM表PartNumber字段存在“默认 ”
|
||||
if (partNumber == item.PartNumber)//判断过滤后,物料编码是否和原料相同,相同的话跳出循环
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var data137 = db.CopyNew().Queryable<Obj137>().Where(x => x._System_objNBS == partNumber && x.deleted == false).OrderByDescending(x => x.idRecord).First();
|
||||
|
||||
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)
|
||||
{
|
||||
item.PartNumber = data137._System_objNBS;
|
||||
@ -925,9 +919,41 @@ public class ProductManagementService : IDynamicApiController, ITransient
|
||||
}
|
||||
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<Obj137>().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()
|
||||
|
@ -651,7 +651,7 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
|
||||
string verification = "不存在";
|
||||
if (item.ChildObjID == 137)
|
||||
{
|
||||
var data137 = await db.CopyNew().Queryable<Obj137>().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<Obj137>().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<Obj137>().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;
|
||||
}
|
||||
//if (item.ChildObjID == 137)
|
||||
//{
|
||||
// string partNumber = item.PartNumber.Replace("默认 ", "");//过滤BOM表PartNumber字段存在“默认 ”
|
||||
// if (partNumber == item.PartNumber)//判断过滤后,物料编码是否和原料相同,相同的话跳出循环
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
// var data137 = db.CopyNew().Queryable<Obj137>().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,21 +720,12 @@ 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)
|
||||
{
|
||||
string partNumber = item.PartNumber.Replace("默认 ", "");//过滤BOM表PartNumber字段存在“默认 ”
|
||||
if (partNumber == item.PartNumber)//判断过滤后,物料编码是否和原料相同,相同的话跳出循环
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var data137 = db.CopyNew().Queryable<Obj137>().Where(x => x._System_objNBS == partNumber && x.deleted == false).OrderByDescending(x => x.idRecord).First();
|
||||
|
||||
var data137 = db.CopyNew().Queryable<Obj137>().Where(x => x.RecordGuid == item.ChildGuid && x.deleted == false).OrderByDescending(x => x.idRecord).First();
|
||||
if (data137 != null)
|
||||
{
|
||||
item.PartNumber = data137._System_objNBS;
|
||||
@ -743,9 +737,15 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
|
||||
}
|
||||
else
|
||||
{
|
||||
var Verification = await _dataValidationService.VerificationMaterial(item.ChildObjID, item.PartNumber, item.ChildGuid);
|
||||
if (Verification == "不存在")
|
||||
{
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//int sun = i + 1;
|
||||
var itemData = new ItemData()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user