Jose,
Perfect! Thank you for teaching me "how to fish" in the alternate style :)
-Dave
Jose,
Perfect! Thank you for teaching me "how to fish" in the alternate style :)
-Dave
Hi All,
The following vb.net program fragment works fine updating a passed in Sales Order # in a Visual Studio 2012 windows form (interactive)project but does not work in a Console (no interaction expected) project. I'm hoping to get the code to work in a console app to tie it to a AT scheduler job to periodically check for a flag(checkbox), do processing, then update to unset the checkbox. Again, the logic works fine in a interactive forms app.
Thank you for any advice,
Dave Beberman
ERP Manager
Ferguson Perforating
Imports Ice.Core.Session
Imports Ice.Lib.Deployment
Imports Ice.Lib.Framework
Imports Ice.Lib.Searches
Module modEpicorUpdate
Friend EpiSession As Ice.Core.Session
Friend EpiLaunch As Ice.Lib.Framework.ILauncher
Sub Update_Single_Epicor_Order(ByVal lstrOrderNum As String)
'Open Epicor Connection
'
Dim result As String = E10Connect("ERP100700")
Dim orderAdapter As Erp.Adapters.SalesOrderAdapter = New Erp.Adapters.SalesOrderAdapter(EpiLaunch)
orderAdapter.BOConnect()
WriteAudit(Now().ToString + " - Updating SO# " + lstrOrderNum)
'SalesOrder.GetByID
Dim boolGoodFetch As Boolean = orderAdapter.GetByID(lstrOrderNum)
WriteAudit(Now().ToString + " - GetByID Fetch boolean = " + boolGoodFetch.ToString)
If orderAdapter.SalesOrderData.OrderHed.Rows.Count < 1 Then
WriteAudit(Now().ToString + " - Logic Error - No rows found for SO# " + lstrOrderNum)
Exit Sub
End If
'Update OrderHed Columns
'
orderAdapter.SalesOrderData.OrderHed(0)("Checkbox01") = 0
orderAdapter.SalesOrderData.OrderHed(0)("Date01") = Now
orderAdapter.SalesOrderData.OrderHed(0)("RowMod") = "U"
'Update
'
orderAdapter.Update()
WriteAudit(Now().ToString + " - Completed Updating SO# " + lstrOrderNum)
orderAdapter.Dispose()
result = E10DisConnect()
End Sub
Private Function E10Connect(ByVal WhichDatabase As String) As String
Dim retval As String = ""
Try
Dim WhoAmI As String = "AAAAAA"
Dim MyPassword As String = "BBBBBB"
EpiSession = New Ice.Core.Session(WhoAmI, MyPassword, LicenseType.Default, "\\PATH\ERP100700.sysconfig")
'Initialize Launcher
EpiLaunch = New ILauncher(EpiSession)
retval = "Connected - Company =" & EpiSession.CompanyID.ToString
WriteAudit(Now().ToString + " - Epicor connection Status - " + retval)
Catch ex As Exception
retval = "ERROR: " & ex.Message
End Try
Return retval
End Function
Private Function E10DisConnect() As String
Dim retval As String = ""
Try
EpiSession.Dispose()
retval = "Disconnected"
Catch ex As Exception
retval = "ERROR: " & ex.Message
End Try
Return retval
End Function
End Module
On Wed, Dec 16, 2015 at 3:28 PM, dbeberman@... [vantage] <vantage@yahoogroups.com> wrote:Â<div> <p></p><p><span>Hi All,</span></p><p><span>The following <a rel="nofollow" target="_blank" href="http://vb.net">vb.net</a> program fragment works fine updating a passed in Sales Order # in a Visual Studio 2012 windows form (interactive)project but does not work in a Console (no interaction expected) project. I'm hoping to get the code to work in a console app to tie it to a AT scheduler job to periodically check for a flag(checkbox), do processing, then update to unset the checkbox. Again, the logic works fine in a interactive forms app. </span></p><p><span>Thank you for any advice,</span></p><p><span>Dave Beberman</span></p><p><span>ERP Manager</span></p><p><span>Ferguson Perforating</span></p><p><span></span> </p><p><span>Imports Ice.Core.Session<br>Imports Ice.Lib.Deployment<br>Imports Ice.Lib.Framework<br>Imports Ice.Lib.Searches</span></p><p><span>Module modEpicorUpdate<br>   Friend EpiSession As Ice.Core.Session<br>   Friend EpiLaunch As Ice.Lib.Framework.ILauncher</span></p><p><span>   Sub Update_Single_Epicor_Order(ByVal lstrOrderNum As String)<br>            <br>       'Open Epicor Connection<br>       '<br>       Dim result As String = E10Connect("ERP100700")</span></p><p><span>       Dim orderAdapter As Erp.Adapters.SalesOrderAdapter = New Erp.Adapters.SalesOrderAdapter(EpiLaunch)<br>       orderAdapter.BOConnect()</span></p><p><span>       WriteAudit(Now().ToString + " - Updating SO# " + lstrOrderNum)</span></p><p><span>       'SalesOrder.GetByID<br>       Dim boolGoodFetch As Boolean = orderAdapter.GetByID(lstrOrderNum)<br>       WriteAudit(Now().ToString + " - GetByID Fetch boolean = " + boolGoodFetch.ToString)</span></p><p><span>       If orderAdapter.SalesOrderData.OrderHed.Rows.Count < 1 Then<br>           WriteAudit(Now().ToString + " - Logic Error - No rows found for SO# " + lstrOrderNum)<br>           Exit Sub<br>       End If</span></p><p><span>       'Update OrderHed Columns<br>       '  <br>       orderAdapter.SalesOrderData.OrderHed(0)("Checkbox01") = 0<br>       orderAdapter.SalesOrderData.OrderHed(0)("Date01") = Now<br>       orderAdapter.SalesOrderData.OrderHed(0)("RowMod") = "U"</span></p><p><span>       'Update<br>       '<br>       orderAdapter.Update()</span></p><p><span>       WriteAudit(Now().ToString + " - Completed Updating SO# " + lstrOrderNum)<br>       orderAdapter.Dispose()<br>       result = E10DisConnect()</span></p><p><span>   End Sub<br>   Private Function E10Connect(ByVal WhichDatabase As String) As String<br>       Dim retval As String = ""<br>       Try<br>           Dim WhoAmI As String = "AAAAAA"<br>           Dim MyPassword As String = "BBBBBB"<br>           EpiSession = New Ice.Core.Session(WhoAmI, MyPassword, LicenseType.Default, "\\PATH\ERP100700.sysconfig")<br>           'Initialize Launcher<br>           EpiLaunch = New ILauncher(EpiSession)<br>           retval = "Connected - Company =" & EpiSession.CompanyID.ToString<br>           WriteAudit(Now().ToString + " - Epicor connection Status - " + retval)<br>       Catch ex As Exception<br>           retval = "ERROR: " & ex.Message<br>       End Try<br>       Return retval<br>   End Function<br>   Private Function E10DisConnect() As String<br>       Dim retval As String = ""<br>       Try<br>           EpiSession.Dispose()<br>           retval = "Disconnected"</span></p><p><span>       Catch ex As Exception<br>           retval = "ERROR: " & ex.Message<br>       End Try</span></p><p><span>       Return retval<br>   End Function</span></p><p><span>End Module<br></span></p><p><span></span> </p><p><span></span> </p><p></p> </div> <div style="color:#fff;min-height:0;"></div>
Thanks for the question,
It fails when run from a Vis Studio Run logging the errors:
12/16/2015 3:39:26 PM - Epicor connection Status - Connected - Company =FERGUSON
12/16/2015 3:39:26 PM - Updating SO# 85539
12/16/2015 3:39:26 PM - GetByID good fetch = True
12/16/2015 3:39:26 PM - Logic Error - No rows found for SO# 85539
On Wed, Dec 16, 2015 at 3:43 PM, dbeberman@... [vantage] <vantage@yahoogroups.com> wrote:Â<div> <p></p><p>Thanks for the question,</p><p>It fails when run from a Vis Studio Run logging the errors:</p><p>12/16/2015 3:39:26 PM - Epicor connection Status - Connected - Company =FERGUSON<br>12/16/2015 3:39:26 PM - Updating SO# 85539<br>12/16/2015 3:39:26 PM - GetByID good fetch = True<br>12/16/2015 3:39:26 PM - Logic Error - No rows found for SO# 85539<br></p><p></p> </div><span class="ygrps-yiv-1415335716"> <div style="color:#fff;min-height:0;"></div>
Yes Jose to both points,
I can perform the operations without issue using the B/L Tester also.
On Wed, Dec 16, 2015 at 4:36 PM, dbeberman@... [vantage] <vantage@yahoogroups.com> wrote:Â<div> <p></p><p>Yes Jose to both points,</p><p>I can perform the operations without issue using the B/L Tester also.<br></p><p></p> </div><span class="ygrps-yiv-440103430"> <div style="color:#fff;min-height:0;"></div>
OK I'll rework my example.
What are the references I'll need for that code to work ?
On Wed, Dec 16, 2015 at 4:58 PM, dbeberman@... [vantage] <vantage@yahoogroups.com> wrote:Â<div> <p></p><p>Ok, I'll rework my code.</p><p>What references do I need to use to use those objects ?</p><p><br>Â </p><p></p> </div><span class="ygrps-yiv-1077901766"> <div style="color:#fff;min-height:0;"></div>
Any Web Service references needed using this technique ?
On Wed, Dec 16, 2015 at 5:24 PM, dbeberman@... [vantage] <vantage@yahoogroups.com> wrote:Â<div> <p></p><p>Any Web Service references needed using this technique ?<br></p><p></p> </div><span class="ygrps-yiv-1324747429"> <div style="color:#fff;min-height:0;"></div>
Good morning,
Created a standalone console net 4.5 app with this code and received this error on the line shown. Any hints ?
Imports Erp.Proxy.BO.PartImpl
Imports Epicor.ServiceModel
Module Module1
Sub Main()
Dim wcfBinding = StandardBindings.NetTcp.UsernameWindowsChannel()
Dim appServer = New Uri("net.tcp://*localhost*/server/erp/bo/part.svc")
Using partClient = New Erp.Proxy.BO.PartImpl(wcfBinding, appServer)
partClient.ClientCredentials.UserName.UserName = "AAA"
partClient.ClientCredentials.UserName.Password = "BBB"
Dim morePages As Boolean
Dim myPartDataset = partClient.GetList("", 10, 1, morePages) <<<Error Line
For Each partRec As Erp.BO.PartListDataSet.PartListRow In myPartDataset.PartList.Rows.Cast(Of Erp.BO.PartListDataSet.PartListRow)()
Console.WriteLine(partRec.PartNum)
Next
partClient.Close()
End Using
End Sub
End Module
System.ServiceModel.EndpointNotFoundException was unhandled
HResult=-2146233087
Message=There was no endpoint listening at net.tcp://*localhost*/server/erp/bo/part.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Source=mscorlib
StackTrace:
Server stack trace:
at System.ServiceModel.Channels.ConnectionUpgradeHelper.DecodeFramingFault(ClientFramingDecoder decoder, IConnection connection, Uri via, String contentType, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.LayeredChannel`1.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelFactory`1.ClientSecurityChannel`1.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open()
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at System.ServiceModel.ICommunicationObject.Open()
at Epicor.ServiceModel.Channels.ChannelEntry`1.CreateChannel()
at Epicor.ServiceModel.Channels.ChannelEntry`1.GetContract()
at Epicor.ServiceModel.Channels.ImplBase`1.GetChannel()
at Epicor.ServiceModel.Channels.ImplBase`1.HandleContractBeforeCall()
at Erp.Proxy.BO.PartImpl.GetList(String whereClause, Int32 pageSize, Int32 absolutePage, Boolean& morePages)
at Con_TestEpiService.Module1.Main() in J:\VBProjectSource\Projects\Con_TestEpiService\Con_TestEpiService\Module1.vb:line 20
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
On Thu, Dec 17, 2015 at 10:23 AM, dbeberman@... [vantage] <vantage@yahoogroups.com> wrote:Â<div> <p></p><p>Good morning,</p><p>Created a standalone console net 4.5 app with this code and received this error on the line shown. Any hints ?</p><p> </p><p>Imports Erp.Proxy.BO.PartImpl<br>Imports Epicor.ServiceModel</p><p>Module Module1</p><p>   Sub Main()<br>       Dim wcfBinding = StandardBindings.NetTcp.UsernameWindowsChannel()</p><p>       Dim appServer = New Uri("net.tcp://*localhost*/server/erp/bo/part.svc")</p><p>       Using partClient = New Erp.Proxy.BO.PartImpl(wcfBinding, appServer)</p><p>           partClient.ClientCredentials.UserName.UserName = "AAA"</p><p>           partClient.ClientCredentials.UserName.Password = "BBB"</p><p>           Dim morePages As Boolean</p><p>           Dim myPartDataset = partClient.GetList("", 10, 1, morePages)  <<<Error Line</p><p>           For Each partRec As Erp.BO.PartListDataSet.PartListRow In myPartDataset.PartList.Rows.Cast(Of Erp.BO.PartListDataSet.PartListRow)()</p><p>               Console.WriteLine(partRec.PartNum)<br>           Next</p><p><br>           partClient.Close()<br>       End Using</p><p> </p><p>   End Sub</p><p>End Module</p><p>System.ServiceModel.EndpointNotFoundException was unhandled<br> HResult=-<a rel="nofollow">2146233087</a><br> Message=There was no endpoint listening at net.tcp://*localhost*/server/erp/bo/part.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.<br> Source=mscorlib<br> StackTrace:<br>   Server stack trace: <br>      at System.ServiceModel.Channels.ConnectionUpgradeHelper.DecodeFramingFault(ClientFramingDecoder decoder, IConnection connection, Uri via, String contentType, TimeoutHelper& timeoutHelper)<br>      at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)<br>      at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)<br>      at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)<br>      at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)<br>      at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)<br>      at System.ServiceModel.Channels.LayeredChannel`1.OnOpen(TimeSpan timeout)<br>      at System.ServiceModel.Channels.SecurityChannelFactory`1.ClientSecurityChannel`1.OnOpen(TimeSpan timeout)<br>      at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)<br>      at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)<br>      at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)<br>      at System.ServiceModel.Channels.CommunicationObject.Open()<br>   Exception rethrown at [0]: <br>      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)<br>      at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)<br>      at System.ServiceModel.ICommunicationObject.Open()<br>      at Epicor.ServiceModel.Channels.ChannelEntry`1.CreateChannel()<br>      at Epicor.ServiceModel.Channels.ChannelEntry`1.GetContract()<br>      at Epicor.ServiceModel.Channels.ImplBase`1.GetChannel()<br>      at Epicor.ServiceModel.Channels.ImplBase`1.HandleContractBeforeCall()<br>      at Erp.Proxy.BO.PartImpl.GetList(String whereClause, Int32 pageSize, Int32 absolutePage, Boolean& morePages)<br>      at Con_TestEpiService.Module1.Main() in J:\VBProjectSource\Projects\Con_TestEpiService\Con_TestEpiService\Module1.vb:line 20<br>      at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)<br>      at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)<br>      at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()<br>      at System.Threading.ThreadHelper.ThreadStart_Context(Object state)<br>      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)<br>      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)<br>      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)<br>      at System.Threading.ThreadHelper.ThreadStart()<br> InnerException: <br></p><p><br> </p><p></p> </div><span class="ygrps-yiv-1233789838"> <div style="color:#fff;min-height:0;"></div>