﻿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 frm7027
    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 WarpHWBcr1 As WarpControl.WarpHWBcr
    'Friend WithEvents WarpField4 As WarpControl.WarpField
    'Friend WithEvents wfKey As WarpControl.WarpField
    'Friend WithEvents wfQty2 As WarpControl.WarpField
    'Friend WithEvents WarpField9 As WarpControl.WarpField
    'Friend WithEvents wfQty1 As WarpControl.WarpField
    'Friend WithEvents WarpField7 As WarpControl.WarpField
    'Friend WithEvents wfPkg2 As WarpControl.WarpField
    'Friend WithEvents WarpField6 As WarpControl.WarpField
    'Friend WithEvents wfPkg1 As WarpControl.WarpField
    'Friend WithEvents WarpField1 As WarpControl.WarpField
    'Friend WithEvents wfZ As WarpControl.WarpField
    'Friend WithEvents wfCL As WarpControl.WarpField
    'Friend WithEvents wfPart As WarpControl.WarpField
    'Friend WithEvents WarpField14 As WarpControl.WarpField
    'Friend WithEvents WarpField13 As WarpControl.WarpField
    'Friend WithEvents WarpField11 As WarpControl.WarpField
    'Friend WithEvents wfLctn2 As WarpControl.WarpField
    'Friend WithEvents WarpField5 As WarpControl.WarpField
    'Friend WithEvents wfLctn1 As WarpControl.WarpField
    'Friend WithEvents WarpField2 As WarpControl.WarpField
    'Friend WithEvents wfCrtnNo As WarpControl.WarpField
    'Friend WithEvents WarpField10 As WarpControl.WarpField
    'Friend WithEvents wfName As WarpControl.WarpField
    'Friend WithEvents WarpBox1 As WarpControl.WarpBox
    'Friend WithEvents wfTagScn As WarpControl.WarpField
    'Friend WithEvents wfCase As WarpControl.WarpField
    'Friend WithEvents WarpField3 As WarpControl.WarpField
    '<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    '    Me.WarpFrame1 = New WarpControl.WarpFrame()
    '    Me.wfCase = New WarpControl.WarpField()
    '    Me.WarpField3 = New WarpControl.WarpField()
    '    Me.wfTagScn = New WarpControl.WarpField()
    '    Me.WarpField4 = 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.wfCase)
    '    Me.WarpFrame1.Controls.Add(Me.WarpField3)
    '    Me.WarpFrame1.Controls.Add(Me.wfTagScn)
    '    Me.WarpFrame1.Controls.Add(Me.WarpField4)
    '    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 = ""
    '    '
    '    'wfCase
    '    '
    '    Me.wfCase.DecimalPointPosition = CType(0, Short)
    '    Me.wfCase.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfCase.FontSize = WarpControl.FontSizes.Small2
    '    Me.wfCase.Format = ""
    '    Me.wfCase.InputMode.NumericOnly = True
    '    Me.wfCase.InputMode.Right = True
    '    Me.wfCase.Length = CType(3, Short)
    '    Me.wfCase.Location = New System.Drawing.Point(201, 16)
    '    Me.wfCase.MacroBcr = ""
    '    Me.wfCase.MacroIn = ""
    '    Me.wfCase.MacroKey = ""
    '    Me.wfCase.MacroOut = ""
    '    Me.wfCase.Name = "wfCase"
    '    Me.wfCase.Size = New System.Drawing.Size(36, 24)
    '    Me.wfCase.TabIndex = CType(74, Short)
    '    Me.wfCase.Text = "9"
    '    '
    '    '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(7, Short)
    '    Me.WarpField3.Location = New System.Drawing.Point(177, 0)
    '    Me.WarpField3.MacroBcr = ""
    '    Me.WarpField3.MacroIn = ""
    '    Me.WarpField3.MacroKey = ""
    '    Me.WarpField3.MacroOut = ""
    '    Me.WarpField3.Name = "WarpField3"
    '    Me.WarpField3.Size = New System.Drawing.Size(63, 18)
    '    Me.WarpField3.TabIndex = CType(73, Short)
    '    Me.WarpField3.Text = "#ofCase"
    '    '
    '    'wfTagScn
    '    '
    '    Me.wfTagScn.DecimalPointPosition = CType(0, Short)
    '    Me.wfTagScn.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfTagScn.FontSize = WarpControl.FontSizes.Small2
    '    Me.wfTagScn.Format = ""
    '    Me.wfTagScn.InputMode.NumericOnly = True
    '    Me.wfTagScn.InputMode.Right = True
    '    Me.wfTagScn.Length = CType(3, Short)
    '    Me.wfTagScn.Location = New System.Drawing.Point(202, 157)
    '    Me.wfTagScn.MacroBcr = ""
    '    Me.wfTagScn.MacroIn = ""
    '    Me.wfTagScn.MacroKey = ""
    '    Me.wfTagScn.MacroOut = ""
    '    Me.wfTagScn.Name = "wfTagScn"
    '    Me.wfTagScn.Size = New System.Drawing.Size(36, 24)
    '    Me.wfTagScn.TabIndex = CType(72, Short)
    '    Me.wfTagScn.Text = "9"
    '    '
    '    'WarpField4
    '    '
    '    Me.WarpField4.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField4.Font = New System.Drawing.Font("lr SVbN", 16.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField4.FontSize = WarpControl.FontSizes.Small4
    '    Me.WarpField4.Format = ""
    '    Me.WarpField4.Length = CType(7, Short)
    '    Me.WarpField4.Location = New System.Drawing.Point(133, 159)
    '    Me.WarpField4.MacroBcr = ""
    '    Me.WarpField4.MacroIn = ""
    '    Me.WarpField4.MacroKey = ""
    '    Me.WarpField4.MacroOut = ""
    '    Me.WarpField4.Name = "WarpField4"
    '    Me.WarpField4.Size = New System.Drawing.Size(63, 18)
    '    Me.WarpField4.TabIndex = CType(71, Short)
    '    Me.WarpField4.Text = "TagScan"
    '    '
    '    'wfKey
    '    '
    '    Me.wfKey.BcrFlag = True
    '    Me.wfKey.DecimalPointPosition = CType(0, Short)
    '    Me.wfKey.Font = New System.Drawing.Font("lr SVbN", 16.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfKey.FontSize = WarpControl.FontSizes.Small4
    '    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(216, 180)
    '    Me.wfKey.MacroBcr = ""
    '    Me.wfKey.MacroIn = ""
    '    Me.wfKey.MacroKey = ""
    '    Me.wfKey.MacroOut = ""
    '    Me.wfKey.Name = "wfKey"
    '    Me.wfKey.Size = New System.Drawing.Size(9, 18)
    '    Me.wfKey.TabIndex = CType(70, 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.InputMode.NumericOnly = True
    '    Me.wfQty2.InputMode.Right = True
    '    Me.wfQty2.Length = CType(4, Short)
    '    Me.wfQty2.Location = New System.Drawing.Point(87, 60)
    '    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(69, Short)
    '    Me.wfQty2.Text = "9"
    '    '
    '    'WarpField9
    '    '
    '    Me.WarpField9.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField9.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField9.Format = ""
    '    Me.WarpField9.Length = CType(1, Short)
    '    Me.WarpField9.Location = New System.Drawing.Point(70, 60)
    '    Me.WarpField9.MacroBcr = ""
    '    Me.WarpField9.MacroIn = ""
    '    Me.WarpField9.MacroKey = ""
    '    Me.WarpField9.MacroOut = ""
    '    Me.WarpField9.Name = "WarpField9"
    '    Me.WarpField9.Size = New System.Drawing.Size(18, 36)
    '    Me.WarpField9.TabIndex = CType(68, 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.InputMode.NumericOnly = True
    '    Me.wfQty1.InputMode.Right = True
    '    Me.wfQty1.Length = CType(4, Short)
    '    Me.wfQty1.Location = New System.Drawing.Point(0, 60)
    '    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(67, 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(0, 40)
    '    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(66, 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.InputMode.NumericOnly = True
    '    Me.wfPkg2.InputMode.Right = True
    '    Me.wfPkg2.Length = CType(2, Short)
    '    Me.wfPkg2.Location = New System.Drawing.Point(204, 58)
    '    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(65, Short)
    '    Me.wfPkg2.Text = "9"
    '    '
    '    'WarpField6
    '    '
    '    Me.WarpField6.DecimalPointPosition = CType(0, Short)
    '    Me.WarpField6.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.WarpField6.Format = ""
    '    Me.WarpField6.Length = CType(1, Short)
    '    Me.WarpField6.Location = New System.Drawing.Point(189, 58)
    '    Me.WarpField6.MacroBcr = ""
    '    Me.WarpField6.MacroIn = ""
    '    Me.WarpField6.MacroKey = ""
    '    Me.WarpField6.MacroOut = ""
    '    Me.WarpField6.Name = "WarpField6"
    '    Me.WarpField6.Size = New System.Drawing.Size(18, 36)
    '    Me.WarpField6.TabIndex = CType(64, 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.InputMode.NumericOnly = True
    '    Me.wfPkg1.InputMode.Right = True
    '    Me.wfPkg1.Length = CType(2, Short)
    '    Me.wfPkg1.Location = New System.Drawing.Point(156, 60)
    '    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(63, 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(144, 40)
    '    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(62, Short)
    '    Me.WarpField1.Text = "#ofPackage"
    '    '
    '    'wfZ
    '    '
    '    Me.wfZ.DecimalPointPosition = CType(0, Short)
    '    Me.wfZ.DisplayAttribute.Bold = True
    '    Me.wfZ.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfZ.Format = ""
    '    Me.wfZ.Length = CType(1, Short)
    '    Me.wfZ.Location = New System.Drawing.Point(72, 153)
    '    Me.wfZ.MacroBcr = ""
    '    Me.wfZ.MacroIn = ""
    '    Me.wfZ.MacroKey = ""
    '    Me.wfZ.MacroOut = ""
    '    Me.wfZ.Name = "wfZ"
    '    Me.wfZ.Size = New System.Drawing.Size(18, 36)
    '    Me.wfZ.TabIndex = CType(61, Short)
    '    Me.wfZ.Text = "X"
    '    '
    '    'wfCL
    '    '
    '    Me.wfCL.DecimalPointPosition = CType(0, Short)
    '    Me.wfCL.DisplayAttribute.Bold = True
    '    Me.wfCL.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfCL.Format = ""
    '    Me.wfCL.Length = CType(2, Short)
    '    Me.wfCL.Location = New System.Drawing.Point(21, 153)
    '    Me.wfCL.MacroBcr = ""
    '    Me.wfCL.MacroIn = ""
    '    Me.wfCL.MacroKey = ""
    '    Me.wfCL.MacroOut = ""
    '    Me.wfCL.Name = "wfCL"
    '    Me.wfCL.Size = New System.Drawing.Size(36, 36)
    '    Me.wfCL.TabIndex = CType(60, Short)
    '    Me.wfCL.Text = "XX"
    '    '
    '    'wfPart
    '    '
    '    Me.wfPart.DecimalPointPosition = CType(0, Short)
    '    Me.wfPart.DisplayAttribute.Bold = True
    '    Me.wfPart.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfPart.Format = ""
    '    Me.wfPart.Length = CType(12, Short)
    '    Me.wfPart.Location = New System.Drawing.Point(4, 115)
    '    Me.wfPart.MacroBcr = ""
    '    Me.wfPart.MacroIn = ""
    '    Me.wfPart.MacroKey = ""
    '    Me.wfPart.MacroOut = ""
    '    Me.wfPart.Name = "wfPart"
    '    Me.wfPart.Size = New System.Drawing.Size(216, 36)
    '    Me.wfPart.TabIndex = CType(59, 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(60, 156)
    '    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(58, 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(0, 156)
    '    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(57, 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, 97)
    '    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(56, Short)
    '    Me.WarpField11.Text = "PartNo"
    '    '
    '    'wfLctn2
    '    '
    '    Me.wfLctn2.DecimalPointPosition = CType(0, Short)
    '    Me.wfLctn2.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfLctn2.FontSize = WarpControl.FontSizes.Small2
    '    Me.wfLctn2.Format = ""
    '    Me.wfLctn2.Length = CType(3, Short)
    '    Me.wfLctn2.Location = New System.Drawing.Point(129, 16)
    '    Me.wfLctn2.MacroBcr = ""
    '    Me.wfLctn2.MacroIn = ""
    '    Me.wfLctn2.MacroKey = ""
    '    Me.wfLctn2.MacroOut = ""
    '    Me.wfLctn2.Name = "wfLctn2"
    '    Me.wfLctn2.Size = New System.Drawing.Size(36, 24)
    '    Me.wfLctn2.TabIndex = CType(55, Short)
    '    Me.wfLctn2.Text = "XXX"
    '    '
    '    'WarpField5
    '    '
    '    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(1, Short)
    '    Me.WarpField5.Location = New System.Drawing.Point(103, 16)
    '    Me.WarpField5.MacroBcr = ""
    '    Me.WarpField5.MacroIn = ""
    '    Me.WarpField5.MacroKey = ""
    '    Me.WarpField5.MacroOut = ""
    '    Me.WarpField5.Name = "WarpField5"
    '    Me.WarpField5.Size = New System.Drawing.Size(12, 24)
    '    Me.WarpField5.TabIndex = CType(54, Short)
    '    Me.WarpField5.Text = "-"
    '    '
    '    'wfLctn1
    '    '
    '    Me.wfLctn1.DecimalPointPosition = CType(0, Short)
    '    Me.wfLctn1.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    '    Me.wfLctn1.FontSize = WarpControl.FontSizes.Small2
    '    Me.wfLctn1.Format = ""
    '    Me.wfLctn1.Length = CType(2, Short)
    '    Me.wfLctn1.Location = New System.Drawing.Point(84, 16)
    '    Me.wfLctn1.MacroBcr = ""
    '    Me.wfLctn1.MacroIn = ""
    '    Me.wfLctn1.MacroKey = ""
    '    Me.wfLctn1.MacroOut = ""
    '    Me.wfLctn1.Name = "wfLctn1"
    '    Me.wfLctn1.Size = New System.Drawing.Size(24, 24)
    '    Me.wfLctn1.TabIndex = CType(53, 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(91, 0)
    '    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(52, 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(7, 18)
    '    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(51, 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(50, 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(49, 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 = 48
    '    '
    '    '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)
    '    '
    '    'frm7027
    '    '
    '    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 = "frm7027"
    '    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 M7027_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
        PRINT = 12
        RETRY = 13
        NOTPACK = 14
        ALLCANCEL = 15
        GHSCAN = 16
        ZEROOK = 17
        GHNOSCAN = 18
        GHOVRSCAN = 19
    End Enum

    Public mint7027status As Integer

    Private Sub frm7027_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
            mint7027status = M7027_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_H0380, WarpBox1)
#End If
            sDisp7027()
            ' 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

    '/*
    '|| ึ”–ผFsDisp7027
    '|| T—v  F7027ๆ–ส•\ฆ
    '*/
    Private Sub sDisp7027()
        Dim wstrLctnPartNo As String

        With gstrctPPDisp
            wfCrtnNo.Text = .strCrtnNo
            'wfCase.Text = .intNumOfCase
            'wfCase.Text = 0
        End With
        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)
            wfTagScn.Text = gstrctOMData.intNumOfTagScanned
        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
        Dim rtn2 As Integer

        If (Not fCheckCode(buf)) Then
#If Not Debug Then
                        fFnc_WrpMsg("E", G_CONST_MID_E7E25)
#End If
            Exit Sub
        End If

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

        If rtn = 0 Then
            Select Case mint7027status
                Case M7027_STATUS.MENUBACK

                Case M7027_STATUS.NOTCD        'ูศ้o[R[h
                    sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
                    sOutputLog(gstrctPicsIni.strOutput_KDPP, "KDPP7E96", G_CONST_BC_GH, buf)
#If Not Debug Then
                                fFnc_WrpMsg("E", G_CONST_MID_E7E96)
#End If
                    RemoveHandler btScanLib.OnScan, AddressOf btScanLib_OnScan
                    btScanLib.Disable()

                    gintStatus = OTR_STATUS.GHSCAN
                    Me.Close()
                    Exit Sub
                Case M7027_STATUS.DONE

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

                    gintStatus = OTR_STATUS.GHSCAN 'ป•i•[XL“
                    Me.Close()
                    Exit Sub
                Case M7027_STATUS.GHOVRSCAN     'ป•i•[XL“๑”I[o[
                    sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
#If Not Debug Then
                                fFnc_WrpMsg("E", G_CONST_MID_E7E98)
#End If
                    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
        '        Dim rtn2 As Integer
        '        Dim rtn3 As Integer
        '        Dim stat As Integer
        '        Dim filePath As String
        '        Dim wstrWkDir As String
        '        Dim wstrFilePath As String
        '        Dim wstrLogData As String

        '        Try

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

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

        '                If WKey = WKY_ENT Then

        '                    If gstrctOMData.intNumOfTagScanned = 0 Then
        '                        'ป•i•[XL“”0
        '                        sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
        '#If Not Debug Then
        '                        fFnc_WrpMsg("E", G_CONST_MID_E7E97)
        '#End If
        '                    Else

        '                        'Q2L[บษเ“ฏ—lฬ—ช•K—v
        '                        rtn = fSrchPackCP4Ohmono(2)
        '                        If rtn = -2 Then  'f[^–ณตฬ๊อ’ •[๓
        '                            gintStatus = OTR_STATUS.PRINT
        '                        ElseIf rtn = 0 Then
        '                            gintStatus = OTR_STATUS.PART
        '                        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

        '                    End If

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

        '                    'มชฏธรจผฏฤ
        '                    If (Not fCheckCode(buf)) Then
        '#If Not Debug Then
        '                        fFnc_WrpMsg("E", G_CONST_MID_E7E25)
        '#End If
        '                        Exit Do
        '                    End If

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

        '                    If rtn = 0 Then
        '                        Select Case mint7027status
        '                            Case M7027_STATUS.MENUBACK

        '                            Case M7027_STATUS.NOTCD        'ูศ้o[R[h
        '                                sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
        '                                sOutputLog(gstrctPicsIni.strOutput_KDPP, "KDPP7E96", G_CONST_BC_GH, buf)
        '#If Not Debug Then
        '                                fFnc_WrpMsg("E", G_CONST_MID_E7E96)
        '#End If
        '                                gintStatus = OTR_STATUS.GHSCAN

        '                            Case M7027_STATUS.DONE

        '                                gintStatus = OTR_STATUS.GHSCAN 'ป•i•[XL“
        '                                Exit Do

        '                            Case M7027_STATUS.GHOVRSCAN     'ป•i•[XL“๑”I[o[
        '                                sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
        '#If Not Debug Then
        '                                fFnc_WrpMsg("E", G_CONST_MID_E7E98)
        '#End If
        '                        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_F4 Then

        '                ElseIf WKey = WKY_PGUP Then

        '                ElseIf WKey = WKY_F2 Then

        '                    '***“ม๊ตข***
        '                    '๓ป•i•[ฺบฐฤ•‘ถ
        '                    wstrFilePath = fgetAppPath() & "DATA"
        '                    'fBNg‘ถ`FbN
        '                    rtn2 = fMakeFolder(wstrFilePath, vbNormal)
        '                    If rtn2 = -1 Then 'tH_์ฌธ”s

        '                        f0.WarpCtrl1.MessageBox(G_CONST_EMT_DB, G_CONST_EM_FILEIO, MWA_DB_WARNING, MWA_DB_OK)

        '                    Else
        '                        wstrFilePath += "\" & gstrctKDHT.strHdNo & "SCAN.LOG"
        '                        wstrLogData = gstrctOMData.strTagData
        '                        If fSaveGHyou(wstrFilePath, wstrLogData) = -1 Then
        '                            'ป•i•[XL“f[^‘ซG[ 
        '                            f0.WarpCtrl1.MessageBox(G_CONST_EMT_DB, G_CONST_EM_FILEIO, MWA_DB_WARNING, MWA_DB_OK)
        '                        Else

        '                            rtn = fSrchPackCP4Ohmono(2)
        '                            If rtn = -2 Then  'f[^–ณตฬ๊อ’ •[๓
        '                                gintStatus = OTR_STATUS.PRINT
        '                            ElseIf rtn = 0 Then
        '                                gintStatus = OTR_STATUS.PART
        '                            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

        '                        End If
        '                    End If
        '                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 wstrFilePath As String
        Dim tmp As String
        Dim wstrLctnPartNo As String
        Dim wintQty As Integer
        Dim wstrLogData As String

        fProcInput = -1

        Try

            If pstrInput.StartsWith("A") Or pstrInput.StartsWith("B") Then  'A,Bอป•i•[
                'ป•i•[XL“”ใภฬ`FbN
                With gstrctPPDispPart
                    wstrLctnPartNo = gstrctPPDisp.strCrtnNo & .strLocation & RTrim(.strItemInCode)
                    wintQty = gstrctPPDisp.fGetQty(RTrim(wstrLctnPartNo), 0)

                    'ป•i•[ฝทฌ”ฦ•”•i‘—สฦฬ”ไr
                    If gstrctOMData.intNumOfTagScanned >= wintQty Then
                        mint7027status = M7027_STATUS.GHOVRSCAN
                        fProcInput = 0
                        Exit Function
                    End If

                End With

                'ป•i•[“ว
                '•\ฆ•”•i”ิฉ็“เ•”—p”ิษ•ฯท
                tmp = Mid(pstrInput, 1, 6) & fBackDispItem(Mid(pstrInput, 7, 10), True) & Mid(pstrInput, 17)
                If fReadGHyou(tmp) = 0 Then
                    wstrFilePath = fgetAppPath() & "DATA"
                    'fBNg‘ถ`FbN
                    rtn = fMakeFolder(wstrFilePath, vbNormal)
                    If rtn = -1 Then 'tH_์ฌธ”s

                        'f0.WarpCtrl1.MessageBox(G_CONST_EMT_DB, G_CONST_EM_FILEIO, MWA_DB_WARNING, MWA_DB_OK)
                        MessageBox.Show(G_CONST_EM_DB, G_CONST_EMT_DB, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)


                        mint7027status = M7027_STATUS.GHSCAN
                        fProcInput = 0
                        Exit Function

                    Else
                        wstrFilePath += "\" & gstrctKDHT.strHdNo & "SCAN.LOG"
                        wstrLogData = gstrctOMData.strTagData & pstrInput.Substring(1)
                        If fSaveGHyou(wstrFilePath, wstrLogData) = -1 Then
                            'ป•i•[XL“f[^‘ซG[ 
                            'f0.WarpCtrl1.MessageBox(G_CONST_EMT_DB, G_CONST_EM_FILEIO, MWA_DB_WARNING, MWA_DB_OK)
                            MessageBox.Show(G_CONST_EM_DB, G_CONST_EMT_DB, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)

                            mint7027status = M7027_STATUS.GHSCAN
                            Exit Function
                        End If
                        mint7027status = M7027_STATUS.DONE

                    End If
                    fProcInput = 0
                    Exit Function

                Else   'o[R[h^CvG[(ป•i•[ลอ ่น๑)

                    mint7027status = M7027_STATUS.NOTCD
                    fProcInput = 0
                    Exit Function

                End If

            Else

                mint7027status = M7027_STATUS.NOTCD
                fProcInput = 0
                Exit Function

            End If

        Catch ex As Exception
            sErrLog(gAppName, "fProcInput", ex.ToString)
        End Try
    End Function
    '/*
    '|| ึ”–ผFfReadGHyou
    '|| T—v  Fป•i•[“วๆ่
    '|| ๘”@Fป•i•[“—อo[R[h
    '|| –฿่’lF-1(NG) 0(OK)
    '*/
    Private Function fReadGHyou(ByVal pstrInput As String) As Integer
        Dim wstrStartChr As String
        Dim wstrWKMakerCD As String
        Dim wstrWKItemCD As String
        Dim wstrDspItemCD As String
        Dim wstrScanned As String
        fReadGHyou = -1

        Try
            wstrStartChr = pstrInput.Substring(0, 1)
            If wstrStartChr = "A" Then
                wstrWKMakerCD = pstrInput.Substring(1, 5)
                wstrWKItemCD = pstrInput.Substring(6, 10)
                wstrDspItemCD = Mid(RTrim(gstrctPPDispPart.strItemInCode), 1, 10)
            ElseIf wstrStartChr = "B" Then
                wstrWKMakerCD = pstrInput.Substring(1, 5)
                wstrWKItemCD = pstrInput.Substring(6, 12)
                wstrDspItemCD = Mid(RTrim(gstrctPPDispPart.strItemInCode), 1, 12)
            Else
                'o[R[h^Cv~X
                Exit Function
            End If

            If RTrim(wstrWKItemCD) = wstrDspItemCD Then
                With gstrctOMData
                    .intNumOfTagScanned += 1
                End With

                fReadGHyou = 0
                Exit Function
            End If

        Catch ex As Exception
            sErrLog(gAppName, "fReadGHyou", ex.ToString)
        End Try
    End Function
    '/*
    '|| ึ”–ผFfSaveGHyou
    '|| T—v  Fป•i•[f[^•‘ถ
    '|| ๘”@F1.ฬซูภ–ผ 2.ป•i•[f[^
    '|| –฿่’lF-1(NG) 0(OK)
    '*/
    Private Function fSaveGHyou(ByVal pstrFilePath As String, ByVal pstrDat As String) As Integer
        Dim wintFNo As Integer

        fSaveGHyou = -1

        Try
            'wintFNo = FreeFile()
            'FileOpen(wintFNo, pstrFilePath, OpenMode.Append, OpenAccess.Write, OpenShare.Default)
            'PrintLine(wintFNo, pstrDat)
            'FileClose(wintFNo)

            Using writer As StreamWriter = New StreamWriter(pstrFilePath, True)
                ' Write the record to the file
                writer.WriteLine(pstrDat)
            End Using

            fSaveGHyou = 0
        Catch ex As Exception
            sErrLog(gAppName, "fSaveGHyou", ex.ToString)
        End Try
    End Function

    Private Sub frm7027_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        Dim rtn As Integer
        Dim buf As String
        Dim rtn2 As Integer
        Dim rtn3 As Integer
        Dim stat As Integer
        Dim filePath As String
        Dim wstrWkDir As String
        Dim wstrFilePath As String
        Dim wstrLogData As String

        Select Case e.KeyCode.ToString()
            Case "Return"
                If gstrctOMData.intNumOfTagScanned = 0 Then
                    'ป•i•[XL“”0
                    'sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
#If Not Debug Then
                        fFnc_WrpMsg("E", G_CONST_MID_E7E97)
#End If
                    Exit Sub
                Else

                    'Q2L[บษเ“ฏ—lฬ—ช•K—v
                    rtn = fSrchPackCP4Ohmono(2)
                    If rtn = -2 Then  'f[^–ณตฬ๊อ’ •[๓

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

                        gintStatus = OTR_STATUS.PRINT
                        Me.Close()
                    ElseIf rtn = 0 Then

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

                        gintStatus = OTR_STATUS.PART
                        Me.Close()
                    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 If
                Exit Sub
            Case "F1"
                Exit Sub
            Case "F2"
                '***“ม๊ตข***
                '๓ป•i•[ฺบฐฤ•‘ถ
                wstrFilePath = fgetAppPath() & "DATA"
                'fBNg‘ถ`FbN
                rtn2 = fMakeFolder(wstrFilePath, vbNormal)
                If rtn2 = -1 Then 'tH_์ฌธ”s

                    'f0.WarpCtrl1.MessageBox(G_CONST_EMT_DB, G_CONST_EM_FILEIO, MWA_DB_WARNING, MWA_DB_OK)
                    MessageBox.Show(G_CONST_EM_DB, G_CONST_EMT_DB, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)

                Else
                    wstrFilePath += "\" & gstrctKDHT.strHdNo & "SCAN.LOG"
                    wstrLogData = gstrctOMData.strTagData
                    If fSaveGHyou(wstrFilePath, wstrLogData) = -1 Then
                        'ป•i•[XL“f[^‘ซG[ 
                        'f0.WarpCtrl1.MessageBox(G_CONST_EMT_DB, G_CONST_EM_FILEIO, MWA_DB_WARNING, MWA_DB_OK)
                        MessageBox.Show(G_CONST_EM_DB, G_CONST_EMT_DB, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)

                    Else

                        rtn = fSrchPackCP4Ohmono(2)
                        If rtn = -2 Then  'f[^–ณตฬ๊อ’ •[๓

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

                            gintStatus = OTR_STATUS.PRINT
                            Me.Close()
                        ElseIf rtn = 0 Then

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

                            gintStatus = OTR_STATUS.PART
                            Me.Close()
                        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 If
                End If
                Exit Sub


        End Select
    End Sub

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


