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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
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 WareHouse : PageBase
    {
        //#region ViewPower
        ///// <summary>
        ///// 本页面的浏览权限,空字符串表示本页面不受权限控制
        ///// </summary>
        //public override string ViewPower
        //{
        //    get
        //    {
        //        return "浏览库存";
        //    }
        //}
 
        //#endregion
 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadData();
            }
        }
 
        private void LoadData()
        {
            InitialForRack(1, 15, 16, Panel1);
            InitialForRack2(1, 29, 16, Panel2);
            BindingPlace1("1");
            BindingPlace2("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 Button)
                        {
                            Button b = btn as 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 (b.Text == "20103" )
                            {
                                b.Text = "出库口";
                                b.CssClass = "BlackFont";
                            }
                            if (b.Text == "60111" )
                            {
                                b.Text = "入库口";
                                b.CssClass = "BlackFont";
                                
                            }
                            if (NoUseplacelst.Contains(b.Text))
                            {
                                b.Text = "";
                                b.CssClass = "WriteFont";
                            }
                         
                        }
                    }
                }
            }
        }
 
        /// <summary>
        /// 库位与颜色绑定
        /// </summary>
        /// <param name="layer"></param>
        private void BindingPlace2(string layer)
        {
            var srv = WareHouseService.GetInstance();
            List<string> emptyPlaceLst = srv.GetEmptyInPlace();
            List<string> inStockPlaceLst = srv.GetItemInPlace();
            List<string> lockedPlaceLst = srv.GetLockedPlace();
           
            lab6.Text = "2";
            lab7.Text = emptyPlaceLst.Count.ToString();
            //lab3.Text = emptyPlaceLst.Count.ToString();
            lab9.Text = inStockPlaceLst.Count.ToString();
            lab10.Text = lockedPlaceLst.Count.ToString();
 
            foreach (Control c in Panel2.Controls)
            {
                if (c is Panel)
                {
                    foreach (Control btn in c.Controls)
                    {
                        if (btn is Button)
                        {
                            Button b = btn as 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";
                            }
                        }
                    }
                }
            }
        }
 
        /// <summary>
        /// 根据列和层数初始化模型1-15
        /// </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 r = "0" + row;
            string l = "";
            string c = "";
            for (int i = layer; i >= 1; i--)
            {
                Panel pl = new Panel()
                {
                    BoxFlex = 1,
                    TableRowspan = 1,
                    Layout = LayoutType.HBox,
                    TableColspan = 16,
                    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;
                    Button btn = new Button()
                    {
                        BoxFlex = 1,
                        TableRowspan = 1,
                        TableColspan = 1,
                        BoxConfigChildMargin = "3 3 3 3",
                        Text = text1,
                        CssClass = "GrayFont",
                        EnablePostBack = false
                    };
                    pl.Items.Add(btn);
                }
                panel.Items.Add(pl);
            }
        }
 
        /// <summary>
        /// 根据列和层数初始化模型16-29
        /// </summary>
        /// <param name="sender">控件</param>
        /// <param name="column">列</param>
        /// <param name="layer">层</param>
        private void InitialForRack2(int row, int layer, int column, Panel panel)
        {
            string r = "0" + row;
            string l = "";
            string c = "";
            for (int i = layer; i >= 16; i--)
            {
                Panel pl = new Panel()
                {
                    BoxFlex = 1,
                    TableRowspan = 1,
                    Layout = FineUIPro.LayoutType.HBox,
                    TableColspan = 16,
                    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();
                    }
                   
                    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",
                        Text = text1,
                        CssClass = "GrayFont",
                        EnablePostBack = false
                    };
                    pl.Items.Add(btn);
                }
                panel.Items.Add(pl);
            }
        }
 
        protected void TabStrip1_TabIndexChanged(object sender, EventArgs e)
        {
            if (TabStrip1.ActiveTabIndex == 0)
            {
                BindingPlace1("1");
            }
            else
            {
                BindingPlace2("1");
            }
        }
    }
}