/// <summary>
        /// 更新类型2改单的各种状态变化
        /// </summary>
        /// <param name="entrustNumber"></param>
        public void ProcessType2ModifyOrder(string entrustNumber)
        {
            string desc = "M<---——ModifyOrderProcessor.ProcessType2ModifyOrder类型2改单——原始委托清算完毕,更新状态";

            LogHelper.WriteDebug(desc);

            //===update 2009-11-08 李健华
            //HK_TodayEntrustInfo tet = HKDataAccess.GetTodayEntrustTable(entrustNumber);

            //如果新单号与原始单号相同,那么代表是一个类型2的改单
            //tet.ModifyOrderNumber = entrustNumber;
            //tet.IsModifyOrder = true;
            //HKDataAccess.UpdateEntrustTable(tet);
            //为了不更新区他字段 和不用再查询一次再更新
            HKDataAccess.UpdateEntrustModifyOrderNumber(entrustNumber, entrustNumber);
            //记录成功改单委托记录明细,方便查询和关联查询
            HKDataAccess.AddModifyOrderSuccessDatils(entrustNumber, entrustNumber, 2);
            //=======================

            HK_ModifyOrderRequestDal dal     = new HK_ModifyOrderRequestDal();
            HKModifyOrderRequest     request = dal.GetModel(entrustNumber);

            if (request != null)
            {
                request.ModifyOrderDateTime = DateTime.Now;
                HKDataAccess.UpdateModifyOrderRequest(request);
            }

            DeleteType2Reqeust(entrustNumber);
        }
        /// <summary>
        /// 类型1改单——生成新委托,下单,并回推改单结果到前台
        /// </summary>
        /// <param name="request"></param>
        internal void ProcessType1_NewOrder(HKModifyOrderRequest request)
        {
            LogHelper.WriteDebug("M——————>ModifyOrderProcessor.ProcessType1_NewOrder生成新委托,下单,并回推改单结果到前台" + request);

            HKOrderRequest        newRequest = CreateNewType1Request(request);
            HKModifyOrderPushBack pushBack   = new HKModifyOrderPushBack();

            pushBack.OriginalRequestNumber = request.EntrustNubmer;
            pushBack.TradeID          = request.TraderId;
            pushBack.CallbackChannlId = request.ChannelID;

            var res = OrderAccepterService.Service.DoHKOrder(newRequest);

            pushBack.IsSuccess = res.IsSuccess;
            pushBack.Message   = res.OrderMessage;


            if (res.IsSuccess)
            {
                HKDataAccess.UpdateEntrustModifyOrderNumber(res.OrderId, request.EntrustNubmer);
                //记录成功改单委托记录明细,方便查询和关联查询
                HKDataAccess.AddModifyOrderSuccessDatils(res.OrderId, request.EntrustNubmer, 1);

                pushBack.NewRequestNumber = res.OrderId;
            }
            else
            {
                request.Message = res.OrderMessage;
                HKDataAccess.UpdateModifyOrderRequest(request);
            }

            //将改单结果推给前台
            CounterOrderService.Instance.AcceptHKModifyOrder(pushBack);
        }
        /// <summary>
        /// 当原始委托撤单清算完毕后,由此方法进行后继处理
        /// 生成新的委托进行下单,并修改原始委托相关信息
        /// </summary>
        /// <param name="request"></param>
        public void ProcessType3NewOrder(HKModifyOrderRequest request)
        {
            string desc = "M<---——ModifyOrderProcessor.ProcessType3NewOrder类型3改单——原始委托撤单清算完毕,生成新的委托下单,改单对象" + request;

            LogHelper.WriteDebug(desc);

            HK_TodayEntrustInfo tet = HKDataAccess.GetTodayEntrustTable(request.EntrustNubmer);

            string        strMessage = "";
            OrderResponse res        = null;

            HKModifyOrderPushBack pushBack = new HKModifyOrderPushBack();

            pushBack.OriginalRequestNumber = request.EntrustNubmer;
            pushBack.TradeID          = request.TraderId;
            pushBack.CallbackChannlId = request.ChannelID;

            //计算出需要下的量
            float amount = request.OrderAmount - tet.TradeAmount;

            //如果成交量已经大于等于当前改单量,那么无法再进行改单操作,改单失败
            if (amount <= 0)
            {
                string format = "GT-2456:[港股改单委托]当前委托已成交数量{0}大于等于改单量{1}";
                strMessage = string.Format(format, tet.TradeAmount, request.OrderAmount);
                LogHelper.WriteDebug("M<---——ModifyOrderProcessor.ProcessType3NewOrder类型3改单失败" + request + "Message=" +
                                     strMessage);

                pushBack.Message   = strMessage;
                pushBack.IsSuccess = false;

                //将改单结果推给前台
                CounterOrderService.Instance.AcceptHKModifyOrder(pushBack);

                //更新改单委托记录表的信息
                request.Message = strMessage;
                HKDataAccess.UpdateModifyOrderRequest(request);
            }
            else
            {
                HKOrderRequest newRequest = CreateNewType3Request(request, tet, amount);

                res = OrderAccepterService.Service.DoHKOrder(newRequest);
                pushBack.NewRequestNumber = res.OrderId;
                pushBack.Message          = res.OrderMessage;

                string txtMsg = "";
                if (res.IsSuccess)
                {
                    txtMsg = "类型3改单成功";
                    //更新改单后成功下单的委托单,--更新是一笔改单下单委托,和原来被改单的委托单号
                    HKDataAccess.UpdateEntrustModifyOrderNumber(res.OrderId, tet.EntrustNumber);
                    //记录成功改单委托记录明细,方便查询和关联查询
                    HKDataAccess.AddModifyOrderSuccessDatils(res.OrderId, tet.EntrustNumber, 3);
                }
                else
                {
                    string desc2 = "M<---——ModifyOrderProcessor.ProcessType3NewOrder类型3改单——生成新的委托下单失败,改单对象" + request +
                                   "Message=" + res.OrderMessage;
                    LogHelper.WriteDebug(desc2);

                    txtMsg = "GT-2457:类型3改单生成新的委托下单失败" + res.OrderMessage;

                    //更新改单委托记录表的信息
                    request.Message = txtMsg;
                    HKDataAccess.UpdateModifyOrderRequest(request);
                }

                //将改单结果推给前台
                CounterOrderService.Instance.AcceptHKModifyOrder(pushBack);

                ////修改原始委托信息
                //tet.ModifyOrderNumber = request.EntrustNubmer;
                //tet.IsModifyOrder = true;
                //HKDataAccess.UpdateEntrustTable(tet);

                //request.ModifyOrderDateTime = DateTime.Now;

                //=====add 李健华 2009-11-07=========
                //则更新原始委托单信息
                HKDataAccess.UpdateEntrustOrderMessage(tet.EntrustNumber, txtMsg);
                //===========
            }

            DeleteType3Reqeust(request.EntrustNubmer);
        }