using Muchinfo.MTPClient.Data.Helper; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Muchinfo.MTPClient.Data.Enums { // // 菜单总集合及ResourceCode // public class eSystemMenuValue { private volatile static eSystemMenuValue _instance = null; private static readonly object lockHelper = new object(); // // The menu // public Dictionary menu; // // The fixed menu list // public List fixedMenuList; private List _serviceMenus; /// /// 私有构造函数,初始化功能菜单 /// private eSystemMenuValue() { //初始化本地菜单配置 InitLocalFixedMenus(); //初始化服务端菜单配置 InitServiceMenus(); //根据本地菜单及服务端菜单初始化全部菜单字典 InitAllMenus(); } #region MTP2.0 /// /// 初始化本地固定菜单-根据资管菜单配置 /// private void InitLocalFixedMenus() { //交易-本地固定菜单使用L开头 var tradeMenuCode = "L00100000000"; //公告通知-本地固定菜单使用M开头 var noticeInfoMenuCode = "L00200000000"; fixedMenuList = new List() { new SysMenuItem("交易", MenuCommandType.Trade)// : 界面改版后。这里的买入卖出不需要了 { FuncMenuCode = tradeMenuCode, SortId = -9999, Children = new List() { new SysMenuItem("买入", MenuCommandType.BuyIn){ParentFuncMenuCode =tradeMenuCode , FuncMenuCode ="L00100010000"}, new SysMenuItem("卖出", MenuCommandType.Sellout){ParentFuncMenuCode =tradeMenuCode , FuncMenuCode ="L00100020000"}, new SysMenuItem("撤单", MenuCommandType.Cancel){ParentFuncMenuCode =tradeMenuCode , FuncMenuCode ="L00100030000"}, } }, //new SysMenuItem("公告通知", MenuCommandType.NoticeInform) //{ // FuncMenuCode = noticeInfoMenuCode, // SortId = 9999, // Children = new List() // { // new SysMenuItem("公告", MenuCommandType.Notice){ParentFuncMenuCode =tradeMenuCode , FuncMenuCode ="L00200010000"}, // } //}, }; } /// /// 初始化服务端配置菜单-根据资管菜单配置 /// private void InitServiceMenus() { //查询-服务配置菜单使用T开头 var queryMenuCode = "T00500000000"; //报表-服务配置菜单使用T开头 var reportMenuCode = "T01500000000"; _serviceMenus = new List() { new SysMenuItem("查询", MenuCommandType.Query) { FuncMenuCode = queryMenuCode, Children = new List() { new SysMenuItem("交易汇总", MenuCommandType.TradeSum){ParentFuncMenuCode =queryMenuCode , FuncMenuCode ="T00500110000"}, new SysMenuItem("账户资金", MenuCommandType.AccountInfo){ParentFuncMenuCode =queryMenuCode , FuncMenuCode ="T00500120000"}, new SysMenuItem("资金流水", MenuCommandType.QueryAmountLog){ParentFuncMenuCode =queryMenuCode , FuncMenuCode ="T00500160000"}, new SysMenuItem("委托单", MenuCommandType.EntrustOrder){ParentFuncMenuCode =queryMenuCode , FuncMenuCode ="T00500130000"}, new SysMenuItem("成交明细", MenuCommandType.TransactionOrder){ParentFuncMenuCode =queryMenuCode , FuncMenuCode ="T00500140000"}, new SysMenuItem("持仓汇总", MenuCommandType.Position){ParentFuncMenuCode =queryMenuCode , FuncMenuCode ="T00500150000"}, //new SysMenuItem("止盈止损", MenuCommandType.SPSLOrder){ParentFuncMenuCode =queryMenuCode , FuncMenuCode ="T00500170000"}, } }, //new SysMenuItem("报表", MenuCommandType.Report) //{ // FuncMenuCode = reportMenuCode, // Children = new List() // { // new SysMenuItem("结算单", MenuCommandType.ReckonReport){ParentFuncMenuCode =reportMenuCode , FuncMenuCode ="T01500010000"}, // } //}, }; } /// /// 根据本地菜单及服务端菜单初始化全部菜单字典 /// private void InitAllMenus() { menu = new Dictionary(); foreach (var item in fixedMenuList) { menu.Add(item.SysCommandType, item.FuncMenuCode); if (item.Children == null) continue; foreach (var subItem in item.Children) { menu.Add(subItem.SysCommandType, subItem.FuncMenuCode); } } foreach (var item in _serviceMenus) { menu.Add(item.SysCommandType, item.FuncMenuCode); if (item.Children == null) continue; foreach (var subItem in item.Children) { menu.Add(subItem.SysCommandType, subItem.FuncMenuCode); } } } #endregion #region MTP1.0 private void InitMenus() { #region ///交易 menu.Add(MenuCommandType.Trade, "T00100000000"); var tradeMenu = new SysMenuItem("交易", MenuCommandType.Trade) { FuncMenuCode = "T00100000000", Children = new List() }; ///买入 menu.Add(MenuCommandType.BuyIn, "T00100010000"); var buyinMenu = new SysMenuItem("买入", MenuCommandType.BuyIn) { ParentFuncMenuCode = "T00100000000", FuncMenuCode = "T00100010000", Children = new List() }; tradeMenu.Children.Add(buyinMenu); ///卖出 menu.Add(MenuCommandType.Sellout, "T00100020000"); var selloutMenu = new SysMenuItem("卖出", MenuCommandType.Sellout) { ParentFuncMenuCode = "T00100000000", FuncMenuCode = "T00100020000", Children = new List() }; tradeMenu.Children.Add(selloutMenu); ///撤单 menu.Add(MenuCommandType.Cancel, "T00100030000"); var cancelMenu = new SysMenuItem("撤单", MenuCommandType.Cancel) { ParentFuncMenuCode = "T00100000000", FuncMenuCode = "T00100030000", Children = new List() }; tradeMenu.Children.Add(cancelMenu); ///协议转让 menu.Add(MenuCommandType.DealClose, "T00100040000"); fixedMenuList.Add(tradeMenu); #endregion #region ///查询 menu.Add(MenuCommandType.Query, "T00200000000"); var queryMenu = new SysMenuItem("查询", MenuCommandType.Query) { FuncMenuCode = "T00200000000", Children = new List() }; /// 交易汇总 menu.Add(MenuCommandType.TradeSum, "T00200010001"); var TradeSumMenu = new SysMenuItem("交易汇总", MenuCommandType.TradeSum) { ParentFuncMenuCode = "T00200000000", FuncMenuCode = "T00200010001", Children = new List() }; queryMenu.Children.Add(TradeSumMenu); ///资金信息 menu.Add(MenuCommandType.AccountInfo, "T00200010000"); var accountInfoMenu = new SysMenuItem("资金信息", MenuCommandType.AccountInfo) { ParentFuncMenuCode = "T00200000000", FuncMenuCode = "T00200010000", Children = new List() }; queryMenu.Children.Add(accountInfoMenu); ///委托单 menu.Add(MenuCommandType.EntrustOrder, "T00200020000"); var entrustOrderMenu = new SysMenuItem("委托单", MenuCommandType.EntrustOrder) { ParentFuncMenuCode = "T00200000000", FuncMenuCode = "T00200020000", Children = new List() }; queryMenu.Children.Add(entrustOrderMenu); ///持仓汇总 menu.Add(MenuCommandType.Position, "T00200030000"); var holdDetailsMenu = new SysMenuItem("持仓汇总", MenuCommandType.Position) { ParentFuncMenuCode = "T00200000000", FuncMenuCode = "T00200030000", Children = new List() }; queryMenu.Children.Add(holdDetailsMenu); ///预埋单 menu.Add(MenuCommandType.PrePostOrder, "T00200040000"); ///成交明细 menu.Add(MenuCommandType.TransactionOrder, "T00200050000"); var transactionOrderMenu = new SysMenuItem("成交明细", MenuCommandType.TransactionOrder) { ParentFuncMenuCode = "T00200000000", FuncMenuCode = "T00200050000", Children = new List() }; queryMenu.Children.Add(transactionOrderMenu); ///资金流水 menu.Add(MenuCommandType.QueryAmountLog, "T00200060000"); var queryAmountLogMenu = new SysMenuItem("资金流水", MenuCommandType.QueryAmountLog) { ParentFuncMenuCode = "T00200000000", FuncMenuCode = "T00200060000", Children = new List() }; queryMenu.Children.Add(queryAmountLogMenu); //日报表 menu.Add(MenuCommandType.DayReport, "T00200070000"); var dayReportMenu = new SysMenuItem("日报表", MenuCommandType.DayReport) { ParentFuncMenuCode = "T00200000000", FuncMenuCode = "T00200070000", Children = new List() }; queryMenu.Children.Add(dayReportMenu); ///操作日志 menu.Add(MenuCommandType.OperationLog, "T00200080000"); var operationLogMenu = new SysMenuItem("操作日志", MenuCommandType.OperationLog) { ParentFuncMenuCode = "T00200000000", FuncMenuCode = "T00200080000", Children = new List() }; queryMenu.Children.Add(operationLogMenu); fixedMenuList.Add(queryMenu); #endregion #region ///仓单管理 menu.Add(MenuCommandType.WarehouseManagement, "T00300000000"); ///仓单 menu.Add(MenuCommandType.WarehouseSearch, "T00300010000"); ///提货单 menu.Add(MenuCommandType.TakaDeliveryGoodsQuery, "T00300020000"); #endregion #region ///交割管理 menu.Add(MenuCommandType.DeliveryManage, "T00800000000"); ///申报单 menu.Add(MenuCommandType.DeliveryDeclarationSearch, "T00800010000"); ///购销合同 menu.Add(MenuCommandType.DeliveryOrderSearch, "T00800020000"); #endregion #region ///公告通知 menu.Add(MenuCommandType.NoticeInform, "T00500000000"); var noticeInformMenu = new SysMenuItem("公告通知", MenuCommandType.NoticeInform) { FuncMenuCode = "T00500000000", Children = new List() }; ///公告 menu.Add(MenuCommandType.Notice, "T00500010000"); var noticeMenu = new SysMenuItem("公告", MenuCommandType.Notice) { ParentFuncMenuCode = "T00500000000", FuncMenuCode = "T00500010000", Children = new List() }; noticeInformMenu.Children.Add(noticeMenu); fixedMenuList.Add(noticeInformMenu); #endregion #region ///银行业务 menu.Add(MenuCommandType.Apply, "T00600000000"); var applyMenu = new SysMenuItem("银行业务", MenuCommandType.Apply) { FuncMenuCode = "T00600000000", Children = new List() }; ///出金申请 menu.Add(MenuCommandType.AmountOutApply, "T00600010000"); var amountOutApplyMenu = new SysMenuItem("出金申请", MenuCommandType.AmountOutApply) { ParentFuncMenuCode = "T00600000000", FuncMenuCode = "T00600010000", Children = new List() }; applyMenu.Children.Add(amountOutApplyMenu); ///入金申请 menu.Add(MenuCommandType.AmountInApply, "T00600020000"); var amountInApplyMenu = new SysMenuItem("入金申请", MenuCommandType.AmountInApply) { ParentFuncMenuCode = "T00600000000", FuncMenuCode = "T00600020000", Children = new List() }; applyMenu.Children.Add(amountInApplyMenu); ///出入金查询 menu.Add(MenuCommandType.AmountQuety, "T00600030000"); var amountQuetyMenu = new SysMenuItem("出入金查询", MenuCommandType.AmountQuety) { ParentFuncMenuCode = "T00600000000", FuncMenuCode = "T00600030000", Children = new List() }; applyMenu.Children.Add(amountQuetyMenu); ///签约信息/银行签约 menu.Add(MenuCommandType.BankSign, "T00600040000"); var bankSignMenu = new SysMenuItem("签约信息", MenuCommandType.BankSign) { ParentFuncMenuCode = "T00600000000", FuncMenuCode = "T00600040000", Children = new List() }; applyMenu.Children.Add(bankSignMenu); ///银行解约 menu.Add(MenuCommandType.BankBreak, "T00600050000"); var bankBreakMenu = new SysMenuItem("银行解约", MenuCommandType.BankBreak) { ParentFuncMenuCode = "T00600000000", FuncMenuCode = "T00600050000", Children = new List() }; applyMenu.Children.Add(bankBreakMenu); //资管注释“银行业务” fixedMenuList.Add(applyMenu); #endregion } #endregion /// /// 单例实例 /// /// eSystemMenuValue. public static eSystemMenuValue CreateInstance() { if (_instance == null) { lock (lockHelper) { if (_instance == null) { _instance = new eSystemMenuValue(); } } } return _instance; } } }