谁做过钱柜系统高手进 大家都见过超市里收音员敲回车后收款机器自动弹出钱箱(装钱的)谁知道哪个用C#是怎么实现的!请高手指点 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我以前做过超市系统。这个调用厂商提供的开发包就行了。。一般是个dll....那个东西不叫“钱柜”,叫“钱箱”。你一说“钱柜系统”,我还以为是你们在做ktv点歌系统呢。呵呵。by the way ..钱柜实在是贵的要死。不是单位掏钱,打死都不去。。^_^ 我还以为是KTV的点歌系统呢这个估计首先要了解硬件接口吧? 钱柜有一个Com口与电脑相连通过C#给这个Com口写个字符串就可以了 建个Class如下:using System;using System.Runtime.InteropServices;using System.IO;namespace Common{ /// <summary> /// POSPrinter 的摘要说明。 /// </summary> public class POSPrinter { const int OPEN_EXISTING = 3; string prnPort ="COM1"; [DllImport("kernel32.dll", CharSet=CharSet.Auto)] private static extern IntPtr CreateFile(string lpFileName, int dwDesiredAccess, int dwShareMode, int lpSecurityAttributes, int dwCreationDisposition , int dwFlagsAndAttributes , int hTemplateFile); public POSPrinter() { // // TODO: 在此处添加构造函数逻辑 // } public POSPrinter(string prnPort) { this.prnPort=prnPort;//打印机端口 } public string PrintLine(string str) { IntPtr iHandle = CreateFile(prnPort, 0x40000000, 0, 0, OPEN_EXISTING, 0, 0); if(iHandle.ToInt32() == -1) { return "打开COM1失败"; } else { FileStream fs = new FileStream(iHandle, FileAccess.ReadWrite); StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.Default); //sw.WriteLine(str)//写数据 //开钱箱 sw.Write(((char)27).ToString()+"p"+((char)0).ToString()+((char)60).ToString()+((char)255).ToString()); sw.Close(); fs.Close(); return ""; } } }}调用:private void But_Save_Click(object sender, System.EventArgs e){ string err=PrintLine(""); if(err!="") { MessageBox.Show(err); }} b/s结构控制Client端的硬件估计要做Activex了 lldwolf(铁背苍狼) ( ) 信誉:100 Blog 加为好友 2007-06-06 11:19:00 得分: 0 POS机也要B/S了 -----------偶顶... DevExpress 控件RibbonPage如何去除3D边框效果 如何修改文件头或者文件内容从而实现文件的加密? 在一个文件中,查找相应格式的字符串 数据库查询问题 C# textbox 怎么判断指定的文字是否存在? 如何获取select控件选中项目的值 winforms 怎么开发数据库应用程序 求一接收邮件的控件,支持设置TOP参数 关于控件中添加其他控件的问题 关于C#对mysql结合的几个问题 正则表达式--如何取消网址的链接? ¥¥¥ 尾为数字的字符串排序小问题
那个东西不叫“钱柜”,叫“钱箱”。你一说“钱柜系统”,我还以为是你们在做ktv点歌系统呢。呵呵。by the way ..钱柜实在是贵的要死。不是单位掏钱,打死都不去。。^_^
通过C#给这个Com口写个字符串就可以了
using System;
using System.Runtime.InteropServices;
using System.IO;
namespace Common
{
/// <summary>
/// POSPrinter 的摘要说明。
/// </summary>
public class POSPrinter
{
const int OPEN_EXISTING = 3;
string prnPort ="COM1";
[DllImport("kernel32.dll", CharSet=CharSet.Auto)]
private static extern IntPtr CreateFile(string lpFileName,
int dwDesiredAccess,
int dwShareMode,
int lpSecurityAttributes,
int dwCreationDisposition ,
int dwFlagsAndAttributes ,
int hTemplateFile);
public POSPrinter()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public POSPrinter(string prnPort)
{
this.prnPort=prnPort;//打印机端口
}
public string PrintLine(string str)
{
IntPtr iHandle = CreateFile(prnPort, 0x40000000, 0, 0, OPEN_EXISTING, 0, 0);
if(iHandle.ToInt32() == -1)
{
return "打开COM1失败";
}
else
{
FileStream fs = new FileStream(iHandle, FileAccess.ReadWrite);
StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.Default);
//sw.WriteLine(str)//写数据
//开钱箱
sw.Write(((char)27).ToString()+"p"+((char)0).ToString()+((char)60).ToString()+((char)255).ToString());
sw.Close();
fs.Close();
return "";
}
}
}
}调用:
private void But_Save_Click(object sender, System.EventArgs e)
{
string err=PrintLine("");
if(err!="")
{
MessageBox.Show(err);
}
}
估计要做Activex了
POS机也要B/S了
-----------
偶顶...