Commit 7e98e6cd by lizefeng

fix

parent 68bd9651
...@@ -409,9 +409,15 @@ namespace AutoTurnOver.DB ...@@ -409,9 +409,15 @@ namespace AutoTurnOver.DB
var pageDatas = allDatas.Skip(offset).Take(limit).ToList(); var pageDatas = allDatas.Skip(offset).Take(limit).ToList();
foreach (var item in pageDatas) foreach (var item in pageDatas)
{ {
var field = item.Key.field;
if (field == "是否断货")
{
field = "断货sku数";
}
deviation_view_dto itemData = new deviation_view_dto() deviation_view_dto itemData = new deviation_view_dto()
{ {
field = item.Key.field, field = field,
field_type = item.Key.field_type, field_type = item.Key.field_type,
group_key = item.Key.project, group_key = item.Key.project,
project = item.Key.project, project = item.Key.project,
...@@ -452,7 +458,7 @@ namespace AutoTurnOver.DB ...@@ -452,7 +458,7 @@ namespace AutoTurnOver.DB
switch (field) switch (field)
{ {
case "销售数量预计偏差比例": case "销售数量预计偏差比例":
val = all.Where(s=>s.field== "销售数量预计偏差值" && s.field_type == "偏差分析" && s.project == project).Sum(s=>s.val).Division( val = all.Where(s => s.field == "销售数量预计偏差值" && s.field_type == "偏差分析" && s.project == project).Sum(s => s.val).Division(
all.Where(s => s.field == "销售产品数量" && s.field_type == "预测值" && s.project == project).Sum(s => s.val) all.Where(s => s.field == "销售产品数量" && s.field_type == "预测值" && s.project == project).Sum(s => s.val)
).ToString("p"); ).ToString("p");
break; break;
...@@ -476,9 +482,14 @@ namespace AutoTurnOver.DB ...@@ -476,9 +482,14 @@ namespace AutoTurnOver.DB
break; break;
} }
} }
else if (field == "是否断货")
{
val = list.Count(s => s.val <= 0).ToString();
}
else else
{ {
val = Math.Round(data.Sum(s => s.val), 1).ToString();
val = Math.Round(data.Sum(s => s.val), field.Contains("金额") ? 1 : 0).ToString();
} }
...@@ -495,11 +506,15 @@ namespace AutoTurnOver.DB ...@@ -495,11 +506,15 @@ namespace AutoTurnOver.DB
var data = list.FirstOrDefault(s => date_str == s.date_str); var data = list.FirstOrDefault(s => date_str == s.date_str);
if (data != null) if (data != null)
{ {
val = Math.Round(data.val, 1).ToString(); val = Math.Round(data.val, field.Contains("金额") ? 1 : 0).ToString();
if (field.Contains("比例")) if (field.Contains("比例"))
{ {
return data.val.ToString("p"); return data.val.ToString("p");
} }
if (field == "是否断货")
{
return data.val > 0 ? "是" : "否";
}
} }
return val; return val;
......
...@@ -89,6 +89,9 @@ namespace AutoTurnOver.Services ...@@ -89,6 +89,9 @@ namespace AutoTurnOver.Services
case "新现金流报表(sku)": case "新现金流报表(sku)":
item.result_file_url = await DownloadDeviationSkuExport(item.parameter, item); item.result_file_url = await DownloadDeviationSkuExport(item.parameter, item);
break; break;
case "新现金流报表(项目)":
item.result_file_url = await DownloadDeviationProjectExport(item.parameter, item);
break;
default: throw new Exception("无法识别的任务"); default: throw new Exception("无法识别的任务");
} }
item.end_date = DateTime.Now; item.end_date = DateTime.Now;
...@@ -423,6 +426,18 @@ namespace AutoTurnOver.Services ...@@ -423,6 +426,18 @@ namespace AutoTurnOver.Services
Console.WriteLine("DownloadStock - 上传完毕"); Console.WriteLine("DownloadStock - 上传完毕");
return fileData; return fileData;
} }
public async Task<string> DownloadDeviationProjectExport(string par_json, dc_task_download download_data)
{
var rows = 0;
deviation_search_dto search_data = par_json.ToObject<deviation_search_dto>();
Console.WriteLine("DownloadStock - 开始生成文件");
var memory = new DeviationServices().ProjectExport(search_data, out rows);
download_data.rows = rows;
Console.WriteLine("DownloadStock - 开始生成上传文件");
var fileData = await AutoTurnOver.Utility.QiNiuCloudHelper.UploadSectioningAsync(memory);
Console.WriteLine("DownloadStock - 上传完毕");
return fileData;
}
} }
} }
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