﻿Imports System
Imports System.Linq
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports Bt
Imports Bt.ScanLib
'Imports KDPP7000.BtScanLib
Imports BTClientLib
Imports System.IO
Imports System.Reflection
Imports BtScan2

Public Class frm7014
    Inherits System.Windows.Forms.Form
    Private btScanLib As BtScanLib
    Private scanHandler As Boolean = False
    'Private dbClient As BtrieveDbClient
    Private tmpStr As List(Of Dictionary(Of String, String))
    Private affected_rows As Integer
    Public tmpStr_PACKCP As List(Of Dictionary(Of String, String))

#Region " Windows tH[€ fUCiลถฌณ๊ฝR[h "

    Public Sub New()
        MyBase.New()

        ' ฑฬฤัoตอ Windows tH[€ fUCiล•K—vลทB
        InitializeComponent()

        ' InitializeComponent() ฤัoตฬใษ๚ป๐’วมตทB

    End Sub

    ' Form อAR“|[l“g๊——ษใ—๐ภsท้ฝ฿ษ dispose ๐I[o[ChตทB
    'Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    '    If disposing Then
    '        If Not (components Is Nothing) Then
    '            components.Dispose()
    '        End If
    '    End If
    '    MyBase.Dispose(disposing)
    'End Sub

    ' Windows tH[€ fUCiล•K—vลทB
    'Private components As System.ComponentModel.IContainer

    '  : ศบฬvV[WอAWindows tH[€ fUCiล•K—vลทB
    'Windows tH[€ fUCi๐gมฤ•ฯXตฤญพณขB  
    ' R[h GfB^๐gมฤ•ฯXตศขลญพณขB
    'Friend WithEvents WarpHWBcr1 As WarpControl.WarpHWBcr
    'Friend WithEvents WarpBox1 As WarpControl.WarpBox
    'Friend WithEvents WarpFrame1 As WarpControl.WarpFrame
    'Friend WithEvents wfName As WarpControl.WarpField
    'Friend WithEvents wfInput As WarpControl.WarpField
    'Friend WithEvents wfMSC As WarpControl.WarpField
    'Friend WithEvents WarpField1 As WarpControl.WarpField
    'Friend WithEvents WarpField2 As WarpControl.WarpField
    'Friend WithEvents WarpField3 As WarpControl.WarpField
    'Friend WithEvents wfPNT As WarpControl.WarpField
    'Friend WithEvents wfTRM As WarpControl.WarpField
    'Friend WithEvents WarpField4 As WarpControl.WarpField
    'Friend WithEvents WarpField5 As WarpControl.WarpField
    'Friend WithEvents wfCaseNo As WarpControl.WarpField
    'Friend WithEvents wfCartonNo As WarpControl.WarpField
    'Friend WithEvents wfType As WarpControl.WarpField
    'Friend WithEvents WarpField8 As WarpControl.WarpField
    '<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    '    Me.WarpFrame1 = New WarpControl.WarpFrame()
    '    Me.WarpField8 = New WarpControl.WarpField()
    '    Me.wfType = New WarpControl.WarpField()
    '    Me.wfCartonNo = New WarpControl.WarpField()
    '    Me.wfCaseNo = New WarpControl.WarpField()
    '    Me.WarpField5 = New WarpControl.WarpField()
    '    Me.WarpField4 = New WarpControl.WarpField()
    '    Me.wfTRM = New WarpControl.WarpField()
    '    Me.wfPNT = New WarpControl.WarpField()
    '    Me.WarpField3 = New WarpControl.WarpField()
    '    Me.WarpField2 = New WarpControl.WarpField()
    '    Me.WarpField1 = New WarpControl.WarpField()
    '    Me.wfInput = New WarpControl.WarpField()
    '    Me.wfMSC = New WarpControl.WarpField()
    '    Me.wfName = New WarpControl.WarpField()
    '    Me.WarpBox1 = New WarpControl.WarpBox()
    '    Me.WarpHWBcr1 = New WarpControl.WarpHWBcr()
    '    Me.WarpFrame1.SuspendLayout()
    '    Me.SuspendLayout()
    '    '
    '    'WarpFrame1
    '    '
    '    Me.WarpFrame1.Controls.Add(Me.WarpField8)
    '    Me.WarpFrame1.Controls.Add(Me.wfType)
    '    Me.WarpFrame1.Controls.Add(Me.wfCartonNo)
    '    Me.WarpFrame1.Controls.Add(Me.wfCaseNo)
    '    Me.WarpFrame1.Controls.Add(Me.WarpField5)
    '    Me.WarpFrame1.Controls.Add(Me.WarpField4)
    '    Me.WarpFrame1.Controls.Add(Me.wfTRM)
    '    Me.WarpFrame1.Controls.Add(Me.wfPNT)
    '    Me.WarpFrame1.Controls.Add(Me.WarpField3)
    '    Me.WarpFrame1.Controls.Add(Me.WarpField2)
    '    Me.WarpFrame1.Controls.Add(Me.WarpField1)
    '    Me.WarpFrame1.Controls.Add(Me.wfInput)
    '    Me.WarpFrame1.Controls.Add(Me.wfMSC)
    '    Me.WarpFrame1.Controls.Add(Me.wfName)
    '    Me.WarpFrame1.Controls.Add(Me.WarpBox1)
    '    Me.WarpFrame1.Font = New System.Drawing.Font("MS UI Gothic", 9.0!)
    '    Me.WarpFrame1.Location = New System.Drawing.Point(0, 0)
    '    Me.WarpFrame1.Name = "WarpFrame1"
    '    Me.WarpFrame1.Size = New System.Drawing.Size(240, 296)
    '    Me.WarpFrame1.TabIndex = 1
    '    Me.WarpFrame1.UseMacro = False
    '    Me.WarpFrame1.UseMacroFileName = ""
    '    '
    '    'WarpField8
    '    '
    '    Me.WarpField8.BcrFlag = True
    '    Me.WarpField8.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField8.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField8.FontSize = WarpControl.FontSizes.Small2
    '    Me.WarpField8.Format = ""
    '    Me.WarpField8.Length = CType(4, Short)
    '    Me.WarpField8.Location = New System.Drawing.Point(168, 126)
    '    Me.WarpField8.MacroBcr = ""
    '    Me.WarpField8.MacroIn = ""
    '    Me.WarpField8.MacroKey = ""
    '    Me.WarpField8.MacroOut = ""
    '    Me.WarpField8.Name = "WarpField8"
    '    Me.WarpField8.Size = New System.Drawing.Size(48, 24)
    '    Me.WarpField8.TabIndex = CType(13, Short)
    '    Me.WarpField8.Text = "Type"
    '    '
    '    'wfType
    '    '
    '    Me.wfType.BcrFlag = True
    '    Me.wfType.DecimalPointPosition = CType(0, Short)
    '    Me.wfType.DisplayAttribute.Bold = True
    '    Me.wfType.Font = New System.Drawing.Font("lr SVbN", 28.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfType.FontSize = WarpControl.FontSizes.Small
    '    Me.wfType.Format = ""
    '    Me.wfType.InputAttribute.Bold = True
    '    Me.wfType.Length = CType(3, Short)
    '    Me.wfType.Location = New System.Drawing.Point(180, 156)
    '    Me.wfType.MacroBcr = ""
    '    Me.wfType.MacroIn = ""
    '    Me.wfType.MacroKey = ""
    '    Me.wfType.MacroOut = ""
    '    Me.wfType.Name = "wfType"
    '    Me.wfType.Size = New System.Drawing.Size(45, 30)
    '    Me.wfType.TabIndex = CType(12, Short)
    '    Me.wfType.Text = "XXX"
    '    '
    '    'wfCartonNo
    '    '
    '    Me.wfCartonNo.BcrFlag = True
    '    Me.wfCartonNo.DecimalPointPosition = CType(0, Short)
    '    Me.wfCartonNo.DisplayAttribute.Bold = True
    '    Me.wfCartonNo.Font = New System.Drawing.Font("lr SVbN", 28.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfCartonNo.FontSize = WarpControl.FontSizes.Small
    '    Me.wfCartonNo.Format = ""
    '    Me.wfCartonNo.InputAttribute.Bold = True
    '    Me.wfCartonNo.Length = CType(5, Short)
    '    Me.wfCartonNo.Location = New System.Drawing.Point(48, 156)
    '    Me.wfCartonNo.MacroBcr = ""
    '    Me.wfCartonNo.MacroIn = ""
    '    Me.wfCartonNo.MacroKey = ""
    '    Me.wfCartonNo.MacroOut = ""
    '    Me.wfCartonNo.Name = "wfCartonNo"
    '    Me.wfCartonNo.Size = New System.Drawing.Size(75, 30)
    '    Me.wfCartonNo.TabIndex = CType(11, Short)
    '    Me.wfCartonNo.Text = "ZZZZ9"
    '    '
    '    'wfCaseNo
    '    '
    '    Me.wfCaseNo.BcrFlag = True
    '    Me.wfCaseNo.DecimalPointPosition = CType(0, Short)
    '    Me.wfCaseNo.DisplayAttribute.Bold = True
    '    Me.wfCaseNo.Font = New System.Drawing.Font("lr SVbN", 28.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfCaseNo.FontSize = WarpControl.FontSizes.Small
    '    Me.wfCaseNo.Format = ""
    '    Me.wfCaseNo.InputAttribute.Bold = True
    '    Me.wfCaseNo.Length = CType(9, Short)
    '    Me.wfCaseNo.Location = New System.Drawing.Point(96, 96)
    '    Me.wfCaseNo.MacroBcr = ""
    '    Me.wfCaseNo.MacroIn = ""
    '    Me.wfCaseNo.MacroKey = ""
    '    Me.wfCaseNo.MacroOut = ""
    '    Me.wfCaseNo.Name = "wfCaseNo"
    '    Me.wfCaseNo.Size = New System.Drawing.Size(135, 30)
    '    Me.wfCaseNo.TabIndex = CType(10, Short)
    '    Me.wfCaseNo.Text = "999-XX-99"
    '    '
    '    'WarpField5
    '    '
    '    Me.WarpField5.BcrFlag = True
    '    Me.WarpField5.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField5.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField5.FontSize = WarpControl.FontSizes.Small2
    '    Me.WarpField5.Format = ""
    '    Me.WarpField5.Length = CType(9, Short)
    '    Me.WarpField5.Location = New System.Drawing.Point(12, 126)
    '    Me.WarpField5.MacroBcr = ""
    '    Me.WarpField5.MacroIn = ""
    '    Me.WarpField5.MacroKey = ""
    '    Me.WarpField5.MacroOut = ""
    '    Me.WarpField5.Name = "WarpField5"
    '    Me.WarpField5.Size = New System.Drawing.Size(108, 24)
    '    Me.WarpField5.TabIndex = CType(9, Short)
    '    Me.WarpField5.Text = "Carton-No"
    '    '
    '    'WarpField4
    '    '
    '    Me.WarpField4.BcrFlag = True
    '    Me.WarpField4.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField4.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField4.FontSize = WarpControl.FontSizes.Small2
    '    Me.WarpField4.Format = ""
    '    Me.WarpField4.Length = CType(7, Short)
    '    Me.WarpField4.Location = New System.Drawing.Point(12, 72)
    '    Me.WarpField4.MacroBcr = ""
    '    Me.WarpField4.MacroIn = ""
    '    Me.WarpField4.MacroKey = ""
    '    Me.WarpField4.MacroOut = ""
    '    Me.WarpField4.Name = "WarpField4"
    '    Me.WarpField4.Size = New System.Drawing.Size(84, 24)
    '    Me.WarpField4.TabIndex = CType(8, Short)
    '    Me.WarpField4.Text = "Case-No"
    '    '
    '    'wfTRM
    '    '
    '    Me.wfTRM.BcrFlag = True
    '    Me.wfTRM.DecimalPointPosition = CType(0, Short)
    '    Me.wfTRM.DisplayAttribute.Bold = True
    '    Me.wfTRM.Font = New System.Drawing.Font("lr SVbN", 28.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfTRM.FontSize = WarpControl.FontSizes.Small
    '    Me.wfTRM.Format = ""
    '    Me.wfTRM.InputAttribute.Bold = True
    '    Me.wfTRM.Length = CType(3, Short)
    '    Me.wfTRM.Location = New System.Drawing.Point(180, 36)
    '    Me.wfTRM.MacroBcr = ""
    '    Me.wfTRM.MacroIn = ""
    '    Me.wfTRM.MacroKey = ""
    '    Me.wfTRM.MacroOut = ""
    '    Me.wfTRM.Name = "wfTRM"
    '    Me.wfTRM.Size = New System.Drawing.Size(45, 30)
    '    Me.wfTRM.TabIndex = CType(7, Short)
    '    Me.wfTRM.Text = "XXX"
    '    '
    '    'wfPNT
    '    '
    '    Me.wfPNT.BcrFlag = True
    '    Me.wfPNT.DecimalPointPosition = CType(0, Short)
    '    Me.wfPNT.DisplayAttribute.Bold = True
    '    Me.wfPNT.Font = New System.Drawing.Font("lr SVbN", 28.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfPNT.FontSize = WarpControl.FontSizes.Small
    '    Me.wfPNT.Format = ""
    '    Me.wfPNT.InputAttribute.Bold = True
    '    Me.wfPNT.Length = CType(3, Short)
    '    Me.wfPNT.Location = New System.Drawing.Point(60, 36)
    '    Me.wfPNT.MacroBcr = ""
    '    Me.wfPNT.MacroIn = ""
    '    Me.wfPNT.MacroKey = ""
    '    Me.wfPNT.MacroOut = ""
    '    Me.wfPNT.Name = "wfPNT"
    '    Me.wfPNT.Size = New System.Drawing.Size(45, 30)
    '    Me.wfPNT.TabIndex = CType(3, Short)
    '    Me.wfPNT.Text = "XXX"
    '    '
    '    'WarpField3
    '    '
    '    Me.WarpField3.BcrFlag = True
    '    Me.WarpField3.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField3.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField3.FontSize = WarpControl.FontSizes.Small2
    '    Me.WarpField3.Format = ""
    '    Me.WarpField3.Length = CType(3, Short)
    '    Me.WarpField3.Location = New System.Drawing.Point(132, 36)
    '    Me.WarpField3.MacroBcr = ""
    '    Me.WarpField3.MacroIn = ""
    '    Me.WarpField3.MacroKey = ""
    '    Me.WarpField3.MacroOut = ""
    '    Me.WarpField3.Name = "WarpField3"
    '    Me.WarpField3.Size = New System.Drawing.Size(36, 24)
    '    Me.WarpField3.TabIndex = CType(6, Short)
    '    Me.WarpField3.Text = "TRM"
    '    '
    '    'WarpField2
    '    '
    '    Me.WarpField2.BcrFlag = True
    '    Me.WarpField2.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField2.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField2.FontSize = WarpControl.FontSizes.Small2
    '    Me.WarpField2.Format = ""
    '    Me.WarpField2.Length = CType(3, Short)
    '    Me.WarpField2.Location = New System.Drawing.Point(12, 36)
    '    Me.WarpField2.MacroBcr = ""
    '    Me.WarpField2.MacroIn = ""
    '    Me.WarpField2.MacroKey = ""
    '    Me.WarpField2.MacroOut = ""
    '    Me.WarpField2.Name = "WarpField2"
    '    Me.WarpField2.Size = New System.Drawing.Size(36, 24)
    '    Me.WarpField2.TabIndex = CType(5, Short)
    '    Me.WarpField2.Text = "PNT"
    '    '
    '    'WarpField1
    '    '
    '    Me.WarpField1.BcrFlag = True
    '    Me.WarpField1.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField1.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField1.FontSize = WarpControl.FontSizes.Small2
    '    Me.WarpField1.Format = ""
    '    Me.WarpField1.Length = CType(3, Short)
    '    Me.WarpField1.Location = New System.Drawing.Point(12, 0)
    '    Me.WarpField1.MacroBcr = ""
    '    Me.WarpField1.MacroIn = ""
    '    Me.WarpField1.MacroKey = ""
    '    Me.WarpField1.MacroOut = ""
    '    Me.WarpField1.Name = "WarpField1"
    '    Me.WarpField1.Size = New System.Drawing.Size(36, 24)
    '    Me.WarpField1.TabIndex = CType(4, Short)
    '    Me.WarpField1.Text = "MSC"
    '    '
    '    'wfInput
    '    '
    '    Me.wfInput.BcrFlag = True
    '    Me.wfInput.DecimalPointPosition = CType(0, Short)
    '    Me.wfInput.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfInput.Format = ""
    '    Me.wfInput.InputMode.Secret = True
    '    Me.wfInput.Length = CType(1, Short)
    '    Me.wfInput.Location = New System.Drawing.Point(216, 0)
    '    Me.wfInput.MacroBcr = ""
    '    Me.wfInput.MacroIn = ""
    '    Me.wfInput.MacroKey = ""
    '    Me.wfInput.MacroOut = ""
    '    Me.wfInput.Name = "wfInput"
    '    Me.wfInput.Size = New System.Drawing.Size(18, 36)
    '    Me.wfInput.TabIndex = CType(3, Short)
    '    '
    '    'wfMSC
    '    '
    '    Me.wfMSC.BcrFlag = True
    '    Me.wfMSC.DecimalPointPosition = CType(0, Short)
    '    Me.wfMSC.DisplayAttribute.Bold = True
    '    Me.wfMSC.Font = New System.Drawing.Font("lr SVbN", 28.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfMSC.FontSize = WarpControl.FontSizes.Small
    '    Me.wfMSC.Format = ""
    '    Me.wfMSC.InputAttribute.Bold = True
    '    Me.wfMSC.Length = CType(8, Short)
    '    Me.wfMSC.Location = New System.Drawing.Point(84, 0)
    '    Me.wfMSC.MacroBcr = ""
    '    Me.wfMSC.MacroIn = ""
    '    Me.wfMSC.MacroKey = ""
    '    Me.wfMSC.MacroOut = ""
    '    Me.wfMSC.Name = "wfMSC"
    '    Me.wfMSC.Size = New System.Drawing.Size(120, 30)
    '    Me.wfMSC.TabIndex = CType(2, Short)
    '    Me.wfMSC.Text = "XXXX-XXX"
    '    '
    '    'wfName
    '    '
    '    Me.wfName.DecimalPointPosition = CType(0, Short)
    '    Me.wfName.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfName.FontSize = WarpControl.FontSizes.Small2
    '    Me.wfName.Format = ""
    '    Me.wfName.Length = CType(20, Short)
    '    Me.wfName.Location = New System.Drawing.Point(0, 216)
    '    Me.wfName.MacroBcr = ""
    '    Me.wfName.MacroIn = ""
    '    Me.wfName.MacroKey = ""
    '    Me.wfName.MacroOut = ""
    '    Me.wfName.Name = "wfName"
    '    Me.wfName.Size = New System.Drawing.Size(240, 24)
    '    Me.wfName.TabIndex = CType(1, Short)
    '    '
    '    'WarpBox1
    '    '
    '    Me.WarpBox1.BoxType = WarpControl.BoxTypes.Box
    '    Me.WarpBox1.DrawMode = WarpControl.DrawModes.Paint
    '    Me.WarpBox1.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpBox1.ForeColor = CType(15, Short)
    '    Me.WarpBox1.Image = "C:\H081-0070.jpg"
    '    Me.WarpBox1.Location = New System.Drawing.Point(0, 192)
    '    Me.WarpBox1.Name = "WarpBox1"
    '    Me.WarpBox1.Size = New System.Drawing.Size(240, 24)
    '    Me.WarpBox1.TabIndex = 0
    '    Me.WarpBox1.Text = "WarpBox1"
    '    '
    '    'WarpHWBcr1
    '    '
    '    Me.WarpHWBcr1.Decode.Code39 = True
    '    Me.WarpHWBcr1.DiscreteFirstLen = CType(0, Short)
    '    Me.WarpHWBcr1.DiscreteSecondLen = CType(0, Short)
    '    Me.WarpHWBcr1.InterleavedFirstLen = CType(0, Short)
    '    Me.WarpHWBcr1.InterleavedSecondLen = CType(0, Short)
    '    '
    '    'frm7014
    '    '
    '    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 12)
    '    Me.ClientSize = New System.Drawing.Size(240, 296)
    '    Me.Controls.Add(Me.WarpFrame1)
    '    Me.Font = New System.Drawing.Font("MS UI Gothic", 9.0!)
    '    Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
    '    Me.Name = "frm7014"
    '    Me.Text = "Form2"
    '    Me.WarpFrame1.ResumeLayout(False)
    '    Me.ResumeLayout(False)

    'End Sub

#End Region

    Public Enum M7014_STATUS As Integer
        INIT = 0
        MENUBACK = 1
        SHUTDOWN = 2
        NOTI = 3
        COMPLETED = 4
        NOTEXIST = 5
        DONE = 6
    End Enum

    Public mint7014status As Integer

    Private Sub frm7014_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        Select Case e.KeyCode.ToString()
            Case "Return"
                Exit Sub
            Case "F1"
            Case "F2"
                gintStatus = OTR_STATUS.QUIT
                Me.Close()
                Exit Sub
        End Select
    End Sub

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

        '// Case QVGA -> resolution to 1/2
        If System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width = 240 Then
            Call resolution.VGAtoQVGA(Me)
        End If

        Dim wstrImage As String
        Dim rtn As Integer

        Try
            mint7014status = M7014_STATUS.INIT

            't[€ฬI[v“
            'rtn = WarpFrame1.Open
            'If (rtn <> 0) Then
            '    Err.Raise(vbObjectError + 1, gAppName, "WarpError")
            'End If

#If Not Debug Then
            'sSetImgFName(G_CONST_MID_H7014, WarpBox1)

#Else
            'WarpBox1.Text = "xแJ[g“x๐XL“"
#End If
            sDisp7014()
            ' tH[€EC“ ภs
            sMain()

            ' t[€ฬN[Y
            'rtn = WarpFrame1.Close()
            'If (rtn <> 0) Then
            '    Err.Raise(vbObjectError + 1, gAppName, "WarpError")
            'End If

            ' tH[€EN[Y
            'Me.Close()

            Exit Sub


        Catch ex As Exception

        End Try

    End Sub

    '/*
    '|| ึ”–ผFsDisp7014
    '|| T—v  F7014ๆ–ส•\ฆ
    '*/
    Private Sub sDisp7014()

        sClrAll()
        'wfName.Puts(gstrctKDHT.strUserName)

        wfName.Text = gstrctKDHT.strUserName

    End Sub

    Private Sub btScanLib_OnScan(ByVal result As String)
        Dim buf As String = result
        Dim rtn As Integer
        Dim rtn2 As Integer

        If (Not fCheckCode(buf)) Then
            sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
#If Not Debug Then
                        fFnc_WrpMsg("E", G_CONST_MID_E5E15)
#End If
            Exit Sub
        End If

        '“—อ—
        rtn = fProcInput(RTrim(buf))

        If rtn = 0 Then
            Select Case mint7014status
                Case M7014_STATUS.INIT

                    RemoveHandler btScanLib.OnScan, AddressOf btScanLib_OnScan
                    btScanLib.Disable()

                    gintStatus = OTR_STATUS.CLABEL
                    Me.Close()
                    Exit Sub
                    '                                gintStatus = TR_STATUS.LOCATION

                Case M7014_STATUS.MENUBACK          'HTCTRL.ExeName๐มตฤI—น

                    RemoveHandler btScanLib.OnScan, AddressOf btScanLib_OnScan
                    btScanLib.Disable()

                    gintStatus = OTR_STATUS.CLSCAN
                    Me.Close()
                    Exit Sub

                Case M7014_STATUS.SHUTDOWN          'HTCTRL.ExeName๐มตฤI—น
                    sFinishApp()
                    gintStatus = OTR_STATUS.QUIT
                    Me.Close()
                    Exit Sub

                Case M7014_STATUS.NOTI             'GศOศฬลดืฐาฏพฐผ
                    sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
                    sOutputLog(gstrctPicsIni.strOutput_KDPP, "KDPP5E15", G_CONST_BC_USER, buf)
#If Not Debug Then
                                fFnc_WrpMsg("E", G_CONST_MID_E5E15)
#End If
                    Exit Sub
                Case M7014_STATUS.NOTEXIST          'Qฦรฐภษ–ณขฬลดืฐาฏพฐผ
                    sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
#If Not Debug Then
                                fFnc_WrpMsg("E", G_CONST_MID_E5E20)
#End If
                    Exit Sub
                Case M7014_STATUS.DONE              'ณํษQฦลซฝ

                    RemoveHandler btScanLib.OnScan, AddressOf btScanLib_OnScan
                    btScanLib.Disable()

                    gintStatus = OTR_STATUS.HEADER
                    Me.Close()
                    Exit Sub

            End Select

        Else

            'f0.WarpCtrl1.MessageBox(G_CONST_EMT_DB, G_CONST_EM_DB, MWA_DB_WARNING, MWA_DB_OK)
            'f0.WarpCtrl1.MessageBox(G_CONST_EMT_DB, fEditErrorInfo(gclsDB.BtriveStatus, gclsDB.ErrFile), MWA_DB_WARNING, MWA_DB_OK)
            MessageBox.Show(G_CONST_EM_DB, G_CONST_EMT_DB, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)

        End If



    End Sub



    ' t[€EC“
    Public Sub sMain()

        '        Dim WKey As Short
        '        Dim buf As String
        '        Dim rtn As Integer

        '        Try

        '            ' t[€ฬ—๐ฑฑษLqตทB
        '            Do While (True)

        '                ' R[h“—อ
        '                WKey = WarpFrame1.Input(wfInput)

        '                If WKey = WKY_ENT Then

        '                    'fSakusei2()

        '                ElseIf WKey = WKY_BCR Then

        '                    'สฐบฐฤ“—อฬๆ“พ
        '                    rtn = WarpHWBcr1.Get(buf)
        '                    sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.OK)
        '                    If (rtn <> 0) Then
        '                        Err.Raise(vbObjectError + 1, gAppName, "WarpError")
        '                    End If

        '                    'มชฏธรจผฏฤ
        '                    If (Not fCheckCode(buf)) Then
        '                        sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
        '#If Not Debug Then
        '                        fFnc_WrpMsg("E", G_CONST_MID_E5E15)
        '#End If
        '                        Exit Do
        '                    End If

        '                    '“—อ—
        '                    rtn = fProcInput(RTrim(buf))

        '                    If rtn = 0 Then
        '                        Select Case mint7014status
        '                            Case M7014_STATUS.INIT
        '                                gintStatus = OTR_STATUS.CLABEL
        '                                '                                gintStatus = TR_STATUS.LOCATION

        '                            Case M7014_STATUS.MENUBACK          'HTCTRL.ExeName๐มตฤI—น

        '                                gintStatus = OTR_STATUS.CLSCAN

        '                            Case M7014_STATUS.SHUTDOWN          'HTCTRL.ExeName๐มตฤI—น
        '                                sFinishApp()
        '                                gintStatus = OTR_STATUS.QUIT

        '                            Case M7014_STATUS.NOTI             'GศOศฬลดืฐาฏพฐผ
        '                                sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
        '                                sOutputLog(gstrctPicsIni.strOutput_KDPP, "KDPP5E15", G_CONST_BC_USER, buf)
        '#If Not Debug Then
        '                                fFnc_WrpMsg("E", G_CONST_MID_E5E15)
        '#End If
        '                            Case M7014_STATUS.NOTEXIST          'Qฦรฐภษ–ณขฬลดืฐาฏพฐผ
        '                                sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
        '#If Not Debug Then
        '                                fFnc_WrpMsg("E", G_CONST_MID_E5E20)
        '#End If
        '                            Case M7014_STATUS.DONE              'ณํษQฦลซฝ
        '                                gintStatus = OTR_STATUS.HEADER

        '                        End Select

        '                    Else

        '                        'f0.WarpCtrl1.MessageBox(G_CONST_EMT_DB, G_CONST_EM_DB, MWA_DB_WARNING, MWA_DB_OK)
        '                        f0.WarpCtrl1.MessageBox(G_CONST_EMT_DB, fEditErrorInfo(gclsDB.BtriveStatus, gclsDB.ErrFile), MWA_DB_WARNING, MWA_DB_OK)

        '                    End If
        '                    Exit Do

        '                ElseIf WKey = WKY_F1 Then


        '                ElseIf WKey = WKY_F2 Then


        '                ElseIf WKey = WKY_ERROR Then

        '                    f0.WarpCtrl1.MessageBox(G_CONST_EMT_WARP, G_CONST_EM_WARP, MWA_DB_WARNING, MWA_DB_OK)

        '                End If

        '            Loop

        '            Exit Sub

        '        Catch ex As Exception
        '            'gintStatus = TR_STATUS.QUIT
        '            sErrLog(gAppName, "sMain", ex.ToString)
        '        End Try

    End Sub
    '/*
    '|| ึ”–ผFfProcInput
    '|| T—v  F“—อ—
    '*/
    Private Function fProcInput(ByVal pstrInput As String) As Integer

        Dim rtn As Integer
        Dim wstrEmplCode As String
        Dim wstrKey(2) As String
        Dim wstrKeyValue(2) As String
        Dim wintRet As Integer
        Dim wintCnt As Integer
        Dim bFound As Boolean
        Dim wstrWhere As String

        fProcInput = -1

        Try

            If pstrInput = "OCMENUBACK" Then             'OCMENUBACKศ็ฮ

                mint7014status = M7014_STATUS.MENUBACK
                fProcInput = 0
                Exit Function

            ElseIf pstrInput = "OCSHUTDOWN" Then             'OCSHUTDOWNศ็ฮ

                mint7014status = M7014_STATUS.SHUTDOWN
                fProcInput = 0
                Exit Function

            ElseIf pstrInput.StartsWith("I") Then        'ๆ“ชชIศ็ฮ

                If pstrInput.Length <> 26 Then
                    mint7014status = M7014_STATUS.NOTI
                    fProcInput = 0
                    Exit Function
                End If

                'gstrctKDPP.initialize()
                gstrctPPDisp.initialize()
                gstrctPPDisp.intNumOfScanned = 0
                Erase gastrctPPDispPart
                ReDim gastrctPPDispPart(4)
                wintCnt = 0
                bFound = False

                ''// ฤืปธผฎJn
                'BtLib.Transaction.BeginConCurrent()

                '๕๐Jnตท
                wstrKey(0) = "ItemCode"
                wstrKey(1) = "ItemInCode"
                wstrKey(2) = "PlanSerial"
                wstrKeyValue(0) = RTrim(Mid(pstrInput, 2, 25))
                wstrKeyValue(1) = Space(30)
                wstrKeyValue(2) = Space(6)


                wstrWhere = ""
                wstrWhere = wstrKey(0) & " = '" & wstrKeyValue(0) & "'"
                wstrWhere &= " and " & wstrKey(1) & " = '" & wstrKeyValue(1) & "'"
                wstrWhere &= " and " & wstrKey(2) & " = '" & wstrKeyValue(2) & "'"

                tmpStr = dbClient.Query("SELECT * FROM " + G_CONST_TBL_PACKCP + " WHERE " + wstrWhere)

                tmpStr_PACKCP = tmpStr

                Dim values As Dictionary(Of String, String) = New Dictionary(Of String, String)
                Dim sItemCode As String = ""
                Dim sItemGr As String = ""
                Dim sItemMCode As String = ""
                Dim sLine As String = ""
                Dim sPickFlag As String = ""
                Dim sBhk As String = ""
                Dim sCenterCode As String = ""
                Dim sSectionID As String = ""
                Dim sSection As String = ""

                Dim sItemInCodeDisp As String = ""
                Dim sItemInCode As String = ""
                Dim sBunkatuJ As String = ""

                Dim i As Integer = 0

                If tmpStr.Count > 0 Then

                    Do

                        values = tmpStr(i)

                        Dim result As String = Nothing
                        If values.TryGetValue("ItemCode", result) Then
                            sItemCode = RTrim(result)
                        End If
                        If values.TryGetValue("ItemGr", result) Then
                            sItemGr = RTrim(result)
                        End If
                        If values.TryGetValue("ItemMCode", result) Then
                            sItemMCode = RTrim(result)
                        End If
                        If values.TryGetValue("Line", result) Then
                            sLine = RTrim(result)
                        End If
                        If values.TryGetValue("PickFlag", result) Then
                            sPickFlag = RTrim(result)
                        End If
                        If values.TryGetValue("Bhk", result) Then
                            sBhk = RTrim(result)
                        End If
                        If values.TryGetValue("CenterCode", result) Then
                            sCenterCode = RTrim(result)
                        End If
                        If values.TryGetValue("SectionID", result) Then
                            sSectionID = RTrim(result)
                        End If
                        If values.TryGetValue("Section", result) Then
                            sSection = RTrim(result)
                        End If
                        If values.TryGetValue("ItemInCodeDisp", result) Then
                            sItemInCodeDisp = RTrim(result)
                        End If
                        If values.TryGetValue("ItemInCode", result) Then
                            sItemInCode = RTrim(result)
                        End If
                        If values.TryGetValue("BunkatuJ", result) Then
                            sBunkatuJ = RTrim(result)
                        End If

                        If wstrKeyValue(0) = RTrim(sItemCode) Then

                            gstrctKDPP.strItemGr = RTrim(sItemGr)
                            gstrctPPDisp.strAic = Mid(RTrim(sItemGr), 1, 13)
                            gstrctPPDisp.strCaseNo = Mid(RTrim(sItemGr), 14, 7)
                            gstrctPPDisp.strCrtnFrom = Mid(RTrim(sItemGr), 21, 5)
                            gstrctPPDisp.strCrtnTo = Mid(RTrim(sItemGr), 26, 5)
                            gstrctPPDisp.strCrtnType = RTrim(sItemMCode)
                            gstrctPPDisp.strItemCode = RTrim(sItemCode)
                            gstrctPPDisp.strMsc = Mid(RTrim(sItemGr), 1, 7)
                            gstrctPPDisp.strPNT = Mid(RTrim(sItemGr), 8, 3)
                            gstrctPPDisp.strTRM = Mid(RTrim(sItemGr), 11, 3)
                            gstrctPPDisp.strCrtnType = RTrim(sItemMCode)
                            gstrctPPDisp.strLine = RTrim(sLine)

                            If G_CONST_ST_PKCP_NOSTOCK = RTrim(sPickFlag) Then

                                bFound = True
                                gstrctKDPP.strBhk = RTrim(sBhk)
                                gstrctKDPP.strCenterCode = RTrim(sCenterCode)
                                'gstrctKDPP.strSectionID = RTrim(sSectionID)
                                'gstrctKDPP.strSection = RTrim(sSection)
                                gstrctKDPP.strItemGr = RTrim(sItemGr)
                                gstrctPPDisp.strCrtnFrom = Mid(RTrim(sItemGr), 21, 5)
                                gstrctPPDisp.strCrtnTo = Mid(RTrim(sItemGr), 26, 5)
                                gstrctPPDisp.strCrtnNo = Mid(RTrim(sItemCode), 21, 5)
                                gstrctPPDisp.intNumOfPkg += 1

                                rtn = fSearchStock2("PKCP1")
                                If rtn = -1 Then
                                    'gclsDB.fCloseRecord("PKCP1")
                                    'BtLib.Transaction.Abort()
                                    Exit Function
                                End If

                                If wintCnt < 3 Then
                                    gastrctPPDispPart(wintCnt).strPartNoDisp = Mid(RTrim(sItemInCodeDisp), 1, 12)
                                    gastrctPPDispPart(wintCnt).strCL = Mid(RTrim(sItemInCode), 11, 2)
                                    gastrctPPDispPart(wintCnt).strZ = Mid(RTrim(sItemInCode), 13, 1)
                                    gastrctPPDispPart(wintCnt).strPackQty = RTrim(sBunkatuJ)
                                End If

                                wintCnt += 1

                                'BtLib.Transaction.End()

                                'Exit Do

                            End If
                        Else
                            Exit Do
                        End If





                        i = i + 1

                        If tmpStr.Count = i Then
                            Exit Do
                        End If


                    Loop


                ElseIf wintCnt = -1 Then
                    fProcInput = -1
                    'gclsDB.fCloseRecord("PKCP1")
                    Exit Function

                Else

                    mint7014status = M7014_STATUS.NOTEXIST
                    fProcInput = 0
                    'gclsDB.fCloseRecord("PKCP1")
                    'BtLib.Transaction.Abort()
                    Exit Function


                End If


            Else

                mint7014status = M7014_STATUS.NOTI
                fProcInput = 0
                Exit Function

            End If

            If bFound Then
                mint7014status = M7014_STATUS.DONE
                rtn = fUpdateHTCTRL()
                If rtn = -1 Then
                    'f0.WarpCtrl1.MessageBox(G_CONST_EMT_DB, G_CONST_EM_DB, MWA_DB_WARNING, MWA_DB_OK)
                    'f0.WarpCtrl1.MessageBox(G_CONST_EMT_DB, fEditErrorInfo(gclsDB.BtriveStatus, gclsDB.ErrFile), MWA_DB_WARNING, MWA_DB_OK)
                    MessageBox.Show(G_CONST_EM_DB, G_CONST_EMT_DB, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)


                End If
            Else
                mint7014status = M7014_STATUS.NOTEXIST
            End If

            fProcInput = 0
            Exit Function

        Catch ex As Exception
            sErrLog(gAppName, "fProcInput", ex.ToString)
        End Try



                'wintRet = gclsDB.fOpenRecord(G_CONST_TBL_PACKCP, G_CONST_KEY_PACKCPKEY06, "PKCP1", wstrKey, wstrKeyValue, BtLib.Operation.GetGreaterOrEqual)

                'If wintRet = 0 Then

                'gclsDB.fCloseRecord("PKCP1")

                ''Do Loop๐Qdษ   —v“ข
                'Do
                'wintRet = gclsDB.fOpenRecord(G_CONST_TBL_PACKCP, G_CONST_KEY_PACKCPKEY00, "PKCP1", wstrKey, wstrKeyValue, BtLib.Operation.GetGreaterOrEqual)
                'If wintRet = -1 Then
                '    gclsDB.fCloseRecord("PKCP1")
                '    BtLib.Transaction.Abort()
                '    Exit Function
                'ElseIf wintRet = 9 Then
                '    If bFound Then
                '        Exit Do
                '    Else
                '        gclsDB.fCloseRecord("PKCP1")
                '        BtLib.Transaction.Abort()
                '        Exit Function
                '    End If
                'End If

                'Do

                '    '// ฤืปธผฎJn
                '    'BtLib.Transaction.Begin()

                '    With gclsDB.Records("PKCP1")
                '        If wstrKeyValue(0) = RTrim(.Item("ItemCode")) Then

                '            gstrctKDPP.strItemGr = RTrim(.Item("ItemGr"))
                '            gstrctPPDisp.strAic = Mid(RTrim(.Item("ItemGr")), 1, 13)
                '            gstrctPPDisp.strCaseNo = Mid(RTrim(.Item("ItemGr")), 14, 7)
                '            gstrctPPDisp.strCrtnFrom = Mid(RTrim(.Item("ItemGr")), 21, 5)
                '            gstrctPPDisp.strCrtnTo = Mid(RTrim(.Item("ItemGr")), 26, 5)
                '            gstrctPPDisp.strCrtnType = RTrim(.Item("ItemMCode"))
                '            gstrctPPDisp.strItemCode = RTrim(.Item("ItemCode"))
                '            gstrctPPDisp.strMsc = Mid(RTrim(.Item("ItemGr")), 1, 7)
                '            gstrctPPDisp.strPNT = Mid(RTrim(.Item("ItemGr")), 8, 3)
                '            gstrctPPDisp.strTRM = Mid(RTrim(.Item("ItemGr")), 11, 3)
                '            gstrctPPDisp.strCrtnType = RTrim(.Item("ItemMCode"))
                '            gstrctPPDisp.strLine = RTrim(.Item("Line"))

                '            If G_CONST_ST_PKCP_NOSTOCK = RTrim(.Item("PickFlag")) Then

                '                bFound = True
                '                gstrctKDPP.strBhk = RTrim(.Item("Bhk"))
                '                gstrctKDPP.strCenterCode = RTrim(.Item("CenterCode"))
                '                'gstrctKDPP.strSectionID = RTrim(.Item("SectionID"))
                '                'gstrctKDPP.strSection = RTrim(.Item("Section"))
                '                gstrctKDPP.strItemGr = RTrim(.Item("ItemGr"))
                '                gstrctPPDisp.strCrtnFrom = Mid(RTrim(.Item("ItemGr")), 21, 5)
                '                gstrctPPDisp.strCrtnTo = Mid(RTrim(.Item("ItemGr")), 26, 5)
                '                gstrctPPDisp.strCrtnNo = Mid(RTrim(.Item("ItemCode")), 21, 5)
                '                gstrctPPDisp.intNumOfPkg += 1

                '                rtn = fSearchStock2("PKCP1")
                '                If rtn = -1 Then
                '                    gclsDB.fCloseRecord("PKCP1")
                '                    BtLib.Transaction.Abort()
                '                    Exit Function
                '                End If

                '                If wintCnt < 3 Then
                '                    gastrctPPDispPart(wintCnt).strPartNoDisp = Mid(RTrim(.Item("ItemInCodeDisp")), 1, 12)
                '                    gastrctPPDispPart(wintCnt).strCL = Mid(RTrim(.Item("ItemInCode")), 11, 2)
                '                    gastrctPPDispPart(wintCnt).strZ = Mid(RTrim(.Item("ItemInCode")), 13, 1)
                '                    gastrctPPDispPart(wintCnt).strPackQty = RTrim(.Item("BunkatuJ"))
                '                End If

                '                wintCnt += 1

                '                'BtLib.Transaction.End()

                '                'Exit Do

                '            End If
                '        Else
                '            Exit Do
                '        End If

                '        'R[h๐ๆ“พท้
                '        If .Read(BtLib.Operation.GetNext) <> 0 Then
                '            'R[hชศญศ๊ฮI—นท้
                '            Exit Do
                '        End If

                '    End With

                'Loop
                'gclsDB.fCloseRecord("PKCP1")

                'Loop
                'gclsDB.fCloseRecord("PKCP1")

                'ElseIf wintCnt = -1 Then
                '    fProcInput = -1
                '    'gclsDB.fCloseRecord("PKCP1")
                '    Exit Function

                'Else

                '    mint7014status = M7014_STATUS.NOTEXIST
                '    fProcInput = 0
                '    'gclsDB.fCloseRecord("PKCP1")
                '    'BtLib.Transaction.Abort()
                '    Exit Function

                'End If

                'BtLib.Transaction.End()

                '    Else

                '        mint7014status = M7014_STATUS.NOTI
                '        fProcInput = 0
                '        Exit Function

                '    End If

                '    If bFound Then
                '        mint7014status = M7014_STATUS.DONE
                '        rtn = fUpdateHTCTRL()
                '        If rtn = -1 Then
                '            'f0.WarpCtrl1.MessageBox(G_CONST_EMT_DB, G_CONST_EM_DB, MWA_DB_WARNING, MWA_DB_OK)
                '            f0.WarpCtrl1.MessageBox(G_CONST_EMT_DB, fEditErrorInfo(gclsDB.BtriveStatus, gclsDB.ErrFile), MWA_DB_WARNING, MWA_DB_OK)
                '        End If
                '    Else
                '        mint7014status = M7014_STATUS.NOTEXIST
                '    End If

                '    fProcInput = 0
                '    Exit Function

                'Catch ex As Exception
                '    sErrLog(gAppName, "fProcInput", ex.ToString)
                'End Try

    End Function


    '/*
    '|| ึ”–ผFsClrAll
    '|| T—v  Fๆ–สNA
    '*/
    Private Sub sClrAll()

        wfMsc1.Text = " "
        wfMsc2.Text = " "
        wfPNT.Text = " "
        wfTRM.Text = " "
        wfCsNo1.Text = " "
        wfCsNo2.Text = " "
        wfCsNo3.Text = " "
        wfCartonNo.Text = " "
        wfType.Text = " "

    End Sub


    '/*
    '|| ึ”–ผFfSearchStock2
    '|| T—v  F
    '*/
    Public Function fSearchStock2(ByVal pstrKey As String) As Integer

        Dim wintRet As Integer
        Dim wstrLocation As String
        Dim wstrSerial As String
        Dim wstrCaseType As String
        Dim wstrItemGr As String
        Dim wstrctPackPlan2 As STRCT_KEY_PACKPLAN2

        fSearchStock2 = -1

        Dim values As Dictionary(Of String, String) = New Dictionary(Of String, String)
        Dim sPicsType As String = ""
        Dim sCstmid As String = ""
        Dim sCstmCode As String = ""
        Dim sCenterCode As String = ""
        Dim sProductDate As String = ""
        Dim sShift As String = ""
        Dim sLine As String = ""

        Dim sItemGr As String = ""
        Dim swstrItemGr As String = ""
        Dim sItemInID As String = ""
        Dim sItemInCode As String = ""
        Dim sPartID As String = ""


        If tmpStr_PACKCP.Count > 0 Then

            values = tmpStr(0)

            Dim result As String = Nothing
            If values.TryGetValue("PicsType", result) Then
                sPicsType = RTrim(result)
            End If
            If values.TryGetValue("Cstmid", result) Then
                sCstmid = RTrim(result)
            End If
            If values.TryGetValue("CstmCode", result) Then
                sCstmCode = RTrim(result)
            End If
            If values.TryGetValue("CenterCode", result) Then
                sCenterCode = RTrim(result)
            End If
            If values.TryGetValue("ProductDate", result) Then
                sProductDate = RTrim(result)
            End If
            If values.TryGetValue("Shift", result) Then
                sShift = RTrim(result)
            End If
            If values.TryGetValue("Line", result) Then
                sLine = RTrim(result)
            End If
            If values.TryGetValue("ItemGr", result) Then
                sItemGr = RTrim(result)
            End If
            If values.TryGetValue("wstrItemGr", result) Then
                swstrItemGr = RTrim(result)
            End If
            If values.TryGetValue("ItemInID", result) Then
                sItemInID = RTrim(result)
            End If
            If values.TryGetValue("ItemInCode", result) Then
                sItemInCode = RTrim(result)
            End If
            If values.TryGetValue("PartID", result) Then
                sPartID = RTrim(result)
            End If


            wstrctPackPlan2.PicsType = RTrim(sPicsType).PadRight(2, " ")
            wstrctPackPlan2.CstmID = RTrim(sCstmid).PadRight(1, " ")
            wstrctPackPlan2.CstmCode = RTrim(sCstmCode).PadRight(8, " ")
            wstrctPackPlan2.CenterCode = RTrim(sCenterCode).PadRight(5, " ")
            wstrctPackPlan2.PDATE = RTrim(sProductDate).PadRight(7, "") + RTrim(sShift).PadRight(1, " ")
            wstrctPackPlan2.Line = RTrim(sLine).PadRight(2, " ")

            wstrItemGr = RTrim(sItemGr).PadRight(30, " ")
            wstrctPackPlan2.Aic = Mid(wstrItemGr, 1, 13).PadRight(13, " ")
            wstrctPackPlan2.CaseNo = Mid(wstrItemGr, 14, 7).PadRight(7, " ")
            wstrctPackPlan2.CartonNo = Mid(wstrItemGr, 21, 5).PadRight(5, " ")

            wstrctPackPlan2.ItemID = RTrim(sItemInID).PadRight(1, " ")
            wstrctPackPlan2.ItemCode = RTrim(sItemInCode).PadRight(30, " ")
            wstrctPackPlan2.PartID = RTrim(sPartID).PadRight(1, " ")




        End If

        wstrctPackPlan2.SerialNo = Space(6)
        wstrctPackPlan2.TempSerial = Space(6)
        If fSearchPackPlan2(wstrctPackPlan2, wstrCaseType) = -1 Then Exit Function

        wintRet = fResetStock2(pstrKey, wstrLocation, wstrSerial, wstrCaseType)
        If wintRet = -1 Then
            Exit Function
        ElseIf wintRet = -2 Then
            'fSearchStock2 = -2
            'Exit Function
        Else
            gstrctKDPP.bRetry = True
        End If

        wintRet = fSetPKCP2(pstrKey, wstrLocation, wstrSerial, wstrCaseType)
        If wintRet = -1 Then
            Exit Function
        Else
            fSearchStock2 = 0
        End If





        'With gclsDB.Records(pstrKey)
        'wstrctPackPlan2.PicsType = RTrim(.Item("PicsType")).PadRight(2, " ")
        'wstrctPackPlan2.CstmID = RTrim(.Item("Cstmid")).PadRight(1, " ")
        'wstrctPackPlan2.CstmCode = RTrim(.Item("CstmCode")).PadRight(8, " ")
        'wstrctPackPlan2.CenterCode = RTrim(.Item("CenterCode")).PadRight(5, " ")
        'wstrctPackPlan2.PDATE = RTrim(.Item("ProductDate")).PadRight(7, "") + RTrim(.Item("Shift")).PadRight(1, " ")
        'wstrctPackPlan2.Line = RTrim(.Item("Line")).PadRight(2, " ")

        'wstrItemGr = RTrim(.Item("ItemGr")).PadRight(30, " ")
        'wstrctPackPlan2.Aic = Mid(wstrItemGr, 1, 13).PadRight(13, " ")
        'wstrctPackPlan2.CaseNo = Mid(wstrItemGr, 14, 7).PadRight(7, " ")
        'wstrctPackPlan2.CartonNo = Mid(wstrItemGr, 21, 5).PadRight(5, " ")

        'wstrctPackPlan2.ItemID = RTrim(.Item("ItemInID")).PadRight(1, " ")
        'wstrctPackPlan2.ItemCode = RTrim(.Item("ItemInCode")).PadRight(30, " ")
        'wstrctPackPlan2.PartID = RTrim(.Item("PartID")).PadRight(1, " ")
        'End With
        'wstrctPackPlan2.SerialNo = Space(6)
        'wstrctPackPlan2.TempSerial = Space(6)
        'If fSearchPackPlan2(wstrctPackPlan2, wstrCaseType) = -1 Then Exit Function

        'wintRet = fResetStock2(pstrKey, wstrLocation, wstrSerial, wstrCaseType)
        'If wintRet = -1 Then
        '    Exit Function
        'ElseIf wintRet = -2 Then
        '    'fSearchStock2 = -2
        '    'Exit Function
        'Else
        '    gstrctKDPP.bRetry = True
        'End If

        'wintRet = fSetPKCP2(pstrKey, wstrLocation, wstrSerial, wstrCaseType)
        'If wintRet = -1 Then
        '    Exit Function
        'Else
        '    fSearchStock2 = 0
        'End If

    End Function

    '/*
    '|| ึ”–ผFfResetStock2
    '|| T—v  F
    '*/
    Public Function fResetStock2(ByVal pstrKey As String, ByRef pstrLocation As String, ByRef pstrSerial As String, ByVal pstrCartonType As String) As Integer

        Dim rtn As Integer
        Dim wstrKey(12) As String
        Dim wstrKeyValue(12) As String
        Dim wstrLocation As String
        Dim wstrQty As String
        Dim wstrNewLocation As String
        Dim wstrNewSerial As String
        Dim wstrNewStockDate As String
        Dim wstrNewStockTime As String
        Dim wstrWhere As String

        Try

            fResetStock2 = -1


            Dim values As Dictionary(Of String, String) = New Dictionary(Of String, String)
            Dim sPicsType As String = ""
            Dim sCstmid As String = ""
            Dim sCstmCode As String = ""
            Dim sCenterCode As String = ""
            Dim sBhk As String = ""
            Dim sItemInID As String = ""
            Dim sItemInCode As String = ""

            Dim sBunkatuJ As String = ""
            Dim sItemMCode As String = ""
            Dim spstrCartonType As String = ""
            Dim sStockLctn As String = ""
            Dim sPackQtyP As String = ""


            If tmpStr_PACKCP.Count > 0 Then

                values = tmpStr(0)

                Dim result As String = Nothing
                If values.TryGetValue("PicsType", result) Then
                    sPicsType = RTrim(result)
                End If
                If values.TryGetValue("Cstmid", result) Then
                    sCstmid = RTrim(result)
                End If
                If values.TryGetValue("CstmCode", result) Then
                    sCstmCode = RTrim(result)
                End If
                If values.TryGetValue("CenterCode", result) Then
                    sCenterCode = RTrim(result)
                End If
                If values.TryGetValue("Bhk", result) Then
                    sBhk = RTrim(result)
                End If
                If values.TryGetValue("ItemInID", result) Then
                    sItemInID = RTrim(result)
                End If
                If values.TryGetValue("ItemInCode", result) Then
                    sItemInCode = RTrim(result)
                End If
                If values.TryGetValue("BunkatuJ", result) Then
                    sBunkatuJ = RTrim(result)
                End If
                If values.TryGetValue("ItemMCode", result) Then
                    sItemMCode = RTrim(result)
                End If
                If values.TryGetValue("pstrCartonType", result) Then
                    spstrCartonType = RTrim(result)
                End If
                If values.TryGetValue("StockLctn", result) Then
                    sStockLctn = RTrim(result)
                End If
                If values.TryGetValue("PackQtyP", result) Then
                    sPackQtyP = RTrim(result)
                End If

                wstrLocation = RTrim(sStockLctn)
                wstrQty = RTrim(sPackQtyP)

                wstrKeyValue(0) = RTrim(sPicsType)
                wstrKeyValue(1) = RTrim(sCstmid)
                wstrKeyValue(2) = RTrim(sCstmCode)
                wstrKeyValue(3) = RTrim(sCenterCode)
                wstrKeyValue(4) = RTrim(sBhk)
                wstrKeyValue(5) = RTrim(sItemInID)
                wstrKeyValue(6) = RTrim(sItemInCode)
                wstrKeyValue(7) = "3"
                wstrKeyValue(8) = RTrim(sBunkatuJ)
                'wstrKeyValue(9) = RTrim(sItemMCode)
                wstrKeyValue(9) = RTrim(pstrCartonType)
                wstrKeyValue(10) = Space(8)
                wstrKeyValue(11) = Space(4)
                wstrKeyValue(12) = Space(6)
                'gstrctPPDisp.strCrtnType = RTrim(sItemMCode)
                gstrctPPDisp.strCrtnType = RTrim(pstrCartonType)



            End If



            '// PKCPฉ็๕๐๐ๆ“พ
            'With gclsDB.Records(pstrKey)

            'wstrLocation = RTrim(.Item("StockLctn"))
            'wstrQty = RTrim(.Item("PackQtyP"))

            'wstrKeyValue(0) = RTrim(.Item("PicsType"))
            'wstrKeyValue(1) = RTrim(.Item("Cstmid"))
            'wstrKeyValue(2) = RTrim(.Item("CstmCode"))
            'wstrKeyValue(3) = RTrim(.Item("CenterCode"))
            'wstrKeyValue(4) = RTrim(.Item("Bhk"))
            'wstrKeyValue(5) = RTrim(.Item("ItemInID"))
            'wstrKeyValue(6) = RTrim(.Item("ItemInCode"))
            'wstrKeyValue(7) = "3"
            'wstrKeyValue(8) = RTrim(.Item("BunkatuJ"))
            ''wstrKeyValue(9) = RTrim(.Item("ItemMCode"))
            'wstrKeyValue(9) = RTrim(pstrCartonType)
            'wstrKeyValue(10) = Space(8)
            'wstrKeyValue(11) = Space(4)
            'wstrKeyValue(12) = Space(6)
            ''gstrctPPDisp.strCrtnType = RTrim(.Item("ItemMCode"))
            'gstrctPPDisp.strCrtnType = RTrim(pstrCartonType)

            'End With

            '// ‘ใ‘ึฬXgbNฬ๕
            wstrKey(0) = "PicsType"
            wstrKey(1) = "Cstmid"
            wstrKey(2) = "CstmCode"
            wstrKey(3) = "CenterCode"
            wstrKey(4) = "Bhk"
            wstrKey(5) = "Itemid"
            wstrKey(6) = "ItemCode"
            wstrKey(7) = "ZaikoStatus"
            wstrKey(8) = "Qty"
            wstrKey(9) = "CartonType"
            wstrKey(10) = "StockDate"
            wstrKey(11) = "StockTime"
            wstrKey(12) = "SerialNo"

            wstrWhere = ""
            wstrWhere = wstrKey(0) & " = '" & wstrKeyValue(0) & "' and "
            wstrWhere = wstrWhere & wstrKey(1) & " = '" & wstrKeyValue(1) & "' and "
            wstrWhere = wstrWhere & wstrKey(2) & " = '" & wstrKeyValue(2) & "' and "
            wstrWhere = wstrWhere & wstrKey(3) & " = '" & wstrKeyValue(3) & "' and "
            wstrWhere = wstrWhere & wstrKey(4) & " = '" & wstrKeyValue(4) & "' and "
            wstrWhere = wstrWhere & wstrKey(5) & " = '" & wstrKeyValue(5) & "' and "
            wstrWhere = wstrWhere & wstrKey(6) & " = '" & wstrKeyValue(6) & "' and "
            wstrWhere = wstrWhere & wstrKey(7) & " = '" & wstrKeyValue(7) & "' and "
            wstrWhere = wstrWhere & wstrKey(8) & " = '" & wstrKeyValue(8) & "' and "
            wstrWhere = wstrWhere & wstrKey(9) & " = '" & wstrKeyValue(9) & "' and "
            wstrWhere = wstrWhere & wstrKey(10) & " = '" & wstrKeyValue(10) & "' and "
            wstrWhere = wstrWhere & wstrKey(11) & " = '" & wstrKeyValue(11) & "' and "
            wstrWhere = wstrWhere & wstrKey(12) & " = '" & wstrKeyValue(12) & "'"

            values = New Dictionary(Of String, String)
            sPicsType = ""
            sCstmid = ""
            sCstmCode = ""
            sCenterCode = ""
            sBhk = ""
            Dim sItemid As String = ""
            Dim sItemCode As String = ""

            Dim sZaikoStatus As String = ""
            Dim sQty As String = ""
            Dim sCartonType As String = ""
            Dim sStockDate As String = ""
            Dim sStockTime As String = ""

            Dim sSerialNo As String = ""
            Dim sLocation As String = ""

            Dim i As Integer = 0

            If tmpStr.Count > 0 Then

                Do

                    values = tmpStr(i)

                    Dim result As String = Nothing
                    If values.TryGetValue("PicsType", result) Then
                        sPicsType = RTrim(result)
                    End If
                    If values.TryGetValue("Cstmid", result) Then
                        sCstmid = RTrim(result)
                    End If
                    If values.TryGetValue("CstmCode", result) Then
                        sCstmCode = RTrim(result)
                    End If
                    If values.TryGetValue("CenterCode", result) Then
                        sCenterCode = RTrim(result)
                    End If
                    If values.TryGetValue("Bhk", result) Then
                        sBhk = RTrim(result)
                    End If

                    If values.TryGetValue("Itemid", result) Then
                        sItemid = RTrim(result)
                    End If
                    If values.TryGetValue("ItemCode", result) Then
                        sItemCode = RTrim(result)
                    End If
                    If values.TryGetValue("ZaikoStatus", result) Then
                        sZaikoStatus = RTrim(result)
                    End If
                    If values.TryGetValue("Qty", result) Then
                        sQty = RTrim(result)
                    End If
                    If values.TryGetValue("CartonType", result) Then
                        sCartonType = RTrim(result)
                    End If
                    If values.TryGetValue("StockDate", result) Then
                        sStockDate = RTrim(result)
                    End If
                    If values.TryGetValue("StockTime", result) Then
                        sStockTime = RTrim(result)
                    End If
                    If values.TryGetValue("SerialNo", result) Then
                        sSerialNo = RTrim(result)
                    End If
                    If values.TryGetValue("Location", result) Then
                        sLocation = RTrim(result)
                    End If

                    If wstrKeyValue(0) = RTrim(sPicsType) And _
                           wstrKeyValue(1) = RTrim(sCstmid) And _
                           wstrKeyValue(2) = RTrim(sCstmCode) And _
                           wstrKeyValue(3) = RTrim(sCenterCode) And _
                           wstrKeyValue(4) = RTrim(sBhk) And _
                           wstrKeyValue(5) = RTrim(sItemid) And _
                           wstrKeyValue(6) = RTrim(sItemCode) And _
                           wstrKeyValue(7) = RTrim(sZaikoStatus) And _
                           wstrKeyValue(8) = RTrim(sQty) And _
                           wstrKeyValue(9) = RTrim(sCartonType) Then

                        wstrKeyValue(10) = RTrim(sStockDate)
                        wstrKeyValue(11) = RTrim(sStockTime)
                        wstrKeyValue(12) = RTrim(sSerialNo)

                        wstrNewLocation = RTrim(sLocation)
                        wstrNewSerial = RTrim(sSerialNo)


                        wstrWhere = ""
                        wstrWhere = wstrKey(0) & " = '" & wstrKeyValue(0) & "' and "
                        wstrWhere = wstrWhere & wstrKey(1) & " = '" & wstrKeyValue(1) & "' and "
                        wstrWhere = wstrWhere & wstrKey(2) & " = '" & wstrKeyValue(2) & "' and "
                        wstrWhere = wstrWhere & wstrKey(3) & " = '" & wstrKeyValue(3) & "' and "
                        wstrWhere = wstrWhere & wstrKey(4) & " = '" & wstrKeyValue(4) & "' and "
                        wstrWhere = wstrWhere & wstrKey(5) & " = '" & wstrKeyValue(5) & "' and "
                        wstrWhere = wstrWhere & wstrKey(6) & " = '" & wstrKeyValue(6) & "' and "
                        wstrWhere = wstrWhere & wstrKey(7) & " = '" & wstrKeyValue(7) & "' and "
                        wstrWhere = wstrWhere & wstrKey(8) & " = '" & wstrKeyValue(8) & "' and "
                        wstrWhere = wstrWhere & wstrKey(9) & " = '" & wstrKeyValue(9) & "' and "
                        wstrWhere = wstrWhere & wstrKey(10) & " = '" & wstrKeyValue(10) & "' and "
                        wstrWhere = wstrWhere & wstrKey(11) & " = '" & wstrKeyValue(11) & "' and "
                        wstrWhere = wstrWhere & wstrKey(12) & " = '" & wstrKeyValue(12) & "'"


                        affected_rows = dbClient.Execute("UPDATE " + G_CONST_TBL_STOCK + " SET ZaikoStatus='" _
                                                                 + G_CONST_ST_STOCK_RESERVED2 _
                                                                 + "' WHERE " + wstrWhere)


                        If affected_rows = 0 Then
                            Exit Function
                        End If


                        pstrLocation = wstrNewLocation
                        pstrSerial = wstrNewSerial
                        fResetStock2 = 0
                        Exit Function

                    Else
                        Exit Do


                    End If


                    i = i + 1

                    If tmpStr.Count = i Then
                        Exit Do
                    End If

                Loop


            Else

                Exit Function


            End If

            pstrLocation = "?????"
            pstrSerial = ""
            fResetStock2 = -2
            Exit Function

        Catch ex As Exception
            sErrLog(gAppName, "fResetStock2", ex.ToString)
        End Try




        'rtn = gclsDB.fOpenRecord(G_CONST_TBL_STOCK, G_CONST_KEY_STOCKKEY06, "STOCK1", wstrKey, wstrKeyValue, BtLib.Operation.GetGreaterOrEqual)

        'If rtn = 9 Then
        '    gclsDB.fCloseRecord("STOCK1")
        '    Exit Function
        'ElseIf rtn <> 0 Then
        '    gclsDB.fCloseRecord("STOCK1")
        '    Exit Function
        'End If

        'If rtn = 0 Then
        '    Do
        '        With gclsDB.Records("STOCK1")
        'If wstrKeyValue(0) = RTrim(.Item("PicsType")) And _
        '   wstrKeyValue(1) = RTrim(.Item("Cstmid")) And _
        '   wstrKeyValue(2) = RTrim(.Item("CstmCode")) And _
        '   wstrKeyValue(3) = RTrim(.Item("CenterCode")) And _
        '   wstrKeyValue(4) = RTrim(.Item("Bhk")) And _
        '   wstrKeyValue(5) = RTrim(.Item("Itemid")) And _
        '   wstrKeyValue(6) = RTrim(.Item("ItemCode")) And _
        '   wstrKeyValue(7) = RTrim(.Item("ZaikoStatus")) And _
        '   wstrKeyValue(8) = RTrim(.Item("Qty")) And _
        '   wstrKeyValue(9) = RTrim(.Item("CartonType")) Then

        '    wstrKeyValue(10) = RTrim(.Item("StockDate"))
        '    wstrKeyValue(11) = RTrim(.Item("StockTime"))
        '    wstrKeyValue(12) = RTrim(.Item("SerialNo"))

        '    wstrNewLocation = RTrim(.Item("Location"))
        '    wstrNewSerial = RTrim(.Item("SerialNo"))

        'With gclsDB
        '    .Setcolumn = "ZaikoStatus"
        '    .SetData = G_CONST_ST_STOCK_RESERVED2

        '    If .fUpdRecords(G_CONST_TBL_STOCK, G_CONST_KEY_STOCKKEY06, wstrKey, wstrKeyValue) = -1 Then
        '        Exit Function
        '    End If
        'End With

        'pstrLocation = wstrNewLocation
        'pstrSerial = wstrNewSerial
        'gclsDB.fCloseRecord("STOCK1")
        'fResetStock2 = 0
        'Exit Function

        'Else
        'Exit Do
        'End If

        'R[h๐ๆ“พท้
        '    If gclsDB.Records("STOCK1").Read(BtLib.Operation.GetNext) <> 0 Then
        '        'R[hชศญศ๊ฮI—นท้
        '        Exit Do
        '    End If

        '            End With
        '        Loop
        '    End If

        'gclsDB.fCloseRecord("STOCK1")

        'pstrLocation = "?????"
        'pstrSerial = ""
        'fResetStock2 = -2
        'Exit Function

        'Catch ex As Exception
        '    sErrLog(gAppName, "fResetStock2", ex.ToString)
        'End Try

    End Function

    '/*
    '|| ึ”–ผFfSetPKCP2
    '|| T—v  F
    '*/
    Public Function fSetPKCP2(ByVal pstrKey As String, ByVal pstrLocation As String, ByVal pstrSerial As String, ByVal pstrCartonType As String) As Integer

        Dim rtn As Integer
        Dim wstrKey(2) As String
        Dim wstrKeyValue(2) As String
        Dim wstrWhere As String

        Try

            fSetPKCP2 = -1

            Dim values As Dictionary(Of String, String) = New Dictionary(Of String, String)
            
            Dim sItemCode As String = ""
            Dim sItemInCode As String = ""

            Dim sPlanSerial As String = ""
            Dim sPackQtyP As String = ""


            If tmpStr_PACKCP.Count > 0 Then

                values = tmpStr(0)

                Dim result As String = Nothing
                If values.TryGetValue("ItemCode", result) Then
                    sItemCode = RTrim(result)
                End If
                If values.TryGetValue("ItemInCode", result) Then
                    sItemInCode = RTrim(result)
                End If
                If values.TryGetValue("PlanSerial", result) Then
                    sPlanSerial = RTrim(result)
                End If
                If values.TryGetValue("PackQtyP", result) Then
                    sPackQtyP = RTrim(result)
                End If

                wstrKey(0) = "ItemCode" : wstrKeyValue(0) = RTrim(sItemCode)
                wstrKey(1) = "ItemInCode" : wstrKeyValue(1) = RTrim(sItemInCode)
                wstrKey(2) = "PlanSerial" : wstrKeyValue(2) = RTrim(sPlanSerial)

            End If

            wstrWhere = ""
            wstrWhere = wstrKey(0) & " = '" & wstrKeyValue(0) & "'"
            wstrWhere &= " and " & wstrKey(1) & " = '" & wstrKeyValue(1) & "'"
            wstrWhere &= " and " & wstrKey(2) & " = '" & wstrKeyValue(2) & "'"

            affected_rows = dbClient.Execute("UPDATE " + G_CONST_TBL_PACKCP + " SET PickFlag='" _
                                                                 + G_CONST_ST_PKCP_INSTOCK _
                                                                 + "' , StockLctn='" _
                                                                 + pstrLocation _
                                                                 + "' , PlanSerial='" _
                                                                 + pstrSerial _
                                                                 + "' , ItemMCode='" _
                                                                 + pstrCartonType _
                                                                 + "' WHERE " + wstrWhere)

            gstrctPPDisp.fSetQty(gstrctPPDisp.strCrtnNo & pstrLocation & wstrKeyValue(1), CInt(RTrim(sPackQtyP)))
            gstrctPPDisp.fSetPkg(gstrctPPDisp.strCrtnNo & pstrLocation & wstrKeyValue(1), 1)

            fSetPKCP2 = 0

            Exit Function

        Catch ex As Exception
            sErrLog(gAppName, "fSetPKCP2", ex.ToString)
        End Try



        '// PKCPฉ็๕๐๐ๆ“พ
        'wstrKey(0) = "ItemCode" : wstrKeyValue(0) = RTrim(gclsDB.Records(pstrKey).Item("ItemCode"))
        'wstrKey(1) = "ItemInCode" : wstrKeyValue(1) = RTrim(gclsDB.Records(pstrKey).Item("ItemInCode"))
        'wstrKey(2) = "PlanSerial" : wstrKeyValue(2) = RTrim(gclsDB.Records(pstrKey).Item("PlanSerial"))

        'With gclsDB
        '    If pstrLocation <> "?????" Then
        '        .Setcolumn = "PickFlag,StockLctn,PlanSerial,ItemMCode"
        '        .SetData = G_CONST_ST_PKCP_INSTOCK & "," & pstrLocation & "," & pstrSerial & "," & pstrCartonType

        '        If .fUpdRecords(G_CONST_TBL_PACKCP, G_CONST_KEY_PACKCPKEY06, wstrKey, wstrKeyValue) = -1 Then
        '            Exit Function
        '        End If
        '    End If

        'End With

        'gstrctPPDisp.fSetQty(gstrctPPDisp.strCrtnNo & pstrLocation & wstrKeyValue(1), CInt(RTrim(gclsDB.Records(pstrKey).Item("PackQtyP"))))
        'gstrctPPDisp.fSetPkg(gstrctPPDisp.strCrtnNo & pstrLocation & wstrKeyValue(1), 1)

        'fSetPKCP2 = 0

        'Exit Function

        'Catch ex As Exception
        '    sErrLog(gAppName, "fSetPKCP2", ex.ToString)
        'End Try

    End Function

    Private Sub frm7014_Activated(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Activated
        ' Enable BTScanLib
        If Not scanHandler Then
            btScanLib = btScanLib.getInstance()
            AddHandler btScanLib.OnScan, AddressOf btScanLib_OnScan
            scanHandler = True
            btScanLib.Debug = False
            btScanLib.Enable()
        End If
    End Sub
End Class
