|
|
@@ -616,10 +616,13 @@ void CPosPrinter::PrintWaimaiOrderShouyin(CWaimaiOrder& order)
|
|
|
std::string food_name = (*it).m_food_name;
|
|
|
std::string food_price = (*it).m_item_price;
|
|
|
std::string quantity = (*it).m_quantity;
|
|
|
+
|
|
|
//计算总价
|
|
|
double item_price = atof(food_price.c_str()) * atof(quantity.c_str());
|
|
|
std::string food_total_price = CLewaimaiString::DoubleToString(item_price, 2);
|
|
|
+
|
|
|
food_name = CLewaimaiString::UTF8ToANSI(food_name);
|
|
|
+
|
|
|
//先输出商品名字
|
|
|
std::vector<string> m_names;
|
|
|
|
|
|
@@ -648,6 +651,7 @@ void CPosPrinter::PrintWaimaiOrderShouyin(CWaimaiOrder& order)
|
|
|
std::string quantityShow = HandleFoodQuantity(quantity, nGuige);
|
|
|
std::string priceTotalShow = HandleFoodTotalPrice(food_total_price, nGuige);
|
|
|
std::string firstLineShow = firstLine + priceShow + quantityShow + priceTotalShow;
|
|
|
+
|
|
|
POS_TextOut(firstLineShow, false, setting_printer_shangpin_big);
|
|
|
POS_FeedLine();
|
|
|
|
|
|
@@ -849,28 +853,47 @@ void CPosPrinter::PrintWaimaiOrderBiaoqian(CWaimaiOrder& order)
|
|
|
std::string order_num_info = "外卖 #" + restaurant_number;
|
|
|
BIAOQIAN_TEXTOUT(order_num_info, 16, 16, 1, 1);
|
|
|
|
|
|
- std::string numInfo = curFoodNum + "/" + foodNum;
|
|
|
- BIAOQIAN_TEXTOUT(numInfo, 260, 16, 1, 1);
|
|
|
+ std::string numInfo = to_string(curFoodNum) + "/" + to_string(foodNum);
|
|
|
+ BIAOQIAN_TEXTOUT(numInfo, 264, 16, 1, 1);
|
|
|
|
|
|
- //每行最多显示12个汉字,这里要计算一下换行
|
|
|
+ //每行最多显示12个汉字,这里要计算一下换行(要先转成ANSI格式)
|
|
|
+ food_name = CLewaimaiString::UTF8ToANSI(food_name);
|
|
|
std::vector<std::string> foodNameVector = HandleBiaoqianFoodname(food_name);
|
|
|
|
|
|
int nRow = 0;
|
|
|
+
|
|
|
+ //考虑是否用大号字体
|
|
|
+ bool is_big_name = false;
|
|
|
+ if (foodNameVector.size() <= 2)
|
|
|
+ {
|
|
|
+ //不超过2行,可以用大的字体
|
|
|
+ is_big_name = true;
|
|
|
+ }
|
|
|
+
|
|
|
for (std::vector<std::string>::iterator it = foodNameVector.begin(); it != foodNameVector.end(); it++)
|
|
|
{
|
|
|
- BIAOQIAN_TEXTOUT(CLewaimaiString::UTF8ToANSI(*it), 16, 60 + 40 * nRow, 1, 2);
|
|
|
+ if (is_big_name)
|
|
|
+ {
|
|
|
+ BIAOQIAN_TEXTOUT(*it, 16, 56 + 64 * nRow, 1, 2);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ BIAOQIAN_TEXTOUT(*it, 16, 56 + 32 * nRow, 1, 1);
|
|
|
+ }
|
|
|
|
|
|
nRow++;
|
|
|
}
|
|
|
|
|
|
//打印价格
|
|
|
- std::wstring priceInfo = L"¥" + CLewaimaiString::UTF8ToUnicode(food_price);
|
|
|
- BIAOQIAN_TEXTOUT(CLewaimaiString::UnicodeToUTF8(priceInfo), 16, 180, 1, 1);
|
|
|
+ std::string priceInfo = food_price + "元";
|
|
|
+ BIAOQIAN_TEXTOUT(priceInfo, 16, 180, 1, 1);
|
|
|
|
|
|
//打印订单号
|
|
|
BIAOQIAN_TEXTOUT(order_num, 16, 210, 1, 1);
|
|
|
|
|
|
BIAOQIAN_PRINT();
|
|
|
+
|
|
|
+ BIAOQIAN_CLS();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1471,11 +1494,6 @@ void CPosPrinter::BIAOQIAN_Reset()
|
|
|
std::string data = size + gap + referent + speed + density + direction + REFERENCE + PEER + TEAR + KEY + cls;
|
|
|
|
|
|
WriteData(data);
|
|
|
-
|
|
|
- //std::string home = "HOME";
|
|
|
- //home += endTag;
|
|
|
-
|
|
|
- //WriteData(home);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
@@ -1517,6 +1535,16 @@ void CPosPrinter::BIAOQIAN_PRINT()
|
|
|
WriteData(print);
|
|
|
}
|
|
|
|
|
|
+void CPosPrinter::BIAOQIAN_CLS()
|
|
|
+{
|
|
|
+ char endTag[3] = { 0x0d, 0x0a, 0x00 };
|
|
|
+
|
|
|
+ std::string cls = "CLS";
|
|
|
+ cls += endTag;
|
|
|
+
|
|
|
+ WriteData(cls);
|
|
|
+}
|
|
|
+
|
|
|
void CPosPrinter::CalWord(string s, int& nHanzi, int& nZimu)
|
|
|
{
|
|
|
nHanzi = 0;
|