Help needed with vb.net please.
Does anyone have any idea how i can get the below snippet of code working in E10, 4 other lines that did not work i have managed to if that but unable to get the last bit of code working.
' **************************************************
' Custom code for IssueMaterialForm
' Created: 22/06/2012 09:07:30
' **************************************************
Imports System
Imports System.ComponentModel
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports Microsoft.VisualBasic
Imports Ice.Lib
Imports Erp.BO
Imports Ice.BO
Imports Erp.Proxy.BO
Imports Erp.UI
Imports Ice.Adapters
Imports Erp.Adapters
Imports Ice.Lib.Customization
Imports Ice.Lib.ExtendedProps
Imports Ice.UI.FormFunctions
Imports Ice.Lib.Framework
Imports Ice.Lib.Searches
Public Class Script
' ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
' Begin Wizard Added Module Level Variables **
' End Wizard Added Module Level Variables **
' Add Custom Module Level Variables Here **
Dim selected_job As Ice.Lib.Framework.EpiTextBox
Dim OK_btn As Ice.Lib.Framework.EpiButton
Dim selected_mtl As Erp.UI.Controls.Combos.JobMtlSearchCombo
Dim issue_return_form As Erp.UI.App.IssueMaterialEntry.IssueMaterialForm
Dim curr_jobNo As String
Dim curr_jobseq As String
Dim gp_box As Ice.Lib.Framework.EpiGroupBox
Dim blnCheckJobseq As Boolean = False
Dim blnIssueMtlmain As Boolean = True
Dim curr_session_IM As Ice.Core.Session
'//////////////////////////////////////////////////////////////////////////////////////////////////////////
'This screen lets people issue material. It gets called from 2 places(MES AND EPICOR 9).
'if it gets called from MES WORKQUEUE then it needs show the selected mtl which the user would have slected in work queue issue mtl option and
'also popolated the lot and the remaining quantity of steel to be issued
'//////////////////////////////////////////////////////////////////////////////////////////////////////////
Public Sub InitializeCustomCode()
' ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
curr_session_IM = DirectCast(IssueMaterialForm.Session, Ice.Core.Session) 'gets the IssueMaterialForm session
gp_box = CType(csm.GetNativeControlReference("6386495a-8b7d-43b4-ae7d-34ae4f6f8dba"), Ice.Lib.Framework.EpiGroupBox)
selected_job = CType(csm.GetNativeControlReference("8eb12134-2ebc-448b-b3db-9ab81ecc4f66"), Ice.Lib.Framework.EpiTextBox)
OK_btn = CType(csm.GetNativeControlReference("43ce5d32-8e77-4d69-9a8e-6c33bd4da434"), Ice.Lib.Framework.EpiButton)
selected_mtl = CType(csm.GetNativeControlReference("3c29bb2b-cc78-4cab-80c8-f004923fdbae"), Erp.UI.Controls.Combos.JobMtlSearchCombo)
issue_return_form = CType(csm.GetNativeControlReference("2dcd1674-5e34-4d98-b493-c75747027376"), Erp.UI.App.IssueMaterialEntry.IssueMaterialForm)
' Begin Wizard Added Variable Initialization
' End Wizard Added Variable Initialization
' Begin Wizard Added Custom Method Calls
' End Wizard Added Custom Method Calls
AddHandler Me.epiButtonC1_ok.Click, AddressOf Me.epiButtonC1_ok_Click
AddHandler Me.IssueReturn_Column.ColumnChanged, AddressOf Me.IssueReturn_AfterFieldChange
End Sub
Public Sub DestroyCustomCode()
' ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
' Begin Wizard Added Object Disposal
'removehandler txtmltseq.TextChanged, AddressOf txtmltseq_TextChanged
RemoveHandler Me.epiButtonC1_ok.Click, AddressOf Me.epiButtonC1_ok_Click
RemoveHandler Me.IssueReturn_Column.ColumnChanged, AddressOf Me.IssueReturn_AfterFieldChange
End Sub
Private Sub IssueMaterialForm_Load(ByVal sender As Object, ByVal args As EventArgs)
' Add Event Handler Code
Load_Job(True)
blnCheckJobseq = True 'flags to confirm from which screen it gets called. if it is from MES where it will have details in ContextValue and it would be true otherwise it is false
End Sub
Private Sub Load_Job(ToJobSeq As Boolean)
Try
' Get the selected job number to issue material
blnCheckJobseq = False ' to assumes it may be from Epicor 9
If Not (IssueMaterialForm.LaunchFormOptions Is Nothing) Then
If Not (IssueMaterialForm.LaunchFormOptions.ContextValue Is Nothing) Then
blnCheckJobseq = True ' to confirm (LaunchFormOptions.contextvalue has some value in it) it got called from MES
curr_jobNo = IssueMaterialForm.LaunchFormOptions.ContextValue ' current job that was selected in workqueue
curr_jobseq = IssueMaterialForm.LaunchFormOptions.Like ' mtl seq no that was selected in workqueue
selected_job.Text = curr_jobNo
Dim load_job As Boolean = oTrans.loadSingleJob(selected_job.Text, 0) 'loads slected job in the IssueMaterialTransaction object
Dim edv_IM As EpiDataView = CType(oTrans.EpiDataViews("IM"), EpiDataView) 'declare the issue mtl dataview
edv_IM.dataView(edv_IM.Row).BeginEdit() 'call the edit method in the dataview
edv_IM.dataView(edv_IM.Row)("ToJobSeq") = curr_jobseq 'pass the currently selected mtl seq no to the dataview and update
edv_IM.dataView(edv_IM.Row).EndEdit()
oTrans.NotifyAll()
gp_box.ReadOnly = False
epiLabelC1.Visible = True ' highlighting bit visibile for quantity
epiLabelC2.Visible = True ' highlighting bit visibile for lot number
blnIssueMtlmain = False
Else
gp_box.ReadOnly = True
epiLabelC1.Visible = False
epiLabelC2.Visible = False
End If
End If
Catch ex As Exception
MsgBox(ex.Source)
End Try
End Sub
Private Sub ISTBACKFLUSHED()
'This is to rectify if the slected mtl is backflushed... if so , display message otherwise workout the Quantity to display
Try
If len(selected_job.Text) > 0 And len(selected_mtl.Text) > 0 Then
'Dim bo_jobmtlsearch As New Erp.BO.JobMtlSearch(curr_session_IM.ConnectionPool) 'declare JobMtlSearch object and pass the current session
Dim bo_jobmtlsearch As Erp.Proxy.BO.JobMtlSearchImpl = WCFServiceSupport.CreateImpl(Of Erp.Proxy.BO.JobMtlSearchImpl)(oTrans.Session, Erp.Proxy.BO.JobMtlSearchImpl.UriPath)
Dim ds_jobmtlsearch As Erp.BO.JobMtlSearchDataSet 'decalre JobMtlSearch DataSet
Dim Issue_mtl As EpiDataView = CType(oTrans.EpiDataViews("IM"), EpiDataView) 'declare Issue Material dataview
ds_jobmtlsearch = bo_jobmtlsearch.GetByID(selected_job.Text, 0, selected_mtl.Text) 'gets the row using GetByID methods of JobMtlSearch DataSet
If ds_jobmtlsearch.Tables(0).Rows(0)(37).ToString() = True Then 'if backflushed = true
lblBackFlushed.Visible = True
Else
lblBackFlushed.Visible = False
If blnCheckJobseq Then
If Issue_mtl.dataView(Issue_mtl.Row)("QtyRequired") <> Issue_mtl.dataView(Issue_mtl.Row)("QtyPreviouslyIssued") Then 'means issue completed
Dim qty_difference As Decimal = Issue_mtl.dataView(Issue_mtl.Row)("QtyRequired") - Issue_mtl.dataView(Issue_mtl.Row)("QtyPreviouslyIssued")
If qty_difference > 0 Then
Issue_mtl.dataView(Issue_mtl.Row).BeginEdit()
Issue_mtl.dataView(Issue_mtl.Row)("TranQty") = Issue_mtl.dataView(Issue_mtl.Row)("QtyRequired") - Issue_mtl.dataView(Issue_mtl.Row)("QtyPreviouslyIssued") 'update the required qty
Issue_mtl.dataView(Issue_mtl.Row).EndEdit()
End If
End If
End If
End If
ds_jobmtlsearch.Dispose() ' dispose the objects
bo_jobmtlsearch = Nothing
End If
Catch ex As Exception
MsgBox(ex.Source)
End Try
End Sub
Private Sub Part_Lot()
Try
Dim edv_part As EpiDataView = CType(oTrans.EpiDataViews("IM"), EpiDataView) 'declare Issue Material dataview
Dim selected_part As String = edv_part.dataView(edv_part.Row)("PartNum") 'gets the part num from Issue Material dataview
Dim whse_house As String = edv_part.dataView(edv_part.Row)("FromWarehouseCode") 'gets the Warehouse Code from Issue Material dataview
If len(selected_part) > 0 And len(whse_house) > 0 Then 'if they are not empty then that selected part and warehouse should have lots assigned to
'Dim bo_PartBinSearch As New Erp.BO.PartBinSearch(curr_session_IM.ConnectionPool) 'declare PartBinSearch object and pass the current session
Dim bo_PartBinSearch As Erp.Proxy.BO.PartBinSearchImpl = WCFServiceSupport.CreateImpl(Of Erp.Proxy.BO.PartBinSearchImpl)(oTrans.Session, Erp.Proxy.BO.PartBinSearchImpl.UriPath)
Dim ds_PartBinSearchDataSet As Erp.BO.PartBinSearchDataSet 'decalre PartBinSearchDataSet DataSet
ds_PartBinSearchDataSet = bo_PartBinSearch.GetFullBinSearch(selected_part, whse_house) 'get the data row using GetFullBinSearch method of PartBinSearch
If ds_PartBinSearchDataSet.Tables(0).Rows.Count > 0 Then
epiUltraComboC1.DataSource = ds_PartBinSearchDataSet.PartBinSearch 'sets the data source
Dim epi_filter_colms As String() = New String(2) {} 'filters the colums we want to show
epi_filter_colms(0) = "LotNumber"
epi_filter_colms(1) = "QtyOnHand"
epi_filter_colms(2) = "LotNumberDesc"
epiUltraComboC1.FilterColumns(epi_filter_colms)
epiUltraComboC1.DisplayMember = "LotNumber" 'set the DisplayMember and value member
epiUltraComboC1.ValueMember = "LotNumber"
epiUltraComboC1.DropDownSearchMethod = Infragistics.Win.UltraWinGrid.DropDownSearchMethod.Default
epiUltraComboC1.DropDownStyle = Infragistics.Win.UltraWinGrid.UltraComboStyle.DropDownList 'set the epiUltraComboC1 other properties to look user & friendly
epiUltraComboC1.EditAreaDisplayStyle = Infragistics.Win.UltraWinGrid.EditAreaDisplayStyle.Default
epiUltraComboC1.RightToLeft = System.Windows.Forms.RightToLeft.Yes
End If
If Not ds_PartBinSearchDataSet Is Nothing Then ds_PartBinSearchDataSet.dispose() 'dispose the objects
bo_PartBinSearch = Nothing
End If
Catch ex As Exception
MsgBox(ex.Source)
End Try
End Sub
Private Sub epiButtonC1_ok_Click(ByVal sender As Object, ByVal args As System.EventArgs)
' ** Place Event Handling Code Here **
'this is to invoke click even on the ok button (provided by epicor). so the control that was there would be invisible. we place a button which is called epiButtonC1_ok
'when the users click on it , it calls the performclick method of the "ok" button.
Try
OK_btn.performclick()
If Not blnIssueMtlmain Then
IssueMaterialForm.LaunchFormOptions.Result = "Issued" ' this is to say mtl has been issued which refreshes the Issued Total in workqueue screen
issue_return_form.Close()
End If
Catch ex As Exception
MsgBox(ex.Source)
End Try
' performclick:
'This method implements the PerformClick method of the IButtonControl interface. The PerformClick method can be used when it is needed, for instance, to raise the Click event.
'By default, it is called for the button that has focus, or for the default button (if no other button has focus) when the user presses the ENTER or SPACE key.
'This method is also called when the user presses the ESC key if the button is set as the cancel button. Use the form's AcceptButton and CancelButton properties
'to specify which buttons on a form should act like default (accept) and cancel buttons respectively.
End Sub
Private Sub IssueReturn_AfterFieldChange(ByVal sender As Object, ByVal args As DataColumnChangeEventArgs)
' ** Argument Properties and Uses **
' args.Row("FieldName")
' args.Column, args.ProposedValue, args.Row
' Add Event Handler Code
Select Case args.Column.ColumnName
Case "ToJobSeq"
Part_Lot()
ISTBACKFLUSHED()
End Select
End Sub
End Class
--------compile errors------------
Error: BC30455 - line 181 (548) - Argument not specified for parameter ‘consolidateInvAttributes’ of ‘Public Function GetFullBinSearch(partNum As String, whseCode As String, consolidateInvAttributes As Boolean) As Erp.BO.PartBinSearchDataSet’.
** Compile Failed. **
Many thanks