This commit is contained in:
yanghongwei 2024-08-27 21:42:28 +08:00
commit 3852e62f58
3 changed files with 71 additions and 2 deletions

View File

@ -41,32 +41,64 @@
/// </summary> /// </summary>
public string V5Percent { get; set; } public string V5Percent { get; set; }
/// <summary> /// <summary>
/// 国五比例数量
/// </summary>
public double V5Numer { get; set; }
/// <summary>
/// 国五运输量百分比 /// 国五运输量百分比
/// </summary> /// </summary>
public string V5WeightPercent { get; set; } public string V5WeightPercent { get; set; }
/// <summary> /// <summary>
/// 国五运输量比例
/// </summary>
public double V5WeightNumber { get; set; }
/// <summary>
/// 国六百分比 /// 国六百分比
/// </summary> /// </summary>
public string V6Percent { get; set; } public string V6Percent { get; set; }
/// <summary> /// <summary>
/// 国六运输量
/// </summary>
public double V6Number { get; set; }
/// <summary>
/// 国六运输量百分比 /// 国六运输量百分比
/// </summary> /// </summary>
public string V6WeightPercent { get; set; } public string V6WeightPercent { get; set; }
/// <summary> /// <summary>
/// 国六运输量
/// </summary>
public double V6WeightNumber { get; set; }
/// <summary>
/// 电动百分比 /// 电动百分比
/// </summary> /// </summary>
public string ElectricPrecent { get; set; } public string ElectricPrecent { get; set; }
/// <summary> /// <summary>
/// 电动运输量
/// </summary>
public double ElectricNumber { get; set; }
/// <summary>
/// 电动运输量百分比 /// 电动运输量百分比
/// </summary> /// </summary>
public string ElectricWeightPrecent { get; set; } public string ElectricWeightPrecent { get; set; }
/// <summary> /// <summary>
/// 电动运输量
/// </summary>
public double ElectricWeightNumber { get; set; }
/// <summary>
/// 其他百分比 /// 其他百分比
/// </summary> /// </summary>
public string OtherPrecent { get; set; } public string OtherPrecent { get; set; }
/// <summary> /// <summary>
/// 其他运输量
/// </summary>
public double OtherNumber { get; set; }
/// <summary>
/// 其他运输量百分比 /// 其他运输量百分比
/// </summary> /// </summary>
public string OtherWeightPrecent { get; set; } public string OtherWeightPrecent { get; set; }
/// <summary>
/// 其他运输量
/// </summary>
public double OtherWeightNumber { get; set; }
} }
} }

View File

@ -132,6 +132,34 @@
public string TransportTypeString { get; set; } public string TransportTypeString { get; set; }
public string TimeString { get; set; } public string TimeString { get; set; }
/// <summary>
/// 排放标准(0-7是国1-7D电动 X无排放阶段
/// </summary>
public string EmissionLevelString(string sort)
{
switch (sort)
{
case "1":
return "国I";
case "2":
return "国II";
case "3":
return "国III";
case "4":
return "国IV";
case "5":
return "国V";
case "6":
return "国VI";
case "7":
return "国VII";
case "D":
return "电动";
default:
return "无排放阶段";
}
}
} }
public enum CarColor public enum CarColor
{ {

View File

@ -55,7 +55,8 @@ namespace langguanApi.Service
var entity = item.Adapt<TransportDto>(); var entity = item.Adapt<TransportDto>();
entity.CarColorString = GetColorString(item.CarColor); entity.CarColorString = GetColorString(item.CarColor);
entity.TransportTypeString = item.TransportType == 1 ? "进场" : "出场"; entity.TransportTypeString = item.TransportType == 1 ? "进场" : "出场";
entity.TimeString = item.Time.ToString(); entity.TimeString = item.Time.ToString("yyyy-MM-dd HH:mm:ss");
entity.effluent = GetEffluentString(item.effluent);
result.Add(entity); result.Add(entity);
} }
} }
@ -108,7 +109,7 @@ namespace langguanApi.Service
CarColor = GetColorString(transport.CarColor), CarColor = GetColorString(transport.CarColor),
CarNumber = transport.CarNumber, CarNumber = transport.CarNumber,
CarType = transport.CarType, CarType = transport.CarType,
Time = transport.Time.ToString(), Time = transport.Time.ToString("yyyy-MM-dd HH:mm:ss"),
Weight = item.Weight, Weight = item.Weight,
Effluent = GetEffluentString(transport.effluent) Effluent = GetEffluentString(transport.effluent)
}); });
@ -129,13 +130,21 @@ namespace langguanApi.Service
if (result.cleans.Any()) if (result.cleans.Any())
{ {
result.V5Percent =((double)result.cleans.Count(p => p.Effluent == "国五") / result.cleans.Count()).ToString(); result.V5Percent =((double)result.cleans.Count(p => p.Effluent == "国五") / result.cleans.Count()).ToString();
result.V5Numer = (double)result.cleans.Count(p => p.Effluent == "国五");
result.V5WeightPercent = (result.cleans.Where(p => p.Effluent == "国五").Sum(p=>p.Weight) / result.cleans.Sum(p=>p.Weight)).ToString("0.00"); result.V5WeightPercent = (result.cleans.Where(p => p.Effluent == "国五").Sum(p=>p.Weight) / result.cleans.Sum(p=>p.Weight)).ToString("0.00");
result.V5WeightNumber = result.cleans.Where(p => p.Effluent == "国五").Sum(p => p.Weight);
result.V6Percent = ((double)result.cleans.Count(p => p.Effluent == "国六") / result.cleans.Count()).ToString("0.00"); result.V6Percent = ((double)result.cleans.Count(p => p.Effluent == "国六") / result.cleans.Count()).ToString("0.00");
result.V6Number = (double)result.cleans.Count(p => p.Effluent == "国六");
result.V6WeightPercent = (result.cleans.Where(p => p.Effluent == "国六").Sum(p => p.Weight) / result.cleans.Sum(p => p.Weight)).ToString("0.00"); result.V6WeightPercent = (result.cleans.Where(p => p.Effluent == "国六").Sum(p => p.Weight) / result.cleans.Sum(p => p.Weight)).ToString("0.00");
result.V6WeightNumber = result.cleans.Where(p => p.Effluent == "国六").Sum(p => p.Weight);
result.ElectricPrecent = ((double)result.cleans.Count(p => p.Effluent == "电动") / result.cleans.Count()).ToString("0.00"); result.ElectricPrecent = ((double)result.cleans.Count(p => p.Effluent == "电动") / result.cleans.Count()).ToString("0.00");
result.ElectricNumber = (double)result.cleans.Count(p => p.Effluent == "电动");
result.ElectricWeightPrecent = (result.cleans.Where(p => p.Effluent == "电动").Sum(p => p.Weight) / result.cleans.Sum(p => p.Weight)).ToString("0.00"); result.ElectricWeightPrecent = (result.cleans.Where(p => p.Effluent == "电动").Sum(p => p.Weight) / result.cleans.Sum(p => p.Weight)).ToString("0.00");
result.ElectricWeightNumber = result.cleans.Where(p => p.Effluent == "电动").Sum(p => p.Weight);
result.OtherPrecent = ((double)result.cleans.Count(p => p.Effluent != "电动" && p.Effluent != "国五" && p.Effluent != "国六") / result.cleans.Count()).ToString("0.00"); result.OtherPrecent = ((double)result.cleans.Count(p => p.Effluent != "电动" && p.Effluent != "国五" && p.Effluent != "国六") / result.cleans.Count()).ToString("0.00");
result.OtherNumber = (double)result.cleans.Count(p => p.Effluent != "电动" && p.Effluent != "国五" && p.Effluent != "国六");
result.OtherWeightPrecent = (result.cleans.Where(p => p.Effluent != "电动" && p.Effluent != "国五" && p.Effluent != "国六").Sum(p => p.Weight) / result.cleans.Sum(p => p.Weight)).ToString("0.00"); result.OtherWeightPrecent = (result.cleans.Where(p => p.Effluent != "电动" && p.Effluent != "国五" && p.Effluent != "国六").Sum(p => p.Weight) / result.cleans.Sum(p => p.Weight)).ToString("0.00");
result.OtherWeightNumber = (double)result.cleans.Where(p => p.Effluent != "电动" && p.Effluent != "国五" && p.Effluent != "国六").Sum(p => p.Weight);
} }
return new ApiResult() return new ApiResult()
{ {