Просмотр исходного кода

开始处理智铺子windows收银机

张洋 4 лет назад
Родитель
Сommit
4b0347bf33

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


BIN
bin/Win32/Debug/zhipuzi_pos_windows/icon/icon.ico


+ 1 - 0
zhipuzi_pos_windows/control/CWaimaiOrderItemUI.h

@@ -44,6 +44,7 @@ private:
 
 	std::string m_is_selftake;
 	std::string m_delivery_date;
+	std::string m_deliverytime;
 
 	std::string m_restaurant_number;
 

+ 28 - 2
zhipuzi_pos_windows/network/CZhipuziHttpClient.cpp

@@ -3,10 +3,36 @@
 
 #include "../helper/MD5.h"
 
-CZhipuziHttpClient CZhipuziHttpClient::m_client;
-
 CZhipuziHttpClient::CZhipuziHttpClient()
 {
+#ifdef _DEBUG
+	m_env = DEV;
+#else
+	m_env = RELEASE;
+#endif	
+
+	if (m_env == DEV)
+	{
+		m_pingtai_url = "https://pf-api-dev.zhipuzi.com/seller";
+		m_canyin_yewu_url = "https://cyapi-dev.zhipuzi.com/seller";
+		m_lingshou_yewu_url = "https://lsapi-dev.zhipuzi.com/seller";
+	}
+	else if (m_env == TEST)
+	{
+		m_pingtai_url = "https://pf-api-test.zhipuzi.com/seller";
+		m_canyin_yewu_url = "https://cyapi-test.zhipuzi.com/seller";
+		m_lingshou_yewu_url = "https://lsapi-test.zhipuzi.com/seller";
+	}
+	else if (m_env == RELEASE)
+	{
+		m_pingtai_url = "https://pf-api.zhipuzi.com/seller";
+		m_canyin_yewu_url = "https://cyapi.zhipuzi.com/seller";
+		m_lingshou_yewu_url = "https://lsapi.zhipuzi.com/seller";
+	}
+
+	//初始化curl
+	curl_global_init(CURL_GLOBAL_ALL);
+
 	m_username = CSetting::getUsername();
 	m_password = CSetting::getPassword();
 }

+ 15 - 3
zhipuzi_pos_windows/network/CZhipuziHttpClient.h

@@ -8,6 +8,13 @@ public:
 	CZhipuziHttpClient();
 	~CZhipuziHttpClient();
 
+	enum Env
+	{
+		DEV,
+		TEST,
+		RELEASE
+	};
+
 public:
 	static void Init(std::string username, std::string password);
 
@@ -26,13 +33,18 @@ private:
 	std::string m_username;
 	std::string m_password;
 
-    std::string m_pingtai_url = "https://pf-api.zhipuzi.com/pos";
-	std::string m_yewu_ur = "";
+	std::string m_pingtai_url = "";
+
+	std::string m_yewu_url = "";
+	std::string m_canyin_yewu_url = "";
+	std::string m_lingshou_yewu_url = "";
 
 	std::string m_version_type;
 	std::string lwm_sess_token;
 
-	//这个是当前登陆的账号对应的店铺ID(如果是连锁店账号就是返回的第一个店铺),主要用于厨房打印的分类打印时候用于获取商品分类
+	Env m_env;
+
+	//这个是当前登陆的账号对应的店铺ID
 	std::string m_shop_id;
 };
 

+ 5 - 0
zhipuzi_pos_windows/order/CWaimaiOrder.cpp

@@ -309,6 +309,11 @@ bool CWaimaiOrder::FailOrder(std::string order_id, std::string reason)
     return true;
 }
 
+bool CWaimaiOrder::Refund(std::string order_id)
+{
+	return true;
+}
+
 bool CWaimaiOrder::AgreeRefund(std::string order_id)
 {
     std::string url = "/waimaiorder/agreerefund";

+ 6 - 0
zhipuzi_pos_windows/order/CWaimaiOrder.h

@@ -37,6 +37,7 @@ public:
     bool ConfirmeOrder(std::string order_id);
     bool SuccessOrder(std::string order_id);
     bool FailOrder(std::string order_id, std::string reason);
+	bool Refund(std::string order_id);
 
     bool AgreeRefund(std::string order_id);
     bool DisagreeRefund(std::string order_id);
@@ -118,6 +119,11 @@ public:
     std::string m_invoice_type;
     std::string m_tax_payer_id;
 
+	std::string m_is_book;
+	std::string m_showordernum;
+	std::string m_manzeng_name;
+
+
     std::vector<CWaimaiOrderItem> m_order_items;
     std::vector<CWaimaiOrderField> m_order_field;
     std::vector<CWaimaiOrderField> m_addservie;

+ 16 - 1
zhipuzi_pos_windows/pch/pch.cpp

@@ -2,4 +2,19 @@
 
 #include "pch.h"
 
-// 一般情况下,忽略此文件,但如果你使用的是预编译标头,请保留它。
+// 一般情况下,忽略此文件,但如果你使用的是预编译标头,请保留它。
+
+//所有的全局变量都在这里初始化
+
+//最先初始化sqllite数据
+
+std::map<std::string, std::string> CSetting::m_paramsMap;
+std::vector<ChufangPrinter> CSetting::m_chufang_printers;
+std::mutex CSetting::m_mutex;
+std::vector<FoodType> CSetting::m_foodtypes;
+std::map<std::string, std::string> CSetting::m_foodtype_id_name;
+std::map<string, string> CSetting::m_users;
+std::string CSetting::m_username;
+std::string CSetting::m_password;
+
+CZhipuziHttpClient CZhipuziHttpClient::m_client;

+ 1 - 32
zhipuzi_pos_windows/tool/CPosPrinter.cpp

@@ -508,16 +508,6 @@ void CPosPrinter::PrintWaimaiOrderShouyin(CWaimaiOrder& order)
         POS_FeedLine();
         POS_FeedLine();
 
-		//打印小票自定义名称
-		string printer_tip_name = CLewaimaiString::UTF8ToANSI(order.m_printer_tip_name);
-		if (printer_tip_name.length() > 0)
-		{
-			POS_TextOut(printer_tip_name, false, true, 1);
-
-			POS_FeedLine();
-			POS_FeedLine();
-		}
-
 		//打印预约、即时配送的提醒
 
 		/*
@@ -902,20 +892,6 @@ void CPosPrinter::PrintWaimaiOrderShouyin(CWaimaiOrder& order)
 		POS_FeedLine();;
 		POS_FeedLine();
 
-        //准备开始打印二维码
-        std::string order_no = order.m_order_no;
-        order_no = CLewaimaiString::UTF8ToANSI(order_no);
-
-		if (order.m_show_qiangdan_qrcode == "1")
-		{
-			POS_OutQRCode(order_no);
-
-			POS_FeedLine();
-			POS_FeedLine();
-
-			POS_TextOut("请使用配送员app扫码绑定订单", false, false, 1);
-		}
-
         //走纸几行再切
         POS_FeedLine();
         POS_FeedLine();
@@ -1027,16 +1003,9 @@ void CPosPrinter::PrintWaimaiOrderBiaoqian(CWaimaiOrder& order)
 			std::string textData = "";
 
             curFoodNum++;
-			
-			//打印小票自定义名称
-			string printer_tip_name = CLewaimaiString::UTF8ToANSI(order.m_printer_tip_name);
-			if (printer_tip_name.length() == 0)
-			{
-				printer_tip_name = "外卖";
-			}
 
             std::string restaurant_number = order.m_restaurant_number;
-            std::string order_num_info = printer_tip_name + " #" + CLewaimaiString::UTF8ToANSI(restaurant_number);
+            std::string order_num_info = "#" + CLewaimaiString::UTF8ToANSI(restaurant_number);
 
 			//纸张宽度40mm的,是 320个点位(每mm8个),刚好可以放13个汉字,每个汉字宽度差不多是24,商品换行显示的时候,
 			//每行最多12个汉字,也就是空24个,因此这里设置12,刚好左右各空一半

+ 1 - 8
zhipuzi_pos_windows/tool/CSetting.cpp

@@ -3,14 +3,7 @@
 
 #include "CSqlite3.h"
 
-std::map<std::string, std::string> CSetting::m_paramsMap;
-std::vector<ChufangPrinter> CSetting::m_chufang_printers;
-std::mutex CSetting::m_mutex;
-std::vector<FoodType> CSetting::m_foodtypes;
-std::map<std::string, std::string> CSetting::m_foodtype_id_name;
-std::map<string, string> CSetting::m_users;
-std::string CSetting::m_username;
-std::string CSetting::m_password;
+
 
 CSetting::CSetting()
 {

+ 6 - 6
zhipuzi_pos_windows/wnd/CLoginWnd.cpp

@@ -8,7 +8,7 @@ void CLoginWnd::Init()
 {
 	//刷新版本号
 	CLabelUI* version = static_cast<CLabelUI*>(m_pm.FindControl(_T("login_version")));
-	version->SetText((L"乐外卖接单软件 " + CLewaimaiString::UTF8ToUnicode(CSystem::GetVersion())).c_str());
+	version->SetText((L"智铺子接单软件 " + CLewaimaiString::UTF8ToUnicode(CSystem::GetVersion())).c_str());
 
 	//初始化下拉框的用户名
 	CComboUI* pCom = static_cast<CComboUI*>(m_pm.FindControl(_T("accountcombo")));
@@ -111,7 +111,7 @@ void CLoginWnd::Notify(TNotifyUI& msg)
 		}
 		else if (msg.pSender->GetName() == _T("guanwang"))
 		{
-			ShellExecute(NULL, _T("open"), _T("explorer.exe"), _T("https://www.lewaimai.com"), NULL, SW_SHOW);
+			ShellExecute(NULL, _T("open"), _T("explorer.exe"), _T("https://www.zhipuzi.com"), NULL, SW_SHOW);
 		}
     }
 	else if (msg.sType == _T("itemselect"))
@@ -380,7 +380,7 @@ void CLoginWnd::HandleLogin()
 	std::map<string, string> params;
 
 	std::string response;
-	bool ret = CLewaimaiHttpClient::Request("/version/getwindowsversion", params, response);
+	bool ret = CZhipuziHttpClient::Request("/version/getwindowsversion", params, response);
 	if (!ret)
 	{
 		pLoginResultLabel->SetText(std::wstring(_T("网络请求出错")).c_str());
@@ -486,10 +486,10 @@ void CLoginWnd::HandleLogin()
 		return;
 	}
 
-    CLewaimaiHttpClient::Init(s_account, s_password);
+    CZhipuziHttpClient::Init(s_account, s_password);
 
     std::string errmsg;
-    bool res = CLewaimaiHttpClient::Login(errmsg);
+    bool res = CZhipuziHttpClient::Login(errmsg);
 
     if(res)
     {
@@ -559,7 +559,7 @@ void CLoginWnd::LoginSuccess()
 	}
 
 	pFrame->SetIcon(IDI_ICON_DUILIB);
-	pFrame->Create(NULL, _T("乐外卖接单软件"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 1024, 768);
+	pFrame->Create(NULL, _T("智铺子接单软件"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 1024, 768);
 	pFrame->CenterWindow();
 
 	::ShowWindow(*pFrame, SW_SHOWMAXIMIZED);

+ 2 - 2
zhipuzi_pos_windows/wnd/CMainWnd.cpp

@@ -1941,7 +1941,7 @@ void CMainWnd::InitSettingStatus()
     //先清空一次分类(主要考虑退出登陆重新登录的情况)
     CSetting::ClearFoodtype();
 
-	std::string shop_id = CLewaimaiHttpClient::getShopId();
+	std::string shop_id = CZhipuziHttpClient::getShopId();
 	if (shop_id != "0")
 	{
 		std::map<string, string> params;
@@ -1951,7 +1951,7 @@ void CMainWnd::InitSettingStatus()
 
 		std::string url = "/goodstype/getlist";
 
-		CLewaimaiHttpClient::Request(url.c_str(), params, response);
+		CZhipuziHttpClient::Request(url.c_str(), params, response);
 
 		rapidjson::Document document;
 		document.Parse(response.c_str());

+ 4 - 4
zhipuzi_pos_windows/zhipuzi_pos_windows.vcxproj

@@ -130,17 +130,17 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
       <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
       <AdditionalIncludeDirectories>$(SolutionDir)include;$(ProjectDir)pch</AdditionalIncludeDirectories>
       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <DisableSpecificWarnings>4099</DisableSpecificWarnings>
+      <DisableSpecificWarnings>4099;4091</DisableSpecificWarnings>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <AdditionalLibraryDirectories>$(SolutionDir)lib\debug</AdditionalLibraryDirectories>
-      <AdditionalDependencies>dbghelp.lib;winmm.lib;setupapi.lib;AdvAPI32.lib;Shell32.lib;user32.lib;kernel32.lib;Gdi32.lib;libboost_date_time-vc141-mt-sgd-x32-1_70.lib;libboost_regex-vc141-mt-sgd-x32-1_70.lib;sqlite3.lib;libcurl.lib;DuiLib_ud.lib;log4cplusUD.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <IgnoreSpecificDefaultLibraries>
-      </IgnoreSpecificDefaultLibraries>
+      <AdditionalDependencies>dbghelp.lib;winmm.lib;setupapi.lib;AdvAPI32.lib;Shell32.lib;user32.lib;kernel32.lib;Gdi32.lib;libboost_date_time-vc141-mt-sgd-x32-1_70.lib;libboost_regex-vc141-mt-sgd-x32-1_70.lib;sqlite3.lib;DuiLib_ud.lib;log4cplusUD.lib;version.lib;libqrencode.lib;winspool.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;alibabacloud-oss-cpp-sdk.lib;libcurl.lib;libssl.lib;libcrypto.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <IgnoreSpecificDefaultLibraries>LIBCMT</IgnoreSpecificDefaultLibraries>
       <Version>
       </Version>
+      <AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
     </Link>
     <PostBuildEvent>
       <Command>mkdir $(SolutionDir)bin\$(Platform)\$(Configuration)\$(ProjectName)\