Commit a39f9aedeba7533aaa180742ca5a3d83317a2109

Authored by liuye
1 parent e6beff82

feat<central_clearing_system>:完成下单流程、打印和菜单配置,未联调

Showing 26 changed files with 826 additions and 209 deletions
central_clearing_system/Config/menu_res_auth_cfg.json
... ... @@ -3,10 +3,22 @@
3 3 {"res_id":10001, "auth_id":100001, "icon":"trade.ico", "index":[0, 0]},
4 4 {"res_id":10002, "auth_id":100002, "icon":"place_an_order.ico", "index":[0, 1]},
5 5 {"res_id":10003, "auth_id":100003, "icon":"statement_manage.ico", "index":[0, 2]},
6   - {"res_id":10004, "auth_id":100004, "icon":"order_manage.ico", "index":[0, 3]},
7 6 {"res_id":2, "auth_id":1010, "icon":"", "index":[1]},
8 7 {"res_id":20001, "auth_id":101001, "icon":"user_manage.ico", "index":[1, 0]},
9 8 {"res_id":20002, "auth_id":101002, "icon":"role_manage.ico", "index":[1, 1]},
  9 + {"res_id":20003, "auth_id":101002, "icon":"role_manage.ico", "index":[1, 1]},
  10 + {"res_id":30001, "auth_id":103001, "icon":"role_manage.ico", "index":[2]},
  11 + {"res_id":4, "auth_id":1020, "icon":"", "index":[3]},
  12 + {"res_id":40001, "auth_id":102001, "icon":"user_manage.ico", "index":[3, 0]},
  13 + {"res_id":40002, "auth_id":102002, "icon":"user_manage.ico", "index":[3, 1]},
  14 + {"res_id":40003, "auth_id":102003, "icon":"user_manage.ico", "index":[3, 2]},
  15 + {"res_id":40004, "auth_id":102004, "icon":"user_manage.ico", "index":[3, 3]},
  16 + {"res_id":40005, "auth_id":102005, "icon":"user_manage.ico", "index":[3, 4]},
  17 + {"res_id":5, "auth_id":1040, "icon":"", "index":[4]},
  18 + {"res_id":50001, "auth_id":104001, "icon":"user_manage.ico", "index":[4, 0]},
  19 + {"res_id":50002, "auth_id":104002, "icon":"user_manage.ico", "index":[4, 1]},
  20 + {"res_id":50003, "auth_id":104003, "icon":"user_manage.ico", "index":[4, 2]},
  21 + {"res_id":50004, "auth_id":104004, "icon":"user_manage.ico", "index":[4, 3]},
10 22 {"res_id":11001, "auth_id":0, "icon":"exit.ico", "index":[]},
11 23 {"res_id":11002, "auth_id":0, "icon":"modify_account_pwd.ico", "index":[]}
12 24 ]
13 25 \ No newline at end of file
... ...
central_clearing_system/Config/menu_res_auth_cfg.json-- deleted 100644 → 0
1   -[
2   - {"res_id":1, "auth_id":1000, "icon":"", "index":[0]},
3   - {"res_id":10001, "auth_id":100001, "icon":"about.ico", "index":[0, 0]},
4   - {"res_id":10002, "auth_id":100002, "icon":"about.ico", "index":[0, 1]},
5   - {"res_id":10003, "auth_id":100003, "icon":"about.ico", "index":[0, 2]},
6   - {"res_id":10004, "auth_id":100004, "icon":"about.ico", "index":[0, 3]},
7   - {"res_id":2, "auth_id":1010, "icon":"", "index":[1]},
8   - {"res_id":20001, "auth_id":101001, "icon":"about.ico", "index":[1, 0]},
9   - {"res_id":20002, "auth_id":101002, "icon":"about.ico", "index":[1, 1]},
10   - {"res_id":20003, "auth_id":101003, "icon":"about.ico", "index":[1, 2]}
11   -]
12 0 \ No newline at end of file
central_clearing_system/Config/menu_res_auth_cfg.json--- deleted 100644 → 0
1   -[
2   - {"res_id":1, "auth_id":1000, "icon":"", "index":[0]},
3   - {"res_id":10001, "auth_id":100001, "icon":"trade.ico", "index":[0, 0]},
4   - {"res_id":10002, "auth_id":100002, "icon":"place_an_order.ico", "index":[0, 1]},
5   - {"res_id":10003, "auth_id":100003, "icon":"statement_manage.ico", "index":[0, 2]},
6   - {"res_id":10004, "auth_id":100004, "icon":"order_manage.ico", "index":[0, 3]},
7   - {"res_id":2, "auth_id":1010, "icon":"", "index":[1]},
8   - {"res_id":20001, "auth_id":101001, "icon":"user_manage.ico", "index":[1, 0]},
9   - {"res_id":20002, "auth_id":101002, "icon":"role_manage.ico", "index":[1, 1]}
10   -]
11 0 \ No newline at end of file
central_clearing_system/Config/url_cfg.json
1 1 {
2 2 "protocol": "http",
3   - "host": "shop.esc.diligrp.com",
  3 + "host": "xtrade.esc.diligrp.com",
4 4 "port": 80,
5 5 "main_path": "/iset/oauth/clientInitMain.iset",
6 6 "login_path": "/iset/oauth/login.auth",
... ... @@ -8,5 +8,10 @@
8 8 "menu_auth_path":"/iset/oauth/loadUserPermission.iset",
9 9 "user_msg_count_path":"",
10 10 "user_msg_path":"",
11   - "modify_pwd_path":"/iset/oauth/initChangePwd.iset"
  11 + "modify_pwd_path":"/iset/oauth/initChangePwd.iset",
  12 + "get_card_name_path":"/iset/product/buyerQuery.iset",
  13 + "get_seller_card_path":"/iset/product/sellerQuery.iset",
  14 + "get_product_name_path":"/iset/product/productQuery.iset",
  15 + "submit_orders_path":"/iset/product/submitStatement.iset",
  16 + "finish_order_path":"/iset/product/finishStatement.iset"
12 17 }
13 18 \ No newline at end of file
... ...
central_clearing_system/Config/url_cfg.json--- deleted 100644 → 0
1   -{
2   - "protocol": "http",
3   - "host": "card.esc.diligrp.com",
4   - "port": 0,
5   - "main_path": "/user/clientInitMain.page",
6   - "login_path": "/counter/authorizeCounter.auth",
7   - "logout_path": "/user/doLogout.auth",
8   - "menu_auth_path":"/counter/loadPermission.do",
9   - "user_msg_count_path":"/message/countUserMessage.do",
10   - "user_msg_path":"/message/userMessageInit.page",
11   - "modify_pwd_path":"/employee/client/initModifyPassword.page"
12   -}
13 0 \ No newline at end of file
central_clearing_system/ETradeClient.rc
... ... @@ -77,17 +77,33 @@ IDR_MAINFRAME ICON &quot;res\\ETradeClient.ico&quot;
77 77  
78 78 IDR_MAINFRAME MENU
79 79 BEGIN
80   - POPUP "中央结算(&Z)"
  80 + POPUP "中央结算"
81 81 BEGIN
82   - MENUITEM "缴费(&J)", ID_PAY_FEE
83   - MENUITEM "下单(&X)", ID_ORDER
84   - MENUITEM "结算单管理(&S)", ID_STATEMENT_MANAGE
85   - MENUITEM "订单管理(&D)", ID_ORDERFORM_MANAGE
  82 + MENUITEM "下单", ID_ORDER
  83 + MENUITEM "结算单管理", ID_STATEMENT_MANAGE
  84 + MENUITEM "订单管理", ID_ORDERFORM_MANAGE
86 85 END
87   - POPUP "系统设置(&A)"
  86 + POPUP "登记分发"
88 87 BEGIN
89   - MENUITEM "用户管理(&B)", ID_USER_MANAGE
90   - MENUITEM "角色管理(&C)", ID_ROLE_MANAGE
  88 + MENUITEM "商品登记", ID_COMM_REGIST
  89 + MENUITEM "商品分发", ID_COMM_DISTRIB
  90 + MENUITEM "查询管理", ID_QUERY_MANAGE
  91 + END
  92 + MENUITEM "特殊处理", ID_SPECIAL_HANDLE
  93 + POPUP "基础资料"
  94 + BEGIN
  95 + MENUITEM "扣点规则", ID_POINT_RULE
  96 + MENUITEM "品类管理", ID_CATEGORY_RULE
  97 + MENUITEM "免密协议", ID_AGREEMENT
  98 + MENUITEM "代卖货管理", ID_TAPE_HANDLE
  99 + MENUITEM "赊销授信管理", ID_CREDIT
  100 + END
  101 + POPUP "系统设置"
  102 + BEGIN
  103 + MENUITEM "用户管理", ID_USER_MANAGE
  104 + MENUITEM "角色管理", ID_ROLE_MANAGE
  105 + MENUITEM "参数设置", ID_PARAM_SET
  106 + MENUITEM "操作日志", ID_LOG
91 107 END
92 108 END
93 109  
... ... @@ -130,10 +146,11 @@ END
130 146  
131 147 IDR_ACCELERATOR_ORDER ACCELERATORS
132 148 BEGIN
  149 + VK_DOWN, ID_ACCELERATOR_DOWN, VIRTKEY, NOINVERT
133 150 VK_RETURN, ID_ACCELERATOR_ENTER, VIRTKEY, NOINVERT
134 151 VK_TAB, ID_ACCELERATOR_TAB, VIRTKEY, NOINVERT
135 152 VK_UP, ID_ACCELERATOR_UP, VIRTKEY, NOINVERT
136   - VK_DOWN, ID_ACCELERATOR_DOWN, VIRTKEY, NOINVERT
  153 + VK_F11, ID_ACCELERATOR_F11, VIRTKEY, NOINVERT
137 154 END
138 155  
139 156  
... ... @@ -243,9 +260,10 @@ BEGIN
243 260 LTEXT "密 码:",IDC_PAY_STATIC_PASSWORD,18,50,31,8
244 261 EDITTEXT IDC_PAY_EDIT_PASSWORD,56,46,40,14,ES_MULTILINE | ES_AUTOHSCROLL
245 262 PUSHBUTTON "输入密码(&A)",IDC_PAY_BUTTON_PASSWORD,151,51,71,18
246   - PUSHBUTTON "关闭(&S)",IDC_PAY_BUTTON_CLOSE,155,95,67,17
247   - PUSHBUTTON "付款(&F)",IDC_PAY_BUTTON_PAY,72,95,67,17
  263 + PUSHBUTTON "关闭(&S)",IDC_PAY_BUTTON_CLOSE,155,94,67,17
  264 + PUSHBUTTON "付款(&F)",IDC_PAY_BUTTON_PAY,72,94,67,17
248 265 LTEXT "",IDC_PAY_STATIC_REAL_MONEY,65,20,57,8
  266 + LTEXT "",IDC_STATIC_ERROR_MSG,68,71,8,8
249 267 END
250 268  
251 269  
... ... @@ -330,7 +348,7 @@ BEGIN
330 348 LEFTMARGIN, 7
331 349 RIGHTMARGIN, 222
332 350 TOPMARGIN, 7
333   - BOTTOMMARGIN, 112
  351 + BOTTOMMARGIN, 111
334 352 END
335 353 END
336 354 #endif // APSTUDIO_INVOKED
... ...
central_clearing_system/ETradeClient/browser/async_js_callback_handler.cpp
... ... @@ -50,6 +50,7 @@ namespace HW
50 50 static const std::string JSON_VAL_FILEID_PIN_PAD = "11";
51 51 static const std::string JSON_VAL_FILEID_BANK_CARD_NUM = "20";
52 52 static const std::string JSON_VAL_FILEID_DILI_CARD_AND_BANK = "30";
  53 + static const std::string JSON_VAL_FILEID_ORDER = "40";
53 54  
54 55 struct HWRequest
55 56 {
... ... @@ -104,8 +105,7 @@ namespace HW
104 105 m_hw_cmd_map.insert(JSON_VAL_CMD_WRITE + JSON_VAL_FILEID_DILI_CARD_SERVICE_INFO, new WriteDILICardServiceInfoCmd());
105 106 m_hw_cmd_map.insert(JSON_VAL_CMD_READ + JSON_VAL_FILEID_BANK_CARD_NUM, new ReadBankCardNumCmd());
106 107 m_hw_cmd_map.insert(JSON_VAL_CMD_READ + JSON_VAL_FILEID_DILI_CARD_AND_BANK, new ReadDILIAndBankCardNumCmd());
107   -
108   - m_hw_cmd_map.insert(std::string(JSON_VAL_CMD_PRINT), new StylusPrinterCmd());
  108 + m_hw_cmd_map.insert(JSON_VAL_CMD_PRINT + JSON_VAL_FILEID_ORDER, new StylusPrinterCmd());
109 109 }
110 110 std::string HandleRequest(const std::string& request_json)
111 111 {
... ...
central_clearing_system/ETradeClient/hardware/hardware_cmd.cpp
... ... @@ -1546,7 +1546,7 @@ bool StylusPrinterCmd::ParseInput(std::string &amp;input, std::vector&lt;OrderInfo&gt; &amp;or
1546 1546 BOOST_FOREACH(PT::ptree::value_type &v, products_ptree)
1547 1547 {
1548 1548 CommInfo comm_info;
1549   - comm_info.comm_id = v.second.get<std::string>(JSON_TAG_ORDER_ID).c_str();
  1549 + comm_info.comm_id = v.second.get<long>(JSON_TAG_ORDER_ID);
1550 1550 comm_info.comm_name = v.second.get<std::string>(JSON_TAG_PRODUCT_NAME).c_str();
1551 1551 comm_info.price = v.second.get<std::string>(JSON_TAG_PRICE).c_str();
1552 1552 comm_info.count = v.second.get<std::string>(JSON_TAG_AMOUNT).c_str();
... ...
central_clearing_system/ETradeClient/hardware/hardware_cmd.h
... ... @@ -101,7 +101,7 @@ class StylusPrinterCmd : public HardwareCmd
101 101 {
102 102 struct CommInfo
103 103 {
104   - CString comm_id;
  104 + long comm_id;
105 105 CString comm_name;
106 106 CString price;
107 107 CString count;
... ...
central_clearing_system/ETradeClient/mfc_ui/ETradeClient.cpp
... ... @@ -192,15 +192,15 @@ BOOL CETradeClientApp::InitInstance()
192 192 SetRegistryKey(APP_ID);
193 193  
194 194 //for test
195   - PlaceOrderDlg dlg;
196   - if (dlg.DoModal())
  195 + //PlaceOrderDlg dlg;
  196 + /*if (dlg.DoModal())
197 197 {
198   - return FALSE;
199   - }
  198 + return FALSE;
  199 + }*/
200 200 //
201 201  
202 202 // First, do login job.
203   - if (!CLoginDialog(L"欢迎使用中央结算系统!").Launch())
  203 + if (!CLoginDialog(L"欢迎使用综合业务系统!").Launch())
204 204 {
205 205 LOG_TRACE(L"登录系统未完成,程序关闭。");
206 206 return FALSE;
... ...
central_clearing_system/ETradeClient/mfc_ui/GridCellBase.cpp
... ... @@ -77,7 +77,8 @@ void CGridCellBase::Reset()
77 77 m_MergeCellID.row=-1;
78 78 m_MergeCellID.col=-1;
79 79  
80   -
  80 + product_id.clear();
  81 + data_id = 0;
81 82 }
82 83 //Used for merge cells,remove const
83 84 //by Huang Wei
... ...
central_clearing_system/ETradeClient/mfc_ui/GridCellBase.h
... ... @@ -74,7 +74,7 @@ typedef struct _GV_ITEM {
74 74 // Each cell contains one of these. Fields "row" and "column" are not stored since we
75 75 // will usually have acces to them in other ways, and they are an extra 8 bytes per
76 76 // cell that is probably unnecessary.
77   -
  77 +#include <string>
78 78 class CGridCellBase : public CObject
79 79 {
80 80 friend class CGridCtrl;
... ... @@ -85,6 +85,7 @@ public:
85 85 CGridCellBase();
86 86 virtual ~CGridCellBase();
87 87  
  88 +
88 89 // Attributes
89 90 public:
90 91 virtual void SetText(LPCTSTR /* szText */) = 0 ;
... ... @@ -180,6 +181,12 @@ private:
180 181 bool m_IsMergeWithOthers;
181 182 CCellID m_MergeCellID;
182 183 bool m_Hide;
  184 +
  185 +public:
  186 + //为了业务,为了部落,为了该死的product_id
  187 + std::string product_id;
  188 + int data_id;
  189 + //
183 190 };
184 191  
185 192 //{{AFX_INSERT_LOCATION}}
... ...
central_clearing_system/ETradeClient/mfc_ui/GridCtrl.cpp
... ... @@ -118,6 +118,8 @@
118 118 #include <afxadv.h> // For CSharedFile
119 119 #include <afxconv.h> // For LPTSTR -> LPSTR macros
120 120  
  121 +#include "Resource.h"
  122 +
121 123 #ifdef _DEBUG
122 124 #define new DEBUG_NEW
123 125 #undef THIS_FILE
... ... @@ -379,6 +381,12 @@ BOOL CGridCtrl::Initialise()
379 381 return TRUE;
380 382 }
381 383  
  384 +#include "../utility/win_msg_define.h"
  385 +void CGridCtrl::DeleteComm()
  386 +{
  387 + ::SendMessage(GetParent()->GetSafeHwnd(), WM_ORDER_DELETE_ORDER, NULL, NULL);
  388 +}
  389 +
382 390 // creates the control - use like any other window create control
383 391 BOOL CGridCtrl::Create(const RECT& rect, CWnd* pParentWnd, UINT nID, DWORD dwStyle)
384 392 {
... ... @@ -553,6 +561,7 @@ BEGIN_MESSAGE_MAP(CGridCtrl, CWnd)
553 561 ON_MESSAGE(WM_GETFONT, OnGetFont)
554 562 ON_MESSAGE(WM_IME_CHAR, OnImeChar)
555 563 ON_NOTIFY(GVN_ENDLABELEDIT, IDC_INPLACE_CONTROL, OnEndInPlaceEdit)
  564 + ON_COMMAND(ID_POPMENU_DELETE, &CGridCtrl::DeleteComm)
556 565 END_MESSAGE_MAP()
557 566  
558 567  
... ... @@ -4616,7 +4625,7 @@ BOOL CGridCtrl::GetItem(GV_ITEM* pItem)
4616 4625 return TRUE;
4617 4626 }
4618 4627  
4619   -BOOL CGridCtrl::SetItemText(int nRow, int nCol, LPCTSTR str)
  4628 +BOOL CGridCtrl::SetItemText(int nRow, int nCol, LPCTSTR str, int data_id, std::string product_id)
4620 4629 {
4621 4630 if (GetVirtualMode())
4622 4631 return FALSE;
... ... @@ -4626,6 +4635,10 @@ BOOL CGridCtrl::SetItemText(int nRow, int nCol, LPCTSTR str)
4626 4635 return FALSE;
4627 4636  
4628 4637 pCell->SetText(str);
  4638 + //ΪÁ˸ÃËÀµÄϵ¥ÒµÎñ
  4639 + pCell->product_id = product_id;
  4640 + pCell->data_id = data_id;
  4641 + //
4629 4642  
4630 4643 SetModified(TRUE, nRow, nCol);
4631 4644 return TRUE;
... ... @@ -6550,6 +6563,17 @@ void CGridCtrl::OnRButtonUp(UINT nFlags, CPoint point)
6550 6563 pCell->OnRClick( GetPointClicked( FocusCell.row, FocusCell.col, point) );
6551 6564  
6552 6565 SendMessageToParent(FocusCell.row, FocusCell.col, NM_RCLICK);
  6566 +
  6567 + if (FocusCell.col > 1 && FocusCell.row > 0)
  6568 + {
  6569 + CPoint pt;
  6570 + ::GetCursorPos(&pt);
  6571 + CMenu menu;
  6572 + menu.LoadMenu(IDR_MENU1);
  6573 + CMenu* mu = menu.GetSubMenu(0);
  6574 + mu->TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this, NULL);
  6575 + }
  6576 +
6553 6577 }
6554 6578 }
6555 6579 #endif
... ...
central_clearing_system/ETradeClient/mfc_ui/GridCtrl.h
... ... @@ -33,6 +33,8 @@
33 33 #include "GridCell.h"
34 34 #include <afxtempl.h>
35 35  
  36 +#include <string>
  37 +
36 38  
37 39 ///////////////////////////////////////////////////////////////////////////////////
38 40 // Defines - these determine the features (and the final size) of the final code
... ... @@ -364,7 +366,7 @@ public:
364 366  
365 367 BOOL SetItem(const GV_ITEM* pItem);
366 368 BOOL GetItem(GV_ITEM* pItem);
367   - BOOL SetItemText(int nRow, int nCol, LPCTSTR str);
  369 + BOOL SetItemText(int nRow, int nCol, LPCTSTR str, int data_id = 0, std::string product_id = "");
368 370 // The following was virtual. If you want to override, use
369 371 // CGridCellBase-derived class's GetText() to accomplish same thing
370 372 CString GetItemText(int nRow, int nCol) const;
... ... @@ -798,6 +800,8 @@ protected:
798 800 MOUSE_PREPARE_DRAG, MOUSE_DRAGGING
799 801 #endif
800 802 };
  803 +
  804 + afx_msg void DeleteComm();
801 805 };
802 806  
803 807 // Returns the default cell implementation for the given grid region
... ...
central_clearing_system/ETradeClient/mfc_ui/MainFrm.cpp
... ... @@ -58,8 +58,9 @@ namespace
58 58  
59 59 static std::vector<TBBUTTON> kQuickAccessBtn =
60 60 {
61   - { 0, ID_PAY_FEE, TBSTATE_ENABLED, BTNS_BUTTON, 0, 0 },
62   - { 1, ID_ORDER, TBSTATE_ENABLED, BTNS_BUTTON, 0, 0 }
  61 + { 0, ID_ORDER, TBSTATE_ENABLED, BTNS_BUTTON, 0, 0 },
  62 + { 1, ID_COMM_REGIST, TBSTATE_ENABLED, BTNS_BUTTON, 0, 0 },
  63 + { 2, ID_COMM_DISTRIB, TBSTATE_ENABLED, BTNS_BUTTON, 0, 0 }
63 64 };
64 65 } // namespace
65 66  
... ... @@ -80,7 +81,7 @@ BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
80 81 ON_COMMAND(ID_MODIFY_PASSWORD, OnModifyPwd)
81 82 ON_UPDATE_COMMAND_UI(USER_MESSAGE, &CMainFrame::OnUpdateToolBarMsgCount)
82 83  
83   - ON_COMMAND_RANGE(ID_PAY_FEE, ID_RIGHT_MANAGE, OnMenuBtnClicked)
  84 + ON_COMMAND_RANGE(ID_ORDER, ID_LOG, OnMenuBtnClicked)
84 85 ON_COMMAND_RANGE(RELOAD, USER_ACCOUNT, OnToolBarBtnClicked)
85 86  
86 87 ON_MESSAGE(WM_CEF_SESSION_EXPIRED, OnSessionExpired)
... ... @@ -315,8 +316,10 @@ void CMainFrame::OnMenuBtnClicked(UINT btn_id)
315 316 PlaceOrderDlg dlg;
316 317 dlg.DoModal();
317 318 }
318   -
319   - m_view.Browser().NavigateTo(MenuUrl(btn_id));
  319 + else
  320 + {
  321 + m_view.Browser().NavigateTo(MenuUrl(btn_id));
  322 + }
320 323 }
321 324  
322 325 void CMainFrame::OnToolbarDropDown(NMHDR* pNMHDR, LRESULT* pResult)
... ...
central_clearing_system/ETradeClient/mfc_ui/etrade_edit_control.cpp
... ... @@ -132,11 +132,11 @@ bool CEditBox::CheckCardNum(CString num)
132 132  
133 133 do
134 134 {
135   - if (num.GetLength() > 12)
  135 + /*if (num.GetLength() > 12)
136 136 {
137   - result = false;
138   - break;
139   - }
  137 + result = false;
  138 + break;
  139 + }*/
140 140  
141 141 if (num.SpanIncluding(L"0123456789") != num)
142 142 {
... ...
central_clearing_system/ETradeClient/mfc_ui/pay_dlg.cpp
... ... @@ -7,15 +7,30 @@
7 7 #include "afxdialogex.h"
8 8 #include "etradeclient/hardware/hardware_cmd.h"
9 9 #include "etradeclient/boost_patch/property_tree/json_parser.hpp"
  10 +#include "ETradeClient/utility/win_msg_define.h"
  11 +#include "ETradeClient/utility/logging.h"
  12 +#include "etradeclient/utility/url_config.h"
  13 +#include "etradeclient/utility/application_config.h"
  14 +#include "etradeclient/browser/session.h"
  15 +#include "ETradeClient/utility/string_converter.h"
  16 +#include "ETradeClient/utility/win_msg_define.h"
  17 +#include <vector>
  18 +#include "pay_dlg.h"
  19 +#include "etradeclient/hardware/hardware_cmd.h"
  20 +#include "ETradeClient/utility/logging.h"
  21 +#include <sstream>
  22 +
10 23  
11 24 // PayDlg 对话框
12 25  
13 26 IMPLEMENT_DYNAMIC(PayDlg, CDialogEx)
14 27  
15   -PayDlg::PayDlg(CWnd* pParent /*=NULL*/)
  28 +PayDlg::PayDlg(long statement_id, CString total_money, int card_type, CWnd* pParent /*=NULL*/)
16 29 : CDialogEx(PayDlg::IDD, pParent)
17 30 {
18   -
  31 + statement_id_ = statement_id;
  32 + total_money_ = total_money;
  33 + card_type_ = card_type;
19 34 }
20 35  
21 36 PayDlg::~PayDlg()
... ... @@ -32,12 +47,14 @@ void PayDlg::DoDataExchange(CDataExchange* pDX)
32 47 DDX_Control(pDX, IDC_PAY_BUTTON_PAY, pay_button_);
33 48 DDX_Control(pDX, IDC_PAY_BUTTON_CLOSE, close_button_);
34 49 DDX_Control(pDX, IDC_PAY_BUTTON_PASSWORD, password_button_);
  50 + DDX_Control(pDX, IDC_STATIC_ERROR_MSG, error_msg_static_);
35 51 }
36 52  
37 53  
38 54 BEGIN_MESSAGE_MAP(PayDlg, CDialogEx)
39 55 ON_BN_CLICKED(IDC_PAY_BUTTON_CLOSE, &PayDlg::OnBnClickedPayButtonClose)
40 56 ON_BN_CLICKED(IDC_PAY_BUTTON_PAY, &PayDlg::OnBnClickedPayButtonPay)
  57 + ON_WM_CTLCOLOR()
41 58 END_MESSAGE_MAP()
42 59  
43 60  
... ... @@ -50,6 +67,20 @@ BOOL PayDlg::OnInitDialog()
50 67  
51 68 SetCtrlPos();
52 69  
  70 + real_money_static_.SetWindowText(total_money_);
  71 + if (card_type_ == 30)
  72 + {
  73 + password_static_.ShowWindow(SW_HIDE);
  74 + password_edit_.ShowWindow(SW_HIDE);
  75 + password_button_.ShowWindow(SW_HIDE);
  76 + }
  77 + else
  78 + {
  79 + password_static_.ShowWindow(SW_SHOW);
  80 + password_edit_.ShowWindow(SW_SHOW);
  81 + password_button_.ShowWindow(SW_SHOW);
  82 + }
  83 +
53 84 return TRUE; // return TRUE unless you set the focus to a control
54 85 // 异常: OCX 属性页应返回 FALSE
55 86 }
... ... @@ -88,7 +119,13 @@ void PayDlg::SetCtrlPos()
88 119  
89 120 CRect dlg_rect;
90 121 GetClientRect(&dlg_rect);
91   - ctrl_rect.bottom = dlg_rect.bottom;
  122 +
  123 + ctrl_rect.left = 30;
  124 + ctrl_rect.right = dlg_rect.right - 30;
  125 + error_msg_static_.MoveWindow(&ctrl_rect);
  126 +
  127 +
  128 + ctrl_rect.bottom = dlg_rect.bottom - 20;
92 129 ctrl_rect.top = ctrl_rect.bottom - ButtonHeight;
93 130 ctrl_rect.right = dlg_rect.right - 100;
94 131 ctrl_rect.left = ctrl_rect.right - ButtonWidth;
... ... @@ -114,7 +151,102 @@ void PayDlg::OnBnClickedPayButtonClose()
114 151  
115 152 void PayDlg::OnBnClickedPayButtonPay()
116 153 {
  154 + std::string statement_data;
  155 + do
  156 + {
  157 + CString error_msg;
  158 + const uint32_t kHTTPOK = 200;
  159 + WinHttp win_http;
  160 + auto& url_cfg = URLConfig::Instance();
  161 + win_http.ConnectHost(url_cfg.Host(), url_cfg.Port(), url_cfg.IsHttps());
  162 + std::string url = url_cfg.GetSubmitOrdersPath();
  163 + auto& request = win_http.OpenRequest(WinHttp::Method::POST, url);
  164 +
  165 + CString pass_word;
  166 + password_edit_.GetWindowText(pass_word);
  167 +
  168 + std::ostringstream os;
  169 + os << statement_id_;
  170 + std::string statement_id_str;
  171 + std::istringstream is(os.str());
  172 + is >> statement_id_str;
  173 +
  174 + std::string post_data = "{\"statementId\":" + statement_id_str + "\"password\":\"" + wstr_2_str(pass_word) + "\"}";
  175 +
  176 + request.SetPostData(post_data);
  177 + if (url_cfg.IsHttps())
  178 + {
  179 + auto& app_cfg = ApplicationConfig::Instance();
  180 + request.SetClientCertificate(app_cfg.ClientCertStore(), app_cfg.ClientCertSubject());
  181 + }
  182 + request.SetCookies(Session::Instance().Cookies());
  183 + request.Send();
  184 + uint32_t status_code = request.GetResponseStatus();
  185 + if (kHTTPOK != status_code)
  186 + {
  187 + std::string err_msg = "网络请求错误! 错误码: " + std::to_string(status_code);
  188 + LOG_ERROR(str_2_wstr(err_msg.c_str()));
  189 + error_msg = err_msg.c_str();
  190 + break;
  191 + }
  192 + std::string response_body = request.ReadResponseBody();
  193 + if (response_body.empty())
  194 + {
  195 + LOG_ERROR(L"获取服务器响应数据失败,请确保网络连接正常!");
  196 + error_msg = CString(L"获取服务器响应数据失败,请确保网络连接正常!");
  197 + break;
  198 + }
  199 +
  200 + namespace PT = boost::property_tree;
  201 + bool card_res = false;
  202 + try //Parse the configuration file
  203 + {
  204 + PT::ptree ptree;
  205 + std::stringstream ss;
  206 + ss << response_body;
  207 + PT::read_json(ss, ptree);
  208 + if (ptree.get<int>("code") == 0)
  209 + {
  210 + statement_data = ptree.get<std::string>("data");
  211 + }
  212 + else
  213 + {
  214 + error_msg = ptree.get<std::string>("message").c_str();
  215 + break;
  216 + }
  217 +
  218 + }
  219 + catch (...)
  220 + {
  221 + LOG_ERROR(L"解析服务器返回的登录结果信息时出错!请确认返回数据不为空,返回的数据格式为正确的Json格式!");
  222 + error_msg = CString(L"解析服务器返回的登录结果信息时出错!请确认返回数据不为空,返回的数据格式为正确的Json格式!");
  223 + break;
  224 + }
  225 + } while (0);
  226 +
117 227 auto printer_device = StylusPrinterCmd();
118   -
119   - HardwareCmd::Reply reply = printer_device.Execute("{\"title\":\"长春结地利算单\",\"orders\":[{\"statementId\":\"123456\",\"tradeTime\":\"2018/10/10\",\"buyerName\":\"大熊\",\"sellerName\":\"卖家大熊\",\"userName\":\"结算员大熊\",\"totalMoney\":\"11001.91\",\"products\":[{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"55.5\",\"amount\":\"500\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"}]},{\"statementId\":\"123456\",\"tradeTime\":\"2018/10/10\",\"buyerName\":\"大熊\",\"sellerName\":\"卖家大熊\",\"userName\":\"结算员大熊\",\"totalMoney\":\"11001.91\",\"products\":[{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"55.5\",\"amount\":\"500\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"},{\"orderId\":1000,\"productName\":\"商品名称大熊\",\"price\":\"2753\",\"amount\":\"752\",\"money\":\"1021.01\"}]}]}");
  228 + HardwareCmd::Reply reply = printer_device.Execute(statement_data);
  229 +
  230 + CDialogEx::OnCancel();
  231 +}
  232 +
  233 +void PayDlg::SetErrorMsg(CString error)
  234 +{
  235 + error_msg_static_.SetWindowTextW(error);
  236 +}
  237 +
  238 +
  239 +HBRUSH PayDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
  240 +{
  241 + HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
  242 +
  243 + if (nCtlColor == CTLCOLOR_STATIC)
  244 + {
  245 + if (IDC_STATIC_ERROR_MSG == pWnd->GetDlgCtrlID())
  246 + {
  247 + pDC->SetTextColor(RGB(200, 0, 0));
  248 + }
  249 + }
  250 +
  251 + return hbr;
120 252 }
... ...
central_clearing_system/ETradeClient/mfc_ui/pay_dlg.h
... ... @@ -9,7 +9,7 @@ class PayDlg : public CDialogEx
9 9 DECLARE_DYNAMIC(PayDlg)
10 10  
11 11 public:
12   - PayDlg(CWnd* pParent = NULL); // 标准构造函数
  12 + PayDlg(long statement_id, CString total_money, int card_type, CWnd* pParent = NULL); // 标准构造函数
13 13 virtual ~PayDlg();
14 14  
15 15 // 对话框数据
... ... @@ -21,15 +21,25 @@ protected:
21 21 DECLARE_MESSAGE_MAP()
22 22 public:
23 23 virtual BOOL OnInitDialog();
  24 + afx_msg void OnBnClickedPayButtonClose();
  25 + afx_msg void OnBnClickedPayButtonPay();
  26 + afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  27 +
  28 +private:
  29 + void SetCtrlPos();
  30 + void SetErrorMsg(CString error);
  31 +
  32 +private:
24 33 CStatic total_money_static_;
25 34 CStatic real_money_static_;
26 35 CStatic password_static_;
27 36 CEdit password_edit_;
28 37 CButton pay_button_;
29 38 CButton close_button_;
30   -
31   - void SetCtrlPos();
32   - afx_msg void OnBnClickedPayButtonClose();
33 39 CButton password_button_;
34   - afx_msg void OnBnClickedPayButtonPay();
  40 + CStatic error_msg_static_;
  41 +
  42 + long statement_id_;
  43 + CString total_money_;
  44 + int card_type_;
35 45 };
... ...
central_clearing_system/ETradeClient/mfc_ui/place_order_dlg.cpp
... ... @@ -23,10 +23,11 @@
23 23 IMPLEMENT_DYNAMIC(PlaceOrderDlg, CDialogEx)
24 24  
25 25 PlaceOrderDlg::PlaceOrderDlg(CWnd* pParent /*=NULL*/)
26   - : CDialogEx(PlaceOrderDlg::IDD, pParent)
  26 +: CDialogEx(PlaceOrderDlg::IDD, pParent)
27 27 {
28 28 line_pen_.CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
29 29 edit_brush_.CreateSolidBrush(RGB(245, 247, 250));
  30 + comm_id_index_ = 1;
30 31 }
31 32  
32 33 PlaceOrderDlg::~PlaceOrderDlg()
... ... @@ -74,8 +75,10 @@ BEGIN_MESSAGE_MAP(PlaceOrderDlg, CDialogEx)
74 75 ON_MESSAGE(WM_ORDER_KILL_FOCUS, &PlaceOrderDlg::OnEditKillFocus)
75 76 ON_COMMAND(ID_ACCELERATOR_DOWN, &PlaceOrderDlg::OnAcceleratorDown)
76 77 ON_COMMAND(ID_ACCELERATOR_UP, &PlaceOrderDlg::OnAcceleratorUp)
  78 + ON_COMMAND(ID_ACCELERATOR_F11, &PlaceOrderDlg::OnBnClickedButtonSwipCard)
77 79 ON_WM_SETFOCUS()
78 80 ON_BN_CLICKED(IDC_BUTTON_SWIP_CARD, &PlaceOrderDlg::OnBnClickedButtonSwipCard)
  81 + ON_MESSAGE(WM_ORDER_DELETE_ORDER, &PlaceOrderDlg::DeleteComm)
79 82 END_MESSAGE_MAP()
80 83  
81 84  
... ... @@ -239,7 +242,7 @@ void PlaceOrderDlg::SetCtrlPos()
239 242  
240 243 CRect dlg_rect;
241 244 GetClientRect(&dlg_rect);
242   - ctrl_rect.top += 10;
  245 + //ctrl_rect.top += 10;
243 246 ctrl_rect.left = ctrl_rect.right + 30;
244 247 ctrl_rect.right = dlg_rect.right;
245 248 error_static_.MoveWindow(&ctrl_rect);
... ... @@ -259,9 +262,10 @@ void PlaceOrderDlg::SetCtrlPos()
259 262 total_money_static_.MoveWindow(&ctrl_rect);
260 263  
261 264 ctrl_rect.left = ctrl_rect.right;
262   - ctrl_rect.right = dlg_rect.right;
  265 + ctrl_rect.right = dlg_rect.right - 10 - ButtonWidth - 5;
263 266 total_real_money_static_.MoveWindow(&ctrl_rect);
264 267  
  268 + ctrl_rect.top -= 5;
265 269 ctrl_rect.right = dlg_rect.right - 10;
266 270 ctrl_rect.left = ctrl_rect.right - ButtonWidth;
267 271 pay_button_.MoveWindow(&ctrl_rect);
... ... @@ -352,12 +356,154 @@ HBRUSH PlaceOrderDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
352 356  
353 357 void PlaceOrderDlg::OnBnClickedButtonPay()
354 358 {
355   - PayDlg pay_dlg;
356   - pay_dlg.DoModal();
  359 + int row_count = product_list_.GetRowCount();
  360 + if (row_count == 0)
  361 + {
  362 + SetErrorMsg(CString(L"订单信息为空!"));
  363 + return;
  364 + }
  365 +
  366 + struct Comm
  367 + {
  368 + std::string product_id;
  369 + std::string price;
  370 + std::string amount;
  371 + std::string unit;
  372 + std::string weight;
  373 + };
  374 + struct Order
  375 + {
  376 + std::string seller_card;
  377 + std::vector<Comm> comm_vec;
  378 + };
  379 + std::vector<Order> orders_list;
  380 + Order current_order;
  381 + for (int row = 0; row < row_count; ++row)
  382 + {
  383 + std::string card = wstr_2_str(product_list_.GetItemText(row, 0));
  384 + if (card.compare(current_order.seller_card) != 0)
  385 + {
  386 + orders_list.push_back(current_order);
  387 + current_order.comm_vec.clear();
  388 + current_order.seller_card = card;
  389 + }
  390 +
  391 + Comm comm_info;
  392 + CGridCellBase* product_cell = product_list_.GetCell(row, 2);
  393 + comm_info.product_id == product_cell->product_id;
  394 + comm_info.price = wstr_2_str(product_list_.GetItemText(row, 3));
  395 + comm_info.amount = wstr_2_str(product_list_.GetItemText(row, 4));
  396 + comm_info.unit = product_list_.GetItemText(row, 5).Compare(L"斤") == 0 ? "1" : "2";
  397 + comm_info.weight = wstr_2_str(product_list_.GetItemText(row, 6));
  398 +
  399 + current_order.comm_vec.push_back(comm_info);
  400 + }
  401 +
  402 + CString buyer_card;
  403 + buyer_card_edit_.GetWindowText(buyer_card);
  404 +
  405 + CString error_msg;
  406 + long statement_id = 0;
  407 + std::string total_money;
  408 + do
  409 + {
  410 + const uint32_t kHTTPOK = 200;
  411 + WinHttp win_http;
  412 + auto& url_cfg = URLConfig::Instance();
  413 + win_http.ConnectHost(url_cfg.Host(), url_cfg.Port(), url_cfg.IsHttps());
  414 + std::string url = url_cfg.GetSubmitOrdersPath();
  415 + auto& request = win_http.OpenRequest(WinHttp::Method::POST, url);
  416 +
  417 + std::string post_data = "{\"paymentType\":1,\"cardNo\":\"" + wstr_2_str(buyer_card) + "\",\"orders\":[";
  418 + for (auto iter_order : orders_list)
  419 + {
  420 + post_data += "{\"cardNo\":\"" + iter_order.seller_card + "\",\"products\":[";
  421 + for (auto iter_product : iter_order.comm_vec)
  422 + {
  423 + post_data += "{\"productId\":" + iter_product.product_id + ",\"price\":\"" + iter_product.price + "\",\"amount\":\"" + iter_product.amount + \
  424 + "\",\"unit\":" + iter_product.unit + ",\"weight\":\"" + iter_product.weight + "\"},";
  425 + }
  426 + post_data.erase(post_data.end() - 1);
  427 + post_data += "]},";
  428 + }
  429 + post_data.erase(post_data.end() - 1);
  430 + post_data += "]}";
  431 +
  432 +
  433 + request.SetPostData(post_data);
  434 + if (url_cfg.IsHttps())
  435 + {
  436 + auto& app_cfg = ApplicationConfig::Instance();
  437 + request.SetClientCertificate(app_cfg.ClientCertStore(), app_cfg.ClientCertSubject());
  438 + }
  439 + request.SetCookies(Session::Instance().Cookies());
  440 + request.Send();
  441 + uint32_t status_code = request.GetResponseStatus();
  442 + if (kHTTPOK != status_code)
  443 + {
  444 + std::string err_msg = "网络请求错误! 错误码: " + std::to_string(status_code);
  445 + LOG_ERROR(str_2_wstr(err_msg.c_str()));
  446 + error_msg = err_msg.c_str();
  447 + break;
  448 + }
  449 + std::string response_body = request.ReadResponseBody();
  450 + if (response_body.empty())
  451 + {
  452 + LOG_ERROR(L"获取服务器响应数据失败,请确保网络连接正常!");
  453 + error_msg = CString(L"获取服务器响应数据失败,请确保网络连接正常!");
  454 + break;
  455 + }
  456 +
  457 + namespace PT = boost::property_tree;
  458 + bool card_res = false;
  459 + try //Parse the configuration file
  460 + {
  461 + PT::ptree ptree;
  462 + std::stringstream ss;
  463 + ss << response_body;
  464 + PT::read_json(ss, ptree);
  465 + if (ptree.get<int>("code") == 0)
  466 + {
  467 + PT::ptree statement_data = ptree.get_child("data");
  468 + statement_id = statement_data.get<long>("statementId");
  469 + total_money = statement_data.get<std::string>("totalMoney");
  470 + }
  471 + else
  472 + {
  473 + error_msg = ptree.get<std::string>("message").c_str();
  474 + break;
  475 + }
  476 +
  477 + }
  478 + catch (...)
  479 + {
  480 + LOG_ERROR(L"解析服务器返回的登录结果信息时出错!请确认返回数据不为空,返回的数据格式为正确的Json格式!");
  481 + error_msg = CString(L"解析服务器返回的登录结果信息时出错!请确认返回数据不为空,返回的数据格式为正确的Json格式!");
  482 + break;
  483 + }
  484 + } while (0);
  485 +
  486 + if (!error_msg.IsEmpty())
  487 + {
  488 + SetErrorMsg(error_msg);
  489 + }
  490 + else
  491 + {
  492 + EmptyCtrl();
  493 + SetCtrlInitData();
  494 + InitList();
  495 + comm_id_index_;
  496 + comm_vec_.clear();
  497 +
  498 + PayDlg pay_dlg(statement_id, CString(total_money.c_str()), buyer_card_type_);
  499 + pay_dlg.DoModal();
  500 + }
357 501 }
358 502  
359 503 void PlaceOrderDlg::InitList()
360 504 {
  505 + product_list_.DeleteAllItems();
  506 +
361 507 product_list_.InsertColumn(L"货主卡号");
362 508 product_list_.InsertColumn(L"货主姓名");
363 509 product_list_.InsertColumn(L"商品名称");
... ... @@ -388,6 +534,7 @@ void PlaceOrderDlg::InitList()
388 534 product_list_.SetListMode(TRUE);
389 535 product_list_.SetSingleColSelection(TRUE);
390 536 product_list_.SetSingleRowSelection(FALSE);
  537 + product_list_.SetFixedRowSelection(true);
391 538  
392 539 product_list_.SetRowResize(FALSE);
393 540 product_list_.SetColumnResize(FALSE);
... ... @@ -411,6 +558,13 @@ void PlaceOrderDlg::OnAcceleratorTab()
411 558 {
412 559  
413 560 }
  561 +
  562 +int PlaceOrderDlg::GetCommIndex()
  563 +{
  564 + ++comm_id_index_;
  565 + return comm_id_index_;
  566 +}
  567 +
414 568 void PlaceOrderDlg::OnAcceleratorEnter()
415 569 {
416 570 OnEditKillFocus(IDC_EDIT_CARD, NULL);
... ... @@ -420,6 +574,8 @@ void PlaceOrderDlg::OnAcceleratorEnter()
420 574 OnEditKillFocus(IDC_EDIT_PRICE, NULL);
421 575 OnEditKillFocus(IDC_EDIT_COUNT, NULL);
422 576  
  577 + card_edit_.SetFocus();
  578 +
423 579 do
424 580 {
425 581 if (card_edit_.IsEditRed() || comm_num_edit_.IsEditRed() ||
... ... @@ -434,30 +590,49 @@ void PlaceOrderDlg::OnAcceleratorEnter()
434 590 CString text;
435 591 double price = 0, count = 0;
436 592 card_edit_.GetWindowText(text);
437   - product_list_.SetItemText(row_index, 0, text);
  593 + CommInfo comm;
  594 + comm.comm_id = GetCommIndex();
  595 + comm.seller_card = text;
  596 + product_list_.SetItemText(row_index, 0, text, comm.comm_id);
438 597 text.Empty();
  598 +
439 599 name_edit_.GetWindowText(text);
440   - product_list_.SetItemText(row_index, 1, text);
  600 + comm.seller_name = text;
  601 + product_list_.SetItemText(row_index, 1, text, comm.comm_id);
441 602 text.Empty();
  603 +
442 604 comm_name_edit_.GetWindowText(text);
443   - product_list_.SetItemText(row_index, 2, text);
  605 + comm.comm_name = text;
  606 + product_list_.SetItemText(row_index, 2, text, comm.comm_id, wstr_2_str(product_id_));
444 607 text.Empty();
  608 +
445 609 price_edit_.GetWindowText(text);
446 610 price = _ttof(text);
447   - product_list_.SetItemText(row_index, 3, text);
  611 + comm.price = text;
  612 + product_list_.SetItemText(row_index, 3, text, comm.comm_id);
448 613 text.Empty();
  614 +
449 615 count_edit_.GetWindowText(text);
450 616 count = _ttof(text);
451   - product_list_.SetItemText(row_index, 4, text);
  617 + comm.count = text;
  618 + product_list_.SetItemText(row_index, 4, text, comm.comm_id);
452 619 text.Empty();
  620 +
453 621 real_unit_static.GetWindowText(text);
454   - product_list_.SetItemText(row_index, 5, text);
  622 + comm.unit = text;
  623 + product_list_.SetItemText(row_index, 5, text, comm.comm_id);
455 624 text.Empty();
  625 +
456 626 heavy_edit_.GetWindowText(text);
457   - product_list_.SetItemText(row_index, 6, text);
  627 + comm.weight = text;
  628 + product_list_.SetItemText(row_index, 6, text, comm.comm_id);
458 629 text.Empty();
  630 +
459 631 text.Format(_T("%.1f"), price * count);
460   - product_list_.SetItemText(row_index, 7, text);
  632 + comm.total_money = text;
  633 + product_list_.SetItemText(row_index, 7, text, comm.comm_id);
  634 +
  635 + comm_vec_.push_back(comm);
461 636  
462 637 for (int index = 0; index < 8; ++index)
463 638 {
... ... @@ -470,7 +645,7 @@ void PlaceOrderDlg::OnAcceleratorEnter()
470 645 CString subtotal;
471 646 double total_price = 0;
472 647 int list_count = product_list_.GetRowCount();
473   - for (int index = 1; index <= count; ++index)
  648 + for (int index = 1; index <= list_count; ++index)
474 649 {
475 650 subtotal = product_list_.GetItemText(index, 7);
476 651 total_price += _ttof(subtotal);
... ... @@ -482,6 +657,15 @@ void PlaceOrderDlg::OnAcceleratorEnter()
482 657  
483 658 } while (0);
484 659  
  660 + if (product_list_.GetRowCount() > 1)
  661 + {
  662 + pay_button_.EnableWindow(TRUE);
  663 + }
  664 + else
  665 + {
  666 + pay_button_.EnableWindow(FALSE);
  667 + }
  668 +
485 669 UpdateWindow();
486 670 }
487 671  
... ... @@ -491,7 +675,7 @@ void PlaceOrderDlg::SetCtrlInitData()
491 675 EnableCtrl(false);
492 676  
493 677 card_edit_.SetWindowTextW(L"8888");
494   -
  678 +
495 679 card_edit_.SetCheck(CardNumType);
496 680 comm_num_edit_.SetCheck(CommNumType);
497 681 unit_edit_.SetCheck(UnitType);
... ... @@ -502,6 +686,7 @@ void PlaceOrderDlg::SetCtrlInitData()
502 686 card_edit_.SetFocus();
503 687 card_edit_.SetSel(4, 4);
504 688 heavy_edit_.EnableWindow(FALSE);
  689 + pay_button_.EnableWindow(FALSE);
505 690 }
506 691  
507 692 void PlaceOrderDlg::SetErrorMsg(CString &error)
... ... @@ -521,13 +706,13 @@ LRESULT PlaceOrderDlg::OnEditKillFocus(WPARAM wParam, LPARAM lParam)
521 706 case IDC_EDIT_CARD:
522 707 {
523 708 CString name;
524   - if (text.GetLength() < 12)
  709 + /*if (text.GetLength() < 12)
525 710 {
526   - card_edit_.SetEditRed(true);
527   - break;
528   - }
  711 + card_edit_.SetEditRed(true);
  712 + break;
  713 + }*/
529 714  
530   - bool result = GetCardName(text, name);
  715 + bool result = GetCardName(text, name, 2);
531 716 if (result)
532 717 {
533 718 name_edit_.SetWindowText(name);
... ... @@ -549,8 +734,9 @@ LRESULT PlaceOrderDlg::OnEditKillFocus(WPARAM wParam, LPARAM lParam)
549 734 comm_num_edit_.SetEditRed(true);
550 735 break;
551 736 }
552   -
553   - bool result = GetCardName(text, name);
  737 + CString buyer_card;
  738 + buyer_card_edit_.GetWindowText(buyer_card);
  739 + bool result = GetCommName(text, buyer_card, name, product_id_);
554 740 if (result)
555 741 {
556 742 name_edit_.SetWindowText(name);
... ... @@ -619,49 +805,156 @@ LRESULT PlaceOrderDlg::OnEditKillFocus(WPARAM wParam, LPARAM lParam)
619 805 }
620 806  
621 807  
622   -bool PlaceOrderDlg::GetCardName(CString &num, CString &name)
  808 +bool PlaceOrderDlg::GetCardName(CString &num, CString &name, int type)
623 809 {
624   - //for test
625   - return true;
626   - //
627   -
628   -
629 810 bool result = true;
630 811  
631   - CString sLog;
  812 + LOG_TRACE(_T("获取卡片姓名!"));
  813 + do
  814 + {
  815 + const uint32_t kHTTPOK = 200;
  816 + WinHttp win_http;
  817 + auto& url_cfg = URLConfig::Instance();
  818 + win_http.ConnectHost(url_cfg.Host(), url_cfg.Port(), url_cfg.IsHttps());
  819 + std::string path = type == 1 ? url_cfg.GetCardNamePath() : url_cfg.GetSellerCardPath();
  820 + std::string url = path + "?cardNo=" + wstr_2_str(num);
  821 + auto& request = win_http.OpenRequest(WinHttp::Method::POST, url);
  822 + if (url_cfg.IsHttps())
  823 + {
  824 + auto& app_cfg = ApplicationConfig::Instance();
  825 + request.SetClientCertificate(app_cfg.ClientCertStore(), app_cfg.ClientCertSubject());
  826 + }
  827 + request.SetCookies(Session::Instance().Cookies());
  828 + request.Send();
  829 + uint32_t status_code = request.GetResponseStatus();
  830 + if (kHTTPOK != status_code)
  831 + {
  832 + std::string err_msg = "网络请求错误! 错误码: " + std::to_string(status_code);
  833 + LOG_ERROR(str_2_wstr(err_msg.c_str()));
  834 + name = CString(L"网络请求错误!");
  835 + result = false;
  836 + break;
  837 + }
  838 + std::string response_body = request.ReadResponseBody();
  839 + if (response_body.empty())
  840 + {
  841 + LOG_ERROR(L"获取服务器响应数据失败,请确保网络连接正常!");
  842 + name = CString(L"获取服务器响应数据失败,请确保网络连接正常!");
  843 + result = false;
  844 + break;
  845 + }
632 846  
633   - LOG_TRACE(_T("获取开卡人姓名!"));
  847 + namespace PT = boost::property_tree;
  848 + bool card_res = false;
  849 + try //Parse the configuration file
  850 + {
  851 + PT::ptree ptree;
  852 + std::stringstream ss;
  853 + ss << response_body;
  854 + PT::read_json(ss, ptree);
  855 + std::string res = ptree.get<std::string>("code");
  856 + card_res = res.compare(0) == 0 ? true : false;
  857 + if (!card_res)
  858 + {
  859 + PT::ptree card_data = ptree.get_child("data");
  860 + name = card_data.get<std::string>("name").c_str();
  861 + buyer_card_type_ = card_data.get<int>("category");
  862 + }
  863 + else
  864 + {
  865 + std::string error_msg = ptree.get<std::string>("message");
  866 + name = CString(error_msg.c_str());
  867 + result = false;
  868 + break;
  869 + }
634 870  
635   - const uint32_t kHTTPOK = 200;
636   - WinHttp win_http;
637   - auto& url_cfg = URLConfig::Instance();
638   - win_http.ConnectHost(url_cfg.Host(), url_cfg.Port(), url_cfg.IsHttps());
639   - auto& request = win_http.OpenRequest(WinHttp::Method::GET, url_cfg.GetCardNamePath());
640   - if (url_cfg.IsHttps())
641   - {
642   - auto& app_cfg = ApplicationConfig::Instance();
643   - request.SetClientCertificate(app_cfg.ClientCertStore(), app_cfg.ClientCertSubject());
644   - }
645   - request.SetCookies(Session::Instance().Cookies());
646   - request.Send();
647   - uint32_t status_code = request.GetResponseStatus();
648   - if (kHTTPOK != status_code)
649   - {
650   - std::string err_msg = "网络请求错误! 错误码: " + std::to_string(status_code);
651   - LOG_ERROR(str_2_wstr(err_msg.c_str()));
652   - }
653   - std::string response_body = request.ReadResponseBody();
654   - if (response_body.empty())
655   - {
656   - LOG_ERROR(L"获取服务器响应数据失败,请确保网络连接正常!");
657   - }
  871 + }
  872 + catch (...)
  873 + {
  874 + LOG_ERROR(L"解析服务器返回的登录结果信息时出错!请确认返回数据不为空,返回的数据格式为正确的Json格式!");
  875 + name = CString(L"解析服务器返回的登录结果信息时出错!请确认返回数据不为空,返回的数据格式为正确的Json格式!");
  876 + result = false;
  877 + break;
  878 + }
  879 + } while (0);
658 880  
659 881 return result;
660 882 }
661 883  
662   -bool PlaceOrderDlg::GetCommName(CString &num, CString &name)
  884 +bool PlaceOrderDlg::GetCommName(CString &num, CString& card, CString &name, CString &product_id)
663 885 {
664   - return true;
  886 + bool result = true;
  887 +
  888 + LOG_TRACE(_T("获取商品名称!"));
  889 + do
  890 + {
  891 + const uint32_t kHTTPOK = 200;
  892 + WinHttp win_http;
  893 + auto& url_cfg = URLConfig::Instance();
  894 + win_http.ConnectHost(url_cfg.Host(), url_cfg.Port(), url_cfg.IsHttps());
  895 + std::string url = url_cfg.GetCommNamePath() + "?cardNo=" + wstr_2_str(card) + "&shortCode=" + wstr_2_str(num);
  896 + auto& request = win_http.OpenRequest(WinHttp::Method::POST, url);
  897 + if (url_cfg.IsHttps())
  898 + {
  899 + auto& app_cfg = ApplicationConfig::Instance();
  900 + request.SetClientCertificate(app_cfg.ClientCertStore(), app_cfg.ClientCertSubject());
  901 + }
  902 + request.SetCookies(Session::Instance().Cookies());
  903 + request.Send();
  904 + uint32_t status_code = request.GetResponseStatus();
  905 + if (kHTTPOK != status_code)
  906 + {
  907 + std::string err_msg = "网络请求错误! 错误码: " + std::to_string(status_code);
  908 + LOG_ERROR(str_2_wstr(err_msg.c_str()));
  909 + name = CString(L"网络请求错误!");
  910 + result = false;
  911 + break;
  912 + }
  913 + std::string response_body = request.ReadResponseBody();
  914 + if (response_body.empty())
  915 + {
  916 + LOG_ERROR(L"获取服务器响应数据失败,请确保网络连接正常!");
  917 + name = CString(L"获取服务器响应数据失败,请确保网络连接正常!");
  918 + result = false;
  919 + break;
  920 + }
  921 +
  922 + namespace PT = boost::property_tree;
  923 + bool card_res = false;
  924 + try //Parse the configuration file
  925 + {
  926 + PT::ptree ptree;
  927 + std::stringstream ss;
  928 + ss << response_body;
  929 + PT::read_json(ss, ptree);
  930 + std::string res = ptree.get<std::string>("code");
  931 + card_res = res.compare(0) == 0 ? true : false;
  932 + if (!card_res)
  933 + {
  934 + PT::ptree card_data = ptree.get_child("data");
  935 + name = ptree.get<std::string>("productName").c_str();
  936 + long id = ptree.get<long>("id");
  937 + product_id.Format(L"%ld", id);
  938 + }
  939 + else
  940 + {
  941 + std::string error_msg = ptree.get<std::string>("message");
  942 + name = CString(error_msg.c_str());
  943 + result = false;
  944 + break;
  945 + }
  946 +
  947 + }
  948 + catch (...)
  949 + {
  950 + LOG_ERROR(L"解析服务器返回的登录结果信息时出错!请确认返回数据不为空,返回的数据格式为正确的Json格式!");
  951 + name = CString(L"解析服务器返回的登录结果信息时出错!请确认返回数据不为空,返回的数据格式为正确的Json格式!");
  952 + result = false;
  953 + break;
  954 + }
  955 + } while (0);
  956 +
  957 + return result;
665 958 }
666 959  
667 960 void PlaceOrderDlg::OnAcceleratorDown()
... ... @@ -822,12 +1115,19 @@ void PlaceOrderDlg::EmptyCtrl()
822 1115 price_edit_.SetWindowText(L"");
823 1116 count_edit_.SetWindowText(L"");
824 1117  
825   - card_edit_.SetFocus();
  1118 + buyer_card_edit_.SetWindowTextW(L"");
  1119 + buyer_name_edit_.SetWindowTextW(L"");
  1120 + total_real_money_static_.SetWindowTextW(L"0.00");
  1121 +
826 1122 card_edit_.SetSel(4, 4);
827 1123 }
828 1124  
829 1125 void PlaceOrderDlg::OnBnClickedButtonSwipCard()
830 1126 {
  1127 + EmptyCtrl();
  1128 + InitList();
  1129 + pay_button_.EnableWindow(FALSE);
  1130 +
831 1131 auto dili_card_device = ReadDILIAndBankCardNumCmd();
832 1132 HardwareCmd::Reply reply = dili_card_device.Execute("");
833 1133  
... ... @@ -836,7 +1136,31 @@ void PlaceOrderDlg::OnBnClickedButtonSwipCard()
836 1136 {
837 1137 if (reply.error_code.compare("") != 0)
838 1138 {
839   - err_msg = "卡片异常!";
  1139 + if (reply.error_code.compare("300") == 0)
  1140 + {
  1141 + err_msg = "打开CPU卡读卡器失败";
  1142 + }
  1143 + else if (reply.error_code.compare("301") == 0)
  1144 + {
  1145 + err_msg = "无法找到卡片,请放卡到读卡器上(或重新放置卡片)";
  1146 + }
  1147 + else if (reply.error_code.compare("304") == 0)
  1148 + {
  1149 + err_msg = "读取卡片基本信息失败";
  1150 + }
  1151 + else if (reply.error_code.compare("501") == 0)
  1152 + {
  1153 + err_msg = "读取银行卡卡号失败";
  1154 + }
  1155 + else
  1156 + {
  1157 + err_msg = "读卡失败";
  1158 + }
  1159 + std::wstring log = L"下单时读取买家卡失败,错误码:" + str_2_wstr(reply.error_code);
  1160 + LOG_ERROR(log);
  1161 +
  1162 + buyer_card_edit_.SetWindowText(L"");
  1163 + buyer_name_edit_.SetWindowText(L"");
840 1164 break;
841 1165 }
842 1166  
... ... @@ -846,13 +1170,15 @@ void PlaceOrderDlg::OnBnClickedButtonSwipCard()
846 1170 boost::property_tree::ptree card_type_node = reply.data.get_child("type");
847 1171 std::string card_type = card_type_node.data();
848 1172  
849   - if (!GetCardInfo(str_2_wstr(card_num).c_str(), err_msg))
  1173 + CString card_name;
  1174 + if (!GetCardName(CString(card_num.c_str()), card_name, 1))
850 1175 {
  1176 + err_msg = card_name;
851 1177 break;
852 1178 }
853 1179  
854   - buyer_card_edit_.SetWindowText(card_info_.card_num);
855   - buyer_name_edit_.SetWindowText(card_info_.card_name);
  1180 + buyer_card_edit_.SetWindowText(CString(card_num.c_str()));
  1181 + buyer_name_edit_.SetWindowText(card_name);
856 1182  
857 1183 EnableCtrl(true);
858 1184  
... ... @@ -862,6 +1188,11 @@ void PlaceOrderDlg::OnBnClickedButtonSwipCard()
862 1188 {
863 1189 SetErrorMsg(err_msg);
864 1190 }
  1191 + else
  1192 + {
  1193 + SetErrorMsg(CString(L""));
  1194 + }
  1195 +
865 1196  
866 1197 }
867 1198  
... ... @@ -886,8 +1217,64 @@ void PlaceOrderDlg::EnableCtrl(bool is_enable)
886 1217 }
887 1218 }
888 1219  
889   -bool PlaceOrderDlg::GetCardInfo(CString num, CString &err_msg)
  1220 +afx_msg LRESULT PlaceOrderDlg::DeleteComm(WPARAM wParam, LPARAM lParam)
890 1221 {
891   - return true;
892   -}
  1222 + CCellID select_cell = product_list_.GetFocusCell();
  1223 + int delete_comm_id = product_list_.GetCell(select_cell)->data_id;
  1224 + for (std::vector<CommInfo>::iterator iter = comm_vec_.begin(); iter != comm_vec_.end(); ++iter)
  1225 + {
  1226 + if (iter->comm_id == delete_comm_id)
  1227 + {
  1228 + comm_vec_.erase(iter);
  1229 + break;
  1230 + }
  1231 + }
  1232 +
  1233 + product_list_.DeleteAllItems();
893 1234  
  1235 + InitList();
  1236 +
  1237 + for (int index = 0; index != comm_vec_.size(); ++index)
  1238 + {
  1239 + int row_index = product_list_.InsertRow(L"", -1);
  1240 + product_list_.SetItemText(row_index, 0, comm_vec_[index].seller_card, comm_vec_[index].comm_id);
  1241 + product_list_.SetItemText(row_index, 1, comm_vec_[index].seller_name, comm_vec_[index].comm_id);
  1242 + product_list_.SetItemText(row_index, 2, comm_vec_[index].comm_name, comm_vec_[index].comm_id);
  1243 + product_list_.SetItemText(row_index, 3, comm_vec_[index].price, comm_vec_[index].comm_id);
  1244 + product_list_.SetItemText(row_index, 4, comm_vec_[index].count, comm_vec_[index].comm_id);
  1245 + product_list_.SetItemText(row_index, 5, comm_vec_[index].unit, comm_vec_[index].comm_id);
  1246 + product_list_.SetItemText(row_index, 6, comm_vec_[index].weight, comm_vec_[index].comm_id);
  1247 + product_list_.SetItemText(row_index, 7, comm_vec_[index].total_money, comm_vec_[index].comm_id);
  1248 + for (int index = 0; index < 8; ++index)
  1249 + {
  1250 + product_list_.SetItemFormat(row_index, index, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
  1251 + }
  1252 + }
  1253 +
  1254 + SortList();
  1255 +
  1256 + CString subtotal;
  1257 + double total_price = 0;
  1258 + int list_count = product_list_.GetRowCount();
  1259 + for (int index = 1; index <= list_count; ++index)
  1260 + {
  1261 + subtotal = product_list_.GetItemText(index, 7);
  1262 + total_price += _ttof(subtotal);
  1263 + }
  1264 +
  1265 + CString total_price_s;
  1266 + total_price_s.Format(L"%.2f", total_price);
  1267 + total_real_money_static_.SetWindowText(total_price_s);
  1268 +
  1269 + if (product_list_.GetRowCount() > 1)
  1270 + {
  1271 + pay_button_.EnableWindow(TRUE);
  1272 + }
  1273 + else
  1274 + {
  1275 + pay_button_.EnableWindow(FALSE);
  1276 + }
  1277 +
  1278 + product_list_.Invalidate(TRUE);
  1279 + return 0;
  1280 +}
... ...
central_clearing_system/ETradeClient/mfc_ui/place_order_dlg.h
... ... @@ -7,7 +7,9 @@
7 7 #include "../utility/win_http.h"
8 8 #include "etrade_edit_control.h"
9 9 #include <string>
10   -
  10 +#include "CellRange.h"
  11 +#include "GridCell.h"
  12 +#include <vector>
11 13  
12 14 // PlaceOrderDlg 对话框
13 15  
... ... @@ -15,6 +17,26 @@ class PlaceOrderDlg : public CDialogEx
15 17 {
16 18 DECLARE_DYNAMIC(PlaceOrderDlg)
17 19  
  20 + struct CardInfo
  21 + {
  22 + CString card_num;
  23 + CString card_name;
  24 + CString card_type;
  25 + };
  26 +
  27 + struct CommInfo
  28 + {
  29 + int comm_id;
  30 + CString seller_card;
  31 + CString seller_name;
  32 + CString comm_name;
  33 + CString price;
  34 + CString count;
  35 + CString unit;
  36 + CString weight;
  37 + CString total_money;
  38 + };
  39 +
18 40 public:
19 41 PlaceOrderDlg(CWnd* pParent = NULL); // 标准构造函数
20 42 virtual ~PlaceOrderDlg();
... ... @@ -26,6 +48,16 @@ public:
26 48 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
27 49 afx_msg void OnPaint();
28 50 afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  51 + afx_msg void OnBnClickedButtonPay();
  52 + virtual BOOL PreTranslateMessage(MSG* pMsg);
  53 + afx_msg void OnAcceleratorTab();
  54 + afx_msg void OnAcceleratorEnter();
  55 + afx_msg LRESULT OnEditKillFocus(WPARAM wParam, LPARAM lParam);
  56 + afx_msg void OnAcceleratorDown();
  57 + afx_msg void OnAcceleratorUp();
  58 + afx_msg void OnSetFocus(CWnd* pOldWnd);
  59 + afx_msg void OnBnClickedButtonSwipCard();
  60 + afx_msg LRESULT DeleteComm(WPARAM wParam, LPARAM lParam);
29 61  
30 62 // 对话框数据
31 63 enum { IDD = IDD_DIALOG_PLACE_ORDER };
... ... @@ -35,12 +67,23 @@ protected:
35 67  
36 68 DECLARE_MESSAGE_MAP()
37 69  
38   -
39 70 private:
40 71 void SetCtrlPos();
41 72 void SetCtrlInitData();
42 73 void InitList();
43   -public:
  74 + void SortList();
  75 + void EmptyCtrl();
  76 + void EnableCtrl(bool is_enable);
  77 +
  78 + int GetCommIndex();
  79 +
  80 + bool GetUserName(CString &name);
  81 + void SetErrorMsg(CString &error);
  82 + bool GetCardName(CString &num, CString &name, int type); //type =1是买家,2是买家
  83 + bool GetCommName(CString &num, CString& card, CString &name, CString &product_id);
  84 +
  85 +
  86 +private:
44 87 CStatic owner_static_;
45 88 CEditBox card_edit_;
46 89 CEdit name_edit_;
... ... @@ -58,59 +101,23 @@ public:
58 101 CEditBox count_edit_;
59 102 CButton pay_button_;
60 103 CGridCtrl product_list_;
61   -
62   - CPen line_pen_;
63   - CPoint line_point_[3];
64   -
65   - CBrush edit_brush_;
66   -public:
67   - afx_msg void OnBnClickedButtonPay();
68   -private:
69 104 CStatic total_money_static_;
70 105 CStatic total_real_money_static_;
71   -
72   - HACCEL acce_;
73   -
74   - bool GetUserName(CString &name);
75   - bool GetCommName(CString &name);
76   -public:
77   - virtual BOOL PreTranslateMessage(MSG* pMsg);
78   - afx_msg void OnAcceleratorTab();
79   - afx_msg void OnAcceleratorEnter();
80   -
81   - void SetErrorMsg(CString &error);
82 106 CStatic error_static_;
83   -
84   - afx_msg LRESULT OnEditKillFocus(WPARAM wParam, LPARAM lParam);
85   -
86   - bool GetCardName(CString &num, CString &name);
87   - bool GetCommName(CString &num, CString &name);
88   -
89   - struct CardInfo
90   - {
91   - CString card_num;
92   - CString card_name;
93   - CString card_type;
94   - };
95   -
96   - CardInfo card_info_;
97   - bool GetCardInfo(CString num, CString &err_msg);
98   -
99   - afx_msg void OnAcceleratorDown();
100   - afx_msg void OnAcceleratorUp();
101   - afx_msg void OnSetFocus(CWnd* pOldWnd);
102   -
103   - void SortList();
104   -
105   - void EmptyCtrl();
106 107 CStatic buyer_static_;
107 108 CEditBox buyer_card_edit_;
108 109 CEditBox buyer_name_edit_;
109 110 CButton swip_card_button_;
110   - afx_msg void OnBnClickedButtonSwipCard();
111 111  
112   - //std::string card_num_;
113   - //std::string card_type_;
  112 + CPen line_pen_;
  113 + CPoint line_point_[3];
  114 + CBrush edit_brush_;
114 115  
115   - void EnableCtrl(bool is_enable);
  116 + HACCEL acce_;
  117 +
  118 + CString product_id_;
  119 + int buyer_card_type_;
  120 +
  121 + std::vector<CommInfo> comm_vec_;
  122 + int comm_id_index_;
116 123 };
... ...
central_clearing_system/ETradeClient/utility/menu_res_auth_mgr.cpp
... ... @@ -141,9 +141,6 @@ void MenuResAuthMgr::DoUpdateAuth(const std::string&amp; auth_data)
141 141 auth_item.id = elem.second.get<uint32_t>("code");
142 142 auth_item.url_path = elem.second.get<std::string>("path");
143 143 auth_item.remark = str_2_wstr(elem.second.get<std::string>("name"));
144   - /*auth_item.id = elem.second.get<uint32_t>("id");
145   - auth_item.url_path = elem.second.get<std::string>("url_path");
146   - auth_item.remark = str_2_wstr(elem.second.get<std::string>("remark"));*/
147 144 menu_auth_items.emplace_back(auth_item);
148 145 }
149 146 }
... ...
central_clearing_system/ETradeClient/utility/url_config.cpp
... ... @@ -61,8 +61,11 @@ URLConfig::URLConfig()
61 61 m_user_msg_count_path = ptree.get<std::string>("user_msg_count_path");
62 62 m_user_msg_path = ptree.get<std::string>("user_msg_path");
63 63 m_modify_pwd_path = ptree.get<std::string>("modify_pwd_path");
64   - m_get_card_name_path = ptree.get<std::string>("get_card_name");
65   -
  64 + m_get_card_name_path = ptree.get<std::string>("get_card_name_path");
  65 + m_get_seller_card_path = ptree.get<std::string>("get_seller_card_path");
  66 + m_get_product_path = ptree.get<std::string>("get_product_name_path");
  67 + m_submit_orders_path = ptree.get<std::string>("submit_orders_path");
  68 + m_finish_order_path = ptree.get<std::string>("finish_order_path");
66 69 }
67 70 catch (...) // Catch the exception in order for logging.
68 71 {
... ... @@ -94,6 +97,9 @@ void URLConfig::ModifyCfg(bool is_https, uint16_t port)
94 97 root.put("user_msg_path", m_user_msg_path);
95 98 root.put("modify_pwd_path", m_modify_pwd_path);
96 99 root.put("get_card_name_path", m_get_card_name_path);
  100 + root.put("get_product_name_path", m_get_product_path);
  101 + root.put("submit_orders_path", m_submit_orders_path);
  102 + root.put("finish_order_path", m_finish_order_path);
97 103 PT::write_json(ss, root, true);
98 104 }
99 105 catch (...) // Catch the exception in order for logging.
... ... @@ -173,4 +179,16 @@ std::string URLConfig::PwdModificationPath() const
173 179 std::string URLConfig::GetCardNamePath() const
174 180 {
175 181 return m_get_card_name_path;
  182 +}
  183 +std::string URLConfig::GetCommNamePath() const
  184 +{
  185 + return m_get_product_path;
  186 +}
  187 +std::string URLConfig::GetSubmitOrdersPath() const
  188 +{
  189 + return m_submit_orders_path;
  190 +}
  191 +std::string URLConfig::GetSellerCardPath() const
  192 +{
  193 + return m_get_seller_path;
176 194 }
177 195 \ No newline at end of file
... ...
central_clearing_system/ETradeClient/utility/url_config.h
... ... @@ -30,6 +30,9 @@ public:
30 30 std::string UserMsgPath() const;
31 31 std::string PwdModificationPath() const;
32 32 std::string GetCardNamePath() const;
  33 + std::string GetCommNamePath() const;
  34 + std::string GetSubmitOrdersPath() const;
  35 + std::string GetSellerCardPath() const;
33 36 private:
34 37 URLConfig();
35 38 URLConfig(const URLConfig&);
... ... @@ -47,5 +50,10 @@ private:
47 50 std::string m_user_msg_path;
48 51 std::string m_modify_pwd_path;
49 52 std::string m_get_card_name_path;
  53 + std::string m_get_seller_card_path;
  54 + std::string m_get_seller_path;
  55 + std::string m_get_product_path;
  56 + std::string m_submit_orders_path;
  57 + std::string m_finish_order_path;
50 58 };
51 59 #endif // ETRADECLIENT_UTILITY_URL_CONFIG_H_INCLUDED
... ...
central_clearing_system/ETradeClient/utility/win_msg_define.h
... ... @@ -23,6 +23,7 @@
23 23 #define WM_CEF_MSG_VIEW_CLOSE_BROWSER (WM_USER + 117)
24 24 #define WM_CRASH_CLOSE (WM_USER + 118)
25 25 #define WM_ORDER_KILL_FOCUS (WM_USER + 119)
  26 +#define WM_ORDER_DELETE_ORDER (WM_USER + 120)
26 27  
27 28 #define WM_CEF_JS_CAMMAND_CLOSE_WND (WM_USER + 301)
28 29 #define WM_CEF_JS_CAMMAND_USER_RELOGIN (WM_USER + 302)
... ...
central_clearing_system/Resource.h
... ... @@ -68,33 +68,49 @@
68 68 #define IDC_PAY_BUTTON_CLOSE 1051
69 69 #define IDC_PAY_BUTTON_PAY 1052
70 70 #define IDC_PAY_STATIC_REAL_MONEY 1053
71   -#define ID_PAY_FEE 10001
72   -#define ID_ORDER 10002
73   -#define ID_STATEMENT_MANAGE 10003
74   -#define ID_ORDERFORM_MANAGE 10004
  71 +#define IDC_STATIC_ERROR_MSG 1054
  72 +
  73 +#define ID_ORDER 10001
  74 +#define ID_STATEMENT_MANAGE 10002
  75 +#define ID_ORDERFORM_MANAGE 10003
  76 +
75 77 #define ID_EXIT 11001
76 78 #define ID_MODIFY_PASSWORD 11002
77   -#define ID_USER_MANAGE 20001
78   -#define ID_ROLE_MANAGE 20002
79   -#define ID_RIGHT_MANAGE 20003
80   -#define ID_32845 32845
  79 +
  80 +#define ID_COMM_REGIST 20001
  81 +#define ID_COMM_DISTRIB 20002
  82 +#define ID_QUERY_MANAGE 20003
  83 +
  84 +#define ID_SPECIAL_HANDLE 30001
  85 +
  86 +#define ID_POINT_RULE 40001
  87 +#define ID_CATEGORY_RULE 40002
  88 +#define ID_AGREEMENT 40003
  89 +#define ID_TAPE_HANDLE 40004
  90 +#define ID_CREDIT 40005
  91 +
  92 +#define ID_USER_MANAGE 50001
  93 +#define ID_ROLE_MANAGE 50002
  94 +#define ID_PARAM_SET 50003
  95 +#define ID_LOG 50004
  96 +
81 97 #define ID_MENU_DELETE 32846
82   -#define ID_32847 32847
83 98 #define ID_POPMENU_LIST 32848
84   -#define ID_32849 32849
85 99 #define ID_POPMENU_DELETE 32850
86 100 #define ID_ACCELERATOR_TAB 32851
87 101 #define ID_ACCELERATOR_ENTER 32852
88 102 #define ID_ACCELERATOR_UP 32854
89 103 #define ID_ACCELERATOR_DOWN 32855
  104 +#define ID_ACCELERATOR_F11 32857
  105 +
90 106  
91 107 // Next default values for new objects
92 108 //
93 109 #ifdef APSTUDIO_INVOKED
94 110 #ifndef APSTUDIO_READONLY_SYMBOLS
95 111 #define _APS_NEXT_RESOURCE_VALUE 332
96   -#define _APS_NEXT_COMMAND_VALUE 32857
97   -#define _APS_NEXT_CONTROL_VALUE 1054
  112 +#define _APS_NEXT_COMMAND_VALUE 32883
  113 +#define _APS_NEXT_CONTROL_VALUE 1055
98 114 #define _APS_NEXT_SYMED_VALUE 311
99 115 #endif
100 116 #endif
... ...
central_clearing_system/out/Win32/Debug.zip 0 → 100644
No preview for this file type