You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.9 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System.Collections;
using Microsoft.AspNetCore.Mvc;
using Estsh.Core.Services.IServices;
using Estsh.Core.Controllers;
using NPOI.Util;
/***************************************************************************************************
*
* 更新人sitong.dong
* 描述:采购周计划导入
* 修改时间2022.06.22
* 修改日志:系统迭代升级
*
**************************************************************************************************/
namespace Estsh.Core.Web.Controllers
{
/// <summary>
/// 采购周计划导入
/// </summary>
public class PurchaseNoteController : BaseController
{
private IPurchaseNoteService service;
private IWebHostEnvironment hostingEnvironment;
public PurchaseNoteController(IPurchaseNoteService _service, IWebHostEnvironment _hostingEnvironment)
{
service = _service;
hostingEnvironment = _hostingEnvironment;
}
//
// GET: /PurchaseNote/
public ActionResult Index()
{
return View();
}
/// <summary>
/// 导入采购周计划
/// </summary>
/// <returns></returns>
public ActionResult importData()
{
Hashtable result = new Hashtable();
IFormFile file = Request.Form.Files[0];
var filename = file.FileName;
filename = hostingEnvironment.WebRootPath + @"\UpLoad\" + filename;
if (!Directory.Exists(hostingEnvironment.WebRootPath + @"\UpLoad"))
{
Directory.CreateDirectory(hostingEnvironment.WebRootPath + @"\UpLoad");
}
using (FileStream fileStream = System.IO.File.Create(filename))
{
file.CopyTo(fileStream);
fileStream.Flush();
result = service.ReadExcelFile(fileStream, CurrentEmp.EmpId);
return Json(result);
}
}
}
}