zhou.xiaoning 4 سال پیش
والد
کامیت
821f1e0e65
19فایلهای تغییر یافته به همراه1440 افزوده شده و 299 حذف شده
  1. 8 0
      Muchinfo.MTPClient/Fx4.0/Main/03.UI/Modules/Muchinfo.TASClient.Trade/Muchinfo.MTPClient.Trade.csproj
  2. 743 0
      Muchinfo.MTPClient/Fx4.0/Main/03.UI/Modules/Muchinfo.TASClient.Trade/ViewModels/ERMCP/HedgingEntrustViewModel.cs
  3. 0 1
      Muchinfo.MTPClient/Fx4.0/Main/03.UI/Modules/Muchinfo.TASClient.Trade/ViewModels/TradeBaseViewModel.cs
  4. 2 0
      Muchinfo.MTPClient/Fx4.0/Main/03.UI/Modules/Muchinfo.TASClient.Trade/ViewModels/TradeOrderViewModel.cs
  5. 246 0
      Muchinfo.MTPClient/Fx4.0/Main/03.UI/Modules/Muchinfo.TASClient.Trade/Views/ERMCP/HedgingEntrustWindow.xaml
  6. 37 0
      Muchinfo.MTPClient/Fx4.0/Main/03.UI/Modules/Muchinfo.TASClient.Trade/Views/ERMCP/HedgingEntrustWindow.xaml.cs
  7. 5 8
      Muchinfo.MTPClient/Fx4.0/Main/03.UI/Modules/Muchinfo.TASClient.Trade/Views/OrderContent.xaml
  8. 1 0
      Muchinfo.MTPClient/Fx4.0/Main/03.UI/Muchinfo.TASClient.UI/Muchinfo.MTPClient.UI.csproj
  9. 18 1
      Muchinfo.MTPClient/Fx4.0/Main/03.UI/Muchinfo.TASClient.UI/ViewModelLocator.cs
  10. 29 0
      Muchinfo.MTPClient/Fx4.0/Main/03.UI/Muchinfo.TASClient.UI/ViewModels/Bridge.cs
  11. 16 8
      Muchinfo.MTPClient/Fx4.0/Main/03.UI/Muchinfo.TASClient.UI/ViewModels/HomeViewModel.cs
  12. 1 1
      Muchinfo.MTPClient/Fx4.0/Main/03.UI/Muchinfo.TASClient.UI/ViewModels/LoginViewModel.cs
  13. 2 0
      Muchinfo.MTPClient/Fx4.0/Main/03.UI/Muchinfo.TASClient.UI/Views/MainPage.xaml.cs
  14. 7 4
      Muchinfo.MTPClient/Fx4.0/Main/03.UI/Muchinfo.TASClient/Config/Config.xml
  15. 3 0
      Muchinfo.MTPClient/Fx4.0/Main/04.Infrastructure/Muchinfo.TASClient.Infrastructure/EntityHelpers/QuoteDatagramHelper.cs
  16. 9 6
      Muchinfo.MTPClient/Fx4.0/Main/04.Infrastructure/Muchinfo.TASClient.Infrastructure/Utilities/ApplicationParameter.cs
  17. 254 263
      Muchinfo.MTPClient/Fx4.0/Main/05.Services/Muchinfo.TASClient.Adapter/Data/tas.cs
  18. 17 7
      Muchinfo.MTPClient/Fx4.0/Main/05.Services/Muchinfo.TASClient.Adapter/ProtoBuf/OrderProtoBufAdapter.cs
  19. 42 0
      Muchinfo.MTPClient/Fx4.0/Main/05.Services/Muchinfo.TASClient.Data/Model/NewEntrustOrder.cs

+ 8 - 0
Muchinfo.MTPClient/Fx4.0/Main/03.UI/Modules/Muchinfo.TASClient.Trade/Muchinfo.MTPClient.Trade.csproj

@@ -118,6 +118,7 @@
     <Compile Include="ViewModels\BidPayTradeViewModel.cs" />
     <Compile Include="ViewModels\BidTradeViewModel.cs" />
     <Compile Include="ViewModels\ChannelTradeViewMode.cs" />
+    <Compile Include="ViewModels\ERMCP\HedgingEntrustViewModel.cs" />
     <Compile Include="ViewModels\MarketTradeViewModel.cs" />
     <Compile Include="ViewModels\MixPayTradeViewModel.cs" />
     <Compile Include="ViewModels\MixTradeViewModel.cs" />
@@ -140,6 +141,9 @@
     <Compile Include="Views\EntrustOrderView.xaml.cs">
       <DependentUpon>EntrustOrderView.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\ERMCP\HedgingEntrustWindow.xaml.cs">
+      <DependentUpon>HedgingEntrustWindow.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\OrderContent.xaml.cs">
       <DependentUpon>OrderContent.xaml</DependentUpon>
     </Compile>
@@ -172,6 +176,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\ERMCP\HedgingEntrustWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\OrderContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 743 - 0
Muchinfo.MTPClient/Fx4.0/Main/03.UI/Modules/Muchinfo.TASClient.Trade/ViewModels/ERMCP/HedgingEntrustViewModel.cs

@@ -0,0 +1,743 @@
+using GalaSoft.MvvmLight;
+using GalaSoft.MvvmLight.Command;
+using GalaSoft.MvvmLight.Ioc;
+using Muchinfo.MTPClient.Data;
+using Muchinfo.MTPClient.Data.Enums;
+using Muchinfo.MTPClient.Data.Helper;
+using Muchinfo.MTPClient.Data.Model;
+using Muchinfo.MTPClient.Data.Model.Account;
+using Muchinfo.MTPClient.Infrastructure.Cache;
+using Muchinfo.MTPClient.Infrastructure.Helpers;
+using Muchinfo.MTPClient.Infrastructure.MessageBox;
+using Muchinfo.MTPClient.Infrastructure.Utilities;
+using Muchinfo.MTPClient.IService;
+using Muchinfo.MTPClient.Resources;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Media;
+
+namespace Muchinfo.MTPClient.Trade.ViewModels.ERMCP
+{
+    public class HedgingEntrustViewModel : ViewModelBase
+    {
+        protected const int defaut_minLot = 1;
+        protected const int defaut_maxLot = 88;
+        protected IGoodsService _goodsService;
+        protected IOrderService _orderService;
+        protected Window _win;
+
+        /// <summary>
+        /// 管理端对冲的入口
+        /// </summary>
+        /// <param name="win">宿主</param>
+        /// <param name="goodsID">商品ID</param>
+        /// <param name="contractType">合同类型,1:采购;-1:销售</param>
+        /// <param name="spotcontractID">现货合同ID</param>
+        /// <param name="saleUserID">业务员ID</param>
+        /// <param name="bizSubjectID">归属业务部门ID</param>
+        public HedgingEntrustViewModel(Window win, string goodsID, string contractType, string spotcontractID, string saleUserID, string bizSubjectID)
+        {
+            _win = win;
+            _goodsService = SimpleIoc.Default.GetInstance<IGoodsService>();
+            _orderService = SimpleIoc.Default.GetInstance<IOrderService>();
+
+            // 对冲方向,采购-卖;销售-买
+            _direction = contractType == "1" ? Direction.Ask : Direction.Bid;
+            if (_direction == Direction.Ask)
+            {
+                //_canUseSell = true;
+                //RaisePropertyChanged(() => CanUseSell);
+
+                SellBackGroundBrush = new SolidColorBrush(Color.FromRgb(100, 100, 100));
+                CanUseSell = false;
+
+                BuyBackGroundBrush = Brushes.Red;
+                CanUseBuy = true;
+            }
+            else
+            {
+                //_canUseBuy = true;
+                //RaisePropertyChanged(() => CanUseBuy);
+
+                SellBackGroundBrush = Brushes.Green;
+                CanUseSell = true;
+
+                BuyBackGroundBrush = new SolidColorBrush(Color.FromRgb(100, 100, 100));
+                CanUseBuy = false;
+            }
+
+            _spotcontractID = spotcontractID;
+            _saleUserID = saleUserID;
+            _bizSubjectID = bizSubjectID;
+
+            //初始化多资金账号信息
+            CurrentUserFundsList = CacheManager.CacheTAAcountList.Select(x => x.FundsAccounts.AccountId.ToString()).ToList();
+
+            // 目标商品
+            List<QuoteGoods> GoodsList =
+                CacheManager.CacheGoodsBaseInfos.Where((item) => (item.ContainsGoodsSrc & (int)GoodsFromScr.Trade) == (int)GoodsFromScr.Trade)
+                    .ToList();
+            var goods = GoodsList.FirstOrDefault(item => item.GoodsId.ToString() == goodsID);
+            if (goods != null)
+            {
+                _currentGoods = goods;
+
+                DefautEntrustPrice(CurrentChannelPriceMode != ChannelPriceMode.LimitPrice);//设置默认值
+            }
+            else
+            {
+                // 找不到目标商品的提示
+                MessageBoxHelper.ShowInfo("没有找到对应的商品,请稍后重试", Client_Resource.MessageBox_Error_Title);
+                _win.Close();
+                return;
+            }
+
+            InitRegister();
+        }
+
+        protected void InitRegister()
+        {
+            // 注册实时行情消息
+            MessengerHelper.QuoteRegister<List<QuoteGoods>>(this, MessengerTokens.ReceiveRealTimeQuote, (quoteList) =>
+            {
+                Application.Current.Dispatcher.BeginInvoke(new Action(() =>
+                {
+                    if (_currentGoods != null)
+                    {
+                        if (quoteList.FirstOrDefault((item) => item.Symbol == _currentGoods.Symbol) != null)
+                        {
+                            DefautEntrustPrice(false);
+                        }
+                    }
+                }));
+            });
+        }
+
+        public override void Cleanup()
+        {
+            base.Cleanup();
+            MessengerHelper.QuoteUnregister<List<QuoteGoods>>(this, MessengerTokens.ReceiveRealTimeQuote);
+        }
+
+        /// <summary>
+        /// 现货合同ID
+        /// </summary>
+        protected string _spotcontractID;
+        /// <summary>
+        /// 业务员ID
+        /// </summary>
+        protected string _saleUserID;
+        /// <summary>
+        /// 归属业务部门ID
+        /// </summary>
+        protected string _bizSubjectID;
+
+        private SolidColorBrush _buyBackGroundBrush = Brushes.Red;
+        public SolidColorBrush BuyBackGroundBrush
+        {
+            get { return _buyBackGroundBrush; }
+            set { Set(() => BuyBackGroundBrush, ref _buyBackGroundBrush, value); }
+        }
+
+        private SolidColorBrush _sellBackGroundBrush = Brushes.Green;
+        public SolidColorBrush SellBackGroundBrush
+        {
+            get { return _sellBackGroundBrush; }
+            set { Set(() => SellBackGroundBrush, ref _sellBackGroundBrush, value); }
+        }
+
+        protected QuoteGoods _currentGoods;     //当前下单的商品
+        /// <summary>
+        /// 当前选择商品
+        /// </summary>
+        public QuoteGoods CurrentGoods
+        {
+            get { return _currentGoods; }
+        }
+
+        protected ePriceMode _priceMode;
+
+        /// <summary>
+        /// 取价方式
+        /// </summary>
+        public virtual ePriceMode PriceMode
+        {
+            get
+            {
+                return _priceMode;
+            }
+            set
+            {
+                if ((int)value == -1) return;
+                Set(() => PriceMode, ref _priceMode, value);
+                DefautEntrustPrice();
+                CheckedVisibleEnable();
+                //SetMinMaxQtyVaule();   //设置数量
+            }
+        }
+
+        #region 界面绑定对像
+        /// <summary>
+        /// 目标合约
+        /// </summary>
+        public string GoodsTitle
+        {
+            get
+            {
+                return _currentGoods != null ? _currentGoods.Name + "/" + _currentGoods.GoodsCode : "--";
+            }
+        }
+
+        /// <summary>
+        /// 合同编号
+        /// </summary>
+        public string ContractID
+        {
+            get
+            {
+                return _spotcontractID;
+            }
+        }
+
+        private Direction _direction;
+        /// <summary>
+        /// 买卖方向
+        /// </summary>
+        public string BuyOrSell
+        {
+            get
+            {
+                return _direction == Direction.Bid ? "买" : "卖";
+            }
+        }
+
+        /// <summary>
+        /// 通道交易价格方式字典
+        /// </summary>
+        public Dictionary<ChannelPriceMode, string> ChannelPriceModeList
+        {
+            get
+            {
+                var dic1 = new Dictionary<ChannelPriceMode, string>
+                {
+                    {ChannelPriceMode.LastestPrice, ChannelPriceMode.LastestPrice.Discription()},
+                    {ChannelPriceMode.MatchPrice, ChannelPriceMode.MatchPrice.Discription()},
+                    {ChannelPriceMode.MarketPrice, ChannelPriceMode.MarketPrice.Discription()},
+                    {ChannelPriceMode.SuperPrice, ChannelPriceMode.SuperPrice.Discription()},
+                    {ChannelPriceMode.LimitPrice, ChannelPriceMode.LimitPrice.Discription()},
+                };
+
+                var dic2 = new Dictionary<ChannelPriceMode, string> // 不支持市价
+                {
+                    {ChannelPriceMode.LastestPrice, ChannelPriceMode.LastestPrice.Discription()},
+                    {ChannelPriceMode.MatchPrice, ChannelPriceMode.MatchPrice.Discription()},
+                    {ChannelPriceMode.SuperPrice, ChannelPriceMode.SuperPrice.Discription()},
+                    {ChannelPriceMode.LimitPrice, ChannelPriceMode.LimitPrice.Discription()},
+                };
+
+                return ApplicationParameter.CanMarketPrice(CurrentGoods) ? dic1 : dic2;
+            }
+        }
+
+        private ChannelPriceMode _currentChannelPriceMode;
+        /// <summary>
+        /// 当前通道交易价格方式
+        /// </summary>
+        public ChannelPriceMode CurrentChannelPriceMode
+        {
+            get
+            {
+                return _currentChannelPriceMode;
+            }
+
+            set
+            {
+                Set(() => CurrentChannelPriceMode, ref _currentChannelPriceMode, value);
+                var priceMode = value == ChannelPriceMode.MarketPrice ? ePriceMode.PRICEMODE_MARKET : ePriceMode.PRICEMODE_LIMIT;
+                if ((int)priceMode == -1) return;
+                PriceMode = priceMode;
+            }
+        }
+
+        /// <summary>
+        /// 小数位数据
+        /// </summary>
+        public int DecimalCount
+        {
+            get { return _currentGoods.GoodsParameters.HqExchFigures; }
+        }
+
+        /// <summary>
+        /// 价格格式化
+        /// </summary>
+        public string PriceFormat
+        {
+            get
+            {
+                if (_currentGoods != null)
+                {
+                    return _currentGoods.FormatPrice;
+                }
+                else
+                {
+                    return "F0";
+                }
+            }
+        }
+
+        /// <summary>
+        /// 可输入小数位数
+        /// </summary>
+        public decimal PriceMinUnit
+        {
+            get
+            {
+
+                int temp = 0;
+                uint quoteMinUnit = 1;
+                if (_currentGoods != null && _currentGoods.GoodsParameters != null)
+                {
+                    temp = _currentGoods.DecimalPlaces;
+                    quoteMinUnit = _currentGoods.QuoteMinUnit;
+                }
+                return Convert.ToDecimal(quoteMinUnit / Math.Pow(10, temp));
+            }
+        }
+
+        /// <summary>
+        /// 价格是否可编辑
+        /// </summary>
+        public virtual bool IsExecutePrice
+        {
+            get { return PriceMode == ePriceMode.PRICEMODE_LIMIT && CurrentChannelPriceMode == ChannelPriceMode.LimitPrice; }
+        }
+
+        protected decimal _executePrice;
+
+        /// <summary>
+        /// 委托价格
+        /// </summary>
+        public virtual decimal ExecutePrice
+        {
+            get
+            {
+                return _executePrice;
+            }
+            set
+            {
+                Set(() => ExecutePrice, ref _executePrice, value);
+            }
+        }
+
+        private decimal _minLot;
+        /// <summary>
+        /// 最小数量
+        /// </summary>
+        public decimal MinLot
+        {
+            get { return _minLot; }
+            set { Set(() => MinLot, ref _minLot, value); }
+        }
+
+        private decimal _lot = decimal.Zero;
+        /// <summary>
+        /// 数量 
+        /// </summary>
+        public decimal Lot
+        {
+            get
+            {
+                //#region 挂牌下单属性赋值=》数量
+                //if (CacheManager.FromType == eOrderFormType.Listting && CacheManager.OrderId_Listing != 0)
+                //{
+                //    if (ListingSelectModel == eListingSelectType.LISTINGSELECTTYPE_DELISTING && DelistingModel == eDelistingType.DELISTINGTYPE_SELECTED)
+                //    {
+                //        return CacheManager.OrderLot_Listing;
+                //    }
+                //} 
+                //#endregion
+
+                return _lot;
+            }
+            set
+            {
+                Set(() => Lot, ref _lot, value);
+                RaisePropertyChanged(() => RelationNum);
+            }
+        }
+
+        /// <summary>
+        /// 单位
+        /// </summary>
+        public string RelationNum
+        {
+
+            get
+            {
+                if (_currentGoods != null)
+                {
+                    return (_currentGoods.GoodsParameters.AgreeUnit * _lot).ToString();
+                }
+                else
+                {
+                    return "-";
+                }
+            }
+        }
+
+        private bool _canUseBuy;
+        public bool CanUseBuy
+        {
+            get { 
+                return _canUseBuy; 
+            }
+            set { Set(() => CanUseBuy, ref _canUseBuy, value); }
+        }
+
+        private bool _canUseSell;
+        public bool CanUseSell
+        {
+            get { 
+                return _canUseSell; 
+            }
+            set { 
+                Set(() => CanUseSell, ref _canUseSell, value); 
+            }
+        }
+
+
+        private string _channelBuyPrice = "";
+        private string _channelSellPrice = "";
+        /// <summary>
+        ///  渠道交易时候买入价格
+        /// </summary>
+        public virtual string ChannelBuyPrice
+        {
+            get
+            {
+                return (_channelBuyPrice.Equals("") || Convert.ToDouble(_channelBuyPrice) == 0) ? "--" : _channelBuyPrice;
+            }
+            set
+            {
+                Set(() => ChannelBuyPrice, ref _channelBuyPrice, value);
+            }
+        }
+        /// <summary>
+        /// 渠道交易时候卖出价格
+        /// </summary>
+        public virtual string ChannelSellPrice
+        {
+            get { return (_channelSellPrice.Equals("") || Convert.ToDouble(_channelSellPrice) == 0) ? "--" : _channelSellPrice; }
+            set
+            {
+                Set(() => ChannelSellPrice, ref _channelSellPrice, value);
+            }
+        }
+
+        private List<string> _currentUserFundsList = null;
+
+        /// <summary>
+        /// 当前登录用户多资金信息列表
+        /// </summary>
+        public List<string> CurrentUserFundsList
+        {
+            get
+            {
+                return _currentUserFundsList;
+            }
+            set
+            {
+                Set(() => CurrentUserFundsList, ref _currentUserFundsList, value);
+
+
+                if (CurrentUserFundsList != null && CurrentUserFundsList.Count() > 1)
+                {
+                    _currentUserFundsList.Insert(0, "请选择资金账户");
+                    UserManager.CurrentTradeAccount.FundsAccountId = 0;
+                }
+                else
+                {
+                    _currentSelectedFunds = CurrentUserFundsList.First(); //单资金账号 默认选择第一个
+                    if (!_currentSelectedFunds.Contains("请"))
+                    {
+                        UserManager.CurrentTradeAccount.FundsAccountId = ulong.Parse(_currentSelectedFunds);
+                    }
+                }
+            }
+        }
+
+        private string _currentSelectedFunds = "请选择资金账户";
+
+        /// <summary>
+        /// 当前选中的资金账号
+        /// </summary>
+        public string CurrentSelectedFunds
+        {
+            get
+            {
+                return _currentSelectedFunds;
+            }
+            set
+            {
+                Set(() => CurrentSelectedFunds, ref _currentSelectedFunds, value);
+                UserManager.CurrentTradeAccount.FundsAccountId = 0;
+                if (!_currentSelectedFunds.Contains("请"))
+                {
+                    UserManager.CurrentTradeAccount.FundsAccountId = ulong.Parse(CurrentSelectedFunds);
+                }
+            }
+        }
+        #endregion
+
+        #region 交互相关
+        /// <summary>
+        /// 检查显示内容或可编辑
+        /// </summary>
+        public virtual void CheckedVisibleEnable()
+        {
+            RaisePropertyChanged(() => IsExecutePrice);
+        }
+
+        /// <summary>
+        /// 设置
+        /// </summary>
+        protected virtual void DefautEntrustPrice(bool isUpdateLimitePrice = true)
+        {
+            if (_currentGoods == null)
+            {
+                return;
+            }
+            if (PriceMode == ePriceMode.PRICEMODE_LIMIT)
+            {
+                switch (_currentGoods.TradeMode)
+                {
+                    case eTradeMode.TRADEMODE_ENTRUST_HEDGE:
+                        switch (CurrentChannelPriceMode)
+                        {
+                            case ChannelPriceMode.MatchPrice:
+                                ExecutePrice = _direction == Direction.Ask
+                                    ? _currentGoods.BidPrice
+                                    : _currentGoods.AskPrice;
+                                ChannelBuyPrice = Convert.ToString(_currentGoods.AskPrice);
+                                ChannelSellPrice = Convert.ToString(_currentGoods.BidPrice);
+                                break;
+
+                            case ChannelPriceMode.MarketPrice:
+                                ChannelBuyPrice = "0";
+                                ChannelSellPrice = "0";
+                                ExecutePrice = 0;
+                                break;
+                            // 4、若价格选择为超价,
+                            // 买入按钮上价格取卖价(卖一价)+配置的超价点数*行情最小变动单位*10^行情小数位,
+                            // 卖出按钮上价格取买价(买一价)-配置的超价点数*行情最小变动单位*10^行情小数位,买卖价变动时价格需要跟着变动;
+                            case ChannelPriceMode.SuperPrice:
+                                double superPoint = SystemParamManager.getChannelSuperPoint;
+                                var changeValue = superPoint * _currentGoods.QuoteMinUnit / Math.Pow(10, _currentGoods.DecimalPlaces);
+                                ExecutePrice = _direction == Direction.Ask
+                                    ? _currentGoods.BidPrice == 0 ? 0 : (_currentGoods.BidPrice - (decimal)changeValue)
+                                    : _currentGoods.AskPrice == 0 ? 0 : (_currentGoods.AskPrice + (decimal)changeValue);
+                                ChannelBuyPrice = Convert.ToString(_currentGoods.AskPrice == 0 ? 0 : (_currentGoods.AskPrice + (decimal)changeValue));
+                                ChannelSellPrice = Convert.ToString(_currentGoods.BidPrice == 0 ? 0 : (_currentGoods.BidPrice - (decimal)changeValue));
+                                break;
+                            case ChannelPriceMode.LastestPrice:
+                                ExecutePrice = _currentGoods.CurrentPrice;
+                                ChannelBuyPrice = Convert.ToString(_currentGoods.CurrentPrice);
+                                ChannelSellPrice = Convert.ToString(_currentGoods.CurrentPrice);
+                                break;
+                            case ChannelPriceMode.LimitPrice:
+                                if (isUpdateLimitePrice)
+                                {
+                                    ExecutePrice = _direction == Direction.Ask
+                                        ? _currentGoods.BidPrice
+                                        : _currentGoods.AskPrice;
+                                }
+                                ChannelBuyPrice = Convert.ToString(ExecutePrice);
+                                ChannelSellPrice = Convert.ToString(ExecutePrice);
+                                break;
+                            default:
+                                ExecutePrice = _direction == Direction.Ask
+                                    ? CurrentGoods.BidPrice
+                                    : CurrentGoods.AskPrice;
+
+                                ChannelBuyPrice = Convert.ToString(_currentGoods.BidPrice);
+                                ChannelSellPrice = Convert.ToString(_currentGoods.AskPrice);
+                                break;
+                        }
+                        break;
+                    default:
+                        break;
+                }
+            }
+            else if (PriceMode == ePriceMode.PRICEMODE_MARKET)
+            {
+                switch (_currentGoods.TradeMode)
+                {
+                    case eTradeMode.TRADEMODE_MARKETMAKE:
+                        ExecutePrice = _direction == Direction.Ask ? _currentGoods.AskPrice : _currentGoods.BidPrice;
+                        break;
+                    case eTradeMode.TRADEMODE_BIDDING:
+                    case eTradeMode.TRADEMODE_BIDDINGMARKETMAKE:
+                    case eTradeMode.TRADEMODE_ENTRUST_HEDGE:
+                        //市价默认价格
+                        ExecutePrice = 0;
+                        ChannelBuyPrice = "0";
+                        ChannelSellPrice = "0";
+                        break;
+                }
+            }
+
+        }
+
+        /// <summary>
+        /// 设置建仓最大最小数量
+        /// </summary>
+        protected void SetOpenQty()
+        {
+            //var maxQty = _goodsService.GetGoodsParamerRule((int)_currentGoods.GoodsId,
+            //    _currentGoods.TradeMode, GoodsTradeConts.MAXOPENTRADEQTY);
+            var minQty = _goodsService.GetGoodsParamerRule((int)_currentGoods.GoodsId,
+                _currentGoods.TradeMode, GoodsTradeConts.MINOPENTRADEQTY);
+            MinLot = minQty == null ? defaut_minLot : minQty.FeeValue;
+        }
+
+        /// <summary>
+        /// 传统下单
+        /// </summary>
+        public RelayCommand<int> TradionOKCommand
+        {
+            get
+            {
+                return new RelayCommand<int>((i) =>
+                {
+                    string errorMsg = string.Empty;
+                    bool validateBool = Validated(ref errorMsg);   ////内容验证
+                    if (validateBool)
+                    {
+                        PostOrder(EntrurstSuccessCallBack, EntrurstErrorCallBack);
+                    }
+                    else
+                    {
+                        MessageBoxHelper.ShowInfo(errorMsg, Client_Resource.MessageBox_Error_Title);
+                    }
+                });
+            }
+        }
+
+        /// <summary>
+        /// 验证数据
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        protected bool Validated(ref string msg)
+        {
+            if (CurrentUserFundsList != null && CurrentUserFundsList.Count() > 1 && CurrentSelectedFunds.Contains("请"))
+            {
+                msg = "请选择资金账户";
+                return false;
+            }
+            if (Lot > 9223372036854775807)
+            {
+                msg = "超出最大委托数量";
+                return false;
+            }
+
+            return true;
+        }
+
+        ///// <summary>
+        ///// 创建基本单据
+        ///// </summary>
+        ///// <returns></returns>
+        public virtual NewEntrustOrder BuildEntrustOrder()
+        {
+            var newOrder = new NewEntrustOrder()
+            {
+                BuyOrSell = _direction,
+                GoodsCode = CurrentGoods.GoodsCode,
+                OperaterId = UserManager.CurrentTradeAccount.LoginID,
+                GoodsId = (uint)CurrentGoods.GoodsParameters.GoodsId,
+                AccountType = UserManager.CurrentTradeAccount.AccountType,
+                BuildType = OpenCloseMode.BUILDTYPE_OPEN,
+                EntrurstTime = ApplicationParameter.ServerTimeNow,
+                MemberAreaId = UserManager.CurrentTradeAccount.MemberAreaId,
+                EntrustQuantity = Lot,
+                PriceMode = PriceMode,
+                MarketId = CurrentGoods.MarketID,
+                TradeMode = CurrentGoods.TradeMode,
+                LoginID = UserManager.CurrentTradeAccount.LoginID,
+                AccountId = UserManager.CurrentTradeAccount.FundsAccountId,
+                OrderFlag = (uint)OrderMethods.NormalOrder,
+                OrderFormType = eOrderFormType.Commom,
+                ChannelPriceMode = CurrentChannelPriceMode,
+                CurrentGoods = CurrentGoods,
+                Ip = ApplicationParameter.PublisgNetIp,
+                ValidType = ExpirationType.Today,
+                // 企业风管
+                HedgeFlag = 4,
+                SpotContractID = Convert.ToUInt64(_spotcontractID),
+                SaleUserID = Convert.ToUInt64(_saleUserID),
+                BizSubjectID = Convert.ToUInt64(_bizSubjectID),
+            };
+
+            if (newOrder.BuyOrSell == Direction.Bid) // 买入
+            {
+                newOrder.EntrustPrice = Convert.ToDecimal(ChannelBuyPrice);
+            }
+            else if (newOrder.BuyOrSell == Direction.Ask)// 卖出
+            {
+                newOrder.EntrustPrice = Convert.ToDecimal(ChannelSellPrice);
+            }
+
+            if (CurrentUserFundsList != null && CurrentUserFundsList.Count() == 1)
+            {
+                newOrder.AccountId = ulong.Parse(CurrentUserFundsList.FirstOrDefault());
+            }
+
+            return newOrder;
+        }
+
+        public virtual void PostOrder(Action<OrderDetail> successAction, Action<ErrorEntity> errorAction)
+        {
+            var entrustOrder = BuildEntrustOrder();
+            entrustOrder.CurtQuotePrice = _direction == Direction.Ask ? _currentGoods.BidPrice : _currentGoods.AskPrice;
+
+            _orderService.ChannelEntrustOrder(entrustOrder, successAction, errorAction);
+        }
+
+        /// <summary>
+        /// 提交成功返回
+        /// </summary>
+        /// <param name="order"></param>
+        private void EntrurstSuccessCallBack(OrderDetail order)
+        {
+            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
+            {
+                //刷新正常单
+                MessengerHelper.DefaultSend(UserManager.CurrentTradeAccount, MessengerTokens.OrderNoticeToken);
+                MessageBoxHelper.ShowInfo("提交成功。", Client_Resource.Message_Title);
+                Cleanup();
+                _win.Close();
+            }));
+        }
+
+        /// <summary>
+        /// 委托失败返回
+        /// </summary>
+        /// <param name="errorEntity"></param>
+        private void EntrurstErrorCallBack(ErrorEntity errorEntity)
+        {
+
+            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
+            {
+                ErrorManager.ShowReturnError(errorEntity, Client_Resource.UI2014_Tips, true);
+                Cleanup();
+                _win.Close();
+            }));
+        }
+        #endregion
+    }
+}

+ 0 - 1
Muchinfo.MTPClient/Fx4.0/Main/03.UI/Modules/Muchinfo.TASClient.Trade/ViewModels/TradeBaseViewModel.cs

@@ -1644,7 +1644,6 @@ namespace Muchinfo.MTPClient.Trade.ViewModels
                 {
                     newOrder.RelationTicket = (ulong)CacheManager.OrderId_Listing;
                 }
-
             }
 
 

+ 2 - 0
Muchinfo.MTPClient/Fx4.0/Main/03.UI/Modules/Muchinfo.TASClient.Trade/ViewModels/TradeOrderViewModel.cs

@@ -41,6 +41,8 @@ namespace Muchinfo.MTPClient.Trade.ViewModels
         private IDeliveryService _deliveryService;
         private OrderModel _orderModel = OrderModel.Normal;
 
+        // 风管云平台
+
         public OrderModel OrderModel
         {
             get { return _orderModel; }

+ 246 - 0
Muchinfo.MTPClient/Fx4.0/Main/03.UI/Modules/Muchinfo.TASClient.Trade/Views/ERMCP/HedgingEntrustWindow.xaml

@@ -0,0 +1,246 @@
+<Window x:Class="Muchinfo.MTPClient.Trade.Views.ERMCP.HedgingEntrustWindow"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:converters="clr-namespace:Muchinfo.MTPClient.Infrastructure.Converters;assembly=Client.Infrastructure"
+        xmlns:resources="clr-namespace:Muchinfo.MTPClient.Resources;assembly=Client.Resources"
+        Background="Black"
+        xmlns:utilities="clr-namespace:Muchinfo.MTPClient.Trade.Utilities"
+        xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
+        Title="对冲保值" Height="400" Width="480" ResizeMode="NoResize">
+    <Window.Resources>
+        <converters:BoolOpposedVisibility x:Key="BoolOpposedVisibility" />
+        <converters:EnumBooleanConvert x:Key="EnumBooleanConvert" />
+        <converters:EnumVisibilityConvert x:Key="EnumVisibilityConvert" />
+        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
+        <Style TargetType="{x:Type TextBlock}">
+            <Setter Property="HorizontalAlignment" Value="Right" />
+            <Setter Property="VerticalAlignment" Value="Center" />
+            <Setter Property="Foreground" Value="{DynamicResource TextBlockForeground}" />
+        </Style>
+        <Style TargetType="{x:Type RadioButton}">
+            <Setter Property="Foreground" Value="{DynamicResource MainForegroundBrush}" />
+        </Style>
+    </Window.Resources>
+    <!--DataContext="{Binding HedgingEntrustViewModel,
+                                   Source={StaticResource Locator}}"-->
+    <Grid Margin="0,10,0,0">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="33" />
+            <RowDefinition Height="33" />
+            <RowDefinition Height="33" />
+            <RowDefinition Height="33" />
+            <RowDefinition Height="33" />
+            <RowDefinition Height="33" />
+            <RowDefinition Height="33" />
+            <RowDefinition Height="33" />
+            <RowDefinition Height="*" />
+        </Grid.RowDefinitions>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="60" />
+            <ColumnDefinition Width="Auto" />
+        </Grid.ColumnDefinitions>
+        <!--  资金账户  -->
+        <TextBlock Grid.Row="0"
+                       Text="资金账户" />
+        <utilities:FocusComboBox x:Name="MoneyComBoxBox"
+                                     Grid.Row="0"
+                                     Grid.Column="1"
+                                     Width="200"
+                                     Margin="20,5,0,5"
+                                     HorizontalAlignment="Left"
+                                     VerticalAlignment="Center"
+                                     ItemsSource="{Binding CurrentUserFundsList}"
+                                     SelectedIndex="0"
+                                     SelectedItem="{Binding CurrentSelectedFunds,
+                                                            Mode=TwoWay}"
+                                     Style="{DynamicResource SimpleComboBoxStyle}"
+                                     TabIndex="4" />
+        <!--商品-->
+        <TextBlock Grid.Row="1" Text="{x:Static resources:Client_Resource.Trade_Xaml_Goods_Title}" />
+        <TextBlock 
+            Grid.Row="1" 
+            Grid.Column="1"
+            Margin="20,0,0,0"
+            HorizontalAlignment="Left"
+            Text="{Binding GoodsTitle}" />
+        <!--现货合同-->
+        <TextBlock Grid.Row="2" Text="现货合同" />
+        <TextBlock 
+            Grid.Row="2" 
+            Grid.Column="1"
+            Margin="20,0,0,0"
+            HorizontalAlignment="Left"
+            Text="{Binding ContractID}" />
+        <!--方向-->
+        <TextBlock Grid.Row="3" Text="{x:Static resources:Client_Resource.EntrustOrderFrame_Direction}" />
+        <TextBlock 
+            Grid.Row="3" 
+            Grid.Column="1"
+            Margin="20,0,0,0"
+            HorizontalAlignment="Left"
+            Text="{Binding BuyOrSell}" />
+        <!--类型-->
+        <TextBlock Grid.Row="4" Text="{x:Static resources:Client_Resource.EntrustOrderFrame_Type}" />
+        <RadioButton x:Name="radOpen" 
+                     Grid.Row="4" 
+                     Grid.Column="1"
+                     Margin="20,0,0,0"
+                     CommandParameter="1"
+                     Content="{x:Static resources:Client_Resource.EntrustOrderFrame_Open}"
+                     IsChecked="True"
+                     Style="{DynamicResource RadioButtonStyle}"
+                     TabIndex="22" />
+        <!--价格方式-->
+        <TextBlock Grid.Row="5" Text="价格方式" />
+        <utilities:FocusComboBox x:Name="ChannelPriceMode"
+                                    Grid.Row="5"
+                                    Grid.Column="1"
+                                    Width="150"
+                                    Margin="20,5,0,5"
+                                    HorizontalAlignment="Left"
+                                    VerticalAlignment="Center"
+                                    HorizontalContentAlignment="Center"
+                                    DisplayMemberPath="Value"
+                                    ItemsSource="{Binding ChannelPriceModeList}"
+                                    SelectedIndex="1"
+                                    SelectedValue="{Binding CurrentChannelPriceMode,
+                                                            Mode=TwoWay}"
+                                    SelectedValuePath="Key"
+                                    Style="{DynamicResource SimpleComboBoxStyle}"
+                                    TabIndex="4" />
+        <!--价格-->
+        <TextBlock Grid.Row="6" Text="{x:Static resources:Client_Resource.EntrustOrderFrame_Price}" />
+        <StackPanel Grid.Row="6"
+                        Grid.Column="1"
+                        Height="33"
+                        Orientation="Horizontal">
+            <utilities:FocusDecimalNumBox x:Name="PriceNumBox"
+                                              Width="150"
+                                              Margin="20,0,0,0"
+                                              HorizontalAlignment="Left"
+                                              VerticalAlignment="Center"
+                                              DecimalCount="{Binding DecimalCount}"
+                                              FormatString="{Binding PriceFormat}"
+                                              Increment="{Binding PriceMinUnit}"
+                                              IsEnabled="{Binding IsExecutePrice}"
+                                              Minimum="0"
+                                              Style="{DynamicResource DecimalNewUpDownStyle}"
+                                              TabIndex="7"
+                                              Text="{Binding ExecutePrice,
+                                                             Mode=TwoWay,
+                                                             UpdateSourceTrigger=PropertyChanged}" />
+        </StackPanel>
+        <!--数量-->
+        <TextBlock Grid.Row="7" Text="{x:Static resources:Client_Resource.EntrustOrderFrame_Lot}" />
+        <StackPanel Grid.Row="7"
+                    Grid.Column="1"
+                    Height="33"
+                    Orientation="Horizontal">
+            <utilities:FocusDecimalNumBox x:Name="DecimalNum"
+                                              Width="150"
+                                              Margin="20,0,0,0"
+                                              VerticalAlignment="Center"
+                                              DecimalCount="0"
+                                              DefaultValue="0"
+                                              DisplayDefaultValueOnEmptyText="True"
+                                              Focusable="True"
+                                              Increment="1"
+                                              Maximum="9223372036854775807"
+                                              Minimum="1"
+                                              Style="{DynamicResource DecimalNewUpDownStyle}"
+                                              TabIndex="4"
+                                              Value="{Binding Lot,
+                                                              Mode=TwoWay}" />
+            <TextBlock Margin="5,0" Text="{x:Static resources:Client_Resource.EntrustOrderFrame_Hand}" />
+        </StackPanel>
+        <!--下单-->
+        <StackPanel Grid.Row="8"
+                    Grid.Column="1"
+                            Margin="0,15"
+                            HorizontalAlignment="Center"
+                            Orientation="Horizontal">
+            <!--  买入  -->
+            <Border Width="90"
+                            HorizontalAlignment="Left"
+                            VerticalAlignment="Top"
+                            Background="{Binding BuyBackGroundBrush}"
+                            BorderBrush="{Binding BuyBackGroundBrush}"
+                            CornerRadius="4, 4, 4, 4">
+                <StackPanel x:Name="BuyCommissions"
+                                    Width="90"
+                                    Background="Transparent"
+                                    IsEnabled="{Binding CanUseBuy}"
+                                    Orientation="Vertical">
+
+                    <i:Interaction.Triggers>
+                        <i:EventTrigger EventName="MouseLeftButtonDown">
+                            <i:InvokeCommandAction Command="{Binding TradionOKCommand}" CommandParameter="0" />
+                        </i:EventTrigger>
+                    </i:Interaction.Triggers>
+                    <TextBlock Margin="0, 3, 0, 0"
+                                       HorizontalAlignment="Center"
+                                       Background="Transparent"
+                                       FontWeight="Bold"
+                                       Text="{Binding ChannelBuyPrice}" />
+
+                    <Path Width="80"
+                                  Height="2"
+                                  Data="F1M1,2C1,2 1,1 1,1 1,1 160,1 160,1 160,1 160,2 160,2 160,2 1,2 1,2z"
+                                  Fill="White">
+                        <Path.Effect>
+                            <DropShadowEffect BlurRadius="0"
+                                                      Direction="-270"
+                                                      Color="White" />
+                        </Path.Effect>
+                    </Path>
+                    <TextBlock Margin="0, 2, 0, 3"
+                                       HorizontalAlignment="Center"
+                                       FontSize="16"
+                                       FontWeight="Bold"
+                                       Text="买入" />
+                </StackPanel>
+            </Border>
+            <!--  卖出  -->
+            <Border Width="90"
+                            Margin="50, 0, 0, 0"
+                            HorizontalAlignment="Left"
+                            VerticalAlignment="Top"
+                            Background="{Binding SellBackGroundBrush}"
+                            BorderBrush="{Binding SellBackGroundBrush}"
+                            CornerRadius="4, 4, 4, 4">
+                <StackPanel x:Name="SellCommissions"
+                                    Width="90"
+                                    Background="Transparent"
+                                    IsEnabled="{Binding CanUseSell}"
+                                    Orientation="Vertical">
+                    <i:Interaction.Triggers>
+                        <i:EventTrigger EventName="MouseLeftButtonDown">
+                            <i:InvokeCommandAction Command="{Binding TradionOKCommand}" CommandParameter="1" />
+                        </i:EventTrigger>
+                    </i:Interaction.Triggers>
+                    <TextBlock Margin="0, 3, 0, 0"
+                                       HorizontalAlignment="Center"
+                                       Background="Transparent"
+                                       FontWeight="Bold"
+                                       Text="{Binding ChannelSellPrice}" />
+
+                    <Path Width="80"
+                                  Height="2"
+                                  Data="F1M1,2C1,2 1,1 1,1 1,1 160,1 160,1 160,1 160,2 160,2 160,2 1,2 1,2z"
+                                  Fill="White">
+                        <Path.Effect>
+                            <DropShadowEffect BlurRadius="0"
+                                                      Direction="-270"
+                                                      Color="White" />
+                        </Path.Effect>
+                    </Path>
+                    <TextBlock Margin="0, 2, 0, 3"
+                                       HorizontalAlignment="Center"
+                                       FontSize="16"
+                                       FontWeight="Bold"
+                                       Text="{x:Static resources:Client_Resource.Content_SellOut}" />
+                </StackPanel>
+            </Border>
+        </StackPanel>
+    </Grid>
+</Window>

+ 37 - 0
Muchinfo.MTPClient/Fx4.0/Main/03.UI/Modules/Muchinfo.TASClient.Trade/Views/ERMCP/HedgingEntrustWindow.xaml.cs

@@ -0,0 +1,37 @@
+using Muchinfo.MTPClient.Trade.ViewModels.ERMCP;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Muchinfo.MTPClient.Trade.Views.ERMCP
+{
+    /// <summary>
+    /// HedgingEntrustWindow.xaml 的交互逻辑
+    /// </summary>
+    public partial class HedgingEntrustWindow : Window
+    {
+        public HedgingEntrustWindow()
+        {
+            InitializeComponent();
+        }
+
+        public HedgingEntrustWindow(string param)
+        {
+            InitializeComponent();
+
+            string[] arr = param.Split(',');
+            HedgingEntrustViewModel viewModel = new HedgingEntrustViewModel(this, arr[0], arr[1], arr[2], arr[3], arr[4]);
+            DataContext = viewModel;
+        }
+    }
+}

+ 5 - 8
Muchinfo.MTPClient/Fx4.0/Main/03.UI/Modules/Muchinfo.TASClient.Trade/Views/OrderContent.xaml

@@ -51,7 +51,8 @@
         所以每次进入界面的时候,都是乱的,什么界面都显示,只能是viewModel加载后,我才能知道要显示那些东西了。
         这里暂时隐藏吧。 ***********************调试界面的时候,打开这个Collapsed,发布的时候,记得加上************************
     -->
-    <Grid x:Name="OrderContentArea" Visibility="Collapsed">
+    <Grid x:Name="OrderContentArea" Visibility="Collapsed">  
+    <!--<Grid x:Name="OrderContentArea">-->
         <Grid.RowDefinitions>
             <RowDefinition />
             <RowDefinition Height="Auto" />
@@ -442,7 +443,7 @@
                                              Converter={StaticResource BooleanToVisibilityConverter}}">
                 <utilities:FocusDecimalNumBox x:Name="PriceNumBox"
                                               Width="150"
-                                              Margin="20,0,0,0"
+                                              Margin="20,4,0,4.143"
                                               HorizontalAlignment="Left"
                                               VerticalAlignment="Center"
                                               DecimalCount="{Binding TradeViewModel.DecimalCount}"
@@ -452,15 +453,11 @@
                                               Minimum="0"
                                               Style="{DynamicResource DecimalNewUpDownStyle}"
                                               TabIndex="7"
-                                              Text="{Binding TradeViewModel.ExecutePrice,
-                                                             Mode=TwoWay,
-                                                             UpdateSourceTrigger=PropertyChanged}" />
+                                              Text="{Binding TradeViewModel.ExecutePrice, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                 <TextBlock HorizontalAlignment="Left"
                            VerticalAlignment="Center"
                            FontWeight="Normal"
-                           Visibility="{Binding TradeViewModel.IsPriceRangeVsb,
-                                                Converter={StaticResource BooleanToVisibilityConverter}}"><Run Text="≥" /><Run Text="{Binding TradeViewModel.DisplayMaxLimit, Mode=OneWay}" /><Run Text="{x:Static resources:Client_Resource.EntrustOrderFrame_Trade_Or}" /><Run Text="≤" /><Run Text="{Binding TradeViewModel.DisplayMinLimit, Mode=OneWay}" />
-                </TextBlock>
+                           Visibility="{Binding TradeViewModel.IsPriceRangeVsb, Converter={StaticResource BooleanToVisibilityConverter}}"><Run Text="≥" /><Run Text="{Binding TradeViewModel.DisplayMaxLimit, Mode=OneWay}" /><Run Text="{x:Static resources:Client_Resource.EntrustOrderFrame_Trade_Or}" /><Run Text="≤" /><Run Text="{Binding TradeViewModel.DisplayMinLimit, Mode=OneWay}" /></TextBlock>
             </StackPanel>
 
             <TextBlock Grid.Row="6" Text="{x:Static resources:Client_Resource.EntrustOrderFrame_Lot}" />

+ 1 - 0
Muchinfo.MTPClient/Fx4.0/Main/03.UI/Muchinfo.TASClient.UI/Muchinfo.MTPClient.UI.csproj

@@ -149,6 +149,7 @@
     <Compile Include="Utilities\ValidCode.cs" />
     <Compile Include="Utilities\WindowHelper.cs" />
     <Compile Include="ViewModelLocator.cs" />
+    <Compile Include="ViewModels\Bridge.cs" />
     <Compile Include="ViewModels\HomeViewModel.cs" />
     <Compile Include="ViewModels\InputTradePassWordViewModel.cs" />
     <Compile Include="ViewModels\LinkStateViewModel.cs" />

+ 18 - 1
Muchinfo.MTPClient/Fx4.0/Main/03.UI/Muchinfo.TASClient.UI/ViewModelLocator.cs

@@ -12,6 +12,7 @@ using Muchinfo.MTPClient.Quotation.ViewModels;
 using Muchinfo.MTPClient.Sale.ViewModels;
 using Muchinfo.MTPClient.Service;
 using Muchinfo.MTPClient.Trade.ViewModels;
+using Muchinfo.MTPClient.Trade.ViewModels.ERMCP;
 using Muchinfo.MTPClient.UI.ViewModels;
 using Muchinfo.MTPClient.UI.Views;
 
@@ -62,7 +63,8 @@ namespace Muchinfo.MTPClient.UI
 
             SimpleIoc.Default.Register<ICommonQueryService, CommonQueryService>();//new 2.0
 
-            SimpleIoc.Default.Register<IErmcpService, ErmcpService>();// 风管云平台
+            // *************** 风管云平台 ***************
+            SimpleIoc.Default.Register<IErmcpService, ErmcpService>();
         }
 
         /// <summary>
@@ -154,6 +156,10 @@ namespace Muchinfo.MTPClient.UI
 
             ////五档历史
             SimpleIoc.Default.Register<HistoryCommissionsListViewModel>();
+
+            // *************** 风管云平台 ***************
+            // 对冲保值
+            SimpleIoc.Default.Register<HedgingEntrustViewModel>();
         }
 
         /// <summary>
@@ -166,6 +172,17 @@ namespace Muchinfo.MTPClient.UI
 
         #region ViewModels
         /// <summary>
+        /// 对冲保值
+        /// </summary>
+        public static HedgingEntrustViewModel HedgingEntrust
+        {
+            get
+            {
+                return ServiceLocator.Current.GetInstance<HedgingEntrustViewModel>();
+            }
+        }
+
+        /// <summary>
         /// 只有一个实例,在RegisterViewModels()里注册后使用ServiceLocator
         /// </summary>
         public static HomeViewModel Home

+ 29 - 0
Muchinfo.MTPClient/Fx4.0/Main/03.UI/Muchinfo.TASClient.UI/ViewModels/Bridge.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using Microsoft.Web.WebView2.Core;
+using Muchinfo.MTPClient.Trade.Views.ERMCP;
+
+namespace Muchinfo.MTPClient.UI.ViewModels
+{
+    [ClassInterface(ClassInterfaceType.AutoDual)]
+    [ComVisible(true)]
+    public class Bridge
+    {
+        public string Func(string param)
+        {
+            // 对冲保值
+            HedgingEntrustWindow hedgingEntrustWindow = new HedgingEntrustWindow(param)
+            {
+                WindowStartupLocation = WindowStartupLocation.CenterScreen
+            };
+            _ = hedgingEntrustWindow.ShowDialog();
+
+            return "Example: " + param;
+        }
+    }
+}

+ 16 - 8
Muchinfo.MTPClient/Fx4.0/Main/03.UI/Muchinfo.TASClient.UI/ViewModels/HomeViewModel.cs

@@ -23,6 +23,7 @@ using Muchinfo.MTPClient.IService;
 using Muchinfo.MTPClient.Resources;
 using Muchinfo.MTPClient.Service.Utilities;
 using Muchinfo.MTPClient.Trade.ViewModels;
+using Muchinfo.MTPClient.Trade.Views.ERMCP;
 using Muchinfo.MTPClient.UI.Utilities;
 using Muchinfo.MTPClient.UI.Views;
 using Muchinfo.PC.Common.Extensions;
@@ -766,17 +767,24 @@ namespace Muchinfo.MTPClient.UI.ViewModels
                     v.Owner = Application.Current.MainWindow;
                     v.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                     v.ShowDialog();
+
                     break;
                 case MenuCommandType.OfficalWeb:
-                    if (string.IsNullOrWhiteSpace(ApplicationParameter.WebSite))
-                    {
-                        MessageBoxHelper.ShowInfo(Muchinfo.MTPClient.Resources.Client_Resource.UI2014_NoOfficialWebsitePleaseConfigurationFile, Muchinfo.MTPClient.Resources.Client_Resource.UI2014_ConfigurationError);
-                    }
-                    else
+                    //if (string.IsNullOrWhiteSpace(ApplicationParameter.WebSite))
+                    //{
+                    //    MessageBoxHelper.ShowInfo(Muchinfo.MTPClient.Resources.Client_Resource.UI2014_NoOfficialWebsitePleaseConfigurationFile, Muchinfo.MTPClient.Resources.Client_Resource.UI2014_ConfigurationError);
+                    //}
+                    //else
+                    //{
+                    //    var proc = new Process { StartInfo = { FileName = ApplicationParameter.WebSite } };
+                    //    proc.Start();
+                    //}
+                    HedgingEntrustWindow hedgingEntrustWindow = new HedgingEntrustWindow()
                     {
-                        var proc = new Process { StartInfo = { FileName = ApplicationParameter.WebSite } };
-                        proc.Start();
-                    }
+                        WindowStartupLocation = WindowStartupLocation.CenterScreen
+                    };
+                    _ = hedgingEntrustWindow.ShowDialog();
+
                     break;
                 //case MenuCommandType.OnlineCS:
                 //    break;

+ 1 - 1
Muchinfo.MTPClient/Fx4.0/Main/03.UI/Muchinfo.TASClient.UI/ViewModels/LoginViewModel.cs

@@ -272,7 +272,7 @@ namespace Muchinfo.MTPClient.UI.ViewModels
                 TradePassword = string.Empty;
 
 #if DEBUG
-                TradePassword = "123123";
+                TradePassword = "123456";
 #endif
 
                 if (LoginAccountList == null) return;

+ 2 - 0
Muchinfo.MTPClient/Fx4.0/Main/03.UI/Muchinfo.TASClient.UI/Views/MainPage.xaml.cs

@@ -113,7 +113,9 @@ namespace Muchinfo.MTPClient.UI.Views
             var loginID = UserManager.CurrentTradeAccount.LoginID;
             var pwd = UserManager.CurrentTradeAccount.Md5Password;
             var url = String.Format("{0}?ACCOUNT={1}&PASSWORD={2}", ApplicationParameter.ErmcpWebUrl, loginID, pwd);
+
             webView.Source = new Uri(url);
+            webView.CoreWebView2.AddHostObjectToScript("bridge", new Bridge());
 
             //webView.CoreWebView2.OpenDevToolsWindow();
         }

+ 7 - 4
Muchinfo.MTPClient/Fx4.0/Main/03.UI/Muchinfo.TASClient/Config/Config.xml

@@ -5,14 +5,17 @@
     <QuoteAddress></QuoteAddress>
 
     <!-- 风管云平台服务地址 - 风管云平台 -->
-    <ErmcpAddress>http://103.40.249.127:28280/cfg?key=mtp_20</ErmcpAddress>
-    <ErmcpWebUrl>http://103.40.249.127:28090/#/custom_info/custom_info_unsubmit</ErmcpWebUrl>
+    <!--<ErmcpAddress>http://103.40.249.127:28280/cfg?key=mtp_20</ErmcpAddress>
+    <ErmcpWebUrl>http://103.40.249.127:28090/#/custom_info/custom_info_unsubmit</ErmcpWebUrl>-->
     <!-- 风管云平台服务地址 - 千海金 -->
     <!--<ErmcpAddress>http://103.40.249.123:8280/cfg?key=mtp_20</ErmcpAddress>
     <ErmcpWebUrl>http://103.40.249.123:8090/#/platinum_pick_query/tab</ErmcpWebUrl>-->
+    <!-- 风管云平台服务地址 - 平安 -->
+    <ErmcpAddress>http://103.40.249.124:38280/cfg?key=mtp_20</ErmcpAddress>
+    <ErmcpWebUrl>http://103.40.249.124:39100/#/custom_info/custom_info_normal</ErmcpWebUrl>
     <!-- 风管云平台服务地址 - 测试 -->
-    <!--<ErmcpAddress>http://192.168.21.71:8280/cfg?key=mtp_20</ErmcpAddress>
-    <ErmcpWebUrl>http://192.168.21.71:9999/#/platinum_pick_query/tab</ErmcpWebUrl>-->
+    <!--<ErmcpAddress>http://192.168.31.93:8080/cfg?key=test_93</ErmcpAddress>
+    <ErmcpWebUrl>http://192.168.31.93:5019/webpc/#/custom_info/custom_info_normal</ErmcpWebUrl>-->
     
 
     <!--应用程序升级地址-->

+ 3 - 0
Muchinfo.MTPClient/Fx4.0/Main/04.Infrastructure/Muchinfo.TASClient.Infrastructure/EntityHelpers/QuoteDatagramHelper.cs

@@ -197,6 +197,9 @@ namespace Muchinfo.MTPClient.Infrastructure.EntityHelpers
                         sellSub = (int)sellRules.FeeValue;
                     }
                     roundInt = item.GoodsParameters == null ? 0 : item.GoodsParameters.HqExchFigures;
+                } else
+                {
+                    continue;
                 }
 
                 //根据商品运行状态确定是否要显示行情

+ 9 - 6
Muchinfo.MTPClient/Fx4.0/Main/04.Infrastructure/Muchinfo.TASClient.Infrastructure/Utilities/ApplicationParameter.cs

@@ -619,15 +619,18 @@ namespace Muchinfo.MTPClient.Infrastructure.Utilities
             {
                 groups.ForEach((group) =>
                 {
-                    if (group.GoodsGroupid == currentGoods.GroupID)// 先用商品中的groupId 去 商品组中查找,找出ExchangeId
+                    if (currentGoods != null)
                     {
-                        var exchangeId = group.ExChangeId;
-                        if (external != null && external.Any())
+                        if (group.GoodsGroupid == currentGoods.GroupID)// 先用商品中的groupId 去 商品组中查找,找出ExchangeId
                         {
-                            var exchaneInfo = external.Find((externalExchange) => exchangeId == externalExchange.ExchangeId);
-                            if (exchaneInfo != null)
+                            var exchangeId = group.ExChangeId;
+                            if (external != null && external.Any())
                             {
-                                isMarketPrice = exchaneInfo.IsMarketPrice;
+                                var exchaneInfo = external.Find((externalExchange) => exchangeId == externalExchange.ExchangeId);
+                                if (exchaneInfo != null)
+                                {
+                                    isMarketPrice = exchaneInfo.IsMarketPrice;
+                                }
                             }
                         }
                     }

+ 254 - 263
Muchinfo.MTPClient/Fx4.0/Main/05.Services/Muchinfo.TASClient.Adapter/Data/tas.cs

@@ -10218,270 +10218,261 @@ namespace tas
     global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
       { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
   }
-  
-  [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ChannelOrderReq")]
-  public partial class ChannelOrderReq : global::ProtoBuf.IExtensible
-  {
-    public ChannelOrderReq() {}
-    
-
-    private MessageHead _Header = null;
-    [global::ProtoBuf.ProtoMember(1, IsRequired = false, Name=@"Header", DataFormat = global::ProtoBuf.DataFormat.Default)]
-    [global::System.ComponentModel.DefaultValue(null)]
-    public MessageHead Header
-    {
-      get { return _Header; }
-      set { _Header = value; }
-    }
-
-    private string _ClientSerialNo = "";
-    [global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"ClientSerialNo", DataFormat = global::ProtoBuf.DataFormat.Default)]
-    [global::System.ComponentModel.DefaultValue("")]
-    public string ClientSerialNo
-    {
-      get { return _ClientSerialNo; }
-      set { _ClientSerialNo = value; }
-    }
-
-    private string _ClientOrderTime = "";
-    [global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"ClientOrderTime", DataFormat = global::ProtoBuf.DataFormat.Default)]
-    [global::System.ComponentModel.DefaultValue("")]
-    public string ClientOrderTime
-    {
-      get { return _ClientOrderTime; }
-      set { _ClientOrderTime = value; }
-    }
-
-    private uint _ClientType = uint.MaxValue;
-    [global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"ClientType", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
-    public uint ClientType
-    {
-      get { return _ClientType; }
-      set { _ClientType = value; }
-    }
-
-    private ulong _LoginID = uint.MaxValue;
-    [global::ProtoBuf.ProtoMember(5, IsRequired = false, Name=@"LoginID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
-    public ulong LoginID
-    {
-      get { return _LoginID; }
-      set { _LoginID = value; }
-    }
-
-    private ulong _AccountID = uint.MaxValue;
-    [global::ProtoBuf.ProtoMember(6, IsRequired = false, Name=@"AccountID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
-    public ulong AccountID
-    {
-      get { return _AccountID; }
-      set { _AccountID = value; }
-    }
-
-    private uint _GoodsID = uint.MaxValue;
-    [global::ProtoBuf.ProtoMember(7, IsRequired = false, Name=@"GoodsID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
-    public uint GoodsID
-    {
-      get { return _GoodsID; }
-      set { _GoodsID = value; }
-    }
-
-    private uint _MarketID = uint.MaxValue;
-    [global::ProtoBuf.ProtoMember(8, IsRequired = false, Name=@"MarketID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
-    public uint MarketID
-    {
-      get { return _MarketID; }
-      set { _MarketID = value; }
-    }
-
-    private int _ValidType = int.MinValue;
-    [global::ProtoBuf.ProtoMember(9, IsRequired = false, Name=@"ValidType", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(int.MinValue)]
-    public int ValidType
-    {
-      get { return _ValidType; }
-      set { _ValidType = value; }
-    }
-
-    private uint _ChannelOperateType = uint.MaxValue;
-    [global::ProtoBuf.ProtoMember(10, IsRequired = false, Name=@"ChannelOperateType", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
-    public uint ChannelOperateType
-    {
-      get { return _ChannelOperateType; }
-      set { _ChannelOperateType = value; }
-    }
-
-    private uint _ChannelOrderSrc = uint.MaxValue;
-    [global::ProtoBuf.ProtoMember(11, IsRequired = false, Name=@"ChannelOrderSrc", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
-    public uint ChannelOrderSrc
-    {
-      get { return _ChannelOrderSrc; }
-      set { _ChannelOrderSrc = value; }
-    }
-
-    private uint _HedgeFlag = uint.MaxValue;
-    [global::ProtoBuf.ProtoMember(12, IsRequired = false, Name=@"HedgeFlag", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
-    public uint HedgeFlag
-    {
-      get { return _HedgeFlag; }
-      set { _HedgeFlag = value; }
-    }
-
-    private ulong _OperatorID = uint.MaxValue;
-    [global::ProtoBuf.ProtoMember(13, IsRequired = false, Name=@"OperatorID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
-    public ulong OperatorID
-    {
-      get { return _OperatorID; }
-      set { _OperatorID = value; }
-    }
-
-    private double _OrderPrice = int.MinValue;
-    [global::ProtoBuf.ProtoMember(14, IsRequired = false, Name=@"OrderPrice", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(int.MinValue)]
-    public double OrderPrice
-    {
-      get { return _OrderPrice; }
-      set { _OrderPrice = value; }
-    }
-
-    private ulong _OrderQty = uint.MaxValue;
-    [global::ProtoBuf.ProtoMember(15, IsRequired = false, Name=@"OrderQty", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
-    public ulong OrderQty
-    {
-      get { return _OrderQty; }
-      set { _OrderQty = value; }
-    }
-
-    private uint _BuyOrSell = uint.MaxValue;
-    [global::ProtoBuf.ProtoMember(16, IsRequired = false, Name=@"BuyOrSell", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
-    public uint BuyOrSell
-    {
-      get { return _BuyOrSell; }
-      set { _BuyOrSell = value; }
-    }
-
-    private uint _ChannelBuildType = uint.MaxValue;
-    [global::ProtoBuf.ProtoMember(17, IsRequired = false, Name=@"ChannelBuildType", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
-    public uint ChannelBuildType
-    {
-      get { return _ChannelBuildType; }
-      set { _ChannelBuildType = value; }
-    }
-
-    private uint _CloseType = uint.MaxValue;
-    [global::ProtoBuf.ProtoMember(18, IsRequired = false, Name=@"CloseType", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
-    public uint CloseType
-    {
-      get { return _CloseType; }
-      set { _CloseType = value; }
-    }
-
-    private uint _PriceMode = uint.MaxValue;
-    [global::ProtoBuf.ProtoMember(19, IsRequired = false, Name=@"PriceMode", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
-    public uint PriceMode
-    {
-      get { return _PriceMode; }
-      set { _PriceMode = value; }
-    }
 
-    private uint _TimeValidType = uint.MaxValue;
-    [global::ProtoBuf.ProtoMember(20, IsRequired = false, Name=@"TimeValidType", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
-    public uint TimeValidType
-    {
-      get { return _TimeValidType; }
-      set { _TimeValidType = value; }
-    }
-
-    private ulong _RelatedID = uint.MaxValue;
-    [global::ProtoBuf.ProtoMember(21, IsRequired = false, Name=@"RelatedID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
-    public ulong RelatedID
-    {
-      get { return _RelatedID; }
-      set { _RelatedID = value; }
-    }
-
-    private string _ServiceTime = "";
-    [global::ProtoBuf.ProtoMember(22, IsRequired = false, Name=@"ServiceTime", DataFormat = global::ProtoBuf.DataFormat.Default)]
-    [global::System.ComponentModel.DefaultValue("")]
-    public string ServiceTime
-    {
-      get { return _ServiceTime; }
-      set { _ServiceTime = value; }
-    }
-
-    private string _validtime = "";
-    [global::ProtoBuf.ProtoMember(23, IsRequired = false, Name=@"validtime", DataFormat = global::ProtoBuf.DataFormat.Default)]
-    [global::System.ComponentModel.DefaultValue("")]
-    public string validtime
-    {
-      get { return _validtime; }
-      set { _validtime = value; }
-    }
-
-    private ulong _CloseTodayQty = uint.MaxValue;
-    [global::ProtoBuf.ProtoMember(24, IsRequired = false, Name=@"CloseTodayQty", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
-    public ulong CloseTodayQty
-    {
-      get { return _CloseTodayQty; }
-      set { _CloseTodayQty = value; }
-    }
-
-    private double _CurPrice = int.MinValue;
-    [global::ProtoBuf.ProtoMember(25, IsRequired = false, Name=@"CurPrice", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(int.MinValue)]
-    public double CurPrice
-    {
-      get { return _CurPrice; }
-      set { _CurPrice = value; }
-    }
-
-    private uint _SPPoint = uint.MaxValue;
-    [global::ProtoBuf.ProtoMember(26, IsRequired = false, Name=@"SPPoint", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
-    public uint SPPoint
-    {
-      get { return _SPPoint; }
-      set { _SPPoint = value; }
-    }
-
-    private uint _SLPoint = uint.MaxValue;
-    [global::ProtoBuf.ProtoMember(27, IsRequired = false, Name=@"SLPoint", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
-    [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
-    public uint SLPoint
-    {
-      get { return _SLPoint; }
-      set { _SLPoint = value; }
-    }
-
-    private string _IP = "";
-    [global::ProtoBuf.ProtoMember(28, IsRequired = false, Name=@"IP", DataFormat = global::ProtoBuf.DataFormat.Default)]
-    [global::System.ComponentModel.DefaultValue("")]
-    public string IP
-    {
-      get { return _IP; }
-      set { _IP = value; }
-    }
-    private global::ProtoBuf.IExtension extensionObject;
-    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-      { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
-  }
-  
-  [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ChannelOrderRsp")]
+    [global::System.Serializable, global::ProtoBuf.ProtoContract(Name = @"ChannelOrderReq")]
+    public partial class ChannelOrderReq : global::ProtoBuf.IExtensible
+    {
+        public ChannelOrderReq() { }
+
+
+        private MessageHead _Header = null;
+        [global::ProtoBuf.ProtoMember(1, IsRequired = false, Name = @"Header", DataFormat = global::ProtoBuf.DataFormat.Default)]
+        [global::System.ComponentModel.DefaultValue(null)]
+        public MessageHead Header
+        {
+            get { return _Header; }
+            set { _Header = value; }
+        }
+
+        private string _ClientSerialNo = "";
+        [global::ProtoBuf.ProtoMember(2, IsRequired = false, Name = @"ClientSerialNo", DataFormat = global::ProtoBuf.DataFormat.Default)]
+        [global::System.ComponentModel.DefaultValue("")]
+        public string ClientSerialNo
+        {
+            get { return _ClientSerialNo; }
+            set { _ClientSerialNo = value; }
+        }
+
+        private string _ClientOrderTime = "";
+        [global::ProtoBuf.ProtoMember(3, IsRequired = false, Name = @"ClientOrderTime", DataFormat = global::ProtoBuf.DataFormat.Default)]
+        [global::System.ComponentModel.DefaultValue("")]
+        public string ClientOrderTime
+        {
+            get { return _ClientOrderTime; }
+            set { _ClientOrderTime = value; }
+        }
+
+        private uint _ClientType = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(4, IsRequired = false, Name = @"ClientType", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public uint ClientType
+        {
+            get { return _ClientType; }
+            set { _ClientType = value; }
+        }
+
+        private ulong _LoginID = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(5, IsRequired = false, Name = @"LoginID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public ulong LoginID
+        {
+            get { return _LoginID; }
+            set { _LoginID = value; }
+        }
+
+        private ulong _AccountID = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(6, IsRequired = false, Name = @"AccountID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public ulong AccountID
+        {
+            get { return _AccountID; }
+            set { _AccountID = value; }
+        }
+
+        private uint _GoodsID = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(7, IsRequired = false, Name = @"GoodsID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public uint GoodsID
+        {
+            get { return _GoodsID; }
+            set { _GoodsID = value; }
+        }
+
+        private uint _MarketID = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(8, IsRequired = false, Name = @"MarketID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public uint MarketID
+        {
+            get { return _MarketID; }
+            set { _MarketID = value; }
+        }
+
+        private int _ValidType = int.MinValue;
+        [global::ProtoBuf.ProtoMember(9, IsRequired = false, Name = @"ValidType", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(int.MinValue)]
+        public int ValidType
+        {
+            get { return _ValidType; }
+            set { _ValidType = value; }
+        }
+
+        private uint _ChannelOperateType = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(10, IsRequired = false, Name = @"ChannelOperateType", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public uint ChannelOperateType
+        {
+            get { return _ChannelOperateType; }
+            set { _ChannelOperateType = value; }
+        }
+
+        private uint _ChannelOrderSrc = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(11, IsRequired = false, Name = @"ChannelOrderSrc", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public uint ChannelOrderSrc
+        {
+            get { return _ChannelOrderSrc; }
+            set { _ChannelOrderSrc = value; }
+        }
+
+        private uint _HedgeFlag = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(12, IsRequired = false, Name = @"HedgeFlag", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public uint HedgeFlag
+        {
+            get { return _HedgeFlag; }
+            set { _HedgeFlag = value; }
+        }
+
+        private ulong _OperatorID = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(13, IsRequired = false, Name = @"OperatorID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public ulong OperatorID
+        {
+            get { return _OperatorID; }
+            set { _OperatorID = value; }
+        }
+
+        private double _OrderPrice = int.MinValue;
+        [global::ProtoBuf.ProtoMember(14, IsRequired = false, Name = @"OrderPrice", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(int.MinValue)]
+        public double OrderPrice
+        {
+            get { return _OrderPrice; }
+            set { _OrderPrice = value; }
+        }
+
+        private ulong _OrderQty = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(15, IsRequired = false, Name = @"OrderQty", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public ulong OrderQty
+        {
+            get { return _OrderQty; }
+            set { _OrderQty = value; }
+        }
+
+        private uint _BuyOrSell = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(16, IsRequired = false, Name = @"BuyOrSell", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public uint BuyOrSell
+        {
+            get { return _BuyOrSell; }
+            set { _BuyOrSell = value; }
+        }
+
+        private uint _ChannelBuildType = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(17, IsRequired = false, Name = @"ChannelBuildType", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public uint ChannelBuildType
+        {
+            get { return _ChannelBuildType; }
+            set { _ChannelBuildType = value; }
+        }
+
+        private uint _CloseType = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(18, IsRequired = false, Name = @"CloseType", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public uint CloseType
+        {
+            get { return _CloseType; }
+            set { _CloseType = value; }
+        }
+
+        private uint _PriceMode = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(19, IsRequired = false, Name = @"PriceMode", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public uint PriceMode
+        {
+            get { return _PriceMode; }
+            set { _PriceMode = value; }
+        }
+
+        private uint _TimeValidType = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(20, IsRequired = false, Name = @"TimeValidType", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public uint TimeValidType
+        {
+            get { return _TimeValidType; }
+            set { _TimeValidType = value; }
+        }
+
+        private ulong _RelatedID = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(21, IsRequired = false, Name = @"RelatedID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public ulong RelatedID
+        {
+            get { return _RelatedID; }
+            set { _RelatedID = value; }
+        }
+
+        private string _ServiceTime = "";
+        [global::ProtoBuf.ProtoMember(22, IsRequired = false, Name = @"ServiceTime", DataFormat = global::ProtoBuf.DataFormat.Default)]
+        [global::System.ComponentModel.DefaultValue("")]
+        public string ServiceTime
+        {
+            get { return _ServiceTime; }
+            set { _ServiceTime = value; }
+        }
+
+        private string _validtime = "";
+        [global::ProtoBuf.ProtoMember(23, IsRequired = false, Name = @"validtime", DataFormat = global::ProtoBuf.DataFormat.Default)]
+        [global::System.ComponentModel.DefaultValue("")]
+        public string validtime
+        {
+            get { return _validtime; }
+            set { _validtime = value; }
+        }
+
+        private ulong _CloseTodayQty = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(24, IsRequired = false, Name = @"CloseTodayQty", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public ulong CloseTodayQty
+        {
+            get { return _CloseTodayQty; }
+            set { _CloseTodayQty = value; }
+        }
+
+        private ulong _SpotContractID = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(25, IsRequired = false, Name = @"SpotContractID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public ulong SpotContractID
+        {
+            get { return _SpotContractID; }
+            set { _SpotContractID = value; }
+        }
+
+        private ulong _SaleUserID = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(26, IsRequired = false, Name = @"SaleUserID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public ulong SaleUserID
+        {
+            get { return _SaleUserID; }
+            set { _SaleUserID = value; }
+        }
+
+        private ulong _BizSubjectID = uint.MaxValue;
+        [global::ProtoBuf.ProtoMember(27, IsRequired = false, Name = @"BizSubjectID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
+        [global::System.ComponentModel.DefaultValue(uint.MaxValue)]
+        public ulong BizSubjectID
+        {
+            get { return _BizSubjectID; }
+            set { _BizSubjectID = value; }
+        }
+        private global::ProtoBuf.IExtension extensionObject;
+        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
+    }
+
+    [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ChannelOrderRsp")]
   public partial class ChannelOrderRsp : global::ProtoBuf.IExtensible
   {
     public ChannelOrderRsp() {}

+ 17 - 7
Muchinfo.MTPClient/Fx4.0/Main/05.Services/Muchinfo.TASClient.Adapter/ProtoBuf/OrderProtoBufAdapter.cs

@@ -545,17 +545,27 @@ namespace Muchinfo.MTPClient.Adapter.ProtoBuf
                         UUID = Guid.NewGuid().ToString(),
                         AccountID2 = clientId,
                     },
-                IP = entrustOrder.Ip,
+                //IP = entrustOrder.Ip,
             };
             // 资管添加
-            if (entrustOrder.SLPoint != 0)
-            {
-                marketOrder.SLPoint = (uint) entrustOrder.SLPoint;
-            }
-            if (entrustOrder.SPPoint != 0)
+            //if (entrustOrder.SLPoint != 0)
+            //{
+            //    marketOrder.SLPoint = (uint) entrustOrder.SLPoint;
+            //}
+            //if (entrustOrder.SPPoint != 0)
+            //{
+            //    marketOrder.SPPoint = (uint) entrustOrder.SPPoint;
+            //}
+
+            // 企业风管添加
+            if (entrustOrder.HedgeFlag == 4)
             {
-                marketOrder.SPPoint = (uint) entrustOrder.SPPoint;
+                marketOrder.HedgeFlag = entrustOrder.HedgeFlag;
+                marketOrder.SpotContractID = entrustOrder.SpotContractID;
+                marketOrder.SaleUserID = entrustOrder.SaleUserID;
+                marketOrder.BizSubjectID = entrustOrder.BizSubjectID;
             }
+
             return ProtoBufHelper.EntitySerialize(marketOrder, false);
         }
 

+ 42 - 0
Muchinfo.MTPClient/Fx4.0/Main/05.Services/Muchinfo.TASClient.Data/Model/NewEntrustOrder.cs

@@ -260,5 +260,47 @@ namespace Muchinfo.MTPClient.Data.Model
             get { return _ip; }
             set { _ip = value; }
         }
+
+        #region 企业风管
+        /// <summary>
+        /// 投机套保标志
+        /// </summary>
+        private uint _HedgeFlag;
+        public uint HedgeFlag
+        {
+            get { return _HedgeFlag; }
+            set { _HedgeFlag = value; }
+        }
+
+        private ulong _SpotContractID;
+        /// <summary>
+        /// 现货合同ID-为4:套期保值时填写
+        /// </summary>
+        public ulong SpotContractID
+        {
+            get { return _SpotContractID; }
+            set { _SpotContractID = value; }
+        }
+
+        private ulong _SaleUserID;
+        /// <summary>
+        /// 业务员ID
+        /// </summary>
+        public ulong SaleUserID
+        {
+            get { return _SaleUserID; }
+            set { _SaleUserID = value; }
+        }
+
+        private ulong _BizSubjectID;
+        /// <summary>
+        /// 归属业务部门ID
+        /// </summary>
+        public ulong BizSubjectID
+        {
+            get { return _BizSubjectID; }
+            set { _BizSubjectID = value; }
+        }
+        #endregion
     }
 }