Material request queue - auto complete transaction

We have this code written by a consultant for us a while ago which @hmwillett helped fix for our kinetic uplift.

Is it possible to auto complete the move when the actionID = ProcessIn?

string requestType = "MI";
string warehousesList = string.Empty;
string defaultBinNum = "PUTAWAY";

List<string> binIssues = new List<string>();

foreach (var toProcess in queryResultDataset.Results.Where(r => r.Calculated_Select && r.RowMod == "U"))
{
  var tsMoveRequest = new MoveRequestTableset();

  using (var hMoveRequest =  ServiceRenderer.GetService<MoveRequestSvcContract>(Db))
  {
    decimal pdRequestQty = actionID == "ProcessIn" ? String.IsNullOrEmpty(toProcess.PartBin_LotNum) ? callContextBpmData.Number01 : toProcess.PartBin_OnhandQty : toProcess.PartBin_OnhandQty;
    
    string toWhse = actionID == "ProcessIn" ? callContextBpmData.ShortChar01 : toProcess.PartPlant_PrimWhse;
    string toBin = actionID == "ProcessIn" ? callContextBpmData.ShortChar02 : toProcess.PlantWhse_PrimBin;
    
    if (String.IsNullOrEmpty(toBin))
    {
      bool defaultBinExists = Db.WhseBin.Where(r => r.Company == toProcess.PartBin_Company && r.WarehouseCode == toWhse && r.BinNum == defaultBinNum).Any();
      
      if (!defaultBinExists)
      {
        binIssues.Add($"PartNum = {toProcess.PartBin_PartNum}, LotNum = {toProcess.PartBin_LotNum}");
        
        continue;
      }
      
      toBin = defaultBinNum;
      
    }
    
    if (toProcess.PartBin_WarehouseCode == toWhse && toProcess.PartBin_BinNum == toBin) continue;
  
    hMoveRequest.GetNewMoveRequest(requestType, ref tsMoveRequest);
    
    hMoveRequest.OnChangePartNum(toProcess.PartBin_PartNum, ref tsMoveRequest, out warehousesList);
   
    hMoveRequest.OnChangeRequestQty(pdRequestQty, ref tsMoveRequest);
    
    hMoveRequest.OnChangeFromWhse(toProcess.PartBin_WarehouseCode, ref tsMoveRequest);
    
    hMoveRequest.OnChangeFromBin(toProcess.PartBin_BinNum, ref tsMoveRequest);
    
    hMoveRequest.OnChangeToWhse(toWhse, ref tsMoveRequest);
    
    //if (String.IsNullOrEmpty(toBin)) ;
    
    hMoveRequest.OnChangeToBin(toBin, ref tsMoveRequest);
    
    if (!String.IsNullOrEmpty(toProcess.PartBin_LotNum)) hMoveRequest.OnChangeLot(toProcess.PartBin_LotNum, ref tsMoveRequest);
    
    tsMoveRequest.MoveRequest.FirstOrDefault().EmpId = toProcess.Calculated_Employee;
    
    hMoveRequest.ProcessRequest(ref tsMoveRequest);
  
  }
}

if (binIssues.Any())
{
  PublishInfoMessage($"The following records have failed processing because there is no default bin against the part and the Bin {defaultBinNum} does not exist in the part's default warehouse.{Environment.NewLine}{Environment.NewLine}{String.Join(Environment.NewLine, binIssues)}",Ice.Common.BusinessObjectMessageType.Warning, Ice.Bpm.InfoMessageDisplayMode.Individual, "LineSequencing", "Process" );
}

PublishInfoMessage($"Processing completed",Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "LineSequencing", "Process" );

Can you provide some more context, as there are various settings that impact Material Queue entries - for most of my clients, unless they are using HH/EMWW we don’t create any queue transactions…is this what you are trying to do?

Hi Sue,

this code creates a material request queue to move material to our production line, however we found the method to bring materials to the line not very efficient using EMW but works excellent for putting them away.

so when the code cycles the ‘ProcessIn’ command it already has been populated with all the info it needs to move the material to the correct location, we simply want the system to move the material to the correct location automatically without needing to go into the material queue or using EMW.

i hope this explains things better.

Hi
Within Resource Groups/Resources, set the Auto-Move checkbox and the appropriate warehouses/bins for input and output then you won’t get Material Queue transactions

will this work only for in warehouses though? i dont want automove to happen for outward, plus the material wont go to the same location as we have various bins for each steel coil