Commit d998fa7d by lizefeng

监控程序异常

parent e0d51271
......@@ -134,142 +134,150 @@ namespace AutoTurnOver.Controllers
/// <param name="sku"></param>
/// <param name="warehousecode"></param>
/// <returns></returns>
public FileResult Export(string supplier_name, int limit, int offset, string order, string sort, int? searchType, string key_words, string buyer_name, string sku_prefix, int? IsRedundant, int? IsStockOut, string warehousecode, string warehousetype, int? warehousearea, bool? hasDefectConfig, bool? hasAadvise = null, string categoryIds = null, int? monitor_status = null,int? has_tort = null)
public ActionResult Export(string supplier_name, int limit, int offset, string order, string sort, int? searchType, string key_words, string buyer_name, string sku_prefix, int? IsRedundant, int? IsStockOut, string warehousecode, string warehousetype, int? warehousearea, bool? hasDefectConfig, bool? hasAadvise = null, string categoryIds = null, int? monitor_status = null,int? has_tort = null)
{
var m = new Condition_AutoTurnOver
{
searchType = searchType,
key_words = key_words,
out_of_stock = IsStockOut,
redundancy = IsRedundant,
warehouse_code = warehousecode,
warehousetype = warehousetype,
warehousearea = warehousearea,
hasDefectConfig = hasDefectConfig,
hasAadvise = hasAadvise,
categoryIds = categoryIds,
monitor_status = monitor_status,
buyer_name = buyer_name,
supplier_name = supplier_name,
has_tort = has_tort
};
var total = 0;
var service = new Services.SkuAutoTurnServices();
var list = service.List(m, 0, int.MaxValue, ref total, order, sort).Select(p => new
try
{
p.bailun_sku,
p.sku_title,
p.warehouse_code,
p.warehouse_name,
p.quantity_minimum_order,
p.quantity_final_advise,
p.quantity_promotion,
p.quantity_inventory,
p.turnover_days,
p.quantity_safe_inventory,
p.inspection_delivery,
p.status,
p.id,
p.quantity_out_stock,
p.supplier_delivery,
p.transfer_delivery,
p.quantity_purchase,
p.quantity_transfer,
p.forecast_fourteenday_sales,
p.forecast_sevenday_sales,
p.oneday_sales,
p.forecast_oneday_sales2,
p.product_inner_code,
p.product_code,
p.bailun_category_name,
p.monitor_status,
p.supplier_name,
p.buyer_name,
p.delivery_days_error,
p.history_sevenday_sales,
p.history_fourteenday_sales,
p.history_thirtyday_sales,
p.unit_price,
p.weight,
p.usable_stock,
p.suppliers_name,
p.history_sevenday_sales_ebay,
p.history_fourteenday_sales_ebay,
p.history_thirtyday_sales_ebay,
p.shipped_stock,
p.develop_time,
p.has_tort
});
var m = new Condition_AutoTurnOver
{
searchType = searchType,
key_words = key_words,
out_of_stock = IsStockOut,
redundancy = IsRedundant,
warehouse_code = warehousecode,
warehousetype = warehousetype,
warehousearea = warehousearea,
hasDefectConfig = hasDefectConfig,
hasAadvise = hasAadvise,
categoryIds = categoryIds,
monitor_status = monitor_status,
buyer_name = buyer_name,
supplier_name = supplier_name,
has_tort = has_tort
};
var total = 0;
var service = new Services.SkuAutoTurnServices();
var list = service.List(m, 0, int.MaxValue, ref total, order, sort).Select(p => new
{
p.bailun_sku,
p.sku_title,
p.warehouse_code,
p.warehouse_name,
p.quantity_minimum_order,
p.quantity_final_advise,
p.quantity_promotion,
p.quantity_inventory,
p.turnover_days,
p.quantity_safe_inventory,
p.inspection_delivery,
p.status,
p.id,
p.quantity_out_stock,
p.supplier_delivery,
p.transfer_delivery,
p.quantity_purchase,
p.quantity_transfer,
p.forecast_fourteenday_sales,
p.forecast_sevenday_sales,
p.oneday_sales,
p.forecast_oneday_sales2,
p.product_inner_code,
p.product_code,
p.bailun_category_name,
p.monitor_status,
p.supplier_name,
p.buyer_name,
p.delivery_days_error,
p.history_sevenday_sales,
p.history_fourteenday_sales,
p.history_thirtyday_sales,
p.unit_price,
p.weight,
p.usable_stock,
p.suppliers_name,
p.history_sevenday_sales_ebay,
p.history_fourteenday_sales_ebay,
p.history_thirtyday_sales_ebay,
p.shipped_stock,
p.develop_time,
p.has_tort
});
DataTable table = new DataTable();
string[] cols = new string[] { "Sku","商品编码", "内部编码", "sku标题", "仓库编码", "仓库名称", "MOQ",
DataTable table = new DataTable();
string[] cols = new string[] { "Sku","商品编码", "内部编码", "sku标题", "仓库编码", "仓库名称", "MOQ",
"采购在途", "调拨在途", "昨日销量", "明日销量", "未来7天日均", "未来14天日均", "建议采购数", "活动促销数量",
"实际库存", "安全库存", "周转天数", "供应商交期", "质检入库天数", "调拨头程天数", "预测是否断货", "缺货数量","监控状态","供应商","采购员","交期异常",
"过去7天日均","过去14天日均","过去30天日均","重量","单价","实时库存","ebay最近7天日均销量","ebay最近14天日均销量","ebay最近30天日均销量","已发货库存","开发时间","是否侵权"
};
foreach (var item in cols)
{
table.Columns.Add(item);
}
foreach (var itemData in list)
{
DataRow row = table.NewRow();
foreach (var item in cols)
{
table.Columns.Add(item);
}
row["Sku"] = itemData.bailun_sku;
row["商品编码"] = itemData.product_code;
row["内部编码"] = itemData.product_inner_code;
row["sku标题"] = itemData.sku_title;
row["仓库编码"] = itemData.warehouse_code;
row["仓库名称"] = itemData.warehouse_name;
row["MOQ"] = itemData.quantity_minimum_order;
row["采购在途"] = itemData.quantity_purchase;
row["调拨在途"] = itemData.quantity_transfer;
row["昨日销量"] = itemData.oneday_sales;
row["明日销量"] = itemData.forecast_oneday_sales2;
row["未来7天日均"] = itemData.forecast_sevenday_sales;
row["未来14天日均"] = itemData.forecast_fourteenday_sales;
row["建议采购数"] = itemData.quantity_final_advise;
row["活动促销数量"] = itemData.quantity_promotion;
row["实际库存"] = itemData.quantity_inventory;
row["安全库存"] = itemData.quantity_safe_inventory;
row["周转天数"] = itemData.turnover_days;
row["供应商交期"] = itemData.supplier_delivery;
row["质检入库天数"] = itemData.inspection_delivery;
row["调拨头程天数"] = itemData.transfer_delivery;
row["预测是否断货"] = itemData.status == 1 ? "是" : "否";
row["缺货数量"] = itemData.quantity_out_stock;
row["监控状态"] = itemData.monitor_status == 1 ? "停止监控" : "监控中";
row["供应商"] = itemData.supplier_name;
row["采购员"] = itemData.buyer_name;
row["交期异常"] = itemData.delivery_days_error;
row["过去7天日均"] = itemData.history_sevenday_sales;
row["过去14天日均"] = itemData.history_fourteenday_sales;
row["过去30天日均"] = itemData.history_thirtyday_sales;
row["重量"] = itemData.weight;
row["单价"] = itemData.unit_price;
row["实时库存"] = itemData.usable_stock;
row["ebay最近7天日均销量"] = itemData.history_sevenday_sales_ebay;
row["ebay最近14天日均销量"] = itemData.history_fourteenday_sales_ebay;
row["ebay最近30天日均销量"] = itemData.history_thirtyday_sales_ebay;
row["已发货库存"] = itemData.shipped_stock;
row["开发时间"] = itemData.develop_time;
row["是否侵权"] = itemData.has_tort;
table.Rows.Add(row);
foreach (var itemData in list)
{
DataRow row = table.NewRow();
row["Sku"] = itemData.bailun_sku;
row["商品编码"] = itemData.product_code;
row["内部编码"] = itemData.product_inner_code;
row["sku标题"] = itemData.sku_title;
row["仓库编码"] = itemData.warehouse_code;
row["仓库名称"] = itemData.warehouse_name;
row["MOQ"] = itemData.quantity_minimum_order;
row["采购在途"] = itemData.quantity_purchase;
row["调拨在途"] = itemData.quantity_transfer;
row["昨日销量"] = itemData.oneday_sales;
row["明日销量"] = itemData.forecast_oneday_sales2;
row["未来7天日均"] = itemData.forecast_sevenday_sales;
row["未来14天日均"] = itemData.forecast_fourteenday_sales;
row["建议采购数"] = itemData.quantity_final_advise;
row["活动促销数量"] = itemData.quantity_promotion;
row["实际库存"] = itemData.quantity_inventory;
row["安全库存"] = itemData.quantity_safe_inventory;
row["周转天数"] = itemData.turnover_days;
row["供应商交期"] = itemData.supplier_delivery;
row["质检入库天数"] = itemData.inspection_delivery;
row["调拨头程天数"] = itemData.transfer_delivery;
row["预测是否断货"] = itemData.status == 1 ? "是" : "否";
row["缺货数量"] = itemData.quantity_out_stock;
row["监控状态"] = itemData.monitor_status == 1 ? "停止监控" : "监控中";
row["供应商"] = itemData.supplier_name;
row["采购员"] = itemData.buyer_name;
row["交期异常"] = itemData.delivery_days_error;
row["过去7天日均"] = itemData.history_sevenday_sales;
row["过去14天日均"] = itemData.history_fourteenday_sales;
row["过去30天日均"] = itemData.history_thirtyday_sales;
row["重量"] = itemData.weight;
row["单价"] = itemData.unit_price;
row["实时库存"] = itemData.usable_stock;
row["ebay最近7天日均销量"] = itemData.history_sevenday_sales_ebay;
row["ebay最近14天日均销量"] = itemData.history_fourteenday_sales_ebay;
row["ebay最近30天日均销量"] = itemData.history_thirtyday_sales_ebay;
row["已发货库存"] = itemData.shipped_stock;
row["开发时间"] = itemData.develop_time;
row["是否侵权"] = itemData.has_tort;
table.Rows.Add(row);
}
var fileName = AppContext.BaseDirectory + @"Result\RealtimeStock\周转表.csv";
DataTableHelper.SaveCSV(table, fileName);
var memory = new MemoryStream();
using (var stream = new FileStream(fileName, FileMode.Open))
{
stream.CopyTo(memory);
}
memory.Position = 0;
return File(memory, "text/csv", "周转表.csv");
}
var fileName = AppContext.BaseDirectory + @"Result\RealtimeStock\周转表.csv";
DataTableHelper.SaveCSV(table, fileName);
var memory = new MemoryStream();
using (var stream = new FileStream(fileName, FileMode.Open))
catch (Exception ex)
{
stream.CopyTo(memory);
return new ContentResult() { Content = ex.Message+"----"+ex.StackTrace };
}
memory.Position = 0;
return File(memory, "text/csv", "周转表.csv");
}
#region 特殊销售设置
......
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