change-首页界面修改

dev
liuwf 1 month ago
parent 98c892a9b3
commit b6c9a4166a

@ -187,12 +187,13 @@ namespace SlnMesnac.Business
/// </summary>
private void ProdPlanExecHandle()
{
RefreshMesProdList();
//每5秒执行一次获取是否有已开始的计划获取已开始的计划下发给WCS进行叫料获取货架到位信息进行投料校验持续获取设备要料信号
while (true)
{
try
{
RefreshMesProdList();
var plc = base.GetPlcByKey("plc");
if (plc == null)
@ -200,7 +201,7 @@ namespace SlnMesnac.Business
//throw new ArgumentException($"PLC连接信息为空");
RefreshMessage($"PLC连接信息为空");
Thread.Sleep(3000);
return;
continue;
}
MesProductPlan prodPlan = _mesProductPlanService.GetStartedProdPlan(out MesProductPlanDto productPlanDto);
@ -227,8 +228,6 @@ namespace SlnMesnac.Business
{
RefreshMessage("等待设备叫料信号触发......");
Thread.Sleep(5000);
continue;
}
@ -278,6 +277,8 @@ namespace SlnMesnac.Business
{
_logger.LogError($"计划执行逻辑处理异常:{e.Message}");
}
Thread.Sleep(5000);
}
}

@ -175,18 +175,32 @@
<!--日产量-->
<Border Grid.Row="1" BorderBrush="Green" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
<Border Grid.Row="1" BorderBrush="Green" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
<Grid Margin="10,10">
<lvc:CartesianChart Series="{Binding Achievement, UpdateSourceTrigger=PropertyChanged}">
<lvc:CartesianChart.AxisX>
<lvc:Axis Labels="{Binding ProductionHourList}" FontSize="15" Foreground="#0288d1"/>
</lvc:CartesianChart.AxisX>
<lvc:CartesianChart.AxisY>
<lvc:Axis FontSize="15" Foreground="#0288d1"/>
</lvc:CartesianChart.AxisY>
</lvc:CartesianChart>
</Grid>
<Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" >
<lvc:CartesianChart Series="{Binding ModelStatistics, UpdateSourceTrigger=PropertyChanged}" LegendLocation="Top" Foreground="White" DisableAnimations="True">
<lvc:CartesianChart.DataTooltip >
<lvc:DefaultTooltip SelectionMode="OnlySender" BulletSize="10" Foreground="Black"></lvc:DefaultTooltip>
</lvc:CartesianChart.DataTooltip>
<lvc:CartesianChart.AxisX >
<lvc:Axis Labels="{Binding ProductionHourList}" FontSize="18" Foreground="White" LabelsRotation="0" DisableAnimations="True" Position="LeftBottom" >
<lvc:Axis.Separator>
<lvc:Separator Visibility="Hidden" Step="1" StrokeThickness="1.5" StrokeDashArray="0" Stroke="#404F56" >
</lvc:Separator>
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
<lvc:CartesianChart.AxisY>
<lvc:Axis FontSize="18" Foreground="White" MinValue="0">
<lvc:Axis.Separator>
<lvc:Separator Step="10" Visibility="Hidden" StrokeThickness="1" StrokeDashArray="3" Stroke="#404F56" >
</lvc:Separator>
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
</lvc:CartesianChart>
</Border>
</Border>
</Grid>
</Border>

@ -21,6 +21,8 @@ using SlnMesnac.Common;
using HslCommunication.Profinet.GE;
using static System.Net.Mime.MediaTypeNames;
using Application = System.Windows.Application;
using LiveCharts;
using System.Threading;
namespace SlnMesnac.WPF.ViewModel
{
@ -125,8 +127,8 @@ namespace SlnMesnac.WPF.ViewModel
/// <summary>
/// 完成率
/// </summary>
public string compleRoution;
public string CompleRoution
public decimal compleRoution;
public decimal CompleRoution
{
get { return compleRoution; }
set { compleRoution = value; RaisePropertyChanged(nameof(CompleRoution)); }
@ -154,6 +156,33 @@ namespace SlnMesnac.WPF.ViewModel
}
#endregion
#region 日产量柱状图X轴日期
/// <summary>
/// 日产量柱状图X轴日期
/// </summary>
private List<string> productionHourList = new List<string>();
public List<string> ProductionHourList
{
get { return productionHourList; }
set { productionHourList = value; }
}
#endregion
#region 型号统计柱状图
/// <summary>
/// 型号统计柱状图
/// </summary>
private SeriesCollection achievement = new SeriesCollection();
public SeriesCollection Achievement
{
get { return achievement; }
set { achievement = value; }
}
#endregion
#region 事件定义
/// <summary>
@ -169,8 +198,7 @@ namespace SlnMesnac.WPF.ViewModel
public ProdMgmtViewModel()
{
StartProdPlanCommand = new RelayCommand<string>(obj => StartProdPlan(obj));
StopProdPlanCommand = new RelayCommand<string>(obj => StopProdPlan(obj));
_logger = App.ServiceProvider.GetService<ILogger<ProdMgmtViewModel>>();
@ -192,8 +220,12 @@ namespace SlnMesnac.WPF.ViewModel
Task.Run(() =>
{
_prodCompletionBusiness.PrintMessageToListBoxEvent += PrintMessageToListBox;
// _prodCompletionBusiness.Init();
});
RefreChart();
}
public void test()
@ -219,7 +251,7 @@ namespace SlnMesnac.WPF.ViewModel
PlanAmount = Convert.ToInt32(prodPlan.PlanAmount);
ComplateAmout = Convert.ToInt32(prodPlan.CompleteAmount);
DiffAmount = Convert.ToInt32(prodPlan.PlanAmount) - Convert.ToInt32(prodPlan.CompleteAmount);
CompleRoution = "50";
CompleRoution = Math.Round((prodPlan.CompleteAmount / prodPlan.PlanAmount) * 100, 2);
}
else
{
@ -230,7 +262,7 @@ namespace SlnMesnac.WPF.ViewModel
PlanAmount = 0;
ComplateAmout = 0;
DiffAmount = 0;
CompleRoution = string.Empty;
CompleRoution = 0;
}
}
@ -402,5 +434,14 @@ namespace SlnMesnac.WPF.ViewModel
});
}
/// <summary>
/// 刷新产量统计图表
/// </summary>
private async void RefreChart()
{
ProductionHourList = new List<string>() {"8:00","9:00","10:00","11:00","12:00","13:00", "14:00", "15:00", "16:00", "17:00","18:00","19:00","20:00" };
}
}
}

Loading…
Cancel
Save