Site switch to turn off AMM request move by transaction type

Would like a central place on the site configuration AMM tab to default the Request Move checkboxes either on or off for each of the material movement types.

Agree+++++ The all or nothing approach to MRQ is suuuper annoying

In the mean time to back fill this issue, I built a data directive that will delete the queue items by tran type

Data Directive: MtlQueue->Standard | Remove Select MtlQueue Trans

foreach(var row in ttMtlQueue.Where(x => x.Added() && (x.TranType == "PUR-STK" || x.TranType == "PUR-SUB")))
{
  using (var txscope = IceDataContext.CreateDefaultTransactionScope())
  {
    var dbrow = Db.MtlQueue.With(LockHint.UpdLock).Where(x => x.MtlQueueSeq == row.MtlQueueSeq).FirstOrDefault();  
    Db.MtlQueue.Delete(dbrow);
    Db.Validate();
    txscope.Complete();
  }
}

Note: Buyer beware, I should have used BOs to delete the records, I didn’t care for the extra overhead on table that’s fairly benign and frankly I was being lazy. BO delete would have been the “right way” vs the way I did it. Conscience decision made to direct delete.

1 Like

@jgiese.wci where have you been all my life?

I’ve posted a couple of times for advice/help in producing exactly this BPM! Thank you for sharing, going to be trying this on my system.

1 Like

Works great on PUR-STK - that takes a load of items out of the queue that we never process.

Struggling on the RMA-INS ones though… for whatever reason, even though this is a standard directive the MtlSeqNo is 0??

I added a bit of code to log into the Epicor App Server the rows in the Data Directive:

foreach(var row in ttMtlQueue)
{
    Ice.Diagnostics.Log.WriteEntry("MtlQueue Entry " + row.MtlQueueSeq + " has type = *" + row.TranType + "* and RowMod = *" + 
                                    row.RowMod + "*");
}

image

Any ideas on getting hold of the MtlSeqNo for these tran type?

Anybody have any ideas why the MtlQueueSeq field would be 0 on RMA-INS rows?

Is there no sequence on those items in the mtlqueue?

They do have a sequence once they finally hit the queue - but appearingly not in the Data directive?

Hmm it’s likely generated during intrans can you do an enable standard directive in intrans and grab the queue ID in the standard?

My BPM is on MtlQueue Standard directive already - just double checked. So in standard in should already have an ID right?

Could be that there is more than 1 row, but I thought my code above would put an entry in the appserver log for each row if that were the case?

In standard you sure would think you have it at that point. Weird. And yeah without a filter in your loop it would log anything that passed through there.

So this is a Standard DD that should technically be “POST”… that’s wieird as heck.
Do they have a valid SysRowID? Can you try printing that? That should be unique.

I’m linking the tt to the db record in Standard Dir to delete them in my code example above. I wonder if it’s transaction type of Epicor version specific that you are having this happen? What version of Epicor do you run? I must have a queue sequence for my code to work so very strange.

Db.MtlQueue.With(LockHint.UpdLock)
.Where(x => x.MtlQueueSeq == row.MtlQueueSeq)
.FirstOrDefault();

foreach(var row in ttMtlQueue.Where(x => x.Added() && (x.TranType == "PUR-STK" || x.TranType == "PUR-SUB")))
{
  using (var txscope = IceDataContext.CreateDefaultTransactionScope())
  {
    var dbrow = Db.MtlQueue.With(LockHint.UpdLock).Where(x => x.MtlQueueSeq == row.MtlQueueSeq).FirstOrDefault();  
    Db.MtlQueue.Delete(dbrow);
    Db.Validate();
    txscope.Complete();
  }
}

I have it running for PUR-STK as you do - that works sweet. We don’t have any PUR-SUB, but if I swap that bit out for RMA-INS then it blows up because it can’t find the Queue ID.

Let me try printing the SysRow a moment and see…

1 Like

PUR-STK

MtlQueue Entry *529039* with SysRowID *606fcf8e-93fb-4edb-aaa3-c1b22081934c* has type = *PUR-STK* and RowMod = *A*

RMA-INS

MtlQueue Entry *0* with SysRowID *a62ef89b-af86-4e9b-a759-4f5463baae18* has type = *RMA-INS* and RowMod = *A*

Gets more weird - changed the code to this:

// Firstly, log all rows to appserver log
foreach(var row in ttMtlQueue)
{
    //Ice.Diagnostics.Log.WriteEntry("MtlQueue Entry " + row.MtlQueueSeq + " has type = *" + row.TranType + "* and RowMod = *" + row.RowMod + "*");
    Ice.Diagnostics.Log.WriteEntry("MtlQueue Entry " + row.MtlQueueSeq + " with SysRowID " + row.SysRowID + " has type = *" + row.TranType + "* and RowMod = *" + row.RowMod + "*");
}

//foreach(var row in ttMtlQueue.Where(x => x.Added() && (x.TranType == "PUR-STK" || x.TranType == "RMA-INS")))
foreach(var row in ttMtlQueue.Where(x => x.Added() && x.TranType == "PUR-STK"))
{
  using (var txscope = IceDataContext.CreateDefaultTransactionScope())
  {
    var dbrow = Db.MtlQueue.With(LockHint.UpdLock).Where(x => x.SysRowID == row.SysRowID).FirstOrDefault();  
    Db.MtlQueue.Delete(dbrow);
    Db.Validate();
    txscope.Complete();
  }
}

It is still preventing the PUR-STK rows from being created in the MtlQueue, but the RMA-INS still gets created! So even though the SysRowID exists, the foreach loop isn’t able to find it in the Db.MtlQueue table?

EDIT:

My mistake - forgot to comment out the second foreach loop, and uncomment the one with RMA-INS condition in.

IT WORKS using SysRowID. Thank you guys! :slight_smile: