Commit 6ed3258a92eab89f2537d2dc26ca59293fc56366
1 parent
3dae8957
feat<central_clearing_system>:完成下单流程和打印功能的调试
喜大普奔!!!
Showing
21 changed files
with
171 additions
and
75 deletions
central_clearing_system/Config/application_config.json
central_clearing_system/Config/url_cfg.json
central_clearing_system/ETradeClient.rc
... | ... | @@ -148,9 +148,14 @@ IDR_ACCELERATOR_ORDER ACCELERATORS |
148 | 148 | BEGIN |
149 | 149 | VK_DOWN, ID_ACCELERATOR_DOWN, VIRTKEY, NOINVERT |
150 | 150 | VK_RETURN, ID_ACCELERATOR_ENTER, VIRTKEY, NOINVERT |
151 | + VK_F11, ID_ACCELERATOR_F11, VIRTKEY, NOINVERT | |
151 | 152 | VK_TAB, ID_ACCELERATOR_TAB, VIRTKEY, NOINVERT |
152 | 153 | VK_UP, ID_ACCELERATOR_UP, VIRTKEY, NOINVERT |
153 | - VK_F11, ID_ACCELERATOR_F11, VIRTKEY, NOINVERT | |
154 | + "S", ID_ACCELERATOR_S, VIRTKEY, NOINVERT | |
155 | + "S", ID_ACCELERATOR_ALT_S, VIRTKEY, ALT, NOINVERT | |
156 | + "A", ID_ACCELERATOR_A, VIRTKEY, NOINVERT | |
157 | + "F", ID_ACCELERATOR_F, VIRTKEY, NOINVERT | |
158 | + "X", ID_ACCELERATOR_X, VIRTKEY, NOINVERT | |
154 | 159 | END |
155 | 160 | |
156 | 161 | |
... | ... | @@ -259,7 +264,7 @@ BEGIN |
259 | 264 | LTEXT "",IDC_PAY_STATIC_MONEY,73,20,8,8 |
260 | 265 | LTEXT "密 码:",IDC_PAY_STATIC_PASSWORD,18,50,31,8 |
261 | 266 | EDITTEXT IDC_PAY_EDIT_PASSWORD,56,46,40,14,ES_PASSWORD | ES_AUTOHSCROLL |
262 | - PUSHBUTTON "输入密码(&A)",IDC_PAY_BUTTON_PASSWORD,151,51,71,18 | |
267 | + PUSHBUTTON "输入密码(&X)",IDC_PAY_BUTTON_PASSWORD,151,51,71,18 | |
263 | 268 | PUSHBUTTON "关闭(&S)",IDC_PAY_BUTTON_CLOSE,155,94,67,17 |
264 | 269 | PUSHBUTTON "付款(&F)",IDC_PAY_BUTTON_PAY,72,94,67,17 |
265 | 270 | LTEXT "",IDC_PAY_STATIC_REAL_MONEY,65,20,57,8 |
... | ... | @@ -337,6 +342,7 @@ BEGIN |
337 | 342 | |
338 | 343 | IDD_DIALOG_PLACE_ORDER, DIALOG |
339 | 344 | BEGIN |
345 | + MOCKUP, 1, 50, -25, -30, "C:\Users\WangGY\Desktop\TIM图片20180918183513.png" | |
340 | 346 | RIGHTMARGIN, 337 |
341 | 347 | HORZGUIDE, 67 |
342 | 348 | END | ... | ... |
central_clearing_system/ETradeClient/hardware/hardware_cmd.cpp
... | ... | @@ -1327,7 +1327,7 @@ int StylusPrinterCmd::Print(std::vector<OrderInfo> &order_vector) |
1327 | 1327 | const int NormalPageCommCount = 10; //非第一页和最后一页,其他页的商品数目 |
1328 | 1328 | const int LastPageCommCount = 9; //最后一页最多商品数量 |
1329 | 1329 | |
1330 | - const int TitleCtrlHIBig = 900; //表头不同组别控件横向间隔 | |
1330 | + const int TitleCtrlHIBig = 700; //表头不同组别控件横向间隔 | |
1331 | 1331 | const int TitleCtrlHISmall = 150; //表头同组别控件横向间隔 |
1332 | 1332 | const int TitleCtrlVI = 50; //表头控件纵向间隔 |
1333 | 1333 | const int LineStartX = 100; //横线起点x坐标 |
... | ... | @@ -1542,22 +1542,22 @@ std::string StylusPrinterCmd::ParseInput(std::string &input, std::vector<OrderIn |
1542 | 1542 | { |
1543 | 1543 | OrderInfo order; |
1544 | 1544 | order.doc_name = title.c_str(); |
1545 | - order.statements_no = str_2_wstr(v.second.get<std::string>(JSON_TAG_STATEMENT_ID)).c_str(); | |
1546 | - order.trade_time = str_2_wstr(v.second.get<std::string>(JSON_TAG_TRADE_TIME)).c_str(); | |
1547 | - order.buyer_name = str_2_wstr(v.second.get<std::string>(JSON_TAG_TRADE_BUYER_NAME)).c_str(); | |
1548 | - order.seller_name = str_2_wstr(v.second.get<std::string>(JSON_TAG_TRADE_SELLER_NAME)).c_str(); | |
1549 | - order.settlement_clerk = str_2_wstr(v.second.get<std::string>(JSON_TAG_TRADE_USER_NAME)).c_str(); | |
1550 | - order.total_money = str_2_wstr(v.second.get<std::string>(JSON_TAG_TRADE_TOTAL_MONEY)).c_str(); | |
1545 | + order.statements_no = v.second.get<std::string>(JSON_TAG_STATEMENT_ID).c_str(); | |
1546 | + order.trade_time = v.second.get<std::string>(JSON_TAG_TRADE_TIME).c_str(); | |
1547 | + order.buyer_name = v.second.get<std::string>(JSON_TAG_TRADE_BUYER_NAME).c_str(); | |
1548 | + order.seller_name = v.second.get<std::string>(JSON_TAG_TRADE_SELLER_NAME).c_str(); | |
1549 | + order.settlement_clerk = v.second.get<std::string>(JSON_TAG_TRADE_USER_NAME).c_str(); | |
1550 | + order.total_money = v.second.get<std::string>(JSON_TAG_TRADE_TOTAL_MONEY).c_str(); | |
1551 | 1551 | |
1552 | 1552 | PT::ptree products_ptree = v.second.get_child(JSON_TAG_TRADE_PRODUCTS); |
1553 | 1553 | BOOST_FOREACH(PT::ptree::value_type &v, products_ptree) |
1554 | 1554 | { |
1555 | 1555 | CommInfo comm_info; |
1556 | 1556 | comm_info.comm_id = v.second.get<long>(JSON_TAG_ORDER_ID); |
1557 | - comm_info.comm_name = str_2_wstr(v.second.get<std::string>(JSON_TAG_PRODUCT_NAME)).c_str(); | |
1558 | - comm_info.price = str_2_wstr(v.second.get<std::string>(JSON_TAG_PRICE)).c_str(); | |
1559 | - comm_info.count = str_2_wstr(v.second.get<std::string>(JSON_TAG_AMOUNT)).c_str(); | |
1560 | - comm_info.total_money = str_2_wstr(v.second.get<std::string>(JSON_TAG_MONEY)).c_str(); | |
1557 | + comm_info.comm_name = v.second.get<std::string>(JSON_TAG_PRODUCT_NAME).c_str(); | |
1558 | + comm_info.price = v.second.get<std::string>(JSON_TAG_PRICE).c_str(); | |
1559 | + comm_info.count = v.second.get<std::string>(JSON_TAG_AMOUNT).c_str(); | |
1560 | + comm_info.total_money = v.second.get<std::string>(JSON_TAG_MONEY).c_str(); | |
1561 | 1561 | order.comm_vector.push_back(comm_info); |
1562 | 1562 | } |
1563 | 1563 | order_vector.push_back(order); | ... | ... |
central_clearing_system/ETradeClient/hardware/hardware_cmd.h
... | ... | @@ -123,7 +123,7 @@ public: |
123 | 123 | virtual Reply Execute(const std::string& input) override; |
124 | 124 | |
125 | 125 | private: |
126 | - bool ParseInput(std::string &input, std::vector<OrderInfo> &order_vector); | |
126 | + std::string ParseInput(std::string &input, std::vector<OrderInfo> &order_vector); | |
127 | 127 | int Print(std::vector<OrderInfo> &order_vector); |
128 | 128 | }; |
129 | 129 | // | ... | ... |
central_clearing_system/ETradeClient/mfc_ui/ETradeClient.cpp
... | ... | @@ -55,7 +55,7 @@ LONG WINAPI ExceptionHandler(PEXCEPTION_POINTERS ExceptionPointer) |
55 | 55 | stuDump.ThreadId = GetCurrentThreadId(); |
56 | 56 | stuDump.ExceptionPointers = ExceptionPointer; |
57 | 57 | stuDump.ClientPointers = FALSE; |
58 | - MINIDUMP_TYPE emDumpType = MiniDumpWithFullMemory; | |
58 | + MINIDUMP_TYPE emDumpType = MiniDumpNormal; | |
59 | 59 | BOOL bCreateDump = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, emDumpType, (ExceptionPointer != 0) ? &stuDump : 0, 0, 0); |
60 | 60 | |
61 | 61 | if (!bCreateDump) |
... | ... | @@ -79,7 +79,7 @@ LONG WINAPI ExceptionHandler(PEXCEPTION_POINTERS ExceptionPointer) |
79 | 79 | |
80 | 80 | // Replace application ID string below with unique ID string; recommended |
81 | 81 | // format for string is CompanyName.ProductName.SubProduct.VersionInformation |
82 | -static const wchar_t* APP_ID = L"DILIGROUP.CentralClearingSystem.V1.0"; | |
82 | +static const wchar_t* APP_ID = L"DILIGROUP.CentralClearingSystem.V2.0"; | |
83 | 83 | |
84 | 84 | |
85 | 85 | // CETradeClientApp | ... | ... |
central_clearing_system/ETradeClient/mfc_ui/GridCellBase.cpp
central_clearing_system/ETradeClient/mfc_ui/GridCellBase.h
central_clearing_system/ETradeClient/mfc_ui/GridCtrl.cpp
... | ... | @@ -4625,7 +4625,7 @@ BOOL CGridCtrl::GetItem(GV_ITEM* pItem) |
4625 | 4625 | return TRUE; |
4626 | 4626 | } |
4627 | 4627 | |
4628 | -BOOL CGridCtrl::SetItemText(int nRow, int nCol, LPCTSTR str, int data_id, std::string product_id) | |
4628 | +BOOL CGridCtrl::SetItemText(int nRow, int nCol, LPCTSTR str, int data_id, long product_id) | |
4629 | 4629 | { |
4630 | 4630 | if (GetVirtualMode()) |
4631 | 4631 | return FALSE; | ... | ... |
central_clearing_system/ETradeClient/mfc_ui/GridCtrl.h
... | ... | @@ -366,7 +366,7 @@ public: |
366 | 366 | |
367 | 367 | BOOL SetItem(const GV_ITEM* pItem); |
368 | 368 | BOOL GetItem(GV_ITEM* pItem); |
369 | - BOOL SetItemText(int nRow, int nCol, LPCTSTR str, int data_id = 0, std::string product_id = ""); | |
369 | + BOOL SetItemText(int nRow, int nCol, LPCTSTR str, int data_id = 0, long product_id = 0); | |
370 | 370 | // The following was virtual. If you want to override, use |
371 | 371 | // CGridCellBase-derived class's GetText() to accomplish same thing |
372 | 372 | CString GetItemText(int nRow, int nCol) const; | ... | ... |
central_clearing_system/ETradeClient/mfc_ui/etrade_edit_control.cpp
... | ... | @@ -221,6 +221,17 @@ bool CEditBox::CheckHeavy(CString heavy) |
221 | 221 | result = false; |
222 | 222 | break; |
223 | 223 | } |
224 | + | |
225 | + //首位为0时,次首位只能是小数点 | |
226 | + if (length == 2 && heavy.Left(1) == "0") | |
227 | + { | |
228 | + if (heavy.Right(1) != ".") | |
229 | + { | |
230 | + result = false; | |
231 | + break; | |
232 | + } | |
233 | + } | |
234 | + | |
224 | 235 | //只有一个小数点 |
225 | 236 | if (heavy.Replace(L".", L".") > 1) |
226 | 237 | { |
... | ... | @@ -272,6 +283,17 @@ bool CEditBox::CheckPrice(CString price) |
272 | 283 | result = false; |
273 | 284 | break; |
274 | 285 | } |
286 | + | |
287 | + //首位为0时,次首位只能是小数点 | |
288 | + if (length == 2 && price.Left(1) == "0") | |
289 | + { | |
290 | + if (price.Right(1) != ".") | |
291 | + { | |
292 | + result = false; | |
293 | + break; | |
294 | + } | |
295 | + } | |
296 | + | |
275 | 297 | //只有一个小数点 |
276 | 298 | if (price.Replace(L".", L".") > 1) |
277 | 299 | { | ... | ... |
central_clearing_system/ETradeClient/mfc_ui/pay_dlg.cpp
... | ... | @@ -56,6 +56,9 @@ BEGIN_MESSAGE_MAP(PayDlg, CDialogEx) |
56 | 56 | ON_BN_CLICKED(IDC_PAY_BUTTON_PAY, &PayDlg::OnBnClickedPayButtonPay) |
57 | 57 | ON_WM_CTLCOLOR() |
58 | 58 | ON_BN_CLICKED(IDC_PAY_BUTTON_PASSWORD, &PayDlg::OnBnClickedPayButtonPassword) |
59 | + ON_COMMAND(ID_ACCELERATOR_A, &PayDlg::OnBnClickedPayButtonPassword) | |
60 | + ON_COMMAND(ID_ACCELERATOR_F, &PayDlg::OnBnClickedPayButtonPay) | |
61 | + ON_COMMAND(ID_ACCELERATOR_X, &PayDlg::OnBnClickedPayButtonClose) | |
59 | 62 | END_MESSAGE_MAP() |
60 | 63 | |
61 | 64 | |
... | ... | @@ -82,6 +85,8 @@ BOOL PayDlg::OnInitDialog() |
82 | 85 | password_button_.ShowWindow(SW_SHOW); |
83 | 86 | } |
84 | 87 | |
88 | + acce_ = LoadAccelerators(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_ACCELERATOR_ORDER)); | |
89 | + | |
85 | 90 | return TRUE; // return TRUE unless you set the focus to a control |
86 | 91 | // 异常: OCX 属性页应返回 FALSE |
87 | 92 | } |
... | ... | @@ -157,21 +162,30 @@ void PayDlg::OnBnClickedPayButtonClose() |
157 | 162 | |
158 | 163 | void PayDlg::OnBnClickedPayButtonPay() |
159 | 164 | { |
160 | - | |
165 | + LOG_TRACE(L"支付订单"); | |
161 | 166 | CString error_msg; |
162 | 167 | |
163 | 168 | std::string statement_data; |
164 | 169 | do |
165 | 170 | { |
171 | + CString pass_word; | |
172 | + password_edit_.GetWindowText(pass_word); | |
173 | + if (card_type_ != 30) | |
174 | + { | |
175 | + if (pass_word.IsEmpty() || pass_word.GetLength() < 6) | |
176 | + { | |
177 | + SetErrorMsg(L"错误提示:密码为空或密码长度不足!"); | |
178 | + break; | |
179 | + } | |
180 | + | |
181 | + } | |
182 | + | |
166 | 183 | const uint32_t kHTTPOK = 200; |
167 | 184 | WinHttp win_http; |
168 | 185 | auto& url_cfg = URLConfig::Instance(); |
169 | 186 | win_http.ConnectHost(url_cfg.Host(), url_cfg.Port(), url_cfg.IsHttps()); |
170 | - std::string url = url_cfg.GetSubmitOrdersPath(); | |
171 | - auto& request = win_http.OpenRequest(WinHttp::Method::POST, url); | |
172 | - | |
173 | - CString pass_word; | |
174 | - password_edit_.GetWindowText(pass_word); | |
187 | + std::string url = url_cfg.GetFinishStatementPath(); | |
188 | + auto& request = win_http.OpenRequest(WinHttp::Method::JSONPOST, url); | |
175 | 189 | |
176 | 190 | std::ostringstream os; |
177 | 191 | os << statement_id_; |
... | ... | @@ -179,7 +193,7 @@ void PayDlg::OnBnClickedPayButtonPay() |
179 | 193 | std::istringstream is(os.str()); |
180 | 194 | is >> statement_id_str; |
181 | 195 | |
182 | - std::string post_data = "{\"statementId\":" + statement_id_str + "\"password\":\"" + wstr_2_str(pass_word) + "\"}"; | |
196 | + std::string post_data = "{\"statementId\":" + statement_id_str + ",\"password\":\"" + wstr_2_str(pass_word) + "\"}"; | |
183 | 197 | |
184 | 198 | request.SetPostData(post_data); |
185 | 199 | if (url_cfg.IsHttps()) |
... | ... | @@ -193,7 +207,7 @@ void PayDlg::OnBnClickedPayButtonPay() |
193 | 207 | if (kHTTPOK != status_code) |
194 | 208 | { |
195 | 209 | std::string err_msg = "网络请求错误! 错误码: " + std::to_string(status_code); |
196 | - LOG_ERROR(str_2_wstr(err_msg.c_str())); | |
210 | + LOG_ERROR(CString(err_msg.c_str()).GetBuffer()); | |
197 | 211 | error_msg = err_msg.c_str(); |
198 | 212 | break; |
199 | 213 | } |
... | ... | @@ -215,7 +229,11 @@ void PayDlg::OnBnClickedPayButtonPay() |
215 | 229 | PT::read_json(ss, ptree); |
216 | 230 | if (ptree.get<long>("code") == 0) |
217 | 231 | { |
218 | - statement_data = ptree.get<std::string>("data"); | |
232 | + PT::ptree data_child = ptree.get_child("data"); | |
233 | + std::ostringstream os; | |
234 | + PT::write_json(os, data_child); | |
235 | + CString data = str_2_wstr(std::string(os.str())).c_str(); | |
236 | + statement_data = CT2A(data); | |
219 | 237 | } |
220 | 238 | else |
221 | 239 | { |
... | ... | @@ -268,6 +286,7 @@ HBRUSH PayDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) |
268 | 286 | |
269 | 287 | void PayDlg::OnBnClickedPayButtonPassword() |
270 | 288 | { |
289 | + password_edit_.SetWindowTextW(L""); | |
271 | 290 | auto pin_pad = ReadPINPadCmd(); |
272 | 291 | HardwareCmd::Reply reply = pin_pad.Execute(""); |
273 | 292 | CString error_msg; |
... | ... | @@ -307,5 +326,22 @@ void PayDlg::OnBnClickedPayButtonPassword() |
307 | 326 | if (!error_msg.IsEmpty()) |
308 | 327 | { |
309 | 328 | SetErrorMsg(error_msg); |
329 | + password_edit_.SetWindowTextW(L""); | |
330 | + } | |
331 | + else | |
332 | + { | |
333 | + SetErrorMsg(CString(L"")); | |
310 | 334 | } |
311 | 335 | } |
336 | + | |
337 | + | |
338 | +BOOL PayDlg::PreTranslateMessage(MSG* pMsg) | |
339 | +{ | |
340 | + if (WM_KEYFIRST <= pMsg->message&&pMsg->message <= WM_KEYLAST) | |
341 | + { | |
342 | + if (acce_ && ::TranslateAccelerator(m_hWnd, acce_, pMsg)) | |
343 | + return TRUE; | |
344 | + } | |
345 | + | |
346 | + return CDialogEx::PreTranslateMessage(pMsg); | |
347 | +} | ... | ... |
central_clearing_system/ETradeClient/mfc_ui/pay_dlg.h
central_clearing_system/ETradeClient/mfc_ui/place_order_dlg.cpp
... | ... | @@ -28,6 +28,7 @@ PlaceOrderDlg::PlaceOrderDlg(CWnd* pParent /*=NULL*/) |
28 | 28 | line_pen_.CreatePen(PS_SOLID, 1, RGB(0, 0, 0)); |
29 | 29 | edit_brush_.CreateSolidBrush(RGB(245, 247, 250)); |
30 | 30 | comm_id_index_ = 1; |
31 | + product_id_ = 0; | |
31 | 32 | } |
32 | 33 | |
33 | 34 | PlaceOrderDlg::~PlaceOrderDlg() |
... | ... | @@ -70,6 +71,7 @@ BEGIN_MESSAGE_MAP(PlaceOrderDlg, CDialogEx) |
70 | 71 | ON_WM_PAINT() |
71 | 72 | ON_WM_CTLCOLOR() |
72 | 73 | ON_BN_CLICKED(IDC_BUTTON_PAY, &PlaceOrderDlg::OnBnClickedButtonPay) |
74 | + ON_COMMAND(ID_ACCELERATOR_S, &PlaceOrderDlg::OnBnClickedButtonPay) | |
73 | 75 | ON_COMMAND(ID_ACCELERATOR_TAB, &PlaceOrderDlg::OnAcceleratorTab) |
74 | 76 | ON_COMMAND(ID_ACCELERATOR_ENTER, &PlaceOrderDlg::OnAcceleratorEnter) |
75 | 77 | ON_MESSAGE(WM_ORDER_KILL_FOCUS, &PlaceOrderDlg::OnEditKillFocus) |
... | ... | @@ -356,6 +358,7 @@ HBRUSH PlaceOrderDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) |
356 | 358 | |
357 | 359 | void PlaceOrderDlg::OnBnClickedButtonPay() |
358 | 360 | { |
361 | + LOG_TRACE(L"Ìá½»¶©µ¥"); | |
359 | 362 | SetErrorMsg(CString(L"")); |
360 | 363 | int row_count = product_list_.GetRowCount(); |
361 | 364 | if (row_count == 1) |
... | ... | @@ -394,7 +397,7 @@ void PlaceOrderDlg::OnBnClickedButtonPay() |
394 | 397 | |
395 | 398 | Comm comm_info; |
396 | 399 | CGridCellBase* product_cell = product_list_.GetCell(row, 2); |
397 | - comm_info.product_id = product_cell->product_id; | |
400 | + comm_info.product_id = std::to_string(product_cell->product_id); | |
398 | 401 | comm_info.price = wstr_2_str(product_list_.GetItemText(row, 3)); |
399 | 402 | comm_info.amount = wstr_2_str(product_list_.GetItemText(row, 4)); |
400 | 403 | comm_info.unit = product_list_.GetItemText(row, 5).Compare(L"½ï") == 0 ? "1" : "2"; |
... | ... | @@ -497,7 +500,7 @@ void PlaceOrderDlg::OnBnClickedButtonPay() |
497 | 500 | EmptyCtrl(true); |
498 | 501 | SetCtrlInitData(); |
499 | 502 | InitList(); |
500 | - comm_id_index_; | |
503 | + comm_id_index_ = 1; | |
501 | 504 | comm_vec_.clear(); |
502 | 505 | |
503 | 506 | PayDlg pay_dlg(statement_id, CString(total_money.c_str()), buyer_card_type_); |
... | ... | @@ -590,60 +593,63 @@ void PlaceOrderDlg::OnAcceleratorEnter() |
590 | 593 | break; |
591 | 594 | } |
592 | 595 | |
593 | - int row_index = product_list_.InsertRow(L"", -1); | |
594 | - product_list_.Invalidate(); | |
595 | 596 | CString text; |
596 | 597 | double price = 0, count = 0; |
597 | 598 | card_edit_.GetWindowText(text); |
598 | 599 | CommInfo comm; |
599 | 600 | comm.comm_id = GetCommIndex(); |
600 | 601 | comm.seller_card = text; |
601 | - product_list_.SetItemText(row_index, 0, text, comm.comm_id); | |
602 | 602 | text.Empty(); |
603 | - | |
604 | 603 | name_edit_.GetWindowText(text); |
605 | 604 | comm.seller_name = text; |
606 | - product_list_.SetItemText(row_index, 1, text, comm.comm_id); | |
607 | 605 | text.Empty(); |
608 | - | |
609 | 606 | comm_name_edit_.GetWindowText(text); |
610 | 607 | comm.comm_name = text; |
611 | - product_list_.SetItemText(row_index, 2, text, comm.comm_id, wstr_2_str(product_id_)); | |
608 | + comm.product_id = product_id_; | |
612 | 609 | text.Empty(); |
613 | - | |
614 | 610 | price_edit_.GetWindowText(text); |
615 | 611 | price = _ttof(text); |
616 | 612 | comm.price = text; |
617 | - product_list_.SetItemText(row_index, 3, text, comm.comm_id); | |
618 | 613 | text.Empty(); |
619 | - | |
620 | 614 | count_edit_.GetWindowText(text); |
621 | 615 | count = _ttof(text); |
622 | 616 | comm.count = text; |
623 | - product_list_.SetItemText(row_index, 4, text, comm.comm_id); | |
624 | 617 | text.Empty(); |
625 | - | |
626 | 618 | real_unit_static.GetWindowText(text); |
627 | 619 | comm.unit = text; |
628 | - product_list_.SetItemText(row_index, 5, text, comm.comm_id); | |
629 | 620 | text.Empty(); |
630 | - | |
631 | 621 | heavy_edit_.GetWindowText(text); |
632 | 622 | comm.weight = text; |
633 | - product_list_.SetItemText(row_index, 6, text, comm.comm_id); | |
634 | 623 | text.Empty(); |
635 | 624 | |
636 | - text.Format(_T("%.1f"), price * count); | |
637 | - comm.total_money = text; | |
638 | - product_list_.SetItemText(row_index, 7, text, comm.comm_id); | |
625 | + double money = price * count * 100; | |
626 | + money = std::round(money) / 100; | |
639 | 627 | |
628 | + text.Format(_T("%.2f"), money); | |
629 | + comm.total_money = text; | |
640 | 630 | comm_vec_.push_back(comm); |
641 | - | |
642 | - for (int index = 0; index < 8; ++index) | |
631 | + | |
632 | + product_list_.DeleteAllItems(); | |
633 | + | |
634 | + InitList(); | |
635 | + | |
636 | + for (int index = 0; index != comm_vec_.size(); ++index) | |
643 | 637 | { |
644 | - product_list_.SetItemFormat(row_index, index, DT_CENTER | DT_VCENTER | DT_SINGLELINE); | |
638 | + int row_index = product_list_.InsertRow(L"", -1); | |
639 | + product_list_.SetItemText(row_index, 0, comm_vec_[index].seller_card, comm_vec_[index].comm_id); | |
640 | + product_list_.SetItemText(row_index, 1, comm_vec_[index].seller_name, comm_vec_[index].comm_id); | |
641 | + product_list_.SetItemText(row_index, 2, comm_vec_[index].comm_name, comm_vec_[index].comm_id, comm_vec_[index].product_id); | |
642 | + product_list_.SetItemText(row_index, 3, comm_vec_[index].price, comm_vec_[index].comm_id); | |
643 | + product_list_.SetItemText(row_index, 4, comm_vec_[index].count, comm_vec_[index].comm_id); | |
644 | + product_list_.SetItemText(row_index, 5, comm_vec_[index].unit, comm_vec_[index].comm_id); | |
645 | + product_list_.SetItemText(row_index, 6, comm_vec_[index].weight, comm_vec_[index].comm_id); | |
646 | + product_list_.SetItemText(row_index, 7, comm_vec_[index].total_money, comm_vec_[index].comm_id); | |
647 | + for (int index = 0; index < 8; ++index) | |
648 | + { | |
649 | + product_list_.SetItemFormat(row_index, index, DT_CENTER | DT_VCENTER | DT_SINGLELINE); | |
650 | + } | |
645 | 651 | } |
646 | - | |
652 | + | |
647 | 653 | EmptyCtrl(false); |
648 | 654 | SortList(); |
649 | 655 | |
... | ... | @@ -670,7 +676,7 @@ void PlaceOrderDlg::OnAcceleratorEnter() |
670 | 676 | { |
671 | 677 | pay_button_.EnableWindow(FALSE); |
672 | 678 | } |
673 | - | |
679 | + product_list_.Invalidate(TRUE); | |
674 | 680 | UpdateWindow(); |
675 | 681 | } |
676 | 682 | |
... | ... | @@ -713,11 +719,11 @@ LRESULT PlaceOrderDlg::OnEditKillFocus(WPARAM wParam, LPARAM lParam) |
713 | 719 | case IDC_EDIT_CARD: |
714 | 720 | { |
715 | 721 | CString name; |
716 | - /*if (text.GetLength() < 12) | |
722 | + if (text.IsEmpty()) | |
717 | 723 | { |
718 | - card_edit_.SetEditRed(true); | |
719 | - break; | |
720 | - }*/ | |
724 | + card_edit_.SetEditRed(true); | |
725 | + break; | |
726 | + } | |
721 | 727 | |
722 | 728 | bool result = GetCardName(text, name, 2); |
723 | 729 | if (result) |
... | ... | @@ -785,6 +791,10 @@ LRESULT PlaceOrderDlg::OnEditKillFocus(WPARAM wParam, LPARAM lParam) |
785 | 791 | { |
786 | 792 | break; |
787 | 793 | } |
794 | + else if(!(_ttof(text) > 0)) | |
795 | + { | |
796 | + ((CEditBox*)GetDlgItem(dlg_id))->SetEditRed(true); | |
797 | + } | |
788 | 798 | } |
789 | 799 | case IDC_EDIT_PRICE: |
790 | 800 | case IDC_EDIT_COUNT: |
... | ... | @@ -797,10 +807,16 @@ LRESULT PlaceOrderDlg::OnEditKillFocus(WPARAM wParam, LPARAM lParam) |
797 | 807 | { |
798 | 808 | ((CEditBox*)GetDlgItem(dlg_id))->SetEditRed(true); |
799 | 809 | } |
810 | + else if (!(_ttof(text) > 0)) | |
811 | + { | |
812 | + ((CEditBox*)GetDlgItem(dlg_id))->SetEditRed(true); | |
813 | + } | |
800 | 814 | else |
801 | 815 | { |
802 | 816 | ((CEditBox*)GetDlgItem(dlg_id))->SetEditRed(false); |
803 | 817 | } |
818 | + | |
819 | + | |
804 | 820 | |
805 | 821 | break; |
806 | 822 | } |
... | ... | @@ -870,6 +886,7 @@ bool PlaceOrderDlg::GetCardName(CString &num, CString &name, int type) |
870 | 886 | else |
871 | 887 | { |
872 | 888 | std::wstring error_msg = str_2_wstr(ptree.get<std::string>("message")); |
889 | + LOG_ERROR(error_msg); | |
873 | 890 | name = error_msg.c_str(); |
874 | 891 | result = false; |
875 | 892 | break; |
... | ... | @@ -888,7 +905,7 @@ bool PlaceOrderDlg::GetCardName(CString &num, CString &name, int type) |
888 | 905 | return result; |
889 | 906 | } |
890 | 907 | |
891 | -bool PlaceOrderDlg::GetCommName(CString &num, CString& card, CString &name, CString &product_id) | |
908 | +bool PlaceOrderDlg::GetCommName(CString &num, CString& card, CString &name, long &product_id) | |
892 | 909 | { |
893 | 910 | SetErrorMsg(CString(L"")); |
894 | 911 | bool result = true; |
... | ... | @@ -942,13 +959,13 @@ bool PlaceOrderDlg::GetCommName(CString &num, CString& card, CString &name, CStr |
942 | 959 | { |
943 | 960 | PT::ptree card_data = ptree.get_child("data"); |
944 | 961 | name = str_2_wstr(card_data.get<std::string>("name")).c_str(); |
945 | - long id = card_data.get<long>("id"); | |
946 | - product_id.Format(L"%ld", id); | |
962 | + product_id = card_data.get<long>("id"); | |
947 | 963 | } |
948 | 964 | else |
949 | 965 | { |
950 | - std::wstring error_msg = str_2_wstr(ptree.get<std::string>("message")); | |
951 | - error_msg = CString(error_msg.c_str()); | |
966 | + std::wstring err_msg = str_2_wstr(ptree.get<std::string>("message")); | |
967 | + LOG_ERROR(err_msg); | |
968 | + error_msg = CString(err_msg.c_str()); | |
952 | 969 | result = false; |
953 | 970 | break; |
954 | 971 | } |
... | ... | @@ -1210,6 +1227,8 @@ void PlaceOrderDlg::OnBnClickedButtonSwipCard() |
1210 | 1227 | else |
1211 | 1228 | { |
1212 | 1229 | SetErrorMsg(CString(L"")); |
1230 | + card_edit_.SetFocus(); | |
1231 | + card_edit_.SetSel(4, 4); | |
1213 | 1232 | } |
1214 | 1233 | |
1215 | 1234 | |
... | ... | @@ -1258,7 +1277,7 @@ afx_msg LRESULT PlaceOrderDlg::DeleteComm(WPARAM wParam, LPARAM lParam) |
1258 | 1277 | int row_index = product_list_.InsertRow(L"", -1); |
1259 | 1278 | product_list_.SetItemText(row_index, 0, comm_vec_[index].seller_card, comm_vec_[index].comm_id); |
1260 | 1279 | product_list_.SetItemText(row_index, 1, comm_vec_[index].seller_name, comm_vec_[index].comm_id); |
1261 | - product_list_.SetItemText(row_index, 2, comm_vec_[index].comm_name, comm_vec_[index].comm_id); | |
1280 | + product_list_.SetItemText(row_index, 2, comm_vec_[index].comm_name, comm_vec_[index].comm_id, comm_vec_[index].product_id); | |
1262 | 1281 | product_list_.SetItemText(row_index, 3, comm_vec_[index].price, comm_vec_[index].comm_id); |
1263 | 1282 | product_list_.SetItemText(row_index, 4, comm_vec_[index].count, comm_vec_[index].comm_id); |
1264 | 1283 | product_list_.SetItemText(row_index, 5, comm_vec_[index].unit, comm_vec_[index].comm_id); | ... | ... |
central_clearing_system/ETradeClient/mfc_ui/place_order_dlg.h
... | ... | @@ -27,6 +27,7 @@ class PlaceOrderDlg : public CDialogEx |
27 | 27 | struct CommInfo |
28 | 28 | { |
29 | 29 | int comm_id; |
30 | + long product_id; | |
30 | 31 | CString seller_card; |
31 | 32 | CString seller_name; |
32 | 33 | CString comm_name; |
... | ... | @@ -80,9 +81,7 @@ private: |
80 | 81 | bool GetUserName(CString &name); |
81 | 82 | void SetErrorMsg(CString &error); |
82 | 83 | 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 | - | |
84 | + bool GetCommName(CString &num, CString& card, CString &name, long &product_id); | |
86 | 85 | private: |
87 | 86 | CStatic owner_static_; |
88 | 87 | CEditBox card_edit_; |
... | ... | @@ -115,7 +114,7 @@ private: |
115 | 114 | |
116 | 115 | HACCEL acce_; |
117 | 116 | |
118 | - CString product_id_; | |
117 | + long product_id_; | |
119 | 118 | int buyer_card_type_; |
120 | 119 | |
121 | 120 | std::vector<CommInfo> comm_vec_; | ... | ... |
central_clearing_system/ETradeClient/utility/url_config.cpp
... | ... | @@ -192,4 +192,8 @@ std::string URLConfig::GetSubmitOrdersPath() const |
192 | 192 | std::string URLConfig::GetSellerCardPath() const |
193 | 193 | { |
194 | 194 | return m_get_seller_card_path; |
195 | +} | |
196 | +std::string URLConfig::GetFinishStatementPath() const | |
197 | +{ | |
198 | + return m_finish_order_path; | |
195 | 199 | } |
196 | 200 | \ No newline at end of file | ... | ... |
central_clearing_system/ETradeClient/utility/url_config.h
central_clearing_system/Resource.h
... | ... | @@ -86,6 +86,11 @@ |
86 | 86 | #define ID_ACCELERATOR_UP 32854 |
87 | 87 | #define ID_ACCELERATOR_DOWN 32855 |
88 | 88 | #define ID_ACCELERATOR_F11 32857 |
89 | +#define ID_ACCELERATOR_S 32883 | |
90 | +#define ID_ACCELERATOR_ALT_S 32884 | |
91 | +#define ID_ACCELERATOR_A 32885 | |
92 | +#define ID_ACCELERATOR_F 32886 | |
93 | +#define ID_ACCELERATOR_X 32887 | |
89 | 94 | #define ID_POINT_RULE 40001 |
90 | 95 | #define ID_CATEGORY_RULE 40002 |
91 | 96 | #define ID_AGREEMENT 40003 |
... | ... | @@ -101,7 +106,7 @@ |
101 | 106 | #ifdef APSTUDIO_INVOKED |
102 | 107 | #ifndef APSTUDIO_READONLY_SYMBOLS |
103 | 108 | #define _APS_NEXT_RESOURCE_VALUE 332 |
104 | -#define _APS_NEXT_COMMAND_VALUE 32883 | |
109 | +#define _APS_NEXT_COMMAND_VALUE 32889 | |
105 | 110 | #define _APS_NEXT_CONTROL_VALUE 1055 |
106 | 111 | #define _APS_NEXT_SYMED_VALUE 311 |
107 | 112 | #endif | ... | ... |
etrade_card_client/Config/menu_res_auth_cfg.json
... | ... | @@ -26,7 +26,7 @@ |
26 | 26 | {"res_id":50190, "auth_id":5517, "icon":"about.ico", "index":[3, 4]}, |
27 | 27 | {"res_id":4, "auth_id":60, "icon":"", "index":[4]}, |
28 | 28 | {"res_id":50180, "auth_id":6004, "icon":"customer_query.ico", "index":[4, 0]}, |
29 | - {"res_id":50190, "auth_id":6008, "icon":"oper_log_query.ico", "index":[4, 1]}, | |
29 | + {"res_id":50185, "auth_id":6008, "icon":"oper_log_query.ico", "index":[4, 1]}, | |
30 | 30 | {"res_id":50181, "auth_id":6009, "icon":"about.ico", "index":[4, 2]}, |
31 | 31 | {"res_id":5, "auth_id":70, "icon":"", "index":[5]}, |
32 | 32 | {"res_id":50182, "auth_id":7002, "icon":"about.ico", "index":[5, 0]}, | ... | ... |
etrade_card_client/ETradeClient.rc
etrade_card_client/resource.h
... | ... | @@ -58,12 +58,13 @@ |
58 | 58 | #define ID_CASH_WITHDRAW 50150 |
59 | 59 | #define ID_FEE_PAYMENT 50160 |
60 | 60 | #define ID_SETTLE_ACCOUNTS_APPLY 50170 |
61 | -#define ID_ACCOUNT_TRANSFER 50190 | |
62 | 61 | #define ID_CUSTOMER_QUERY 50180 |
62 | +#define ID_OPERATING_RECORD 50185 | |
63 | 63 | #define ID_CUS_MANAGE 50181 |
64 | 64 | #define ID_ETC_QUERY 50182 |
65 | 65 | #define ID_ETC_SERVICE 50183 |
66 | 66 | #define ID_KING_CARD 50184 |
67 | +#define ID_ACCOUNT_TRANSFER 50190 | |
67 | 68 | #define ID_OPER_LOG_QUERY 50190 |
68 | 69 | #define ID_INDICATOR_TIME 59142 |
69 | 70 | |
... | ... | @@ -72,7 +73,7 @@ |
72 | 73 | #ifdef APSTUDIO_INVOKED |
73 | 74 | #ifndef APSTUDIO_READONLY_SYMBOLS |
74 | 75 | #define _APS_NEXT_RESOURCE_VALUE 326 |
75 | -#define _APS_NEXT_COMMAND_VALUE 32840 | |
76 | +#define _APS_NEXT_COMMAND_VALUE 32842 | |
76 | 77 | #define _APS_NEXT_CONTROL_VALUE 1018 |
77 | 78 | #define _APS_NEXT_SYMED_VALUE 311 |
78 | 79 | #endif | ... | ... |