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.

62 lines
2.0 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 Estsh.Core.Controllers;
using Estsh.Core.Services.IServices;
using Microsoft.AspNetCore.Mvc;
using System.Collections;
/***************************************************************************************************
*
* 更新人sitong.dong
* 描述SAP指令导入模块控制类
* 修改时间2022.06.22
* 修改日志:系统迭代升级
*
**************************************************************************************************/
namespace Estsh.Core.Web.Controllers
{
/// <summary>
/// SAP指令导入模块控制类
/// </summary>
public class SAPOrderImportController : BaseController
{
private ISAPOrderImportService service;
private IWebHostEnvironment hostingEnvironment;
public SAPOrderImportController(ISAPOrderImportService _service, IWebHostEnvironment _hostingEnvironment)
{
service = _service;
hostingEnvironment = _hostingEnvironment;
}
public ActionResult Index()
{
return View();
}
#region SAP指令导入
/// <summary>
/// 指令导入
/// </summary>
/// <returns></returns>
public ActionResult importOrderInfo(int orderType)
{
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, orderType, CurrentEmp.EmpId);
return Json(result);
}
}
#endregion
}
}