Material Tags and Passing Data

I see. Wow, there is much more involved to this than I realized. I’m on 10.2.200.13 so there could be some differences. Thank you, I will look in to that.

Tanesh, I am not sure if I am in the proper place to see what the Material Tags form is expecting, because the dataView looks entirely different than the one you have used. I could not find ReceiptRcvDtl, but did see ReportParam with what appears like the rows with the same names. Is this where I want to be and what I need to go by?

In my experience, this isn’t information that’s exposed through Epicor’s customization screen. You’ll need to use a trace or decompile the assemblies that contain the code for the base forms.

EDIT: 10.2 may do things differently and this could very well be what you’re looking for. But I’m not so sure about the order in there - it looks alpha sorted.

EDIT 2: 10.1 has that EpiDataView too and it’s definitely not what data needs to be sent/received

Okay. I am not quite sure how to go about decompiling the assemblies, but I do know how to run a trace, so I’ll give that a shot. Thank you.

I did manage to located the following MtlTagsParam in the trace log. The rows seem to parallel what was in the object explorer only in a different order. Should I modify the BuildMtlTagParams() to mirror the rows in the trace log and in the order found in the trace log?

<MtlTagsParam>
          <TagFormat></TagFormat>
          <TotalQty>0</TotalQty>
          <QtyPer>0</QtyPer>
          <PartNum></PartNum>
          <Revision></Revision>
          <PartDesc></PartDesc>
          <UnitOfMeasure></UnitOfMeasure>
          <JobNum></JobNum>
          <AssemblySeq>0</AssemblySeq>
          <OprSeq>0</OprSeq>
          <PONum>0</PONum>
          <POLine>0</POLine>
          <PORel>0</PORel>
          <VendorNum>0</VendorNum>
          <PurPoint></PurPoint>
          <RefJob></RefJob>
          <RefAssemblySeq>0</RefAssemblySeq>
          <RefMtlSeq>0</RefMtlSeq>
          <NonConfTranID>0</NonConfTranID>
          <ReasonCode></ReasonCode>
          <ReasonType></ReasonType>
          <Comment></Comment>
          <WarehouseCode></WarehouseCode>
          <BinNum></BinNum>
          <LotNum></LotNum>
          <ItemTags></ItemTags>
          <JobSeqType></JobSeqType>
          <BarCodes>true</BarCodes>
          <LegalNumber></LegalNumber>
          <DMRNum>0</DMRNum>
          <SysRowID>00000000-0000-0000-0000-000000000000</SysRowID>
          <AutoAction></AutoAction>
          <PrinterName></PrinterName>
          <AgentSchedNum>0</AgentSchedNum>
          <AgentID></AgentID>
          <AgentTaskNum>0</AgentTaskNum>
          <RecurringTask>false</RecurringTask>
          <RptPageSettings></RptPageSettings>
          <RptPrinterSettings></RptPrinterSettings>
          <RptVersion></RptVersion>
          <ReportStyleNum>1003</ReportStyleNum>
          <WorkstationID></WorkstationID>
          <TaskNote></TaskNote>
          <ArchiveCode>0</ArchiveCode>
          <DateFormat></DateFormat>
          <NumericFormat></NumericFormat>
          <AgentCompareString></AgentCompareString>
          <ProcessID></ProcessID>
          <ProcessCompany></ProcessCompany>
          <ProcessSystemCode></ProcessSystemCode>
          <ProcessTaskNum>0</ProcessTaskNum>
          <DecimalsGeneral>0</DecimalsGeneral>
          <DecimalsCost>0</DecimalsCost>
          <DecimalsPrice>0</DecimalsPrice>
          <GlbDecimalsGeneral>0</GlbDecimalsGeneral>
          <GlbDecimalsCost>0</GlbDecimalsCost>
          <GlbDecimalsPrice>0</GlbDecimalsPrice>
          <FaxSubject></FaxSubject>
          <FaxTo></FaxTo>
          <FaxNumber></FaxNumber>
          <EMailTo></EMailTo>
          <EMailCC></EMailCC>
          <EMailBCC></EMailBCC>
          <EMailBody></EMailBody>
          <AttachmentType></AttachmentType>
          <ReportCurrencyCode></ReportCurrencyCode>
          <ReportCultureCode></ReportCultureCode>
          <SSRSRenderFormat></SSRSRenderFormat>
          <UIXml></UIXml>
          <PrintReportParameters>false</PrintReportParameters>
          <SSRSEnableRouting>false</SSRSEnableRouting>
          <RowMod>A</RowMod>
        </MtlTagsParam>

Also, in the trace log I found rows for the ItemTags dataset which I also saw in the Object Explorer. Do I need to reference this as well in the script?

image

<ItemTagsDataSet xmlns="http://www.epicor.com/Ice/300/Rpt/MtlTags/ItemTags">
        <ItemTags>
          <ItemQty>5.00000000</ItemQty>
          <ItemTags>1</ItemTags>
          <ItemUOM>EA</ItemUOM>
          <SysRowID>00000000-0000-0000-0000-000000000000</SysRowID>
          <RowMod></RowMod>
        </ItemTags>
      </ItemTagsDataSet>

I don’t think those parameters are right - looks like way too many. I think your best option is to decompile the assemblies.

That is something I am unfamiliar with. It looks like I may have met a dead end. Might you know of any references for decompiling the assemblies?

dotPeek is my go-to.

You probably wanna take a look at Erp.UIRpt.MtlTags to see what’s being expected, or Erp.UI.ReceiptEntry to see what’s being sent.

Tanesh, I have managed to decompile the Erp.UIRpt.MtlTags.dll and found the following two components. The first one is setIncomingParams and the second one is setIncomingParamsFromReceiptEntry. I’m not sure which one would be the one I need. Might you by chance?

  1. setIncomingParams
internal void setIncomingParams(string partNum, string partDesc, decimal tranQty, string TagFormat, string UnitOfMeasure, string VendorNum, string PONum, string POLine, string PORel, string WarehouseCode, string BinNum)
{
base.ReportParmsView.dataView[base.ReportParmsView.Row].Row.BeginEdit();
base.ReportParmsView.dataView[base.ReportParmsView.Row]["PartNum"] = partNum;
base.ReportParmsView.dataView[base.ReportParmsView.Row]["PartDesc"] = partDesc;
base.ReportParmsView.dataView[base.ReportParmsView.Row]["TotalQty"] = tranQty;
base.ReportParmsView.dataView[base.ReportParmsView.Row]["UnitOfMeasure"] = UnitOfMeasure;
base.ReportParmsView.dataView[base.ReportParmsView.Row]["QtyPer"] = tranQty;
base.ReportParmsView.dataView[base.ReportParmsView.Row]["TagFormat"] = TagFormat;
base.ReportParmsView.dataView[base.ReportParmsView.Row]["VendorNum"] = VendorNum;
base.ReportParmsView.dataView[base.ReportParmsView.Row]["PONum"] = PONum;
base.ReportParmsView.dataView[base.ReportParmsView.Row]["POLine"] = POLine;
base.ReportParmsView.dataView[base.ReportParmsView.Row]["PORel"] = PORel;
base.ReportParmsView.dataView[base.ReportParmsView.Row]["WarehouseCode"] = WarehouseCode;
base.ReportParmsView.dataView[base.ReportParmsView.Row]["BinNum"] = BinNum;
base.ReportParmsView.dataView[base.ReportParmsView.Row].Row.EndEdit();
base.NotifyAll(EpiTransaction.NotifyType.Initialize, base.ReportParmsView);
}
  1. setIncomingParamsFromReceiptEntry
internal void setIncomingParamsFromReceiptEntry(string[] parameters)
{
    base.ReportParmsView.dataView[base.ReportParmsView.Row].Row.BeginEdit();
    if (!string.IsNullOrEmpty(parameters[0]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["PartNum"] = parameters[0];
    }
    if (!string.IsNullOrEmpty(parameters[1]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["PartDesc"] = parameters[1];
    }
    if (!string.IsNullOrEmpty(parameters[6]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["UnitOfMeasure"] = parameters[6];
    }
    if (!string.IsNullOrEmpty(parameters[2]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["TotalQty"] = Convert.ToDecimal(parameters[2]);
    }
    if (!string.IsNullOrEmpty(parameters[3]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["QtyPer"] = Convert.ToDecimal(parameters[3]);
    }
    if (!string.IsNullOrEmpty(parameters[4]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["TagFormat"] = parameters[4];
    }
    if (!string.IsNullOrEmpty(parameters[5]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["Revision"] = parameters[5];
    }
    if (!string.IsNullOrEmpty(parameters[7]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["JobNum"] = parameters[7];
    }
    if (!string.IsNullOrEmpty(parameters[6]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["RefJob"] = parameters[7];
    }
    if (!string.IsNullOrEmpty(parameters[8]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["AssemblySeq"] = Convert.ToInt32(parameters[8]);
    }
    if (!string.IsNullOrEmpty(parameters[7]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["RefAssemblySeq"] = Convert.ToInt32(parameters[8]);
    }
    if (!string.IsNullOrEmpty(parameters[9]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["OprSeq"] = Convert.ToInt32(parameters[9]);
    }
    if (!string.IsNullOrEmpty(parameters[14]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["RefMtlSeq"] = Convert.ToInt32(parameters[9]);
    }
    if (!string.IsNullOrEmpty(parameters[10]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["PONum"] = Convert.ToInt32(parameters[10]);
    }
    if (!string.IsNullOrEmpty(parameters[11]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["POLine"] = Convert.ToInt32(parameters[11]);
    }
    if (!string.IsNullOrEmpty(parameters[12]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["PORel"] = Convert.ToInt32(parameters[12]);
    }
    if (!string.IsNullOrEmpty(parameters[13]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["VendorNum"] = Convert.ToInt32(parameters[13]);
    }
    if (!string.IsNullOrEmpty(parameters[14]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["PurPoint"] = parameters[14];
    }
    if (!string.IsNullOrEmpty(parameters[15]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["ReasonCode"] = parameters[15];
    }
    if (!string.IsNullOrEmpty(parameters[0x10]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["WarehouseCode"] = parameters[0x10];
    }
    if (!string.IsNullOrEmpty(parameters[0x11]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["BinNum"] = parameters[0x11];
    }
    if (!string.IsNullOrEmpty(parameters[0x12]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["LotNum"] = parameters[0x12];
    }
    if (!string.IsNullOrEmpty(parameters[0x13]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["LegalNumber"] = parameters[0x13];
    }
    if (!string.IsNullOrEmpty(parameters[20]))
    {
        base.ReportParmsView.dataView[base.ReportParmsView.Row]["JobSeqType"] = parameters[20];
    }
    base.ReportParmsView.dataView[base.ReportParmsView.Row].Row.EndEdit();
    base.NotifyAll(EpiTransaction.NotifyType.Initialize, base.ReportParmsView);
}
1 Like

My guess would be the latter. I think the material tags report can be generated by multiple screens, so the parameters probably differ for each.

The random hex indexes in the middle are so weird though. I really hope that’s a decompiler issue and not the way Epicor designed it :rofl:

Okay, I have my values correct when passing from Receipt Entry form to Mtl Tags form. I am no longer receiving Index was outside the bounds of the array.

However, I am now receiving a compile error in the MtlTags form. ’ ‘Script’ does not contain a definition for ‘callContextBpmDataView’ and no extension method ‘callContextBpmDataView’ accepting a first argument of type ‘Script’ could be found’.

Frustrated, yet I feel like I am getting close. :confounded:

	private void MtlTagsForm_Load(object sender, EventArgs args)
	{
		// Add Event Handler Code
			EpiDataView callContextBpmDataView = oTrans.Factory("CallContextBpmData");
			if (this.MtlTagsForm.LaunchFormOptions != null)
			{
				this.callContextBpmDataView.dataview[this.callContextBpmDataView.Row]["Character01"] = this.MtlTagsForm.LaunchFormOptions.ContextValue.ToString();
			}
	}

I’m stumped. Might be a missing reference.

Maybe try initializing callContextBpmDataView the other way and see if that helps things.

Do you mean with this one?:

EpiDataView callContextBpmDataView = (EpiDataView) this.oTrans.EpiDataViews[(object) "CallContextBpmData"];

Yeah. Just throwing things at the wall to see what sticks.

:+1: Gotcha!

I get the same error message with that line of code as well.

Could I be missing something from the Assembly Reference Manager?

Other than the MtlTagsForm_Load(), does anything need to be populated in the script like in InitializeCustomCode() or DestoryCustomCode()?

I don’t have any custom assembly references in my customization. And I’m not using InitializeCustomCode() or DestroyCustomCode() to set up anything for this.

10.2 doesn’t need you to initialize EpiDataViews any differently, does it?

Not to my knowledge.

James, I feel like such a silly goose - I was looking at the base version of the form for some inexplicable reason, which is why I saw nothing in InitializeCustomCode() and DestroyCustomCode().

I had declared a custom module level variable for the EpiDataView and then initialized/destroyed it in the methods above. The form load just references that variable to set the EpiDataView’s fields.

Apologies for the error.

Hi Tanesh:

I have tried and tried again to configure the public class Script, InitializeCustomCode(), and DestroyCustomCode() but to no avail. I still get the same compile error message as previously described. I am at a loss and feel like a silly goose myself! I’ve included the code below. Could you please take a quick look when you have a spare moment. I am sure that you will probably see the issue straight away. Many thanks!

// **************************************************
// Custom code for MtlTagsForm
// Created: 11/11/2019 1:15:39 PM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Erp.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;

public class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **

	private EpiDataView edvCallContextBpmData;
	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **

	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		this.edvCallContextBpmData = ((EpiDataView)(this.oTrans.EpiDataViews["CallContextBpmData"]));
		// End Wizard Added Custom Method Calls
	}

	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal

		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		this.edvCallContextBpmData = null;
		// End Custom Code Disposal
	}


	private void MtlTagsForm_Load(object sender, EventArgs args)
	{
		// Add Event Handler Code
			EpiDataView callContextBpmDataView = (EpiDataView) this.oTrans.EpiDataViews[(object) "CallContextBpmData"];
			if (this.MtlTagsForm.LaunchFormOptions != null)
			{
				this.callContextBpmDataView.dataview[this.callContextBpmDataView.Row]["Character01"] = this.MtlTagsForm.LaunchFormOptions.ContextValue.ToString();
			}
	}

}