Commit 947c9b42 by xiaoqing.gu

1、增加字体加粗和放大的功能 2、修改子商品打印bug

parent a2112b28
No preview for this file type
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
#include <sstream> #include <sstream>
#include <time.h> #include <time.h>
#include "Calculator.h" #include "Calculator.h"
#include "prtlib.h" #include "prtlib.h"
#include "fmlog.h" #include "fmlog.h"
using namespace rapidxml; using namespace rapidxml;
using namespace rapidjson; using namespace rapidjson;
EXTERN_C IMAGE_DOS_HEADER __ImageBase; EXTERN_C IMAGE_DOS_HEADER __ImageBase;
PrintLib::PrintLib(void) PrintLib::PrintLib(void)
...@@ -110,7 +110,7 @@ void PrintLib::_LabPrintLine(rapidxml::xml_node<> *node,rapidjson::Document &jso ...@@ -110,7 +110,7 @@ void PrintLib::_LabPrintLine(rapidxml::xml_node<> *node,rapidjson::Document &jso
_LabPrintData(lineArg); _LabPrintData(lineArg);
} }
void PrintLib::_PrintLine(rapidxml::xml_node<> *node,rapidjson::Document &jsonDoc, rapidjson::Value &childNode) void PrintLib::_PrintLine(rapidxml::xml_node<> *node,rapidjson::Document &jsonDoc,const rapidjson::Value &childNode)
{ {
LinePrintArguments lineArg = _ParsePrintArgumnets(node);//属性值解析 LinePrintArguments lineArg = _ParsePrintArgumnets(node);//属性值解析
//解析xml中math,获取信息 //解析xml中math,获取信息
...@@ -167,51 +167,27 @@ void PrintLib::_PrintLine(rapidxml::xml_node<> *node,rapidjson::Document &jsonDo ...@@ -167,51 +167,27 @@ void PrintLib::_PrintLine(rapidxml::xml_node<> *node,rapidjson::Document &jsonDo
_PrintData(lineArg); _PrintData(lineArg);
} }
void PrintLib::_PrintMultLine(rapidxml::xml_node<> *node,rapidjson::Document &jsonDoc,rapidjson::Value &jsonValue) void PrintLib::_PrintMultLine(rapidxml::xml_node<> *node,rapidjson::Document &jsonDoc)
{ {
xml_attribute<>* attr = node->first_attribute("array"); xml_attribute<>* attr = node->first_attribute("array");
std::string fieldName = attr->value(); std::string fieldName = attr->value();
rapidjson::Value childJson; rapidjson::Value contact(kArrayType);
bool ret = _GetJsonArryNode(fieldName,jsonDoc,childJson); _GetJsonArryNode(node,fieldName,jsonDoc,contact);
if (!ret)
{
for (SizeType i = 0; i < childJson.Size(); i++)
{
rapidjson::Value& temp= childJson[i];
_XMLiterate(node,jsonDoc,temp);
}
}
else
{
if(jsonValue.IsArray())
{
int g = jsonValue.Size();
for (SizeType i = 0; i < jsonValue.Size(); i++)
{
rapidjson::Value& temp= jsonValue[i];
if (temp.HasMember(fieldName.c_str()))
{
rapidjson::Value &FirstSub = temp[fieldName.c_str()];
for (SizeType i = 0; i < FirstSub.Size(); i++)
{
rapidjson::Value &SecondSub = FirstSub[i];
_XMLiterate(node,jsonDoc,SecondSub);
}
} }
}
}
}
void PrintLib::_PrintMultLine(rapidxml::xml_node<> *node,rapidjson::Document &jsonDoc,const rapidjson::Value &childNode)
{
xml_attribute<>* attr = node->first_attribute("array");
std::string fieldName = attr->value();
_GetJsonArryNode(node,fieldName,jsonDoc,childNode);
} }
void PrintLib::_XMLiterate(rapidxml::xml_node<> *node,rapidjson::Document &jsonDoc,rapidjson::Value &jsonChild)
void PrintLib::_XMLiterate(rapidxml::xml_node<> *node,rapidjson::Document &jsonDoc,const rapidjson::Value &jsonChild)
{ {
xml_node<> *childNode = node->first_node(); xml_node<> *childNode = node->first_node();
...@@ -222,9 +198,10 @@ void PrintLib::_XMLiterate(rapidxml::xml_node<> *node,rapidjson::Document &jsonD ...@@ -222,9 +198,10 @@ void PrintLib::_XMLiterate(rapidxml::xml_node<> *node,rapidjson::Document &jsonD
if (nodeName.compare("line") == 0) if (nodeName.compare("line") == 0)
{ {
_PrintLine(childNode,jsonDoc,jsonChild); _PrintLine(childNode,jsonDoc,jsonChild);
} else }
else
{ {
_PrintMultLine(childNode,jsonDoc,jsonChild); _PrintMultLine(childNode,jsonDoc,jsonChild); //迭代到第二级
} }
childNode = childNode->next_sibling(); childNode = childNode->next_sibling();
} }
...@@ -282,9 +259,10 @@ bool PrintLib::_PrintOrder(rapidxml::xml_node<> * xmlNode,rapidjson::Document& ...@@ -282,9 +259,10 @@ bool PrintLib::_PrintOrder(rapidxml::xml_node<> * xmlNode,rapidjson::Document&
rapidjson::Value paraValue; rapidjson::Value paraValue;
if (nodeName.compare("line") == 0) { // if (nodeName.compare("line") == 0) { //
_PrintLine(node,doc,paraValue); _PrintLine(node,doc,paraValue);
} else //多行处理 } else
{ {
_PrintMultLine(node,doc,paraValue); //解析json中位于第一层的multLine定义的字段信息
_PrintMultLine(node,doc);
} }
} }
...@@ -374,6 +352,7 @@ bool PrintLib::DoPrint(std::string prtStr, std::string orderStr, std::string xml ...@@ -374,6 +352,7 @@ bool PrintLib::DoPrint(std::string prtStr, std::string orderStr, std::string xml
} }
Document dJson; Document dJson;
int intType = 1; int intType = 1;
if (_ParseJson(orderStr,dJson)) if (_ParseJson(orderStr,dJson))
...@@ -925,6 +904,20 @@ LabLinePrintArguments PrintLib::_LabParsePrintArgumnets( const rapidxml::xml_nod ...@@ -925,6 +904,20 @@ LabLinePrintArguments PrintLib::_LabParsePrintArgumnets( const rapidxml::xml_nod
arguments.line = 0; arguments.line = 0;
} }
// 打印粗细
attr=e->first_attribute("bold");
if(attr != NULL)
{
arguments.bold = std::atoi(attr->value());
}
// 打印字体放大
attr=e->first_attribute("large");
if(attr != NULL)
{
arguments.large = std::atoi(attr->value());
}
return arguments; return arguments;
} }
...@@ -1095,6 +1088,8 @@ void PrintLib::_LabPrintData( const LabLinePrintArguments& arguments ) ...@@ -1095,6 +1088,8 @@ void PrintLib::_LabPrintData( const LabLinePrintArguments& arguments )
int x = arguments.x; int x = arguments.x;
int y = arguments.y; int y = arguments.y;
int line = arguments.line; int line = arguments.line;
int bold = arguments.bold;
int large = arguments.large;
char *temchar = new char[2048]; char *temchar = new char[2048];
memset(temchar, 0, 2048); memset(temchar, 0, 2048);
...@@ -1102,8 +1097,15 @@ void PrintLib::_LabPrintData( const LabLinePrintArguments& arguments ) ...@@ -1102,8 +1097,15 @@ void PrintLib::_LabPrintData( const LabLinePrintArguments& arguments )
if(!printType.compare("Text")){ if(!printType.compare("Text")){
//调用FMPOSDLL打印单行数据 //调用FMPOSDLL打印单行数据
if (bold == 1)
{
LabPrtLineWithSizeAndStyle(x,y,24,2,line,temchar);
}else if(large == 1) {
LabPrtLineWithSizeAndStyle(x,y,28,2,line,temchar);
}else {
LabPrtLine(x,y,line,temchar) ; LabPrtLine(x,y,line,temchar) ;
} }
}
delete []temchar; delete []temchar;
} }
...@@ -1128,7 +1130,7 @@ void PrintLib::_LabPrintData( const LabLinePrintArguments& arguments ) ...@@ -1128,7 +1130,7 @@ void PrintLib::_LabPrintData( const LabLinePrintArguments& arguments )
// str = std::string(pathBuf); // str = std::string(pathBuf);
//} //}
std::string PrintLib::_GetMathValue(rapidjson::Document &jsonDoc,const std::string &toMatch,rapidjson::Value & childNode) std::string PrintLib::_GetMathValue(rapidjson::Document &jsonDoc,const std::string &toMatch,const rapidjson::Value & childNode)
{ {
if (jsonDoc.HasMember(toMatch.c_str())) //一级就可以找到 if (jsonDoc.HasMember(toMatch.c_str())) //一级就可以找到
{ {
...@@ -1142,10 +1144,10 @@ std::string PrintLib::_GetMathValue(rapidjson::Document &jsonDoc,const std::stri ...@@ -1142,10 +1144,10 @@ std::string PrintLib::_GetMathValue(rapidjson::Document &jsonDoc,const std::stri
int g = childNode.Size(); int g = childNode.Size();
for (SizeType i = 0; i < childNode.Size(); i++) for (SizeType i = 0; i < childNode.Size(); i++)
{ {
rapidjson::Value& arrayV = childNode[i]; const rapidjson::Value& arrayV = childNode[i];
if (arrayV.HasMember(toMatch.c_str())) if (arrayV.HasMember(toMatch.c_str()))
{ {
rapidjson::Value& valueData = arrayV[toMatch.c_str()]; const rapidjson::Value& valueData = arrayV[toMatch.c_str()];
std::string text = _JsonValueDivide(valueData); std::string text = _JsonValueDivide(valueData);
return text; return text;
} }
...@@ -1159,7 +1161,7 @@ std::string PrintLib::_GetMathValue(rapidjson::Document &jsonDoc,const std::stri ...@@ -1159,7 +1161,7 @@ std::string PrintLib::_GetMathValue(rapidjson::Document &jsonDoc,const std::stri
std::string key = (itr->name).GetString(); std::string key = (itr->name).GetString();
if(key.compare(toMatch.c_str()) == 0) if(key.compare(toMatch.c_str()) == 0)
{ {
rapidjson::Value& valueData = childNode[toMatch.c_str()]; const rapidjson::Value& valueData = childNode[toMatch.c_str()];
std::string text = _JsonValueDivide(valueData); std::string text = _JsonValueDivide(valueData);
return text; return text;
} }
...@@ -1173,7 +1175,7 @@ std::string PrintLib::_GetMathValue(rapidjson::Document &jsonDoc,const std::stri ...@@ -1173,7 +1175,7 @@ std::string PrintLib::_GetMathValue(rapidjson::Document &jsonDoc,const std::stri
} }
std::string PrintLib::_JsonValueDivide(rapidjson::Value &value) std::string PrintLib::_JsonValueDivide(const rapidjson::Value &value)
{ {
if (value.IsDouble()) if (value.IsDouble())
...@@ -1239,18 +1241,55 @@ bool PrintLib::_ParseJson(std::string jsonStr,rapidjson::Document &jsonDoc) ...@@ -1239,18 +1241,55 @@ bool PrintLib::_ParseJson(std::string jsonStr,rapidjson::Document &jsonDoc)
return true; return true;
} }
bool PrintLib::_GetJsonArryNode(std::string nodeKey,rapidjson::Document& jsonDoc,rapidjson::Value& childValue) void PrintLib::_GetJsonArryNode(rapidxml::xml_node<> *node,std::string nodeKey,rapidjson::Document&jsonDoc,const rapidjson::Value& childValue)
{ {
std::string AppendKey = "/"+nodeKey;
char key[20]="";
strcpy(key,AppendKey.c_str());
//multLine 第一层key对应的Value
if(jsonDoc.HasMember(nodeKey.c_str()))
{
const rapidjson::Value &testdd = RAPID_GETVALUE(jsonDoc,key,rapidjson::Value(rapidjson::kObjectType));
for (SizeType i = 0; i < testdd.Size(); i++)
{
_DealJsonNode(node,jsonDoc,testdd[i]);
}
if (jsonDoc.HasMember(nodeKey.c_str())) }
else if(!childValue.IsNull())//sub_products对应的节点
{ {
childValue = jsonDoc[nodeKey.c_str()]; const rapidjson::Value & secondLevel =childValue[nodeKey.c_str()];
int g = childValue.Size(); if(!secondLevel.IsNull())
return false; {
_DealJsonNode(node,jsonDoc,secondLevel);
}
} }
return true;
} }
void PrintLib::_DealJsonNode(rapidxml::xml_node<> *node,rapidjson::Document&jsonDoc,const rapidjson::Value& jsonValue)
{
//解析sub_products 对应的二层json Value,Value是一个数组
if(jsonValue.IsArray())
{
int g = jsonValue.Size();
for (SizeType i = 0; i < jsonValue.Size(); i++)
{
const rapidjson::Value& SecondSub= jsonValue[i];;
_XMLiterate(node,jsonDoc,SecondSub);
}
}
//解析product 对应的处于第一层的Value,Value 是一个json对象
if(jsonValue.IsObject())
{
_XMLiterate(node,jsonDoc,jsonValue);
}
}
std::string PrintLib::_GetExePath() std::string PrintLib::_GetExePath()
{ {
...@@ -1265,3 +1304,4 @@ std::string PrintLib::_GetExePath() ...@@ -1265,3 +1304,4 @@ std::string PrintLib::_GetExePath()
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include "rapidjson/writer.h" #include "rapidjson/writer.h"
#include "rapidjson/memorystream.h" #include "rapidjson/memorystream.h"
#define RAPID_GETVALUE rapidjson::GetValueByPointerWithDefault
struct LinePrintArguments{ struct LinePrintArguments{
// 字体种类 // 字体种类
int fontType; int fontType;
...@@ -52,6 +54,10 @@ struct LabLinePrintArguments{ ...@@ -52,6 +54,10 @@ struct LabLinePrintArguments{
std::string text ; std::string text ;
// 打印类型 // 打印类型
std::string printType; std::string printType;
// 打印粗细
int bold;
//打印字体放大
int large;
}; };
struct MathArguments{ struct MathArguments{
...@@ -178,7 +184,7 @@ private: ...@@ -178,7 +184,7 @@ private:
* 参数:[1]jsonDoc,json document ,[2]toMatch,待匹配字符串,[3]childNode,json子串 * 参数:[1]jsonDoc,json document ,[2]toMatch,待匹配字符串,[3]childNode,json子串
* 返回:NULL * 返回:NULL
* */ * */
std::string _GetMathValue(rapidjson::Document& jsonDoc,const std::string &toMatch,rapidjson::Value & childNode); std::string _GetMathValue(rapidjson::Document& jsonDoc,const std::string &toMatch,const rapidjson::Value & childNode);
/* 功能:替换Text中的占位符,将math中数据填到打印数据中 /* 功能:替换Text中的占位符,将math中数据填到打印数据中
* 参数:[1]mathArguments属性表,[2]mathValue的值,[3]mathArguments.text,[4]index占位符 * 参数:[1]mathArguments属性表,[2]mathValue的值,[3]mathArguments.text,[4]index占位符
...@@ -190,7 +196,7 @@ private: ...@@ -190,7 +196,7 @@ private:
* 参数:[1]xml模板,[2]打印内容json[3]结点数据 * 参数:[1]xml模板,[2]打印内容json[3]结点数据
* 返回:NULL * 返回:NULL
* */ * */
void _PrintLine(rapidxml::xml_node<> *node,rapidjson::Document& jsonDoc, rapidjson::Value &childNode); void _PrintLine(rapidxml::xml_node<> *node,rapidjson::Document& jsonDoc, const rapidjson::Value &childNode);
/* 功能:打印单行数据 /* 功能:打印单行数据
* 参数:[1]xml模板,[2]打印内容json[3]结点数据 * 参数:[1]xml模板,[2]打印内容json[3]结点数据
...@@ -202,12 +208,23 @@ private: ...@@ -202,12 +208,23 @@ private:
* 参数:[1]xml模板,[2]打印内容json[3]结点数据 * 参数:[1]xml模板,[2]打印内容json[3]结点数据
* 返回:NULL * 返回:NULL
* */ * */
void _PrintMultLine(rapidxml::xml_node<> *node,rapidjson::Document& jsonDoc,rapidjson::Value &jsonValue); void _PrintMultLine(rapidxml::xml_node<> *node,rapidjson::Document& jsonDoc);
/* 功能:打印多行数据
* 参数:[1]xml模板,[2]打印内容json DOM
* 返回:NULL
* */
void _PrintMultLine(rapidxml::xml_node<> *node,rapidjson::Document &jsonDoc,const rapidjson::Value &childNode);
/* 功能:打印多行数据
* 参数:[1]xml模板,[2]打印内容json DOM [3]xx key 对应的json value值
* 返回:NULL
* */
/* 功能:获取json的value值 /* 功能:获取json的value值
* 参数:NULL * 参数:NULL
* 返回:json 属性值 * 返回:json 属性值
* */ * */
std::string _JsonValueDivide(rapidjson::Value &value); std::string _JsonValueDivide(const rapidjson::Value &value);
//获取嵌套的数组的节点 //获取嵌套的数组的节点
...@@ -215,12 +232,17 @@ private: ...@@ -215,12 +232,17 @@ private:
* 参数:[1]nodeKey节点key,[2]childValue,节点value * 参数:[1]nodeKey节点key,[2]childValue,节点value
* 返回:成功与否 * 返回:成功与否
* */ * */
bool _GetJsonArryNode(std::string nodeKey,rapidjson::Document &jsonDoc,rapidjson::Value& childValue); void _GetJsonArryNode(rapidxml::xml_node<> *node,std::string nodeKey,rapidjson::Document & jsonDoc,const rapidjson::Value& childValue);
/* 功能:解析字符串为json对象
* 参数:[1]jsonStr,待解析的字符串 /* 功能:json Document判断时候有某个节点
* 返回:成功与否 * 参数:[1]node XML DOM,[2]jsonDoc JSON DOM,[3]childValue 节点Value,节点位于json第一级时传空节点,第二级时传入对应的Value
* */
void _DealJsonNode(rapidxml::xml_node<> *node,rapidjson::Document&jsonDoc,const rapidjson::Value& childValue);
/* 功能:处理xml中multLine对应的json对象
* 参数:[1]node XML DOM,[2]jsonDoc JSON DOM,[3]节点Value
* */ * */
bool _ParseJson(std::string jsonStr,rapidjson::Document& jsonDoc); bool _ParseJson(std::string jsonStr,rapidjson::Document& jsonDoc);
/* 功能:获取exe所在目录 /* 功能:获取exe所在目录
* 返回:exe所在目录,如D:\Debug\ * 返回:exe所在目录,如D:\Debug\
...@@ -230,7 +252,7 @@ private: ...@@ -230,7 +252,7 @@ private:
* 参数:[1]node xml的节点,[2]jsonChild,json的节点 * 参数:[1]node xml的节点,[2]jsonChild,json的节点
* 返回:NULL * 返回:NULL
* */ * */
void _XMLiterate(rapidxml::xml_node<> *node,rapidjson::Document& jsonDoc,rapidjson::Value &jsonChild); void _XMLiterate(rapidxml::xml_node<> *node,rapidjson::Document& jsonDoc,const rapidjson::Value &jsonChild);
private: private:
int total; int total;
......
...@@ -49,12 +49,16 @@ typedef struct ...@@ -49,12 +49,16 @@ typedef struct
{ {
int x; int x;
int y; int y;
int size;
int style;
string data; string data;
} Function_Argv; } Function_Argv;
#define INIT_FUN_ARGV(tmpx, tmpheigth, tmpdata) do { \ #define INIT_FUN_ARGV(tmpx, tmpheigth, tmpsize, tmpstyle, tmpdata) do { \
argv.x = tmpx; \ argv.x = tmpx; \
argv.y = tmpheigth; \ argv.y = tmpheigth; \
argv.size = tmpsize; \
argv.style = tmpstyle; \
argv.data = string(tmpdata); \ argv.data = string(tmpdata); \
}while(0); }while(0);
...@@ -100,7 +104,7 @@ typedef struct ...@@ -100,7 +104,7 @@ typedef struct
#define LABEL_FOUT_SIZE 24 #define LABEL_FOUT_SIZE 24
#define LABEL_BPFOUT_SIZE 22 #define LABEL_BPFOUT_SIZE 22
//#define LABEL_FOUT_RATIO 0.0266665 //#define LABEL_FOUT_RATIO 0.0766665
#define LABEL_FOUT_RATIO 0.0666665 #define LABEL_FOUT_RATIO 0.0666665
#define LENTH_FMS 30 #define LENTH_FMS 30
......
...@@ -1285,7 +1285,7 @@ int LabPrtLine(int x, int y, int line, const char *data) ...@@ -1285,7 +1285,7 @@ int LabPrtLine(int x, int y, int line, const char *data)
Function_Argv argv = {0}; Function_Argv argv = {0};
INIT_FUN_ARGV(x, y, data); INIT_FUN_ARGV(x, y, 24, 0, data);
g_label_print_lines.push_back(argv); g_label_print_lines.push_back(argv);
...@@ -1313,7 +1313,7 @@ int LabPrtLine(int x, int y, int line, const char *data) ...@@ -1313,7 +1313,7 @@ int LabPrtLine(int x, int y, int line, const char *data)
Function_Argv argv = {0}; Function_Argv argv = {0};
INIT_FUN_ARGV(x, y, tmp); INIT_FUN_ARGV(x, y, 24, 0, tmp);
g_label_print_lines.push_back(argv); g_label_print_lines.push_back(argv);
getheigth(y, LABEL_FOUT_SIZE, 0); getheigth(y, LABEL_FOUT_SIZE, 0);
...@@ -1334,7 +1334,7 @@ int LabPrtLineWithSizeAndRatio(int x, int y, int size, double ratio, int line, c ...@@ -1334,7 +1334,7 @@ int LabPrtLineWithSizeAndRatio(int x, int y, int size, double ratio, int line, c
Function_Argv argv = {0}; Function_Argv argv = {0};
INIT_FUN_ARGV(x, y, data); INIT_FUN_ARGV(x, y, 24, 0, data);
g_label_print_lines.push_back(argv); g_label_print_lines.push_back(argv);
...@@ -1362,7 +1362,56 @@ int LabPrtLineWithSizeAndRatio(int x, int y, int size, double ratio, int line, c ...@@ -1362,7 +1362,56 @@ int LabPrtLineWithSizeAndRatio(int x, int y, int size, double ratio, int line, c
Function_Argv argv = {0}; Function_Argv argv = {0};
INIT_FUN_ARGV(x, y, tmp); INIT_FUN_ARGV(x, y, 24, 0, tmp);
g_label_print_lines.push_back(argv);
getheigth(y, size, 0);
memset(tmp, 0, 512);
}
return 1;
}
int LabPrtLineWithSizeAndStyle(int x, int y, int size, int style, int line, const char *data)
{
if(line == 0)
{
if(g_heigth > y + 1)
y = g_heigth + 0;
if(y > g_info.high*10 - 80)
y = g_info.high*10 - 80;
Function_Argv argv = {0};
INIT_FUN_ARGV(x, y, size, style, data);
g_label_print_lines.push_back(argv);
getheigth(y, size, 0);
return 1;
}
int index = 0;
char tmp[512] = {0};
int tmpi = 0;
while(GetFout(x, &index, size, LABEL_FOUT_RATIO, data, tmp, g_info))
{
if(g_heigth > y + 1)
y = g_heigth;
if(tmpi == 0)
{
y += 0;
tmpi = 1;
}
if(y > g_info.high * 10 - 80)
y = g_info.high * 10 - 80;
Function_Argv argv = {0};
INIT_FUN_ARGV(x, y, size, style, tmp);
g_label_print_lines.push_back(argv); g_label_print_lines.push_back(argv);
getheigth(y, size, 0); getheigth(y, size, 0);
...@@ -1419,7 +1468,7 @@ int TscPrintClose() ...@@ -1419,7 +1468,7 @@ int TscPrintClose()
LOG() << tmpdata; LOG() << tmpdata;
TSC_windowsfont(argv.x, argv.y, LABEL_FOUT_SIZE, 0, 2, 0, tmpfont_name, tmpdata); TSC_windowsfont(argv.x, argv.y, argv.size, 0, argv.style, 0, tmpfont_name, tmpdata);
++ i; ++ i;
} }
......
...@@ -19,6 +19,7 @@ extern "C" int __declspec(dllexport)LabPrtOpen(char data[]); ...@@ -19,6 +19,7 @@ extern "C" int __declspec(dllexport)LabPrtOpen(char data[]);
//--------------------------------------------------------- //---------------------------------------------------------
extern "C" int __declspec(dllexport)LabPrtLine(int x, int y, int line, const char *data); extern "C" int __declspec(dllexport)LabPrtLine(int x, int y, int line, const char *data);
extern "C" int __declspec(dllexport)LabPrtLineWithSizeAndRatio(int x, int y, int size, double ratio, int line, const char *data); extern "C" int __declspec(dllexport)LabPrtLineWithSizeAndRatio(int x, int y, int size, double ratio, int line, const char *data);
extern "C" int __declspec(dllexport)LabPrtLineWithSizeAndStyle(int x, int y, int size, int style, int line, const char *data);
//杯贴打印完结; //杯贴打印完结;
extern "C" int __declspec(dllexport)LabPrtClose(); extern "C" int __declspec(dllexport)LabPrtClose();
/****************************************************小票**********************************************/ /****************************************************小票**********************************************/
......
...@@ -208,20 +208,22 @@ int main() ...@@ -208,20 +208,22 @@ int main()
//char xmlstr[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ticket type=\"OrderPrint\" typeCode=\"1\">\n<line printType=\"Text\" text=\"0001非码测试单\" codeType=\"1\" fontType=\"1\" fontStyle=\"1\" width=\"2\" height=\"2\" leftMargin=\"0\" AlignMode=\"1\"/>\n</ticket>"; //char xmlstr[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ticket type=\"OrderPrint\" typeCode=\"1\">\n<line printType=\"Text\" text=\"0001非码测试单\" codeType=\"1\" fontType=\"1\" fontStyle=\"1\" width=\"2\" height=\"2\" leftMargin=\"0\" AlignMode=\"1\"/>\n</ticket>";
//char xmlstr[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?><ticket type = \"OrderPrint\" typeCode = \"1\"><line printType=\"Text\" text=\"%1Bulabula%2\" fontType=\"1\" fontStyle=\"1\" width=\"1\" height=\"1\" leftMargin=\"0\" AlignMode=\"0\"><math index=\"1\" content=\"order_title\" /><math index=\"2\" content=\"order_index\" /></line></ticket>"; //char xmlstr[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?><ticket type = \"OrderPrint\" typeCode = \"1\"><line printType=\"Text\" text=\"%1Bulabula%2\" fontType=\"1\" fontStyle=\"1\" width=\"1\" height=\"1\" leftMargin=\"0\" AlignMode=\"0\"><math index=\"1\" content=\"order_title\" /><math index=\"2\" content=\"order_index\" /></line></ticket>";
//char conf[] = "{\"name\":\"Xprinter\",\"paperwidth\":\"56\",\"type\":3}"; //char conf[] = "{\"name\":\"Xprinter\",\"paperwidth\":\"56\",\"type\":3}";
char conf[] = "{\"name\":\"Xprinter\",\"high\":\"25\",\"labelprttype\":0,\"type\": 4,\"width\":\"40\"}"; char conf[] = "{\"name\":\"XP-80C\",\"paperwidth\":\"80\",\"type\":4}";
//char conf[] = "{\"name\":\"Xprinter\",\"high\":\"25\",\"labelprttype\":0,\"type\": 4,\"width\":\"40\"}";
//char order[] = "{\"order_title\":\"AAAA\",\"order_index\":\"0001\"}"; //char order[] = "{\"order_title\":\"AAAA\",\"order_index\":\"0001\"}";
char err[1024] = {}; char err[1024] = {};
char xmlstr[25600] = {0}; char xmlstr[25600] = {0};
char order[25600] = {0}; char order[25600] = {0};
string xmlfilename = "D:\\gitcode\\prtlab\\PrtLib\\Debug\\xml.txt"; string xmlfilename = "C:\\Users\\xiaoqing.gu\\Desktop\\xml\\xml.txt";
string jsonfilename = "D:\\gitcode\\prtlab\\PrtLib\\Debug\\json.txt"; string jsonfilename = "C:\\Users\\xiaoqing.gu\\Desktop\\xml\\json.txt";
GetFileBuf(xmlstr, xmlfilename); GetFileBuf(xmlstr, xmlfilename);
GetFileBuf(order, jsonfilename); GetFileBuf(order, jsonfilename);
DoLabPrintWithXmls(conf, order, xmlstr, err); /*DoLabPrintWithXmls(conf, order, xmlstr, err);*/
DoPrintWithXmls(conf, order, xmlstr, err);
system("pause"); system("pause");
......
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