using System; using System.Collections.Generic; using System.Linq; using System.Text; //---------------------------------------------------------------- //Module Name: $safeprojectname$ //Purpose: //CopyRight: Muchinfo //History: //---------------------------------------------------------------- //DateTime 2016/7/22 16:03:12 //Author //Description Create //---------------------------------------------------------------- using System.Windows; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; using Muchinfo.MTPClient.Data; using Muchinfo.MTPClient.Data.Enums; 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.Resources; using System.Collections.ObjectModel; using System.Windows.Media; using Muchinfo.MTPClient.Data.Model.Delivery; using Muchinfo.MTPClient.IService; using GalaSoft.MvvmLight.Ioc; namespace Muchinfo.MTPClient.Trade.ViewModels { public class TradeOrderViewModel : ViewModelBase { private Window _openWindow; ///下单窗口 private bool _isBusy; private bool _isDefautClose; //是否从平仓入口进入 private IDeliveryService _deliveryService; private OrderModel _orderModel = OrderModel.Normal; public OrderModel OrderModel { get { return _orderModel; } } /// /// 选择商品后的入口 /// /// /// public TradeOrderViewModel(QuoteGoods goods, Direction tradeDirection) { _deliveryService = SimpleIoc.Default.GetInstance(); GoodsList = CacheManager.CacheGoodsBaseInfos.Where((item) => (item.ContainsGoodsSrc & (int)GoodsFromScr.Trade) == (int)GoodsFromScr.Trade) .ToList(); ////交易的商品 GoodsList = GoodsList.Where((item) => ((item.TradeMode != eTradeMode.TRADEMODE_SALE))).ToList();//|| (item.TradeMode == eTradeMode.TRADEMODE_SALE && item.GoodsParameters.RunSteps == eRunStep.RUNSTEP_ISSUE_SUBSCRIPTING) if (goods == null || GoodsList.FirstOrDefault(item => item.GoodsId == goods.GoodsId) == null) { _currentGoods = GoodsList.FirstOrDefault(); } else { _currentGoods = GoodsList.FirstOrDefault(item => item.GoodsId == goods.GoodsId); } _direction = tradeDirection; TradeViewModel = CreateTradeModeViewModel(_currentGoods, tradeDirection); ShowTradeArea(); //绑定Popup关联交割商品信息 SelectGoodsOfPAndX_ItemSource(_currentGoods); ShowLockGoods(); } /// /// 选择单据的入口 /// /// /// /// public TradeOrderViewModel(OrderBase orderBase, ePriceMode priceMode, OrderModel orderModel = OrderModel.Normal) { this._orderModel = orderModel; _isDefautClose = true; _deliveryService = SimpleIoc.Default.GetInstance(); GoodsList = CacheManager.CacheGoodsBaseInfos.Where((item) => (item.ContainsGoodsSrc & (int)GoodsFromScr.Trade) == (int)GoodsFromScr.Trade) .ToList(); ////交易的商品 GoodsList = GoodsList.Where((item) => ((item.TradeMode != eTradeMode.TRADEMODE_SALE) || (item.TradeMode == eTradeMode.TRADEMODE_SALE && item.GoodsParameters.RunSteps == eRunStep.RUNSTEP_BIDDINGCONTINUOUS))).ToList(); if (orderBase == null || GoodsList.FirstOrDefault(item => item.GoodsId == orderBase.GoodsId) == null) { _currentGoods = GoodsList.FirstOrDefault(); } else { _currentGoods = GoodsList.FirstOrDefault(item => item.GoodsId == orderBase.GoodsId); } TradeViewModel = CreateCloseViewModel(_currentGoods, orderBase, priceMode, orderModel); ShowTradeArea(); //绑定Popup关联交割商品信息 SelectGoodsOfPAndX_ItemSource(_currentGoods); ShowLockGoods(); TradeViewModel.ChangeBuySellBackground(orderBase.Direction); } private void ShowTradeArea() { Application.Current.Dispatcher.BeginInvoke(new Action(() => { // 没有商品界面是没有办法知道自己显示成什么样子的,所以 MessengerHelper.DefaultSend(_currentGoods != null, MessengerTokens.TradeLoadGoods); })); } #region 只有传统模式的下单界面,才需要锁商品,除此之外就不需要了,因为其他的模式都是弹出框的下单界面。 /// /// 判断传统下单方式下的锁商品按钮显示 /// private void ShowLockGoods() { if (UserManager.GetCurrentLayoutStyle() == LayoutStyle.Tradition) { ShowGoodsLock = true; } else { ShowGoodsLock = false; } LockType = LockType.UnLock; } /// /// 是否显示锁商品按钮 /// private bool _showGoodsLock = true; public bool ShowGoodsLock { get { return _showGoodsLock; } set { Set(() => ShowGoodsLock, ref _showGoodsLock, value); } } #endregion #region 当前资金账号,用户 /// /// 当前资金账号 /// public string CurrentFunAccount { get { ulong _currentFunAccount; //交易员账号和资金账号不一致 if (UserManager.CurrentTradeAccount.FundsAccounts.Any() && UserManager.CurrentTradeAccount.FundsAccounts[0] != null) { _currentFunAccount = UserManager.CurrentTradeAccount.FundsAccounts[0].AccountId; } else { //投资者账号和资金账号一致 _currentFunAccount = UserManager.CurrentTradeAccount.AccountId; } //string CustomerName = UserManager.CurrentTradeAccount.CustomerName; //if (CustomerName.Length > 10) //{ // CustomerName = UserManager.CurrentTradeAccount.CustomerName.Substring(0, 10)+"..."; //} return _currentFunAccount.ToString(); } //set { _currentFunAccount = value; } } public string CurrentFunAccountNameFormat { get { string CustomerName = UserManager.CurrentTradeAccount.CustomerName; if (CustomerName.Length > 10) { CustomerName = UserManager.CurrentTradeAccount.CustomerName.Substring(0, 10) + "..."; } return CustomerName; } } public string CurrentFunAccountName { get { string CustomerName = UserManager.CurrentTradeAccount.CustomerName; return CustomerName; } } #endregion #region 商品列表 private List _goodsList; //商品列表 /// /// 商品列表 /// public List GoodsList { get { return _goodsList; } set { Set(() => GoodsList, ref _goodsList, value); } } #endregion #region 当前选择商品/所属市场【[混合]竞价/即期/竞价全额】 private QuoteGoods _currentGoods; /// /// 当前选择商品 /// public QuoteGoods CurrentGoods { get { return _currentGoods; } set { Set(() => CurrentGoods, ref _currentGoods, value); if (value != null) { if (_isDefautClose) { var holders = UserManager.GetCacheOrders(); if (holders != null) { var defaultHolder = holders.FirstOrDefault((item => item.GoodsId == value.GoodsId)); if (defaultHolder != null) { TradeViewModel = CreateCloseViewModel(value, defaultHolder); return; } } } TradeViewModel = CreateTradeModeViewModel(CurrentGoods, _direction); //绑定Popup关联交割商品信息 SelectGoodsOfPAndX_ItemSource(_currentGoods); if (!IsVisibilityGoodsOfPAndX) { IsChecked_IsPopupOpen = false; } //订阅当前交易选中的商品 UserManager.CurrentGoodsId = (int) value.GoodsId; QuoteProxyHelper.QuoteSubscribe(GoodsFromScr.Trade); SelectGoods(); } } } /// /// 选择商品,报价牌和图表也要联动 /// private void SelectGoods() { if (_currentGoods == null) return; QuoteGoods quoteGoods = CacheManager.CacheGoodsBaseInfos.Find(g => _currentGoods.GoodsId == g.GoodsId); QuoteGoodsForSelectOrder quoteGoodsForSelectOrder = new QuoteGoodsForSelectOrder() { IsSelect = true, QuoteGoods = quoteGoods, }; MessengerHelper.DefaultSend(quoteGoodsForSelectOrder, MessengerTokens.SelectGoodsOrderChange); } private bool _hasGoods = false; public bool HasGoods { get { return _hasGoods; } set { Set(() => HasGoods, ref _hasGoods, value); } } #endregion #region 关联P+X配置列表 private List _relationPerformConfigList = null; /// /// 关联P+X配置列表 /// public List RelationPerformConfigList { get { return _relationPerformConfigList; } set { Set(() => RelationPerformConfigList, ref _relationPerformConfigList, value); } } #endregion #region 隐藏商品配比信息提示 private Visibility _isVisibility_GoodsScale = Visibility.Visible; /// /// 隐藏商品配比信息提示 /// public Visibility IsVisibility_GoodsScale { get { return _isVisibility_GoodsScale; } set { Set(() => IsVisibility_GoodsScale, ref _isVisibility_GoodsScale, value); } } #endregion #region Popup关联交割商品信息 private ObservableCollection _goodsOfPAndXInfoList = new ObservableCollection(); /// /// 选择商品的P+X商品数据源 /// public ObservableCollection GoodsOfPandXInfoList { get { return _goodsOfPAndXInfoList; } set { Set(() => GoodsOfPandXInfoList, ref _goodsOfPAndXInfoList, value); } } #endregion #region 交易类型 private TradeBaseViewModel _tradeViewModel; public TradeBaseViewModel TradeViewModel { get { return _tradeViewModel; } set { if (_tradeViewModel != null) { _tradeViewModel.Cleanup(); } Set(() => TradeViewModel, ref _tradeViewModel, value); } } #endregion /// /// 打开窗口时的买卖方向 /// private Direction _direction; public LockType LockType { get { return ApplicationParameter._LockType; } set { Set(() => LockType, ref ApplicationParameter._LockType, value); } } public RelayCommand LockImageCommand { get { return new RelayCommand(() => { LockType = LockType == LockType.UnLock ? LockType.Lock : LockType.UnLock; }); } } private TradeBaseViewModel CreateTradeModeViewModel(QuoteGoods goods, Direction direction) { if (goods != null) { #region switch goods.GoodsParameters.TradeMode switch (goods.TradeMode) { case eTradeMode.TRADEMODE_MARKETMAKE: return new MarketTradeViewModel(goods, direction); //case eTradeMode.Full_Transfer: // return new BidPayTradeViewModel(goods, direction); case eTradeMode.TRADEMODE_BIDDING://竞价 if (goods.TradeProperty == eTradeProperty.TRADEPROPERTY_CANSHORT) //收益权【改名前=保证金】 { return new BidTradeViewModel(goods, direction); } else { return new BidPayTradeViewModel(goods, direction);//所有权 } case eTradeMode.TRADEMODE_LISTING_SELECT://挂牌点选 goods.formType = eOrderFormType.Listting; if (goods.TradeProperty == eTradeProperty.TRADEPROPERTY_CANSHORT) //收益权【改名前=保证金】 { return new TradeListingViewModel(goods, direction); } else { return new TradeListingFullViewModel(goods, direction); //所有权不能建空,只能买(建),卖(平)-》有头寸 } //case eTradeMode.TRADEMODE_SALE: // return new SaleTradeViewModel(goods, direction); //case eTradeMode.TRADEMODE_BIDDINGMARKETMAKE: // //if (goods.GoodsParameters.MoneyMode == eMoneyMode.MONEYMODE_MARGIN) // if (goods.TradeProperty == eTradeProperty.TRADEPROPERTY_CANSHORT) //收益权【改名后】=保证金 // { // return new MixTradeViewModel(goods, direction); // } // else // { // return new MixPayTradeViewModel(goods, direction); // } case eTradeMode.TRADEMODE_ENTRUST_HEDGE: //通道交易市场 return new ChannelTradeViewMode(goods, direction); default: return new MarketTradeViewModel(goods, direction); } #endregion } else { return null; } } /// /// 持仓汇总平仓调用 /// /// /// /// /// private TradeBaseViewModel CreateCloseViewModel(QuoteGoods goods, OrderBase orderBase, ePriceMode priceMode = ePriceMode.PRICEMODE_MARKET, OrderModel orderModel = OrderModel.Normal) { switch (goods.TradeMode) { case eTradeMode.TRADEMODE_MARKETMAKE: return new MarketTradeViewModel(goods, orderBase); //case eTradeMode.Full_Transfer: // return new BidPayTradeViewModel(goods, orderBase); case eTradeMode.TRADEMODE_BIDDING://无报价商竞价 if (goods.TradeProperty == eTradeProperty.TRADEPROPERTY_CANSHORT) //收益权【改名前=保证金】 { return new BidTradeViewModel(goods, orderBase); } else { return new BidPayTradeViewModel(goods, orderBase);//所有权 } case eTradeMode.TRADEMODE_LISTING_SELECT://挂牌点选 goods.formType = eOrderFormType.Listting; if (goods.TradeProperty == eTradeProperty.TRADEPROPERTY_CANSHORT) //收益权【改名前=保证金】 { return new TradeListingViewModel(goods, orderBase); } else { return new TradeListingFullViewModel(goods, orderBase); //所有权不能建空,只能买(建),卖(平)-》有头寸 } //case eTradeMode.TRADEMODE_SALE: //case eTradeMode.TRADEMODE_BIDDINGMARKETMAKE: //case eTradeMode.TRADEMODE_BIDDING: //case eTradeMode.TRADEMODE_MARKETMAKE: // if (priceMode == ePriceMode.PRICEMODE_MARKET) // { // return new MarketTradeViewModel(goods, orderBase); // } // else // { // return new MarketTradeViewModel(goods, orderBase, priceMode); // } //case eTradeMode.TRADEMODE_BIDDING: // if (goods.GoodsParameters.MoneyMode == eMoneyMode.MONEYMODE_MARGIN) // { // return new BidTradeViewModel(goods, orderBase); // } // else // { // return new BidPayTradeViewModel(goods, orderBase); // } //case eTradeMode.TRADEMODE_BIDDINGMARKETMAKE: // if (goods.GoodsParameters.MoneyMode == eMoneyMode.MONEYMODE_MARGIN) // { // return new MixTradeViewModel(goods, orderBase); // } // else // { // return new MixPayTradeViewModel(goods, orderBase); // } //case eTradeMode.TRADEMODE_SALE: // return new SaleTradeViewModel(goods, Direction.Bid); case eTradeMode.TRADEMODE_ENTRUST_HEDGE: return new ChannelTradeViewMode(goods, orderBase, orderModel); default: if (priceMode != ePriceMode.PRICEMODE_MARKET) { return new MarketTradeViewModel(goods, orderBase); } else { return new MarketTradeViewModel(goods, orderBase, priceMode); } } } #region 【置灰】设置按键不可用 private bool _oKButtonEnabled = true; /// ///设置按键不可用 /// public bool OKButtonEnabled { get { return _oKButtonEnabled; } set { Set(() => OKButtonEnabled, ref _oKButtonEnabled, value); } } /// /// 传统模式显示确认 /// public bool IsOKCommandVbs { get { return UserManager.GetCurrentLayoutStyle() == LayoutStyle.Tradition; } } #endregion #region 是否忙 /// /// 是否忙 /// public bool IsBusy { get { return _isBusy; } set { Set(() => IsBusy, ref _isBusy, value); } } #endregion #region "Public Commands" #region IsPopupOpenCheckedCommand private RelayCommand _isPopupOpenCheckedCommand; /// /// Gets the IsPopupOpenCheckedCommand. /// public RelayCommand IsPopupOpenCheckedCommand { get { return _isPopupOpenCheckedCommand ?? (_isPopupOpenCheckedCommand = new RelayCommand( () => { if (IsChecked_IsPopupOpen) { IsDeliveryInfoStaysOpen = true; IsDeliveryInfoStaysOpen = false; IsChecked_IsPopupOpen = false; } else { IsDeliveryInfoStaysOpen = false; IsChecked_IsPopupOpen = true; } })); } } #endregion #region 窗口改变大小事件 private RelayCommand _sizeChangedCommand; /// /// Gets the SizeChangedCommand. /// public RelayCommand SizeChangedCommand { get { return _sizeChangedCommand ?? (_sizeChangedCommand = new RelayCommand( () => { if (IsChecked_IsPopupOpen && IsVisibilityGoodsOfPAndX) { IsChecked_IsPopupOpen = false; IsChecked_IsPopupOpen = true; } else { IsChecked_IsPopupOpen = false; } })); } } #endregion /// /// 快速下单窗口取消 /// public RelayCommand CancelCommand { get { return new RelayCommand((dialog) => { dialog.DialogResult = false; }); } } /// /// 传统下单 /// public RelayCommand TradionOKCommand { get { return new RelayCommand((i) => { if (_currentGoods == null) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { MessageBoxHelper.ShowQuestion(Client_Resource.GoodsSelect_Vailed, Client_Resource.DeliveryOrderView_WarningTipsTitle); })); return; } TradeViewModel.Direction = (Direction)i; OKButtonEnabled = false; string errorMsg = string.Empty; bool validateBool = TradeViewModel.Validated(ref errorMsg); ////内容验证 if (validateBool) { if (ComfirmCheck()) { IsBusy = true; TradeViewModel.PostOrder(EntrurstSuccessCallBack, EntrurstErrorCallBack); } else { OKButtonEnabled = true; } } else { MessageBoxHelper.ShowInfo(errorMsg, Client_Resource.MessageBox_Error_Title); OKButtonEnabled = true; if (IsOKCommandVbs) ////传统下单 { MessengerHelper.DefaultSend(true, MessengerTokens.SetOrderFoucsToken); } } }); } } private bool ComfirmCheck() { var userInfo = UserManager.GetCurrentUserInfo(); ////交易菜单设置 if (userInfo.TradeParams == null) { userInfo.TradeParams = new TradeParams(); } var result = true; if (userInfo.TradeParams.IsOrderComfrim) { var comfim = new OrderComfirmModel() { GoodsName = TradeViewModel.CurrentGoods.Name, Lot = TradeViewModel.Lot, Direction = TradeViewModel.Direction, OrderPrice = TradeViewModel.ExecutePrice, }; var comfirm = new OrderComfirm() { DataContext = comfim, Owner = Application.Current.MainWindow }; if (comfirm.ShowDialog() != true) { result = false; } } return result; } /// /// 下单确定 /// public RelayCommand OKCommand { get { return new RelayCommand((dialog) => { OKButtonEnabled = false; string errorMsg = string.Empty; bool validateBool = TradeViewModel.Validated(ref errorMsg); ////内容验证 if (validateBool) { if (ComfirmCheck() && TradeViewModel.CheckProfitLoss()/*新增加的判断,用于止盈止损下单界面,此方法已经有弹出框的提示,true表示放行*/) { IsBusy = true; _openWindow = dialog; TradeViewModel.PostOrder(EntrurstSuccessCallBack, EntrurstErrorCallBack); } else { OKButtonEnabled = true; } } else { MessageBoxHelper.ShowInfo(errorMsg, Client_Resource.MessageBox_Error_Title); OKButtonEnabled = true; if (IsOKCommandVbs) ////传统下单 { MessengerHelper.DefaultSend(true, MessengerTokens.SetOrderFoucsToken); } } }); } } #endregion "Public Commands" /// /// 提交成功返回 /// /// private void EntrurstSuccessCallBack(OrderDetail order) { IsBusy = false; Application.Current.Dispatcher.BeginInvoke(new Action(() => { OKButtonEnabled = true; CloseOrderWin(); if (IsOKCommandVbs) ////传统下单 { MessengerHelper.DefaultSend(true, MessengerTokens.SetOrderFoucsToken); } })); if (TradeViewModel.OrderFlag == OrderMethods.NormalOrder) { //刷新正常单 MessengerHelper.DefaultSend(UserManager.CurrentTradeAccount, MessengerTokens.OrderNoticeToken); //MessengerHelper.DefaultSend(string.Empty, MessengerTokens.UpdateCacheGoodsToken); } else { //刷新预埋单 MessengerHelper.DefaultSend(false, MessengerTokens.PreOrderUpdate); } //MessengerHelper.DefaultSend(string.Empty, MessengerTokens.OrderRefresh);//下单成功后刷新界面 } /// /// 下单关窗口 /// private void CloseOrderWin() { var userInfo = UserManager.GetCurrentUserInfo(); ////交易菜单设置 if (userInfo.TradeParams == null) { userInfo.TradeParams = new TradeParams(); } if (userInfo.TradeParams.IsSuccessComfrim) ////下单成功是否提示 { if (OpenCloseMode.BUILDTYPE_CLOSETHENOPEN == TradeViewModel.OpenCloseMode) // 自动开平 { MessageBoxHelper.ShowSuccess("操作成功!", Client_Resource.UI2014_Tips); } else { MessageBoxHelper.ShowSuccess(Client_Resource.Order_Success_Result, Client_Resource.UI2014_Tips); } } if (_openWindow != null) { _openWindow.Close(); this.Cleanup(); } } /// /// 委托失败返回 /// /// private void EntrurstErrorCallBack(ErrorEntity errorEntity) { IsBusy = false; Application.Current.Dispatcher.BeginInvoke(new Action(() => { #region 提示失败 也刷新单据 if (TradeViewModel.OrderFlag == OrderMethods.NormalOrder) { //刷新正常单 MessengerHelper.DefaultSend(UserManager.CurrentTradeAccount, MessengerTokens.OrderNoticeToken); } else { //刷新预埋单 MessengerHelper.DefaultSend(false, MessengerTokens.PreOrderUpdate); } #endregion OKButtonEnabled = true; ErrorManager.ShowReturnError(errorEntity, Client_Resource.UI2014_Tips, true); if (_openWindow != null) { _openWindow.Close(); this.Cleanup(); } if (IsOKCommandVbs) ////传统下单 { MessengerHelper.DefaultSend(true, MessengerTokens.SetOrderFoucsToken); MessengerHelper.DefaultSend("", MessengerTokens.OrderChangeToRefeshTrade);// 刷新界面某个值 } })); } private eDeliveryContractLink _relationMode; /// /// 关联模式 /// public eDeliveryContractLink RelationMode { get { return _relationMode; } set { Set(() => RelationMode, ref _relationMode, value); } } private string _PDeliveryGoodsName; /// /// P交割模式商品 /// public string PDeliveryGoodsName { get { return _PDeliveryGoodsName; } set { Set(() => PDeliveryGoodsName, ref _PDeliveryGoodsName, value); } } private string _BelowDeliveryInfoTips = Client_Resource.EntrustOrderView_DeliveryGoodsInfo_BelowIsDeliveryInfo; /// /// 交割模式信息提示 /// public string BelowDeliveryInfoTips { get { return _BelowDeliveryInfoTips; } set { Set(() => BelowDeliveryInfoTips, ref _BelowDeliveryInfoTips, value); } } public bool IsDeliveryVisible { get { return ApplicationParameter.IsDeliveryVisible == 1 && UserManager.IsAccountLogin; } } private bool _isVisibilityGoodsOfPAndX = false; /// /// 是否显示P+X商品数据源LIST /// public bool IsVisibilityGoodsOfPAndX { get { return _isVisibilityGoodsOfPAndX; } set { Set(() => IsVisibilityGoodsOfPAndX, ref _isVisibilityGoodsOfPAndX, value); } } #region IsDeliveryInfoStaysOpen private bool _isDeliveryInfoStaysOpen = false; /// /// Sets and gets the IsDeliveryInfoStaysOpen property. /// public bool IsDeliveryInfoStaysOpen { get { return _isDeliveryInfoStaysOpen; } set { Set(() => IsDeliveryInfoStaysOpen, ref _isDeliveryInfoStaysOpen, value); } } #endregion #region 交割信息CheckBox按钮 private bool _isChecked_IsPopupOpen = false; /// /// 交割信息CheckBox按钮 /// public bool IsChecked_IsPopupOpen { get { return _isChecked_IsPopupOpen; } set { Set(() => IsChecked_IsPopupOpen, ref _isChecked_IsPopupOpen, value); } } #endregion /// /// 绑定关联交割商品信息 /// /// private void SelectGoodsOfPAndX_ItemSource(QuoteGoods goodsItem) { GoodsOfPandXInfoList.Clear(); PDeliveryGoodsName = ""; IsVisibilityGoodsOfPAndX = false; var tempPAndXList = CacheManager.AllDeliveryRelationList.Where(x => x.GoodsId == goodsItem.GoodsId).ToList(); if (tempPAndXList != null && tempPAndXList.Count() > 0) { _deliveryService.SearchRelationPerformConfig(tempPAndXList.FirstOrDefault().RelationId, QueryRelationConfigSuccess, null); if (IsDeliveryVisible && tempPAndXList.FirstOrDefault().RelationMode != eDeliveryContractLink.None) { IsVisibilityGoodsOfPAndX = true; } foreach (var item in tempPAndXList) { if (string.IsNullOrEmpty(PDeliveryGoodsName)) { IsVisibility_GoodsScale = Visibility.Visible; switch (item.RelationMode) { case eDeliveryContractLink.None: PDeliveryGoodsName = "N"; BelowDeliveryInfoTips = Client_Resource.EntrustOrderView_DeliveryGoodsInfo_BelowIsDeliveryInfoN; break; case eDeliveryContractLink.Normal: PDeliveryGoodsName = "P"; IsVisibility_GoodsScale = Visibility.Collapsed; break; case eDeliveryContractLink.PAndX: PDeliveryGoodsName = "P+X"; break; } } if (!GoodsOfPandXInfoList.Any(x => x.GoodsId == item.GoodsId)) { GoodsOfPandXInfoList.Add(new GoodsOfPAndX() { DeliveryGoodsName = item.deliverygoodsname, DeliveryGoodsCode = item.deliverygoodscode, RelationGoodsCode = item.RelationGoodscode, RelationGoodsName = item.RelationGoodsname, RelationGoodsNameCodeDisplay = item.RelationGoodsNameCodeDisplay, RelationMode = item.RelationMode, GoodsScale = item.GoodsScale, GoodsId = item.GoodsId, Conversion = item.Conversion, Deliverypricemove = item.DeliveryPriceMove, //AgreeUnit=item.AgreeUnit, GoodsUnitId = item.GoodsId, goodsUnitName = item.goodsUnitName, BrandList = item.BrandList, RankList = item.RankList, WarehouseList = item.WarehouseList }); } } } if (!IsVisibilityGoodsOfPAndX) { IsChecked_IsPopupOpen = false; } } /// /// 设置订单价格 /// /// public void SetOrderPrice(decimal price) { if (this.TradeViewModel != null) { TradeViewModel.SetOrderPrice(price); } } public override void Cleanup() { if (this._tradeViewModel != null) { _tradeViewModel.Cleanup(); } base.Cleanup(); } /// /// 交割关系配置查询-成功返回 /// /// protected void QueryRelationConfigSuccess(List itemList) { if (itemList != null) { RelationPerformConfigList = itemList; } } /// /// 是否显示买卖价格的显示区域 /// public bool ShowBuySellPriceArea { get { return ApplicationParameter.ShowBuyOrSellPrice; } } private bool _showOkCancel; public bool ShowOkCancel { get { return _showOkCancel; } set { Set(() => ShowOkCancel, ref _showOkCancel, value); } } } }