C# 简易POS零售系统架构设计源码(2)
C# 简易POS零售系统架构设计源码(2)
C# Code:
using System; using System.Collections.Generic; using System.Text; using Tech2007.Common; using System.Windows.Forms; namespace CSFramework.Tech2011.PosTerminal { #region ICashier Interface and Class /// <summary> /// 钱箱接口 /// </summary> public interface ICashier { //ITraceLog事件跟踪 void Init(Label currentReceive, Label totalReceive, ITraceLog log);//初始化钱箱 void Reset(); void OpenDoor(); void CloseDoor(); void AcceptMoney(decimal amount); //客户结账收钱 } /// <summary> /// 普通收银钱箱 /// </summary> public class StandardCashier : ICashier { private ITraceLog _Log; private Label _currentReceive; private Label _totalReceive; private decimal _Total = 0; public void Init(Label currentReceive, Label totalReceive, ITraceLog log) { _currentReceive = currentReceive; _totalReceive = totalReceive; _Log = log; } public void OpenDoor() { _currentReceive.Text = "Open Door"; _Log.ShowMessage("The cashier door opened!"); } public void CloseDoor() { _currentReceive.Text = "Close Door"; _Log.ShowMessage("The cashier door closed!"); } public void AcceptMoney(decimal amount) { _Total = _Total amount; _currentReceive.Text = "Receive:" amount.ToString(); _totalReceive.Text = "Total:" _Total.ToString(); _Log.ShowMessage("Total received money:" amount.ToString()); } public void Reset() { _currentReceive.Text = "Receive:0.00"; _totalReceive.Text = "Total:0.00"; this.CloseDoor(); _Log.ShowMessage("钱箱初始化成功!"); } } #endregion #region IMonitor interface and Classes /// <summary> /// 显示器接口 /// </summary> public interface IMonitor { void Reset(); void Init(Label lbCurStock, Label lbReceivable, ITraceLog log); void ShowMessage(string line1, string line2); //一般的小显示器只支持显示2行消息. } /// <summary> /// BENQ50显示器 /// </summary> public class Monitor_BENQ500 : IMonitor { private ITraceLog _Log; private Label _label; private Label _lbReceivable; public void Init(Label lbCurStock, Label lbReceivable, ITraceLog log) { _label = lbCurStock; _lbReceivable = lbReceivable; _Log = log; } public void ShowMessage(string line1, string line2) { if (line1 != "") _label.Text = line1; if (line2 != "") _lbReceivable.Text = line2; _Log.ShowMessage("BENQ500:" line1); } public void Reset() { _label.Text = "Welcome!"; _lbReceivable.Text = "应收:0.00"; _Log.ShowMessage("BENQ500初始化成功!"); } } /// <summary> /// 三星Samsung200显示器 /// </summary> public class Monitor_Samsung200 : IMonitor { private ITraceLog _Log; private Label _label; private Label _lbReceivable; public void Init(Label lbCurStock, Label lbReceivable, ITraceLog log) { _label = lbCurStock; _lbReceivable = lbReceivable; _Log = log; } public void ShowMessage(string line1, string line2) { _label.Text = line1; _lbReceivable.Text = line2; _Log.ShowMessage("Samsung200:" line1); } public void Reset() { _label.Text = "Welcome!"; _lbReceivable.Text = "应收:0.00"; _Log.ShowMessage("Samsung200初始化成功!"); } } #endregion #region IPrinter interface and classes /// <summary> /// 打印机接口 /// </summary> public interface IPrinter { void Reset(); void Init(ListBox listbox, ITraceLog log); void Print(string msg); } /// <summary> /// 打印机:HP5000型号 /// </summary> public class Printer_HP5000 : IPrinter { private ITraceLog _Log; private ListBox _listbox; public void Init(ListBox listbox, ITraceLog log) { _listbox = listbox; _Log = log; } public void Print(string msg) { _listbox.Items.Add(msg); _Log.ShowMessage("HP5000:" msg); } public void Reset() { _listbox.Items.Clear(); _listbox.Items.Add("Printer OK!"); _Log.ShowMessage("HP5000初始化成功!"); } } /// <summary> /// 打印机:Epson600型号 /// </summary> public class Printer_Epson600 : IPrinter { private ITraceLog _Log; private ListBox _listbox; public void Init(ListBox listbox, ITraceLog log) { _listbox = listbox; _Log = log; } public void Print(string msg) { _listbox.Items.Add(msg); _Log.ShowMessage("Epson600:" msg); } public void Reset() { _listbox.Items.Clear(); _listbox.Items.Add("Printer OK!"); } } #endregion } //来源:C/S框架网(www.csframework.com) QQ:1980854898
参考文档:
C# 简易POS零售系统架构设计源码(1) C# 简易POS零售系统架构设计源码(3) C# 简易POS零售系统架构设计源码(4) C# 简易POS零售系统架构设计源码(5) C# Winform系统登录(登入/登出)架构设计 CSFrameworkV2.x标准版成功案例 - C# Winform C/S架构MES系统 物流运输管理系统TMS 司机车辆GPS+手机定位设计(C#源码) 软件开发与设计 - MIS-管理信息系统-产品管理系统(三层结构示例项目源码) 软件开发与设计 - POS-销售终端系统(电商-数据库表设计) C#源码-内容管理系统-NetCMS.1.7.0.build1125_src源码下载 C#源码-Xluo大型三层架构短消息系统源码-源码下载 C#源码-友欧ERP进销存系统通用版 2.0-源码下载 C#源码-C.NETBS架构的开源OA的办公系统-源码下载 C#源码-NIKE销售系统源码-源码下载 C#源码-SSM商城后台管理系统源码-源码下载
其它资料:
什么是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内容管理系统 | |