Imports System.Windows.Forms

Public Class dlg_StoreSelect
    Dim rTable As New DataTable
    Dim m_SQL As New CStore
    Dim m_AddressList As New ArrayList
    Dim 库位表 As New ArrayList
    Public m_SelPosName As String = ""

    Private Function GetStoreList() As Boolean
        combo_Store.Items.Clear()
        m_AddressList.Clear()
        库位表.Clear()

        If m_SQL.QueryAll(rTable) = ERROR_CODE.SUCCESS Then
            For i As Integer = 0 To rTable.Rows.Count - 1
                combo_Store.Items.Add(rTable.Rows(i).Item(CStore.COLS.仓库名称))
                m_AddressList.Add(rTable.Rows(i).Item(CStore.COLS.仓库地点))
                库位表.Add(rTable.Rows(i).Item(CStore.COLS.仓库库位表))
            Next
            Return True
        End If

        Return False
    End Function

    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        If combo_Store.Text.Length = 0 Then
            MsgBox("请选择仓库!")
            Return
        End If

        m_SelPosName = 库位表.Item(combo_Store.SelectedIndex)

        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.Close()
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Private Sub dlg_StoreSelect_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        GetStoreList()
    End Sub

    Private Sub combo_Store_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles combo_Store.SelectedIndexChanged
        If combo_Store.SelectedIndex >= 0 Then
            lblAddress.Text = m_AddressList.Item(combo_Store.SelectedIndex)
        Else
            lblAddress.Text = ""
        End If
    End Sub
End Class
