jt
2021-06-10 5d0d028456874576560552f5a5c4e8b801786f11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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<AccountEntity>(str);
            string parentId = menu.UserMenuList.Find(x => x.pId.Equals("-1")).id;
            if(string.IsNullOrEmpty(parentId))
                MessageBoxEx.Show("请检查Autobom菜单配置!");
 
            List<MenuListEntity> 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;
            }     
        }
    }
}