详细代码

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data ;

namespace POS机C井例子代码
{
 /// <summary>
 /// Form3 的摘要说明。
 /// </summary>
 public class Form3 : System.Windows.Forms.Form
 {
  private System.Windows.Forms.Label label1;
  private System.Windows.Forms.Label label2;
  private System.Windows.Forms.Label label3;
  private System.Windows.Forms.TextBox textBox1;
  private System.Windows.Forms.ProgressBar progressBar1;
  private System.Windows.Forms.Button button1;
  private System.Windows.Forms.Button button2;
  private System.Windows.Forms.Button button3;
  private System.Windows.Forms.Button button4;
  private System.Windows.Forms.Button button5;
  private System.Windows.Forms.Button button6;
  private System.Windows.Forms.Button button7;
  private System.Windows.Forms.Button button8;
  private System.Windows.Forms.Button button9;
  private System.Windows.Forms.ListView listView1;
  private Microsoft.VisualBasic.Compatibility.VB6.DriveListBox driveListBox1;
  private System.Windows.Forms.TextBox textBox2;
  /// <summary>
  /// 必需的设计器变量。
  /// </summary>
  private System.ComponentModel.Container components = null;

public Form3()
  {
   //
   // Windows 窗体设计器支持所必需的
   //
   InitializeComponent();

//
   // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
   //
  }

/// <summary>
  /// 清理所有正在使用的资源。
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if(components != null)
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }

#region Windows 窗体设计器生成的代码
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {
   this.label1 = new System.Windows.Forms.Label();
   this.label2 = new System.Windows.Forms.Label();
   this.label3 = new System.Windows.Forms.Label();
   this.textBox1 = new System.Windows.Forms.TextBox();
   this.progressBar1 = new System.Windows.Forms.ProgressBar();
   this.button1 = new System.Windows.Forms.Button();
   this.button2 = new System.Windows.Forms.Button();
   this.button3 = new System.Windows.Forms.Button();
   this.button4 = new System.Windows.Forms.Button();
   this.button5 = new System.Windows.Forms.Button();
   this.button6 = new System.Windows.Forms.Button();
   this.button7 = new System.Windows.Forms.Button();
   this.button8 = new System.Windows.Forms.Button();
   this.button9 = new System.Windows.Forms.Button();
   this.listView1 = new System.Windows.Forms.ListView();
   this.driveListBox1 = new Microsoft.VisualBasic.Compatibility.VB6.DriveListBox();
   this.textBox2 = new System.Windows.Forms.TextBox();
   this.SuspendLayout();
   //
   // label1
   //
   this.label1.Location = new System.Drawing.Point(24, 24);
   this.label1.Name = "label1";
   this.label1.Size = new System.Drawing.Size(64, 23);
   this.label1.TabIndex = 0;
   this.label1.Text = "挂失管理";
   //
   // label2
   //
   this.label2.Location = new System.Drawing.Point(112, 24);
   this.label2.Name = "label2";
   this.label2.Size = new System.Drawing.Size(64, 23);
   this.label2.TabIndex = 1;
   this.label2.Text = "总挂失数";
   //
   // label3
   //
   this.label3.Location = new System.Drawing.Point(112, 352);
   this.label3.Name = "label3";
   this.label3.Size = new System.Drawing.Size(32, 23);
   this.label3.TabIndex = 2;
   this.label3.Text = "卡号";
   //
   // textBox1
   //
   this.textBox1.Location = new System.Drawing.Point(184, 24);
   this.textBox1.Name = "textBox1";
   this.textBox1.TabIndex = 3;
   this.textBox1.Text = "0";
   //
   // progressBar1
   //
   this.progressBar1.Location = new System.Drawing.Point(488, 24);
   this.progressBar1.Maximum = 10000;
   this.progressBar1.Name = "progressBar1";
   this.progressBar1.Size = new System.Drawing.Size(136, 23);
   this.progressBar1.TabIndex = 4;
   //
   // button1
   //
   this.button1.Location = new System.Drawing.Point(16, 72);
   this.button1.Name = "button1";
   this.button1.Size = new System.Drawing.Size(80, 32);
   this.button1.TabIndex = 5;
   this.button1.Text = "增加挂失";
   this.button1.Click += new System.EventHandler(this.button1_Click);
   //
   // button2
   //
   this.button2.Location = new System.Drawing.Point(16, 120);
   this.button2.Name = "button2";
   this.button2.Size = new System.Drawing.Size(80, 32);
   this.button2.TabIndex = 6;
   this.button2.Text = "清 空";
   this.button2.Click += new System.EventHandler(this.button2_Click);
   //
   // button3
   //
   this.button3.Location = new System.Drawing.Point(568, 72);
   this.button3.Name = "button3";
   this.button3.Size = new System.Drawing.Size(144, 48);
   this.button3.TabIndex = 7;
   this.button3.Text = "覆盖式发送左边列表中所有挂失卡号至设备";
   this.button3.Click += new System.EventHandler(this.button3_Click);
   //
   // button4
   //
   this.button4.Location = new System.Drawing.Point(568, 144);
   this.button4.Name = "button4";
   this.button4.Size = new System.Drawing.Size(144, 48);
   this.button4.TabIndex = 8;
   this.button4.Text = "<<从设备中读取所有挂失信息";
   this.button4.Click += new System.EventHandler(this.button4_Click);
   //
   // button5
   //
   this.button5.Location = new System.Drawing.Point(568, 224);
   this.button5.Name = "button5";
   this.button5.Size = new System.Drawing.Size(48, 32);
   this.button5.TabIndex = 9;
   this.button5.Text = "刷新";
   this.button5.Click += new System.EventHandler(this.button5_Click);
   //
   // button6
   //
   this.button6.Location = new System.Drawing.Point(568, 280);
   this.button6.Name = "button6";
   this.button6.Size = new System.Drawing.Size(144, 48);
   this.button6.TabIndex = 10;
   this.button6.Text = "写所有挂失信息至U盘或磁盘";
   this.button6.Click += new System.EventHandler(this.button6_Click);
   //
   // button7
   //
   this.button7.Location = new System.Drawing.Point(224, 352);
   this.button7.Name = "button7";
   this.button7.Size = new System.Drawing.Size(136, 48);
   this.button7.TabIndex = 11;
   this.button7.Text = "追加式从设备取消单个卡号挂失";
   this.button7.Click += new System.EventHandler(this.button7_Click);
   //
   // button8
   //
   this.button8.Location = new System.Drawing.Point(392, 352);
   this.button8.Name = "button8";
   this.button8.Size = new System.Drawing.Size(144, 48);
   this.button8.TabIndex = 12;
   this.button8.Text = "追加式挂失单个卡号至设备";
   this.button8.Click += new System.EventHandler(this.button8_Click);
   //
   // button9
   //
   this.button9.Location = new System.Drawing.Point(568, 352);
   this.button9.Name = "button9";
   this.button9.Size = new System.Drawing.Size(144, 48);
   this.button9.TabIndex = 13;
   this.button9.Text = "从设备中查询卡号是否已被挂失";
   this.button9.Click += new System.EventHandler(this.button9_Click);
   //
   // listView1
   //
   this.listView1.Location = new System.Drawing.Point(112, 72);
   this.listView1.Name = "listView1";
   this.listView1.Size = new System.Drawing.Size(440, 256);
   this.listView1.TabIndex = 14;
   this.listView1.View = System.Windows.Forms.View.List;
   //
   // driveListBox1
   //
   this.driveListBox1.Location = new System.Drawing.Point(624, 224);
   this.driveListBox1.Name = "driveListBox1";
   this.driveListBox1.Size = new System.Drawing.Size(88, 22);
   this.driveListBox1.TabIndex = 15;
   //
   // textBox2
   //
   this.textBox2.Location = new System.Drawing.Point(152, 352);
   this.textBox2.Name = "textBox2";
   this.textBox2.Size = new System.Drawing.Size(56, 21);
   this.textBox2.TabIndex = 16;
   this.textBox2.Text = "12";
   //
   // Form3
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
   this.ClientSize = new System.Drawing.Size(752, 422);
   this.Controls.Add(this.textBox2);
   this.Controls.Add(this.driveListBox1);
   this.Controls.Add(this.listView1);
   this.Controls.Add(this.button9);
   this.Controls.Add(this.button8);
   this.Controls.Add(this.button7);
   this.Controls.Add(this.button6);
   this.Controls.Add(this.button5);
   this.Controls.Add(this.button4);
   this.Controls.Add(this.button3);
   this.Controls.Add(this.button2);
   this.Controls.Add(this.button1);
   this.Controls.Add(this.progressBar1);
   this.Controls.Add(this.textBox1);
   this.Controls.Add(this.label3);
   this.Controls.Add(this.label2);
   this.Controls.Add(this.label1);
   this.Name = "Form3";
   this.Text = "Form3";
   this.ResumeLayout(false);

}
  #endregion

private void button1_Click(object sender, System.EventArgs e)
  {
   Form5 f5=new Form5();
  
   f5.ShowDialog();

String  str;

str = f5.Value;                                 //InputBox("请输入卡号,必须为小于65535的数字", 输入卡号);
   this.listView1.Items.Add(str);
  }

private void button2_Click(object sender, System.EventArgs e)
  {
  
   this.listView1.Clear ();
  }

private void button3_Click(object sender, System.EventArgs e)
  {
   int i;
   Form1 f3 ;
   f3 = (Form1)this.Owner;
   f3.Refresh();
      
   if( f3.axPOS011.DevComPortOpen == 1)
   {
    f3.axPOS011.DevLossClearFromBuf();          // 先清空缓冲
        
    for (i = 0;i<listView1.Items.Count ;i++)
    {
    
     f3.axPOS011.CardCustomNumberStr = listView1.Items[i].Text;
     f3.axPOS011.DevLossAddToBuf();           //加入挂失信息缓冲
    }

f3.axPOS011.DevNumber = Convert.ToInt32(f3.textBox16.Text);
    this.progressBar1.Maximum = f3.axPOS011.DevLossFrames;
    this.progressBar1.Value = 0;
     
            
    for( i = 0 ;i<=f3.axPOS011.DevLossFrames - 1;i++)
    {
     f3.axPOS011.DevLossFramePoint = i;
     f3.axPOS011.DevLossFrameWrite();
     if( f3.axPOS011.OperatingResults != 0)
         
     {break;}
     else
     {
      this.progressBar1.Value = i + 1;
           
     }

}
            
    if (f3.axPOS011.OperatingResults == 0 )

{
     MessageBox.Show ( "下载挂失信息成功!");
    }
    else
    {
     MessageBox.Show(Convert.ToString (f3.axPOS011.OperatingResults));
    }
   }
   else
   {
    MessageBox.Show( "端口未打开!");

}
  }

private void button4_Click(object sender, System.EventArgs e)
  {
   Form1 f3 ;
   f3 = (Form1)this.Owner;
   f3.Refresh();
   int i;
   if (f3.axPOS011.DevComPortOpen == 1 )
   {
    f3.axPOS011.DevNumber = Convert.ToInt32(f3.textBox16.Text );
    this.progressBar1.Maximum=f3.axPOS011.DevLossFrames;
    this.progressBar1.Value =0;     
           
    for (i = 0 ;i<f3.axPOS011.DevLossFrames ;i++)
    {
     f3.axPOS011.DevLossFramePoint = i;
     f3.axPOS011.DevLossFrameRead();
     if (f3.axPOS011.OperatingResults != 0 )
     {
      break;
     }
     else
     {
      this.progressBar1.Value=i+1;
     }
    }
           
    if (f3.axPOS011.OperatingResults == 0)
    {
     if (f3.axPOS011.DevLossBufSize > 0)
     {
      for (i = 0;i<f3.axPOS011.DevLossBufSize ;i++)                     
      {
       f3.axPOS011.DevLossBufPoint = i;                          
       listView1.Items.Add( f3.axPOS011.CardCustomNumberStr);
                       
      }     
      MessageBox.Show ( "提取挂失信息成功!");
     }
    }
                           
    else
    {
     MessageBox.Show( Convert.ToString (f3.axPOS011.OperatingResults));

}
   
     }
   else
   {
    MessageBox.Show( "端口未打开!");
   }
  
  }

private void button5_Click(object sender, System.EventArgs e)
  {
   this.driveListBox1.Refresh();
  }

private void button6_Click(object sender, System.EventArgs e)
  {
   Form1 f3 ;
   f3 = (Form1)this.Owner;
   f3.Refresh();
      int i;

f3.axPOS011.DevLossClearFromBuf();      //先清空缓冲
        
   for (i = 0;i<listView1.Items.Count ;i++)
   {
   
    f3.axPOS011.CardCustomNumberStr = listView1.Items[i].Text;
    f3.axPOS011.DevLossAddToBuf();           //加入挂失信息缓冲
   }
        
   f3.axPOS011.DevDriverStr =this.driveListBox1.Drive;
        
   f3.axPOS011.DevLossWriteAllToDisk();
        
        
   if (f3.axPOS011.OperatingResults == 0 )
   {
    MessageBox.Show ( "写覆盖式挂失信息到U盘或磁盘成功!");
   }
   else
   {
    MessageBox.Show(Convert.ToString ( f3.axPOS011.OperatingResults));
   }

}

private void button9_Click(object sender, System.EventArgs e)
  {

Form1 f3 ;
   f3 = (Form1)this.Owner;
   f3.Refresh();

if( f3.axPOS011.DevComPortOpen == 1)
   {
    f3.axPOS011.DevNumber = Convert.ToInt32(f3.textBox16.Text );
    f3.axPOS011.CardCustomNumberStr = textBox2.Text ;        //自编卡号
    f3.axPOS011.DevLossBitRead();

if( f3.axPOS011.OperatingResults == 0 )
    {
     MessageBox.Show ( "该卡号已被挂失!");
    }
            
    else if (f3.axPOS011.OperatingResults == 113 )
    {
     MessageBox.Show ( "该卡号可使用!");
    }
    else
    {
     MessageBox.Show ( "设备通讯不通!");
    }
   }
   else
   {
    MessageBox.Show  ("端口未打开!");
   }
 
  }

private void button8_Click(object sender, System.EventArgs e)
  {

Form1 f3 ;
   f3 = (Form1)this.Owner;
   f3.Refresh();
 
   if (f3.axPOS011.DevComPortOpen == 1 )
   {
    f3.axPOS011.DevNumber = Convert.ToInt32(f3.textBox16.Text );
    f3.axPOS011.CardCustomNumberStr = textBox1.Text ;          //自编卡号
    f3.axPOS011.DevLossBitWrite();
           
           
    if (f3.axPOS011.OperatingResults == 0 )
    {
     MessageBox.Show ( "挂失单张卡号成功!");
    }
    
           
    else
    {
     MessageBox.Show("设备通讯不通!");
    }
   }
   else
    {
     MessageBox.Show( "端口未打开!");
    }

}

private void button7_Click(object sender, System.EventArgs e)
  {

Form1 f3 ;
   f3 = (Form1)this.Owner;
   f3.Refresh();
 
   if (f3.axPOS011.DevComPortOpen == 1)
    {
     f3.axPOS011.DevNumber = Convert.ToInt32(f3.textBox16.Text );  //指定设备号
     f3.axPOS011.CardCustomNumberStr = textBox2.Text  ;            //自编卡号
     f3.axPOS011.DevLossBitClear();                                //在设备中清空该卡号的挂失信息

if( f3.axPOS011.OperatingResults == 0 )                      
      {
       MessageBox.Show ("取消单张卡号成功!");
      
      }
     else
      {
       MessageBox.Show( "设备通讯不通!");
      }
    }
     else
    {
     MessageBox.Show ("端口未打开!");
    }

}
 }
}

转载于:https://blog.51cto.com/reader/597062

POS消费机C#例子代码相关推荐

  1. POS机C井例子代码(2)

    详细代码 using System; using System.Drawing; using System.Collections; using System.ComponentModel; usin ...

  2. c语言快餐店pos机计费系统,消费机,售饭机,食堂刷卡机,食堂收费机,餐饮收费POS机 -- 新开普(股票代码,300248)...

    产品概述 新开普餐饮收费POS机是一款基于ARM Cortex-M3平台的32位智能卡支付终端产品,采用非接触式的IC卡实现电子货币消费功能.智能卡支付终端专为读写 CPU卡而设计,并全面兼容Mifa ...

  3. POS消费小票(签购单)上的“秘密”

    POS消费小票(签购单),其实还隐藏着不少的你知道的和不知道的"秘密". 首先你看到签购单的项是收单银行,它表明你刷卡的商户是那个银行的签约商户,通常是以该银行的表识和文字表示的. ...

  4. LED数字显示消费机设置说明

    QQ:954486673 微信:13822155058 淘宝:https://shop73172356.taobao.com/ F0:(表示按FUNC,再按0),改管理员密码 F1:更改时间 F2:设 ...

  5. 华为电脑c语言总是错误,关于华为机试题求代码!解决方法

    关于华为机试题求代码!!! n个字符串,1 如n=3 1.what is local bus? 2.this is local bus. 3.local bus is name sdhfj. 那么最长 ...

  6. cm60消费机说明书_中控CM50、CM60消费机二次开发SDK

    [实例简介] 中控CM50.CM60消费机二次开发SDK 有Dephi,VC,VB源码和SDK说明文档 [实例截图] [核心代码] 8181a865-3b0f-4bfe-87b3-457de018eb ...

  7. FileInputStream与FileOutputStream 复制文件例子代码

    FileInputStream与FileOutputStream 复制文件例子代码 try {File sourceFile = new File("C:\\Users\\prize\\De ...

  8. java2实用教程第5版第九章_java2实用教程(例子代码)第4版第九章.doc

    java2实用教程(例子代码)第4版第九章 java2实用教程(例子代码)第4版第九章 例9_3 Lt4_3.java public clss Lt4_3 { public static void m ...

  9. 人脸离线识别模块_人脸消费机离线刷脸如何实现?

    随着越来越多刷卡刷脸一卡通的设备出现.大家在享受一卡通的便利的同时.也在考虑人脸消费机的基本功能和安全属性,人脸消费机,是指人脸在消费访客管理方面的相关.在人脸刷脸进行消费的时候是一下几个阶段1.人脸 ...

最新文章

  1. shell命令之(一) 初探grep
  2. node 压缩图片_为了你安全压缩图片我操碎了心
  3. 声明式事务和编程式事务
  4. 下周开幕!给深圳的嵌入式和电子工程师准备的嘉年华来了
  5. 【华为云技术分享】云图说 | 华为云MCP多云容器平台,让您轻松灾备!
  6. Android 代码混淆、第三方平台加固加密、渠道分发 完整教程(转)
  7. python爬知识星球付费数据_Python 爬取知识星球数据
  8. 蓝桥杯题目练习 提升篇 [蓝桥杯2018初赛]三体攻击
  9. 【EJB学习笔记】——EJB开发环境搭建(Eclipse集成JBoss)
  10. Web前端CSS颜色代码大全
  11. 在线考试系统毕业设计设计过程及部分代码
  12. 微信编辑器新手入门必读
  13. 阿里云服务器ECS测评
  14. 百度统计热力图邀请码
  15. java8中的lambda表达式实用详解
  16. 经典风险因子模型 对于中国股票市场定价解释能力初探
  17. SqlServer的LDF文件丢失, 如何仅用MDF文件恢复数据库呢?(已解决)
  18. 怎样参与火箭计划币_从目的到计划不是火箭科学
  19. ​蔚来高速换电站,大家还没看懂的护城河
  20. Python基础教程(第三版)读书笔记(5)

热门文章

  1. 介绍Cassandra中的压缩
  2. PHP快速入门教程:WHILE循环示例
  3. 黑客秘籍:7个有趣的信息安全项目
  4. python | 三种可变参数简述
  5. linux的文件link占用空间的差别,Linux重要知识点汇总——磁盘与文件系统管理
  6. hdfs安全模式退出_浅谈HDFS(二)之NameNode与SecondaryNameNode
  7. MySQL 高级 - 语法 - if判断
  8. Nacos源码BeatInfo
  9. Nginx的http块MIME-Type的使用
  10. JAX-RS协议说明