| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- using GalaSoft.MvvmLight.Command;
- using Muchinfo.MTPClient.Data;
- using Muchinfo.MTPClient.Data.Enums;
- using Muchinfo.MTPClient.Delivery.Views;
- using Muchinfo.MTPClient.Infrastructure.Helpers;
- using Muchinfo.MTPClient.IService;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows;
- using System.Windows.Input;
- namespace Muchinfo.MTPClient.Delivery.Utilities
- {
- /// <summary>
- /// 交收管理菜单
- /// Add By DK 20160804
- /// </summary>
- public class DeliveryMenuService : IModuleMenuService
- {
- /// <summary>
- /// Gets the module menu items.
- /// </summary>
- /// <returns>System.Collections.Generic.Dictionary{Muchinfo.MTPClient.Data.Enums.MenuCommandType,Muchinfo.MTPClient.Data.SysMenuItem}.</returns>
- public Dictionary<MenuCommandType, SysMenuItem> GetModuleMenuItems()
- {
- var sysMenu = new Dictionary<MenuCommandType, SysMenuItem>();
- sysMenu.Add(MenuCommandType.DeliveryManage, new SysMenuItem(MenuCommandType.DeliveryManage));
- sysMenu.Add(MenuCommandType.DeliveryDeclaration, new SysMenuItem(MenuCommandType.DeliveryDeclaration) { Command = MenuCommand, ViewType = typeof(NDeliveryOrderView), IsDialog = true });
- //sysMenu.Add(MenuCommandType.DeliveryDeclarationSearch, new SysMenuItem(MenuCommandType.DeliveryDeclarationSearch) { Command = MenuCommand, ViewType = typeof(DeliveryEntructOrderView), });
- sysMenu.Add(MenuCommandType.DeliveryDeclarationSearch, new SysMenuItem(MenuCommandType.DeliveryDeclarationSearch) { Command = MenuCommand, ViewType = typeof(NDeliveryEntructOrderView), });
- sysMenu.Add(MenuCommandType.DeliveryOrderSearch, new SysMenuItem(MenuCommandType.DeliveryOrderSearch) { Command = MenuCommand, ViewType = typeof(DryHoldDetailView), });
- sysMenu.Add(MenuCommandType.WarehouseManagement, new SysMenuItem(MenuCommandType.WarehouseManagement));
- //仓单查询
- sysMenu.Add(MenuCommandType.WarehouseSearch, new SysMenuItem(MenuCommandType.WarehouseSearch) { Command = MenuCommand, ViewType = typeof(DeliveryWarehouseOrderView), });
- //提货申请
- sysMenu.Add(MenuCommandType.TakaDeliveryGoodsApply, new SysMenuItem(MenuCommandType.TakaDeliveryGoodsApply) { Command = MenuCommand, ViewType = typeof(TakaDeliveryGoodsApplyView), IsDialog = true });
- //提货查询
- sysMenu.Add(MenuCommandType.TakaDeliveryGoodsQuery, new SysMenuItem(MenuCommandType.TakaDeliveryGoodsQuery) { Command = MenuCommand, ViewType = typeof(TakaDeliveryGoodsQueryView), });
- //成交单查询
- sysMenu.Add(MenuCommandType.DeliveryComplete, new SysMenuItem(MenuCommandType.DeliveryComplete) { Command = MenuCommand, ViewType = typeof(DeliveryComplete), });
- return sysMenu;
- }
- private ICommand _menuCommand;
- /// <summary>
- /// 菜单操作
- /// </summary>
- public ICommand MenuCommand
- {
- get
- {
- if (_menuCommand == null)
- {
- _menuCommand = new RelayCommand<SysMenuItem>((item) =>
- {
- if (!item.IsDialog)
- {
- var type = item.ViewType;
- var assembly = System.Reflection.Assembly.GetAssembly(type);
- var view = assembly.CreateInstance(type.FullName, false, System.Reflection.BindingFlags.CreateInstance, null, item.Params == null ? null : item.Params.ToArray(), null, null) as FrameworkElement;
- if (view != null)
- {
- MessengerHelper.DefaultSend(view, MessengerTokens.ShowQueryContet);
- }
- }
- else
- {
- var type = item.ViewType;
- var assembly = System.Reflection.Assembly.GetAssembly(type);
- var view = assembly.CreateInstance(type.FullName, false, System.Reflection.BindingFlags.CreateInstance, null, item.Params == null ? null : item.Params.ToArray(), null, null) as Window;
- if (view != null)
- {
- view.Owner = Application.Current.MainWindow;
- view.WindowStartupLocation = WindowStartupLocation.CenterOwner;
- view.ShowDialog();
- }
- }
- });
- }
- return _menuCommand;
- }
- }
- }
- }
|