|
@@ -33,7 +33,7 @@ namespace TeamAAS_VP.ViewModels.Statistics
|
|
|
public Int64 TotalCount
|
|
public Int64 TotalCount
|
|
|
{
|
|
{
|
|
|
get { return _TotalCount; }
|
|
get { return _TotalCount; }
|
|
|
- set { SetProperty(ref _TotalCount,value); }
|
|
|
|
|
|
|
+ set { SetProperty(ref _TotalCount, value); }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private Int64 _MonthCount;
|
|
private Int64 _MonthCount;
|
|
@@ -112,7 +112,7 @@ namespace TeamAAS_VP.ViewModels.Statistics
|
|
|
public DelegateCommand LoadedCommand =>
|
|
public DelegateCommand LoadedCommand =>
|
|
|
_LoadedCommand ?? (_LoadedCommand = new DelegateCommand(ExecuteLoadedCommand));
|
|
_LoadedCommand ?? (_LoadedCommand = new DelegateCommand(ExecuteLoadedCommand));
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
#region 事件
|
|
#region 事件
|
|
@@ -121,7 +121,7 @@ namespace TeamAAS_VP.ViewModels.Statistics
|
|
|
|
|
|
|
|
public ProductionStatementViewModel(IContainerProvider container, ISystemDatabaseService systemDatabaseService)
|
|
public ProductionStatementViewModel(IContainerProvider container, ISystemDatabaseService systemDatabaseService)
|
|
|
{
|
|
{
|
|
|
- _container= container;
|
|
|
|
|
|
|
+ _container = container;
|
|
|
_systemDatabaseService = systemDatabaseService;
|
|
_systemDatabaseService = systemDatabaseService;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -141,14 +141,14 @@ namespace TeamAAS_VP.ViewModels.Statistics
|
|
|
WeekChartModel = CreateWeek(await _systemDatabaseService.GetWeeklyProductionByDayAndCategoryAsync(management.CurrentProduct.Name));
|
|
WeekChartModel = CreateWeek(await _systemDatabaseService.GetWeeklyProductionByDayAndCategoryAsync(management.CurrentProduct.Name));
|
|
|
DayChartModel = CreateDay(await _systemDatabaseService.GetDailyProductionByHourAndCategoryAsync(management.CurrentProduct.Name));
|
|
DayChartModel = CreateDay(await _systemDatabaseService.GetDailyProductionByHourAndCategoryAsync(management.CurrentProduct.Name));
|
|
|
}));
|
|
}));
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// 创建产量图表模型
|
|
/// 创建产量图表模型
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
|
- private PlotModel CreateYieldChartModel(Dictionary<string,int> Items)
|
|
|
|
|
|
|
+ private PlotModel CreateYieldChartModel(Dictionary<string, int> Items)
|
|
|
{
|
|
{
|
|
|
List<PieSlice> PieSlices = new List<PieSlice>();
|
|
List<PieSlice> PieSlices = new List<PieSlice>();
|
|
|
PieSlices = new List<PieSlice>();
|
|
PieSlices = new List<PieSlice>();
|
|
@@ -172,7 +172,7 @@ namespace TeamAAS_VP.ViewModels.Statistics
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
model.Series.Add(series);
|
|
model.Series.Add(series);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return model;
|
|
return model;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -211,13 +211,18 @@ namespace TeamAAS_VP.ViewModels.Statistics
|
|
|
MajorGridlineColor = OxyColor.Parse("#F3F3F3"),
|
|
MajorGridlineColor = OxyColor.Parse("#F3F3F3"),
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ var now = DateTime.UtcNow;
|
|
|
|
|
+ var monthStart = DateTimeAxis.ToDouble(new DateTime(now.Year, now.Month, 1));
|
|
|
|
|
+ var temp = new DateTime(now.Year, now.Month, 1);
|
|
|
|
|
+ var monthEnd = DateTimeAxis.ToDouble(temp.AddMonths(1).AddDays(-1));
|
|
|
|
|
+
|
|
|
// 定义X轴为日期轴
|
|
// 定义X轴为日期轴
|
|
|
- var minValue = DateTimeAxis.ToDouble(Items.Keys.ElementAt(0));
|
|
|
|
|
- var maxValue = DateTimeAxis.ToDouble(Items.Keys.ElementAt(Items.Keys.Count-1));
|
|
|
|
|
|
|
+ //var minValue = DateTimeAxis.ToDouble(Items.Keys.ElementAt(0));
|
|
|
|
|
+ //var maxValue = DateTimeAxis.ToDouble(Items.Keys.ElementAt(Items.Keys.Count - 1));
|
|
|
var ax = new DateTimeAxis()
|
|
var ax = new DateTimeAxis()
|
|
|
{
|
|
{
|
|
|
- Minimum = minValue,
|
|
|
|
|
- Maximum = maxValue,
|
|
|
|
|
|
|
+ Minimum = monthStart,
|
|
|
|
|
+ Maximum = monthEnd,
|
|
|
StringFormat = $"dd{Lang.日}",
|
|
StringFormat = $"dd{Lang.日}",
|
|
|
MajorStep = 1,
|
|
MajorStep = 1,
|
|
|
Position = AxisPosition.Bottom,
|
|
Position = AxisPosition.Bottom,
|
|
@@ -233,6 +238,11 @@ namespace TeamAAS_VP.ViewModels.Statistics
|
|
|
model.Axes.Add(ay1);
|
|
model.Axes.Add(ay1);
|
|
|
model.Axes.Add(ax);
|
|
model.Axes.Add(ax);
|
|
|
|
|
|
|
|
|
|
+ if (Items.Count <= 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return model;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
foreach (var category in Items.First().Value.Keys)
|
|
foreach (var category in Items.First().Value.Keys)
|
|
|
{
|
|
{
|
|
|
var barSeries = new LinearBarSeries { Title = category };
|
|
var barSeries = new LinearBarSeries { Title = category };
|
|
@@ -242,7 +252,14 @@ namespace TeamAAS_VP.ViewModels.Statistics
|
|
|
barSeries.TrackerFormatString = $"{0}\r\n{2:dd}{Lang.日}: {4:0}";
|
|
barSeries.TrackerFormatString = $"{0}\r\n{2:dd}{Lang.日}: {4:0}";
|
|
|
foreach (var item in Items)
|
|
foreach (var item in Items)
|
|
|
{
|
|
{
|
|
|
- barSeries.Points.Add(new OxyPlot.DataPoint(DateTimeAxis.ToDouble(item.Key), (double)(item.Value[category])));
|
|
|
|
|
|
|
+ if (item.Value.ContainsKey(category))
|
|
|
|
|
+ {
|
|
|
|
|
+ barSeries.Points.Add(new OxyPlot.DataPoint(DateTimeAxis.ToDouble(item.Key), (double)(item.Value[category])));
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ barSeries.Points.Add(new OxyPlot.DataPoint(DateTimeAxis.ToDouble(item.Key), 0));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
model.Series.Add(barSeries);
|
|
model.Series.Add(barSeries);
|
|
@@ -306,7 +323,7 @@ namespace TeamAAS_VP.ViewModels.Statistics
|
|
|
Maximum = 7.5,
|
|
Maximum = 7.5,
|
|
|
MajorStep = 1,
|
|
MajorStep = 1,
|
|
|
Position = AxisPosition.Bottom,
|
|
Position = AxisPosition.Bottom,
|
|
|
- StringFormat= $"{Lang.周} 0",
|
|
|
|
|
|
|
+ StringFormat = $"{Lang.周} 0",
|
|
|
Angle = 0,
|
|
Angle = 0,
|
|
|
IsZoomEnabled = false,
|
|
IsZoomEnabled = false,
|
|
|
IsPanEnabled = false,
|
|
IsPanEnabled = false,
|
|
@@ -318,10 +335,15 @@ namespace TeamAAS_VP.ViewModels.Statistics
|
|
|
|
|
|
|
|
model.Axes.Add(ay1);
|
|
model.Axes.Add(ay1);
|
|
|
model.Axes.Add(ax);
|
|
model.Axes.Add(ax);
|
|
|
|
|
+ if (Items.Count <= 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return model;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
foreach (var category in Items.First().Value.Keys)
|
|
foreach (var category in Items.First().Value.Keys)
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
var barSeries = new LinearBarSeries { Title = category };
|
|
var barSeries = new LinearBarSeries { Title = category };
|
|
|
barSeries.YAxisKey = "y1";
|
|
barSeries.YAxisKey = "y1";
|
|
|
barSeries.BarWidth = 10;
|
|
barSeries.BarWidth = 10;
|
|
@@ -329,7 +351,14 @@ namespace TeamAAS_VP.ViewModels.Statistics
|
|
|
barSeries.TrackerFormatString = $"{0}\r\n{Lang.周}{2:0}: {4:0}";
|
|
barSeries.TrackerFormatString = $"{0}\r\n{Lang.周}{2:0}: {4:0}";
|
|
|
foreach (var item in Items)
|
|
foreach (var item in Items)
|
|
|
{
|
|
{
|
|
|
- barSeries.Points.Add(new OxyPlot.DataPoint(LinearAxis.ToDouble(item.Key), (double)(item.Value[category])));
|
|
|
|
|
|
|
+ if (item.Value.ContainsKey(category))
|
|
|
|
|
+ {
|
|
|
|
|
+ barSeries.Points.Add(new OxyPlot.DataPoint(DateTimeAxis.ToDouble(item.Key), (double)(item.Value[category])));
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ barSeries.Points.Add(new OxyPlot.DataPoint(DateTimeAxis.ToDouble(item.Key), 0));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
model.Series.Add(barSeries);
|
|
model.Series.Add(barSeries);
|
|
@@ -406,6 +435,11 @@ namespace TeamAAS_VP.ViewModels.Statistics
|
|
|
model.Axes.Add(ay1);
|
|
model.Axes.Add(ay1);
|
|
|
model.Axes.Add(ax);
|
|
model.Axes.Add(ax);
|
|
|
|
|
|
|
|
|
|
+ if (Items.Count<=0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return model;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
foreach (var category in Items.First().Value.Keys)
|
|
foreach (var category in Items.First().Value.Keys)
|
|
|
{
|
|
{
|
|
|
|
|
|