Commit c9b6d65e by lizefeng

fix

parent 9a0fffe8
......@@ -375,18 +375,18 @@ namespace AutoTurnOver.DB
field_type = item.Key.field_type,
group_key = item.Key.sku,
project = item.Key.project,
month1 = GetVal(item.AsQueryable(), $"{year}-01"),
month2 = GetVal(item.AsQueryable(), $"{year}-02"),
month3 = GetVal(item.AsQueryable(), $"{year}-03"),
month4 = GetVal(item.AsQueryable(), $"{year}-04"),
month5 = GetVal(item.AsQueryable(), $"{year}-05"),
month6 = GetVal(item.AsQueryable(), $"{year}-06"),
month7 = GetVal(item.AsQueryable(), $"{year}-07"),
month8 = GetVal(item.AsQueryable(), $"{year}-08"),
month9 = GetVal(item.AsQueryable(), $"{year}-09"),
month10 = GetVal(item.AsQueryable(), $"{year}-10"),
month11 = GetVal(item.AsQueryable(), $"{year}-11"),
month12 = GetVal(item.AsQueryable(), $"{year}-12")
month1 = GetVal(item.AsQueryable(), $"{year}-01", item.Key.field),
month2 = GetVal(item.AsQueryable(), $"{year}-02", item.Key.field),
month3 = GetVal(item.AsQueryable(), $"{year}-03", item.Key.field),
month4 = GetVal(item.AsQueryable(), $"{year}-04", item.Key.field),
month5 = GetVal(item.AsQueryable(), $"{year}-05", item.Key.field),
month6 = GetVal(item.AsQueryable(), $"{year}-06", item.Key.field),
month7 = GetVal(item.AsQueryable(), $"{year}-07", item.Key.field),
month8 = GetVal(item.AsQueryable(), $"{year}-08", item.Key.field),
month9 = GetVal(item.AsQueryable(), $"{year}-09", item.Key.field),
month10 = GetVal(item.AsQueryable(), $"{year}-10", item.Key.field),
month11 = GetVal(item.AsQueryable(), $"{year}-11", item.Key.field),
month12 = GetVal(item.AsQueryable(), $"{year}-12", item.Key.field)
};
viewDatas.Add(itemData);
......@@ -399,17 +399,20 @@ namespace AutoTurnOver.DB
return viewDatas;
}
public static decimal? GetVal(IQueryable<dc_ana_deviation> list, string date_str)
public static string GetVal(IQueryable<dc_ana_deviation> list, string date_str,string field)
{
string val = "";
var data = list.FirstOrDefault(s => date_str == s.date_str);
if (data == null)
if (data != null)
{
return 0;
}
else
{
return data.val;
val = Math.Round(data.val,1).ToString();
if (field.Contains("比例"))
{
return data.val.ToString("p");
}
}
return val;
}
......
......@@ -16,17 +16,17 @@ namespace AutoTurnOver.Models
public string project { get; set; }
public string field { get; set; }
public string field_type { get; set; }
public decimal? month1 { get; set; }
public decimal? month2 { get; set; }
public decimal? month3 { get; set; }
public decimal? month4 { get; set; }
public decimal? month5 { get; set; }
public decimal? month6 { get; set; }
public decimal? month7 { get; set; }
public decimal? month8 { get; set; }
public decimal? month9 { get; set; }
public decimal? month10 { get; set; }
public decimal? month11 { get; set; }
public decimal? month12 { get; set; }
public string month1 { get; set; }
public string month2 { get; set; }
public string month3 { get; set; }
public string month4 { get; set; }
public string month5 { get; set; }
public string month6 { get; set; }
public string month7 { get; set; }
public string month8 { get; set; }
public string month9 { get; set; }
public string month10 { get; set; }
public string month11 { get; set; }
public string month12 { get; set; }
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment