trying to create code that is running inside a BPM .. created a BAQ that returns the primaryBin from the PlantWhse for a part/warehouse.. (passed back to BOM) to update the jobmlt.bin.. but error (CS0246).. (the Type or namespace name ‘DynamicQueryImpl’ could not be found..
I am no expert in C#..
I did use the reference assemblies
// BAQ ID
string baqID = "test-baq";
// Get parameters from BPM context (ShortChar fields are common)
string partNum = this.callContextBpmData.Character01 ?? string.Empty;
string warehouseCode = this.callContextBpmData.Character02 ?? string.Empty;
// Instantiate the BAQ service
var dqSvc = new DynamicQueryImpl(this.Db);
// Get the BAQ parameters
var paramDS = dqSvc.GetQueryExecutionParametersByID(baqID);
// Set parameter values
foreach (var param in paramDS.ExecutionParameter)
{
if (param.ParameterID == "PartNum")
param.ParameterValue = partNum;
else if (param.ParameterID == "WarehouseCode")
param.ParameterValue = warehouseCode;
}
// Execute the BAQ with parameters
var resultDS = dqSvc.ExecuteByIDWithParams(baqID, paramDS);
// Initialize result variable
string primBin = string.Empty;
// Check if results exist and get value
if (resultDS?.Tables["Results"]?.Rows.Count > 0)
{
var row = resultDS.Tables["Results"].Rows[0];
if (row.Table.Columns.Contains("PrimBin"))
{
primBin = row["PrimBin"].ToString();
}
}
// Store result back to BPM context
this.callContextBpmData.ShortChar03 = primBin;
// BAQ ID
string baqID = "test-baq";
// Get parameters from BPM context (ShortChar fields are common)
string partNum = this.callContextBpmData.Character01 ?? string.Empty;
string warehouseCode = this.callContextBpmData.Character02 ?? string.Empty;
// Instantiate the BAQ service
//var dqSvc = new DynamicQueryImpl(this.Db);
var dqSvc = new Ice.Contracts.BO.DynamicQueryImpl(this.Db);
// Get the BAQ parameters
var paramDS = dqSvc.GetQueryExecutionParametersByID(baqID);
// Set parameter values
foreach (var param in paramDS.ExecutionParameter)
{
if (param.ParameterID == "PartNum")
param.ParameterValue = partNum;
else if (param.ParameterID == "WarehouseCode")
param.ParameterValue = warehouseCode;
}
// Execute the BAQ with parameters
var resultDS = dqSvc.ExecuteByIDWithParams(baqID, paramDS);
// Initialize result variable
string primBin = string.Empty;
// Check if results exist and get value
if (resultDS?.Tables["Results"]?.Rows.Count > 0)
{
var row = resultDS.Tables["Results"].Rows[0];
if (row.Table.Columns.Contains("PrimBin"))
{
primBin = row["PrimBin"].ToString();
}
}
// Store result back to BPM context
this.callContextBpmData.ShortChar03 = primBin;
// BAQ ID
string baqID = "test-baq";
// Get parameters from BPM context (ShortChar fields are common)
string partNum = this.callContextBpmData.Character01 ?? string.Empty;
string warehouseCode = this.callContextBpmData.Character02 ?? string.Empty;
// Instantiate the BAQ service
this.CallService<Ice.Contracts.DynamicQuerySvcContract>(dqSvc=>
{
//var dqSvc = new DynamicQueryImpl(this.Db);
// Get the BAQ parameters
var paramDS = dqSvc.GetQueryExecutionParametersByID(baqID);
// Set parameter values
foreach (var param in paramDS.ExecutionParameter)
{
if (param.ParameterID == "PartNum")
param.ParameterValue = partNum;
else if (param.ParameterID == "WarehouseCode")
param.ParameterValue = warehouseCode;
}
// Execute the BAQ with parameters
var resultDS = dqSvc.ExecuteByID(baqID, paramDS);
// Initialize result variable
string primBin = string.Empty;
// Check if results exist and get value
if (resultDS?.Tables["Results"]?.Rows.Count > 0)
{
var row = resultDS.Tables["Results"].Rows[0];
if (row.Table.Columns.Contains("PrimBin"))
{
primBin = row["PrimBin"].ToString();
}
}
// Store result back to BPM context
this.callContextBpmData.ShortChar03 = primBin;
});
That slowness is because Epicor is calling for one row at a time. You can put a BPM in there to fix it. I can never find the post, but I have the BPM in place. Below are the screenshots. That takes it from minutes to literally seconds.