谁做过钱柜系统高手进 大家都见过超市里收音员敲回车后收款机器自动弹出钱箱(装钱的)谁知道哪个用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了 -----------偶顶... dataGridView相关问题请教 关于GDI+的问题(C#),希望各路神仙指点... 北大青鸟笔试题 ◆500分求eWorld.UI 组件。 关闭操作系统时,软件可以检测到这个事件吗?即软件是否会发生formclosed事件? 请问一下如何在程序里修改msi文件 怎么样读xml中的属性 C# 编程小问题,急救! 自定义控件的属性赋值问题 这里有谁用过windows.net? 正则表达式--如何取消网址的链接? ¥¥¥ 尾为数字的字符串排序小问题
那个东西不叫“钱柜”,叫“钱箱”。你一说“钱柜系统”,我还以为是你们在做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了
-----------
偶顶...