ReceiptEntry - How do I default in the Whse and Bin to Match Primary

In receipt Entry I would like to default in the Warehouse and Bin to match the Primary bin set on the Part - if the Part does not exists then use Defaults.

If I create a BPM to Invoke BO Method - Erp.Receipt.SetToLocation:
If the Part exists and NonStock = False - I get the desired behavior
If the Part exists and NonStock = True - the Warehouse and Bin fields are blank
If the Part does not exist - the Warehouse and Bin fields are blank

If I write a BPM:

//Epicor.Customization.Bpm.InfoMessage.Publish("Start");

foreach(var ttRcvDtl_xRow in (from ttRcvDtl_Row in ttRcvDtl
                                where ttRcvDtl_Row.Added()
                                select ttRcvDtl_Row).ToList())
{
  var Part_xRow = (from Part_Row in Db.Part where Part_Row.Company == ttRcvDtl_xRow.Company && Part_Row.PartNum == ttRcvDtl_xRow.PartNum
                   select Part_Row).FirstOrDefault();
  if (Part_xRow != null)
  {
    //Epicor.Customization.Bpm.InfoMessage.Publish("Found Part");  
    if ((bool)Part_xRow["NonStock"] == true);
    {
      //Epicor.Customization.Bpm.InfoMessage.Publish("Part NonStock");        
      ttRcvDtl_xRow["SetToLocation"] = true;
    }
  }
}

If the Part exists and NonStock = False - I get the Default Warehouse and Default Bin (user has to Click To Location)
If the Part exists and NonStock = True - I get the Default Warehouse and Default Bin
If the Part does not exist - I get the Default Warehouse and Default Bin

If I do not attempt to Customise:
If the Part exists and NonStock = False - I get the Default Warehouse and Default Bin
If the Part exists and NonStock = True - I get the Default Warehouse and Default Bin
If the Part does not exist - I get the Default Warehouse and Default Bin

@rppmorris
In the Method directives, create this bpm it should work fine.

As per the standard functionality, if there no primary warehouse and bin then it will pick the details from the default receiving warehouse set in the site configuration.

Erp.Receipt.GetDtlPOLineInfo
Pre-processing

@prash172

I have tried Bpm already - it works if the Part is NonStock = False.
If the Part is NonStock = True - the warehouse and bin fields are blank:
image

@rppmorris
Kindly cross check the site maintenance, does the receiving warehouse is setup ?
If the answer is yes for the above question, then in the bpm put the condition non-stock = false.

@prash172

image
The Non-Stock is not available as a field to add through the Widgets - so I tried to perform the action by firstly invoking the method then by coding - neither works.

@rppmorris
Below is the condition which I have tested with.
I have both the stock and non-stock parts in the part master. Same set with primary warehouse and bin. Its working fine. If the part is on-the fly then it will default the warehouse set in the site.


Sorry for the step back. Is there a reason you aren’t using Mass Receipt:Set to all Locations?

@rppmorris - I get your desired action with no customization or BPM required.

Part ZZ-5000 Qty Bearing = Y Non-Stock = N, Prim Bin = A0101
Part ZZ-5001 Qty Bearing = Y Non-Stock = Y, Prim Bin = A0101
Part ZZ-5002 Qty Bearing = Y Non-Stock = N, Prim Bin = <blank>
Part ZZ-5003 Qty Bearing = Y Non-Stock = Y, Prim Bin = <blank>

The Site’s default Warehouse and bin are setup to use bin deflt

Made a PO for the above 4 parts.

During Receipt, the To Bin field is automatically set as follows:
ZZ-5000 - A0101
ZZ-5001 - A0101
ZZ-5002 - <blank>
ZZ-5003 - <blank>

So it is using the value in Part master regardless of the Non-Stock setting.

Or are you saying that you want a blank Primary Bin value on the Part to be overridden with the Sites default warehouse and bin? Like an OTF part does?

If you do want to overried a blank Primary bin with the Plant’s default Rcv Bin, use a Post-Proc on Receipt.GetDtlPOLinesInfo

image

The condition just checks if the Bin Num is blank.

The Set Field widget is:

image

with the expression:

Db.PlantConfCtrl
  .Where( r =>r.Company == callContextClient.CurrentCompany
     && r.DefRcvWhse == ttRcvDtlRow.WareHouseCode)
  .Select( r =>r.DefRcvBin)
  .DefaultIfEmpty("")
  .FirstOrDefault()