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");
}
/////
///// 库位状态与颜色绑定
/////
private void BindingPlace1(string layer)
{
var srv = WareHouseService.GetInstance();
var NoUseplacelst = srv.GetALlNoUsePlace();
List emptyPlaceLst = srv.GetEmptyInPlace();
List inStockPlaceLst = srv.GetItemInPlace();
List 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";
}
}
}
}
}
}
///
/// 根据列和层数初始化模型
///
/// 控件
/// 列
/// 层
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");
}
}
}
}