Material Queue BPM to hijack MtlQueueSeq assignment

We are trying to get everyone using an Epicor handheld to process physical moves by scanning the Material Queue Sequence ID (MtlQueue.MtlQueueSeq).

The problem is that if an Operation has “Request Move” checked but the operation itself is split up into multiple labors, it dumps the move requests to the queue onto the same row. It does a RowMod update and stacks it into a pool. It then sits there to Process, at which time it is physically deleted from that table. Subsequent Move Requests on the same operation after this are assigned a new MtlQueueSeq. This is troublesome and terrible.

I need every Labor End Activity that occurs with a Request Move to put these on a new row with its own unique MtlQueueSeq.

The reasoning for this is because, for example, if they split up an operation of 30 parts across 3 machines, you end up with 3 palettes of 10 parts, but the queue only shows a single row of 30. If someone goes to move these, they might grab the first set of 10 and leave behind the other two because the label that I have triggering off this action only has a single mtlqueueseq barcode for the lot of them.

But not always, cause if a process move occurs in the middle, you could end up with 2 with one seqId, and 1 with a different one for the same Opr. Urgh!

I’m open to any and all solutions.

My thought was to do an In-Transaction BPM to convert “Update” rowmods into “Add”, and somehow assign a unique ID, but this results in manipulating the temp table before Update and generating multiple dirty rows. I now there are caveats to this, but I don’t know what they are.

In addition, I don’t want to manually create the Id (since the rows are gone, I can’t anyway) but since Epicor remembers somehow the last value used even if the physical row is gone, I’m hoping there is an auto-assign I can slap into c# code and do this. I need to ensure MtlQueueSeq is unique on every label I print.

I can manipulate the json I’m sending to Bartender later for Quantities and Totals. I’m not concerned about that yet.

I moved forward with my initial plan. However, I’m getting the error “Collection was modified; enumeration operation may not execute” probably because I’m not removing by GUIDs.

Here’s the code:

int maxSeqId = Db.MtlQueue.Max(m => m.MtlQueueSeq);

foreach (var tt in ttMtlQueue) {
    int runSeq = maxSeqId+1;
    
    if (tt.RowMod == "U") {
          //generate a unique ID that doesn't collide
          var newSeq = new Ice.Lib.NextValue(Db).GetNextSequence("MtlQueueSeq");
          Ice.Lib.NextValue.SetSequenceCurrentValue(Db, "MtlQueueSeq", runSeq);
          runSeq += 1;
          
          //difference between prior row and new (because it stacks)
          decimal? qtyOld = ttMtlQueue.Where(t => t.SysRowID == tt.SysRowID && t.RowMod == "").Select(t => t.Quantity).FirstOrDefault();
          decimal qtyDiff = (qtyOld != null) ? tt.Quantity - (decimal)qtyOld : tt.Quantity;
          
          //delete corresponding old row (rowmod blank)
          var itemToRemove = ttMtlQueue.Single(r => r.SysRowID == tt.SysRowID && r.RowMod == "");
          if (itemToRemove != null){
              ttMtlQueue.Remove(itemToRemove);
          }
          
          //assign new values
          int rowIndex = ttMtlQueue.IndexOf(tt);
          ttMtlQueue[rowIndex].MtlQueueSeq = newSeq;
          ttMtlQueue[rowIndex].Quantity = qtyDiff;
          ttMtlQueue[rowIndex].RowMod = "A"; //convert to Add
    }
}

How realistic is it to have the end labor activities on each machine go to a different BIN?

Then each of your move requests would have a different from location and be unique.

Huh, I had not considered that. You are right, the move request could have a diff line for each machine if they dropped into different bins. And the operator could just make sure he’s using the most recent label printed.

Viable. Would still prefer having multiple split labels.

Update: Nevermind. Looks like the move operations drop it into the bin for the next operation, so that wouldn’t work.