Commit 7a00d66d by 刘帅

添加对商米打印机的支持

parent 31985820
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include "Model/orderObject.h" #include "Model/orderObject.h"
#include "Model/productObject.h" #include "Model/productObject.h"
#include <QLibrary> #include <QLibrary>
#include <functional>
#include <iostream>
//中科英泰POS 打印接口返回值 //中科英泰POS 打印接口返回值
#define HS_OK 0xF0 #define HS_OK 0xF0
...@@ -15,6 +17,7 @@ class FMPRINTERSHARED_EXPORT FmPrinter ...@@ -15,6 +17,7 @@ class FMPRINTERSHARED_EXPORT FmPrinter
public: public:
static FmPrinter& GetInstance(); static FmPrinter& GetInstance();
~FmPrinter();
/* 功能:打印订单 /* 功能:打印订单
* 参数:[1]物理打印机名[2]订单对象 * 参数:[1]物理打印机名[2]订单对象
* 返回:true成功false失败 * 返回:true成功false失败
...@@ -39,6 +42,13 @@ private: ...@@ -39,6 +42,13 @@ private:
* 返回:打印数据 * 返回:打印数据
* */ * */
QString _GetPrintData(OrderObject* pData); QString _GetPrintData(OrderObject* pData);
/* 功能:从订单对象获取打印数据
* 参数:[1]订单对象
* 返回:打印数据
* */
bool _PrintBodyForShangmiPrinter(OrderObject* pData);
/* 功能:打印数据 /* 功能:打印数据
* 参数:[1]物理打印机名[2]信息内容 * 参数:[1]物理打印机名[2]信息内容
* 返回:打印数据 * 返回:打印数据
...@@ -79,6 +89,27 @@ private: ...@@ -79,6 +89,27 @@ private:
typedef int ( *fmCutPaper)(int i); typedef int ( *fmCutPaper)(int i);
typedef int ( *fmPrintHex)(char* pStr,int nLength); typedef int ( *fmPrintHex)(char* pStr,int nLength);
//商米打印机接口
QLibrary m_UAN_lib;
using PrintTextWithStyles = int(char*, int, int, int);
using PrintBitmapFile = int(char*, int);
using BeginPrint = int(int);
using PrintTicketBarcode = int(int, int, int, char *);
std::function<PrintTextWithStyles> m_printTextWithStyles;
std::function<PrintBitmapFile> m_printBitmapFile;
std::function<BeginPrint> m_beginPrint;
std::function<PrintTicketBarcode> m_printTicketBarcode;
bool _shangmiPrinter(OrderObject* pData);
bool _shangmiPrinter(QString data);
enum PRINTERTYPE{ //打印机类型
SHANGMI,
ZHONGKEYINGTAI,
OTHER
};
PRINTERTYPE printer;
fmOpenPrinter m_pOpenPrinter; fmOpenPrinter m_pOpenPrinter;
fmPrintText m_pPrintText; fmPrintText m_pPrintText;
fmPrintBitmapFile m_pPrintBitmapFile; fmPrintBitmapFile m_pPrintBitmapFile;
......
...@@ -9,6 +9,8 @@ QT -= gui ...@@ -9,6 +9,8 @@ QT -= gui
TARGET = fmPrinter TARGET = fmPrinter
TEMPLATE = lib TEMPLATE = lib
CONFIG += C++11
DEFINES += FMPRINTER_LIBRARY DEFINES += FMPRINTER_LIBRARY
INCLUDEPATH += ../fmTakeaway INCLUDEPATH += ../fmTakeaway
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment