You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace Kingo.DataAnalysis.Model
|
|
|
|
|
{
|
|
|
|
|
public class ProgressModel
|
|
|
|
|
{
|
|
|
|
|
private int _Count = 0;
|
|
|
|
|
private int _Value = 0;
|
|
|
|
|
public string ProName { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 总个数
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int Count
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return GetCount();
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_Count = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 当前处理个数
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int Value
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return GetValue();
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_Value = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public double Percentage => Count == 0 ? 0 : Math.Round((double)Value / Count, 2);
|
|
|
|
|
|
|
|
|
|
public List<ProgressModel>? SubProgress { get; set; }
|
|
|
|
|
|
|
|
|
|
private int GetCount()
|
|
|
|
|
{
|
|
|
|
|
if (SubProgress != null)
|
|
|
|
|
{
|
|
|
|
|
_Count = SubProgress.Sum(s => s.Count);
|
|
|
|
|
}
|
|
|
|
|
return _Count;
|
|
|
|
|
}
|
|
|
|
|
private int GetValue()
|
|
|
|
|
{
|
|
|
|
|
if (SubProgress != null)
|
|
|
|
|
{
|
|
|
|
|
_Value = SubProgress.Sum(s => s.Value);
|
|
|
|
|
}
|
|
|
|
|
return _Value;
|
|
|
|
|
}
|
|
|
|
|
public ProgressModel GetProModel(string ProName)
|
|
|
|
|
{
|
|
|
|
|
if (this.ProName == ProName)
|
|
|
|
|
return this;
|
|
|
|
|
else if (SubProgress != null)
|
|
|
|
|
{
|
|
|
|
|
return SubProgress.FirstOrDefault(f => f.ProName == ProName);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|