Retrieving the PartUOM.UOMConversion in a User Defined Method

I am attempting to retrieve the PartUOM Conversion method using a Configurator User Defined Method. I can’t seem to locate an assembly that will return the value.

I need to retrieve the specific unit of measure conversion based on the part number and UOMCode.

I have tried a number of assemblies includeing:
Erp.Contracts.BO.Part.dll
Erp.Services.BO.Part.dll

I keep getting errors that indicate Part does not contain a definition for UOMCode and no extension method UOMCode accepting a first argument of type Part could be found.

Here is my code

var Part = (from row in Db.Part
where row.PartNum == PartNum && row.UOMCode == “LB”
select row).FirstOrDefault();
If (Part != null)
{
return (PartUOM.ConvFactor);
}
else
{
return 0;
}

Does this part use Part specific UOMs, or Class based?

Class based

You’re retrieving a Part record. You need to retrieve the UOM for that part.

And a Part (that’s using UOM Class), can have a deafult UOM which might not be the default for the Class.

For Example: UOMClass LENGTH has the following UOM’s and conversions

  • FT(the default), 1 FT = 1 FT (conversion is 1.0)
  • IN, 12 IN = 1FT (conversion is 12.0)
  • YD, 1 YD = 3 FT (conversion is 0.33333)

(I might have the conversions inverted)

You want the conversion from class’s base to the one specified in the part master?

There is the problem. I have not been able to find a way to query the partuom table, which is where the data is located. I can do this using a BAQ, but that is only available to me with a dynamic list. I was hoping to have a UD Method that would look up the data and populate another field without the user having to click on a combo box just to activate the baq and return the one value I am looking for.

Thats not going to work if you are getting only Part from Db.Part - you have to either join Part on Db.PartUOM or do another Query on Db.PartUOM. LINQ 101 stuff. Unless I am just seeing a portion of the entire code.

Are you trying to convert from 1 UOM to another?

1 Like

Since this topic contains the product-configurator tag (and the fact that you’re trying to do this in a UD Method), you must be trying to retrieve the UOM conversion for a specific part being added to (or kept in) the MOM.

Is your PC (Prod Confiurator) the Super-BOM or Template style? If the Super-BOM, then why do you need to find the conversion? If the Template style and you’re changing the PartNum of a place holder, then just let the substituted part’s UOM take over. Or set the UOM to the desired one of that class.

I dont know much about Configurator, but I can atleast say In a BPM You could prob use Epicor’s Shared Helper Method, Epicor itself uses throughout many BOs.

// Assembly to Reference in BPM
Erp.Internal.Lib.AppService

// Example Code prob must first instantiate a new AppService by passing in Db
AppService libAppService =  new Erp.Internal.Lib.AppService(Db);
libAppService.UOMConv(bJobAsmbl.PartNum, dOutstandingQty, bJobAsmbl.IUM, InvtyUOM, out dOutstandingQty, true);

// Signature FYI the converted uom will go into your out decimal variable
AppService.UOMConv(string PartNum, decimal QtyIn, string fromuom, string touom, out decimal QtyOut, bool SuppressErrors = true);

That helper method will make sure your UOM is converted to your out variable properly, by going through the entire UOM Logic… Part Specific, Price Lists are checked etc…

Worst case you can use the CustShip BO on the Client which has a UOMConv Helper method you could hijack. Which in the end calls the AppService UOMConv Method. #CircleOfLife

You can download the BO Ref .chm guide from Dropbox - 10.2.300_CHM - Simplify your life

Gotta run, to an appointment, good luck guys! :slight_smile:

2 Likes

Sorry to not be responsive…just distracted. All of this is related to the product configurator.
The business need is user needs to enter a type of material, and thickness of materia. This is used to retrieve a valid part number. That part number has a unit of measure class and the part record has the IUM, SUM and PUM codes as expected. However, we need to obtain the weight per square foot for the part, which is contained in a unit of measure code that is within the class and stored in the partuom dataset. When trying to create a user defined method within the confines of the product configurator, there is no reference to the partuom, only the part.
The only work around I have been able to use so far is to add another field, which is a dynamic list, which retrieves what we need by executing a BAQ to retrieve it. Not very elegant as the user needs to always click the down arrow just to retrieve the one result we are looking for.