BPM code to issue to job materials from material queue

,

Hello

I am creating a BPM to issue all materials from a material queue to a job, instead of doing it manually line by line. Below is my code, where I want to go through all lines of the material queue for a specific job and issue the materials.

var mtlQueue = (from q in Db.MtlQueue
  where q.SelectedByEmpID == EmpID && q.JobNum == JobNum
  select q).ToList();
  
  
  foreach(var seq in mtlQueue)
    {
    Erp.Contracts.IssueReturnSvcContract hIssueReturn = null;
    hIssueReturn = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.IssueReturnSvcContract>(Db);
    if (hIssueReturn != null)
      {
        Erp.BO.IssueReturnDataSet issueReturnDataSet = new Erp.BO.IssueReturnDataSet();
        hIssueReturn.GetNewIssueReturn("STK-MTL",seq.SysRowID,"IssueMaterial",ref issueReturnDataSet);
(...)
          }
        }

I get the following error message on the last line:

System.Drawing.Bitmap CS1503 Argument 4: cannot convert from ‘ref Erp.BO.IssueReturnDataSet’ to ‘ref Erp.Tablesets.IssueReturnTableset’

The error message seems straight forward. However, I don’t manage to make it work. Also, I don’t understand why the last parameter should be an Erp.Tablesets.IssueReturnTableset, when the method tracker shows that the fourth parameter should be an Erp.BO.IssueReturnDataSet. See below what I get from the method tracker.

<tracePacket>
  <businessObject>Erp.Proxy.BO.IssueReturnImpl</businessObject>
  <methodName>GetNewIssueReturn</methodName>
  <appServerUri>net.tcp:/xxx/EpicorERPPilot/</appServerUri>
  <returnType>System.Void</returnType>
  <localTime>23/10/2019 09:35:10:8811951 AM</localTime>
  <threadID>1</threadID>
  <executionTime total="48" roundTrip="39" channel="0" bpm="1" other="8" />
  <retries>0</retries>
  <parameters>
    <parameter name="pcTranType" type="System.String"><![CDATA[STK-MTL]]></parameter>
    <parameter name="pcMtlQueueRowID" type="System.Guid"><![CDATA[581f5012-502a-4c3b-8e58-9630be2644d7]]></parameter>
    <parameter name="pCallProcess" type="System.String"><![CDATA[IssueMaterial]]></parameter>
    <parameter name="ds" type="Erp.BO.IssueReturnDataSet">
      <IssueReturnDataSet xmlns="http://www.epicor.com/Ice/300/BO/IssueReturn/IssueReturn" />
    </parameter>
  </parameters>
</tracePacket>

Can someone help?

Thanks in advance!

Hi Fabien, curious, did you ever solve this? I am also looking for a way to auto-issue materials to a job prior to the finished good being received into inventory. Just starting to do some poking around and came across this old unanswered thread. Thanks!