Commit 37764839 by lizefeng

优化实时库存导出

parent 34305167
......@@ -239,7 +239,7 @@ left join dc_base_tort as t8 on dat.bailun_sku = t8.bailun_sku
return obj.AsList();
}
catch (Exception ex)
catch (Exception)
{
throw;
......
......@@ -584,9 +584,9 @@ and EXISTS (
return obj.AsList();
}
catch (Exception ex)
catch (Exception)
{
return list;
throw;
}
}
......
......@@ -42,7 +42,7 @@ namespace AutoTurnOver.Common
return data.data;
}
}
catch(Exception ex)
catch(Exception)
{
current.Response.StatusCode = (int)HttpStatusCode.Unauthorized;
return null;
......
......@@ -117,9 +117,18 @@ namespace AutoTurnOver.Controllers
/// <returns></returns>
public FileResult ExportRealtime(string sku,string bailun_sku, string warehousecode, string product_inner_code, string sku_title_cn,string supplier_name, string warehousetype, int? warehousearea,int? has_tort = null)
{
var user = AutoUtility.GetUser();
var services = new DailyServices();
var total = 0;
var list = services.RealtimeList(sku, bailun_sku, warehousecode, product_inner_code, sku_title_cn, supplier_name, 0, int.MaxValue, ref total,warehousetype,warehousearea, has_tort: has_tort);
var fileName = AppContext.BaseDirectory + $@"Result\RealtimeStock\{user.UserAccount}实时库存.csv";
int page = 1;
int rows = 10000;
while (true)
{
var list = services.RealtimeList(sku, bailun_sku, warehousecode, product_inner_code, sku_title_cn, supplier_name, (page-1)*rows, rows, ref total, warehousetype, warehousearea, has_tort: has_tort);
if (list == null || list.Count <= 0) break;
DataTable table = new DataTable();
string[] cols = new string[] { "Sku", "采购名称", "中文名", "英文名称","内部编码", "仓库编码", "仓库名称", "货主编码","实时采购在途","实时调拨在途"
......@@ -191,9 +200,11 @@ namespace AutoTurnOver.Controllers
table.Rows.Add(row);
}
var fileName = AppContext.BaseDirectory+ @"Result\RealtimeStock\实时库存.csv";
CsvFileHelper.SaveCSV(table, fileName,page==1);
page++;
}
DataTableHelper.SaveCSV(table, fileName);
var memory = new MemoryStream();
using (var stream = new FileStream(fileName, FileMode.Open))
......@@ -201,7 +212,7 @@ namespace AutoTurnOver.Controllers
stream.CopyTo(memory);
}
memory.Position = 0;
return File(memory, "text/csv", "实时库存.csv");
return File(memory, "text/csv", $"{user.UserAccount}实时库存.csv");
}
/// <summary>
......
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