From 1743bf6223c3925fcfcf81a536524f1f52f6a1f6 Mon Sep 17 00:00:00 2001 From: wyw <571921741@qq.com> Date: Mon, 1 Jul 2024 15:58:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=A3=80=E6=9F=A5=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=EF=BC=88=E9=9A=90=E8=97=8F=E6=98=BE=E7=A4=BA=E3=80=81?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E9=9C=B2=E5=A4=A9=E7=9F=BF=EF=BC=89=20?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E5=BA=93=E5=AF=BC=E5=85=A5=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=20=E5=AF=B9=E5=BA=94=E5=AF=BC=E5=85=A5=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E6=A3=80=E6=9F=A5=E8=8C=83=E5=9B=B4?= =?UTF-8?q?=E5=8E=BB=E9=99=A4=20=E6=89=8B=E5=8A=A8=E9=9A=90=E6=82=A3?= =?UTF-8?q?=E4=B8=8A=E6=8A=A5=20=E6=A3=80=E6=9F=A5=E8=8C=83=E5=9B=B4?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=20=E9=9C=B2=E5=A4=A9=E7=9F=BF=20=E8=B7=91?= =?UTF-8?q?=E6=89=B9=20=E9=BB=98=E8=AE=A4=E9=9C=B2=E5=A4=A9=E7=9F=BF=20?= =?UTF-8?q?=EF=BC=88=E9=99=90=E5=88=B6=E6=9C=AA=E5=8E=BB=E9=99=A4=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Api/BSCheckMainController.cs | 156 +++++++----------- .../Controllers/Api/BSRiskSubmitController.cs | 3 +- .../Controllers/Api/BSController.cs | 4 +- 3 files changed, 65 insertions(+), 98 deletions(-) diff --git a/APT.MicroApi/APT.BS.WebApi/Controllers/Api/BSCheckMainController.cs b/APT.MicroApi/APT.BS.WebApi/Controllers/Api/BSCheckMainController.cs index 331ad85..6f5045a 100644 --- a/APT.MicroApi/APT.BS.WebApi/Controllers/Api/BSCheckMainController.cs +++ b/APT.MicroApi/APT.BS.WebApi/Controllers/Api/BSCheckMainController.cs @@ -75,7 +75,7 @@ namespace APT.BS.WebApi.Controllers.Api //获取数据 Dictionary startRowIndexs = new Dictionary(); - startRowIndexs.Add(0, 1);//根据Excel格式数据赋值 + startRowIndexs.Add(0, 3);//根据Excel格式数据赋值 var dataTables = FileUtils.ReadExcelByOledb(filePath, startRowIndexs); string Msg = string.Empty; @@ -135,18 +135,20 @@ namespace APT.BS.WebApi.Controllers.Api /// /// /// - public bool InsertModel(DataTable dtSource, Guid OrgID, ref string Msg, int rowIndex = 2) + public bool InsertModel(DataTable dtSource, Guid OrgID, ref string Msg, int rowIndex = 4) { - //检查对象0 检查区域1 检查类型2 检查项目分类3 检查层级4 责任单位5 检查周期6 检查项目7 检查内容8 检查依据9 检查问题描述10 检查问题等级11 重大隐患类别12 整改建议与措施13 责任人14 + //SMS 检查范围 默认露天矿 + //删除 检查范围、检查周期、检查依据、重大隐患类别 + //检查区域 0 检查类型1 检查项目分类2 检查层级3 责任单位4 检查项目5 检查内容6 检查问题描述7 检查问题等级8 整改建议与措施9 - //只有检查依据可以为空 + //检查对象0 检查区域1 检查类型2 检查项目分类3 检查层级4 责任单位5 检查周期6 检查项目7 检查内容8 检查依据9 检查问题描述10 检查问题等级11 重大隐患类别12 整改建议与措施13 责任人14 if (dtSource == null || dtSource.Rows.Count < 0) { Msg = "未获取到导入数据"; throw new Exception(Msg); } - List listNotEmpty = new List() { 0, 1, 2, 3, 4, 5, 7, 8, 10, 11, 12, 13 }; + List listNotEmpty = new List() { 0, 1, 2, 3, 4, 5, 7, 8, 9 }; //BSMineTypeEnum @@ -154,9 +156,9 @@ namespace APT.BS.WebApi.Controllers.Api Dictionary> dicIndexEmpty = new Dictionary>(); - //检查对象0 - int ICheckObject = 0; - string strCheckObject = string.Empty; + ////检查对象0 + //int ICheckObject = 0; + //string strCheckObject = string.Empty; //检查区域 1 @@ -222,14 +224,14 @@ namespace APT.BS.WebApi.Controllers.Api //检查问题等级11 - List listStrQuestionLevel = new List() { "重大", "A", "B", "C", "D", }; + //List listStrQuestionLevel = new List() { "重大", "A", "B", "C", "D", }; string strQuestionLevel = string.Empty; List listQuestionLevel = new List(); int iQuestionLevel = 0; //责任人14 - BSPLANCHECKOBJECTEnum? RESPONOBJECT = null; - string strResponObject = string.Empty; + //BSPLANCHECKOBJECTEnum? RESPONOBJECT = null; + //string strResponObject = string.Empty; #endregion @@ -252,14 +254,16 @@ namespace APT.BS.WebApi.Controllers.Api //第一行是标题 跳过 int rowAll = dtSource.Rows.Count; - List list = DataHelper.GetEnum("BSMineTypeEnum"); + //List list = DataHelper.GetEnum("BSMineTypeEnum"); + //EnumsResult? enumCheck = null; + List listLevel = DataHelper.GetEnum("BSQuestionLevelEnum"); EnumsResult? enumCheck = null; for (int i = 0; i < rowAll; i++) { #region 不能为空 List listi = null; - for (int j = 0; j < 16; j++) + for (int j = 0; j < 10; j++) { if (!listNotEmpty.Contains(j)) continue; @@ -270,29 +274,19 @@ namespace APT.BS.WebApi.Controllers.Api { listi = new List(); } - listi.Add(j); + listi.Add(j + 1); } } if (listi != null) - dicIndexEmpty.Add(i + rowIndex, listi);//有空的 直接添加 - - #endregion - - #region 检查范围 0 - - strCheckObject = dtSource.Rows[i][0].ToString().Trim(); - ICheckObject = 0; - - enumCheck = list.FirstOrDefault(e => e.NAME == strCheckObject); - if (enumCheck != null) { - ICheckObject = enumCheck.ID; + dicIndexEmpty.Add(i + rowIndex, listi);//有空的 直接添加 + continue; } - #endregion - #region 检查区域 1 - strArea = dtSource.Rows[i][1].ToString().Trim(); + #region 检查区域 0 + + strArea = dtSource.Rows[i][0].ToString().Trim(); modelArea = listModelArea.FirstOrDefault(e => e.NAME == strArea); if (modelArea == null && dicIndexEmpty.Count < 1 && listType.Count < 1 && listProjCate.Count < 1 && listTypeLevel.Count < 1 && listQuestionLevel.Count < 1) { @@ -323,9 +317,9 @@ namespace APT.BS.WebApi.Controllers.Api } #endregion - #region 检查类型 2 + #region 检查类型 1 - strType = dtSource.Rows[i][2].ToString().Trim(); + strType = dtSource.Rows[i][1].ToString().Trim(); modelType = listModelType.FirstOrDefault(e => e.NAME == strType); if (modelType == null) { @@ -361,22 +355,25 @@ namespace APT.BS.WebApi.Controllers.Api } #endregion - #region 项目分类 3 - strProjCate = dtSource.Rows[i][3].ToString().Trim(); + #region 项目分类 2 + + strProjCate = dtSource.Rows[i][2].ToString().Trim(); modelProjCate = listModelProjCate.FirstOrDefault(e => e.NAME == strProjCate); if (modelProjCate == null) { //检查项目分类 - listProjCate.Add(i); + listProjCate.Add(i + rowIndex); if (!listStrProjCate.Contains(strProjCate)) listStrProjCate.Add(strProjCate); + continue; } #endregion - #region 检查层级 4 - strTypeLevel = dtSource.Rows[i][4].ToString().Trim(); + #region 检查层级 3 + + strTypeLevel = dtSource.Rows[i][3].ToString().Trim(); modelTypeLevel = listModelTypeLevel.FirstOrDefault(e => e.Nav_Enums.NAME == strTypeLevel && e.Nav_CheckType.NAME == strType); if (modelTypeLevel == null) { @@ -389,9 +386,10 @@ namespace APT.BS.WebApi.Controllers.Api TypeLevelEnumsTemp = listCheckTypeLevelEnums.FirstOrDefault(e => e.NAME == strTypeLevel); if (TypeLevelEnumsTemp == null) { - listTypeLevel.Add(i); + listTypeLevel.Add(i + rowIndex); if (!listStrTypeLevel.Contains(strType + "-" + strTypeLevel)) listStrTypeLevel.Add(strType + "-" + strTypeLevel); + continue; } else { @@ -442,33 +440,35 @@ namespace APT.BS.WebApi.Controllers.Api #endregion - #region 责任单位 5 + #region 责任单位 4 - strDepName = dtSource.Rows[i][5].ToString().Trim(); + strDepName = dtSource.Rows[i][4].ToString().Trim(); listDepName = strDepName.Split(charSplit, StringSplitOptions.RemoveEmptyEntries).ToList(); ListModelDepartment = listDep.FindAll(e => listDepName.Contains(e.NAME)); if (ListModelDepartment == null || ListModelDepartment.Count == 0) { - listDepartment.Add(i); + listDepartment.Add(i + rowIndex); if (!listStrDepartmentName.Contains(strDepName)) { listStrDepartmentName.Add(strDepName); } + continue; } else if (ListModelDepartment.Count != listDepName.Count) { - listDepartment.Add(i); + listDepartment.Add(i + rowIndex); if (!listStrDepartmentName.Contains(strDepName)) { listStrDepartmentName.Add(strDepName); } + continue; } #endregion - #region 检查项目 7 + #region 检查项目 5 - strProject = dtSource.Rows[i][7].ToString().Trim(); + strProject = dtSource.Rows[i][5].ToString().Trim(); modelProject = listModelProject.FirstOrDefault(e => e.NAME == strProject); if (modelProject == null && dicIndexEmpty.Count < 1 && listType.Count < 1 && listProjCate.Count < 1 && listTypeLevel.Count < 1 && listQuestionLevel.Count < 1) { @@ -496,10 +496,10 @@ namespace APT.BS.WebApi.Controllers.Api #endregion - #region 检查内容 8 + #region 检查内容 6 - strContents = dtSource.Rows[i][8].ToString().Trim(); - modelContents = listModelContents.FirstOrDefault(e => e.CHECKCONTENT == strContents && (BSMineTypeEnum)ICheckObject == e.CHECKOBJECT); + strContents = dtSource.Rows[i][6].ToString().Trim(); + modelContents = listModelContents.FirstOrDefault(e => e.CHECKCONTENT == strContents && BSMineTypeEnum.Mine == e.CHECKOBJECT); if (modelContents == null) { modelContents = new T_BS_CHECK_CONTENTS(); @@ -516,7 +516,7 @@ namespace APT.BS.WebApi.Controllers.Api modelContents.MODIFY_TIME = dtNow; //modelContents.CREATER_ID =; //modelContents.MODIFIER_ID =; - modelContents.CHECKOBJECT = (BSMineTypeEnum)ICheckObject; + modelContents.CHECKOBJECT = BSMineTypeEnum.Mine;// (BSMineTypeEnum)ICheckObject; listModelContents.Add(modelContents); listModelContentsAdd.Add(modelContents); @@ -524,50 +524,27 @@ namespace APT.BS.WebApi.Controllers.Api #endregion + #region 检查问题等级 8 - #region 检查问题等级 11 - - strQuestionLevel = dtSource.Rows[i][11].ToString().Trim(); - if (listStrQuestionLevel.Contains(strQuestionLevel)) - { - iQuestionLevel = 0; - switch (strQuestionLevel) - { - case "重大": - iQuestionLevel = 10; - break; - case "A": - iQuestionLevel = 20; - break; - case "B": - iQuestionLevel = 30; - break; - case "C": - iQuestionLevel = 40; - break; - case "D": - iQuestionLevel = 50; - break; - default: - break; - } - } + strQuestionLevel = dtSource.Rows[i][8].ToString().Trim(); + enumCheck = listLevel.FirstOrDefault(e => e.NAME == strQuestionLevel); + if (enumCheck != null) + iQuestionLevel = enumCheck.ID; else { - //检查问题等级 - listQuestionLevel.Add(i); + listQuestionLevel.Add(i + rowIndex); //检查问题等级 + continue; } - #endregion - #region 检查问题 (添加数据库) + #region 检查问题 7 (添加数据库) - strDescreption = dtSource.Rows[i][10].ToString().Trim(); + strDescreption = dtSource.Rows[i][7].ToString().Trim(); modelQuestion = listCheckQuestion.FirstOrDefault(e => !e.IS_DELETED && e.DESCREPTION == strDescreption);// && e.DEMAND == strDemand 不报错 if (modelQuestion == null && dicIndexEmpty.Count < 1 && listType.Count < 1 && listProjCate.Count < 1 && listTypeLevel.Count < 1 && listQuestionLevel.Count < 1) { - strDemand = dtSource.Rows[i][13].ToString().Trim(); + strDemand = dtSource.Rows[i][9].ToString().Trim(); modelQuestion = new T_BS_CHECK_QUESTION(); modelQuestion.ID = Guid.NewGuid(); @@ -596,27 +573,17 @@ namespace APT.BS.WebApi.Controllers.Api #endregion - - - #region 责任人14 - - strResponObject = dtSource.Rows[i][14].ToString().Trim(); - RESPONOBJECT = GetBSPLANCHECKOBJECTEnum(strResponObject, strTypeLevel.Contains("班") ? true : false); - - #endregion - - #region listMain if (dicIndexEmpty.Count < 1 && listType.Count < 1 && listProjCate.Count < 1 && listTypeLevel.Count < 1 && listQuestionLevel.Count < 1 && listDepartment.Count < 1) { T_BS_CHECK_MAIN modelAdd = new T_BS_CHECK_MAIN(); modelAdd.ID = Guid.NewGuid(); - modelAdd.CHECKOBJECT = ICheckObject; + modelAdd.CHECKOBJECT = (int)BSMineTypeEnum.Mine;// ICheckObject; modelAdd.CHECK_PROJECT_ID = modelProject.ID; modelAdd.CHECK_QUESTION_ID = modelQuestion.ID; - modelAdd.CHECKCONTENT = dtSource.Rows[i][8].ToString().Trim(); - modelAdd.CHECKPROOF = dtSource.Rows[i][9].ToString().Trim(); + modelAdd.CHECKCONTENT = dtSource.Rows[i][6].ToString().Trim();//dtSource.Rows[i][8] + //modelAdd.CHECKPROOF = dtSource.Rows[i][9].ToString().Trim(); modelAdd.QUESTION_LEVEL = iQuestionLevel; modelAdd.SERIOUS_RISK = iQuestionLevel == 10 ? 1 : 0; modelAdd.CHECK_TYPE_ID = modelType.ID; @@ -653,7 +620,7 @@ namespace APT.BS.WebApi.Controllers.Api MAIN_ID = modelAdd.ID, ORG_ID = modelAdd.ORG_ID, DEPARTMENT_ID = item.ID, - RESPONOBJECT = RESPONOBJECT.Value + RESPONOBJECT = BSPLANCHECKOBJECTEnum.Head,// RESPONOBJECT.Value }); } } @@ -713,7 +680,6 @@ namespace APT.BS.WebApi.Controllers.Api // strProjectError = "未找到检查项目" + string.Join(',', listProject); //} - string strQuestionLevelError = string.Empty; if (listQuestionLevel != null && listQuestionLevel.Count > 0) { diff --git a/APT.MicroApi/APT.BS.WebApi/Controllers/Api/BSRiskSubmitController.cs b/APT.MicroApi/APT.BS.WebApi/Controllers/Api/BSRiskSubmitController.cs index b38163d..2e01a22 100644 --- a/APT.MicroApi/APT.BS.WebApi/Controllers/Api/BSRiskSubmitController.cs +++ b/APT.MicroApi/APT.BS.WebApi/Controllers/Api/BSRiskSubmitController.cs @@ -217,7 +217,7 @@ namespace APT.BS.WebApi.Controllers.Api { List filterRules = filter.FilterGroup.Rules.ToList(); var guid = new Guid(filterRules[0].Value.ToString()); - var modelSub = GetEntity(e => e.ID == guid, new string[] { "Nav_CheckType", "Nav_CheckTypeLevel.Nav_Enums", "Nav_Files.Nav_ImgFile.Nav_File", "Nav_User" }); + var modelSub = GetEntity(e => e.ID == guid, new string[] { "Nav_Check", "Nav_CheckType", "Nav_CheckTypeLevel.Nav_Enums", "Nav_Files.Nav_ImgFile.Nav_File", "Nav_User" }); //上报明细 是不完整的 明细信息重新 整理 @@ -6037,6 +6037,7 @@ namespace APT.BS.WebApi.Controllers.Api risk.ORG_ID = entity.ORG_ID; risk.SUBMIT_STATUS = entity.RiskContentState; risk.NAME = "手动隐患上报"; + risk.CHECKOBJECT = BSMineTypeEnum.Mine;//SMS 默认露天矿 if (!risk.CHECKTIME.HasValue) risk.CHECKTIME = DateTime.Now; diff --git a/APT.MicroApi/APT.PP.WebApi/Controllers/Api/BSController.cs b/APT.MicroApi/APT.PP.WebApi/Controllers/Api/BSController.cs index e2275e3..b2bf80d 100644 --- a/APT.MicroApi/APT.PP.WebApi/Controllers/Api/BSController.cs +++ b/APT.MicroApi/APT.PP.WebApi/Controllers/Api/BSController.cs @@ -802,7 +802,7 @@ namespace APT.PP.WebApi.Controllers.Api.PP //modelRun.CHECKTIME = listPlanSetRund[i].CHECKTIME.HasValue ? Convert.ToDateTime(dtNow.ToString("yyyy-MM-dd ") + listPlanSetRund[i].CHECKTIME.Value.ToString("HH:mm:ss")) : DateTime.Now; modelRun.CREATER_ID = listFMUserNotice[j].ID;//安全检查的创建人 就是通知人 - modelRun.CHECKOBJECT = CHECKOBJECT; + modelRun.CHECKOBJECT =(int) BSMineTypeEnum.Mine;// CHECKOBJECT; modelRun.PLAN_SET_ID = listPlanSetRund[i].ID; modelRun.CREACTTYPE = CREACTTYPEEnum.System;// 10;//系统生成 @@ -1258,7 +1258,7 @@ namespace APT.PP.WebApi.Controllers.Api.PP //modelRun.CHECKTIME = listPlanSetRund[i].CHECKTIME.HasValue ? Convert.ToDateTime(dtNow.ToString("yyyy-MM-dd ") + listPlanSetRund[i].CHECKTIME.Value.ToString("HH:mm:ss")) : DateTime.Now; modelRun.CREATER_ID = listFMUserNotice[j].ID;//安全检查的创建人 就是通知人 - modelRun.CHECKOBJECT = CHECKOBJECT; + modelRun.CHECKOBJECT = (int)BSMineTypeEnum.Mine;// CHECKOBJECT; modelRun.PLAN_SET_ID = listPlanSetRund[i].ID; modelRun.CREACTTYPE = CREACTTYPEEnum.System;// 10;//系统生成 modelRun.CODE = CHECK_TYPENAME_CODE + i.ToString() + j.ToString();//mmss 因为审批流 CODE 长度20 减少长度