年度安全检查情况综合统计分析
This commit is contained in:
parent
89a3118bce
commit
4aeec69c2d
@ -103,17 +103,17 @@ namespace APT.MS.Domain.Enums
|
||||
[Description("全公司")] /*全局*/
|
||||
All = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 选矿厂
|
||||
/// </summary>
|
||||
[Description("选矿厂")]
|
||||
MineChoose = 10,
|
||||
///// <summary>
|
||||
///// 选矿厂
|
||||
///// </summary>
|
||||
//[Description("选矿厂")]
|
||||
//MineChoose = 10,
|
||||
|
||||
/// <summary>
|
||||
/// 尾矿库
|
||||
/// </summary>
|
||||
[Description("尾矿库")]
|
||||
Minelast = 20,
|
||||
///// <summary>
|
||||
///// 尾矿库
|
||||
///// </summary>
|
||||
//[Description("尾矿库")]
|
||||
//Minelast = 20,
|
||||
|
||||
/// <summary>
|
||||
/// 露天矿
|
||||
@ -121,28 +121,28 @@ namespace APT.MS.Domain.Enums
|
||||
[Description("露天矿")]
|
||||
Mine = 30,
|
||||
|
||||
/// <summary>
|
||||
/// 地下矿
|
||||
/// </summary>
|
||||
[Description("地下矿")]
|
||||
MineUnderground = 40,
|
||||
///// <summary>
|
||||
///// 地下矿
|
||||
///// </summary>
|
||||
//[Description("地下矿")]
|
||||
//MineUnderground = 40,
|
||||
}
|
||||
/// <summary>
|
||||
/// 安全库类型(需同步修改FMProductionUnit)
|
||||
/// </summary>
|
||||
public enum BSMineTypeEditEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// 选矿
|
||||
/// </summary>
|
||||
[Description("选矿厂")]
|
||||
MineChoose = 10,
|
||||
///// <summary>
|
||||
///// 选矿
|
||||
///// </summary>
|
||||
//[Description("选矿厂")]
|
||||
//MineChoose = 10,
|
||||
|
||||
/// <summary>
|
||||
/// 尾矿
|
||||
/// </summary>
|
||||
[Description("尾矿库")]
|
||||
Minelast = 20,
|
||||
///// <summary>
|
||||
///// 尾矿
|
||||
///// </summary>
|
||||
//[Description("尾矿库")]
|
||||
//Minelast = 20,
|
||||
|
||||
/// <summary>
|
||||
/// 矿山
|
||||
@ -150,11 +150,11 @@ namespace APT.MS.Domain.Enums
|
||||
[Description("露天矿")]
|
||||
Mine = 30,
|
||||
|
||||
/// <summary>
|
||||
/// 地下矿
|
||||
/// </summary>
|
||||
[Description("地下矿")]
|
||||
MineUnderground = 40,
|
||||
///// <summary>
|
||||
///// 地下矿
|
||||
///// </summary>
|
||||
//[Description("地下矿")]
|
||||
//MineUnderground = 40,
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
|
||||
@ -137,10 +137,10 @@ namespace APT.BaseData.Services.DomainServices
|
||||
}
|
||||
else
|
||||
{
|
||||
listMineType.Add(BSMineTypeEditEnum.MineChoose);
|
||||
listMineType.Add(BSMineTypeEditEnum.Minelast);
|
||||
//listMineType.Add(BSMineTypeEditEnum.MineChoose);
|
||||
//listMineType.Add(BSMineTypeEditEnum.Minelast);
|
||||
//listMineType.Add(BSMineTypeEditEnum.MineUnderground);
|
||||
listMineType.Add(BSMineTypeEditEnum.Mine);
|
||||
listMineType.Add(BSMineTypeEditEnum.MineUnderground);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -121,44 +121,44 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
{
|
||||
BIDepartmentSafeYear result = new BIDepartmentSafeYear();
|
||||
//BSMineTypeEnum MineType = BSMineTypeEnum.Mine;
|
||||
List<BSMineTypeEnum> listMineType = new List<BSMineTypeEnum>();
|
||||
//List<BSMineTypeEnum> listMineType = new List<BSMineTypeEnum>();
|
||||
|
||||
if (!string.IsNullOrEmpty(filter.Keyword))
|
||||
{
|
||||
try
|
||||
{
|
||||
string types = filter.Keyword.Split("=")[1];
|
||||
if (types.Contains("_"))
|
||||
{
|
||||
var listTypes = types.Split("_");
|
||||
//listTypes.foreach ((e) => { listMineType.Add((BSMineTypeEnum)int.Parse(e))})
|
||||
foreach (var item in listTypes)
|
||||
{
|
||||
listMineType.Add((BSMineTypeEnum)int.Parse(item));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
listMineType.Add((BSMineTypeEnum)int.Parse(types));
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
else
|
||||
{
|
||||
listMineType.Add(BSMineTypeEnum.Mine);
|
||||
}
|
||||
//if (!string.IsNullOrEmpty(filter.Keyword))
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// string types = filter.Keyword.Split("=")[1];
|
||||
// if (types.Contains("_"))
|
||||
// {
|
||||
// var listTypes = types.Split("_");
|
||||
// //listTypes.foreach ((e) => { listMineType.Add((BSMineTypeEnum)int.Parse(e))})
|
||||
// foreach (var item in listTypes)
|
||||
// {
|
||||
// listMineType.Add((BSMineTypeEnum)int.Parse(item));
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// listMineType.Add((BSMineTypeEnum)int.Parse(types));
|
||||
// }
|
||||
// }
|
||||
// catch { }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// listMineType.Add(BSMineTypeEnum.Mine);
|
||||
//}
|
||||
Expression<Func<T_BI_BSSAFECHECKTYPE_YEAR, bool>> expression = e => e.YEAR == DateTime.Now.Year;
|
||||
|
||||
//行洛坑 选矿部 = 选矿部 + 尾矿部 看传参
|
||||
if (listMineType.Count == 1)
|
||||
{
|
||||
expression = expression.And(e => e.MineType == listMineType[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
expression = expression.And(e => listMineType.Contains(e.MineType));
|
||||
}
|
||||
//if (listMineType.Count == 1)
|
||||
//{
|
||||
// expression = expression.And(e => e.MineType == listMineType[0]);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// expression = expression.And(e => listMineType.Contains(e.MineType));
|
||||
//}
|
||||
|
||||
var listCheckLevel = GetEntities<T_BI_BSSAFECHECKTYPE_YEAR>(expression, null, null);
|
||||
if (listCheckLevel != null && listCheckLevel.Any())
|
||||
@ -207,116 +207,116 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
}
|
||||
}
|
||||
|
||||
//总结数据
|
||||
IEnumerable<T_BI_SUMMARY> listSummery = GetEntities<T_BI_SUMMARY>(e => listMineType.Contains((BSMineTypeEnum)e.MineType) && e.CODE == "BI052_BSSafeCheckYear", null, null).OrderBy(e => e.NUM).ThenBy(e => e.PART);//e.MineType == (BSMineTypeEditEnum)MineType
|
||||
//总结数据 listMineType.Contains((BSMineTypeEnum)e.MineType) &&
|
||||
IEnumerable<T_BI_SUMMARY> listSummery = GetEntities<T_BI_SUMMARY>(e => e.CODE == "BI052_BSSafeCheckYear", null, null).OrderBy(e => e.NUM).ThenBy(e => e.PART);//e.MineType == (BSMineTypeEditEnum)MineType
|
||||
|
||||
//前12月的数据
|
||||
IEnumerable<T_BI_BSCHECKTYPE_YEAR> listCheckType = null;
|
||||
if (listMineType.Count == 1)
|
||||
{
|
||||
if (DateTime.Now.Month == 12)
|
||||
listCheckType = GetEntities<T_BI_BSCHECKTYPE_YEAR>(e => e.MineType == listMineType[0] && e.YEAR == DateTime.Now.Year, null, null);
|
||||
else
|
||||
listCheckType = GetEntities<T_BI_BSCHECKTYPE_YEAR>(e => e.MineType == listMineType[0] && (e.YEAR == DateTime.Now.Year || (e.YEAR == (DateTime.Now.Year - 1) && (e.MONTH > DateTime.Now.Month))), null, null);
|
||||
}
|
||||
//if (listMineType.Count == 1)
|
||||
//{
|
||||
if (DateTime.Now.Month == 12)
|
||||
listCheckType = GetEntities<T_BI_BSCHECKTYPE_YEAR>(e => e.YEAR == DateTime.Now.Year, null, null);//e.MineType == listMineType[0] &&
|
||||
else
|
||||
{
|
||||
if (DateTime.Now.Month == 12)
|
||||
listCheckType = GetEntities<T_BI_BSCHECKTYPE_YEAR>(e => listMineType.Contains(e.MineType) && e.YEAR == DateTime.Now.Year, null, null);
|
||||
else
|
||||
listCheckType = GetEntities<T_BI_BSCHECKTYPE_YEAR>(e => listMineType.Contains(e.MineType) && (e.YEAR == DateTime.Now.Year || (e.YEAR == (DateTime.Now.Year - 1) && (e.MONTH > DateTime.Now.Month))), null, null);
|
||||
}
|
||||
listCheckType = GetEntities<T_BI_BSCHECKTYPE_YEAR>(e => (e.YEAR == DateTime.Now.Year || (e.YEAR == (DateTime.Now.Year - 1) && (e.MONTH > DateTime.Now.Month))), null, null);//e.MineType == listMineType[0] &&
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// if (DateTime.Now.Month == 12)
|
||||
// listCheckType = GetEntities<T_BI_BSCHECKTYPE_YEAR>(e => listMineType.Contains(e.MineType) && e.YEAR == DateTime.Now.Year, null, null);
|
||||
// else
|
||||
// listCheckType = GetEntities<T_BI_BSCHECKTYPE_YEAR>(e => listMineType.Contains(e.MineType) && (e.YEAR == DateTime.Now.Year || (e.YEAR == (DateTime.Now.Year - 1) && (e.MONTH > DateTime.Now.Month))), null, null);
|
||||
//}
|
||||
listCheckType = listCheckType.OrderBy(e => e.YEAR).ThenBy(e => e.MONTH);
|
||||
|
||||
if (listSummery != null && listSummery.Any())
|
||||
{
|
||||
if (listMineType.Count > 1)
|
||||
//if (listMineType.Count > 1)
|
||||
//{
|
||||
//PART 1 3 合并
|
||||
var temp = listSummery.ToList();
|
||||
for (int i = 1; i < temp.Count; i++)
|
||||
{
|
||||
//PART 1 3 合并
|
||||
var temp = listSummery.ToList();
|
||||
for (int i = 1; i < temp.Count; i++)
|
||||
if (temp[i].PART == 1 && temp[i].PART == temp[i - 1].PART)
|
||||
{
|
||||
if (temp[i].PART == 1 && temp[i].PART == temp[i - 1].PART)
|
||||
temp[i - 1].Count1 += temp[i].Count1;
|
||||
temp[i - 1].Count2 += temp[i].Count2;
|
||||
temp[i - 1].Count3 += temp[i].Count3;
|
||||
temp[i - 1].Count4 += temp[i].Count4;
|
||||
|
||||
if (temp[i - 1].Count2 + temp[i - 1].Count3 == 0 || temp[i - 1].Count1 == 0)
|
||||
{
|
||||
temp[i - 1].Count1 += temp[i].Count1;
|
||||
temp[i - 1].Count2 += temp[i].Count2;
|
||||
temp[i - 1].Count3 += temp[i].Count3;
|
||||
temp[i - 1].Count4 += temp[i].Count4;
|
||||
|
||||
if (temp[i - 1].Count2 + temp[i - 1].Count3 == 0 || temp[i - 1].Count1 == 0)
|
||||
{
|
||||
temp[i - 1].Parameter7 = "0.00%";
|
||||
}
|
||||
else
|
||||
{
|
||||
temp[i - 1].Parameter7 = Math.Round((100.00 * (temp[i - 1].Count2 + temp[i - 1].Count3) / temp[i - 1].Count1) / 100, 2) + "%";//完成率
|
||||
}
|
||||
if (temp[i - 1].Count2 == 0 || temp[i - 1].Count1 == 0)
|
||||
{
|
||||
temp[i - 1].Parameter8 = "0.00%";
|
||||
}
|
||||
else
|
||||
{
|
||||
temp[i - 1].Parameter8 = Math.Round((100.00 * temp[i - 1].Count2 / temp[i - 1].Count1) / 100, 2) + "%";//及时完成率
|
||||
}
|
||||
temp.RemoveAt(i);
|
||||
i--;
|
||||
temp[i - 1].Parameter7 = "0.00%";
|
||||
}
|
||||
else if (temp[i].PART == 3 && temp[i].PART == temp[i - 1].PART)
|
||||
else
|
||||
{
|
||||
temp[i - 1].Count1 += temp[i].Count1;
|
||||
temp[i - 1].Count2 += temp[i].Count2;
|
||||
temp[i - 1].Count3 += temp[i].Count3;
|
||||
|
||||
temp[i - 1].Parameter7 = Math.Round((100.00 * (temp[i - 1].Count2 + temp[i - 1].Count3) / temp[i - 1].Count1) / 100, 2) + "%";//整改率
|
||||
|
||||
temp.RemoveAt(i);
|
||||
i--;
|
||||
temp[i - 1].Parameter7 = Math.Round((100.00 * (temp[i - 1].Count2 + temp[i - 1].Count3) / temp[i - 1].Count1) / 100, 2) + "%";//完成率
|
||||
}
|
||||
if (temp[i - 1].Count2 == 0 || temp[i - 1].Count1 == 0)
|
||||
{
|
||||
temp[i - 1].Parameter8 = "0.00%";
|
||||
}
|
||||
else
|
||||
{
|
||||
temp[i - 1].Parameter8 = Math.Round((100.00 * temp[i - 1].Count2 / temp[i - 1].Count1) / 100, 2) + "%";//及时完成率
|
||||
}
|
||||
temp.RemoveAt(i);
|
||||
i--;
|
||||
}
|
||||
else if (temp[i].PART == 3 && temp[i].PART == temp[i - 1].PART)
|
||||
{
|
||||
temp[i - 1].Count1 += temp[i].Count1;
|
||||
temp[i - 1].Count2 += temp[i].Count2;
|
||||
temp[i - 1].Count3 += temp[i].Count3;
|
||||
|
||||
temp[i - 1].Parameter7 = Math.Round((100.00 * (temp[i - 1].Count2 + temp[i - 1].Count3) / temp[i - 1].Count1) / 100, 2) + "%";//整改率
|
||||
|
||||
temp.RemoveAt(i);
|
||||
i--;
|
||||
}
|
||||
result.listSummary = temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.listSummary = listSummery.ToList();
|
||||
}
|
||||
result.listSummary = temp;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// result.listSummary = listSummery.ToList();
|
||||
//}
|
||||
}
|
||||
if (listCheckType != null && listCheckType.Any())
|
||||
{
|
||||
if (listMineType.Count > 0)
|
||||
//if (listMineType.Count > 0)
|
||||
//{
|
||||
var Temp = listCheckType.ToList();
|
||||
for (int i = 1; i < Temp.Count; i++)
|
||||
{
|
||||
var Temp = listCheckType.ToList();
|
||||
for (int i = 1; i < Temp.Count; i++)
|
||||
if (Temp[i].YEAR == Temp[i - 1].YEAR && Temp[i].MONTH == Temp[i - 1].MONTH)
|
||||
{
|
||||
if (Temp[i].YEAR == Temp[i - 1].YEAR && Temp[i].MONTH == Temp[i - 1].MONTH)
|
||||
Temp[i - 1].ALLCOUNT += Temp[i].ALLCOUNT;
|
||||
Temp[i - 1].OUTTIMECOUNT += Temp[i].OUTTIMECOUNT;
|
||||
Temp[i - 1].INTTIMECOUNT += Temp[i].INTTIMECOUNT;
|
||||
Temp[i - 1].NOTFINISHCOUN += Temp[i].NOTFINISHCOUN;
|
||||
if (Temp[i - 1].ALLCOUNT == 0)
|
||||
{
|
||||
Temp[i - 1].ALLCOUNT += Temp[i].ALLCOUNT;
|
||||
Temp[i - 1].OUTTIMECOUNT += Temp[i].OUTTIMECOUNT;
|
||||
Temp[i - 1].INTTIMECOUNT += Temp[i].INTTIMECOUNT;
|
||||
Temp[i - 1].NOTFINISHCOUN += Temp[i].NOTFINISHCOUN;
|
||||
if (Temp[i - 1].ALLCOUNT == 0)
|
||||
{
|
||||
Temp[i - 1].FINISHPERCENT = 100;
|
||||
}
|
||||
else if (Temp[i - 1].OUTTIMECOUNT + Temp[i - 1].INTTIMECOUNT == 0)
|
||||
{
|
||||
Temp[i - 1].FINISHPERCENT = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Temp[i - 1].FINISHPERCENT = (decimal)Math.Round((100.00 * (Temp[i - 1].OUTTIMECOUNT + Temp[i - 1].INTTIMECOUNT) / Temp[i - 1].ALLCOUNT), 2);
|
||||
}
|
||||
|
||||
Temp.RemoveAt(i);
|
||||
i--;
|
||||
Temp[i - 1].FINISHPERCENT = 100;
|
||||
}
|
||||
else if (Temp[i - 1].OUTTIMECOUNT + Temp[i - 1].INTTIMECOUNT == 0)
|
||||
{
|
||||
Temp[i - 1].FINISHPERCENT = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Temp[i - 1].FINISHPERCENT = (decimal)Math.Round((100.00 * (Temp[i - 1].OUTTIMECOUNT + Temp[i - 1].INTTIMECOUNT) / Temp[i - 1].ALLCOUNT), 2);
|
||||
}
|
||||
|
||||
Temp.RemoveAt(i);
|
||||
i--;
|
||||
}
|
||||
result.listCheckTypeYear = Temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.listCheckTypeYear = listCheckType.ToList();
|
||||
}
|
||||
result.listCheckTypeYear = Temp;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// result.listCheckTypeYear = listCheckType.ToList();
|
||||
//}
|
||||
}
|
||||
if (result.listCheckTypeYear == null)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user