Beispiel #1
0
        public static void OntfcomRcvMessage(object sender, PackageBase package)
        {
            StringBuilder sbtmp = new StringBuilder();

            switch ((DT)package.DT)
            {
            case DT.LOGIN:
                P001503 p1503 = (P001503)package;
                if (p1503.Code != 0)
                {
                    AddInfo("登入失敗 CODE = " + p1503.Code + " " + tfcom.GetMessageMap(p1503.Code));
                }
                else
                {
                    if (p1503.p001503_2.Length > 0)
                    {
                        brokerid = p1503.p001503_2[0].BrokeId;
                        account  = p1503.p001503_2[0].Account;
                    }
                    AddInfo("登入成功 ");
                }
                break;

            case DT.SECU_ALLOWANCE_RPT:       //子帳額度控管: 回補
                PT05002 p5002 = (PT05002)package;
                AddInfo(p5002.ToLog());
                break;

            case DT.SECU_ALLOWANCE:
                PT05003 p5003 = (PT05003)package;
                AddInfo(p5003.ToLog());
                break;

                #region 證券下單回報
            case DT.SECU_ORDER_ACK:       //下單第二回覆

                PT04002 p4002 = (PT04002)package;
                AddInfo(p4002.ToLog() + "訊息:" + tfcom.GetMessageMap(p4002.ErrorCode));
                break;

            case DT.SECU_ORDER_RPT:     //委託回報

                PT04010 p4010 = (PT04010)package;
                AddInfo("RCV 4010 [" + p4010.CNT + "," + p4010.OrderNo + "]");
                // "委託型態", "分公司代號", "帳號", "綜合帳戶", "營業員代碼",                                                                                     "委託書號",            "交易日期",             "回報時間",           "委託日期時間",            "商品代號", "下單序號",             "委託來源別",                     "市場別",                        "買賣",                    "委託別",                         "委託種類",                      "委託價格",    "改量前數量",              "改量後數量",    "錯誤代碼", "錯誤訊息"
                string[] row4010 = { p4010.OrderFunc.ToString(), p4010.BrokerId, p4010.Account, p4010.SubAccount, p4010.OmniAccount, p4010.AgentId, p4010.OrderNo, p4010.TradeDate, p4010.ReportTime, p4010.ClientOrderTime, p4010.StockID, p4010.CNT, p4010.Channel.ToString(), p4010.Market.ToString(), p4010.Side.ToString(), p4010.OrdLot.ToString(), p4010.OrdClass.ToString(), p4010.Price, p4010.BeforeQty, p4010.AfterQty, p4010.ErrCode, p4010.ErrMsg };
                AddInfo(string.Join(",", row4010));
                break;

            case DT.SECU_DEAL_RPT:       //成交回報

                PT04011 p4011 = (PT04011)package;
                AddInfo("RCV 4011 [" + p4011.CNT + "]");
                //                            "委託型態",                             "分公司代號", "帳號",              "綜合帳戶", "營業員代碼",                  "委託書號",              "交易日期",               "回報時間", "電子單號",     "來源別",                          "市場別",                         "商品代碼",            "買賣別",             "委託別",                            ",委託種類",                          "成交價格", "成交數量", "市場成交序號"
                string[] row4011 = { p4011.OrderFunc.ToString(), p4011.BrokerId, p4011.Account, p4011.SubAccount, p4011.OmniAccount, p4011.AgentId, p4011.OrderNo, p4011.TradeDate, p4011.ReportTime, p4011.CNT, p4011.Channel.ToString(), p4011.Market.ToString(), p4011.StockID, p4011.Side.ToString(), p4011.OrdLot.ToString(), p4011.OrdClass.ToString(), p4011.Price, p4011.DealQty, p4011.MarketNo };
                AddInfo(string.Join(",", row4011));
                break;
                #endregion
            }
        }
Beispiel #2
0
        private void OnTradeRcvMessage(object sender, PackageBase package)
        {
            if (this.InvokeRequired)
            {
                Smart.OnRcvMessage_EventHandler d = new Smart.OnRcvMessage_EventHandler(OnTradeRcvMessage);
                this.Invoke(d, new object[] { sender, package });
                return;
            }
            StringBuilder sbtmp = new StringBuilder();

            switch ((DT)package.DT)
            {
            case DT.LOGIN:      // Bona登入
                P001503 p1503 = (P001503)package;
                if (p1503.Code != 0)
                {
                    AddInfo("登入失敗 CODE = " + p1503.Code + " " + tfcom.GetMessageMap(p1503.Code));
                }
                else
                {
                    AddInfo("登入成功 ");
                    AddInfo("Yo:" + p1503.p001503_2[0].BrokeId + ":" + p1503.p001503_2[0].Account);
                }
                break;

            case DT.SECU_ALLOWANCE_RPT:       //子帳額度控管: 回補
                PT05002 p5002 = (PT05002)package;
                AddInfo(p5002.ToLog());
                break;

            case DT.SECU_ALLOWANCE:
                PT05003 p5003 = (PT05003)package;
                AddInfo(p5003.ToLog());
                break;

                #region 證券下單回報
            case DT.SECU_ORDER_ACK:       //下單第二回覆
//                    if (!cbShowUI.Checked) break;
                PT04002 p4002 = (PT04002)package;
                AddInfo(p4002.ToLog() + "訊息:" + tfcom.GetMessageMap(p4002.ErrorCode));
                break;

            case DT.SECU_ORDER_RPT:     // Bona委託回報
//                    if (!cbShowUI.Checked) break;
                PT04010 p4010 = (PT04010)package;
                AddInfo("RCV 4010 [" + p4010.CNT + "," + p4010.OrderNo + "]");
                // "委託型態", "分公司代號", "帳號", "綜合帳戶", "營業員代碼",                                                                                     "委託書號",            "交易日期",             "回報時間",           "委託日期時間",            "商品代號", "下單序號",             "委託來源別",                     "市場別",                        "買賣",                    "委託別",                         "委託種類",                      "委託價格",    "改量前數量",              "改量後數量",    "錯誤代碼", "錯誤訊息"
                string[] row4010 = { p4010.OrderFunc.ToString(), p4010.BrokerId, p4010.Account, p4010.SubAccount, p4010.OmniAccount, p4010.AgentId, p4010.OrderNo, p4010.TradeDate, p4010.ReportTime, p4010.ClientOrderTime, p4010.StockID, p4010.CNT, p4010.Channel.ToString(), p4010.Market.ToString(), p4010.Side.ToString(), p4010.OrdLot.ToString(), p4010.OrdClass.ToString(), p4010.Price, p4010.BeforeQty, p4010.AfterQty, p4010.ErrCode, p4010.ErrMsg };
//                    dgv4010.Rows.Add(row4010);
                break;

            case DT.SECU_DEAL_RPT:       //成交回報
//                    if (!cbShowUI.Checked) break;
                PT04011 p4011 = (PT04011)package;
                AddInfo("RCV 4011 [" + p4011.CNT + "]");
                //                            "委託型態",                             "分公司代號", "帳號",              "綜合帳戶", "營業員代碼",                  "委託書號",              "交易日期",               "回報時間", "電子單號",     "來源別",                          "市場別",                         "商品代碼",            "買賣別",             "委託別",                            ",委託種類",                          "成交價格", "成交數量", "市場成交序號"
                string[] row4011 = { p4011.OrderFunc.ToString(), p4011.BrokerId, p4011.Account, p4011.SubAccount, p4011.OmniAccount, p4011.AgentId, p4011.OrderNo, p4011.TradeDate, p4011.ReportTime, p4011.CNT, p4011.Channel.ToString(), p4011.Market.ToString(), p4011.StockID, p4011.Side.ToString(), p4011.OrdLot.ToString(), p4011.OrdClass.ToString(), p4011.Price, p4011.DealQty, p4011.MarketNo };
//                    dgv4011.Rows.Add(row4011);
                break;
                #endregion

                #region 證券複委託回報  <2015.11 Add >
            case DT.SECU_SUBORDER_ACK:       //下單第二回覆
//                    if (!cbShowUI.Checked) break;
                PT04102 p4102 = (PT04102)package;
                sbtmp.Append("[RCV 4102]").Append(" RequestId=").Append("" + p4102.RequestId)
                .Append(";CNT=").Append(p4102.CNT)
                .Append(";WEBID=").Append(p4102.WEBID)
                .Append(";Code=").Append("" + p4102.Code)
                //.Append(";CustomerID=").Append(p4102.CustomerID)
                .Append(";SeqNum=").Append(p4102.SeqNum)
                .Append(";OrdgSeqNum=").Append(p4102.OrdgSeqNum)
                .Append(";OrderNo=").Append(p4102.OrderNo)
                .Append(";ErrCode=").Append(p4102.ErrCode)
                .Append(";ErrMsg=").Append(p4102.ErrMsg);
                //AddInfo("RCV 4102 [" + p4102.RequestId + "," + p4102.WEBID + "," +  "]");
                AddInfo(sbtmp.ToString());
                break;

            case DT.SECU_SUBORDER_RPT:     //委託回報
//                    if (!cbShowUI.Checked) break;
                PT04110 p4110 = (PT04110)package;
                AddInfo("RCV 4110 [ SeqNo=" + p4110.SeqNo + " OrderNO=" + p4110.OrderNo + " OrgSeqNo=" + p4110.OrgSeqNo + "]");
                //"委託型態",            "客戶帳號",             "客戶姓名",                "委託書號",           "交易日期",           "市場別",         "商品代號",           "商品名稱",          "買賣別",                   "幣別",            "價格",          "數量",        "成交/改單數量", "成交狀態",        "成交數量",      "委託狀態",       " 委託序號",   "原始委託序號",       "接單方式",                "錯誤代碼",            "錯誤訊息",         "下單IP", "下單管道",         "通路別",            "建立日期"
                string[] row4110 = { p4110.OrderFunc, p4110.CustomerId, p4110.CustomerName, p4110.OrderNo, p4110.TradeDate, p4110.Market, p4110.Symbol, p4110.SymbolName, p4110.BS.ToString(), p4110.Currency, p4110.Price, p4110.Qty, p4110.Qty2, p4110.ExeStatus, p4110.ExeQty, p4110.Status, p4110.SeqNo, p4110.OrgSeqNo, p4110.OrderMethod, p4110.ErrorCode, p4110.ErrorMsg, p4110.IP, p4110.SystemID, p4110.Channel, p4110.CreateDate };
//                    dgv4110.Rows.Add(row4110);
                break;

            case DT.SECU_SUBDEAL_RPT:       //成交回報
//                    if (!cbShowUI.Checked) break;
                PT04111 p4111 = (PT04111)package;
                AddInfo("RCV 4111 [" + p4111.OrderNo + "]");
                //                            "客戶帳號",               "客戶姓名",               "交易日期",                "市場別",        "商品代碼",       "商品名稱",             "委託價格",    "委託數量", "成交價格",             "成交數量",         "委託書號",         "成交序號",         "下單管道",         "通路別"
                string[] row4111 = { p4111.CustomerId, p4111.CustomerName, p4111.TradeDate, p4111.Market, p4111.Symbol, p4111.SymbolName, p4111.Price, p4111.Qty, p4111.MatchPrice, p4111.MatchQty, p4111.OrderNo, p4111.MatchNo, p4111.SystemID, p4111.Channel };
//                    dgv4111.Rows.Add(row4111);
                break;

                #endregion
                #region 複委託帳務查詢
            case DT.FINANCIAL_RCORDER:                    //4113. 複委託委託查詢
                PT04113 p4113 = (PT04113)package;
                AddInfo("RCV 4113 [" + p4113.Code + "][" + p4113.CodeDesc + "][ 筆數:" + p4113.Rows + "]");
                if (p4113.Code == 0)
                {
//                        dgvRCQuery.DataSource = p4113.Detail;
//                        SetGridHeader(4113);
                }
                break;

            case DT.FINANCIAL_RCMATCHSUM:             //4115. 複委託成交彙總查詢

                PT04115 p4115 = (PT04115)package;
                AddInfo("RCV 4115 [" + p4115.Code + "][" + p4115.CodeDesc + "][ 筆數:" + p4115.Rows + "]");
                if (p4115.Code == 0)
                {
//                        dgvRCQuery.DataSource = p4115.Detail;
//                        SetGridHeader(4115);
                }
                break;

            case DT.FINANCIAL_RCMATCHDETAIL:          //4117. 複委託成交明細查詢
                PT04117 p4117 = (PT04117)package;
                AddInfo("RCV 4117 [" + p4117.Code + "][" + p4117.CodeDesc + "][ 筆數:" + p4117.Rows + "]");
                if (p4117.Code == 0)
                {
//                        dgvRCQuery.DataSource = p4117.Detail;
//                        SetGridHeader(4117);
                }
                break;

            case DT.FINANCIAL_RCPOSITIONSUM:         //4119. 複委託整戶部位明細查詢

                PT04119 p4119 = (PT04119)package;
                AddInfo("RCV 4119 [" + p4119.Code + "][" + p4119.CodeDesc + "][ 筆數:" + p4119.Rows + "]");
                if (p4119.Code == 0)
                {
//                        dgvRCQuery.DataSource = p4119.Detail;
//                        SetGridHeader(4119);
                }
                break;

            case DT.FINANCIAL_RCCURRENCY:              //4121. 複委託單一幣別帳務查詢
                PT04121 p4121 = (PT04121)package;
                AddInfo("RCV 4121 [" + p4121.Code + "][" + p4121.CodeDesc + "][ 筆數:" + p4121.Rows + "]");
                if (p4121.Code == 0)
                {
//                        dgvRCQuery.DataSource = p4121.Detail;
//                        SetGridHeader(4121);
                }
                break;

            case DT.FINANCIAL_RCSTOCKPOSITION:      //4123. 複委託股票庫存部位查詢 ;

                PT04123 p4123 = (PT04123)package;
                AddInfo("RCV 4123 [" + p4123.Code + "][" + p4123.CodeDesc + "][ 筆數:" + p4123.Rows + "]");
                if (p4123.Code == 0)
                {
//                        dgvRCQuery.DataSource = p4123.Detail;
//                        SetGridHeader(4123);
                }
                break;

            case DT.FINANCIAL_RCDELIVERY:               //4125. 複委託交割金額試算 ; 交割:Delivery ;
                PT04125 p4125 = (PT04125)package;
                AddInfo("RCV 4125 [" + p4125.Code + "][" + p4125.CodeDesc + "][ 筆數:" + p4125.Rows + "]");
                if (p4125.Code == 0)
                {
//                        dgvRCQuery.DataSource = p4125.Detail;
//                        SetGridHeader(4125);
                }
                break;

                #endregion

                #region 帳務中台WebSerivce 查詢
            case DT.FINANCIAL_WSSETAMTTRIAL:      //當日交割金額試算查詢
                PT04302 p4302 = (PT04302)package;
                AddInfo("RCV 4302 [" + p4302.Code + "][" + p4302.CodeDesc + "][ 筆數:" + p4302.Rows1 + " , " + p4302.Rows2 + "]");
//                    lbResult.Text = "4302[ " + p4302.Rows1 + "]筆";
//                    lbResult1.Text = "4302_2[ " + p4302.Rows2 + "]筆";
                if (p4302.Code == 0)
                {
//                        dgvWSDetail1.DataSource = p4302.Detail1;
//                        dgvWSDetail2.DataSource = p4302.Detail2;
//                        SetWSGridHeader(4302);
                }
                break;

            case DT.FINANCIAL_WSSETAMTDETAIL:     //當日交割金額_沖銷明細(非當沖)查詢
                PT04304 p4304 = (PT04304)package;
                AddInfo("RCV 4304 [" + p4304.Code + "][" + p4304.CodeDesc + "][ 筆數:" + p4304.Rows + "]");
//                    lbResult.Text = "4304[ " + p4304.Rows + "]筆";
                if (p4304.Code == 0)
                {
//                        dgvWSDetail1.DataSource = p4304.Detail;
//                        SetWSGridHeader(4304);
                }
                break;

            case DT.FINANCIAL_WSSETTLEAMT:    //交割金額查詢(3日)查詢
                PT04306 p4306 = (PT04306)package;
                AddInfo("RCV 4306 [" + p4306.Code + "][" + p4306.CodeDesc + "][ 筆數:" + p4306.Rows + "]");
//                    lbResult.Text = "4304[ " + p4306.Rows + "]筆";
                if (p4306.Code == 0)
                {
//                        dgvWSDetail1.DataSource = p4306.Detail;
//                        SetWSGridHeader(4306);
                }
                break;

            case DT.FINANCIAL_WSINVENTORY:    //庫存損益及即時維持率試算查詢
                PT04308 p4308 = (PT04308)package;
                AddInfo("RCV 4308 [" + p4308.Code + "][" + p4308.CodeDesc + "][ 筆數:" + p4308.Rows + "]");
//                    lbResult.Text = "4308[ " + p4308.Rows + "]筆";
                if (p4308.Code == 0)
                {
//                        dgvWSDetail1.DataSource = p4308.Detail;
//                        SetWSGridHeader(4308);
                }
                break;

            case DT.FINANCIAL_WSINVENTORYSUM:    //證券庫存彙總查詢
                PT04310 p4310 = (PT04310)package;
                AddInfo("RCV 4310 [" + p4310.Code + "][" + p4310.CodeDesc + "][ 筆數:" + p4310.Rows + "]");
//                    lbResult.Text = "4310[ " + p4310.Rows + "]筆";
                if (p4310.Code == 0)
                {
//                        dgvWSDetail1.DataSource = p4310.Detail;
//                        SetWSGridHeader(4310);
                }
                break;

            case DT.FINANCIAL_WSBALANCESTATEMENT:    //證券對帳單查詢
                PT04312 p4312 = (PT04312)package;
                AddInfo("RCV 4312 [" + p4312.Code + "][" + p4312.CodeDesc + "][ 筆數:" + p4312.Rows + "]");

//                    lbResult.Text = "4312[ " + p4312.Rows + "]筆";
                if (p4312.Code == 0)
                {
//                        dgvWSDetail1.DataSource = p4312.Detail;
//                        SetWSGridHeader(4312);
                }

                break;

                #endregion

            case DT.SECU_EARMARK_SET:     //圈存 ;
                //string[] header4031 = { "Requestid", "webid", "1.圈/D.解圈", "分公司代號", "帳號", "證券代號", "申請張數", "回覆張數", "申請日期" ,"申請時間","回覆時間","序號","代碼","訊息"};
                P004031 p4031 = (P004031)package;
                //MessageBox.Show("EarMark Set:" + p4031.ErrCode);
                string[] row4031 = { p4031.RequestId.ToString(), p4031.Webid, p4031.TCode.ToString(), p4031.BrokerId, p4031.Account, p4031.StockNO, p4031.ApplyQTY, p4031.ReplyQTY, p4031.ApplyDate, p4031.ApplyTime, p4031.ReplyTime, p4031.Seqno, p4031.ErrCode, p4031.ErrMsg };
//                    dgv4031.Rows.Add(row4031);
                break;
            }
        }