William Asks:
Trying to fire off the ImportEDI demand process from VB.NET with:
- backup process checkbox checked
- Import folder being \\taf2k8edi1\epicor\edidata\inbound\demand.
- Continuous process is false.
This can be accomplished by establishing a session on the VB/C# application and creating an instance of the ImportEDI process as shown below. After running a trace on Epicor you can see that the EDI Import Process runs 2 main methods.
Epicor.Mfg.Proc.ImportEDI GetNewParameters Epicor.Mfg.Proc.ImportEDIDataSet 7/2/2015 09:28:33:6255008 AM 67
GetNewParameters: gets you an new instance of the EDI Process Import Data Set
Epicor.Mfg.Proc.ImportEDI SubmitToAgent void 7/2/2015 09:28:55:7313078 AM 327
SubmitToAgent: schedules the process with the System Task Agent for Execution. This method requires that you fill in the appropriate values within the ImportEDIDataSet as shown on the FULL trace.
The code below is an implementation of calling these two methods in C# from an External application. You requested it in VB.NET but I don’t write VB.NET unless someone is holding a gun against my head… It makes me itchy and I break out in hives… so your homework is to convert the below code into VB.NET. You will need to reference the following DLL’s available within the Epicor Client Folder
- Epicor.Mfg.Core.BLConnectionPool.dll
- Epicor.Mfg.Core.Session.dll
- Epicor.Mfg.Proc.IImportEDI.dll
- Epicor.Mfg.Proc.ImportEDI.dll
using Epicor.Mfg.Core; using Epicor.Mfg.Proc; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using(Session _session = new Session("manager","manager","AppServerDC://E9P:9411",Session.LicenseType.Default)) { ImportEDI _importEDIPRoc = new ImportEDI(_session.ConnectionPool); ImportEDIDataSet importEDIDS = _importEDIPRoc.GetNewParameters(); ImportEDIDataSet.ImportEDIParamRow newRow = importEDIDS.ImportEDIParam[0]; newRow.ProcessingDelay=1; newRow.LogFilename=@"C:\Epicor\EpicorData\ImportEDI.log"; //EDI LOG newRow.Inactive=false; newRow.InboundPath=@"\\taf2k8edi1\epicor\edidata\inbound\demand"; //IMPUT PATH newRow.ProcessNum=0; newRow.BackupFile=true; newRow.AutoAction=""; newRow.PrinterName=""; newRow.AgentSchedNum=0; newRow.AgentID="SystemTaskAgent"; newRow.AgentTaskNum=0; newRow.RecurringTask=false; newRow.RptPageSettings=""; newRow.RptPrinterSettings=""; newRow.RptVersion=""; newRow.ReportStyleNum=0; newRow.WorkstationID = Environment.MachineName + " " + Process.GetCurrentProcess().SessionId; //TIS IS IMPORTANT newRow.TaskNote=""; newRow.ArchiveCode=0; newRow.DateFormat="m/d/yyyy"; newRow.NumericFormat=",."; newRow.AgentCompareString=""; newRow.ProcessID=""; newRow.ProcessTaskNum=0; newRow.DecimalsGeneral=2; newRow.DecimalsCost=5; newRow.DecimalsPrice=5; newRow.GlbDecimalsGeneral=2; newRow.GlbDecimalsCost=5; newRow.GlbDecimalsPrice=5; newRow.FaxSubject=""; newRow.FaxTo=""; newRow.FaxNumber=""; newRow.EMailTo=""; newRow.EMailCC=""; newRow.EMailBCC=""; newRow.EMailBody=""; newRow.AttachmentType=""; newRow.ReportCurrencyCode=""; newRow.ReportCultureCode=""; newRow.RowIdent=""; newRow.RowMod="A"; _importEDIPRoc.SubmitToAgent(importEDIDS,"SystemTaskAgent",0,0,"Epicor.Mfg.UIProc.ImportEDI"); }
Tags: C#, EDI, Epicor, Epicor 9, Programming