change - 货道监控货道号显示

dev
wenjy 1 year ago
parent c53f513ec4
commit dc1cddd908

@ -51,5 +51,7 @@ namespace Aucma.Core.OldBoxFoam.Models
public string MaterialCode { get; set; }
public string MaterialName { get; set; }
public string SpaceName { get; set; }
}
}

@ -125,26 +125,57 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
public async void InitData(object? sender, ElapsedEventArgs e)
{
List<OldBoxFoamType> list = await _oldBoxFoamTypeServices.QueryAsync();
if (list == null) return;
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
if(list != null)
{
ListItems.Clear();
foreach (OldBoxFoamType item in list)
if(list.Count > 0)
{
ListItems.Add(new OldBoxFoamTypeModel()
{
ObjId = item.ObjId,
Local = item.Local,
Status = item.Storeamount==3?"1":"0",
Storeamount = item.Storeamount,
MaterialCode = item.MaterialCode,
MaterialName = item.MaterialName,
Boxtype = item.Boxtype,
list = list.OrderBy(x=>x.ObjId).ToList();
int totalItems = list.Count;
int half = totalItems / 2;
}); ;
List<OldBoxFoamType> spaceInfoLeft = list.Take(half).ToList();
List<OldBoxFoamType> spaceInfoRight = list.Skip(half).ToList();
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
{
ListItems.Clear();
if (spaceInfoLeft == null) return;
for (int i = 0; i < spaceInfoLeft.Count; i++)
{
ListItems.Add(new OldBoxFoamTypeModel()
{
SpaceName = $"东线{i + 1}",
Local = spaceInfoLeft[i].Local,
Status = spaceInfoLeft[i].Storeamount == 3 ? "1" : "0",
Storeamount = spaceInfoLeft[i].Storeamount,
MaterialCode = spaceInfoLeft[i].MaterialCode,
MaterialName = spaceInfoLeft[i].MaterialName,
Boxtype = spaceInfoLeft[i].Boxtype,
});
}
if (spaceInfoRight == null) return;
for (int i = 0; i < spaceInfoRight.Count; i++)
{
ListItems.Add(new OldBoxFoamTypeModel()
{
SpaceName = $"西线{i + 1}",
Local = spaceInfoRight[i].Local,
Status = spaceInfoRight[i].Storeamount == 3 ? "1" : "0",
Storeamount = spaceInfoRight[i].Storeamount,
MaterialCode = spaceInfoRight[i].MaterialCode,
MaterialName = spaceInfoRight[i].MaterialName,
Boxtype = spaceInfoRight[i].Boxtype,
});
}
}));
}
}));
}
}
#region 初始化datagrid

@ -228,7 +228,7 @@
ScrollViewer.VerticalScrollBarVisibility="Auto" BorderThickness="0" CanUserAddRows="False" SelectionMode="Single" IsReadOnly="True"
Foreground="White" >
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding ObjId}" Header="货道号" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding SpaceName}" Header="货道号" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding Local}" Header="位置" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTemplateColumn Width="*" Header="状态">
<DataGridTemplateColumn.CellStyle>

Loading…
Cancel
Save