POS消费机VB.NET源代码(2)

界面图

 

 

 

 

详细代码

 

 

Public Class Form2
    Inherits System.Windows.Forms.Form

'广州荣士电子有限公司,联系电话020-82318861,82322852,定制13826029618 网址http://www.icmcu.com


#Region " Windows 窗体设计器生成的代码 "

    Public Sub New()
        MyBase.New()

        '该调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        '在 InitializeComponent() 调用之后添加任何初始化

    End Sub

    '窗体重写 dispose 以清理组件列表。
    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 窗体设计器所必需的
    Private components As System.ComponentModel.IContainer

    '注意: 以下过程是 Windows 窗体设计器所必需的
    '可以使用 Windows 窗体设计器修改此过程。
    '不要使用代码编辑器修改它。
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents Button3 As System.Windows.Forms.Button
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Button4 As System.Windows.Forms.Button
    Friend WithEvents DriveListBox1 As Microsoft.VisualBasic.Compatibility.VB6.DriveListBox
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
    Friend WithEvents ProgressBar1 As System.Windows.Forms.ProgressBar
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents Button5 As System.Windows.Forms.Button
    Friend WithEvents Button6 As System.Windows.Forms.Button
    Friend WithEvents Button7 As System.Windows.Forms.Button
    Friend WithEvents ListView1 As System.Windows.Forms.ListView
    Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader
    Friend WithEvents ColumnHeader2 As System.Windows.Forms.ColumnHeader
    Friend WithEvents ColumnHeader3 As System.Windows.Forms.ColumnHeader
    Friend WithEvents ColumnHeader4 As System.Windows.Forms.ColumnHeader
    Friend WithEvents ColumnHeader5 As System.Windows.Forms.ColumnHeader
    Friend WithEvents ColumnHeader6 As System.Windows.Forms.ColumnHeader
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Button1 = New System.Windows.Forms.Button
        Me.Button2 = New System.Windows.Forms.Button
        Me.Button3 = New System.Windows.Forms.Button
        Me.Label1 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label3 = New System.Windows.Forms.Label
        Me.Label4 = New System.Windows.Forms.Label
        Me.Button4 = New System.Windows.Forms.Button
        Me.DriveListBox1 = New Microsoft.VisualBasic.Compatibility.VB6.DriveListBox
        Me.TextBox1 = New System.Windows.Forms.TextBox
        Me.TextBox2 = New System.Windows.Forms.TextBox
        Me.TextBox3 = New System.Windows.Forms.TextBox
        Me.ProgressBar1 = New System.Windows.Forms.ProgressBar
        Me.Label6 = New System.Windows.Forms.Label
        Me.Button5 = New System.Windows.Forms.Button
        Me.Button6 = New System.Windows.Forms.Button
        Me.Button7 = New System.Windows.Forms.Button
        Me.ListView1 = New System.Windows.Forms.ListView
        Me.ColumnHeader1 = New System.Windows.Forms.ColumnHeader
        Me.ColumnHeader2 = New System.Windows.Forms.ColumnHeader
        Me.ColumnHeader3 = New System.Windows.Forms.ColumnHeader
        Me.ColumnHeader4 = New System.Windows.Forms.ColumnHeader
        Me.ColumnHeader5 = New System.Windows.Forms.ColumnHeader
        Me.ColumnHeader6 = New System.Windows.Forms.ColumnHeader
        Me.SuspendLayout()
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(16, 24)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(112, 32)
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "采集记录"
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(24, 104)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(80, 40)
        Me.Button2.TabIndex = 1
        Me.Button2.Text = "删除记录"
        '
        'Button3
        '
        Me.Button3.Location = New System.Drawing.Point(128, 104)
        Me.Button3.Name = "Button3"
        Me.Button3.Size = New System.Drawing.Size(80, 40)
        Me.Button3.TabIndex = 2
        Me.Button3.Text = "清空列表"
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(160, 24)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(64, 23)
        Me.Label1.TabIndex = 3
        Me.Label1.Text = "记录总数"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(160, 56)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(80, 23)
        Me.Label2.TabIndex = 4
        Me.Label2.Text = "未上传总金额"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(312, 24)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(72, 23)
        Me.Label3.TabIndex = 5
        Me.Label3.Text = "总传输帧数"
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(344, 56)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(64, 23)
        Me.Label4.TabIndex = 6
        Me.Label4.Text = "分钱"
        '
        'Button4
        '
        Me.Button4.Location = New System.Drawing.Point(352, 104)
        Me.Button4.Name = "Button4"
        Me.Button4.Size = New System.Drawing.Size(72, 32)
        Me.Button4.TabIndex = 8
        Me.Button4.Text = "刷 新"
        '
        'DriveListBox1
        '
        Me.DriveListBox1.Location = New System.Drawing.Point(440, 112)
        Me.DriveListBox1.Name = "DriveListBox1"
        Me.DriveListBox1.Size = New System.Drawing.Size(64, 22)
        Me.DriveListBox1.TabIndex = 9
        '
        'TextBox1
        '
        Me.TextBox1.Location = New System.Drawing.Point(232, 24)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(72, 21)
        Me.TextBox1.TabIndex = 10
        Me.TextBox1.Text = ""
        '
        'TextBox2
        '
        Me.TextBox2.Location = New System.Drawing.Point(384, 24)
        Me.TextBox2.Name = "TextBox2"
        Me.TextBox2.Size = New System.Drawing.Size(72, 21)
        Me.TextBox2.TabIndex = 11
        Me.TextBox2.Text = ""
        '
        'TextBox3
        '
        Me.TextBox3.Location = New System.Drawing.Point(240, 56)
        Me.TextBox3.Name = "TextBox3"
        Me.TextBox3.TabIndex = 12
        Me.TextBox3.Text = ""
        '
        'ProgressBar1
        '
        Me.ProgressBar1.Location = New System.Drawing.Point(472, 24)
        Me.ProgressBar1.Name = "ProgressBar1"
        Me.ProgressBar1.TabIndex = 13
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(592, 24)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(192, 23)
        Me.Label6.TabIndex = 14
        Me.Label6.Text = "已采集"
        '
        'Button5
        '
        Me.Button5.Location = New System.Drawing.Point(728, 56)
        Me.Button5.Name = "Button5"
        Me.Button5.Size = New System.Drawing.Size(80, 32)
        Me.Button5.TabIndex = 15
        Me.Button5.Text = "暂 停"
        '
        'Button6
        '
        Me.Button6.Location = New System.Drawing.Point(528, 96)
        Me.Button6.Name = "Button6"
        Me.Button6.Size = New System.Drawing.Size(104, 40)
        Me.Button6.TabIndex = 16
        Me.Button6.Text = "从U盘提取记录"
        '
        'Button7
        '
        Me.Button7.Location = New System.Drawing.Point(664, 96)
        Me.Button7.Name = "Button7"
        Me.Button7.Size = New System.Drawing.Size(144, 40)
        Me.Button7.TabIndex = 17
        Me.Button7.Text = "生成删除记录许可文件"
        '
        'ListView1
        '
        Me.ListView1.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1, Me.ColumnHeader2, Me.ColumnHeader3, Me.ColumnHeader4, Me.ColumnHeader5, Me.ColumnHeader6})
        Me.ListView1.Location = New System.Drawing.Point(24, 152)
        Me.ListView1.Name = "ListView1"
        Me.ListView1.Size = New System.Drawing.Size(784, 248)
        Me.ListView1.TabIndex = 18
        Me.ListView1.View = System.Windows.Forms.View.Details
        '
        'ColumnHeader1
        '
        Me.ColumnHeader1.Text = "卡号"
        '
        'ColumnHeader2
        '
        Me.ColumnHeader2.Text = "充值次数"
        Me.ColumnHeader2.Width = 72
        '
        'ColumnHeader3
        '
        Me.ColumnHeader3.Text = "余额"
        Me.ColumnHeader3.Width = 90
        '
        'ColumnHeader4
        '
        Me.ColumnHeader4.Text = "消费额"
        Me.ColumnHeader4.Width = 83
        '
        'ColumnHeader5
        '
        Me.ColumnHeader5.Text = "消费时间"
        Me.ColumnHeader5.Width = 164
        '
        'ColumnHeader6
        '
        Me.ColumnHeader6.Text = "餐次"
        '
        'Form2
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(864, 422)
        Me.Controls.Add(Me.ListView1)
        Me.Controls.Add(Me.Button7)
        Me.Controls.Add(Me.Button6)
        Me.Controls.Add(Me.Button5)
        Me.Controls.Add(Me.Label6)
        Me.Controls.Add(Me.ProgressBar1)
        Me.Controls.Add(Me.TextBox3)
        Me.Controls.Add(Me.TextBox2)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.DriveListBox1)
        Me.Controls.Add(Me.Button4)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.Button3)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.Name = "Form2"
        Me.Text = "Form2"
        Me.ResumeLayout(False)

    End Sub

#End Region
    Dim iscontinue1 As Boolean

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim f2 As Form1
        f2 = Me.Owner

        Dim long_i As Long
        Dim plist As ListViewItem


        If f2.AxPOS011.DevComPortOpen = 1 Then
            f2.AxPOS011.DevNumber = CLng(f2.TextBox18.Text)
            f2.AxPOS011.DevRecTotalRead()

            If f2.AxPOS011.OperatingResults = 0 Then

                TextBox3.Text = f2.AxPOS011.DevRecAmountTotal '累计金额数

                TextBox1.Text = f2.AxPOS011.DevRecTotal '总记录数
                TextBox2.Text = f2.AxPOS011.DevRecFrames '记录总帧数

                '以下代码开始采集记录
                If (f2.AxPOS011.DevRecFrames > 0) Then '有记录需要采集
                    iscontinue1 = True
                    ProgressBar1.Maximum = f2.AxPOS011.DevRecFrames

                    For long_i = 0 To f2.AxPOS011.DevRecFrames - 1
                        f2.AxPOS011.DevRecFramePoint = long_i '设定当前需要采集的帧指针
                        f2.AxPOS011.DevRecFrameRead() '执行采集通讯
                        If f2.AxPOS011.OperatingResults <> 0 Then
                            '表示通讯错误,采集中断
                            MsgBox("通讯错误,退出,错误代码为" + CStr(f2.AxPOS011.OperatingResults))
                            Exit For
                        End If

                        If iscontinue1 = False Then

                            Exit For
                        End If

                        '以下可以做进度条算法
                        ProgressBar1.Value = long_i + 1
                        Label6.Text = "已采集" + CStr(long_i + 1)

                    Next

                    If (ProgressBar1.Value = f2.AxPOS011.DevRecFrames) Then


                        If f2.AxPOS011.OperatingResults = 0 Then
                            '采集全部成功
                            If f2.AxPOS011.DevRecTotal > 0 Then
                                '下面为提取数据

                                For long_i = 0 To f2.AxPOS011.DevRecTotal - 1
                                    f2.AxPOS011.DevRecPoint = long_i '设定当前记录指针,用于提取记录数据,
                                    '执行完本语句后,以下数据才有效

                                    plist = ListView1.Items.Add(f2.AxPOS011.CardCustomNumberStr)      '卡号

                                    'plist.Text = f2.AxPOS011.DevRecCustomNumberStr '卡号
                                    plist.SubItems.Add(CStr(f2.AxPOS011.DevRecRechargeTimes))         '充值次数

                                    plist.SubItems.Add(f2.AxPOS011.DevRecCardMoney)                   '余额

                                    plist.SubItems.Add(f2.AxPOS011.DevRecConsumption)                  '当次消费额
                                    plist.SubItems.Add(CStr(f2.AxPOS011.DevRecTimeYear) + "-" + CStr(f2.AxPOS011.DevRecTimeMonth) + "-" + CStr(f2.AxPOS011.DevRecTimeDay) + " " + CStr(f2.AxPOS011.DevRecTimeHour) + ":" + CStr(f2.AxPOS011.DevRecTimeMinute) + ":" + CStr(f2.AxPOS011.DevRecTimeSecond))
                                    plist.SubItems.Add(f2.AxPOS011.DevRecMealType)

 

                                Next
                            End If

                        End If
                    End If


                End If

            Else
                MsgBox("设备通讯不通!")
            End If
        Else
            MsgBox("端口未打开!")
        End If

    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click


        Dim f2 As Form1
        f2 = Me.Owner


        Dim long_i As Long
        Dim plist As ListViewItem

        f2.AxPOS011.DevDriverStr = DriveListBox1.Drive 'U盘
        f2.AxPOS011.DevNumber = CLng(f2.TextBox18.Text) '机号

        f2.AxPOS011.DevRecReadFromDisk()

        If f2.AxPOS011.OperatingResults = 0 Then

            TextBox3.Text = f2.AxPOS011.DevRecAmountTotal '累计金额数

            TextBox1.Text = f2.AxPOS011.DevRecTotal '总记录数

            For long_i = 0 To f2.AxPOS011.DevRecTotal - 1
                f2.AxPOS011.DevRecPoint = long_i '设定当前记录指针,用于提取记录数据,
                '执行完本语句后,以下数据才有效

                plist = ListView1.Items.Add(f2.AxPOS011.CardCustomNumberStr)

                'plist.Text = f2.AxPOS011.DevRecCustomNumberStr '卡号
                plist.SubItems.Add(CStr(f2.AxPOS011.DevRecRechargeTimes))  '充值次数

                plist.SubItems.Add(f2.AxPOS011.DevRecCardMoney)  '余额

                plist.SubItems.Add(f2.AxPOS011.DevRecConsumption)   '当次消费额
                plist.SubItems.Add(CStr(f2.AxPOS011.DevRecTimeYear) + "-" + CStr(f2.AxPOS011.DevRecTimeMonth) + "-" + CStr(f2.AxPOS011.DevRecTimeDay) + " " + CStr(f2.AxPOS011.DevRecTimeHour) + ":" + CStr(f2.AxPOS011.DevRecTimeMinute) + ":" + CStr(f2.AxPOS011.DevRecTimeSecond))
                plist.SubItems.Add(f2.AxPOS011.DevRecMealType)

 

            Next

 

 

            MsgBox("从U盘提取记录成功!")
        ElseIf f2.AxPOS011.OperatingResults = 40 Then
            MsgBox("该机号对应的记录文件不存在") '
        ElseIf f2.AxPOS011.OperatingResults = 45 Then
            MsgBox("文件不是该机号设备生成的文件!") '
        Else
            MsgBox(f2.AxPOS011.OperatingResults)
        End If
    End Sub

    'Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    '    Dim list2 As ListViewItem
    '    list2 = New ListViewItem("0")
    '    list2.SubItems.Add("1")
    '    list2.SubItems.Add("2")
    '    list2.SubItems.Add("3")
    '    list2.SubItems.Add("4")
    '    list2.SubItems.Add("5")
    '    ListView1.Items.Add(list2)

 


    'End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        ListView1.Items.Clear()

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim f2 As Form1
        f2 = Me.Owner

        If f2.AxPOS011.DevComPortOpen = 1 Then
            f2.AxPOS011.DevNumber = CLng(f2.TextBox18.Text)

            f2.AxPOS011.DevRecDelete()
            If f2.AxPOS011.OperatingResults = 0 Then
                MsgBox("删除记录成功!")
            ElseIf f2.AxPOS011.OperatingResults = 112 Then
                MsgBox("记录未完全上传,无法删除!")
            ElseIf f2.AxPOS011.OperatingResults = 111 Then
                MsgBox("删除失败,请先按流程采集数据才能删除!")


            Else
                MsgBox(f2.AxPOS011.OperatingResults)

            End If
        Else
            MsgBox("端口未打开!")
        End If


    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        DriveListBox1.Refresh()

    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        iscontinue1 = False
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click

        Dim f2 As Form1
        f2 = Me.Owner


        f2.AxPOS011.DevDriverStr = DriveListBox1.Drive

        f2.AxPOS011.DevNumber = CLng(f2.TextBox18.Text)
        f2.AxPOS011.DevRecClearFileToDisk()

        If f2.AxPOS011.OperatingResults = 0 Then

            MsgBox("写记录删除许可文件到U盘成功!")
        ElseIf f2.AxPOS011.OperatingResults = 46 Then
            MsgBox("尚未提取文件记录!")
        Else
            MsgBox(f2.AxPOS011.OperatingResults)
        End If
    End Sub
End Class

 

一、源码描述 这是超市商店会员刷卡消费综合管理系统,功能十分的强大,可以作为二次开发或者毕业设计 使用,感兴趣的可以下载看看啊。 二、功能介绍 该源码主要包括管理员后台和会员后台两大部分,具体功能如下: 网站前台模块: 1、会员管理:会员办卡、会员密码修改、增加积分、扣除积分、会员充值、会员退款、会员列表。 2、消费管理:销售收银、快速消费、现金退货、会员退货。 3、商品管理:类别管理、新增商品、商品设置、库存管理、进价提成设置。 4、统计报表:充值明细报表、收入明细报表、消费明细报表、积分明细报表、出库入库报表、会员信息 报表、积分排行报表、利润统计报表、商品销售统计。 5、短信提醒:会员生日提醒、节日活动提醒、短信发送明细。 6、个人设置:修改密码。 7、系统设置:参数设置、店铺设置、会员卡设置、角色管理、用户管理、系统日志。 网站会员后台模块 1、会员中心。 2、商品列表。 3、礼品中心。 4、充值记录。 5、对换记录。 6、充值记录。 三、注意事项 1、后台管理员用户名密码均是:51aspx,会员用户名16801553,密码123456。 2、开发环境为Visual Studio 2010,数据库为SQL Server 2005,数据库文件在DB_51aspx文件夹中, 使用.net 4.0开发。 3、默认数据库连接字符串在webconfig配置文件中修改。 4、会员登陆页面为User_Default.aspx。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值