1.Startup.cs 文件中增加授权.apk文件
2.Excel下载方法中增加.net core直接下载wwwroot下的文件代码(暂时不用,先注释掉)
已修改5个文件
89 ■■■■ 文件已修改
VueWebCoreApi/Controllers/ImportExcelController.cs 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/DAL/BasicSettingDAL.cs 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Startup.cs 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Tools/ExcelList.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/appsettings.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Controllers/ImportExcelController.cs
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Data;
@@ -18,6 +19,12 @@
    //[ChannelActionFilter]
    public class ImportExcelController : Controller
    {
        private readonly IWebHostEnvironment _hostingEnvironment;
        public ImportExcelController(IWebHostEnvironment hostingEnvironment)
        {
            _hostingEnvironment = hostingEnvironment;
        }
        #region[Excel导入模板列表]
        /// <summary>
@@ -55,6 +62,33 @@
            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
VueWebCoreApi/DLL/DAL/BasicSettingDAL.cs
@@ -3039,6 +3039,14 @@
            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)
                {
@@ -3092,7 +3100,7 @@
        #endregion
        #region[仓位信息新增/编辑保存]
        public static ToMessage TSecLocaAddUpdate(string data_sources, string locacode, string locaname, string stckcode, string parentlocacode,string depth, string status, string description, string OperType, User us)
        public static ToMessage TSecLocaAddUpdate(string data_sources, string locacode, string locaname, string stckcode, string parentlocacode, string depth, string status, string description, string OperType, User us)
        {
            string sql = "";
            List<object> list = new List<object>();
@@ -3146,7 +3154,7 @@
                            lm_user = us.usercode,
                            lm_date = DateTime.Now.ToString(),
                            data_sources = data_sources,
                            depth= depth
                            depth = depth
                        }
                    });
                    bool aa = DapperHelper.DoTransaction(list);
@@ -3207,7 +3215,7 @@
                            name = locaname,
                            idwarehouse = stckcode,
                            idparent = parentlocacode,
                            depth= depth,
                            depth = depth,
                            status = status,
                            description = description,
                            lm_user = us.usercode,
@@ -3321,7 +3329,7 @@
        #region[工序查询]
        public static ToMessage StepSearch(string stepcode, string stepname, string enable, string steptypecode,int startNum, int endNum, string prop, string order)
        public static ToMessage StepSearch(string stepcode, string stepname, string enable, string steptypecode, int startNum, int endNum, string prop, string order)
        {
            var dynamicParams = new DynamicParameters();
            string search = "";
@@ -3442,7 +3450,7 @@
                    }
                    sql = @"update TStep set stepname=@stepname,flwtype=@steptypecode,enable=@enable,descr=@description,
                                lm_user=@username,lm_date=@CreateDate where id=@stepid";
                    list.Add(new { str = sql, parm = new {stepid = stepid, stepname = stepname, steptypecode = steptypecode, enable = enable, description = description, username = us.usercode, CreateDate = DateTime.Now.ToString() } });
                    list.Add(new { str = sql, parm = new { stepid = stepid, stepname = stepname, steptypecode = steptypecode, enable = enable, description = description, username = us.usercode, CreateDate = DateTime.Now.ToString() } });
                    bool aa = DapperHelper.DoTransaction(list);
                    if (aa)
                    {
VueWebCoreApi/Startup.cs
@@ -76,7 +76,7 @@
                        Description = $"Panda.Sewerage :  {version}  ",
                    });
                });
                string basePath = Path.GetDirectoryName(typeof(Program).Assembly.Location);
                string xmlPath = Path.Combine(basePath, "VueWebCoreApi.xml");
                c.IncludeXmlComments(xmlPath, true);
@@ -146,7 +146,7 @@
                {
                    c.SwaggerEndpoint($"/swagger/{version}/swagger.json", $"{version}");
                });
            });
            #endregion
            app.UseHttpsRedirection();
@@ -157,12 +157,13 @@
            //添加静态文件中间件
            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();
            //跨域
@@ -189,15 +190,15 @@
            //        Mappings = { [".exe"] = "application/octect-stream" }
            //    }
            //});
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapHub<ChatHub>("/ChatHub", options =>
                {
                        options.Transports =
                        HttpTransportType.WebSockets |
                        HttpTransportType.LongPolling;
                    options.Transports =
                    HttpTransportType.WebSockets |
                    HttpTransportType.LongPolling;
                });
            });
            loggerFactory.AddLog4Net("Config/log4net.config");
VueWebCoreApi/Tools/ExcelList.cs
@@ -22,10 +22,10 @@
                //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","模具点检标准"),
VueWebCoreApi/appsettings.json
@@ -25,7 +25,7 @@
    //session失效时间
    "InProc": "240",
    //Excel导出模板配置IP
    "FileIP": "http://121.196.36.24:8025/",
    "FileIP": "http://121.196.36.24:8021/",
    //jwtkey
    "SigningKey": "Hello World"
  }