1.Startup.cs 文件中增加授权.apk文件
2.Excel下载方法中增加.net core直接下载wwwroot下的文件代码(暂时不用,先注释掉)
| | |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Microsoft.AspNetCore.Hosting; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | |
| | | //[ChannelActionFilter] |
| | | public class ImportExcelController : Controller |
| | | { |
| | | private readonly IWebHostEnvironment _hostingEnvironment; |
| | | |
| | | public ImportExcelController(IWebHostEnvironment hostingEnvironment) |
| | | { |
| | | _hostingEnvironment = hostingEnvironment; |
| | | } |
| | | |
| | | #region[Excel导入模板列表] |
| | | /// <summary> |
| | |
| | | mes.code = "200"; |
| | | mes.data = msg; |
| | | return Json(mes); |
| | | |
| | | //ToMessage mes = new ToMessage(); |
| | | //List<ScoreReport> list = ExcelList.ExcelData(); |
| | | //list = list.Where(s => s.FileCode == FileCode).ToList(); |
| | | //var filename = list[0].FileName + ".xls"; |
| | | //var wwwRootPath = _hostingEnvironment.WebRootPath; |
| | | //var fileDirectory = Path.Combine(wwwRootPath, "Excel"); // 替换为您的Excel文件所在目录 |
| | | //var filePath = Path.Combine(fileDirectory, $"{filename}.xlsx"); // 假设文件名编码为文件名 |
| | | |
| | | //if (System.IO.File.Exists(filePath)) |
| | | //{ |
| | | // var fileInfo = new FileInfo(filePath); |
| | | // var result = new |
| | | // { |
| | | // FileName = fileInfo.Name, |
| | | // FilePath = filePath, |
| | | // FileSize = fileInfo.Length |
| | | // }; |
| | | // return Json(result); |
| | | //} |
| | | //else |
| | | //{ |
| | | // mes.code = "300"; |
| | | // mes.data = ""; |
| | | // mes.message = "文件不存在"; |
| | | //} |
| | | //return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | IEnumerable<object> data; |
| | | try |
| | | { |
| | | if (flag == "-1" && stckcode == null) |
| | | { |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.message = "暂无数据!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | string[] classcode = Array.ConvertAll<string, string>(stckcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string分割转string[] |
| | | switch (flag) |
| | | { |
| | |
| | | //添加静态文件中间件 |
| | | app.UseDefaultFiles(); |
| | | //添加授权文件 |
| | | app.UseStaticFiles(new StaticFileOptions() |
| | | { |
| | | ContentTypeProvider = new FileExtensionContentTypeProvider() |
| | | { |
| | | Mappings = { [".xls"] = "application/vnd.ms-excel" } |
| | | app.UseStaticFiles(new StaticFileOptions() { |
| | | ContentTypeProvider = new FileExtensionContentTypeProvider() { |
| | | Mappings = { |
| | | [".xls"] = "application/vnd.ms-excel", |
| | | [".apk"] = "application/vnd.android.package-archive" |
| | | } |
| | | } |
| | | }); |
| | | app.UseStaticFiles(); |
| | |
| | | //new ScoreReport("7","库位设置"), |
| | | new ScoreReport("8","存货档案"), |
| | | new ScoreReport("9","设备清单"), |
| | | new ScoreReport("10","设备点检项目"), |
| | | new ScoreReport("10_1","设备点检标准"), |
| | | new ScoreReport("11","设备保养项目"), |
| | | new ScoreReport("11_1","设备保养标准"), |
| | | //new ScoreReport("10","设备点检项目"), |
| | | //new ScoreReport("10_1","设备点检标准"), |
| | | //new ScoreReport("11","设备保养项目"), |
| | | //new ScoreReport("11_1","设备保养标准"), |
| | | new ScoreReport("12","模具清单"), |
| | | new ScoreReport("13","模具点检项目"), |
| | | new ScoreReport("13_1","模具点检标准"), |
| | |
| | | //session失效时间 |
| | | "InProc": "240", |
| | | //Excel导出模板配置IP |
| | | "FileIP": "http://121.196.36.24:8025/", |
| | | "FileIP": "http://121.196.36.24:8021/", |
| | | //jwtkey |
| | | "SigningKey": "Hello World" |
| | | } |