yl
2023-09-08 129879f45b1b59f8e1b26c766a80d50f371be385
人员信息导入
已重命名11个文件
已添加2个文件
已修改8个文件
已删除1个文件
1157 ■■■■■ 文件已修改
VueWebCoreApi/Controllers/GeneralBasicDataController.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Controllers/ImportExcelController.cs 135 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/BLL/ExcelCheckBLL.cs 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/DAL/ExcelCheckDAL.cs 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Excel/用户清单.xls 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Models/SystemSetting/ExceImport.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Tools/ExcelList.cs 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Tools/ImportExcel.cs 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Tools/ImportExcelData.cs 827 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/VueWebCoreApi.csproj 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/wwwroot/Excel/仓库库位清单.xls 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/wwwroot/Excel/往来单位.xls 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/wwwroot/Excel/物料清单.xls 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/wwwroot/Excel/用户清单.xls 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/wwwroot/Excel/缺陷定义.xls 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/wwwroot/Excel/节拍工价.xls 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/wwwroot/Excel/角色清单.xls 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/wwwroot/Excel/设备保养标准.xls 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/wwwroot/Excel/设备保养项目.xls 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/wwwroot/Excel/设备清单.xls 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/wwwroot/Excel/设备点检标准.xls 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/wwwroot/Excel/设备点检项目.xls 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Controllers/GeneralBasicDataController.cs
@@ -32,6 +32,10 @@
        #endregion
        #region[岗位基础资料]
        /// <summary>
        /// å²—位基础资料
        /// </summary>
        /// <returns></returns>
        [Route(template: "PostPermissions")]
        [HttpGet]
        public JsonResult PostPermissions()
@@ -42,6 +46,10 @@
        #endregion
        #region[角色基础资料]
        /// <summary>
        /// è§’色基础资料
        /// </summary>
        /// <returns></returns>
        [Route(template: "RolePermissions")]
        [HttpGet]
        public JsonResult RolePermissions()
@@ -52,6 +60,10 @@
        #endregion
        #region[班组基础资料]
        /// <summary>
        ///班组基础资料
        /// </summary>
        /// <returns></returns>
        [Route(template: "GroupsPermissions")]
        [HttpGet]
        public JsonResult GroupsPermissions()
VueWebCoreApi/Controllers/ImportExcelController.cs
@@ -1,9 +1,13 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using VueWebCoreApi.DLL.BLL;
using VueWebCoreApi.Models;
using VueWebCoreApi.Models.SystemSetting;
using VueWebCoreApi.Tools;
namespace VueWebCoreApi.Controllers
@@ -14,8 +18,6 @@
    //[ChannelActionFilter]
    public class ImportExcelController : Controller
    {
        //定义全局信息返回变量
        ToMessage mes = new ToMessage();
        #region[Excel导入模板列表]
        /// <summary>
@@ -26,6 +28,7 @@
        [HttpGet]
        public JsonResult ExcelModelData()
        {
            ToMessage mes = new ToMessage();
            List<ScoreReport> list = ExcelList.ExcelData();
            mes.code = "200";
            mes.data = list;
@@ -43,6 +46,7 @@
        [HttpGet]
        public JsonResult DownLoadExcel(string FileCode = null)
        {
            ToMessage mes = new ToMessage();
            List<ScoreReport> list = ExcelList.ExcelData();
            list = list.Where(s => s.FileCode == FileCode).ToList();
            var filename = list[0].FileName + ".xls";
@@ -53,5 +57,132 @@
            return Json(mes);
        }
        #endregion
        #region [Excel导入数据提交、模板验证、数据导入]
        /// <summary>
        /// Excel导入数据提交、模板验证、数据导入
        /// </summary>
        /// <param name="myModel">提交数据</param>
        /// <returns></returns>
        [Route(template: "ExcelModelCheck")]
        [HttpPost]
        public JsonResult ExcelModelCheck([FromBody] ExceImport myModel)
        {
            string FileCode = myModel.FileCode;
            List<DataTable> dataTable = myModel.TableData;
            ExcelModelCheck list = new ExcelModelCheck();
            list.json1 = ExcelCheck(dataTable, FileCode);  //模板验证
            if (list.json1.code == "301")
            {
                list.json1 = list.json1;
                return Json(list);
            }
            list.json2 = ExcelCheckData(myModel);  //数据验证
            if (list.json2.code == "301")
            {
                list.json2 = list.json2;
                return Json(list);
            }
            //list.json3 = ExcelCheckData(myModel);  //数据验证
            //if (list.json3.code == "300")
            //{
            //    list.json3 = list.json3;
            //    return Json(list);
            //}
            return Json(list);
        }
        #endregion
        #region [Excel导入模板验证]
        /// <summary>
        /// Excel导入模板验证
        /// </summary>
        /// <param name="dataTable">提交数据</param>
        /// <param name="FileCode">文件编码</param>
        /// <returns></returns>
        [Route(template: "ExcelCheckUpload")]
        [HttpGet]
        [ApiExplorerSettings(IgnoreApi = true)]
        public ToMessage ExcelCheck(List<DataTable> dataTable, string FileCode = null)
        {
            ToMessage mes = new ToMessage();
            try
            {
                mes = ExcelCheckBLL.ExcelCheck(FileCode, dataTable);
                if (mes.code == "301") //上传模板不是指定模板
                {
                    return mes;
                }
                return mes;
            }
            catch (Exception e)
            {
                mes.code = "300";
                mes.Message = e.Message;
            }
            return mes;
        }
        #endregion
        #region [Excel导入数据验证]
        /// <summary>
        /// Excel导入数据验证
        /// </summary>
        /// <param name="myModel">提交数据</param>
        /// <returns></returns>
        [Route(template: "ExcelCheckData")]
        [HttpPost]
        [ApiExplorerSettings(IgnoreApi = true)]
        public ToMessage ExcelCheckData([FromBody] ExceImport myModel)
        {
            ToMessage mes = new ToMessage();
            string message = "";
            string StuCode = "";
            int count = 0;
            List<ExcelErro> list = new List<ExcelErro>();
            string FileCode = myModel.FileCode;
            List<DataTable> dataTable = myModel.TableData;
            list = ExcelCheckBLL.ExcelCheckData(FileCode, dataTable, out StuCode, out message, out count);
            mes.code = StuCode;
            mes.Message = message;
            mes.count = count;
            mes.data = list;
            return mes;
        }
        #endregion
        #region[Excel导入数据]
        /// <summary>
        /// Excel导入数据
        /// </summary>
        /// <param name="dataTable">提交数据</param>
        /// <param name="FileCode">文件编码</param>
        /// <returns></returns>
        [Route(template: "ExcelImportSubmit")]
        [HttpPost]
        [ApiExplorerSettings(IgnoreApi = true)]
        public ToMessage ExcelImportSubmit(List<DataTable> dataTable, string FileCode = null)
        {
            ToMessage mes = new ToMessage();
            try
            {
                var token = HttpContext.Request.Headers["Token"].ToString();
                User us = JwtTools.Denocode(token.ToString());
                mes = ExcelCheckBLL.ExcelImportSubmit(FileCode, dataTable, us);
                if (mes.code == "300")
                {
                    return mes;
                }
                return mes;
            }
            catch (Exception e)
            {
                mes.code = "300";
                mes.Message = e.Message;
            }
            return mes;
        }
        #endregion
    }
}
VueWebCoreApi/DLL/BLL/ExcelCheckBLL.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using VueWebCoreApi.DLL.DAL;
@@ -11,23 +12,23 @@
    public class ExcelCheckBLL
    {
        #region【Excel导入模板验证】
        public static ToMessage ExcelCheck(string fileCode, string savePath)
        public static ToMessage ExcelCheck(string fileCode, List<DataTable> dataTable)
        {
            return ExcelCheckDAL.ExcelCheck(fileCode, savePath);
            return ExcelCheckDAL.ExcelCheck(fileCode, dataTable);
        }
        #endregion
        #region[Excel导入数据验证]
        public static List<ExcelErro> ExcelCheckData(string fileCode, string savePath, out string stuCode, out string message, out int count)
        public static List<ExcelErro> ExcelCheckData(string fileCode, List<DataTable> dataTable, out string stuCode, out string message, out int count)
        {
            return ExcelCheckDAL.ExcelCheckData(fileCode, savePath, out stuCode, out message, out count);
            return ExcelCheckDAL.ExcelCheckData(fileCode, dataTable, out stuCode, out message, out count);
        }
        #endregion
        #region[Excel导入数据]
        public static ToMessage ExcelImportSubmit(string fileCode, string savePath, string username)
        public static ToMessage ExcelImportSubmit(string FileCode, List<DataTable> dataTable, User us)
        {
            return ExcelCheckDAL.ExcelImportSubmit(fileCode, savePath, username);
            return ExcelCheckDAL.ExcelImportSubmit(FileCode, dataTable, us);
        }
        #endregion
    }
VueWebCoreApi/DLL/DAL/ExcelCheckDAL.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using VueWebCoreApi.Models;
@@ -10,30 +11,37 @@
    public class ExcelCheckDAL
    {
        public static ToMessage mes = new ToMessage(); //定义全局返回信息对象
        public static string savePath = "";
        #region【Excel导入模板验证】
        public static ToMessage ExcelCheck(string fileCode, string savePath)
        public static ToMessage ExcelCheck(string fileCode, List<DataTable> dataTable)
        {
            string StuCode = "";
            string Message = "";
            switch (fileCode)
            {
                case "1": //角色权限
                case "0": //组织架构
                    Message = ImportExcelData.Zerro(savePath, out StuCode);
                    break;
                case "1"://岗位管理
                    Message = ImportExcelData.One(savePath, out StuCode);
                    break;
                case "2"://用户角色
                case "2"://班组管理
                    Message = ImportExcelData.Two(savePath, out StuCode);
                    break;
                case "3"://工位清单
                    Message = ImportExcelData.Three(savePath, out StuCode);
                case "3"://人员管理
                    Message = ImportExcelData.Three(dataTable, out StuCode);
                    break;
                case "4"://往来单位
                case "4"://角色管理
                    Message = ImportExcelData.Four(savePath, out StuCode);
                    break;
                case "6"://仓库、库位定义
                    Message = ImportExcelData.SixOne(savePath, out StuCode);
                case "5"://往来单位
                    Message = ImportExcelData.Five(savePath, out StuCode);
                    break;
                case "7"://容器定义
                case "6"://仓库设置
                    Message = ImportExcelData.Six(savePath, out StuCode);
                    break;
                case "7"://库位设置
                    Message = ImportExcelData.Seven(savePath, out StuCode);
                    break;
                case "8"://存货档案
@@ -102,7 +110,7 @@
        #endregion
        #region【Excel导入数据验证】
        public static List<ExcelErro> ExcelCheckData(string fileCode, string savePath, out string stuCode, out string message, out int count)
        public static List<ExcelErro> ExcelCheckData(string fileCode, List<DataTable> dataTable, out string stuCode, out string message, out int count)
        {
            stuCode = "";
            message = "";
@@ -110,22 +118,28 @@
            List<ExcelErro> list = new List<ExcelErro>();
            switch (fileCode)
            {
                case "1": //角色权限
                case "0": //组织架构
                    list = ImportExcelData.ZerroData(savePath, out stuCode, out message, out count);
                    break;
                case "1": //岗位管理
                    list = ImportExcelData.OneData(savePath, out stuCode, out message, out count);
                    break;
                case "2"://用户角色
                case "2"://班组管理
                    list = ImportExcelData.TwoData(savePath, out stuCode, out message, out count);
                    break;
                case "3"://工位清单
                    list = ImportExcelData.ThreeData(savePath, out stuCode, out message, out count);
                case "3"://人员管理
                    list = ImportExcelData.ThreeData(dataTable, out stuCode, out message, out count);
                    break;
                case "4"://往来单位清单
                case "4"://角色管理
                    list = ImportExcelData.FourData(savePath, out stuCode, out message, out count);
                    break;
                case "6"://仓库、库位定义
                    list = ImportExcelData.SixOneData(savePath, out stuCode, out message, out count);
                case "5"://往来单位
                    list = ImportExcelData.FiveData(savePath, out stuCode, out message, out count);
                    break;
                case "7"://容器定义
                case "6"://仓库设置
                    list = ImportExcelData.SixData(savePath, out stuCode, out message, out count);
                    break;
                case "7"://库位设置
                    list = ImportExcelData.SevenData(savePath, out stuCode, out message, out count);
                    break;
                case "8"://存货档案
@@ -186,29 +200,36 @@
        }
        #endregion
        #region【Excel导入数据验证】
        public static ToMessage ExcelImportSubmit(string FileCode, string savePath, string User)
        #region【Excel导入数据】
        public static ToMessage ExcelImportSubmit(string FileCode, List<DataTable> dataTable, User us)
        {
            string StuCode = "";
            string Message = "";
            string User = "";
            switch (FileCode)
            {
                case "1": //角色权限
                case "0": //组织架构
                    Message = ImportExcelData.ZerroSubmit(savePath, User, out StuCode);
                    break;
                case "1": //岗位管理
                    Message = ImportExcelData.OneSubmit(savePath, User, out StuCode);
                    break;
                case "2"://用户角色
                case "2"://班组管理
                    Message = ImportExcelData.TwoSubmit(savePath, User, out StuCode);
                    break;
                case "3"://工位清单
                    Message = ImportExcelData.ThreeSubmit(savePath, User, out StuCode);
                case "3"://人员管理
                    Message = ImportExcelData.ThreeSubmit(dataTable, us, out StuCode);
                    break;
                case "4"://往来单位清单
                case "4"://角色管理
                    Message = ImportExcelData.FourSubmit(savePath, User, out StuCode);
                    break;
                case "6"://仓库、库位定义
                    Message = ImportExcelData.SixOneSubmit(savePath, User, out StuCode);
                case "5"://往来单位
                    Message = ImportExcelData.FiveSubmit(savePath, User, out StuCode);
                    break;
                case "7"://容器定义
                case "6"://仓库设置
                    Message = ImportExcelData.SixSubmit(savePath, User, out StuCode);
                    break;
                case "7"://库位设置
                    Message = ImportExcelData.SevenSubmit(savePath, User, out StuCode);
                    break;
                case "8"://存货档案
VueWebCoreApi/Excel/Óû§Çåµ¥.xls
Binary files differ
VueWebCoreApi/Models/SystemSetting/ExceImport.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
namespace VueWebCoreApi.Models.SystemSetting
{
    public class ExceImport
    {
        public string FileCode { get; set; }
        //public List<string> SheetName { get; set; }
        //public List<List<string>> TableHeader { get; set; }
        //public List<List<Dictionary<string, object>>> TableData { get; set; }
        public List<DataTable> TableData { get; set; }
    }
}
VueWebCoreApi/Tools/ExcelList.cs
@@ -13,12 +13,13 @@
            List<ScoreReport> list = new List<ScoreReport>
            {
                new ScoreReport("0","组织架构"),
                new ScoreReport("1","角色清单"),
                new ScoreReport("2","用户清单"),
                new ScoreReport("3","工位清单"),
                new ScoreReport("4","往来单位"),
                new ScoreReport("6","仓库库位清单"),
                new ScoreReport("7","容器定义"),
                new ScoreReport("1","岗位管理"),
                new ScoreReport("2","班组管理"),
                new ScoreReport("3","人员管理"),
                new ScoreReport("4","角色管理"),
                new ScoreReport("5","往来单位"),
                new ScoreReport("6","仓库设置"),
                new ScoreReport("7","库位设置"),
                new ScoreReport("8","存货档案"),
                new ScoreReport("9","设备清单"),
                new ScoreReport("10","设备点检项目"),
VueWebCoreApi/Tools/ImportExcel.cs
@@ -1273,5 +1273,52 @@
            return table.Rows.Count;
        }
        #endregion
        #region
        public static List<ExcelErro> InportExcelToTableListErro(List<DataTable> excelTable)
        {
            List<ExcelErro> list = new List<ExcelErro>();
            for (int i = 0; i < excelTable.Count; i++)
            {
                var emptyColumn = excelTable[i].Columns.Cast<DataColumn>().FirstOrDefault(
                    column => column.ColumnName.Contains("*") && excelTable[i].AsEnumerable().Any(row => row.IsNull(column))
                    );
                if (emptyColumn != null)
                {
                    int columnIndex = excelTable[i].Columns.IndexOf(emptyColumn);
                    int rowIndex = excelTable[i].AsEnumerable().ToList().FindIndex(row => row.IsNull(emptyColumn));
                    ExcelErro erro = new ExcelErro();
                    erro.RoeNumber = (rowIndex + 1).ToString();
                    erro.ErrorField = emptyColumn.ColumnName;
                    erro.ErrorCont = "模板表头带*的列中存在空值,第" + (rowIndex + 1).ToString() + "行,必填字段:"+ emptyColumn.ColumnName +"为空";
                    list.Add(erro);
                }
                var duplicateColumn = excelTable[i].Columns.Cast<DataColumn>().FirstOrDefault(
                    column => column.ColumnName.Contains("唯一") && excelTable[i].AsEnumerable().GroupBy(row => row[column]).Any(group => group.Count() > 1));
                if (duplicateColumn != null)
                {
                    int columnIndex = excelTable[i].Columns.IndexOf(duplicateColumn);
                    var duplicateRows = excelTable[i].AsEnumerable()
                        .Where(row => row[duplicateColumn] != DBNull.Value)
                        .GroupBy(row => row[duplicateColumn])
                        .Where(group => group.Count() > 1)
                        .SelectMany(group => group.ToList())
                        .ToList();
                    foreach (var row in duplicateRows)
                    {
                        ExcelErro erro = new ExcelErro();
                        erro.RoeNumber = excelTable[i].Rows.IndexOf(row).ToString();
                        erro.ErrorField = emptyColumn.ColumnName;
                        erro.ErrorCont = "模板表头带(唯一)的列中存在重复值,第" + excelTable[i].Rows.IndexOf(row).ToString() + "行,必填字段:" + duplicateColumn.ColumnName + "重复";
                        list.Add(erro);
                    }
                }
            }
            return list;
        }
        #endregion
    }
}
VueWebCoreApi/Tools/ImportExcelData.cs
@@ -13,132 +13,20 @@
        public static ToMessage mes = new ToMessage(); //定义全局返回信息对象
        #region【Excel模板上传验证】
        #region【Excel模板上传验证,用户清单模板】
        public static string Two(string FileCode, out string code)
        #region【Excel模板上传验证,组织架构模板】
        public static string Zerro(string FileCode, out string code)
        {
            string Message = "";
            code = "";
            List<DataTable> excelTable = new List<DataTable>();
            excelTable = ImportExcel.ExcelToTableList(FileCode);
            if (excelTable.Count != 4)
            {
                code = "300";
                Message = "导入模板不符合规范,请检查sheet数";
                return Message;
            }
            else if (excelTable[0].Columns.Count != 5)
            {
                code = "300";
                Message = "用户班组模板不符合规范,请检查列名字段数";
                return Message;
            }
            else if (excelTable[1].Columns.Count != 10)
            {
                code = "300";
                Message = "用户清单模板不符合规范,请检查列名字段数";
                return Message;
            }
            else if (excelTable[0].Columns[0].ColumnName != "序号")
            {
                code = "300";
                Message = "用户班组模板:表头信息不符合规范,第1列应为{序号}";
                return Message;
            }
            else if (excelTable[0].Columns[1].ColumnName != "组织编码")
            {
                code = "300";
                Message = "用户班组模板:表头信息不符合规范,第2列应为{组织编码}";
                return Message;
            }
            else if (excelTable[0].Columns[2].ColumnName != "班组编号(唯一)")
            {
                code = "300";
                Message = "用户班组模板:表头信息不符合规范,第2列应为{班组编号(唯一)}";
                return Message;
            }
            else if (excelTable[0].Columns[3].ColumnName != "班组名称")
            {
                code = "300";
                Message = "用户班组模板:表头信息不符合规范,第3列应为{班组名称}";
                return Message;
            }
            else if (excelTable[0].Columns[4].ColumnName != "班组描述")
            {
                code = "300";
                Message = "用户班组模板:表头信息不符合规范,第4列应为{班组描述}";
                return Message;
            }
            else if (excelTable[1].Columns[0].ColumnName != "序号")
            {
                code = "300";
                Message = "用户清单模板:表头信息不符合规范,第1列应为{序号}";
                return Message;
            }
            else if (excelTable[1].Columns[1].ColumnName != "用户编号(唯一)")
            {
                code = "300";
                Message = "用户清单模板:表头信息不符合规范,第2列应为{用户编号(唯一)}";
                return Message;
            }
            else if (excelTable[1].Columns[2].ColumnName != "用户姓名")
            {
                code = "300";
                Message = "用户清单模板:表头信息不符合规范,第3列应为{用户姓名}";
                return Message;
            }
            else if (excelTable[1].Columns[3].ColumnName != "在职状态")
            {
                code = "300";
                Message = "用户清单模板:表头信息不符合规范,第4列应为{在职状态}";
                return Message;
            }
            else if (excelTable[1].Columns[4].ColumnName != "密码")
            {
                code = "300";
                Message = "用户清单模板:表头信息不符合规范,第5列应为{密码}";
                return Message;
            }
            else if (excelTable[1].Columns[5].ColumnName != "手机号")
            {
                code = "300";
                Message = "用户清单模板:表头信息不符合规范,第6列应为{手机号}";
                return Message;
            }
            else if (excelTable[1].Columns[6].ColumnName != "邮箱")
            {
                code = "300";
                Message = "用户清单模板:表头信息不符合规范,第7列应为{邮箱}";
                return Message;
            }
            else if (excelTable[1].Columns[7].ColumnName != "组织编码")
            {
                code = "300";
                Message = "用户清单模板:表头信息不符合规范,第8列应为{组织编码}";
                return Message;
            }
            else if (excelTable[1].Columns[8].ColumnName != "工资类型")
            {
                code = "300";
                Message = "用户清单模板:表头信息不符合规范,第9列应为{工资类型}";
                return Message;
            }
            else if (excelTable[1].Columns[9].ColumnName != "用户组编码")
            {
                code = "300";
                Message = "用户清单模板:表头信息不符合规范,第10列应为{用户组编码}";
                return Message;
            }
            else
            {
                code = "200";
                Message = "模板检验通过";
            }
            return Message;
        }
        #endregion
        #region【Excel模板上传验证,角色权限模板】
        #region【Excel模板上传验证,岗位管理模板】
        public static string One(string FileCode, out string code)
        {
            string Message = "";
@@ -233,62 +121,93 @@
        }
        #endregion
        #region【Excel模板上传验证,工位清单模板】
        public static string Three(string FileCode, out string code)
        #region【Excel模板上传验证,班组管理模板】
        public static string Two(string FileCode, out string code)
        {
            string Message = "";
            code = "";
            DataTable excelTable = new DataTable();
            excelTable = ImportExcel.ExcelToTable(FileCode);
            if (excelTable.Columns.Count != 9)
            return Message;
        }
        #endregion
        #region【Excel模板上传验证,人员管理模板】
        public static string Three(List<DataTable> excelTable, out string code)
        {
            string Message = "";
            code = "";
            if (excelTable.Count != 1)
            {
                code = "300";
                Message = "模板不符合规范,请检查列名";
                code = "301";
                Message = "导入模板不符合规范,请检查sheet数";
                return Message;
            }
            else if (excelTable.Columns[0].ColumnName != "序号")
            else if (excelTable[0].Columns.Count != 10)
            {
                code = "300";
                Message = "模板不符合规范,请检查列名";
                code = "301";
                Message = "用户清单模板不符合规范,请检查列名字段数";
                return Message;
            }
            else if (excelTable.Columns[1].ColumnName != "工位编号(唯一)")
            else if (excelTable[0].Columns[0].ColumnName != "*用户编号(唯一)")
            {
                code = "300";
                Message = "模板不符合规范,请检查列名";
                code = "301";
                Message = "用户清单模板:表头信息不符合规范,第1列应为{*用户编号(唯一)}";
                return Message;
            }
            else if (excelTable.Columns[2].ColumnName != "工位名称(唯一)")
            else if (excelTable[0].Columns[1].ColumnName != "*用户姓名")
            {
                code = "300";
                Message = "模板不符合规范,请检查列名";
                code = "301";
                Message = "用户清单模板:表头信息不符合规范,第2列应为{*用户姓名}";
                return Message;
            }
            else if (excelTable.Columns[3].ColumnName != "工位类型")
            else if (excelTable[0].Columns[2].ColumnName != "*密码")
            {
                code = "300";
                Message = "模板不符合规范,请检查列名";
                code = "301";
                Message = "用户清单模板:表头信息不符合规范,第3列应为{*密码}";
                return Message;
            }
            else if (excelTable.Columns[4].ColumnName != "所属车间")
            else if (excelTable[0].Columns[3].ColumnName != "*在职状态")
            {
                code = "300";
                Message = "模板不符合规范,请检查列名";
                code = "301";
                Message = "用户清单模板:表头信息不符合规范,第4列应为{*在职状态}";
                return Message;
            }
            else if (excelTable.Columns[5].ColumnName != "所属产线")
            else if (excelTable[0].Columns[4].ColumnName != "手机号")
            {
                code = "300";
                Message = "模板不符合规范,请检查列名";
                code = "301";
                Message = "用户清单模板:表头信息不符合规范,第5列应为{手机号}";
                return Message;
            }
            else if (excelTable.Columns[6].ColumnName != "使用状态")
            else if (excelTable[0].Columns[5].ColumnName != "邮箱")
            {
                code = "300";
                Message = "模板不符合规范,请检查列名";
                code = "301";
                Message = "用户清单模板:表头信息不符合规范,第6列应为{邮箱}";
                return Message;
            }
            else if (excelTable.Columns[7].ColumnName != "数采标识1")
            else if (excelTable[0].Columns[6].ColumnName != "*所属组织编码")
            {
                code = "300";
                Message = "模板不符合规范,请检查列名";
                code = "301";
                Message = "用户清单模板:表头信息不符合规范,第7列应为{*所属组织编码}";
                return Message;
            }
            else if (excelTable.Columns[8].ColumnName != "数采标识2")
            else if (excelTable[0].Columns[7].ColumnName != "所属岗位编码")
            {
                code = "300";
                Message = "模板不符合规范,请检查列名";
                code = "301";
                Message = "用户清单模板:表头信息不符合规范,第8列应为{所属岗位编码}";
                return Message;
            }
            else if (excelTable[0].Columns[8].ColumnName != "所属角色编码")
            {
                code = "301";
                Message = "用户清单模板:表头信息不符合规范,第9列应为{所属角色编码}";
                return Message;
            }
            else if (excelTable[0].Columns[9].ColumnName != "所属班组编码")
            {
                code = "301";
                Message = "用户清单模板:表头信息不符合规范,第10列应为{所属班组编码}";
                return Message;
            }
            else
            {
@@ -299,7 +218,7 @@
        }
        #endregion
        #region【Excel模板上传验证,往来单位清单模板】
        #region【Excel模板上传验证,角色管单模板】
        public static string Four(string FileCode, out string code)
        {
            string Message = "";
@@ -370,8 +289,18 @@
        }
        #endregion
        #region【Excel模板上传验证,仓库、库位定义模板】
        public static string SixOne(string FileCode, out string code)
        #region【Excel模板上传验证,往来单位模板】
        public static string Five(string FileCode, out string code)
        {
            string Message = "";
            code = "";
            return Message;
        }
        #endregion
        #region【Excel模板上传验证,仓库设置模板】
        public static string Six(string FileCode, out string code)
        {
            string Message = "";
            code = "";
@@ -459,7 +388,7 @@
        }
        #endregion
        #region【Excel模板上传验证,容器定义模板】
        #region【Excel模板上传验证,库位设置模板】
        public static string Seven(string FileCode, out string code)
        {
            string Message = "";
@@ -1854,8 +1783,8 @@
        #endregion
        #region【Excel上传数据验证】
        #region【Excel上传数据验证,用户角色】
        public static List<ExcelErro> TwoData(string FileCode, out string StuCode, out string message, out int count)
        #region【Excel上传数据验证,组织架构】
        public static List<ExcelErro> ZerroData(string savePath, out string StuCode, out string message, out int count)
        {
            message = "";
            StuCode = "";
@@ -1864,108 +1793,7 @@
            var dynamicParams = new DynamicParameters();
            DataTable dt;
            List<ExcelErro> list = new List<ExcelErro>();
            List<DataTable> excelTable = new List<DataTable>();
            list = ImportExcel.ExcelToTableListErro(FileCode);    //验证Excel数据必填字段是否为空、唯一字段是否重复
            excelTable = ImportExcel.ExcelToTableList(FileCode);  //获取Excel数据
            //主表
            for (int j = 0; j < excelTable[0].Rows.Count; j++)
            {
                if (excelTable[0].Rows[j][2].ToString().Trim() != null && excelTable[0].Rows[j][2].ToString().Trim() != "")
                {
                    sql = @"select *  from TGroup where group_code=@group_code";
                    dynamicParams.Add("@group_code", excelTable[0].Rows[j][2].ToString().Trim());
                    dt = DapperHelper.selectdata(sql, dynamicParams);
                    if (dt.Rows.Count > 0)
                    {
                        ExcelErro erro = new ExcelErro();
                        erro.RoeNumber = "/";
                        erro.ErrorField = "{班组编码(唯一)}";
                        erro.ErrorCont = "班组表:{班组编码(唯一)}字段" + excelTable[0].Rows[j][2].ToString().Trim() + "已存在";
                        list.Add(erro);
                    }
                }
            }
            //子表
            for (int k = 0; k < excelTable[1].Rows.Count; k++)
            {
                if (excelTable[1].Rows[k][1].ToString().Trim() != null && excelTable[1].Rows[k][1].ToString().Trim() != "")
                {
                    sql = @"select *  from TUser where usercode=@usercode";
                    dynamicParams.Add("@usercode", excelTable[1].Rows[k][1].ToString().Trim());
                    dt = DapperHelper.selectdata(sql, dynamicParams);
                    if (dt.Rows.Count > 0)
                    {
                        ExcelErro erro = new ExcelErro();
                        erro.RoeNumber = "/";
                        erro.ErrorField = "{用户编码(唯一)}";
                        erro.ErrorCont = "用户表:{用户编码(唯一)}字段" + excelTable[1].Rows[k][1].ToString().Trim() + "已存在";
                        list.Add(erro);
                    }
                }
                if (excelTable[1].Rows[k][7].ToString().Trim() != null && excelTable[1].Rows[k][7].ToString().Trim() != "")
                {
                    sql = @"select *  from TOrganization where org_code=@org_code";
                    dynamicParams.Add("@org_code", excelTable[1].Rows[k][7].ToString().Trim());
                    dt = DapperHelper.selectdata(sql, dynamicParams);
                    if (dt == null || dt.Rows.Count <= 0)
                    {
                        ExcelErro erro = new ExcelErro();
                        erro.RoeNumber = "/";
                        erro.ErrorField = "{组织编码}";
                        erro.ErrorCont = "用户表:{组织编码}字段" + excelTable[1].Rows[k][7].ToString().Trim() + "不存在";
                        list.Add(erro);
                    }
                }
                if (excelTable[1].Rows[k][9].ToString().Trim() != null && excelTable[1].Rows[k][9].ToString().Trim() != "")
                {
                    sql = @"select torg_code  from TGroup where group_code=@group_code";
                    dynamicParams.Add("@group_code", excelTable[1].Rows[k][9].ToString().Trim());
                    dt = DapperHelper.selectdata(sql, dynamicParams);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        if (dt.Rows[0]["torg_code"].ToString() != excelTable[1].Rows[k][7].ToString().Trim())
                        {
                            ExcelErro erro = new ExcelErro();
                            erro.RoeNumber = "/";
                            erro.ErrorField = "{用户组编码}";
                            erro.ErrorCont = "用户表:{用户组编码}字段" + excelTable[1].Rows[k][9].ToString().Trim() + " ä¸æ˜¯ç»„织编码:" + excelTable[1].Rows[k][7].ToString().Trim() + "下的用户组";
                            list.Add(erro);
                        }
                    }
                }
            }
            //判断子表组织编码不存在于主表组织编码中的数据
            var dt2 = from r in excelTable[1].AsEnumerable()
                      where !(
                          from rr in excelTable[0].AsEnumerable()
                          select rr.Field<string>("组织编码")
                      ).Contains(r.Field<string>("组织编码"))
                      select r;
            List<DataRow> listRow2 = dt2.ToList();
            if (listRow2.Count > 0)
            {
                ExcelErro erro = new ExcelErro();
                erro.RoeNumber = "/";
                erro.ErrorField = "{组织编码}";
                erro.ErrorCont = "用户表:{组织编码}字段中有值在班组表:{组织编码}中不存在";
                list.Add(erro);
            }
            //判断子表外键不存在于主表主键中的数据
            var dt3 = from r in excelTable[1].AsEnumerable()
                      where !(
                          from rr in excelTable[0].AsEnumerable()
                          select rr.Field<string>("班组编号(唯一)")
                      ).Contains(r.Field<string>("用户组编码"))
                      select r;
            List<DataRow> listRow = dt3.ToList();
            if (listRow.Count > 0)
            {
                ExcelErro erro = new ExcelErro();
                erro.RoeNumber = "/";
                erro.ErrorField = "{用户组编码}";
                erro.ErrorCont = "用户表:{用户组编码}字段中有值在班组表:{班组编号(唯一)}中不存在";
                list.Add(erro);
            }
            if (list.Count > 0)
            {
                int index = 0;
@@ -1981,13 +1809,12 @@
            {
                StuCode = "200";
                message = "数据验证成功";
                count = excelTable[0].Rows.Count + excelTable[1].Rows.Count;
            }
            return list;
        }
        #endregion
        #region【Excel上传数据验证,角色权限】
        #region【Excel上传数据验证,岗位管理】
        public static List<ExcelErro> OneData(string FileCode, out string StuCode, out string message, out int count)
        {
            message = "";
@@ -2128,14 +1955,14 @@
            {
                StuCode = "200";
                message = "数据验证成功";
                count = excelTable[0].Rows.Count + excelTable[1].Rows.Count;
                count = excelTable[0].Rows.Count;
            }
            return list;
        }
        #endregion
        #region【Excel上传数据验证,工位清单】
        public static List<ExcelErro> ThreeData(string FileCode, out string StuCode, out string message, out int count)
        #region【Excel上传数据验证,班组管理】
        public static List<ExcelErro> TwoData(string FileCode, out string StuCode, out string message, out int count)
        {
            message = "";
            StuCode = "";
@@ -2148,7 +1975,169 @@
        }
        #endregion
        #region【Excel上传数据验证,往来单位清单】
        #region【Excel上传数据验证,人员管理】
        public static List<ExcelErro> ThreeData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
        {
            message = "";
            StuCode = "";
            count = 0;
            string sql = "";
            var dynamicParams = new DynamicParameters();
            DataTable dt;
            List<ExcelErro> list = new List<ExcelErro>();
            list = ImportExcel.InportExcelToTableListErro(excelTable);    //验证Excel数据必填字段是否为空、唯一字段是否重复
            //用户表
            for (int k = 0; k < excelTable[0].Rows.Count; k++)
            {
                if (excelTable[0].Rows[k][0].ToString().Trim() != null && excelTable[0].Rows[k][0].ToString().Trim() != "")
                {
                    sql = @"select *  from TUser where usercode=@usercode";
                    dynamicParams.Add("@usercode", excelTable[0].Rows[k][0].ToString().Trim());
                    dt = DapperHelper.selectdata(sql, dynamicParams);
                    if (dt.Rows.Count > 0)
                    {
                        ExcelErro erro = new ExcelErro();
                        erro.RoeNumber = (k + 1).ToString();
                        erro.ErrorField = "*用户编码(唯一)";
                        erro.ErrorCont = "用户表:*用户编码(唯一)字段" + excelTable[0].Rows[k][0].ToString().Trim() + "已存在";
                        list.Add(erro);
                    }
                }
                if (excelTable[0].Rows[k][1].ToString().Trim() != null && excelTable[0].Rows[k][1].ToString().Trim() != "")
                {
                    sql = @"select *  from TUser where username=@username";
                    dynamicParams.Add("@username", excelTable[0].Rows[k][1].ToString().Trim());
                    dt = DapperHelper.selectdata(sql, dynamicParams);
                    if (dt.Rows.Count > 0)
                    {
                        ExcelErro erro = new ExcelErro();
                        erro.RoeNumber = (k + 1).ToString();
                        erro.ErrorField = "*用户名称";
                        erro.ErrorCont = "用户表:*用户名称字段" + excelTable[0].Rows[k][1].ToString().Trim() + "已存在";
                        list.Add(erro);
                    }
                }
                if (excelTable[0].Rows[k][6].ToString().Trim() != null && excelTable[0].Rows[k][6].ToString().Trim() != "")
                {
                    sql = @"select *  from TOrganization where torg_code=@torg_code";
                    dynamicParams.Add("@torg_code", excelTable[0].Rows[k][6].ToString().Trim());
                    dt = DapperHelper.selectdata(sql, dynamicParams);
                    if (dt == null || dt.Rows.Count <= 0)
                    {
                        ExcelErro erro = new ExcelErro();
                        erro.RoeNumber = (k + 1).ToString();
                        erro.ErrorField = "*组织编码";
                        erro.ErrorCont = "用户表:*组织编码字段" + excelTable[0].Rows[k][6].ToString().Trim() + "不存在";
                        list.Add(erro);
                    }
                }
                if (excelTable[0].Rows[k][7].ToString().Trim() != null && excelTable[0].Rows[k][7].ToString().Trim() != "")
                {
                    string[] postcode = Array.ConvertAll<string, string>(excelTable[0].Rows[k][7].ToString().Trim().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string分割转string[]
                    sql = @"select postcode  from TPost  where postcode in @postcode";
                    dynamicParams.Add("@postcode", postcode);
                    dt = DapperHelper.selectdata(sql, dynamicParams);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        string[] values = excelTable[0].Rows[k][7].ToString().Trim().Split(',');
                        var unmatchedValues = values.Except(dt.AsEnumerable().Select(row => row.Field<string>("postcode")));
                        foreach (var value in unmatchedValues)
                        {
                            ExcelErro erro = new ExcelErro();
                            erro.RoeNumber = (k + 1).ToString();
                            erro.ErrorField = "{所属岗位编码}";
                            erro.ErrorCont = "用户表:{所属岗位编码}字段" + value + " ä¸æ˜¯æœ‰æ•ˆçš„岗位编码";
                            list.Add(erro);
                        }
                    }
                    else
                    {
                        ExcelErro erro = new ExcelErro();
                        erro.RoeNumber = (k + 1).ToString();
                        erro.ErrorField = "{所属岗位编码}";
                        erro.ErrorCont = "用户表:{所属岗位编码}字段" + excelTable[0].Rows[k][7].ToString().Trim() + " ä¸æ˜¯æœ‰æ•ˆçš„岗位编码";
                        list.Add(erro);
                    }
                }
                if (excelTable[0].Rows[k][8].ToString().Trim() != null && excelTable[0].Rows[k][8].ToString().Trim() != "")
                {
                    string[] rolecode = Array.ConvertAll<string, string>(excelTable[0].Rows[k][8].ToString().Trim().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string分割转string[]
                    sql = @"select rolecode  from TRole  where rolecode in @rolecode";
                    dynamicParams.Add("@rolecode", rolecode);
                    dt = DapperHelper.selectdata(sql, dynamicParams);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        string[] values = excelTable[0].Rows[k][8].ToString().Trim().Split(',');
                        var unmatchedValues = values.Except(dt.AsEnumerable().Select(row => row.Field<string>("rolecode")));
                        foreach (var value in unmatchedValues)
                        {
                            ExcelErro erro = new ExcelErro();
                            erro.RoeNumber = (k + 1).ToString();
                            erro.ErrorField = "{所属角色编码}";
                            erro.ErrorCont = "用户表:{所属角色编码}字段" + value + " ä¸æ˜¯æœ‰æ•ˆçš„角色编码";
                            list.Add(erro);
                        }
                    }
                    else
                    {
                        ExcelErro erro = new ExcelErro();
                        erro.RoeNumber = (k + 1).ToString();
                        erro.ErrorField = "{所属角色编码}";
                        erro.ErrorCont = "用户表:{所属角色编码}字段" + excelTable[0].Rows[k][8].ToString().Trim() + " ä¸æ˜¯æœ‰æ•ˆçš„角色编码";
                        list.Add(erro);
                    }
                }
                if (excelTable[0].Rows[k][9].ToString().Trim() != null && excelTable[0].Rows[k][9].ToString().Trim() != "")
                {
                    string[] usergroupcode = Array.ConvertAll<string, string>(excelTable[0].Rows[k][9].ToString().Trim().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string分割转string[]
                    sql = @"select usergroupcode  from TGroup  where usergroupcode in @usergroupcode";
                    dynamicParams.Add("@usergroupcode", usergroupcode);
                    dt = DapperHelper.selectdata(sql, dynamicParams);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        string[] values = excelTable[0].Rows[k][9].ToString().Trim().Split(',');
                        var unmatchedValues = values.Except(dt.AsEnumerable().Select(row => row.Field<string>("usergroupcode")));
                        foreach (var value in unmatchedValues)
                        {
                            ExcelErro erro = new ExcelErro();
                            erro.RoeNumber = (k + 1).ToString();
                            erro.ErrorField = "{所属班组编码}";
                            erro.ErrorCont = "用户表:{所属班组编码}字段" + value + " ä¸æ˜¯æœ‰æ•ˆçš„班组编码";
                            list.Add(erro);
                        }
                    }
                    else
                    {
                        ExcelErro erro = new ExcelErro();
                        erro.RoeNumber = (k + 1).ToString();
                        erro.ErrorField = "{所属班组编码}";
                        erro.ErrorCont = "用户表:{所属班组编码}字段" + excelTable[0].Rows[k][9].ToString().Trim() + " ä¸æ˜¯æœ‰æ•ˆçš„班组编码";
                        list.Add(erro);
                    }
                }
            }
            if (list.Count > 0)
            {
                int index = 0;
                foreach (ExcelErro item in list)
                {
                    index++;
                    item.Seq = index.ToString();
                }
                StuCode = "301";
                message = "数据验证失败";
            }
            else
            {
                StuCode = "200";
                message = "数据验证成功";
                count = excelTable[0].Rows.Count;
            }
            return list;
        }
        #endregion
        #region【Excel上传数据验证,角色管理】
        public static List<ExcelErro> FourData(string FileCode, out string StuCode, out string message, out int count)
        {
            message = "";
@@ -2200,8 +2189,60 @@
        }
        #endregion
        #region【Excel上传数据验证,仓库、库位定义】
        public static List<ExcelErro> SixOneData(string FileCode, out string StuCode, out string message, out int count)
        #region【Excel上传数据验证,往来单位】
        public static List<ExcelErro> FiveData(string FileCode, out string StuCode, out string message, out int count)
        {
            message = "";
            StuCode = "";
            count = 0;
            string sql = "";
            DataTable dt;
            var dynamicParams = new DynamicParameters();
            List<ExcelErro> list = new List<ExcelErro>();
            DataTable excelTable = new DataTable();
            list = ImportExcel.ExcelToTableErro(FileCode);    //验证Excel数据必填字段是否为空、唯一字段是否重复
            excelTable = ImportExcel.ExcelToTable(FileCode);  //获取Excel数据
            for (int i = 0; i < excelTable.Rows.Count; i++)
            {
                if (excelTable.Rows[i][1].ToString().Trim() != null && excelTable.Rows[i][1].ToString().Trim() != "")
                {
                    sql = @"select code  from TCustomer where code=@code";
                    dynamicParams.Add("@code", excelTable.Rows[i][1].ToString().Trim());
                    dt = DapperHelper.selectdata(sql, dynamicParams);
                    if (dt.Rows.Count > 0)
                    {
                        ExcelErro erro = new ExcelErro();
                        erro.RoeNumber = "/";
                        erro.ErrorField = "{往来单位编码(唯一)}";
                        erro.ErrorCont = "往来单位表:{往来单位编码(唯一)}字段" + excelTable.Rows[i][1].ToString().Trim() + "已存在";
                        list.Add(erro);
                    }
                }
            }
            if (list.Count > 0)
            {
                int index = 0;
                foreach (ExcelErro item in list)
                {
                    index++;
                    item.Seq = index.ToString();
                }
                StuCode = "301";
                message = "数据验证失败";
            }
            else
            {
                StuCode = "200";
                message = "数据验证成功";
                count = excelTable.Rows.Count;
            }
            return list;
        }
        #endregion
        #region【Excel上传数据验证,仓库设置】
        public static List<ExcelErro> SixData(string FileCode, out string StuCode, out string message, out int count)
        {
            message = "";
            StuCode = "";
@@ -2286,7 +2327,7 @@
        }
        #endregion
        #region【Excel上传数据验证,容器定义】
        #region【Excel上传数据验证,库位设置】
        public static List<ExcelErro> SevenData(string FileCode, out string StuCode, out string message, out int count)
        {
            message = "";
@@ -3221,8 +3262,8 @@
        #endregion
        #region[Excel上传数据提交]
        #region【Excel数据上传,用户角色】
        public static string TwoSubmit(string FileCode, string User, out string StuCode)
        #region【Excel数据上传,组织架构】
        public static string ZerroSubmit(string FileCode, string User, out string StuCode)
        {
            string message = "";
            StuCode = "";
@@ -3236,83 +3277,39 @@
                list.Clear();
                List<DataTable> excelTable = new List<DataTable>();
                excelTable = ImportExcel.ExcelToTableList(FileCode);
                //导入班组
                //导入角色类型
                for (int k = 0; k < excelTable[0].Rows.Count; k++)
                {
                    sql = @"select *   from TGroup where group_code=@group_code";
                    dynamicParams.Add("@group_code", excelTable[0].Rows[k][2].ToString().Trim());
                    dt = DapperHelper.selectdata(sql, dynamicParams);
                    if (dt.Rows.Count > 0)
                    {
                        continue;
                    }
                    else
                    {
                        sql = @"insert into TGroup(group_code,group_name,description,lm_user,lm_date,torg_code)
                            values(@group_code,@group_name,@description,@Operator,@CreateDate,@torg_code)";
                        list.Add(new
                        {
                            str = sql,
                            parm = new
                            {
                                group_code = excelTable[0].Rows[k][2].ToString().Trim(),
                                group_name = excelTable[0].Rows[k][3].ToString().Trim(),
                                description = excelTable[0].Rows[k][4].ToString().Trim(),
                                CreateDate = DateTime.Now.ToString(),
                                Operator = User,
                                torg_code = excelTable[0].Rows[k][1].ToString().Trim()
                            }
                        });
                    }
                }
                //导入用户
                for (int i = 0; i < excelTable[1].Rows.Count; i++)
                {
                    if (excelTable[1].Rows[i][3].ToString().Trim() == "在职")
                    {
                        Enable = "Y";
                    }
                    else
                    {
                        Enable = "N";
                    }
                    //工资类型
                    switch (excelTable[1].Rows[i][8].ToString().Trim())
                    {
                        case "计件制":
                            WageType = "2";
                            break;
                        case "计时制":
                            WageType = "1";
                            break;
                        default:
                            break;
                    }
                    sql = @"select *   from TUser where usercode=@usercode";
                    dynamicParams.Add("@usercode", excelTable[1].Rows[i][1].ToString().Trim());
                    dt = DapperHelper.selectdata(sql, dynamicParams);
                    if (dt.Rows.Count > 0)
                    {
                        continue;
                    }
                    sql = @"insert into TUser(usercode,username,password,enable,mobile,lm_date,email,lm_user,stu_torgcode,wagetype,usergroup_code)
                            values(@UserCode,@UserName,@password,@Enable,@Mobile,@CreateDate,@Email,@Operator,@StuOrg,@wagetype,@usergroup_code)";
                    sql = @"insert into TRoleType(roletype_code,roletype_name,torg_code)
                            values(@roletype_code,@roletype_name,@torg_code)";
                    list.Add(new
                    {
                        str = sql,
                        parm = new
                        {
                            UserCode = excelTable[1].Rows[i][1].ToString().Trim(),
                            UserName = excelTable[1].Rows[i][2].ToString().Trim(),
                            password = excelTable[1].Rows[i][4].ToString().Trim(),
                            Enable = Enable,
                            Mobile = excelTable[1].Rows[i][5].ToString().Trim(),
                            CreateDate = DateTime.Now.ToString(),
                            Email = excelTable[1].Rows[i][6].ToString().Trim(),
                            roletype_code = excelTable[0].Rows[k][2].ToString().Trim(),
                            roletype_name = excelTable[0].Rows[k][3].ToString().Trim(),
                            torg_code = excelTable[0].Rows[k][1].ToString().Trim()
                        }
                    });
                }
                //导入角色
                for (int i = 0; i < excelTable[1].Rows.Count; i++)
                {
                    sql = @"insert into TRole(role_code,role_name,roletype_code,description,lm_user,lm_date,torg_code)
                            values(@role_code,@role_name,@roletype_code,@description,@Operator,@CreateDate,@torg_code)";
                    list.Add(new
                    {
                        str = sql,
                        parm = new
                        {
                            role_code = excelTable[1].Rows[i][2].ToString().Trim(),
                            role_name = excelTable[1].Rows[i][3].ToString().Trim(),
                            roletype_code = excelTable[1].Rows[i][4].ToString().Trim(),
                            description = excelTable[1].Rows[i][5].ToString().Trim(),
                            Operator = User,
                            StuOrg = excelTable[1].Rows[i][7].ToString().Trim(),
                            wagetype = WageType,
                            usergroup_code = excelTable[1].Rows[i][9].ToString().Trim()
                            CreateDate = DateTime.Now.ToString(),
                            torg_code = excelTable[1].Rows[i][1].ToString().Trim()
                        }
                    });
                }
@@ -3337,7 +3334,7 @@
        }
        #endregion
        #region【Excel数据上传,角色权限】
        #region【Excel数据上传,岗位管理】
        public static string OneSubmit(string FileCode, string User, out string StuCode)
        {
            string message = "";
@@ -3409,8 +3406,8 @@
        }
        #endregion
        #region【Excel数据上传,工位清单】
        public static string ThreeSubmit(string FileCode, string User, out string StuCode)
        #region【Excel数据上传,分组管理】
        public static string  TwoSubmit(string FileCode, string User, out string StuCode)
        {
            string message = "";
            StuCode = "";
@@ -3427,7 +3424,73 @@
        }
        #endregion
        #region【Excel数据上传,往来单位清单】
        #region【Excel数据上传,人员管理】
        public static string ThreeSubmit(List<DataTable> excelTable, User us, out string StuCode)
        {
            string message = "";
            StuCode = "";
            string sql = "";
            DataTable dt;
            List<object> list = new List<object>();
            var dynamicParams = new DynamicParameters();
            try
            {
                list.Clear();
                //导入用户
                for (int i = 0; i < excelTable[0].Rows.Count; i++)
                {
                    //sql = @"select *   from TUser where usercode=@usercode";
                    //dynamicParams.Add("@usercode", excelTable[1].Rows[i][1].ToString().Trim());
                    //dt = DapperHelper.selectdata(sql, dynamicParams);
                    //if (dt.Rows.Count > 0)
                    //{
                    //    continue;
                    //}
                    sql = @"insert into TUser(usercode,username,password,status,mobile,email,storg_code,post_code,role_code,group_code,is_system_admin,lm_user,lm_date)
                            values(@usercode,@username,@password,@status,@mobile,@email,@storg_code,@post_code,@role_code,@group_code,@is_system_admin,@lm_user,@lm_date)";
                    list.Add(new
                    {
                        str = sql,
                        parm = new
                        {
                            usercode = excelTable[0].Rows[i][0].ToString().Trim(),
                            username = excelTable[0].Rows[i][1].ToString().Trim(),
                            password = excelTable[0].Rows[i][2].ToString().Trim(),
                            status = excelTable[0].Rows[i][3].ToString().Trim(),
                            mobile = excelTable[0].Rows[i][4].ToString().Trim(),
                            email = excelTable[0].Rows[i][5].ToString().Trim(),
                            storg_code = excelTable[0].Rows[i][6].ToString().Trim(),
                            post_code = excelTable[0].Rows[i][7].ToString().Trim(),
                            role_code = excelTable[0].Rows[i][8].ToString().Trim(),
                            group_code = excelTable[0].Rows[i][9].ToString().Trim(),
                            is_system_admin = "N",
                            lm_user = us.usercode,
                            lm_date = DateTime.Now.ToString()
                        }
                    });
                }
                bool aa = DapperHelper.DoTransaction(list);
                if (aa)
                {
                    StuCode = "200";
                    message = "导入成功!";
                }
                else
                {
                    StuCode = "300";
                    message = "导入失败!";
                }
            }
            catch (Exception e)
            {
                StuCode = "300";
                message = e.Message;
            }
            return message;
        }
        #endregion
        #region【Excel数据上传,角色管理】
        public static string FourSubmit(string FileCode, string User, out string StuCode)
        {
            string message = "";
@@ -3499,8 +3562,80 @@
        }
        #endregion
        #region【Excel数据上传,仓库、库位定义】
        public static string SixOneSubmit(string FileCode, string User, out string StuCode)
        #region【Excel数据上传,往来单位】
        public static string FiveSubmit(string FileCode, string User, out string StuCode)
        {
            string message = "";
            StuCode = "";
            string sql = "";
            DataTable dt;
            List<object> list = new List<object>();
            var dynamicParams = new DynamicParameters();
            try
            {
                list.Clear();
                DataTable excelTable = new DataTable();
                excelTable = ImportExcel.ExcelToTable(FileCode);
                //导入往来单位表
                for (int i = 0; i < excelTable.Rows.Count; i++)
                {
                    string Type = "";
                    switch (excelTable.Rows[i][3].ToString().Trim())
                    {
                        case "供应商":
                            Type = "226";
                            break;
                        case "客户":
                            Type = "211";
                            break;
                        case "客户/供应商":
                            Type = "228";
                            break;
                        default:
                            break;
                    }
                    sql = @"insert into TCustomer(code,name,type,conttacts,conttphone,addr,lm_user,lm_date)
                            values(@code,@name,@type,@conttacts,@conttphone,@addr,@Operator,@CreateDate)";
                    list.Add(new
                    {
                        str = sql,
                        parm = new
                        {
                            code = excelTable.Rows[i][1].ToString().Trim(),
                            name = excelTable.Rows[i][2].ToString().Trim(),
                            type = Type,
                            conttacts = excelTable.Rows[i][4].ToString().Trim(),
                            conttphone = excelTable.Rows[i][5].ToString().Trim(),
                            addr = excelTable.Rows[i][6].ToString().Trim(),
                            Operator = User,
                            CreateDate = DateTime.Now.ToString()
                        }
                    });
                }
                bool aa = DapperHelper.DoTransaction(list);
                if (aa)
                {
                    StuCode = "200";
                    message = "导入成功!";
                }
                else
                {
                    StuCode = "300";
                    message = "导入失败!";
                }
            }
            catch (Exception e)
            {
                StuCode = "300";
                message = e.Message;
            }
            return message;
        }
        #endregion
        #region【Excel数据上传,仓库设置】
        public static string SixSubmit(string FileCode, string User, out string StuCode)
        {
            string message = "";
            StuCode = "";
@@ -3570,7 +3705,7 @@
        }
        #endregion
        #region【Excel数据上传,容器定义】
        #region【Excel数据上传,库位设置】
        public static string SevenSubmit(string FileCode, string User, out string StuCode)
        {
            string message = "";
VueWebCoreApi/VueWebCoreApi.csproj
@@ -47,7 +47,21 @@
    <ItemGroup>
        <Folder Include="InExcel\" />
        <Folder Include="Models\SystemSetting\" />
    </ItemGroup>
    <ItemGroup>
      <None Include="wwwroot\Excel\仓库库位清单.xls" />
      <None Include="wwwroot\Excel\往来单位.xls" />
      <None Include="wwwroot\Excel\物料清单.xls" />
      <None Include="wwwroot\Excel\用户清单.xls" />
      <None Include="wwwroot\Excel\缺陷定义.xls" />
      <None Include="wwwroot\Excel\节拍工价.xls" />
      <None Include="wwwroot\Excel\角色清单.xls" />
      <None Include="wwwroot\Excel\设备保养标准.xls" />
      <None Include="wwwroot\Excel\设备保养项目.xls" />
      <None Include="wwwroot\Excel\设备清单.xls" />
      <None Include="wwwroot\Excel\设备点检标准.xls" />
      <None Include="wwwroot\Excel\设备点检项目.xls" />
    </ItemGroup>
    <ItemGroup>
VueWebCoreApi/wwwroot/Excel/²Ö¿â¿âλÇåµ¥.xls
Binary files differ
VueWebCoreApi/wwwroot/Excel/ÍùÀ´µ¥Î».xls
Binary files differ
VueWebCoreApi/wwwroot/Excel/ÎïÁÏÇåµ¥.xls
Binary files differ
VueWebCoreApi/wwwroot/Excel/Óû§Çåµ¥.xls
Binary files differ
VueWebCoreApi/wwwroot/Excel/ȱÏݶ¨Òå.xls
Binary files differ
VueWebCoreApi/wwwroot/Excel/½ÚÅŤ¼Û.xls
Binary files differ
VueWebCoreApi/wwwroot/Excel/½ÇÉ«Çåµ¥.xls
Binary files differ
VueWebCoreApi/wwwroot/Excel/É豸±£Ñø±ê×¼.xls
Binary files differ
VueWebCoreApi/wwwroot/Excel/É豸±£ÑøÏîÄ¿.xls
Binary files differ
VueWebCoreApi/wwwroot/Excel/É豸Çåµ¥.xls
Binary files differ
VueWebCoreApi/wwwroot/Excel/É豸µã¼ì±ê×¼.xls
Binary files differ
VueWebCoreApi/wwwroot/Excel/É豸µã¼ìÏîÄ¿.xls
Binary files differ