C# 简易POS零售系统架构设计源码(1)
C# 简易POS零售系统架构设计源码(1)
C# 简易POS零售系统架构设计源码(1)
程序运行效果:
C# Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace CSFramework.Tech2011.PosTerminal
{
public partial class frmPosMain : Form
{
private PosTerminal _terminal = null; //收银管理器实例
public frmPosMain()
{
InitializeComponent();
}
private void frmPosMain_Load(object sender, EventArgs e)
{
//IPrinter printer = new Printer_Epson600();
//IMonitor monitor = new Monitor_Samsung200();
ICashier cashier = new StandardCashier();
IPrinter printer = new Printer_HP5000();
IMonitor monitor = new Monitor_BENQ500();
IStockDataView view = new ListBoxStockDataView(lbStocks);
ITraceLog log = new TraceLogListBox(lbTrace);
printer.Init(lbPrinter, log);
cashier.Init(label9, label10, log);
monitor.Init(lbCurStock, lblRec, log);
//创建收银管理器实例
_terminal = new PosTerminal(cashier, monitor, printer, view);
//检查系统
_terminal.CheckSystem();
//加载完毕...可以收银
}
private void txtStock_KeyDown(object sender, KeyEventArgs e)
{
if ((e.KeyCode == Keys.Enter) &&&& (txtStock.Text != null))
{
string code = txtStock.Text.Trim();
Stock stock = StockData.GetStock(code); //跟据输入的货品编号创建Stock对象
if (stock != null)//数据库存在货品编号
_terminal.AddStock(stock, int.Parse(txtQty.Text));
else
lbTrace.Items.Add("Stock " txtStock.Text " doesn't exists!");
txtStock.Clear();
txtStock.Focus();
}
}
private void txtPay_KeyDown(object sender, KeyEventArgs e)
{
if ((e.KeyCode == Keys.Enter) & (txtPay.Text != null))
{
decimal amt = 0;
bool ok = decimal.TryParse(txtPay.Text, out amt);
if (ok & amt > 0)
{
bool pay = _terminal.Pay(amt); // Pay by the customer
if (pay) //收款成功将焦点移入货品输入框
{
txtPay.Clear();
txtStock.Clear();
txtStock.Focus();
}
}
else
{
lbTrace.Items.Add("不是数字!");
}
}
}
private void btnReset_Click(object sender, EventArgs e)
{
decimal rcv = _terminal.PosStockDataView.GetReceivableAmount();
if (rcv > 0)
{
DialogResult ret = MessageBox.Show("正在收银,要取消么?", "正在收银", MessageBoxButtons.YesNo);
if (ret == DialogResult.No) return;
}
lbTrace.Items.Clear();
_terminal.Reset();
}
}
}
//来源:C/S框架网(www.csframework.com) QQ:1980854898
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace CSFramework.Tech2011.PosTerminal
{
public partial class frmPosMain : Form
{
private PosTerminal _terminal = null; //收银管理器实例
public frmPosMain()
{
InitializeComponent();
}
private void frmPosMain_Load(object sender, EventArgs e)
{
//IPrinter printer = new Printer_Epson600();
//IMonitor monitor = new Monitor_Samsung200();
ICashier cashier = new StandardCashier();
IPrinter printer = new Printer_HP5000();
IMonitor monitor = new Monitor_BENQ500();
IStockDataView view = new ListBoxStockDataView(lbStocks);
ITraceLog log = new TraceLogListBox(lbTrace);
printer.Init(lbPrinter, log);
cashier.Init(label9, label10, log);
monitor.Init(lbCurStock, lblRec, log);
//创建收银管理器实例
_terminal = new PosTerminal(cashier, monitor, printer, view);
//检查系统
_terminal.CheckSystem();
//加载完毕...可以收银
}
private void txtStock_KeyDown(object sender, KeyEventArgs e)
{
if ((e.KeyCode == Keys.Enter) &&&& (txtStock.Text != null))
{
string code = txtStock.Text.Trim();
Stock stock = StockData.GetStock(code); //跟据输入的货品编号创建Stock对象
if (stock != null)//数据库存在货品编号
_terminal.AddStock(stock, int.Parse(txtQty.Text));
else
lbTrace.Items.Add("Stock " txtStock.Text " doesn't exists!");
txtStock.Clear();
txtStock.Focus();
}
}
private void txtPay_KeyDown(object sender, KeyEventArgs e)
{
if ((e.KeyCode == Keys.Enter) & (txtPay.Text != null))
{
decimal amt = 0;
bool ok = decimal.TryParse(txtPay.Text, out amt);
if (ok & amt > 0)
{
bool pay = _terminal.Pay(amt); // Pay by the customer
if (pay) //收款成功将焦点移入货品输入框
{
txtPay.Clear();
txtStock.Clear();
txtStock.Focus();
}
}
else
{
lbTrace.Items.Add("不是数字!");
}
}
}
private void btnReset_Click(object sender, EventArgs e)
{
decimal rcv = _terminal.PosStockDataView.GetReceivableAmount();
if (rcv > 0)
{
DialogResult ret = MessageBox.Show("正在收银,要取消么?", "正在收银", MessageBoxButtons.YesNo);
if (ret == DialogResult.No) return;
}
lbTrace.Items.Clear();
_terminal.Reset();
}
}
}
//来源:C/S框架网(www.csframework.com) QQ:1980854898
参考文档:
C# 简易POS零售系统架构设计源码(5)
C# 简易POS零售系统架构设计源码(4)
C# 简易POS零售系统架构设计源码(3)
C# 简易POS零售系统架构设计源码(2)
CSFramework.EF.PostgreSql数据库组件 PostgreSql数据库测试报告|C/S开发框架
CSFrameworkV6快速开发框架 | 使用PostgreSql 数据库测试报告|C/S开发框架
CSFramework WebApi开发框架集成PostgreSql数据库及测试报告|C/S开发框架
Postman工具设置Bearer Token与调试WebApi接口|C/S开发框架
DevExpressV22:RepositoryItemComboBox的QueryPopUp事件无法动态加载数据项
DevExpress开发技巧高级篇:双击RepositoryItemPictureEdit组件自动弹出菜单
GIT报错:Could not get HEAD hash. libgit2 returned:repository path "xx" is not owned by current user
DevExpress 实时打印表格内容(PrintableComponentLink/CompositeLink组件使用)
使用RepositoryItemMemoExEdit显示大文本内容
饰品店面销售管理系统POS系统详细设计说明书doc文档下载|软件文档
HTTP|POST提交数据:ContentType=application/x|www|form|urlencoded 内容格式|C#源码
HTTP|POST提交数据:ContentType=application/json 内容格式|C#源码
C# 简易POS零售系统架构设计源码(5)
C# 简易POS零售系统架构设计源码(4)
C# 简易POS零售系统架构设计源码(3)
C# 简易POS零售系统架构设计源码(2)
CSFramework.EF.PostgreSql数据库组件 PostgreSql数据库测试报告|C/S开发框架
CSFrameworkV6快速开发框架 | 使用PostgreSql 数据库测试报告|C/S开发框架
CSFramework WebApi开发框架集成PostgreSql数据库及测试报告|C/S开发框架
Postman工具设置Bearer Token与调试WebApi接口|C/S开发框架
DevExpressV22:RepositoryItemComboBox的QueryPopUp事件无法动态加载数据项
DevExpress开发技巧高级篇:双击RepositoryItemPictureEdit组件自动弹出菜单
GIT报错:Could not get HEAD hash. libgit2 returned:repository path "xx" is not owned by current user
DevExpress 实时打印表格内容(PrintableComponentLink/CompositeLink组件使用)
使用RepositoryItemMemoExEdit显示大文本内容
饰品店面销售管理系统POS系统详细设计说明书doc文档下载|软件文档
HTTP|POST提交数据:ContentType=application/x|www|form|urlencoded 内容格式|C#源码
HTTP|POST提交数据:ContentType=application/json 内容格式|C#源码
其它资料:
什么是C/S结构? | C/S框架核心组成部分 | C/S框架-WebService部署图 | C/S框架-权限管理 | C/S结构系统框架 - 5.1旗舰版介绍 | C/S结构系统框架 - 功能介绍 | C/S结构系统框架 - 产品列表 | C/S结构系统框架 - 应用展示(图) | 三层体系架构详解 | C/S架构轻量级快速开发框架 | C/S框架网客户案例 | WebApi快速开发框架 | C/S框架代码生成器 | 用户授权注册软件系统 | 版本自动升级软件 | 数据库底层应用框架 | CSFramework.CMS内容管理系统 |
什么是C/S结构? | C/S框架核心组成部分 | C/S框架-WebService部署图 | C/S框架-权限管理 | C/S结构系统框架 - 5.1旗舰版介绍 | C/S结构系统框架 - 功能介绍 | C/S结构系统框架 - 产品列表 | C/S结构系统框架 - 应用展示(图) | 三层体系架构详解 | C/S架构轻量级快速开发框架 | C/S框架网客户案例 | WebApi快速开发框架 | C/S框架代码生成器 | 用户授权注册软件系统 | 版本自动升级软件 | 数据库底层应用框架 | CSFramework.CMS内容管理系统 |
在线客服
