|
|
|
@ -657,7 +657,7 @@ void MsgHandler::Print1_1(const std::map<std::string, std::string>& msg)
|
|
|
|
//设置页模式
|
|
|
|
//设置页模式
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x11, 0x21}); //进入页模式
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x11, 0x21}); //进入页模式
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x11, 0x25, 00});//设置页模式打印方向
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x11, 0x25, 00});//设置页模式打印方向
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x11, 0x23, 0x02, 0x30, 0x03, 0x60});//设置页模式宽度和高度,70mm*108mm
|
|
|
|
// m_PrintData.insert(m_PrintData.end(), {0x11, 0x23, 0x02, 0x30, 0x03, 0x60});//设置页模式宽度和高度,70mm*108mm
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x11, 0x24, 0x00, 0x00, 0x00, 0x00});//设置打印坐标起点
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x11, 0x24, 0x00, 0x00, 0x00, 0x00});//设置打印坐标起点
|
|
|
|
|
|
|
|
|
|
|
|
//=============================开票时间=====================================
|
|
|
|
//=============================开票时间=====================================
|
|
|
|
@ -750,19 +750,65 @@ void MsgHandler::Print1_1(const std::map<std::string, std::string>& msg)
|
|
|
|
|
|
|
|
|
|
|
|
//====供应商=====================
|
|
|
|
//====供应商=====================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const size_t MAX_DISPLAY_WIDTH = 28; // 每行最多28个显示位置
|
|
|
|
|
|
|
|
|
|
|
|
m_newObj.clear();
|
|
|
|
m_newObj.clear();
|
|
|
|
m_newObj[0] = ("│");
|
|
|
|
m_newObj[0] = ("│");
|
|
|
|
m_newObj[26] = (" 往来单位");
|
|
|
|
m_newObj[26] = (" 往来单位");
|
|
|
|
m_newObj[168] = ("│");
|
|
|
|
m_newObj[168] = ("│");
|
|
|
|
it = msg.find("Supplier");
|
|
|
|
it = msg.find("Supplier");
|
|
|
|
if(it != msg.end())
|
|
|
|
if (it != msg.end())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_newObj[190] = it->second;
|
|
|
|
// 检查显示宽度是否超过限制
|
|
|
|
|
|
|
|
size_t display_width = get_utf8_display_width(it->second);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (display_width > MAX_DISPLAY_WIDTH)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// 需要分割成多行显示
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 第一行:显示前32个宽度的内容
|
|
|
|
|
|
|
|
std::vector<std::string> lines = split_utf8_by_width(it->second, MAX_DISPLAY_WIDTH);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 输出第一行(包含前缀)
|
|
|
|
|
|
|
|
m_newObj[190] = lines[0];
|
|
|
|
|
|
|
|
m_newObj[528] = ("│");
|
|
|
|
|
|
|
|
blTemp = BuildStringLine(m_newObj);
|
|
|
|
|
|
|
|
m_PrintData.insert(m_PrintData.end(), blTemp.begin(), blTemp.end());
|
|
|
|
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x0A});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 输出剩余行(不包含前缀,但有边框)
|
|
|
|
|
|
|
|
for (size_t i = 1; i < lines.size(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_newObj.clear();
|
|
|
|
|
|
|
|
m_newObj[0] = ("│");
|
|
|
|
|
|
|
|
m_newObj[168] = ("│");
|
|
|
|
|
|
|
|
m_newObj[190] = lines[i];
|
|
|
|
|
|
|
|
m_newObj[528] = ("│");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
blTemp = BuildStringLine(m_newObj);
|
|
|
|
|
|
|
|
m_PrintData.insert(m_PrintData.end(), blTemp.begin(), blTemp.end());
|
|
|
|
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x0A});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// 宽度不超过限制,正常显示
|
|
|
|
|
|
|
|
m_newObj[190] = it->second;
|
|
|
|
|
|
|
|
m_newObj[528] = ("│");
|
|
|
|
|
|
|
|
blTemp = BuildStringLine(m_newObj);
|
|
|
|
|
|
|
|
m_PrintData.insert(m_PrintData.end(), blTemp.begin(), blTemp.end());
|
|
|
|
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x0A});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// 没有找到,显示空内容
|
|
|
|
|
|
|
|
m_newObj[190] = "";
|
|
|
|
|
|
|
|
m_newObj[528] = ("│");
|
|
|
|
|
|
|
|
blTemp = BuildStringLine(m_newObj);
|
|
|
|
|
|
|
|
m_PrintData.insert(m_PrintData.end(), blTemp.begin(), blTemp.end());
|
|
|
|
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x0A});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_newObj[528] = ("│");
|
|
|
|
|
|
|
|
blTemp = BuildStringLine(m_newObj);
|
|
|
|
|
|
|
|
m_PrintData.insert(m_PrintData.end(), blTemp.begin(), blTemp.end());
|
|
|
|
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x0A});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_newObj.clear();
|
|
|
|
m_newObj.clear();
|
|
|
|
m_newObj[1] = ("├");
|
|
|
|
m_newObj[1] = ("├");
|
|
|
|
@ -1060,34 +1106,12 @@ void MsgHandler::Print1_1(const std::map<std::string, std::string>& msg)
|
|
|
|
m_PrintData.insert(m_PrintData.end(), blTemp.begin(), blTemp.end());
|
|
|
|
m_PrintData.insert(m_PrintData.end(), blTemp.begin(), blTemp.end());
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x0A});
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x0A});
|
|
|
|
|
|
|
|
|
|
|
|
// 操作员
|
|
|
|
|
|
|
|
// m_newObj.clear();
|
|
|
|
|
|
|
|
// m_newObj[0] = ("│");
|
|
|
|
|
|
|
|
// it = msg.find("GrossOperater");
|
|
|
|
|
|
|
|
// if (it != msg.end())
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// m_newObj[26] = " " + it->second;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// m_newObj[528] = ("│");
|
|
|
|
|
|
|
|
// blTemp = BuildStringLine(m_newObj);
|
|
|
|
|
|
|
|
// m_PrintData.insert(m_PrintData.end(), blTemp.begin(), blTemp.end());
|
|
|
|
|
|
|
|
// m_PrintData.insert(m_PrintData.end(), {0x0A});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// m_newObj.clear();
|
|
|
|
|
|
|
|
// m_newObj[1] = ("├");
|
|
|
|
|
|
|
|
// m_newObj[7] = ("┬");
|
|
|
|
|
|
|
|
// m_newObj[23] = ("┤");
|
|
|
|
|
|
|
|
// blTemp = BuildLine(24, m_newObj);
|
|
|
|
|
|
|
|
// m_PrintData.insert(m_PrintData.end(), blTemp.begin(), blTemp.end());
|
|
|
|
|
|
|
|
// m_PrintData.insert(m_PrintData.end(), {0x0A});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//=========备注=====================
|
|
|
|
//=========备注=====================
|
|
|
|
|
|
|
|
|
|
|
|
m_newObj.clear();
|
|
|
|
m_newObj.clear();
|
|
|
|
m_newObj[0] = ("│");
|
|
|
|
m_newObj[0] = ("│");
|
|
|
|
m_newObj[26] = (" 备注");
|
|
|
|
m_newObj[26] = (" 备注");
|
|
|
|
m_newObj[168] = ("│");
|
|
|
|
m_newObj[168] = ("│");
|
|
|
|
|
|
|
|
|
|
|
|
it = msg.find("Tips");
|
|
|
|
it = msg.find("Tips");
|
|
|
|
if (it != msg.end())
|
|
|
|
if (it != msg.end())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -1108,75 +1132,7 @@ void MsgHandler::Print1_1(const std::map<std::string, std::string>& msg)
|
|
|
|
m_PrintData.insert(m_PrintData.end(), blTemp.begin(), blTemp.end());
|
|
|
|
m_PrintData.insert(m_PrintData.end(), blTemp.begin(), blTemp.end());
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x0A});
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x0A});
|
|
|
|
|
|
|
|
|
|
|
|
// const size_t MAX_DISPLAY_WIDTH = 30; // 每行最多32个显示位置
|
|
|
|
//=========打印=====================
|
|
|
|
|
|
|
|
|
|
|
|
// m_newObj.clear();
|
|
|
|
|
|
|
|
// m_newObj[0] = ("│");
|
|
|
|
|
|
|
|
// m_newObj[26] = ("提示");
|
|
|
|
|
|
|
|
// m_newObj[144] = ("│");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// it = msg.find("Tips");
|
|
|
|
|
|
|
|
// if (it != msg.end())
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// // 检查显示宽度是否超过限制
|
|
|
|
|
|
|
|
// size_t display_width = get_utf8_display_width(it->second);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if (display_width > MAX_DISPLAY_WIDTH)
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// // 需要分割成多行显示
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // 第一行:显示前32个宽度的内容
|
|
|
|
|
|
|
|
// std::vector<std::string> lines = split_utf8_by_width(it->second, MAX_DISPLAY_WIDTH);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // 输出第一行(包含前缀)
|
|
|
|
|
|
|
|
// m_newObj[170] = lines[0];
|
|
|
|
|
|
|
|
// m_newObj[528] = ("│");
|
|
|
|
|
|
|
|
// blTemp = BuildStringLine(m_newObj);
|
|
|
|
|
|
|
|
// m_PrintData.insert(m_PrintData.end(), blTemp.begin(), blTemp.end());
|
|
|
|
|
|
|
|
// m_PrintData.insert(m_PrintData.end(), {0x0A});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // 输出剩余行(不包含前缀,但有边框)
|
|
|
|
|
|
|
|
// for (size_t i = 1; i < lines.size(); i++)
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// m_newObj.clear();
|
|
|
|
|
|
|
|
// m_newObj[0] = ("│");
|
|
|
|
|
|
|
|
// m_newObj[144] = ("│");
|
|
|
|
|
|
|
|
// m_newObj[170] = lines[i];
|
|
|
|
|
|
|
|
// m_newObj[528] = ("│");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// blTemp = BuildStringLine(m_newObj);
|
|
|
|
|
|
|
|
// m_PrintData.insert(m_PrintData.end(), blTemp.begin(), blTemp.end());
|
|
|
|
|
|
|
|
// m_PrintData.insert(m_PrintData.end(), {0x0A});
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// else
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// // 宽度不超过限制,正常显示
|
|
|
|
|
|
|
|
// m_newObj[170] = it->second;
|
|
|
|
|
|
|
|
// m_newObj[528] = ("│");
|
|
|
|
|
|
|
|
// blTemp = BuildStringLine(m_newObj);
|
|
|
|
|
|
|
|
// m_PrintData.insert(m_PrintData.end(), blTemp.begin(), blTemp.end());
|
|
|
|
|
|
|
|
// m_PrintData.insert(m_PrintData.end(), {0x0A});
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// else
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// // 没有找到Warning,显示空内容
|
|
|
|
|
|
|
|
// m_newObj[170] = "";
|
|
|
|
|
|
|
|
// m_newObj[528] = ("│");
|
|
|
|
|
|
|
|
// blTemp = BuildStringLine(m_newObj);
|
|
|
|
|
|
|
|
// m_PrintData.insert(m_PrintData.end(), blTemp.begin(), blTemp.end());
|
|
|
|
|
|
|
|
// m_PrintData.insert(m_PrintData.end(), {0x0A});
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// m_newObj.clear();
|
|
|
|
|
|
|
|
// m_newObj[1] = ("└");
|
|
|
|
|
|
|
|
// m_newObj[7] = ("┴");
|
|
|
|
|
|
|
|
// m_newObj[23] = ("┘");
|
|
|
|
|
|
|
|
// blTemp = BuildLine(24, m_newObj);
|
|
|
|
|
|
|
|
// m_PrintData.insert(m_PrintData.end(), blTemp.begin(), blTemp.end());
|
|
|
|
|
|
|
|
// m_PrintData.insert(m_PrintData.end(), {0x0A});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//打印页
|
|
|
|
//打印页
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x11, 0x0C});
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x11, 0x0C});
|
|
|
|
//退出页模式
|
|
|
|
//退出页模式
|
|
|
|
@ -1187,6 +1143,8 @@ void MsgHandler::Print1_1(const std::map<std::string, std::string>& msg)
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x1B, 0x4B, 0x60});//向上调整位置
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x1B, 0x4B, 0x60});//向上调整位置
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x1B, 0x4B, 0x60});//向上调整位置
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x1B, 0x4B, 0x60});//向上调整位置
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x1B, 0x4B, 0x60});//向上调整位置
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x1B, 0x4B, 0x60});//向上调整位置
|
|
|
|
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x1B, 0x4B, 0x60});//向上调整位置
|
|
|
|
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x1B, 0x4B, 0x40});//向上调整位置
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x1C, 0x70, 0x01, 0x00});//打印下载NV位图
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x1C, 0x70, 0x01, 0x00});//打印下载NV位图
|
|
|
|
|
|
|
|
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x1B, 0x64, 0x06});//空行并打印
|
|
|
|
m_PrintData.insert(m_PrintData.end(), {0x1B, 0x64, 0x06});//空行并打印
|
|
|
|
|