using DevComponents.DotNetBar; using HH.WMS.Client.Common; using HH.WMS.Client.frm; using HH.WMS.Entitys.Func; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using WindowsFormsApplication2; namespace HH.WMS.Client { public partial class Main : DevComponents.DotNetBar.Metro.MetroForm { public Main() { InitializeComponent(); } private void metroTileItem1_Click(object sender, EventArgs e) { ItemTagPrint print = new ItemTagPrint(); print.ShowDialog(); } private void metroTileItem2_Click(object sender, EventArgs e) { frmUpShelves frm= new frmUpShelves(); frm.ShowDialog(); } private void metroTileItem4_Click(object sender, EventArgs e) { Application.Exit(); } private void metroTileItem3_Click(object sender, EventArgs e) { frmPicking frm = new frmPicking(); frm.ShowDialog(); } private void metroTileItem5_Click(object sender, EventArgs e) { frmPacking frm = new frmPacking(); frm.ShowDialog(); } private void mtiSet_Click(object sender, EventArgs e) { fromSysSet from = new fromSysSet(); from.ShowDialog(); } private void Main_Load(object sender, EventArgs e) { var UserCode = StaticUtil.User.userCode; var appCode = "AutoWMS"; string parentCode = "0"; var entity = new { userName = UserCode, parentCode = parentCode, appCode = appCode, showType=2 }; //string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(entity); //string result = HH.WMS.Common.WebApiManager.HttpAutoBom_Post("api/Menu/GetMenuByUser", jsonString); string str = WebApiManager.HttpWMS_Post("/api/Login/GetUserMenu", Newtonsoft.Json.JsonConvert.SerializeObject(entity)); AccountEntity menu = JsonConvert.DeserializeObject(str); string parentId = menu.UserMenuList.Find(x => x.pId.Equals("-1")).id; if(string.IsNullOrEmpty(parentId)) MessageBoxEx.Show("请检查Autobom菜单配置!"); List menuList = menu.UserMenuList.FindAll(x => x.pId == parentId).ToList(); if (menuList.Exists(x => x.url.Equals("ItemTagPrint"))) { metroTileItem1.Visible = true; } if (menuList.Exists(x => x.url.Equals("frmUpShelves"))) { metroTileItem2.Visible = true; } if (menuList.Exists(x => x.url.Equals("frmPicking"))) { metroTileItem3.Visible = true; } if (menuList.Exists(x => x.url.Equals("frmPacking"))) { metroTileItem5.Visible = true; } if (menuList.Exists(x => x.url.Equals("fromSysSet"))) { mtiSet.Visible = true; } } } }