I got all my code built out and the syntax comes out good. However, I am getting an error when running it.
The error seems to be happening on line 214 of the following code:
//Get user input on part rev from BAQ selection
//Get user op description text from
//Get user change description from form
//Get op sequence code from user.
int counter = 0;
int counter2 = 0;
string checkedOutRev, msg;
bool flag;
myPart = callContextBpmData.Character01;
myRev = callContextBpmData.Character02;
//myComment = callContextBpmData.Character03; // defined after the dataset has been pulled. This helps combine the existing comment with the new comment.
myReason = callContextBpmData.Character04;
myUser = callContextBpmData.Character05;
myOp = Convert.ToInt32(callContextBpmData.Number01);
myResGrpID = callContextBpmData.Character06;
myQtyPerParent = Convert.ToDecimal(callContextBpmData.Number02);
mySetHours = Convert.ToDecimal(callContextBpmData.Number03);
myProdTime = Convert.ToDecimal(callContextBpmData.Number04);
SkipCheckIn = callContextBpmData.Checkbox01;
EngWorkBenchTableset tsWB = new EngWorkBenchTableset();
//check all inputs
this.PublishInfoMessage("myPart: " + myPart + "\n myRev: " + myRev + "\n myReason: " + myReason + "\n myUser: " + myUser + "\n myOp: " + myOp + "\n myResGrpID: " + myResGrpID , Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
//Module: PromptPW1
this.CallService<Erp.Contracts.EngWorkBenchSvcContract>(ewb => ewb.PromptForPassword(out myPass));
//Module: GetDSTree 6
this.CallService<Erp.Contracts.EngWorkBenchSvcContract>(ewb =>
{
tsWB = ewb.GetDatasetForTree(myUser, myPart, myRev,"","", BpmFunc.Now(), false, false);
});
//Module: Op Seq Taken? 1
//PUT IN QUERY CHECK IF OP EXISTS
foreach (var PartOpr_iterator in (from r in Db.PartOpr where r.Company == Session.CompanyID && r.PartNum == myPart && r.RevisionNum == myRev && r.OprSeq == myOp select r))
{
//Module: No Valid Op! 1
if (PartOpr_iterator == null)
{
this.PublishInfoMessage("This part and revision does not have Op " + myOp + ". Please review the operations for this part and select a valid Op sequence number.", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
break;
}
}
//Module: ECOUser? 1
//PUT IN QUERY CHECK IF USER ECO EXISTS
foreach (var ECOGroup_iterator in (from r in Db.ECOGroup where r.Company == Session.CompanyID && r.GroupID == myUser select r))
{
//Module: No ECO Group! 1
if (ECOGroup_iterator == null)
{
this.PublishInfoMessage("You do not have permission to make this change. Please contact ERPSupport to add your userID to the ECO group list.", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
break;
}
}
//Module: GetDsTree 1
this.CallService<Erp.Contracts.EngWorkBenchSvcContract>(ewb =>
{
tsWB = ewb.GetDatasetForTree(myUser, myPart, myRev,"","", BpmFunc.Now(), false, false);
});
counter = 0;
//Module: SkipCHeckin?2
if(SkipCheckIn == true)
{
//Module: CheckedOutAnyone? 1
foreach (var ECORev_iterator in (from r in Db.ECORev where r.Company == Session.CompanyID && r.PartNum == myPart && r.RevisionNum == myRev && r.CheckedOut == true select r))
{
counter++;
}
if(counter > 0)
{
//Module: CheckedOutByYou? 2
foreach (var ECORev_iterator in (from r in Db.ECORev where r.Company == Session.CompanyID && r.GroupID == myUser &&r.PartNum == myPart && r.RevisionNum == myRev && r.CheckedOut == true select r))
{
counter2++;
}
//Module: Already Checked Out! 2
if(counter2 == 0)
{
this.PublishInfoMessage("This part and revision has already been checked out to another user. Please check the revision back in before editing any operations.", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
//break;
}
}
else
{
//Module: CheckOut 1
this.CallService<Erp.Contracts.EngWorkBenchSvcContract>(ewb =>
{
tsWB = ewb.CheckOut(myUser, myPart, myRev,"","", BpmFunc.Now(), false, myPass, false, true, false, out checkedOutRev, out msg, out flag);
});
}
}
else
{
counter = 0;
counter2 = 0;
//Module: CheckedOutByYou? 1
foreach (var ECORev_iterator in (from r in Db.ECORev where r.Company == Session.CompanyID && r.GroupID == myUser &&r.PartNum == myPart && r.RevisionNum == myRev && r.CheckedOut == true select r))
{
counter++;
}
if(counter == 0)
{
//Module: Already Checked Out! 1
foreach (var ECORev_iterator in (from r in Db.ECORev where r.Company == Session.CompanyID && r.PartNum == myPart && r.RevisionNum == myRev && r.CheckedOut == true select r))
{
counter2++;
}
if(counter2 > 0)
{
this.PublishInfoMessage("This part and revision has already been checked out to another user.Please check the revision back in before editing any operations.", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
//break;
}
else
{
//Module: CheckOut 1
this.CallService<Erp.Contracts.EngWorkBenchSvcContract>(ewb =>
{
tsWB = ewb.CheckOut(myUser, myPart, myRev,"","", BpmFunc.Now(), false, myPass, false, true, false, out checkedOutRev, out msg, out flag);
});
}
}
}
//Module: GetECORevData 1
this.CallService<Erp.Contracts.EngWorkBenchSvcContract>(ewb =>
{
tsWB = ewb.GetECORevData(myUser, true);
});
//Module: GetDsTree 5
this.CallService<Erp.Contracts.EngWorkBenchSvcContract>(ewb =>
{
tsWB = ewb.GetDatasetForTree(myUser, myPart, myRev,"","", BpmFunc.Now(), false, false);
});
//Module: GetECORevData 1
this.CallService<Erp.Contracts.EngWorkBenchSvcContract>(ewb =>
{
tsWB = ewb.GetECORevData(myUser, true);
});
//Module: GetDsTree 5
this.CallService<Erp.Contracts.EngWorkBenchSvcContract>(ewb =>
{
tsWB = ewb.GetDatasetForTree(myUser, myPart, myRev,"","", BpmFunc.Now(), false, false);
});
//Module: set shortdesc1
myShortDesc = (from ECORev_Row in Db.ECORev
where ECORev_Row.Company == Session.CompanyID &&
ECORev_Row.GroupID == myUser &&
ECORev_Row.PartNum == myPart &&
ECORev_Row.RevisionNum == myRev
select ECORev_Row.RevShortDesc).FirstOrDefault();
//Module: Set myComment 1
myComment = (from ECORev_Row in Db.ECORev
where ECORev_Row.Company == Session.CompanyID &&
ECORev_Row.GroupID == myUser &&
ECORev_Row.PartNum == myPart &&
ECORev_Row.RevisionNum == myRev
select ECORev_Row.RevDescription).DefaultIfEmpty(".").FirstOrDefault();
//Check
this.PublishInfoMessage("My Comment: " + myComment + " My Short Desc: " + myShortDesc, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
//Module: is mycomment blank 1
if(myComment == "")
{
//Module: set mycomment=. 1
myComment = ".";
}
//Module: shortdesc is blank? 1
if(myShortDesc == "")
{
//Module: set shortdesc = . 1
myShortDesc = ".";
}
//Module: tsWB RowMod=u1
/* update ECOOpDtl*/
Erp.Tables.ECORev ECORev;
ECORev = (from ECORev_Row in Db.ECORev
where ECORev_Row.Company == Session.CompanyID &&
ECORev_Row.GroupID == myUser&&
ECORev_Row.PartNum == myPart &&
ECORev_Row.RevisionNum == myRev
select ECORev_Row).FirstOrDefault(); //Get the ECOOpDtl record to update...
if (ECORev != null)
{
ECORev.RevShortDesc = myShortDesc;
ECORev.RevDescription = myComment;
}
//Module: CheckECORev tsApp1 1
this.CallService<Erp.Contracts.EngWorkBenchSvcContract>(ewb => ewb.CheckECORevApproved(false, myPass, ref tsWB));
Error:
Even though this pops up it still checks out the part into your eco group. I also reapproved the revision and checked it back in but the error still comes up.
Is this something that just needs to be suppressed and if so how?