|
|
@@ -474,7 +474,7 @@ void CPosPrinter::PrintWaimaiOrderShouyin(CWaimaiOrder& order)
|
|
|
catch(std::exception& e)
|
|
|
{
|
|
|
std::string err = e.what();
|
|
|
- LOG_INFO("打印机失败,IP地址:" << wangkou_ip.c_str() << ",错误信息:" << err.c_str());
|
|
|
+ LOG_INFO("网口打印机连接失败,IP地址:" << wangkou_ip.c_str() << ",错误信息:" << err.c_str());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -900,6 +900,11 @@ void CPosPrinter::PrintWaimaiOrderShouyin(CWaimaiOrder& order)
|
|
|
{
|
|
|
CloseHandle((*it).hPort);
|
|
|
}
|
|
|
+
|
|
|
+ if (m_type == 2)
|
|
|
+ {
|
|
|
+ m_socket.close();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void CPosPrinter::PrintWaimaiOrderBiaoqian(CWaimaiOrder& order)
|
|
|
@@ -1025,7 +1030,7 @@ void CPosPrinter::PrintWaimaiOrderChufang(CWaimaiOrder& order)
|
|
|
catch(std::exception& e)
|
|
|
{
|
|
|
std::string err = e.what();
|
|
|
- LOG_INFO("连接厨房打印机失败,IP地址:" << ip.c_str() << ",错误信息:" << err.c_str());
|
|
|
+ LOG_INFO("厨房网口打印机连接失败,IP地址:" << ip.c_str() << ",错误信息:" << err.c_str());
|
|
|
|
|
|
//连接失败了,处理下一个厨房打印机
|
|
|
continue;
|
|
|
@@ -1313,6 +1318,7 @@ int CPosPrinter::WriteBuf(const unsigned char* buf, int len)
|
|
|
{
|
|
|
if(m_type == 1)
|
|
|
{
|
|
|
+ //USB、串口、并口,走这里
|
|
|
DWORD dwWrite;
|
|
|
|
|
|
for(std::vector<PrinterHandle>::iterator it = m_hPorts.begin(); it != m_hPorts.end(); it++)
|
|
|
@@ -1361,13 +1367,14 @@ int CPosPrinter::WriteBuf(const unsigned char* buf, int len)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ //网口走这里
|
|
|
try
|
|
|
{
|
|
|
m_socket.write_some(boost::asio::buffer(buf, len));
|
|
|
}
|
|
|
catch(const std::exception& e)
|
|
|
{
|
|
|
- LOG_INFO(e.what());
|
|
|
+ LOG_INFO("网口打印机发送消息失败,错误信息:" << e.what());
|
|
|
}
|
|
|
|
|
|
return 0;
|