I am a BPM novice and am having some difficulty with the following situation that maybe someone can see the solution to quickly.
I currently have a post-processing BPM on ERP.VendPartPlant.Update. There are actually 2 of these BPMs (I separated them in case upper management changed their minds). The purpose is to update the PartPlant.LeadTime and the PartPlant.DaysOfSupply fields with the value in the VendPart.LeadTime field so that users only need to update the Supplier Price List Lead Time in order to populate these two fields and thus keep them in sync.
However, we do not want the PartPlant.DaysOfSupply to be updated from the VendPart.LeadTime field for anything other than PURCHASED (P) parts on the Part.TypeCode field.
How do I create a condition on the following custom code to ignore the Part.TypeCodes that are NOT âPâ?
Any help would be greatly appreciated.
Thanks
int LTime;
string PartNum1;
int VNum;
var vendPartTt = ttVendPart.Where(item => item.Company == CompanyID).FirstOrDefault();
if(vendPartTt != null){
LTime = vendPartTt.LeadTime;
PartNum1 = vendPartTt.PartNum;
VNum = vendPartTt.VendorNum;
LTime = 0;
foreach(var vendPartDb in Db.VendPart.Where(item => item.VendorNum == VNum && item.PartNum == PartNum1 && item.Company == vendPartTt.Company).With(LockHint.NoLock)){
LTime = vendPartDb.LeadTime;
}
foreach(var partPlantDb in Db.PartPlant
.Where(item => item.PartNum == PartNum1 && item.VendorNum == VNum && item.Company == vendPartTt.Company)
.With(LockHint.NoLock)){
partPlantDb.DaysOfSupply = LTime;
}
}