2
schangxiang@126.com
2024-08-16 b47c50a2a514def7374b32d7194b2c599cba5625
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
using FineUIPro;
using iWareDataCore.BASE.Service;
using iWareWms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
 
namespace iWareWms.View.SL.WareHouse
{
    public partial class WareHousePreView : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadData();
            }
        }
 
        private void LoadData()
        {
            InitialForRack(1, 29, 16, Panel1);
            BindingPlace1("1");
        }
 
 
 
        ///// <summary>
        ///// 库位状态与颜色绑定
        ///// </summary>
        private void BindingPlace1(string layer)
        {
            var srv = WareHouseService.GetInstance();
            var NoUseplacelst = srv.GetALlNoUsePlace();
            List<string> emptyPlaceLst = srv.GetEmptyInPlace();
            List<string> inStockPlaceLst = srv.GetItemInPlace();
            List<string> lockedPlaceLst = srv.GetLockedPlace();
            lab1.Text = "2";
            lab2.Text = emptyPlaceLst.Count.ToString();
            //lab3.Text = emptyPlaceLst.Count.ToString();
            lab4.Text = inStockPlaceLst.Count.ToString();
            lab5.Text = lockedPlaceLst.Count.ToString();
 
            foreach (Control c in Panel1.Controls)
            {
                if (c is Panel)
                {
                    foreach (Control btn in c.Controls)
                    {
                        if (btn is FineUIPro.Button)
                        {
                            FineUIPro.Button b = btn as FineUIPro.Button;
                            string listFind = "";
                            listFind = emptyPlaceLst.Find(x => x == b.Text.Trim());
                            if (!string.IsNullOrEmpty(listFind))
                            {
                                b.CssClass = "GrayFont";
                            }
                            listFind = inStockPlaceLst.Find(x => x == b.Text.Trim());
                            if (!string.IsNullOrEmpty(listFind))
                            {
                                b.CssClass = "GreenFont";
                            }
                            listFind = lockedPlaceLst.Find(x => x == b.Text.Trim());
                            if (!string.IsNullOrEmpty(listFind))
                            {
                                b.CssClass = "RedFont";
                            }
                            if (NoUseplacelst.Contains(b.Text))
                            {
                                b.Text = "";
                                b.CssClass = "WriteFont";
                            }
                        }
                    }
                }
            }
        }
 
        
 
        /// <summary>
        /// 根据列和层数初始化模型
        /// </summary>
        /// <param name="sender">控件</param>
        /// <param name="column">列</param>
        /// <param name="layer">层</param>
        private void InitialForRack(int row, int layer, int column, Panel panel)
        {
    
            string l = "";
            string c = "";
            for (int i = layer; i >= 1; i--)
            {
               Panel pl = new Panel()
                {
                    BoxFlex = 1,
                    TableRowspan = 1,
                    Layout = FineUIPro.LayoutType.HBox,
                    TableColspan = 14,
                    BoxConfigChildMargin = "3 3 3 3",
                    ShowHeader = false
                };
               string rr = "";
               for (int j = 1; j <= column; j++)
                {
                    if (j < 10)
                    {
                        c = "0" + j.ToString();
 
                    }
                    else if (j >= 10 )
                    {
                        c = j.ToString();
                    }
                    if (i < 10)
                    {
                        l = "0" + i.ToString();
                    }
                    else if (i >= 10)
                    {
                        l = i.ToString();
                    }
                    if ((j % 2) == 0)
                    {
                        rr = (j / 2).ToString();
                    }
                    if ((j % 2) == 1)
                    {
                        rr = ((j / 2) + 1).ToString();
                    }
                    string text1 = rr + l + c;
                   FineUIPro.Button btn = new FineUIPro.Button()
                    {
                        BoxFlex = 1,
                        TableRowspan = 1,
                        TableColspan = 1,
                        BoxConfigChildMargin = "3 3 3 3",
                        EnablePostBack = false
                    };
  
                    if (text1 == "60111")
                    {
                        btn.Text = "入库口";
                        btn.CssClass = "BlackFont";
                    }
                    else if (text1 == "20103")
                    {
                        btn.Text = "出库口";
                        btn.CssClass = "BlackFont";
                    }else
                    {
 
                        btn.Text = text1;
                        btn.CssClass = "GrayFont";
 
                    }
                      pl.Items.Add(btn);
                }
                panel.Items.Add(pl);
            }
        }
 
        
 
        protected void TabStrip1_TabIndexChanged(object sender, EventArgs e)
        {
            if (TabStrip1.ActiveTabIndex == 0)
            {
                BindingPlace1("1");
            }
        }
    }
}