﻿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 KDPP2000.BtScanLib
Imports BTClientLib
Imports System.IO
Imports System.Reflection
Imports BtScan2

Public Class frm2025
    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

#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 WarpFrame1 As WarpControl.WarpFrame
    'Friend WithEvents WarpBox1 As WarpControl.WarpBox
    'Friend WithEvents WarpField10 As WarpControl.WarpField
    'Friend WithEvents WarpField2 As WarpControl.WarpField
    'Friend WithEvents WarpField5 As WarpControl.WarpField
    'Friend WithEvents WarpField11 As WarpControl.WarpField
    'Friend WithEvents WarpField13 As WarpControl.WarpField
    'Friend WithEvents WarpField14 As WarpControl.WarpField
    'Friend WithEvents wfCL As WarpControl.WarpField
    'Friend WithEvents wfZ As WarpControl.WarpField
    'Friend WithEvents wfName As WarpControl.WarpField
    'Friend WithEvents wfLctn2 As WarpControl.WarpField
    'Friend WithEvents wfLctn1 As WarpControl.WarpField
    'Friend WithEvents WarpHWBcr1 As WarpControl.WarpHWBcr
    'Friend WithEvents WarpField1 As WarpControl.WarpField
    'Friend WithEvents WarpField6 As WarpControl.WarpField
    'Friend WithEvents WarpField7 As WarpControl.WarpField
    'Friend WithEvents WarpField9 As WarpControl.WarpField
    'Friend WithEvents wfKey As WarpControl.WarpField
    'Friend WithEvents wfQty1 As WarpControl.WarpField
    'Friend WithEvents wfQty2 As WarpControl.WarpField
    'Friend WithEvents wfPkg2 As WarpControl.WarpField
    'Friend WithEvents wfPkg1 As WarpControl.WarpField
    'Friend WithEvents wfPart As WarpControl.WarpField
    'Friend WithEvents wfCrtnNo As WarpControl.WarpField
    'Friend WithEvents WarpField3 As WarpControl.WarpField
    'Friend WithEvents wfNumOfLoc As WarpControl.WarpField
    '<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    '    Me.WarpFrame1 = New WarpControl.WarpFrame()
    '    Me.wfNumOfLoc = New WarpControl.WarpField()
    '    Me.WarpField3 = New WarpControl.WarpField()
    '    Me.wfKey = New WarpControl.WarpField()
    '    Me.wfQty2 = New WarpControl.WarpField()
    '    Me.WarpField9 = New WarpControl.WarpField()
    '    Me.wfQty1 = New WarpControl.WarpField()
    '    Me.WarpField7 = New WarpControl.WarpField()
    '    Me.wfPkg2 = New WarpControl.WarpField()
    '    Me.WarpField6 = New WarpControl.WarpField()
    '    Me.wfPkg1 = New WarpControl.WarpField()
    '    Me.WarpField1 = New WarpControl.WarpField()
    '    Me.wfZ = New WarpControl.WarpField()
    '    Me.wfCL = New WarpControl.WarpField()
    '    Me.wfPart = New WarpControl.WarpField()
    '    Me.WarpField14 = New WarpControl.WarpField()
    '    Me.WarpField13 = New WarpControl.WarpField()
    '    Me.WarpField11 = New WarpControl.WarpField()
    '    Me.wfLctn2 = New WarpControl.WarpField()
    '    Me.WarpField5 = New WarpControl.WarpField()
    '    Me.wfLctn1 = New WarpControl.WarpField()
    '    Me.WarpField2 = New WarpControl.WarpField()
    '    Me.wfCrtnNo = New WarpControl.WarpField()
    '    Me.WarpField10 = 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.wfNumOfLoc)
    '    Me.WarpFrame1.Controls.Add(Me.WarpField3)
    '    Me.WarpFrame1.Controls.Add(Me.wfKey)
    '    Me.WarpFrame1.Controls.Add(Me.wfQty2)
    '    Me.WarpFrame1.Controls.Add(Me.WarpField9)
    '    Me.WarpFrame1.Controls.Add(Me.wfQty1)
    '    Me.WarpFrame1.Controls.Add(Me.WarpField7)
    '    Me.WarpFrame1.Controls.Add(Me.wfPkg2)
    '    Me.WarpFrame1.Controls.Add(Me.WarpField6)
    '    Me.WarpFrame1.Controls.Add(Me.wfPkg1)
    '    Me.WarpFrame1.Controls.Add(Me.WarpField1)
    '    Me.WarpFrame1.Controls.Add(Me.wfZ)
    '    Me.WarpFrame1.Controls.Add(Me.wfCL)
    '    Me.WarpFrame1.Controls.Add(Me.wfPart)
    '    Me.WarpFrame1.Controls.Add(Me.WarpField14)
    '    Me.WarpFrame1.Controls.Add(Me.WarpField13)
    '    Me.WarpFrame1.Controls.Add(Me.WarpField11)
    '    Me.WarpFrame1.Controls.Add(Me.wfLctn2)
    '    Me.WarpFrame1.Controls.Add(Me.WarpField5)
    '    Me.WarpFrame1.Controls.Add(Me.wfLctn1)
    '    Me.WarpFrame1.Controls.Add(Me.WarpField2)
    '    Me.WarpFrame1.Controls.Add(Me.wfCrtnNo)
    '    Me.WarpFrame1.Controls.Add(Me.WarpField10)
    '    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.Text = "WarpFrame1"
    '    Me.WarpFrame1.UseMacro = False
    '    Me.WarpFrame1.UseMacroFileName = ""
    '    '
    '    'wfNumOfLoc
    '    '
    '    Me.wfNumOfLoc.DecimalPointPosition = CType(0, Short)
    '    Me.wfNumOfLoc.DisplayAttribute.Bold = True
    '    Me.wfNumOfLoc.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfNumOfLoc.Format = ""
    '    Me.wfNumOfLoc.InputAttribute.Bold = True
    '    Me.wfNumOfLoc.Length = CType(2, Short)
    '    Me.wfNumOfLoc.Location = New System.Drawing.Point(204, 24)
    '    Me.wfNumOfLoc.MacroBcr = ""
    '    Me.wfNumOfLoc.MacroIn = ""
    '    Me.wfNumOfLoc.MacroKey = ""
    '    Me.wfNumOfLoc.MacroOut = ""
    '    Me.wfNumOfLoc.Name = "wfNumOfLoc"
    '    Me.wfNumOfLoc.Size = New System.Drawing.Size(36, 36)
    '    Me.wfNumOfLoc.TabIndex = CType(47, Short)
    '    Me.wfNumOfLoc.Text = "XX"
    '    '
    '    'WarpField3
    '    '
    '    Me.WarpField3.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField3.Font = New System.Drawing.Font("lr SVbN", 16.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField3.FontSize = WarpControl.FontSizes.Small4
    '    Me.WarpField3.Format = ""
    '    Me.WarpField3.Length = CType(6, Short)
    '    Me.WarpField3.Location = New System.Drawing.Point(186, 0)
    '    Me.WarpField3.MacroBcr = ""
    '    Me.WarpField3.MacroIn = ""
    '    Me.WarpField3.MacroKey = ""
    '    Me.WarpField3.MacroOut = ""
    '    Me.WarpField3.Name = "WarpField3"
    '    Me.WarpField3.Size = New System.Drawing.Size(54, 18)
    '    Me.WarpField3.TabIndex = CType(46, Short)
    '    Me.WarpField3.Text = "#ofLoc"
    '    '
    '    'wfKey
    '    '
    '    Me.wfKey.BcrFlag = True
    '    Me.wfKey.DecimalPointPosition = CType(0, Short)
    '    Me.wfKey.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfKey.ForeColor = CType(15, Short)
    '    Me.wfKey.Format = ""
    '    Me.wfKey.InputMode.Secret = True
    '    Me.wfKey.Length = CType(1, Short)
    '    Me.wfKey.Location = New System.Drawing.Point(156, 36)
    '    Me.wfKey.MacroBcr = ""
    '    Me.wfKey.MacroIn = ""
    '    Me.wfKey.MacroKey = ""
    '    Me.wfKey.MacroOut = ""
    '    Me.wfKey.Name = "wfKey"
    '    Me.wfKey.Size = New System.Drawing.Size(18, 36)
    '    Me.wfKey.TabIndex = CType(45, Short)
    '    '
    '    'wfQty2
    '    '
    '    Me.wfQty2.DecimalPointPosition = CType(0, Short)
    '    Me.wfQty2.DisplayAttribute.Bold = True
    '    Me.wfQty2.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfQty2.Format = ""
    '    Me.wfQty2.InputAttribute.Bold = True
    '    Me.wfQty2.InputMode.NumericOnly = True
    '    Me.wfQty2.InputMode.Right = True
    '    Me.wfQty2.Length = CType(4, Short)
    '    Me.wfQty2.Location = New System.Drawing.Point(165, 144)
    '    Me.wfQty2.MacroBcr = ""
    '    Me.wfQty2.MacroIn = ""
    '    Me.wfQty2.MacroKey = ""
    '    Me.wfQty2.MacroOut = ""
    '    Me.wfQty2.Name = "wfQty2"
    '    Me.wfQty2.Size = New System.Drawing.Size(72, 36)
    '    Me.wfQty2.TabIndex = CType(44, Short)
    '    Me.wfQty2.Text = "9"
    '    '
    '    'WarpField9
    '    '
    '    Me.WarpField9.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField9.DisplayAttribute.Bold = True
    '    Me.WarpField9.Font = New System.Drawing.Font("lr SVbN", 28.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField9.FontSize = WarpControl.FontSizes.Small
    '    Me.WarpField9.Format = ""
    '    Me.WarpField9.InputAttribute.Bold = True
    '    Me.WarpField9.Length = CType(1, Short)
    '    Me.WarpField9.Location = New System.Drawing.Point(153, 147)
    '    Me.WarpField9.MacroBcr = ""
    '    Me.WarpField9.MacroIn = ""
    '    Me.WarpField9.MacroKey = ""
    '    Me.WarpField9.MacroOut = ""
    '    Me.WarpField9.Name = "WarpField9"
    '    Me.WarpField9.Size = New System.Drawing.Size(15, 30)
    '    Me.WarpField9.TabIndex = CType(43, Short)
    '    Me.WarpField9.Text = "/"
    '    '
    '    'wfQty1
    '    '
    '    Me.wfQty1.DecimalPointPosition = CType(0, Short)
    '    Me.wfQty1.DisplayAttribute.Bold = True
    '    Me.wfQty1.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfQty1.Format = ""
    '    Me.wfQty1.InputAttribute.Bold = True
    '    Me.wfQty1.InputMode.NumericOnly = True
    '    Me.wfQty1.InputMode.Right = True
    '    Me.wfQty1.Length = CType(4, Short)
    '    Me.wfQty1.Location = New System.Drawing.Point(82, 144)
    '    Me.wfQty1.MacroBcr = ""
    '    Me.wfQty1.MacroIn = ""
    '    Me.wfQty1.MacroKey = ""
    '    Me.wfQty1.MacroOut = ""
    '    Me.wfQty1.Name = "wfQty1"
    '    Me.wfQty1.Size = New System.Drawing.Size(72, 36)
    '    Me.wfQty1.TabIndex = CType(42, Short)
    '    Me.wfQty1.Text = "9"
    '    '
    '    'WarpField7
    '    '
    '    Me.WarpField7.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField7.Font = New System.Drawing.Font("lr SVbN", 16.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField7.FontSize = WarpControl.FontSizes.Small4
    '    Me.WarpField7.Format = ""
    '    Me.WarpField7.Length = CType(3, Short)
    '    Me.WarpField7.Location = New System.Drawing.Point(105, 126)
    '    Me.WarpField7.MacroBcr = ""
    '    Me.WarpField7.MacroIn = ""
    '    Me.WarpField7.MacroKey = ""
    '    Me.WarpField7.MacroOut = ""
    '    Me.WarpField7.Name = "WarpField7"
    '    Me.WarpField7.Size = New System.Drawing.Size(27, 18)
    '    Me.WarpField7.TabIndex = CType(41, Short)
    '    Me.WarpField7.Text = "Qty"
    '    '
    '    'wfPkg2
    '    '
    '    Me.wfPkg2.DecimalPointPosition = CType(0, Short)
    '    Me.wfPkg2.DisplayAttribute.Bold = True
    '    Me.wfPkg2.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfPkg2.Format = ""
    '    Me.wfPkg2.InputAttribute.Bold = True
    '    Me.wfPkg2.InputMode.NumericOnly = True
    '    Me.wfPkg2.InputMode.Right = True
    '    Me.wfPkg2.Length = CType(2, Short)
    '    Me.wfPkg2.Location = New System.Drawing.Point(48, 144)
    '    Me.wfPkg2.MacroBcr = ""
    '    Me.wfPkg2.MacroIn = ""
    '    Me.wfPkg2.MacroKey = ""
    '    Me.wfPkg2.MacroOut = ""
    '    Me.wfPkg2.Name = "wfPkg2"
    '    Me.wfPkg2.Size = New System.Drawing.Size(36, 36)
    '    Me.wfPkg2.TabIndex = CType(40, Short)
    '    Me.wfPkg2.Text = "9"
    '    '
    '    'WarpField6
    '    '
    '    Me.WarpField6.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField6.DisplayAttribute.Bold = True
    '    Me.WarpField6.Font = New System.Drawing.Font("lr SVbN", 28.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField6.FontSize = WarpControl.FontSizes.Small
    '    Me.WarpField6.Format = ""
    '    Me.WarpField6.InputAttribute.Bold = True
    '    Me.WarpField6.Length = CType(1, Short)
    '    Me.WarpField6.Location = New System.Drawing.Point(36, 147)
    '    Me.WarpField6.MacroBcr = ""
    '    Me.WarpField6.MacroIn = ""
    '    Me.WarpField6.MacroKey = ""
    '    Me.WarpField6.MacroOut = ""
    '    Me.WarpField6.Name = "WarpField6"
    '    Me.WarpField6.Size = New System.Drawing.Size(15, 30)
    '    Me.WarpField6.TabIndex = CType(39, Short)
    '    Me.WarpField6.Text = "/"
    '    '
    '    'wfPkg1
    '    '
    '    Me.wfPkg1.DecimalPointPosition = CType(0, Short)
    '    Me.wfPkg1.DisplayAttribute.Bold = True
    '    Me.wfPkg1.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfPkg1.Format = ""
    '    Me.wfPkg1.InputAttribute.Bold = True
    '    Me.wfPkg1.InputMode.NumericOnly = True
    '    Me.wfPkg1.InputMode.Right = True
    '    Me.wfPkg1.Length = CType(2, Short)
    '    Me.wfPkg1.Location = New System.Drawing.Point(0, 144)
    '    Me.wfPkg1.MacroBcr = ""
    '    Me.wfPkg1.MacroIn = ""
    '    Me.wfPkg1.MacroKey = ""
    '    Me.wfPkg1.MacroOut = ""
    '    Me.wfPkg1.Name = "wfPkg1"
    '    Me.wfPkg1.Size = New System.Drawing.Size(36, 36)
    '    Me.wfPkg1.TabIndex = CType(38, Short)
    '    Me.wfPkg1.Text = "1"
    '    '
    '    'WarpField1
    '    '
    '    Me.WarpField1.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField1.Font = New System.Drawing.Font("lr SVbN", 16.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField1.FontSize = WarpControl.FontSizes.Small4
    '    Me.WarpField1.Format = ""
    '    Me.WarpField1.Length = CType(10, Short)
    '    Me.WarpField1.Location = New System.Drawing.Point(0, 126)
    '    Me.WarpField1.MacroBcr = ""
    '    Me.WarpField1.MacroIn = ""
    '    Me.WarpField1.MacroKey = ""
    '    Me.WarpField1.MacroOut = ""
    '    Me.WarpField1.Name = "WarpField1"
    '    Me.WarpField1.Size = New System.Drawing.Size(90, 18)
    '    Me.WarpField1.TabIndex = CType(37, Short)
    '    Me.WarpField1.Text = "#ofPackage"
    '    '
    '    'wfZ
    '    '
    '    Me.wfZ.DecimalPointPosition = CType(0, Short)
    '    Me.wfZ.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfZ.FontSize = WarpControl.FontSizes.Small2
    '    Me.wfZ.Format = ""
    '    Me.wfZ.Length = CType(1, Short)
    '    Me.wfZ.Location = New System.Drawing.Point(217, 99)
    '    Me.wfZ.MacroBcr = ""
    '    Me.wfZ.MacroIn = ""
    '    Me.wfZ.MacroKey = ""
    '    Me.wfZ.MacroOut = ""
    '    Me.wfZ.Name = "wfZ"
    '    Me.wfZ.Size = New System.Drawing.Size(12, 24)
    '    Me.wfZ.TabIndex = CType(36, Short)
    '    Me.wfZ.Text = "X"
    '    '
    '    'wfCL
    '    '
    '    Me.wfCL.DecimalPointPosition = CType(0, Short)
    '    Me.wfCL.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfCL.FontSize = WarpControl.FontSizes.Small2
    '    Me.wfCL.Format = ""
    '    Me.wfCL.Length = CType(2, Short)
    '    Me.wfCL.Location = New System.Drawing.Point(172, 99)
    '    Me.wfCL.MacroBcr = ""
    '    Me.wfCL.MacroIn = ""
    '    Me.wfCL.MacroKey = ""
    '    Me.wfCL.MacroOut = ""
    '    Me.wfCL.Name = "wfCL"
    '    Me.wfCL.Size = New System.Drawing.Size(24, 24)
    '    Me.wfCL.TabIndex = CType(35, Short)
    '    Me.wfCL.Text = "XX"
    '    '
    '    'wfPart
    '    '
    '    Me.wfPart.DecimalPointPosition = CType(0, Short)
    '    Me.wfPart.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfPart.FontSize = WarpControl.FontSizes.Small2
    '    Me.wfPart.Format = ""
    '    Me.wfPart.Length = CType(12, Short)
    '    Me.wfPart.Location = New System.Drawing.Point(4, 99)
    '    Me.wfPart.MacroBcr = ""
    '    Me.wfPart.MacroIn = ""
    '    Me.wfPart.MacroKey = ""
    '    Me.wfPart.MacroOut = ""
    '    Me.wfPart.Name = "wfPart"
    '    Me.wfPart.Size = New System.Drawing.Size(144, 24)
    '    Me.wfPart.TabIndex = CType(30, Short)
    '    Me.wfPart.Text = "XXXX-XX-XXXX"
    '    '
    '    'WarpField14
    '    '
    '    Me.WarpField14.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField14.Font = New System.Drawing.Font("lr SVbN", 16.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField14.FontSize = WarpControl.FontSizes.Small4
    '    Me.WarpField14.Format = ""
    '    Me.WarpField14.Length = CType(1, Short)
    '    Me.WarpField14.Location = New System.Drawing.Point(216, 81)
    '    Me.WarpField14.MacroBcr = ""
    '    Me.WarpField14.MacroIn = ""
    '    Me.WarpField14.MacroKey = ""
    '    Me.WarpField14.MacroOut = ""
    '    Me.WarpField14.Name = "WarpField14"
    '    Me.WarpField14.Size = New System.Drawing.Size(9, 18)
    '    Me.WarpField14.TabIndex = CType(29, Short)
    '    Me.WarpField14.Text = "Z"
    '    '
    '    'WarpField13
    '    '
    '    Me.WarpField13.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField13.Font = New System.Drawing.Font("lr SVbN", 16.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField13.FontSize = WarpControl.FontSizes.Small4
    '    Me.WarpField13.Format = ""
    '    Me.WarpField13.Length = CType(2, Short)
    '    Me.WarpField13.Location = New System.Drawing.Point(171, 81)
    '    Me.WarpField13.MacroBcr = ""
    '    Me.WarpField13.MacroIn = ""
    '    Me.WarpField13.MacroKey = ""
    '    Me.WarpField13.MacroOut = ""
    '    Me.WarpField13.Name = "WarpField13"
    '    Me.WarpField13.Size = New System.Drawing.Size(18, 18)
    '    Me.WarpField13.TabIndex = CType(28, Short)
    '    Me.WarpField13.Text = "CL"
    '    '
    '    'WarpField11
    '    '
    '    Me.WarpField11.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField11.Font = New System.Drawing.Font("lr SVbN", 16.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField11.FontSize = WarpControl.FontSizes.Small4
    '    Me.WarpField11.Format = ""
    '    Me.WarpField11.Length = CType(6, Short)
    '    Me.WarpField11.Location = New System.Drawing.Point(3, 81)
    '    Me.WarpField11.MacroBcr = ""
    '    Me.WarpField11.MacroIn = ""
    '    Me.WarpField11.MacroKey = ""
    '    Me.WarpField11.MacroOut = ""
    '    Me.WarpField11.Name = "WarpField11"
    '    Me.WarpField11.Size = New System.Drawing.Size(54, 18)
    '    Me.WarpField11.TabIndex = CType(27, Short)
    '    Me.WarpField11.Text = "PartNo"
    '    '
    '    'wfLctn2
    '    '
    '    Me.wfLctn2.DecimalPointPosition = CType(0, Short)
    '    Me.wfLctn2.DisplayAttribute.Bold = True
    '    Me.wfLctn2.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfLctn2.Format = ""
    '    Me.wfLctn2.InputAttribute.Bold = True
    '    Me.wfLctn2.Length = CType(3, Short)
    '    Me.wfLctn2.Location = New System.Drawing.Point(99, 42)
    '    Me.wfLctn2.MacroBcr = ""
    '    Me.wfLctn2.MacroIn = ""
    '    Me.wfLctn2.MacroKey = ""
    '    Me.wfLctn2.MacroOut = ""
    '    Me.wfLctn2.Name = "wfLctn2"
    '    Me.wfLctn2.Size = New System.Drawing.Size(54, 36)
    '    Me.wfLctn2.TabIndex = CType(21, Short)
    '    Me.wfLctn2.Text = "XXX"
    '    '
    '    'WarpField5
    '    '
    '    Me.WarpField5.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField5.DisplayAttribute.Bold = True
    '    Me.WarpField5.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField5.Format = ""
    '    Me.WarpField5.InputAttribute.Bold = True
    '    Me.WarpField5.Length = CType(1, Short)
    '    Me.WarpField5.Location = New System.Drawing.Point(72, 42)
    '    Me.WarpField5.MacroBcr = ""
    '    Me.WarpField5.MacroIn = ""
    '    Me.WarpField5.MacroKey = ""
    '    Me.WarpField5.MacroOut = ""
    '    Me.WarpField5.Name = "WarpField5"
    '    Me.WarpField5.Size = New System.Drawing.Size(18, 36)
    '    Me.WarpField5.TabIndex = CType(20, Short)
    '    Me.WarpField5.Text = "-"
    '    '
    '    'wfLctn1
    '    '
    '    Me.wfLctn1.DecimalPointPosition = CType(0, Short)
    '    Me.wfLctn1.DisplayAttribute.Bold = True
    '    Me.wfLctn1.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfLctn1.Format = ""
    '    Me.wfLctn1.InputAttribute.Bold = True
    '    Me.wfLctn1.Length = CType(2, Short)
    '    Me.wfLctn1.Location = New System.Drawing.Point(28, 42)
    '    Me.wfLctn1.MacroBcr = ""
    '    Me.wfLctn1.MacroIn = ""
    '    Me.wfLctn1.MacroKey = ""
    '    Me.wfLctn1.MacroOut = ""
    '    Me.wfLctn1.Name = "wfLctn1"
    '    Me.wfLctn1.Size = New System.Drawing.Size(36, 36)
    '    Me.wfLctn1.TabIndex = CType(19, Short)
    '    Me.wfLctn1.Text = "XX"
    '    '
    '    'WarpField2
    '    '
    '    Me.WarpField2.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField2.Font = New System.Drawing.Font("lr SVbN", 16.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField2.FontSize = WarpControl.FontSizes.Small4
    '    Me.WarpField2.Format = ""
    '    Me.WarpField2.Length = CType(8, Short)
    '    Me.WarpField2.Location = New System.Drawing.Point(3, 24)
    '    Me.WarpField2.MacroBcr = ""
    '    Me.WarpField2.MacroIn = ""
    '    Me.WarpField2.MacroKey = ""
    '    Me.WarpField2.MacroOut = ""
    '    Me.WarpField2.Name = "WarpField2"
    '    Me.WarpField2.Size = New System.Drawing.Size(72, 18)
    '    Me.WarpField2.TabIndex = CType(17, Short)
    '    Me.WarpField2.Text = "Location"
    '    '
    '    'wfCrtnNo
    '    '
    '    Me.wfCrtnNo.DecimalPointPosition = CType(0, Short)
    '    Me.wfCrtnNo.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfCrtnNo.FontSize = WarpControl.FontSizes.Small2
    '    Me.wfCrtnNo.Format = ""
    '    Me.wfCrtnNo.Length = CType(5, Short)
    '    Me.wfCrtnNo.Location = New System.Drawing.Point(84, 0)
    '    Me.wfCrtnNo.MacroBcr = ""
    '    Me.wfCrtnNo.MacroIn = ""
    '    Me.wfCrtnNo.MacroKey = ""
    '    Me.wfCrtnNo.MacroOut = ""
    '    Me.wfCrtnNo.Name = "wfCrtnNo"
    '    Me.wfCrtnNo.Size = New System.Drawing.Size(60, 24)
    '    Me.wfCrtnNo.TabIndex = CType(14, Short)
    '    Me.wfCrtnNo.Text = "XXXXX"
    '    '
    '    'WarpField10
    '    '
    '    Me.WarpField10.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField10.Font = New System.Drawing.Font("lr SVbN", 16.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField10.FontSize = WarpControl.FontSizes.Small4
    '    Me.WarpField10.Format = ""
    '    Me.WarpField10.Length = CType(8, Short)
    '    Me.WarpField10.Location = New System.Drawing.Point(0, 0)
    '    Me.WarpField10.MacroBcr = ""
    '    Me.WarpField10.MacroIn = ""
    '    Me.WarpField10.MacroKey = ""
    '    Me.WarpField10.MacroOut = ""
    '    Me.WarpField10.Name = "WarpField10"
    '    Me.WarpField10.Size = New System.Drawing.Size(72, 18)
    '    Me.WarpField10.TabIndex = CType(13, Short)
    '    Me.WarpField10.Text = "CartonNo"
    '    '
    '    '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.Line
    '    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:\081-0030.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
    '    '
    '    '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)
    '    '
    '    'frm2025
    '    '
    '    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 = "frm2025"
    '    Me.Text = "Form1"
    '    Me.WarpFrame1.ResumeLayout(False)
    '    Me.ResumeLayout(False)

    'End Sub

#End Region

    Const CONST_PART_ID = "P"
    Const CONST_NEXTLOC = "OCNEXTLCTN"
    Const CONST_NOTPACK = "OCNOTPACK"
    Const CONST_ALLCANCEL = "OCALLCAN"
    Const CONST_ZEROOK = "OCZEROOK"

    Public Enum M2025_STATUS As Integer
        INIT = 0
        MENUBACK = 1
        NOTCD = 2
        NONG = 3
        QTYNG = 4
        LOCNG = 5
        DSCAN = 6
        SRLNG = 7
        SSTNG = 8
        NOTT = 9
        SEARCH = 10
        DONE = 11
        DONE2 = 12
        PRINT = 13
        RETRY = 14
        NOTPACK = 15
        ALLCANCEL = 16
        ZEROOK = 17
    End Enum

    Public mint2025status As Integer

    'PACKPLAN Key\‘ข‘ฬ
    Private Structure STRCT_KEY_PACKPLAN
        Dim Product As String
        Dim Aic As String
        Dim CaseNo As String
        Dim CartonNo As String
        Dim ItemID As String
        Dim ItemCode As String
        Dim Tume As Long

        Dim SPM_ItemInCode As String
        Dim SPM_ItemInCodeDisp As String
        Dim SPM_PackQtyP As String
        Dim SPM_CaseQty As String
        Dim SPM_CartonType As String
    End Structure

    Private mstrctPackPlan As STRCT_KEY_PACKPLAN

    Private Structure PART
        Public strItemID As String
        Public strItemCode As String
        Public strPartNo As String
        Public strCL As String
        Public strZnc As String
        Public strQty As String
        Public strSerial As String
        Public StrLocation As String
    End Structure

    Private Structure KDPP_LOC_STR

        Public astrLocation() As String
        Public intNumOfLoc As Integer

        Public Sub initialize()
            intNumOfLoc = 0
        End Sub

        Public Sub AddLoc(ByVal strLoc As String)

            Dim i As Integer
            Dim flag As Boolean

            If intNumOfLoc = 0 Then
                ReDim astrLocation(intNumOfLoc)
                astrLocation(intNumOfLoc) = strLoc
                intNumOfLoc += 1
                Exit Sub
            End If

            flag = False
            i = 0
            Do Until i = intNumOfLoc
                If astrLocation(i) = strLoc Then
                    flag = True
                End If
                i += 1
            Loop

            If Not flag Then
                ReDim Preserve astrLocation(intNumOfLoc)
                astrLocation(intNumOfLoc) = strLoc
                intNumOfLoc += 1
            End If

        End Sub

    End Structure

    Private Sub frm2025_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
        Dim f26 As frm2026

        Try
            mint2025status = M2025_STATUS.INIT

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

            If gstrctPPDispPart.bNextCarton Then
                ' tH[€์ฌ
                f26 = New frm2026

                ' tH[€E[h
                'f26.Show()
                f26.ShowDialog()
                f26.Dispose()
                gstrctPPDispPart.bNextCarton = False
            End If

#If Not Debug Then
            'sSetImgFName(G_CONST_MID_H2025, WarpBox1)
#End If

            sDisp2025()
            ' 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
            sErrLog(gAppName, "", ex.ToString)
        End Try

    End Sub

    '/*
    '|| ึ”–ผFsDisp2025
    '|| T—v  F2025ๆ–ส•\ฆ
    '*/
    Private Sub sDisp2025()
        Dim wintNum As Integer
        Dim wstrLctnPartNo As String

        With gstrctPPDisp
            wfCrtnNo.Text = .strCrtnNo
        End With

        wintNum = fCountLoc(gstrctPPDispPart.strLocation)
        If wintNum <> -1 Then
            wfNumOfLoc.Text = CStr(wintNum)
        End If

        With gstrctPPDispPart
            wstrLctnPartNo = gstrctPPDisp.strCrtnNo & .strLocation & RTrim(.strItemInCode)
            wfLctn1.Text = .strLocation1
            wfLctn2.Text = .strLocation2
            wfPart.Text = .strPartNoDisp
            wfCL.Text = .strCL
            wfZ.Text = .strZ

            wfPkg1.Text = gstrctPPDisp.fGetPkg(RTrim(wstrLctnPartNo), 1)
            wfPkg2.Text = gstrctPPDisp.fGetPkg(RTrim(wstrLctnPartNo), 0)
            wfQty1.Text = gstrctPPDisp.fGetQty(RTrim(wstrLctnPartNo), 1)
            wfQty2.Text = gstrctPPDisp.fGetQty(RTrim(wstrLctnPartNo), 0)

        End With
        wfName.Text = gstrctKDHT.strUserName

    End Sub

    Private Sub btScanLib_OnScan(ByVal result As String)
        Dim buf As String = result
        Dim rtn 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_E2E25)
#End If
            Exit Sub
        End If

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

        If rtn = 0 Then
            Select Case mint2025status
                Case M2025_STATUS.MENUBACK


                Case M2025_STATUS.NOTCD              'ูศ้o[R[h
                    gstrctKDPP.bRetry = True
                    sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
                    sOutputLog(gstrctPicsIni.strOutput_KDPP, "KDPP2E25", G_CONST_BC_PART, buf)
#If Not Debug Then
                    fFnc_WrpMsg("E", G_CONST_MID_E2E25)
#End If
                    Exit Sub
                Case M2025_STATUS.NONG               '•”•i”ิแข
                    gstrctKDPP.bRetry = True
                    sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
#If Not Debug Then
                    fFnc_WrpMsg("E", G_CONST_MID_E2E30)
#End If
                    Exit Sub
                Case M2025_STATUS.QTYNG              '”—สแข
                    gstrctKDPP.bRetry = True
                    sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
#If Not Debug Then
                    fFnc_WrpMsg("E", G_CONST_MID_E2E42)
#End If
                    Exit Sub
                Case M2025_STATUS.DSCAN              '_uXL“
                    gstrctKDPP.bRetry = True
                    sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
#If Not Debug Then
                    fFnc_WrpMsg("E", G_CONST_MID_E2E35)
#End If
                    Exit Sub
                Case M2025_STATUS.LOCNG              'Pแข
                    gstrctKDPP.bRetry = True
                    sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
#If Not Debug Then
                    fFnc_WrpMsg("E", G_CONST_MID_E2E40)
#End If
                    Exit Sub
                Case M2025_STATUS.SRLNG              'VANo•sณ
                    gstrctKDPP.bRetry = True
                    sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
#If Not Debug Then
                    fFnc_WrpMsg("E", G_CONST_MID_E2E43)
#End If
                    Exit Sub
                Case M2025_STATUS.SSTNG              'ษXe[^X•sณ
                    gstrctKDPP.bRetry = True
                    sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
#If Not Debug Then
                    fFnc_WrpMsg("E", G_CONST_MID_E2E44)
#End If
                    Exit Sub
                Case M2025_STATUS.NOTT               'Pแข
                    sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
                    sOutputLog(gstrctPicsIni.strOutput_KDPP, "KDPP2E25", G_CONST_BC_PART, buf)
#If Not Debug Then
                    fFnc_WrpMsg("E", G_CONST_MID_E2E25)
#End If
                    Exit Sub
                Case M2025_STATUS.DONE

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

                    gintStatus = PP_STATUS.PART
                    Me.Close()
                    Exit Sub

                Case M2025_STATUS.PRINT

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

                    gintStatus = PP_STATUS.PRINT
                    Me.Close()
                    Exit Sub

                Case M2025_STATUS.SEARCH

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

                    gintStatus = PP_STATUS.SEARCH
                    Me.Close()
                    Exit Sub

                Case M2025_STATUS.RETRY

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

                    gstrctKDPP.bRetry = False
                    gintStatus = PP_STATUS.RETRY1
                    Me.Close()
                    Exit Sub

                Case M2025_STATUS.NOTPACK

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

                    gintStatus = PP_STATUS.NOTPACK
                    Me.Close()
                    Exit Sub

                Case M2025_STATUS.ZEROOK  'oื”[ฎ—น

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

                    gintStatus = PP_STATUS.ZEROOK
                    Me.Close()
                    Exit Sub

                Case M2025_STATUS.ALLCANCEL

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

                    gintStatus = PP_STATUS.ALLCANCEL
                    Me.Close()
                    Exit Sub

                    'rtn = fPicsAllCancel()
                    'If rtn = 0 Then
                    'gintStatus = PP_STATUS.ENTKEY
                    'End If
                    'gintStatus = PP_Status.

            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
        '        Dim stat As Integer

        '        Try

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

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

        '                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_E2E25)
        '#End If
        '                        Exit Do
        '                    End If

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

        '                    If rtn = 0 Then
        '                        Select Case mint2025status
        '                            Case M2025_STATUS.MENUBACK


        '                            Case M2025_STATUS.NOTCD              'ูศ้o[R[h
        '                                gstrctKDPP.bRetry = True
        '                                sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
        '                                sOutputLog(gstrctPicsIni.strOutput_KDPP, "KDPP2E25", G_CONST_BC_PART, buf)
        '#If Not Debug Then
        '                                fFnc_WrpMsg("E", G_CONST_MID_E2E25)
        '#End If

        '                            Case M2025_STATUS.NONG               '•”•i”ิแข
        '                                gstrctKDPP.bRetry = True
        '                                sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
        '#If Not Debug Then
        '                                fFnc_WrpMsg("E", G_CONST_MID_E2E30)
        '#End If

        '                            Case M2025_STATUS.QTYNG              '”—สแข
        '                                gstrctKDPP.bRetry = True
        '                                sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
        '#If Not Debug Then
        '                                fFnc_WrpMsg("E", G_CONST_MID_E2E42)
        '#End If

        '                            Case M2025_STATUS.DSCAN              '_uXL“
        '                                gstrctKDPP.bRetry = True
        '                                sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
        '#If Not Debug Then
        '                                fFnc_WrpMsg("E", G_CONST_MID_E2E35)
        '#End If

        '                            Case M2025_STATUS.LOCNG              'Pแข
        '                                gstrctKDPP.bRetry = True
        '                                sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
        '#If Not Debug Then
        '                                fFnc_WrpMsg("E", G_CONST_MID_E2E40)
        '#End If

        '                            Case M2025_STATUS.SRLNG              'VANo•sณ
        '                                gstrctKDPP.bRetry = True
        '                                sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
        '#If Not Debug Then
        '                                fFnc_WrpMsg("E", G_CONST_MID_E2E43)
        '#End If

        '                            Case M2025_STATUS.SSTNG              'ษXe[^X•sณ
        '                                gstrctKDPP.bRetry = True
        '                                sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
        '#If Not Debug Then
        '                                fFnc_WrpMsg("E", G_CONST_MID_E2E44)
        '#End If

        '                            Case M2025_STATUS.NOTT               'Pแข
        '                                sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
        '                                sOutputLog(gstrctPicsIni.strOutput_KDPP, "KDPP2E25", G_CONST_BC_PART, buf)
        '#If Not Debug Then
        '                                fFnc_WrpMsg("E", G_CONST_MID_E2E25)
        '#End If

        '                            Case M2025_STATUS.DONE

        '                                gintStatus = PP_STATUS.PART
        '                                Exit Do

        '                            Case M2025_STATUS.PRINT

        '                                gintStatus = PP_STATUS.PRINT
        '                                Exit Do

        '                            Case M2025_STATUS.SEARCH
        '                                gintStatus = PP_STATUS.SEARCH
        '                                Exit Do

        '                            Case M2025_STATUS.RETRY

        '                                gstrctKDPP.bRetry = False
        '                                gintStatus = PP_STATUS.RETRY1
        '                                Exit Do

        '                            Case M2025_STATUS.NOTPACK

        '                                gintStatus = PP_STATUS.NOTPACK
        '                                Exit Do

        '                            Case M2025_STATUS.ZEROOK  'oื”[ฎ—น

        '                                gintStatus = PP_STATUS.ZEROOK
        '                                Exit Do

        '                            Case M2025_STATUS.ALLCANCEL

        '                                gintStatus = PP_STATUS.ALLCANCEL
        '                                Exit Do
        '                                'rtn = fPicsAllCancel()
        '                                'If rtn = 0 Then
        '                                'gintStatus = PP_STATUS.ENTKEY
        '                                'End If
        '                                'gintStatus = PP_Status.

        '                        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

        '                ElseIf WKey = WKY_PGUP And Not gstrctPPDispPart.bLocked Then
        '                    If gstrctKDPP.intIndex = 0 And gstrctPPDisp.strCrtnNo = gstrctPPDisp.strCrtnFrom Then
        '                        gintStatus = PP_STATUS.HEADER
        '                        Exit Do
        '                    Else
        '                        gstrctKDPP.intIndex -= 1
        '                        If fSearchPackCP(G_CONST_DIR_GOBACKWARD) = -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)
        '                            Exit Do
        '                        End If
        '                        gintStatus = PP_STATUS.PART
        '                        Exit Do
        '                    End If

        '                ElseIf WKey = WKY_PGDOWN And Not gstrctPPDispPart.bLocked Then
        '                    gstrctKDPP.intIndex += 1
        '                    If fSearchPackCP() = -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)
        '                        Exit Do
        '                    End If
        '                    gintStatus = PP_STATUS.PART
        '                    Exit Do

        '                ElseIf WKey = WKY_F1 Then
        '                    rtn = fSortPKCP(G_CONST_SORT_ASCEND)
        '                    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)
        '                        Exit Do
        '                    End If
        '                    gstrctKDPP.intIndex = 0
        '                    If fSearchPackCP() = -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)
        '                        Exit Do
        '                    End If
        '                    sDisp2025()
        '                ElseIf WKey = WKY_F2 Then
        '                    rtn = fSortPKCP(G_CONST_SORT_DESCEND)
        '                    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)
        '                        Exit Do
        '                    End If
        '                    gstrctKDPP.intIndex = 0
        '                    If fSearchPackCP() = -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)
        '                        Exit Do
        '                    End If
        '                    sDisp2025()
        '                ElseIf WKey = WKY_F3 Then
        '                    rtn = fSortPKCP(G_CONST_SORT_PASCEND)
        '                    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)
        '                        Exit Do
        '                    End If
        '                    gstrctKDPP.intIndex = 0
        '                    If fSearchPackCP() = -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)
        '                        Exit Do
        '                    End If
        '                    sDisp2025()
        '                ElseIf WKey = WKY_F4 Then
        '                    rtn = fSortPKCP(G_CONST_SORT_PDESCEND)
        '                    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)
        '                        Exit Do
        '                    End If
        '                    gstrctKDPP.intIndex = 0
        '                    If fSearchPackCP() = -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)
        '                        Exit Do
        '                    End If
        '                    sDisp2025()
        '                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
        '            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 rtn2 As Integer
        Dim wstrEmplCode As String
        Dim wstrSecKey(2) As String
        Dim wstrSecKeyValue(2) As String
        Dim wstrCenterCode As String
        Dim wintCnt As Integer
        Dim wintCnt2 As Integer
        Dim wstrWhere As String
        Dim wstrKey(0) As String, wstrKeyValue(0) As String
        Dim wstrPkcpKey(2) As String, wstrPkcpKeyValue(2) As String
        Dim wstrStkKey(7) As String, wstrStkKeyValue(7) As String
        Dim wstrLctnPartNo As String
        Dim wstrctCrntPart As PART
        Dim wstrctPickedPart As PART
        Const KEY01 = "UPD_KEY01"     '—\–๑ฬR[h
        Const KEY02 = "UPD_KEY02"     'sbNตฝR[h
        Dim wintFlag As Integer

        Dim tmp As String

        fProcInput = -1

        Try

            If pstrInput.Length = 19 Then
                wintFlag = 2
            ElseIf pstrInput.Length = 25 Then
                wintFlag = 0
            Else
                wintFlag = -1
            End If

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

                mint2025status = M2025_STATUS.MENUBACK
                fProcInput = 0
                Exit Function

            ElseIf pstrInput = "OCNOTPACK" Then 'J[g“xแ—

                mint2025status = M2025_STATUS.NOTPACK
                fProcInput = 0
                Exit Function

            ElseIf pstrInput = "OCALLCAN" Then  'PACKCPม

                mint2025status = M2025_STATUS.ALLCANCEL
                fProcInput = 0
                Exit Function

            ElseIf pstrInput = "OCMTLINFO" Then '—ฟ๊——Aฦ๏

            ElseIf pstrInput = "OCZEROOK" Then  '1ACe€NOTPACK—

                mint2025status = M2025_STATUS.ZEROOK
                fProcInput = 0
                Exit Function

            ElseIf gstrctPPDispPart.strLocation = "?????" Then

                mint2025status = M2025_STATUS.INIT
                fProcInput = 0
                Exit Function

                'ElseIf pstrInput.StartsWith("T") Then        'ๆ“ชชTศ็ฮ
                '    rtn = pstrInput.Length
                '    If rtn = 9 And (gstrctPPDispPart.strLocation1 & gstrctPPDispPart.strLocation2) = RTrim(Mid(pstrInput, 5)) Then '9…ศOศ็ฮ

                '        '// ษศตAT[`
                '        mint2025status = M2025_STATUS.SEARCH
                '        fProcInput = 0
                '        Exit Function

                '    Else

                '        mint2025status = M2025_STATUS.NOTT
                '        fProcInput = 0
                '        Exit Function

                '    End If

            ElseIf pstrInput = "OCNEXTLCTN" Then

                mint2025status = M2025_STATUS.SEARCH
                fProcInput = 0
                Exit Function

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

                If wintFlag = 0 Or wintFlag = 2 Then '•”•io[R[h

                    'XL“ณ๊ฝ•”•iฬ•”•i๎•๑ๆ“พ
                    tmp = Mid(pstrInput, 1, 1) & fBackDispItem(Mid(pstrInput, 2, 10), True) & Mid(pstrInput, 12)
                    sDecodeParts(wstrctPickedPart, tmp, gstrctPPDispPart.strSerial)

                    'ปฬwฆ•”•i๎•๑ๆ“พ
                    With gstrctPPDispPart
                        wstrctCrntPart.strItemID = .strItemInID
                        wstrctCrntPart.strItemCode = .strItemInCode
                        wstrctCrntPart.strQty = .strPackQty
                        wstrctCrntPart.strSerial = .strSerial
                        wstrctCrntPart.StrLocation = .strLocation
                    End With

                    If wstrctPickedPart.strItemCode = wstrctCrntPart.strItemCode Then

                        If IsNumeric(wstrctPickedPart.strQty) = False Then
                            'o[R[hG[
                            mint2025status = M2025_STATUS.NOTCD
                            fProcInput = 0
                            Exit Function
                        End If

                        If CInt(wstrctPickedPart.strQty) <> CInt(wstrctCrntPart.strQty) Then

                            '”—ส•s๊’v(KDPP2E42)
                            mint2025status = M2025_STATUS.QTYNG
                            fProcInput = 0
                            Exit Function

                        Else

                            ''oษP[V“ฬ`FbN
                            rtn = fCheckStock(wstrctPickedPart.strSerial, wintFlag)
                            If rtn = 1 Then
                                '_uXL“
                                mint2025status = M2025_STATUS.DSCAN
                                fProcInput = 0
                                Exit Function
                            ElseIf rtn = 2 Then
                                'ษXe[^Xิแข
                                mint2025status = M2025_STATUS.SSTNG
                                fProcInput = 0
                                Exit Function
                            ElseIf rtn = 3 Then
                                'P[V“ิแข
                                mint2025status = M2025_STATUS.LOCNG
                                fProcInput = 0
                                Exit Function
                            ElseIf rtn = 4 Then
                                'VANoิแข
                                mint2025status = M2025_STATUS.SRLNG
                                fProcInput = 0
                                Exit Function
                            End If

                            '—\–๑VA๕—p
                            With gstrctPPDispPart
                                wstrPkcpKey(0) = "ItemCode" : wstrPkcpKeyValue(0) = .strItemCode
                                wstrPkcpKey(1) = "ItemInCode" : wstrPkcpKeyValue(1) = .strItemInCode
                                wstrPkcpKey(2) = "PlanSerial" : wstrPkcpKeyValue(2) = .strSerial
                            End With


                            rtn2 = fOpenPackCP(G_CONST_KEY_PACKCPKEY06, KEY01, wstrPkcpKey, wstrPkcpKeyValue)
                            If rtn2 <> 0 Then
                                'DBG[
                                'gclsDB.fCloseRecord(KEY01)
                                Exit Function
                            End If

                            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 i As Integer = 0

                            If tmpStrCP.Count > 0 Then

                                values = tmpStrCP(0)

                                Dim result As String = Nothing
                                If values.TryGetValue("PicsType", result) Then
                                    'Console.WriteLine("RESULT: {0}", result)
                                    sPicsType = result
                                End If
                                If values.TryGetValue("Cstmid", result) Then
                                    'Console.WriteLine("RESULT: {0}", result)
                                    sCstmid = result
                                End If
                                If values.TryGetValue("CstmCode", result) Then
                                    'Console.WriteLine("RESULT: {0}", result)
                                    sCstmCode = result
                                End If
                                If values.TryGetValue("CenterCode", result) Then
                                    'Console.WriteLine("RESULT: {0}", result)
                                    sCenterCode = result
                                End If
                                If values.TryGetValue("Bhk", result) Then
                                    'Console.WriteLine("RESULT: {0}", result)
                                    sBhk = result
                                End If
                                If values.TryGetValue("ItemInID", result) Then
                                    'Console.WriteLine("RESULT: {0}", result)
                                    sItemInID = result
                                End If
                                If values.TryGetValue("ItemInCode", result) Then
                                    'Console.WriteLine("RESULT: {0}", result)
                                    sItemInCode = result
                                End If


                                wstrStkKey(0) = "PicsType" : wstrStkKeyValue(0) = RTrim(sPicsType)
                                wstrStkKey(1) = "Cstmid" : wstrStkKeyValue(1) = RTrim(sCstmid)
                                wstrStkKey(2) = "CstmCode" : wstrStkKeyValue(2) = RTrim(sCstmCode)
                                wstrStkKey(3) = "CenterCode" : wstrStkKeyValue(3) = RTrim(sCenterCode)
                                wstrStkKey(4) = "Bhk" : wstrStkKeyValue(4) = RTrim(sBhk)
                                wstrStkKey(5) = "Itemid" : wstrStkKeyValue(5) = RTrim(sItemInID)
                                wstrStkKey(6) = "ItemCode" : wstrStkKeyValue(6) = RTrim(sItemInCode)
                                wstrStkKey(7) = "SerialNo" : wstrStkKeyValue(7) = wstrctPickedPart.strSerial


                                rtn2 = fOpenStock(G_CONST_KEY_STOCKKEY00, KEY02, wstrStkKey, wstrStkKeyValue, wintFlag)

                                If rtn2 <> 0 Then
                                    If wintFlag = 2 And rtn2 = -2 Then
                                        mint2025status = M2025_STATUS.LOCNG
                                        fProcInput = 0
                                        Exit Function
                                    End If
                                    Exit Function
                                End If

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

                                If tmpStrSTOCK.Count > 0 Then
                                    values = tmpStrSTOCK(0)

                                    result = Nothing
                                    If values.TryGetValue("Location", result) Then
                                        'Console.WriteLine("RESULT: {0}", result)
                                        sLocation = result
                                    End If
                                    If values.TryGetValue("ItemCode", result) Then
                                        'Console.WriteLine("RESULT: {0}", result)
                                        sItemCode = result
                                    End If
                                    If values.TryGetValue("Qty", result) Then
                                        'Console.WriteLine("RESULT: {0}", result)
                                        sQty = result
                                    End If

                                End If

                                wstrLctnPartNo = gstrctPPDisp.strCrtnNo & RTrim(sLocation) & RTrim(sItemCode)
                                gstrctPPDisp.fSetQty(wstrLctnPartNo, RTrim(sQty), 1)
                                gstrctPPDisp.fSetPkg(wstrLctnPartNo, 1, 1)

                                gstrctPPDisp.intNumOfScanned += 1
                                gstrctPPDispPart.bLocked = False

                                If IsNumeric(gstrctPicsIni.strConstant_WaitTime) Then System.Threading.Thread.Sleep(CInt(gstrctPicsIni.strConstant_WaitTime))

                                'f[^—()
                                'gstrctKDPP.intIndex = 0
                                rtn = fSearchPackCP()
                                If rtn = -1 Then
                                    Exit Function
                                ElseIf rtn = -2 Then
                                    If gstrctKDPP.bRetry Then
                                        gstrctPPDisp.strCrtnNo = gstrctPPDisp.strCrtnFrom
                                        mint2025status = M2025_STATUS.RETRY
                                        fProcInput = 0
                                    Else
                                        rtn = fUpdatePackPlan()
                                        If rtn = -1 Then
                                            sErrLog(gAppName, "fProcInput", "ERROR ON UPDATING PACKPLAN")
                                            'Exit Function
                                        End If
                                        mint2025status = M2025_STATUS.PRINT
                                        fProcInput = 0
                                    End If

                                Else
                                    If rtn = 0 Then
                                        mint2025status = M2025_STATUS.DONE
                                    Else
                                        mint2025status = M2025_STATUS.DONE2
                                    End If
                                    fProcInput = 0
                                End If

                            End If
                            Exit Function
                        End If

                    Else
                        '•”•i”ิแข
                        mint2025status = M2025_STATUS.NONG
                        fProcInput = 0
                        Exit Function

                    End If


                Else
                    '…”แข
                    mint2025status = M2025_STATUS.NOTCD
                    fProcInput = 0
                    Exit Function
                End If

            Else

                mint2025status = M2025_STATUS.NOTCD
                fProcInput = 0
                Exit Function

            End If

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



        'sbNVA๕—p
        '                    With gclsDB.Records(KEY01)
        '                        wstrStkKey(0) = "PicsType" : wstrStkKeyValue(0) = RTrim(.Item("PicsType"))
        '                        wstrStkKey(1) = "Cstmid" : wstrStkKeyValue(1) = RTrim(.Item("Cstmid"))
        '                        wstrStkKey(2) = "CstmCode" : wstrStkKeyValue(2) = RTrim(.Item("CstmCode"))
        '                        wstrStkKey(3) = "CenterCode" : wstrStkKeyValue(3) = RTrim(.Item("CenterCode"))
        '                        wstrStkKey(4) = "Bhk" : wstrStkKeyValue(4) = RTrim(.Item("Bhk"))
        '                        wstrStkKey(5) = "Itemid" : wstrStkKeyValue(5) = RTrim(.Item("ItemInID"))
        '                        wstrStkKey(6) = "ItemCode" : wstrStkKeyValue(6) = RTrim(.Item("ItemInCode"))
        '                        wstrStkKey(7) = "SerialNo" : wstrStkKeyValue(7) = wstrctPickedPart.strSerial

        '                    End With

        '                    rtn2 = fOpenStock(G_CONST_KEY_STOCKKEY00, KEY02, wstrStkKey, wstrStkKeyValue, wintFlag)

        '                    If rtn2 <> 0 Then
        '                        If wintFlag = 2 And rtn2 = -2 Then
        '                            'P[V“ิแข
        '                            gclsDB.fCloseRecord(KEY01)
        '                            gclsDB.fCloseRecord(KEY02)
        '                            mint2025status = M2025_STATUS.LOCNG
        '                            fProcInput = 0
        '                            Exit Function
        '                        End If
        '                        'DBG[
        '                        gclsDB.fCloseRecord(KEY01)
        '                        gclsDB.fCloseRecord(KEY02)
        '                        Exit Function
        '                    End If

        '                    'ภัXV
        '                    If fUpdProc(KEY01, KEY02, wintFlag) <> 0 Then
        '                        'XVธ”s
        '                        gclsDB.fCloseRecord(KEY01)
        '                        gclsDB.fCloseRecord(KEY02)
        '                        Exit Function
        '                    End If

        '                    With gclsDB.Records(KEY02)
        '                        wstrLctnPartNo = gstrctPPDisp.strCrtnNo & RTrim(.Item("Location")) & RTrim(.Item("ItemCode"))
        '                        gstrctPPDisp.fSetQty(wstrLctnPartNo, RTrim(.Item("Qty")), 1)
        '                        gstrctPPDisp.fSetPkg(wstrLctnPartNo, 1, 1)
        '                    End With
        '                    gstrctPPDisp.intNumOfScanned += 1
        '                    gstrctPPDispPart.bLocked = False

        '                    gclsDB.fCloseRecord(KEY01)
        '                    gclsDB.fCloseRecord(KEY02)

        '                    If IsNumeric(gstrctPicsIni.strConstant_WaitTime) Then System.Threading.Thread.Sleep(CInt(gstrctPicsIni.strConstant_WaitTime))

        '                    'f[^—()
        '                    'gstrctKDPP.intIndex = 0
        '                    rtn = fSearchPackCP()
        '                    If rtn = -1 Then
        '                        Exit Function
        '                    ElseIf rtn = -2 Then
        '                        If gstrctKDPP.bRetry Then
        '                            gstrctPPDisp.strCrtnNo = gstrctPPDisp.strCrtnFrom
        '                            mint2025status = M2025_STATUS.RETRY
        '                            fProcInput = 0
        '                        Else
        '                            rtn = fUpdatePackPlan()
        '                            If rtn = -1 Then
        '                                sErrLog(gAppName, "fProcInput", "ERROR ON UPDATING PACKPLAN")
        '                                'Exit Function
        '                            End If
        '                            mint2025status = M2025_STATUS.PRINT
        '                            fProcInput = 0
        '                        End If

        '                    Else
        '                        If rtn = 0 Then
        '                            mint2025status = M2025_STATUS.DONE
        '                        Else
        '                            mint2025status = M2025_STATUS.DONE2
        '                        End If
        '                        fProcInput = 0
        '                    End If

        '                End If
        '                Exit Function
        '            Else
        '                '•”•i”ิแข
        '                mint2025status = M2025_STATUS.NONG
        '                fProcInput = 0
        '                Exit Function
        '            End If

        '        Else
        '            '…”แข
        '            mint2025status = M2025_STATUS.NOTCD
        '            fProcInput = 0
        '            Exit Function
        '        End If

        '    Else

        '        mint2025status = M2025_STATUS.NOTCD
        '        fProcInput = 0
        '        Exit Function

        '    End If

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

    '/*•”•i”ิ•ช๐
    Private Sub sDecodeParts(ByRef strctParts As PART, ByVal strCode As String, ByVal strSerial As String)
        With strctParts
            .strItemID = RTrim(Mid(strCode, 1, 1))
            .strItemCode = RTrim(Mid(strCode, 2, 13))
            .strPartNo = RTrim(Mid(strCode, 2, 10))
            .strCL = RTrim(Mid(strCode, 12, 2))
            .strZnc = RTrim(Mid(strCode, 14, 1))
            .strQty = RTrim(Mid(strCode, 15, 5))
            If strCode.Length = 25 Then
                .strSerial = RTrim(Mid(strCode, 20, 6))
            Else
                .strSerial = strSerial
            End If
        End With
    End Sub

    '/*
    '|| ึ”–ผFfCountLoc
    '|| T—v  FP[V“JE“g
    '*/
    Private Function fCountLoc(ByVal pstrLoc) As Integer

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

        fCountLoc = -1
        wstrctLoc.initialize()

        Try

            wstrKey(0) = "ItemCode"
            wstrKey(1) = "ItemInCode"
            wstrKey(2) = "PlanSerial"
            wstrKeyValue(0) = gstrctPPDisp.strItemCode
            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)

            Dim values As Dictionary(Of String, String) = New Dictionary(Of String, String)
            Dim result As String = Nothing
            Dim sItemCode As String = Nothing
            Dim sStockLctn As String = Nothing
            Dim i As Integer = 0


            If tmpStr.Count > 0 Then
                Do

                    values = tmpStr(i)

                    If values.TryGetValue("ItemCode", result) Then
                        sItemCode = RTrim(result)
                    End If
                    If values.TryGetValue("StockLctn", result) Then
                        sStockLctn = RTrim(result)
                    End If

                    If wstrKeyValue(0) = RTrim(sItemCode) Then

                        wstrctLoc.AddLoc(RTrim(sStockLctn))

                    Else
                        Exit Do
                    End If

                    i = i + 1

                    If i = tmpStr.Count Then
                        Exit Do
                    End If

                Loop

            End If

            fCountLoc = wstrctLoc.intNumOfLoc
            Exit Function

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




        'rtn = gclsDB.fOpenRecord(G_CONST_TBL_PACKCP, G_CONST_KEY_PACKCPKEY06, "PKCP01", wstrKey, wstrKeyValue, BtLib.Operation.GetGreaterOrEqual)
        'If rtn = 9 Then
        '    gclsDB.fCloseRecord("PKCP01")
        '    Exit Function
        'ElseIf rtn <> 0 Then
        '    gclsDB.fCloseRecord("PKCP01")
        '    Exit Function
        'End If

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

        '                wstrctLoc.AddLoc(RTrim(.Item("StockLctn")))

        '            Else
        '                Exit Do
        '            End If

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

        '        End With
        '    Loop
        'End If

        'gclsDB.fCloseRecord("PKCP01")
        'fCountLoc = wstrctLoc.intNumOfLoc
        'Exit Function

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

    End Function

    Private Sub frm2025_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        Dim rtn As Integer

        Select Case e.KeyCode.ToString()
            Case "Return"
                Exit Sub
            Case "F1"
                rtn = fSortPKCP(G_CONST_SORT_ASCEND)
                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
                gstrctKDPP.intIndex = 0
                If fSearchPackCP() = -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
                sDisp2025()
                Exit Sub
            Case "F2"
                rtn = fSortPKCP(G_CONST_SORT_DESCEND)
                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
                gstrctKDPP.intIndex = 0
                If fSearchPackCP() = -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
                sDisp2025()
                Exit Sub
            Case "F3"
                rtn = fSortPKCP(G_CONST_SORT_PASCEND)
                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
                gstrctKDPP.intIndex = 0
                If fSearchPackCP() = -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
                sDisp2025()
                Exit Sub
            Case "F4"
                rtn = fSortPKCP(G_CONST_SORT_PDESCEND)
                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
                gstrctKDPP.intIndex = 0
                If fSearchPackCP() = -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
                sDisp2025()
                Exit Sub
        End Select



    End Sub

    Private Sub frm2025_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


