We want to firm jobs based on criteria, after MRP runs every day.
I have put a data directive on Ice.Systask using the Task Description and the Process Set name to trigger this.
Using the trace log, if I unfirm a job manually I get
Which makes sense, although it’s not clear why it always calls Update() twice.
If I trace a DMT unfirm it’s much simpler:
This makes even more sense.
Using DMT, there’s no problem firming these jobs. I only have five columns:
I can firm jobs by REST or BLTester, but not from my BPM.
If I use REST in the Swagger UI I can firm jobs. It doesn’t work if I try to work in a different site to my last activity, but I gues if I was using Rest I’d specify that in headers.
If I use the BLTester, with only GetByID and Update, everything just works.
I’ve managed to make it fail in BLTester two ways:
- If I don’t set the plant using Tools > Change Plant before invoking GetByID
Or
- If I make the change to the dataset AFTER pulling up the Update() method (but before invoking it).
That’s of interest because it gives me the same error as I’m getting in my BPM: “Update not allowed. Job not firm”. So if I select the Update() method and then change the dataset, I get this error, but if I change the flag right after GetByID() and THEN select Update() and immediately click Invoke, everything works.
The other thing I notice in BLTester is the JobFirm flag has 3 states. One click and it’s ticked, one more click and the tick turns grey, and one more click and the tick mark is cleared.
My BPM code is here:
//SF_JobFirmer
Ice.Diagnostics.Log.WriteEntry("BPM Triggered");
if ( (from t in ttSysTask where t.TaskDescription.Equals("Process MRP") /* && t.ProcessID.Equals("MRP Reg")*/ select t).Any() ) //MRP Just Ran (TODO: add called by process set MRP Reg)
{
using (CallContext.Current.TemporarySessionCreator.SetCompanyID("RDCAN").Create() )
{
using (var txScope = IceContext.CreateDefaultTransactionScope() )
{
DateTime futureDate = DateTime.Today.AddDays(30);
var job = (from jh in Db.JobHead
join jp in Db.JobProd on jh.JobNum equals jp.JobNum
join rl in Db.OrderRel on jp.OrderNum equals rl.OrderNum
join oh in Db.OrderHed on rl.OrderNum equals oh.OrderNum
where jp.OrderNum > 0 &&
jp.WIPQty > 0 &&
jp.OrderNum == rl.OrderNum &&
jp.OrderLine == rl.OrderLine &&
jp.OrderRelNum == rl.OrderRelNum &&
jh.JobEngineered == true &&
oh.OpenOrder == true &&
oh.ReadyToFulfill == true &&
rl.OpenRelease == true &&
rl.FirmRelease == true &&
rl.ReadyToFulfill == true &&
oh.RequestDate <= futureDate
select jh);
foreach (var j in job)
{
if ( (j.JobFirm == false) )
{
var bo = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.JobEntrySvcContract>(Db);
var ds = bo.GetByID(j.JobNum);
ds.JobHead[0].JobFirm = true;
ds.JobHead[0].RowMod = "U"; //tried "U", "M" and without this, no difference
bo.Update(ref ds);
}
}
txScope.Complete();
}
}
}
``cs
Anybody see anything? I haven't been able to find too much on this service contract.