Issue updating Inventory Transaction Receipt Multi-Bin Distribution using BOI

SOLVED

When attempting to create line items for a Inventory Transaction Receipt batch I'm having issues when I attempt to update the distribution.  my code was working on Sage 2018 but they are upgrading to Sage 2021 and it now throws an

System.Runtime.InteropServices.COMException (0x80020006): Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))

Here's my code the commented out using line was the old code which also generates the above error.  I'm able to add lines to the batch without any issues it is just when I attempt to update the distributions that there is an issue.  Any help, hints suggestions are greatly appreciated.

IMBoi.AddLine();
//Set data on added line.
IMBoi.Lines.Set_Value("ItemCode", alias);
IMBoi.Lines.Set_Value("TransactionQty", item.item_length);
IMBoi.Lines.Set_Value("UnitCost", price);
IMBoi.Lines.Set_Value("UnitOfMeasure", uom);
IMBoi.Lines.Set_Value("WarehouseCode", setting.DefaultWarehouse);
//using (var tierdist = new BoiObject(new DispatchObject(IMBoi.Lines.InvokeMethod("oTierBinDistribution")), IMBoi.Lines.Name + ".Distribution"))
using (BoiObject tierdist = session.GetBoiObject("IM_TransactionTierDistribution_ui", "I/M", "IM_TransactionTierDistribution_bus"))
{
//add distribution record to line and specify qty
////tierdist.InvokeMethod("nAddDistributionLine", item.unit_id, item.location_name);
//IMBoi.Lines.Distribution.InvokeMethod("nAddDistributionLine", item.unit_id, item.location_name);
//var tierdist = IMBoi.Lines.InvokeMethod("oACS_MultiBin_OBJ");
tierdist.InvokeMethod("nAddDristributionLine", item.unit_id, item.location_name);
tierdist.Set_Value("BinLocatoin", item.unit_id);
tierdist.Set_Value("UDF_Weight", item.item_weight);
tierdist.Set_Value("UDF_Expiration_Date", item.scale_barcode_time.AddYears(1).ToString("yyyyMMdd"));

Parents Reply Children
  • +1 in reply to BigLouie
    verified answer

    Thanks, I caught the Typo and with some help from ScanCo Support I was able to get this working, here's the final working result:

    //Add line to Transaction Entry
    IMBoi.AddLine();
    //Set data on added line.
    IMBoi.Lines.Set_Value("ItemCode", alias);
    IMBoi.Lines.Set_Value("TransactionQty", item.item_length);
    IMBoi.Lines.Set_Value("UnitCost", price);
    IMBoi.Lines.Set_Value("UnitOfMeasure", uom);
    IMBoi.Lines.Set_Value("WarehouseCode", setting.DefaultWarehouse);
    //the call below is referencing the current version of ScanCo MultiBin that is installed
    using (var tierdist = new BoiObject(new DispatchObject(IMBoi.Lines.InvokeMethod("oScancoMultiBin")), IMBoi.Lines.Name + ".Distribution"))
    {
    //add distribution record to line and specify qty
    tierdist.Set_KeyValue("LotSerialNo", item.item_id);
    //Get the line no key that was created above in IMBoi.AddLine()
    var lineKey = IMBoi.Lines.Get_Value("lineKey");
    //Call to add a line to the Multi-Bin Distribution
    tierdist.AddMBDistributionLine(item.item_id, item.location_name, lineKey);
    //item.item_weight is an integer but the client wants it format like the Weight field and needs to be a string for the VendorLotSerialNo
    tierdist.Set_Value("VendorLotSerialNo", String.Format("{0:#,##0.000000}",item.item_weight));
    tierdist.Set_Value("Weight", item.item_weight);
    tierdist.Set_Value("ExpirationDate", item.scale_barcode_time.AddYears(1).ToString("yyyyMMdd"));

    The key was calling oScancoMultiBin and then Setting Key Value for LotSerialNo.