With some pointers from epiUser.Help and @amurdock, I managed to get Bartender installed, setup and semi-functional. Still a work in progress, but happy with the status thus far.
I’ve managed to get correct labels, depending on PurchaseType, to print automatically when a receipt line is marked as received. Still, need to figure out a few things before implementing this is production, but it’s a start!
BPM Question
Does anyone have any tricks/ideas/code snippets to find the next operation on a job? Meaning if a SubContracting operation is received, I want to display the next operation, assuming the SubCon op isn’t marked as final.
This situation is relatively simple, I know there are more complicated situations I’ll need to program for as well, but small steps first.
The structure of the job looks like this:
Op 10 - Cut
Op 20 - Machine
Op 30 - OV Plating (subcontracting on PO)
Op 40 - Assembly
When the PO related to Op 30 is received, I need to be able to find the next Op (40) and print that on the label.
Two thoughts come to mind;
Find a programmatical way to find the next op; loop through the possible options CurrentOp +1, until a match is found.
Find a “NextOp” field in the database, that I’m not aware of, and yes I hunted a bit. I would think the scheduling engine & work queues would need that data.
I’ll have to dig around, I recall building a baq report to print a move ticket that printed out the next operation. It’s a relatively straight forward query.
Hi @nhutchins,
not sure if there is a ‘NextOp’ filed within any BO, but my conventional programmatic way to find next operation is to do foreach loop within your table, add condition to exclude any operation seq. smaller than your tt JobOper.Oprseq., then compare each matched records to variable (declared to start with zero) with another condition to update it only if Oprseq_iterator value is smaller than the saved variable value, and that is it, i remember some one asked about finding the final operation within JobOper table, and i have posted the code, cant find it now, but it is the same logical principle.
i can see that, and that is why the code will call any operation from the rest, unless your routing has only one record after the tt current operation which is not always the case
You could retrieve the results of the query into an array, then loop through the contents of the array, find your current op, then the next op (if exists) would be index + 1.
i would like to see the code of assigning selected Epicor Db.Table.Filed to a defined array withing the BPM class, i have tried before with no luck, however could you explain what do you mean by indexing by +1, will it work when gap between operation sequence is more than 1
Yes, because the index refers to the array and its contents, not the job sequence.
I’ll see if I can dig up some code where I did that. Stand by.
var ttLaborDtlR = ttLaborDtl.FirstOrDefault(r=>r.Added() || r.Updated());
if( ttLaborDtlR != null )
{
string job = (string)ttLaborDtlR.JobNum;
int op = (int)ttLaborDtlR.OprSeq;
int nextOp = 0;
int ass = (int)ttLaborDtlR.AssemblySeq;
//Get an ascending list of job operations
int[] jobOps = (
from j in Db.JobOper.With(LockHint.NoLock)
where j.Company == Session.CompanyID &&
j.JobNum == job &&
j.AssemblySeq == ass
orderby j.OprSeq
select j.OprSeq).ToArray();
for( int i = 0; i < jobOps.Count(); i ++ )
{
if( jobOps[i] == op )
{
int nextAvail = i + 1;
if( nextAvail < jobOps.Count() ) //Check to see if the next index is real
nextOp = jobOps[nextAvail];
}
}
//Set the next operations 'PrevOpComp' to true
foreach(var jobs in(
from jo in Db.JobOper.With(LockHint.UpdLock)
where jo.Company == Session.CompanyID &&
jo.JobNum == job &&
jo.AssemblySeq == ass &&
jo.OprSeq == nextOp
select new {jo}))
using( var scope = IceDataContext.CreateDefaultTransactionScope() )
{
if( jobs.jo != null )
jobs.jo["PrevOpComp_c"] = true;
scope.Complete();
}
}