|
|
@@ -300,8 +300,22 @@ int CPosPrinter::GetDevicePath(LPGUID lpGuid, LPTSTR* pszDevicePath)
|
|
|
|
|
|
if(bResult)
|
|
|
{
|
|
|
+ wstring DevicePath = pDetail->DevicePath;
|
|
|
+
|
|
|
+ wstring vid = DevicePath.substr(DevicePath.find(_T("vid_"), 0) + 4, 4);
|
|
|
+ wstring pid = DevicePath.substr(DevicePath.find(_T("pid_"), 0) + 4, 4);
|
|
|
+
|
|
|
+ LOG_INFO("Vid:" << vid.c_str() << ", Pid:" << pid.c_str());
|
|
|
+
|
|
|
+ if (GetPrinterType(vid, pid) == 2)
|
|
|
+ {
|
|
|
+ //标签打印机,暂时不处理打印
|
|
|
+ LOG_INFO("标签打印机,暂时不打印!");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
// 复制设备路径到输出缓冲区
|
|
|
- ::_tcscpy_s(pszDevicePath[nCount], 256, pDetail->DevicePath);
|
|
|
+ ::_tcscpy_s(pszDevicePath[nCount], 256, pDetail->DevicePath);
|
|
|
|
|
|
// 调整计数值
|
|
|
nCount++;
|
|
|
@@ -324,6 +338,20 @@ int CPosPrinter::GetDevicePath(LPGUID lpGuid, LPTSTR* pszDevicePath)
|
|
|
return nCount;
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ *返回打印机的类型, 1:普通热敏打印机 2:标签打印机
|
|
|
+ **/
|
|
|
+int CPosPrinter::GetPrinterType(wstring vid, wstring pid)
|
|
|
+{
|
|
|
+ if (vid == L"6868" && pid == L"0500")
|
|
|
+ {
|
|
|
+ //佳博标签打印机
|
|
|
+ return 2;
|
|
|
+ }
|
|
|
+
|
|
|
+ return 1;
|
|
|
+}
|
|
|
+
|
|
|
void CPosPrinter::PrintWaimaiOrderShouyin(CWaimaiOrder& order)
|
|
|
{
|
|
|
//设置模式,后面输出数据不会错
|
|
|
@@ -1009,9 +1037,9 @@ int CPosPrinter::WriteBuf(const char* buf, int len)
|
|
|
if((*it).type == 3)
|
|
|
{
|
|
|
//串口,同步写数据
|
|
|
- LOG_INFO("before com writefile handle:" << hPort);
|
|
|
+ //LOG_INFO("before com writefile handle:" << hPort);
|
|
|
WriteFile(hPort, buf, len, &dwWrite, NULL);
|
|
|
- LOG_INFO("after com writefile handle:" << hPort);
|
|
|
+ //LOG_INFO("after com writefile handle:" << hPort);
|
|
|
}
|
|
|
else
|
|
|
{
|