Commit ac50e867 by 李定达

1.测试预留

parent 1a9ab21d
No preview for this file type
......@@ -376,22 +376,34 @@ bool PrintLib::DoPrint(std::string prtStr, std::string orderStr, std::string xml
Document dJson;
int intType = 1;
if (_ParseJson(orderStr,dJson))
{
stringstream stm;
stm << xmlStr;
file<> fdoc(stm);
xml_document<> doc;
doc.parse<0>(fdoc.data());
xml_node<>* rootTicket = doc.first_node();
xml_attribute<>* p = rootTicket->first_attribute("typeCode");
intType = strtol(p->value(), NULL, 10);
_PrintDoc(intType,rootTicket,dJson);
}
else
{
LOG() << "_ParseJson failed";
}
//try
//{
if (_ParseJson(orderStr,dJson))
{
stringstream stm;
stm << xmlStr;
file<> fdoc(stm);
xml_document<> doc;
doc.parse<0>(fdoc.data());
xml_node<>* rootTicket = doc.first_node();
xml_attribute<>* p = rootTicket->first_attribute("typeCode");
intType = strtol(p->value(), NULL, 10);
_PrintDoc(intType,rootTicket,dJson);
}
else
{
LOG() << "_ParseJson failed";
}
//}
//catch (std::exception* e)
//{
// LOG() << "std::exception : " << e->what();
//}
//catch(...)
//{
// LOG() << "Exception ParseJson";
//}
f_ClosePrinter(intType);
return true;
}
......
......@@ -208,7 +208,8 @@ 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\"?><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\",\"high\":\"25\",\"labelprttype\":0,\"type\": 4,\"width\":\"40\"}";
//char conf[] = "{\"name\":\"Xprinter\",\"high\":\"25\",\"labelprttype\":0,\"type\": 4,\"width\":\"40\"}";
char conf[] = "{\"name\":\"GP-80160(Cut) Series\",\"paperwidth\":\"80\",\"type\":4}";
//char order[] = "{\"order_title\":\"AAAA\",\"order_index\":\"0001\"}";
char err[1024] = {};
......@@ -221,7 +222,8 @@ int main()
GetFileBuf(xmlstr, xmlfilename);
GetFileBuf(order, jsonfilename);
DoLabPrintWithXmls(conf, order, xmlstr, err);
DoPrintWithXmls(conf, order, xmlstr, err);
//DoLabPrintWithXmls(conf, order, xmlstr, err);
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