Browse Source

集成了乐外卖的改动

zhangyang 6 years ago
parent
commit
567f5d4103

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


+ 49 - 1
bin/Win32/Debug/zhipuzi_pos_windows/skin/setting.xml

@@ -30,7 +30,7 @@
 					</HorizontalLayout>
 				</VerticalLayout>
 
-				<VerticalLayout bkcolor="#FFFFFFFF" padding="0,20,20,20" inset="15,15,15,15">
+				<VerticalLayout bkcolor="#FFFFFFFF" padding="0,20,20,20" inset="15,15,15,15" vscrollbar="true">
 					<HorizontalLayout height="44">
 						<Label text="新订单自动打印" width="260" />
 						<CheckBox name="setting_is_new_waimai_printer" width="72" height="45" normalimage="file='switchbutton.png' source='0,0,143,91'" selectedimage="file='switchbutton.png' source='0,182,143,273'"/>
@@ -51,6 +51,54 @@
 							<ListLabelElement text="4联" />
 						</Combo>
 					</HorizontalLayout>
+					<HorizontalLayout height="44" padding="0,20,0,0">
+						<Label text="小票格式设置" width="260" />
+					</HorizontalLayout>
+					<Control height="1" bkcolor="#FF708090" />
+					<HorizontalLayout height="44">
+						<Label text="取货方式大号字体" width="260" />
+						<CheckBox name="setting_printer_quhuo_big" width="72" height="45" normalimage="file='switchbutton.png' source='0,0,143,91'" selectedimage="file='switchbutton.png' source='0,182,143,273'"/>
+					</HorizontalLayout>
+					<HorizontalLayout height="44">
+						<Label text="订单号大号字体" width="260" />
+						<CheckBox name="setting_printer_dingdanhao_big" width="72" height="45" normalimage="file='switchbutton.png' source='0,0,143,91'" selectedimage="file='switchbutton.png' source='0,182,143,273'"/>
+					</HorizontalLayout>
+					<HorizontalLayout height="44">
+						<Label text="下单时间大号字体" width="260" />
+						<CheckBox name="setting_printer_xiadanshijian_big" width="72" height="45" normalimage="file='switchbutton.png' source='0,0,143,91'" selectedimage="file='switchbutton.png' source='0,182,143,273'"/>
+					</HorizontalLayout>
+					<HorizontalLayout height="44">
+						<Label text="配送(自取)时间大号字体" width="260" />
+						<CheckBox name="setting_printer_peisongshijian_big" width="72" height="45" normalimage="file='switchbutton.png' source='0,0,143,91'" selectedimage="file='switchbutton.png' source='0,182,143,273'"/>
+					</HorizontalLayout>
+					<HorizontalLayout height="44">
+						<Label text="姓名大号字体" width="260" />
+						<CheckBox name="setting_printer_name_big" width="72" height="45" normalimage="file='switchbutton.png' source='0,0,143,91'" selectedimage="file='switchbutton.png' source='0,182,143,273'"/>
+					</HorizontalLayout>
+					<HorizontalLayout height="44">
+						<Label text="电话大号字体" width="260" />
+						<CheckBox name="setting_printer_phone_big" width="72" height="45" normalimage="file='switchbutton.png' source='0,0,143,91'" selectedimage="file='switchbutton.png' source='0,182,143,273'"/>
+					</HorizontalLayout>
+					<HorizontalLayout height="44">
+						<Label text="地址大号字体" width="260" />
+						<CheckBox name="setting_printer_address_big" width="72" height="45" normalimage="file='switchbutton.png' source='0,0,143,91'" selectedimage="file='switchbutton.png' source='0,182,143,273'"/>
+					</HorizontalLayout>
+					<HorizontalLayout height="44">
+						<Label text="商品大号字体" width="260" />
+						<CheckBox name="setting_printer_shangpin_big" width="72" height="45" normalimage="file='switchbutton.png' source='0,0,143,91'" selectedimage="file='switchbutton.png' source='0,182,143,273'"/>
+					</HorizontalLayout>
+					<HorizontalLayout height="44">
+						<Label text="备注大号字体" width="260" />
+						<CheckBox name="setting_printer_memo_big" width="72" height="45" normalimage="file='switchbutton.png' source='0,0,143,91'" selectedimage="file='switchbutton.png' source='0,182,143,273'"/>
+					</HorizontalLayout>
+					<HorizontalLayout height="44">
+						<Label text="价格大号字体" width="260" />
+						<CheckBox name="setting_printer_price_big" width="72" height="45" normalimage="file='switchbutton.png' source='0,0,143,91'" selectedimage="file='switchbutton.png' source='0,182,143,273'"/>
+					</HorizontalLayout>
+					<HorizontalLayout height="44">
+						<Label text="付款方式大号字体" width="260" />
+						<CheckBox name="setting_printer_pay_big" width="72" height="45" normalimage="file='switchbutton.png' source='0,0,143,91'" selectedimage="file='switchbutton.png' source='0,182,143,273'"/>
+					</HorizontalLayout>
 				</VerticalLayout>
 
 				<VerticalLayout bkcolor="#FFFFFFFF" padding="0,20,20,20" inset="15,15,15,15">

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


File diff suppressed because it is too large
+ 569 - 387
zhipuzi_pos_windows/tool/CPosPrinter.cpp


+ 15 - 5
zhipuzi_pos_windows/tool/CPosPrinter.h

@@ -10,7 +10,16 @@
 #define MAX_DEVICE 16
 
 //USB类的GUID
-const GUID USB_GUID = {0xa5dcbf10, 0x6530, 0x11d2, {0x90, 0x1f, 0x00, 0xc0, 0x4f, 0xb9, 0x51, 0xed}};
+//const GUID USB_GUID = {0xa5dcbf10, 0x6530, 0x11d2, {0x90, 0x1f, 0x00, 0xc0, 0x4f, 0xb9, 0x51, 0xed}};
+const GUID USB_GUID = {0x28d78fad, 0x5a12, 0x11d1, {0xae, 0x5b, 0x00, 0x00, 0xf8, 0x03, 0xa8, 0xc2 }};
+
+//存储打印端口句柄的结构
+class PrinterHandle
+{
+public:
+	HANDLE hPort;
+	int type; //句柄类型 1:usb 2:并口 3:串口
+};
 
 class CPosPrinter
 {
@@ -23,11 +32,12 @@ public:
 
 private:
 	bool InitShouyin();
-
 	int GetDevicePath(LPGUID lpGuid, LPTSTR* pszDevicePath);
 
 	int WriteData(string meg);
-	int WriteBuf(char *buf, int len);
+	int WriteBuf(const char* buf, int len);
+
+	bool PortTest(HANDLE hPort);
 
 	int POS_Reset(void);
 	int POS_FeedLine(void);
@@ -40,7 +50,7 @@ private:
 	int POS_SET_ABS_X(int x, int y);
 	int POS_SET_PRINT_AREA(int x, int y);
 
-	int POS_TextOut(string abc, bool is_double = false, int align_type = 0);
+	int POS_TextOut(string abc, bool is_double_width = false, bool is_double_height = false, int align_type = 0);
 
 	int POS_CutPaper();
 	int POS_OutQRCode();
@@ -55,7 +65,7 @@ private:
 	std::string HandleFoodTotalPrice(std::string oldprice, int guige = 1);
 
 private:
-	std::vector<HANDLE> m_hPorts;
+	std::vector<PrinterHandle> m_hPorts;
 
 	boost::asio::io_service m_io;
 	boost::asio::ip::tcp::socket m_socket;

+ 66 - 0
zhipuzi_pos_windows/tool/CSetting.cpp

@@ -167,6 +167,72 @@ void CSetting::Init()
 		m_paramsMap[setting_printer_lianshu] = "1";
 	}
 
+	std::string setting_printer_quhuo_big = "setting_printer_quhuo_big";
+	if (m_paramsMap.find(setting_printer_quhuo_big) == m_paramsMap.end())
+	{
+		m_paramsMap[setting_printer_quhuo_big] = "0";
+	}
+
+	std::string setting_printer_dingdanhao_big = "setting_printer_dingdanhao_big";
+	if (m_paramsMap.find(setting_printer_dingdanhao_big) == m_paramsMap.end())
+	{
+		m_paramsMap[setting_printer_dingdanhao_big] = "0";
+	}
+
+	std::string setting_printer_xiadanshijian_big = "setting_printer_xiadanshijian_big";
+	if (m_paramsMap.find(setting_printer_xiadanshijian_big) == m_paramsMap.end())
+	{
+		m_paramsMap[setting_printer_xiadanshijian_big] = "0";
+	}
+
+	std::string setting_printer_peisongshijian_big = "setting_printer_peisongshijian_big";
+	if (m_paramsMap.find(setting_printer_peisongshijian_big) == m_paramsMap.end())
+	{
+		m_paramsMap[setting_printer_peisongshijian_big] = "0";
+	}
+
+	std::string setting_printer_name_big = "setting_printer_name_big";
+	if (m_paramsMap.find(setting_printer_name_big) == m_paramsMap.end())
+	{
+		m_paramsMap[setting_printer_name_big] = "0";
+	}
+
+	std::string setting_printer_phone_big = "setting_printer_phone_big";
+	if (m_paramsMap.find(setting_printer_phone_big) == m_paramsMap.end())
+	{
+		m_paramsMap[setting_printer_phone_big] = "0";
+	}
+
+	std::string setting_printer_address_big = "setting_printer_address_big";
+	if (m_paramsMap.find(setting_printer_address_big) == m_paramsMap.end())
+	{
+		m_paramsMap[setting_printer_address_big] = "0";
+	}
+
+	std::string setting_printer_shangpin_big = "setting_printer_shangpin_big";
+	if (m_paramsMap.find(setting_printer_shangpin_big) == m_paramsMap.end())
+	{
+		m_paramsMap[setting_printer_shangpin_big] = "0";
+	}
+
+	std::string setting_printer_memo_big = "setting_printer_memo_big";
+	if (m_paramsMap.find(setting_printer_memo_big) == m_paramsMap.end())
+	{
+		m_paramsMap[setting_printer_memo_big] = "0";
+	}
+
+	std::string setting_printer_price_big = "setting_printer_price_big";
+	if (m_paramsMap.find(setting_printer_price_big) == m_paramsMap.end())
+	{
+		m_paramsMap[setting_printer_price_big] = "0";
+	}
+
+	std::string setting_printer_pay_big = "setting_printer_pay_big";
+	if (m_paramsMap.find(setting_printer_pay_big) == m_paramsMap.end())
+	{
+		m_paramsMap[setting_printer_pay_big] = "0";
+	}
+
 	//³ø·¿´òÓ¡µÄĬÈϲÎÊý
 	std::string setting_is_new_waimai_chufang_printer = "setting_is_new_waimai_chufang_printer";
 	if (m_paramsMap.find(setting_is_new_waimai_chufang_printer) == m_paramsMap.end())

+ 265 - 0
zhipuzi_pos_windows/wnd/CMainWnd.cpp

@@ -489,6 +489,150 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
         }
     }
 
+	else if (name == _T("setting_printer_quhuo_big"))
+	{
+	CCheckBoxUI* box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_quhuo_big")));
+
+	if (box->IsSelected())
+	{
+		CSetting::SetParam("setting_printer_quhuo_big", "0");
+	}
+	else
+	{
+		CSetting::SetParam("setting_printer_quhuo_big", "1");
+	}
+	}
+	else if (name == _T("setting_printer_dingdanhao_big"))
+	{
+	CCheckBoxUI* box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_dingdanhao_big")));
+
+	if (box->IsSelected())
+	{
+		CSetting::SetParam("setting_printer_dingdanhao_big", "0");
+	}
+	else
+	{
+		CSetting::SetParam("setting_printer_dingdanhao_big", "1");
+	}
+	}
+	else if (name == _T("setting_printer_xiadanshijian_big"))
+	{
+	CCheckBoxUI* box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_xiadanshijian_big")));
+
+	if (box->IsSelected())
+	{
+		CSetting::SetParam("setting_printer_xiadanshijian_big", "0");
+	}
+	else
+	{
+		CSetting::SetParam("setting_printer_xiadanshijian_big", "1");
+	}
+	}
+	else if (name == _T("setting_printer_peisongshijian_big"))
+	{
+	CCheckBoxUI* box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_peisongshijian_big")));
+
+	if (box->IsSelected())
+	{
+		CSetting::SetParam("setting_printer_peisongshijian_big", "0");
+	}
+	else
+	{
+		CSetting::SetParam("setting_printer_peisongshijian_big", "1");
+	}
+	}
+	else if (name == _T("setting_printer_name_big"))
+	{
+	CCheckBoxUI* box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_name_big")));
+
+	if (box->IsSelected())
+	{
+		CSetting::SetParam("setting_printer_name_big", "0");
+	}
+	else
+	{
+		CSetting::SetParam("setting_printer_name_big", "1");
+	}
+	}
+	else if (name == _T("setting_printer_phone_big"))
+	{
+	CCheckBoxUI* box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_phone_big")));
+
+	if (box->IsSelected())
+	{
+		CSetting::SetParam("setting_printer_phone_big", "0");
+	}
+	else
+	{
+		CSetting::SetParam("setting_printer_phone_big", "1");
+	}
+	}
+	else if (name == _T("setting_printer_address_big"))
+	{
+	CCheckBoxUI* box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_address_big")));
+
+	if (box->IsSelected())
+	{
+		CSetting::SetParam("setting_printer_address_big", "0");
+	}
+	else
+	{
+		CSetting::SetParam("setting_printer_address_big", "1");
+	}
+	}
+	else if (name == _T("setting_printer_shangpin_big"))
+	{
+	CCheckBoxUI* box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_shangpin_big")));
+
+	if (box->IsSelected())
+	{
+		CSetting::SetParam("setting_printer_shangpin_big", "0");
+	}
+	else
+	{
+		CSetting::SetParam("setting_printer_shangpin_big", "1");
+	}
+	}
+	else if (name == _T("setting_printer_memo_big"))
+	{
+	CCheckBoxUI* box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_memo_big")));
+
+	if (box->IsSelected())
+	{
+		CSetting::SetParam("setting_printer_memo_big", "0");
+	}
+	else
+	{
+		CSetting::SetParam("setting_printer_memo_big", "1");
+	}
+	}
+	else if (name == _T("setting_printer_price_big"))
+	{
+	CCheckBoxUI* box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_price_big")));
+
+	if (box->IsSelected())
+	{
+		CSetting::SetParam("setting_printer_price_big", "0");
+	}
+	else
+	{
+		CSetting::SetParam("setting_printer_price_big", "1");
+	}
+	}
+	else if (name == _T("setting_printer_pay_big"))
+	{
+	CCheckBoxUI* box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_pay_big")));
+
+	if (box->IsSelected())
+	{
+		CSetting::SetParam("setting_printer_pay_big", "0");
+	}
+	else
+	{
+		CSetting::SetParam("setting_printer_pay_big", "1");
+	}
+	}
+
     else if(name == _T("setting_is_new_waimai_chufang_printer"))
     {
         CCheckBoxUI* box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_new_waimai_chufang_printer")));
@@ -1359,6 +1503,127 @@ void CMainWnd::InitSettingStatus()
         com->SetText(L"4联");
     }
 
+	box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_quhuo_big")));
+
+	if (CSetting::GetParam("setting_printer_quhuo_big") == "1")
+	{
+		box->Selected(true, false);
+	}
+	else
+	{
+		box->Selected(false, false);
+	}
+
+	box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_dingdanhao_big")));
+
+	if (CSetting::GetParam("setting_printer_dingdanhao_big") == "1")
+	{
+		box->Selected(true, false);
+	}
+	else
+	{
+		box->Selected(false, false);
+	}
+
+	box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_xiadanshijian_big")));
+
+	if (CSetting::GetParam("setting_printer_xiadanshijian_big") == "1")
+	{
+		box->Selected(true, false);
+	}
+	else
+	{
+		box->Selected(false, false);
+	}
+
+	box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_peisongshijian_big")));
+
+	if (CSetting::GetParam("setting_printer_peisongshijian_big") == "1")
+	{
+		box->Selected(true, false);
+	}
+	else
+	{
+		box->Selected(false, false);
+	}
+
+	box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_name_big")));
+
+	if (CSetting::GetParam("setting_printer_name_big") == "1")
+	{
+		box->Selected(true, false);
+	}
+	else
+	{
+		box->Selected(false, false);
+	}
+
+	box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_phone_big")));
+
+	if (CSetting::GetParam("setting_printer_phone_big") == "1")
+	{
+		box->Selected(true, false);
+	}
+	else
+	{
+		box->Selected(false, false);
+	}
+
+	box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_address_big")));
+
+	if (CSetting::GetParam("setting_printer_address_big") == "1")
+	{
+		box->Selected(true, false);
+	}
+	else
+	{
+		box->Selected(false, false);
+	}
+
+	box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_shangpin_big")));
+
+	if (CSetting::GetParam("setting_printer_shangpin_big") == "1")
+	{
+		box->Selected(true, false);
+	}
+	else
+	{
+		box->Selected(false, false);
+	}
+
+	box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_memo_big")));
+
+	if (CSetting::GetParam("setting_printer_memo_big") == "1")
+	{
+		box->Selected(true, false);
+	}
+	else
+	{
+		box->Selected(false, false);
+	}
+
+	box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_price_big")));
+
+	if (CSetting::GetParam("setting_printer_price_big") == "1")
+	{
+		box->Selected(true, false);
+	}
+	else
+	{
+		box->Selected(false, false);
+	}
+
+	box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_printer_pay_big")));
+
+	if (CSetting::GetParam("setting_printer_pay_big") == "1")
+	{
+		box->Selected(true, false);
+	}
+	else
+	{
+		box->Selected(false, false);
+	}
+
     box = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("setting_is_new_waimai_chufang_printer")));
 
     if(CSetting::GetParam("setting_is_new_waimai_chufang_printer") == "1")