Hello All!
I am working on automatic BPM hold creation and removal for jobs with non-conforming sub-assemblies. I am at the part where I would like to have a Hold be released when the entire Non-Conf qty is deemed good and can return to the job from the inspection module.
The issue comes when I am trying to remove the hold from the Job. I can get the data set, update the BpHoldAttachment.RowMod to “D” then call the bpHold Service update method to remove the hold, but this is not triggering the addition of that hold to the BpHoldAttachHist.
I wanted to know if I am missing a statement, or if I should be using a different approach to remove this hold…
Now, on to the fun part!
In Erp.InspProcessing.InspectOperation / Pre-Processing
In the custom code section:
using(Ice.Contracts.BpHoldsSvcContract bpHoldSrvc = Ice.Assemblies.ServiceRenderer.GetService<Ice.Contracts.BpHoldsSvcContract>(Db))
{
string whereClauseBpHoldType = string.Format("HoldTypeID = '{0}' and ClassName = 'JobEntry' and SystemCode = 'ERP' BY HoldTypeID", HoldType);
string whereClauseBpHoldAttachHist = string.Empty;
string whereClauseBpHoldAttachment = string.Format("HoldSysRowID = '{0}'", activeHold.HoldSysRowID);
int pageSize = 100;
int absolutePage = 0;
bool morePages = false;
Ice.Tablesets.BpHoldsTableset bpHoldDs = null;
try
{
bpHoldDs = bpHoldSrvc.GetRows(whereClauseBpHoldType, whereClauseBpHoldAttachHist, whereClauseBpHoldAttachment, pageSize, absolutePage, out morePages);
}
catch(Exception x)
{
throw new Ice.BLException(x.Message);
}
if(bpHoldDs == null)
return;
bpHoldDs .BpHoldAttachment[0].SetRowState(IceRowState.Deleted);
bpHoldSrvc.Update(ref bpHoldDs );
}
using this method, I am showing gaps in my history…
I haven’t tried the drag and drop Invoke BO Methods, but I would really love to know why this wouldn’t trigger the same triggers as deleting the hold from the BPM Holds screen.
Thank you!
Dave
UPDATE:
I decided to test the UpdateExt method to see if it delete the hold and create the history. and it did.
Ice.Tablesets.UpdExtBpHoldsTableset bpHoldUpdDs = new Ice.Tablesets.UpdExtBpHoldsTableset();
Ice.Tablesets.BpHoldAttachmentRow bpHoldAtchRow = new Ice.Tablesets.BpHoldAttachmentRow(){
Comment = bpHoldDs.BpHoldAttachment[0].Comment,
Company = bpHoldDs.BpHoldAttachment[0].Company,
CreatedOn = bpHoldDs.BpHoldAttachment[0].CreatedOn,
CreateUserID = bpHoldDs.BpHoldAttachment[0].CreateUserID,
HoldAttachID = bpHoldDs.BpHoldAttachment[0].HoldAttachID,
HoldSysRowID = bpHoldDs.BpHoldAttachment[0].HoldSysRowID,
HoldTypeID = bpHoldDs.BpHoldAttachment[0].HoldTypeID,
SysRowID = bpHoldDs.BpHoldAttachment[0].SysRowID,
SysRevID = bpHoldDs.BpHoldAttachment[0].SysRevID
};
bpHoldUpdDs.BpHoldAttachment.Add(bpHoldAtchRow);
bpHoldUpdDs.BpHoldAttachment[0].SetRowState(IceRowState.Deleted);
Ice.Tablesets.BpHoldTypeRow bpHoldTypeRow = new Ice.Tablesets.BpHoldTypeRow(){
ClassName = bpHoldDs.BpHoldType[0].ClassName,
Company = bpHoldDs.BpHoldType[0].Company,
DataTableID = bpHoldDs.BpHoldType[0].DataTableID,
Description = bpHoldDs.BpHoldType[0].Description,
HistoryLength = bpHoldDs.BpHoldType[0].HistoryLength,
HoldTypeID = bpHoldDs.BpHoldType[0].HoldTypeID,
ObjectNS = bpHoldDs.BpHoldType[0].ObjectNS,
SysRowID = bpHoldDs.BpHoldType[0].SysRowID,
SystemCode = bpHoldDs.BpHoldType[0].SystemCode,
SystemFlag = bpHoldDs.BpHoldType[0].SystemFlag
};
bpHoldUpdDs.BpHoldType.Add(bpHoldTypeRow);
bool errorsOccurred = false;
Ice.BOUpdErrorTableset rtn = bpHoldSrvc.UpdateExt(ref bpHoldUpdDs, false,true,out errorsOccurred);
BpmContext.BpmData.Checkbox01 = errorsOccurred;
if(errorsOccurred)
BpmContext.BpmData.Character01 = rtn.BOUpdError[0].ErrorText;
This achieved my goal, but I am curious if there isn’t a way to have the Update method trigger the addition of hold history.