Commit fc8da7d0dbb5c76244f6d4f663a1090ef1e631d6

Authored by liuye
1 parent 917e2a45

feat<central-clearing-system>:新增分发打印功能,对部分菜单进行了修改

central_clearing_system/Config/menu_res_auth_cfg.json
... ... @@ -12,12 +12,15 @@
12 12 {"res_id":40002, "auth_id":102002, "icon":"cate_manage.ico", "index":[2, 1]},
13 13 {"res_id":40003, "auth_id":102003, "icon":"agreement.ico", "index":[2, 2]},
14 14 {"res_id":40004, "auth_id":102004, "icon":"consign_manage.ico", "index":[2, 3]},
15   - {"res_id":40005, "auth_id":102005, "icon":"credt.ico", "index":[2, 4]},
  15 + {"res_id":40006, "auth_id":102005, "icon":"buckle-list.ico", "index":[2, 4]},
  16 + {"res_id":40007, "auth_id":102006, "icon":"pay-black-list.ico", "index":[2, 5]},
  17 + {"res_id":40008, "auth_id":102007, "icon":"pay-white-list.ico", "index":[2, 6]},
16 18 {"res_id":5, "auth_id":1040, "icon":"", "index":[3]},
17 19 {"res_id":50001, "auth_id":104001, "icon":"user.ico", "index":[3, 0]},
18 20 {"res_id":50002, "auth_id":104002, "icon":"role.ico", "index":[3, 1]},
19 21 {"res_id":50003, "auth_id":104003, "icon":"para.ico", "index":[3, 2]},
20 22 {"res_id":50004, "auth_id":104004, "icon":"log.ico", "index":[3, 3]},
  23 + {"res_id":50005, "auth_id":104005, "icon":"pay-mode.ico", "index":[3, 4]},
21 24 {"res_id":11001, "auth_id":0, "icon":"exit.ico", "index":[]},
22 25 {"res_id":11002, "auth_id":0, "icon":"modify_account_pwd.ico", "index":[]}
23 26 ]
24 27 \ No newline at end of file
... ...
central_clearing_system/ETradeClient.rc
... ... @@ -95,7 +95,9 @@ BEGIN
95 95 MENUITEM "品类管理", ID_CATEGORY_RULE
96 96 MENUITEM "免密协议", ID_AGREEMENT
97 97 MENUITEM "代卖货管理", ID_TAPE_HANDLE
98   - MENUITEM "赊销授信管理", ID_CREDIT
  98 + MENUITEM "扣点白名单", ID_KOUDIAN_WHITE_LIST
  99 + MENUITEM "支付黑名单", ID_PAY_BLACK_LIST
  100 + MENUITEM "支付白名单", ID_PAY_WHITE_LIST
99 101 END
100 102 POPUP "系统设置"
101 103 BEGIN
... ... @@ -103,6 +105,7 @@ BEGIN
103 105 MENUITEM "角色管理", ID_ROLE_MANAGE
104 106 MENUITEM "参数设置", ID_PARAM_SET
105 107 MENUITEM "操作日志", ID_LOG
  108 + MENUITEM "支付方式管理", ID_PAY_MANAGE
106 109 END
107 110 END
108 111  
... ... @@ -281,8 +284,8 @@ END
281 284 //
282 285  
283 286 VS_VERSION_INFO VERSIONINFO
284   - FILEVERSION 2,0,0,9
285   - PRODUCTVERSION 2,0,0,9
  287 + FILEVERSION 2,0,0,10
  288 + PRODUCTVERSION 2,0,0,10
286 289 FILEFLAGSMASK 0x3fL
287 290 #ifdef _DEBUG
288 291 FILEFLAGS 0x1L
... ... @@ -299,12 +302,12 @@ BEGIN
299 302 BEGIN
300 303 VALUE "CompanyName", "地利集团【DILI GROUP】"
301 304 VALUE "FileDescription", "电子交易结算综合业务系统"
302   - VALUE "FileVersion", "2.0.0.9"
303   - VALUE "InternalName", "Central-Clearing-System_2.0.9.181109_Release"
  305 + VALUE "FileVersion", "2.0.0.10"
  306 + VALUE "InternalName", "Central-Clearing-System_2.0.10.181115_Release"
304 307 VALUE "LegalCopyright", "(C) 地利集团。 保留所有权利。"
305   - VALUE "OriginalFilename", "Central-Clearing-System_2.0.9.181109_Release"
306   - VALUE "ProductName", "Central-Clearing-System_2.0.9.181109_Release"
307   - VALUE "ProductVersion", "2.0.0.9"
  308 + VALUE "OriginalFilename", "Central-Clearing-System_2.0.10.181115_Release"
  309 + VALUE "ProductName", "Central-Clearing-System_2.0.10.181115_Release"
  310 + VALUE "ProductVersion", "2.0.0.10"
308 311 END
309 312 END
310 313 BLOCK "VarFileInfo"
... ...
central_clearing_system/ETradeClient/browser/async_js_callback_handler.cpp
... ... @@ -73,7 +73,7 @@ namespace HW
73 73 std::string file_id = ptree.get<std::string>(JSON_TAG_FILEID);
74 74  
75 75 std::string data;
76   - if (cmd.compare(JSON_VAL_CMD_PRINT) == 0 && file_id.compare(JSON_VAL_FILEID_ORDER) == 0)
  76 + if (cmd.compare(JSON_VAL_CMD_PRINT) == 0)
77 77 {
78 78 PT::ptree data_child = ptree.get_child(JSON_TAG_DATA);
79 79 std::ostringstream os;
... ... @@ -136,7 +136,7 @@ namespace HW
136 136 LOG_TRACE(L"Ö´ÐÐÓ²¼þµ÷ÓÃÇëÇó:" + str_2_wstr("[" + hw_req.cmd + "," + hw_req.file_id + "," + hw_req.seq + "]"));
137 137 HardwareCmd::Reply reply;
138 138 std::string answer = "";
139   -
  139 +
140 140 reply = m_hw_cmd_map.at(hw_req.cmd + hw_req.file_id).Execute(hw_req.data);
141 141  
142 142 if (boost::iequals(OK, reply.error_code)) // Succeed.
... ...
central_clearing_system/ETradeClient/hardware/hardware_cmd.cpp
... ... @@ -1254,17 +1254,6 @@ ReadPINPadCmd::Reply ReadDILIAndBankCardNumCmd::Execute(const std::string&amp; input
1254 1254 return reply;
1255 1255 }
1256 1256  
1257   -const CString StatementNoText = L"结算单号:";
1258   -const CString TradeTimeText = L"交易时间:";
1259   -const CString BuyerNameText = L"买家姓名:";
1260   -const CString SalerNameText = L"卖家姓名:";
1261   -const CString CommNameText = L"商品名称";
1262   -const CString PriceText = L"单价";
1263   -const CString CountText = L"数量";
1264   -const CString SubtotalText = L"小计/元";
1265   -const CString ClerkText = L"结算员:";
1266   -const CString TotalMoneyText = L"总计:";
1267   -
1268 1257  
1269 1258 StylusPrinterCmd::Reply StylusPrinterCmd::Execute(const std::string& input)
1270 1259 {
... ... @@ -1290,6 +1279,17 @@ StylusPrinterCmd::Reply StylusPrinterCmd::Execute(const std::string&amp; input)
1290 1279  
1291 1280 std::string StylusPrinterCmd::Print(std::vector<OrderInfo> &order_vector)
1292 1281 {
  1282 + const CString StatementNoText = L"结算单号:";
  1283 + const CString TradeTimeText = L"交易时间:";
  1284 + const CString BuyerNameText = L"买家姓名:";
  1285 + const CString SalerNameText = L"卖家姓名:";
  1286 + const CString CommNameText = L"商品名称";
  1287 + const CString PriceText = L"单价";
  1288 + const CString CountText = L"数量";
  1289 + const CString SubtotalText = L"小计/元";
  1290 + const CString ClerkText = L"结算员:";
  1291 + const CString TotalMoneyText = L"总计:";
  1292 +
1293 1293 HDC print_dc;
1294 1294 DOCINFO docin;
1295 1295  
... ... @@ -1624,4 +1624,255 @@ std::string DistributePrinterCmd::ParseInput(std::string &amp;input, std::vector&lt;Ord
1624 1624 result = StatusCode::PRINT_PARSE_DATA_FAILED;
1625 1625 }
1626 1626 return result;
  1627 +}
  1628 +
  1629 +DistributePrinterCmd::Reply DistributePrinterCmd::Execute(const std::string& input)
  1630 +{
  1631 + LOG_TRACE(L"开始打印");
  1632 + Reply reply;
  1633 + reply.error_code = StatusCode::OK;
  1634 +
  1635 + std::vector<OrderInfo> comm_vector;
  1636 + do
  1637 + {
  1638 + LOG_TRACE(L"解析打印数据!");
  1639 + reply.error_code = ParseInput(const_cast<std::string&>(input), comm_vector);
  1640 + if (reply.error_code.compare(StatusCode::OK) != 0)
  1641 + {
  1642 + break;
  1643 + }
  1644 + reply.error_code = Print(comm_vector);
  1645 + } while (0);
  1646 +
  1647 +
  1648 + return reply;
  1649 +}
  1650 +
  1651 +std::string DistributePrinterCmd::Print(std::vector<OrderInfo> &order_vector)
  1652 +{
  1653 + const CString RegistNoText = L"登记单号:";
  1654 + const CString PatchNoText = L"批次号:";
  1655 + const CString ShipNameText = L"货主姓名:";
  1656 + const CString SheetNoText = L"进门收费单号:";
  1657 + const CString CommNameText = L"商品名称";
  1658 + const CString CountText = L"数量";
  1659 + const CString PlaceText = L"产地";
  1660 + const CString BrandText = L"品牌";
  1661 + const CString DistributeMenText = L"分发员:";
  1662 + const CString DistributeTimeText = L"分发时间:";
  1663 + const CString SignText = L"客户签名:__________________";
  1664 +
  1665 + HDC print_dc;
  1666 + DOCINFO docin;
  1667 +
  1668 + //设置打印机相关参数
  1669 + docin.cbSize = sizeof(DOCINFO);
  1670 + docin.lpszDocName = L"ETrade";
  1671 + docin.lpszOutput = NULL;
  1672 + CPrintDialog print_dialog(TRUE, PD_ALLPAGES | PD_NOPAGENUMS, NULL);
  1673 + PRINTDLG *print_dlg_info = &print_dialog.m_pd;
  1674 + AfxGetApp()->GetPrinterDeviceDefaults(print_dlg_info);
  1675 + DEVMODE* lpDevMode = (DEVMODE*)::GlobalLock(print_dlg_info->hDevMode);
  1676 + if (!lpDevMode)
  1677 + {
  1678 + return StatusCode::PRINT_GET_MACHINE_DATA_FAILED;
  1679 + }
  1680 + ::GlobalUnlock(print_dlg_info->hDevMode);
  1681 + lpDevMode->dmFields |= -1;
  1682 + lpDevMode->dmPaperLength = 1397; //设定纸长为 139.7mm
  1683 + lpDevMode->dmPaperWidth = 2410; //设定纸宽为 241mm
  1684 + print_dc = print_dialog.CreatePrinterDC(); //返回一个打印DC句柄
  1685 + CDC *dc = new CDC;
  1686 + dc->Attach(print_dc);
  1687 + CFont title_font;
  1688 + title_font.CreatePointFont(350, L"宋体");
  1689 + CFont normal_font;
  1690 + normal_font.CreatePointFont(200, L"宋体");
  1691 + //
  1692 +
  1693 + const int FirstPageCommCount = 5; //如果有多页第一页商品数为6
  1694 + const int NormalPageCommCount = 10; //非第一页和最后一页,其他页的商品数目
  1695 + const int LastPageCommCount = 9; //最后一页最多商品数量
  1696 +
  1697 + const int TitleCtrlHIBig = 700; //表头不同组别控件横向间隔
  1698 + const int TitleCtrlHISmall = 150; //表头同组别控件横向间隔
  1699 + const int TitleCtrlVI = 50; //表头控件纵向间隔
  1700 + const int LineStartX = 100; //横线起点x坐标
  1701 + const int LineLength = 1600; //横线长度
  1702 + const int CommStartX = 200; //商品信息起始x坐标
  1703 + const int CommToLineVI = 30; //商品距横线纵向间隔
  1704 + const int NormalCommStartY = 40; //非第一页商品信息起始y坐标
  1705 + const int CommHI = 300; //商品信息横向间隔
  1706 + const int CommVI = 80; //商品信息纵向间隔
  1707 + const CPoint PagePoint(1200, 870); //页码坐标
  1708 + const CPoint TitleStartPoint(600, 50);//表名起始坐标
  1709 + const CPoint TitleCtrlStartPoint(100, 150);//表头控件起始坐标
  1710 +
  1711 + //开始打印
  1712 + StartDoc(print_dc, &docin); // 启动打印工作
  1713 + for (auto iter : order_vector)
  1714 + {
  1715 + //打印阶段单头部信息
  1716 + StartPage(print_dc);
  1717 +
  1718 + int y_point = TitleCtrlStartPoint.y;
  1719 + int x_point = TitleCtrlStartPoint.x;
  1720 +
  1721 + dc->SelectObject(&title_font);
  1722 + dc->TextOut(TitleStartPoint.x, TitleStartPoint.y, iter.title);
  1723 +
  1724 + dc->SelectObject(&normal_font);
  1725 + dc->TextOut(TitleCtrlStartPoint.x, TitleCtrlStartPoint.y, RegistNoText);
  1726 + x_point += TitleCtrlHISmall;
  1727 + dc->TextOut(x_point, y_point, iter.reg_id);
  1728 +
  1729 + x_point += TitleCtrlHIBig;
  1730 + dc->TextOut(x_point, y_point, PatchNoText);
  1731 + x_point += TitleCtrlHISmall;
  1732 + dc->TextOut(x_point - 20, y_point, iter.sheet_id);
  1733 +
  1734 + x_point = TitleCtrlStartPoint.x;
  1735 + y_point += TitleCtrlVI;
  1736 + dc->TextOut(x_point, y_point, ShipNameText);
  1737 + x_point += TitleCtrlHISmall;
  1738 + dc->TextOut(x_point, y_point, iter.seller_name);
  1739 +
  1740 + x_point += TitleCtrlHIBig;
  1741 + dc->TextOut(x_point, y_point, SheetNoText);
  1742 + x_point += TitleCtrlHISmall;
  1743 + dc->TextOut(x_point + 40, y_point, iter.entry_fee);
  1744 +
  1745 + y_point += TitleCtrlVI;
  1746 + dc->MoveTo(LineStartX, y_point);
  1747 + x_point += LineLength;
  1748 + dc->LineTo(x_point, y_point);
  1749 + //
  1750 +
  1751 + //打印商品信息头
  1752 + x_point = CommStartX;
  1753 + y_point += CommToLineVI;
  1754 + dc->TextOut(x_point, y_point, CommNameText);
  1755 + x_point += CommHI;
  1756 + dc->TextOut(x_point, y_point, CountText);
  1757 + x_point += CommHI;
  1758 + dc->TextOut(x_point, y_point, PlaceText);
  1759 + x_point += CommHI;
  1760 + dc->TextOut(x_point, y_point, BrandText);
  1761 + //
  1762 +
  1763 + //计算页数
  1764 + int comm_count = iter.comm_vector.size();
  1765 + int page_count = 0;
  1766 + if (comm_count <= FirstPageCommCount)
  1767 + {
  1768 + page_count = 1;
  1769 + }
  1770 + else
  1771 + {
  1772 + page_count = (comm_count - FirstPageCommCount - 1) / NormalPageCommCount + 2;
  1773 + }
  1774 + //
  1775 +
  1776 + CString pagination;//页码文本
  1777 +
  1778 + // 打印第一页
  1779 + int first_page_comm = page_count > 1 ? FirstPageCommCount + 1 : comm_count; //第一页不分页最多有5条商品,分页最多有6条商品
  1780 + int comm_index = 0;
  1781 + for (; comm_index < first_page_comm; ++comm_index)
  1782 + {
  1783 + y_point += CommVI;
  1784 + x_point = CommStartX;
  1785 + dc->TextOut(x_point, y_point, iter.comm_vector[comm_index].product_name);
  1786 + x_point += CommHI;
  1787 + dc->TextOut(x_point, y_point, iter.comm_vector[comm_index].amount);
  1788 + x_point += CommHI;
  1789 + dc->TextOut(x_point, y_point, iter.comm_vector[comm_index].place);
  1790 + x_point += CommHI;
  1791 + dc->TextOut(x_point, y_point, iter.comm_vector[comm_index].brand);
  1792 + }
  1793 +
  1794 + if (page_count > 1)
  1795 + {
  1796 + pagination.Format(L"%d/%d", 1, page_count);
  1797 + dc->TextOut(PagePoint.x, PagePoint.y, pagination);
  1798 + dc->EndPage();
  1799 + }
  1800 + //
  1801 +
  1802 + //打印除第一页和最后一页的其余页数
  1803 + for (int index = 1; index < page_count - 1; ++index)
  1804 + {
  1805 + StartPage(print_dc);
  1806 + y_point = NormalCommStartY;
  1807 + for (int comm = 0; comm < NormalPageCommCount; ++comm, ++comm_index)
  1808 + {
  1809 + x_point = CommStartX;
  1810 + dc->TextOut(x_point, y_point, iter.comm_vector[comm_index].product_name);
  1811 + x_point += CommHI;
  1812 + dc->TextOut(x_point, y_point, iter.comm_vector[comm_index].amount);
  1813 + x_point += CommHI;
  1814 + dc->TextOut(x_point, y_point, iter.comm_vector[comm_index].place);
  1815 + x_point += CommHI;
  1816 + dc->TextOut(x_point, y_point, iter.comm_vector[comm_index].brand);
  1817 + y_point += CommVI;
  1818 + }
  1819 + pagination.Format(L"%d/%d", index + 1, page_count);
  1820 + dc->TextOut(PagePoint.x, PagePoint.y, pagination);
  1821 + dc->EndPage();
  1822 + }
  1823 + //
  1824 +
  1825 + //打印最后一页
  1826 + if (page_count > 1)
  1827 + {
  1828 + StartPage(print_dc);
  1829 + y_point = NormalCommStartY;
  1830 + for (; comm_index < comm_count; ++comm_index)
  1831 + {
  1832 + x_point = CommStartX;
  1833 + dc->TextOut(x_point, y_point, iter.comm_vector[comm_index].product_name);
  1834 + x_point += CommHI;
  1835 + dc->TextOut(x_point, y_point, iter.comm_vector[comm_index].amount);
  1836 + x_point += CommHI;
  1837 + dc->TextOut(x_point, y_point, iter.comm_vector[comm_index].place);
  1838 + x_point += CommHI;
  1839 + dc->TextOut(x_point, y_point, iter.comm_vector[comm_index].brand);
  1840 + y_point += CommVI;
  1841 + }
  1842 + }
  1843 +
  1844 + x_point = LineStartX;
  1845 + y_point += CommVI;
  1846 + dc->MoveTo(x_point, y_point);
  1847 + x_point += LineLength;
  1848 + dc->LineTo(x_point, y_point);
  1849 +
  1850 + x_point = TitleCtrlStartPoint.x;
  1851 + y_point += CommToLineVI;
  1852 + dc->TextOut(x_point, y_point, DistributeMenText);
  1853 + x_point += TitleCtrlHISmall;
  1854 + dc->TextOut(x_point - 30, y_point, iter.dis_name);
  1855 +
  1856 + x_point += TitleCtrlHIBig / 3;
  1857 + dc->TextOut(x_point, y_point, DistributeTimeText);
  1858 + x_point += TitleCtrlHISmall;
  1859 + dc->TextOut(x_point, y_point, iter.dis_date);
  1860 +
  1861 + x_point += TitleCtrlHIBig * 2 / 3;
  1862 + dc->TextOut(x_point, y_point, SignText);
  1863 +
  1864 + pagination.Format(L"%d/%d", page_count, page_count);
  1865 + dc->TextOut(PagePoint.x, PagePoint.y, pagination);
  1866 +
  1867 + EndPage(print_dc);
  1868 + }
  1869 +
  1870 + title_font.DeleteObject();
  1871 + normal_font.DeleteObject();
  1872 +
  1873 + EndDoc(print_dc);//结束打印
  1874 + DeleteDC(print_dc);
  1875 + delete dc;
  1876 +
  1877 + return StatusCode::OK;
1627 1878 }
1628 1879 \ No newline at end of file
... ...
central_clearing_system/ETradeClient/mfc_ui/MainFrm.cpp
... ... @@ -82,7 +82,7 @@ BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
82 82 ON_COMMAND(ID_MODIFY_PASSWORD, OnModifyPwd)
83 83 ON_UPDATE_COMMAND_UI(USER_MESSAGE, &CMainFrame::OnUpdateToolBarMsgCount)
84 84  
85   - ON_COMMAND_RANGE(ID_ORDER, ID_LOG, OnMenuBtnClicked)
  85 + ON_COMMAND_RANGE(ID_ORDER, ID_PAY_MANAGE, OnMenuBtnClicked)
86 86 ON_COMMAND_RANGE(RELOAD, HOMEPAGE, OnToolBarBtnClicked)
87 87  
88 88 ON_MESSAGE(WM_CEF_SESSION_EXPIRED, OnSessionExpired)
... ...
central_clearing_system/Resource.h
... ... @@ -92,23 +92,59 @@
92 92 #define ID_ACCELERATOR_F 32886
93 93 #define ID_ACCELERATOR_X 32887
94 94 #define ID_ACCELERATOR_A 32895
95   -#define ID_ACCELERATOR32896 32896
  95 +
96 96 #define ID_POINT_RULE 40001
97 97 #define ID_CATEGORY_RULE 40002
98 98 #define ID_AGREEMENT 40003
99 99 #define ID_TAPE_HANDLE 40004
100 100 #define ID_CREDIT 40005
  101 +#define ID_KOUDIAN_WHITE_LIST 40006
  102 +#define ID_PAY_BLACK_LIST 40007
  103 +
  104 +
  105 +
  106 +
  107 +
  108 +
  109 +
  110 +
  111 +
  112 +
  113 +
  114 +
  115 +
  116 +
  117 +
  118 +
  119 +
  120 +
  121 +
  122 +
  123 +
  124 +
  125 +
  126 +
  127 +
  128 +
  129 +
  130 +
  131 +
  132 +
  133 +
  134 +
  135 +#define ID_PAY_WHITE_LIST 40008
101 136 #define ID_USER_MANAGE 50001
102 137 #define ID_ROLE_MANAGE 50002
103 138 #define ID_PARAM_SET 50003
104 139 #define ID_LOG 50004
  140 +#define ID_PAY_MANAGE 50005
105 141  
106 142 // Next default values for new objects
107 143 //
108 144 #ifdef APSTUDIO_INVOKED
109 145 #ifndef APSTUDIO_READONLY_SYMBOLS
110 146 #define _APS_NEXT_RESOURCE_VALUE 333
111   -#define _APS_NEXT_COMMAND_VALUE 32898
  147 +#define _APS_NEXT_COMMAND_VALUE 32907
112 148 #define _APS_NEXT_CONTROL_VALUE 1055
113 149 #define _APS_NEXT_SYMED_VALUE 311
114 150 #endif
... ...
central_clearing_system/Resource/Menu/buckle-list.ico 0 → 100644
No preview for this file type
central_clearing_system/Resource/Menu/pay-black-list.ico 0 → 100644
No preview for this file type
central_clearing_system/Resource/Menu/pay-mode.ico 0 → 100644
No preview for this file type
central_clearing_system/Resource/Menu/pay-white-list.ico 0 → 100644
No preview for this file type