change - 组装计划统计图表加载

foamRearStore
wenjy 11 months ago
parent 744640fed0
commit 94f52253e8

Binary file not shown.

@ -96,14 +96,14 @@ namespace Aucma.Scada.Business
grabImage.RefreshLogMessageEvent += PrintLogInfoMessage; grabImage.RefreshLogMessageEvent += PrintLogInfoMessage;
StartPassDown(); StartPassDown();
//Task.Run(() => Task.Run(() =>
//{ {
// Thread.Sleep(6000); Thread.Sleep(6000);
// for (int i = 1; i < 9; i++) for (int i = 1; i < 9; i++)
// { {
// InStore("F23406001225101901" + i); InStore("F23406001225101901" + i);
// } }
//}); });
} }
/// <summary> /// <summary>

@ -125,7 +125,7 @@ namespace Aucma.Scada.Business
var bomInfo = _bomInfoService.GetChildenBomInfoByMaterialCode(planInfo.materialCode, appConfig.foamMaterialType); var bomInfo = _bomInfoService.GetChildenBomInfoByMaterialCode(planInfo.materialCode, appConfig.foamMaterialType);
for (int i = 0; i < planInfo.planAmount - planInfo.completeAmount; i++) for (int i = 0; i < planInfo.planAmount - planInfo.completeAmount; i++)
{ {
string taskCode = DateTime.Now.ToString("HH:mm:ss"); string taskCode = System.Guid.NewGuid().ToString("N").Substring(0,10);
OutStore(appConfig.foamStoreCode, bomInfo, planInfo.executePlanCode, taskCode); OutStore(appConfig.foamStoreCode, bomInfo, planInfo.executePlanCode, taskCode);
Thread.Sleep(500); Thread.Sleep(500);
} }

@ -98,7 +98,7 @@
<TextBlock Text="计划数量" FontSize="15" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock Text="计划数量" FontSize="15" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border> </Border>
<Border Grid.Row="1" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" > <Border Grid.Row="1" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
<lvc:Gauge Margin="5" Uses360Mode="True" From="0" To="100" Value="50" Foreground="#0288d1"/> <lvc:Gauge Margin="5" Uses360Mode="True" From="0" To="100" Value="{Binding PlanAmount}" Foreground="#0288d1"/>
</Border> </Border>
</Grid> </Grid>
</Border> </Border>
@ -113,7 +113,7 @@
<TextBlock Text="实际数量" FontSize="15" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock Text="实际数量" FontSize="15" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border> </Border>
<Border Grid.Row="1" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" > <Border Grid.Row="1" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
<lvc:Gauge Margin="5" Uses360Mode="True" From="0" To="100" Value="50" Foreground="#0288d1"/> <lvc:Gauge Margin="5" Uses360Mode="True" From="0" To="100" Value="{Binding ComplateAmout}" Foreground="#0288d1"/>
</Border> </Border>
</Grid> </Grid>
</Border> </Border>
@ -128,7 +128,7 @@
<TextBlock Text="差异数量" FontSize="15" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock Text="差异数量" FontSize="15" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border> </Border>
<Border Grid.Row="1" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" > <Border Grid.Row="1" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
<lvc:Gauge Margin="5" Uses360Mode="True" From="0" To="100" Value="50" Foreground="#0288d1"/> <lvc:Gauge Margin="5" Uses360Mode="True" From="0" To="100" Value="{Binding DiffAmount}" Foreground="#0288d1"/>
</Border> </Border>
</Grid> </Grid>
</Border> </Border>
@ -143,7 +143,7 @@
<TextBlock Text="完成率" FontSize="15" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock Text="完成率" FontSize="15" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border> </Border>
<Border Grid.Row="1" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" > <Border Grid.Row="1" BorderBrush="CadetBlue" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
<lvc:Gauge Margin="5" Uses360Mode="True" From="0" To="100" Value="50" Foreground="#0288d1"/> <lvc:Gauge Margin="5" Uses360Mode="True" From="0" To="100" Value="{Binding CompleRoution}" Foreground="#0288d1"/>
</Border> </Border>
</Grid> </Grid>
</Border> </Border>

@ -1,4 +1,4 @@
E:\桌面\澳柯玛MES项目\程序设计\Aucma.Scada\Aucma.Scada.UI\obj\Debug\GeneratedInternalTypeHelper.g.cs 
FE:\桌面\澳柯玛MES项目\程序设计\Aucma.Scada\Aucma.Scada.UI\App.xaml;; FE:\桌面\澳柯玛MES项目\程序设计\Aucma.Scada\Aucma.Scada.UI\App.xaml;;
FE:\桌面\澳柯玛MES项目\程序设计\Aucma.Scada\Aucma.Scada.UI\Page\AssemblyPlan\AssemblyPlanControl.xaml;; FE:\桌面\澳柯玛MES项目\程序设计\Aucma.Scada\Aucma.Scada.UI\Page\AssemblyPlan\AssemblyPlanControl.xaml;;
FE:\桌面\澳柯玛MES项目\程序设计\Aucma.Scada\Aucma.Scada.UI\Page\AssemblyPlan\PlanInfoEditWindow.xaml;; FE:\桌面\澳柯玛MES项目\程序设计\Aucma.Scada\Aucma.Scada.UI\Page\AssemblyPlan\PlanInfoEditWindow.xaml;;

@ -1,2 +1,62 @@
 //------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace XamlGeneratedNamespace {
/// <summary>
/// GeneratedInternalTypeHelper
/// </summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public sealed class GeneratedInternalTypeHelper : System.Windows.Markup.InternalTypeHelper {
/// <summary>
/// CreateInstance
/// </summary>
protected override object CreateInstance(System.Type type, System.Globalization.CultureInfo culture) {
return System.Activator.CreateInstance(type, ((System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic)
| (System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.CreateInstance)), null, null, culture);
}
/// <summary>
/// GetPropertyValue
/// </summary>
protected override object GetPropertyValue(System.Reflection.PropertyInfo propertyInfo, object target, System.Globalization.CultureInfo culture) {
return propertyInfo.GetValue(target, System.Reflection.BindingFlags.Default, null, null, culture);
}
/// <summary>
/// SetPropertyValue
/// </summary>
protected override void SetPropertyValue(System.Reflection.PropertyInfo propertyInfo, object target, object value, System.Globalization.CultureInfo culture) {
propertyInfo.SetValue(target, value, System.Reflection.BindingFlags.Default, null, null, culture);
}
/// <summary>
/// CreateDelegate
/// </summary>
protected override System.Delegate CreateDelegate(System.Type delegateType, object target, string handler) {
return ((System.Delegate)(target.GetType().InvokeMember("_CreateDelegate", (System.Reflection.BindingFlags.InvokeMethod
| (System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)), null, target, new object[] {
delegateType,
handler}, null)));
}
/// <summary>
/// AddEventHandler
/// </summary>
protected override void AddEventHandler(System.Reflection.EventInfo eventInfo, object target, System.Delegate handler) {
eventInfo.AddEventHandler(target, handler);
}
}
}

@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\Page\AssemblyPlan\AssemblyPlanControl.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "A08B9C7140DB0AACAE086B977EE7C330BEFBFCCDB35F4D977FB64FC20FD7CF70" #pragma checksum "..\..\..\..\Page\AssemblyPlan\AssemblyPlanControl.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "D536AE37E611DE63815C8A69BC3CB492E8D312804D0D4C91592629457E2EA8CE"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// 此代码由工具生成。 // 此代码由工具生成。

@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\Page\AssemblyPlan\AssemblyPlanControl.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "A08B9C7140DB0AACAE086B977EE7C330BEFBFCCDB35F4D977FB64FC20FD7CF70" #pragma checksum "..\..\..\..\Page\AssemblyPlan\AssemblyPlanControl.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "D536AE37E611DE63815C8A69BC3CB492E8D312804D0D4C91592629457E2EA8CE"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// 此代码由工具生成。 // 此代码由工具生成。

@ -3,6 +3,7 @@ using Aucma.Scada.Model.domain;
using Aucma.Scada.UI.Page.AssemblyPlan; using Aucma.Scada.UI.Page.AssemblyPlan;
using GalaSoft.MvvmLight; using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command; using GalaSoft.MvvmLight.Command;
using HighWayIot.Common;
using HighWayIot.Config; using HighWayIot.Config;
using LiveCharts; using LiveCharts;
using LiveCharts.Wpf; using LiveCharts.Wpf;
@ -21,6 +22,8 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
private AppConfig appConfig = AppConfig.Instance; private AppConfig appConfig = AppConfig.Instance;
private StringChange stringChange = StringChange.Instance;
private OutStoreBusiness outStoreBusiness = OutStoreBusiness.Instance; private OutStoreBusiness outStoreBusiness = OutStoreBusiness.Instance;
public AssemblyPlanViewModel() public AssemblyPlanViewModel()
{ {
@ -143,6 +146,46 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
get { return materialNameList; } get { return materialNameList; }
set { materialNameList = value; } set { materialNameList = value; }
} }
/// <summary>
/// 计划数量
/// </summary>
private int planAmount = 0;
public int PlanAmount
{
get { return planAmount; }
set { planAmount = value; RaisePropertyChanged(nameof(planAmount)); }
}
/// <summary>
/// 完成数量
/// </summary>
public int complateAmout;
public int ComplateAmout
{
get { return complateAmout; }
set { complateAmout = value; RaisePropertyChanged(nameof(ComplateAmout)); }
}
/// <summary>
/// 差异值
/// </summary>
public int diffAmount;
public int DiffAmount
{
get { return diffAmount; }
set { diffAmount = value; RaisePropertyChanged(nameof(DiffAmount)); }
}
/// <summary>
/// 完成率
/// </summary>
public string compleRoution;
public string CompleRoution
{
get { return compleRoution; }
set { compleRoution = value; RaisePropertyChanged(nameof(CompleRoution)); }
}
#endregion #endregion
#region 事件定义 #region 事件定义
@ -177,6 +220,7 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
PlanInfoDataGrid = new ObservableCollection<ExecutePlanInfo>(); PlanInfoDataGrid = new ObservableCollection<ExecutePlanInfo>();
if (executePlanInfos != null) if (executePlanInfos != null)
{ {
RefreshStatisticsGauge(executePlanInfos);
executePlanInfos.ForEach( executePlanInfos.ForEach(
arg => arg =>
{ {
@ -256,25 +300,12 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
} }
private void RefreshPlanInfoDataGrid() private void RefreshPlanInfoDataGrid()
{ {
RefreshDataGrid();
App.Current.Dispatcher.BeginInvoke((Action)(() => App.Current.Dispatcher.BeginInvoke((Action)(() =>
{ {
var planInfos = assemblyPlanBusiness.GetEexecutePlanInfosByProductLineCode();
RefreshDataGrid(planInfos);
if(planInfos != null)
{
//加载正在执行的计划
planInfos = planInfos.Where(x => x.executeStatus == 2).ToList();
if (planInfos.Count > 0)
{
ExecutePlanInfo planInfo = planInfos.OrderBy(x => x.executeOrder).First();
RefreshPlanExecute(planInfo);
}
}
OrderCode = string.Empty; OrderCode = string.Empty;
PlanCode = string.Empty; PlanCode = string.Empty;
ProductModel = string.Empty; ProductModel = string.Empty;
@ -286,16 +317,7 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
/// </summary> /// </summary>
public void Init() public void Init()
{ {
var planInfos = assemblyPlanBusiness.GetEexecutePlanInfosByProductLineCode(); RefreshDataGrid();
RefreshDataGrid(planInfos);
//加载正在执行的计划
planInfos = planInfos.Where(x => x.executeStatus == 2).ToList();
if (planInfos.Count > 0)
{
ExecutePlanInfo planInfo = planInfos.OrderBy(x => x.executeOrder).First();
RefreshPlanExecute(planInfo);
}
MaterialNameList = new List<string>() MaterialNameList = new List<string>()
{ {
@ -365,6 +387,52 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
DateTime dateTime = (DateTime)planInfo.beginTime; DateTime dateTime = (DateTime)planInfo.beginTime;
BeginTime = dateTime.ToString("yyyy-MM-dd HH:mm:ss"); BeginTime = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
} }
/// <summary>
/// 加载正在执行的计划
/// </summary>
private void RefreshDataGrid()
{
var planInfos = assemblyPlanBusiness.GetEexecutePlanInfosByProductLineCode();
if (planInfos != null)
{
//加载正在执行的计划
planInfos = planInfos.Where(x => x.executeStatus == 2).ToList();
if (planInfos.Count > 0)
{
ExecutePlanInfo planInfo = planInfos.OrderBy(x => x.executeOrder).First();
RefreshPlanExecute(planInfo);
}
}
}
/// <summary>
/// 刷新统计图表
/// </summary>
/// <param name="planInfos"></param>
private void RefreshStatisticsGauge(List<ExecutePlanInfo> planInfos)
{
if (planInfos != null)
{
if (planInfos.Count > 0)
{
PlanAmount = stringChange.ParseToInt(planInfos.Sum(x => x.planAmount).ToString());
ComplateAmout = stringChange.ParseToInt(planInfos.Sum(x => x.completeAmount).ToString());
DiffAmount = planAmount - complateAmout;
double completionRate = (double)ComplateAmout / PlanAmount * 100; // 计算完成率
CompleRoution = completionRate.ToString("0.0");
}
else
{
PlanAmount =0;
ComplateAmout =0;
DiffAmount = 0;
CompleRoution =string.Empty;
}
}
}
} }

Loading…
Cancel
Save