Shipping Packslip via Svc doesn't update/close related Sales Order

Hello,

When I check the “Shipped” checkbox in Customer Shipment entry for a packslip, the ShipHead.ReadyToInvoice will be updated indicating packslip is shipped. This process will also update the OrderRel.ShippingQty on the related Sales Order and Close the Order. After that the “Multi-Company Direct Server Process” will run and I can add the Intercompany Receipt via Receipt Entry in the second company. The problem arises when I replicate the flow of updating the packslip from a Service. In that case the Packslip will be Shipped, but the related Sales Order won’t be affected and the Intercompany receipt wont be visible in the second company. There are no errors in the codes execution

I tried updating and closing the related Sales Order as well, and while this works, the Intercompany receipt is not visible.

The tracelog of the process:

<tracePacket>
  <businessObject>Erp.Proxy.BO.CustShipImpl</businessObject>
  <methodName>GetPkgCodeQtyList</methodName>
  <appServerUri>*******************</appServerUri>
  <returnType>System.Void</returnType>
  <localTime>08.02.2022 16:29:50:4297319 </localTime>
  <threadID>1</threadID>
  <correlationId>a4026b6e-511d-4a41-b01f-8a84a166c019</correlationId>
  <executionTime total="13" roundTrip="11" channel="0" bpm="0" bpmDataForm="0" other="2" />
  <retries>0</retries>
  <parameters>
    <parameter name="ipPackNum" type="System.Int32"><![CDATA[132954]]></parameter>
    <parameter name="opPkgCodeList" type="System.Collections.IList"><![CDATA[]]></parameter>
  </parameters>
</tracePacket>

<tracePacket>
  <businessObject>Erp.Proxy.BO.CustShipImpl</businessObject>
  <methodName>CheckPCBinOutLocation</methodName>
  <appServerUri>*******************</appServerUri>
  <returnType>System.Void</returnType>
  <localTime>08.02.2022 16:29:50:4447367 </localTime>
  <threadID>1</threadID>
  <correlationId>cbfe6afe-b4d9-4c3c-8398-53950bf5be54</correlationId>
  <executionTime total="26" roundTrip="11" channel="0" bpm="0" bpmDataForm="0" other="15" />
  <retries>0</retries>
  <parameters>
    <parameter name="ds" type="Erp.BO.CustShipDataSet">
      <CustShipDataSet xmlns="http://www.epicor.com/Ice/300/BO/CustShip/CustShip" />
    </parameter>
    <parameter name="lineNum" type="System.Int32"><![CDATA[0]]></parameter>
    <parameter name="belongToAnotherPC" type="System.Boolean"><![CDATA[False]]></parameter>
    <parameter name="pcOutsideMessage" type="System.String"><![CDATA[]]></parameter>
  </parameters>
  <paramDataSetChanges>
    <paramDataSet name="ds" useDataSetNbr="0">
      <changedValue tableName="ShipHead" rowState="Modified" rowNum="0" colName="ReadyToInvoice"><![CDATA[True]]></changedValue>
      <changedValue tableName="ShipHead" rowState="Modified" rowNum="0" colName="UD_SysRevID"><![CDATA[System.Byte[]]]></changedValue>
    </paramDataSet>
  </paramDataSetChanges>
</tracePacket>

<tracePacket>
  <businessObject>Erp.Proxy.BO.CustShipImpl</businessObject>
  <methodName>UpdateMaster</methodName>
  <appServerUri>*******************</appServerUri>
  <returnType>System.Void</returnType>
  <localTime>08.02.2022 16:29:50:4747357 </localTime>
  <threadID>1</threadID>
  <correlationId>1b563c4f-232c-40cc-9a18-047041d293d8</correlationId>
  <executionTime total="636" roundTrip="625" channel="0" bpm="0" bpmDataForm="0" other="11" />
  <retries>0</retries>
  <parameters>
    <parameter name="ds" type="Erp.BO.CustShipDataSet">
      <CustShipDataSet xmlns="http://www.epicor.com/Ice/300/BO/CustShip/CustShip" />
    </parameter>
    <parameter name="doValidateCreditHold" type="System.Boolean"><![CDATA[True]]></parameter>
    <parameter name="doCheckShipDtl" type="System.Boolean"><![CDATA[True]]></parameter>
    <parameter name="doLotValidation" type="System.Boolean"><![CDATA[False]]></parameter>
    <parameter name="doCheckOrderComplete" type="System.Boolean"><![CDATA[True]]></parameter>
    <parameter name="doPostUpdate" type="System.Boolean"><![CDATA[True]]></parameter>
    <parameter name="doCheckCompliance" type="System.Boolean"><![CDATA[False]]></parameter>
    <parameter name="ipShippedFlagChanged" type="System.Boolean"><![CDATA[True]]></parameter>
    <parameter name="ipPackNum" type="System.Int32"><![CDATA[132954]]></parameter>
    <parameter name="ipBTCustNum" type="System.Int32"><![CDATA[479]]></parameter>
    <parameter name="opReleaseMessage" type="System.String"><![CDATA[]]></parameter>
    <parameter name="opCompleteMessage" type="System.String"><![CDATA[]]></parameter>
    <parameter name="opShippingMessage" type="System.String"><![CDATA[]]></parameter>
    <parameter name="opLotMessage" type="System.String"><![CDATA[]]></parameter>
    <parameter name="opInventoryMessage" type="System.String"><![CDATA[]]></parameter>
    <parameter name="opLockQtyMessage" type="System.String"><![CDATA[]]></parameter>
    <parameter name="opAllocationMessage" type="System.String"><![CDATA[]]></parameter>
    <parameter name="opPartListNeedsAttr" type="System.String"><![CDATA[]]></parameter>
    <parameter name="opLotListNeedsAttr" type="System.String"><![CDATA[]]></parameter>
    <parameter name="shipCreditMsg" type="System.String"><![CDATA[]]></parameter>
    <parameter name="cError" type="System.Boolean"><![CDATA[False]]></parameter>
    <parameter name="compError" type="System.Boolean"><![CDATA[False]]></parameter>
    <parameter name="msg" type="System.String"><![CDATA[]]></parameter>
    <parameter name="opPostUpdMessage" type="System.String"><![CDATA[]]></parameter>
    <parameter name="updateComplete" type="System.Boolean"><![CDATA[False]]></parameter>
    <parameter name="checkComplianceError" type="System.Boolean"><![CDATA[False]]></parameter>
    <parameter name="changeStatusError" type="System.Boolean"><![CDATA[False]]></parameter>
    <parameter name="checkShipDtlAgain" type="System.Boolean"><![CDATA[False]]></parameter>
  </parameters>
  <paramDataSetChanges>
    <paramDataSet name="ds" useDataSetNbr="0">
      <changedValue tableName="ShipHead" rowState="Modified" rowNum="0" colName="ReadyToInvoice"><![CDATA[True]]></changedValue>
      <changedValue tableName="ShipHead" rowState="Modified" rowNum="0" colName="RowMod"><![CDATA[U]]></changedValue>
      <changedValue tableName="ShipHead" rowState="Modified" rowNum="0" colName="UD_SysRevID"><![CDATA[System.Byte[]]]></changedValue>
    </paramDataSet>
  </paramDataSetChanges>
</tracePacket>

<tracePacket>
  <businessObject>Erp.Proxy.BO.CustShipImpl</businessObject>
  <methodName>BuildShipToList</methodName>
  <appServerUri>*******************</appServerUri>
  <returnType>System.Void</returnType>
  <localTime>08.02.2022 16:29:51:1729466 </localTime>
  <threadID>1</threadID>
  <correlationId>22a54b52-fd45-4b48-98c3-0e5525d0967d</correlationId>
  <executionTime total="36" roundTrip="35" channel="0" bpm="0" bpmDataForm="0" other="1" />
  <retries>0</retries>
  <parameters>
    <parameter name="orderNum" type="System.Int32"><![CDATA[121708]]></parameter>
    <parameter name="iShipToCustNum" type="System.Int32"><![CDATA[479]]></parameter>
    <parameter name="shipToList" type="System.String"><![CDATA[]]></parameter>
  </parameters>
</tracePacket>

<tracePacket>
  <businessObject>Erp.Proxy.BO.CustShipImpl</businessObject>
  <methodName>BuildShipToList</methodName>
  <appServerUri>*******************</appServerUri>
  <returnType>System.Void</returnType>
  <localTime>08.02.2022 16:29:51:3919621 </localTime>
  <threadID>1</threadID>
  <correlationId>daf092ec-a7bc-4767-97c3-1e56f599b69b</correlationId>
  <executionTime total="40" roundTrip="38" channel="0" bpm="0" bpmDataForm="0" other="2" />
  <retries>0</retries>
  <parameters>
    <parameter name="orderNum" type="System.Int32"><![CDATA[121708]]></parameter>
    <parameter name="iShipToCustNum" type="System.Int32"><![CDATA[479]]></parameter>
    <parameter name="shipToList" type="System.String"><![CDATA[]]></parameter>
  </parameters>
</tracePacket>

<tracePacket>
  <businessObject>Erp.Proxy.BO.CustShipImpl</businessObject>
  <methodName>GetByID</methodName>
  <appServerUri>*******************</appServerUri>
  <returnType>Erp.Tablesets.CustShipTableset</returnType>
  <localTime>08.02.2022 16:29:51:4349665 </localTime>
  <threadID>1</threadID>
  <correlationId>ccb522f4-a61b-4887-b38d-9ff4a518a3d1</correlationId>
  <executionTime total="50" roundTrip="46" channel="0" bpm="0" bpmDataForm="0" other="4" />
  <retries>0</retries>
  <parameters>
    <parameter name="packNum" type="System.Int32"><![CDATA[132954]]></parameter>
  </parameters>
</tracePacket>

and my code

using(var custShipSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.CustShipSvcContract>(Db))
{

    string[] stringForUpdatemaster = new string[12];
    bool[] outForUpdateMater = new bool[6];

    custShipTS = custShipSvc.GetByID(tempNum);

    custShipSvc.BuildShipToCustomerList(tempOrderNum.OrderNum, out creditMsg);

    custShipSvc.BuildShipToList(tempOrderNum.OrderNum, tempOrderNum.ShipToCustNum,out shipToList);
    System.Collections.IList codeList;
    custShipSvc.GetPkgCodeQtyList(shipHeadRow.PackNum, out codeList);


    var biTTShipHead3 = BufferCopy.Copy<Erp.Tablesets.ShipHeadRow>(custShipTS.ShipHead[0]);
    biTTShipHead3.RowMod = "";
    custShipTS.ShipHead.Add(biTTShipHead3);


    custShipTS.ShipHead.FirstOrDefault().ReadyToInvoice = true;
    custShipTS.ShipHead.FirstOrDefault().RowMod = "U";

    custShipSvc.CheckPCBinOutLocation(ref custShipTS, out lineNum, out belongtoAnother, out pcOutsideMessage);


    custShipSvc.UpdateMaster(ref custShipTS,false,false,false,false,false,false,false, custShipTS.ShipHead.FirstOrDefault().PackNum, tempOrderNum.BTCustNum,  out stringForUpdatemaster[0], out stringForUpdatemaster[1], out stringForUpdatemaster[2], out stringForUpdatemaster[3], out stringForUpdatemaster[4], out stringForUpdatemaster[5], out stringForUpdatemaster[6], out stringForUpdatemaster[7], out stringForUpdatemaster[8], out stringForUpdatemaster[9], out outForUpdateMater[0], out outForUpdateMater[1],out stringForUpdatemaster[10], out stringForUpdatemaster[11],out outForUpdateMater[2],out outForUpdateMater[3],out outForUpdateMater[4],out outForUpdateMater[5]);

    custShipSvc.BuildShipToList(tempOrderNum.OrderNum, tempOrderNum.ShipToCustNum,out shipToList);
}

Note: This is not the full code, this is the part that doesn’t work. All the variable parameters passed in the methods are valid.

Thanks for the help in advance!

Here is what I use to ship a pack. I never got the UpdateMaster or UpdateExt to work for this, only the Update:

      // set shipped=true
      Erp.Tablesets.ShipHeadRow shrow = BufferCopy.Copy<Erp.Tablesets.ShipHeadRow>(tsCustShip.ShipHead[0]);
      shrow.RowMod = "U";
      shrow.ReadyToInvoice = true;
      tsCustShip.ShipHead.Add(shrow);
      // save pack
      csc.Update(ref tsCustShip);    

Hello, thanks for the response, I tried it and I’m getting the same result. The pack is set to shipped, but the related Sales Order is still open and a Intercompany receipt is not created.

Are you creating the pack from scratch using the service or is the pack already created in Epicor and the service just ships it ?

I’m creating it from scratch.

The first thing I would try is to add the pack in Epicor, leave the shipped unchecked and then use the service to ship it. Then, for adding the pack, that is not very straight forward I’m afraid. There are a lot of topics in this forum, @hkeric.wci has some very interesting posts you may want to check. A good starting point is this: you should never have more that one record in your custShipTS.ShipDtl when adding the pack lines. Serial numbers are tricky and sales kits are a nightmare! I have to say trying to ship SOs with sales kits was a real challenge for us and took forever to figure out.

Thanks for he response, I’ll check it out. I want to mention that I have tested the creation of the Customer Shipment Record and that goes without a problem. If I do everything until I ship it from a service, and I ship it manually from the Customer Shipment Entry, everything works. I have also compared in the database the ShipHead and ShipDtl of a manually created packslip and one created with a Svc, and they are exactly the same. I thought that there might be some functionality being run after shipping the packslip, that is not visible in the tracelog, so I decompiled the Erp.Services.BO.CustShip.dll and I still couldn’t find anything.