I am trying to pull inventory information from Epicor via REST API v.1 and using Erp.BO.PartSvc. I have a filter(basically ItemMask) to get a particular set of parts …/api/v1/Erp.BO.PartSvc/Parts?$filter=ItemMask and then for each part I want to get some Warehouse data like QtyOnHand, DemandQty and maybe something else, but those two for sure. So for that, I think I could use …/api/v1/Erp.BO.PartSvc/PartWhses as it has all the necessary fields I need. However, I do not see the way how do I limit returned records by the number of warehouses. I tried to build different filters from the swagger page just to play and see if can get something nice but was not able to achieve what I need.
Example:
I have part A in the warehouses 1,2,3,4 and 5 but I am only interested in Inventory for part A in warehouses 1,3 and 5. Is it possible to achieve this if using /PartWhses entity?
I looked at other BO’s and entities but could not find a suitable one for my needs. Let me know if you need any additional info to be posted/added.
I wanted to eliminate number of requests I need to make as well as using Plant in my case won’t be possible. Let’s say I know only PartNum, Company and a bunch of WarehouseCodes (something like comma separated list of WarehouseCodes). For now I am looking for a way to limit it by embedding list of warehouses into a filter but, I guess it won’t work for multiple warehouses.
I am not sure how to do that kind of BAQ. I have more programming background than Epicor. I can solve this problem by grabbing all the warehouses and then filter them but I do not want to load the whole bunch of not required parts into a memory.
I am so sorry Josh. When I said it did not work for me I meant that I received first 100 parts but not the part I need with only two warehouses. So yes, it works but gives undesired output.
The problem with this approach is that I need to get total number of part records in the system which might take significant amount of time(depends on how many parts you have) in order to use it for pageSize.
I tried your suggestion but that still gave me first 100 parts back
{
"whereClausePartWhseSearch" : "PartNum='TESTPart' and WarehouseCode='TEST' or WarehouseCode='MAIN'",
"pageSize" : 100,
"absolutePage" : 0
}
I guess there is no way to achieve what I want in completely efficient way. BAQ might help but, I am doubting I will go that way.
If you called the BO method like this, if there are more results, morePages would return true. I would wrap this inside a loop and then set the absolutePage +=100 each time morePages returns true. This would essentially page through all the results.
Something like this:
Ice.Core.Session session = new Ice.Core.Session(userID, password, Ice.Core.Session.LicenseType.EnterpriseProcessing, {app's location}.sysconfig);
Erp.Proxy.BO.PartWhseSearchImpl WhseSearch = Ice.Lib.Framework.WCFServiceSupport.CreateImpl<Erp.Proxy.BO.PartWhseSearchImpl>(session, Erp.Proxy.BO.PartWhseSearchImpl.UriPath);
bool morePages;
int absPage = 1;
do
{
var recs = WhseSearch.GetRows("WarehouseCode eq 'Main' or WarehouseCode eq 'Fastenal'", 100, absPage, out morePages);
absPage += 100;
} while (morePages);
All these answers seem complicated to me. Wouldn’t this be a simple single table BAQ on the PartWhse table that you can then set either a fixed filter on the BAQ, or a Parameter if you want to vary the filters from outside of epicor?
Yeah, I know how to loop through all pages I’ve done that through OData as well but again, it will give me parts that I do not need. The main problem here I think is that it should be done through API only and nobody will go for BAQ but, I guess that’s the only way to do it efficiently though. We will see. Thanks all for your awesome help. I will keep BAQ in mind.