Hi @Lee,
i see what you mean, i.e. at Start Activity method the Job Oper record is not yet loaded, so the easiest and correct way -in my opinion- is to trigger a BPMCallContext variable at Post-Process StartActivity then capture it at the Pre-Process Update method, so my design will stop any one to login on any operation as long as its previous operation has not been completed, Note: this solution will not correct history but going forward each start operation will validate previous one i.e. no operation can be missed, so
- Trigger a BPMCallContext variable at Post-Process StartActivity method:
2.Do the validation at Pre-Process LaborDtl Update method:
the code i created:
int iPreviousJobOperOprSeq = 0;
var ttLaborDtl_xRow = (from ttLaborDtl_Row in ttLaborDtl
where ttLaborDtl_Row.Company == Session.CompanyID
select ttLaborDtl_Row).FirstOrDefault();
if(ttLaborDtl_xRow != null)
{
int[] list = (from JobOper_Row in Db.JobOper
where JobOper_Row.Company == Session.CompanyID
&& JobOper_Row.JobNum == ttLaborDtl_xRow.JobNum
&& JobOper_Row.OprSeq < ttLaborDtl_xRow.OprSeq
select JobOper_Row.OprSeq).ToArray();
if(list !=null && list.Length > 0)
{
iPreviousJobOperOprSeq=list.Max();
var JobOper = (from JobOper_Row in Db.JobOper
where JobOper_Row.Company == Session.CompanyID
&& JobOper_Row.JobNum == ttLaborDtl_xRow.JobNum
&& JobOper_Row.OprSeq == iPreviousJobOperOprSeq
&& JobOper_Row.OpComplete == false
select JobOper_Row).FirstOrDefault();
if(JobOper != null)
{
CallContext.Current.ExceptionManager.AddBLException("Previous Job Operation Sequence : "+iPreviousJobOperOprSeq+" is incomplete please correct to proceed");
}
}
}
HTH