Browse Source

加入新订单的相关判断

zhangyang 6 years ago
parent
commit
3a16ef27a6

BIN
bin/Win32/Debug/zhipuzi_pos_windows/db/pos.db


BIN
bin/Win32/Debug/zhipuzi_pos_windows/zhipuzi_pos_windows.exe


+ 36 - 2
lewaimai_dispatch/network/CMessagePush.cpp

@@ -2,6 +2,7 @@
 #include "CMessagePush.h"
 #include "CMessagePush.h"
 
 
 #include "../tool/CPosPrinter.h"
 #include "../tool/CPosPrinter.h"
+#include "../order/CWaimaiOrder.h"
 
 
 #include "mmsystem.h" 
 #include "mmsystem.h" 
 
 
@@ -113,8 +114,41 @@ void CMessagePush::HandleMessage(std::string msg)
 				mciSendString(Close.c_str(), NULL, 0, 0);
 				mciSendString(Close.c_str(), NULL, 0, 0);
 			}
 			}
 
 
-			CPosPrinter printer;
-			printer.PrintWaimaiOrder(order_id, order_no);
+			//判断是否要自动确认
+			if (CSetting::GetParam("setting_is_new_waimai_autoconfirm") == "1")
+			{
+				CWaimaiOrder newOrder;
+				newOrder.ConfirmeOrder(order_id);
+			}
+
+			//判断是否右下角弹框提醒
+			if (CSetting::GetParam("setting_is_new_waimai_dialog") == "1")
+			{
+				
+			}
+
+			//判断是否自动打印
+			if (CSetting::GetParam("setting_is_new_waimai_printer") == "1")
+			{
+				CPosPrinter printer;
+
+				//判断打印规格和联数
+				std::string guige = CSetting::GetParam("setting_printer_guige");
+				std::string lianshu = CSetting::GetParam("setting_printer_lianshu");
+
+				int n_lianshu = atoi(lianshu.c_str());
+				for (int i = 0; i < n_lianshu; i++)
+				{
+					if (guige == "58")
+					{
+						printer.PrintWaimaiOrder(order_id, order_no, 1);
+					}
+					else
+					{
+						printer.PrintWaimaiOrder(order_id, order_no, 2);
+					}
+				}
+			}
 		}
 		}
 	}
 	}
 	catch (std::exception& e)
 	catch (std::exception& e)

+ 2 - 2
lewaimai_dispatch/tool/CPosPrinter.cpp

@@ -53,7 +53,7 @@ bool CPosPrinter::Init()
     return true;
     return true;
 }
 }
 
 
-void CPosPrinter::PrintWaimaiOrder(string order_id, string order_no)
+void CPosPrinter::PrintWaimaiOrder(string order_id, string order_no, int type)
 {
 {
 	CWaimaiOrder order;
 	CWaimaiOrder order;
 	order.InitData(order_id, order_no);
 	order.InitData(order_id, order_no);
@@ -61,7 +61,7 @@ void CPosPrinter::PrintWaimaiOrder(string order_id, string order_no)
 	PrintWaimaiOrder(order);
 	PrintWaimaiOrder(order);
 }
 }
 
 
-void CPosPrinter::PrintWaimaiOrder(CWaimaiOrder& order)
+void CPosPrinter::PrintWaimaiOrder(CWaimaiOrder& order, int type)
 {
 {
     POS_Reset();
     POS_Reset();
 
 

+ 4 - 2
lewaimai_dispatch/tool/CPosPrinter.h

@@ -19,8 +19,10 @@ public:
     ~CPosPrinter();
     ~CPosPrinter();
 
 
 	bool Init();
 	bool Init();
-	void PrintWaimaiOrder(string order_id, string order_no);
-    void PrintWaimaiOrder(CWaimaiOrder& order);
+
+	//type为1表示58mmm,为2表示80mmm
+	void PrintWaimaiOrder(string order_id, string order_no, int type = 1);
+    void PrintWaimaiOrder(CWaimaiOrder& order, int type = 1);
 
 
 private:
 private:
 	int GetDevicePath(LPGUID lpGuid, LPTSTR* pszDevicePath);
 	int GetDevicePath(LPGUID lpGuid, LPTSTR* pszDevicePath);