This commit is contained in:
wjn 2024-07-05 14:44:41 +08:00
commit db73ff246c
7 changed files with 97 additions and 113 deletions

View File

@ -181,7 +181,8 @@ namespace APT.BS.WebApi.Controllers.Api
entity.Nav_ListCheckQuestion = null;
if (!string.IsNullOrEmpty(entity.StrCheckObject))
{
List<string> list = entity.StrCheckObject.Split('_', StringSplitOptions.RemoveEmptyEntries).ToList();
//List<string> list = entity.StrCheckObject.Split('_', StringSplitOptions.RemoveEmptyEntries).ToList();
List<string> list = new List<string>() { ((int)BSMineTypeEnum.Mine).ToString() };
for (int i = 0; i < list.Count; i++)
{
try
@ -208,6 +209,7 @@ namespace APT.BS.WebApi.Controllers.Api
}
else
{
entity.CHECKOBJECT = BSMineTypeEnum.Mine;
this.UnifiedCommit(() =>
{
if (entity != null)

View File

@ -75,7 +75,7 @@ namespace APT.BS.WebApi.Controllers.Api
//获取数据
Dictionary<int, int> startRowIndexs = new Dictionary<int, int>();
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
/// <param name="rowIndex"></param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
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<int> listNotEmpty = new List<int>() { 0, 1, 2, 3, 4, 5, 7, 8, 10, 11, 12, 13 };
List<int> listNotEmpty = new List<int>() { 0, 1, 2, 3, 4, 5, 7, 8, 9 };
//BSMineTypeEnum
@ -154,9 +156,9 @@ namespace APT.BS.WebApi.Controllers.Api
Dictionary<int, List<int>> dicIndexEmpty = new Dictionary<int, List<int>>();
//检查对象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<string> listStrQuestionLevel = new List<string>() { "重大", "A", "B", "C", "D", };
//List<string> listStrQuestionLevel = new List<string>() { "重大", "A", "B", "C", "D", };
string strQuestionLevel = string.Empty;
List<int> listQuestionLevel = new List<int>();
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<EnumsResult> list = DataHelper.GetEnum("BSMineTypeEnum");
//List<EnumsResult> list = DataHelper.GetEnum("BSMineTypeEnum");
//EnumsResult? enumCheck = null;
List<EnumsResult> listLevel = DataHelper.GetEnum("BSQuestionLevelEnum");
EnumsResult? enumCheck = null;
for (int i = 0; i < rowAll; i++)
{
#region
List<int> 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<int>();
}
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)
{

View File

@ -43,7 +43,17 @@ namespace APT.BS.WebApi.Controllers.Api
if (listObj == null)
{
throw new Exception("请完善检查范围!");
var checkCategory = GetEntity<T_BS_CHECK_PROJECT_CATEGORY_OBJECT>(e => e.CHECKOBJECT == BSMineTypeEnum.Mine && e.PROJECT_CATEGORY_ID == entity.ID);
if (checkCategory == null)
{
listObj = new List<T_BS_CHECK_PROJECT_CATEGORY_OBJECT>();
listObj.Add(new T_BS_CHECK_PROJECT_CATEGORY_OBJECT()
{
ORG_ID = entity.ORG_ID,
CHECKOBJECT = BSMineTypeEnum.Mine,
PROJECT_CATEGORY_ID = entity.ID,
});
}
}
var listCategoryType = entity.Nav_ListCategoryType;
entity.Nav_ListCategoryType = null;
@ -62,7 +72,7 @@ namespace APT.BS.WebApi.Controllers.Api
{
if (entity != null)
UpdateEntityNoCommit(entity);
if (listObj.Any())
if (listObj != null && listObj.Any())
BantchSaveEntityNoCommit(listObj);
if (listCategoryType.Any())
BantchSaveEntityNoCommit(listCategoryType);

View File

@ -81,13 +81,17 @@ namespace APT.BS.WebApi.Controllers.Api
var ListSetDepObject = entity.Nav_ListSetDepObject;
entity.Nav_ListSetDepObject = null;
int rowIndex = 1;
foreach (var item in ListSetDepObject)
if (ListSetDepObject != null && ListSetDepObject.Any())
{
if (!item.DEPARTMENT_ID.HasValue)
foreach (var item in ListSetDepObject)
{
throw new Exception("请设置部门,行:" + rowIndex + "");
item.CHECKOBJECT = BSMineTypeEnum.Mine;
if (!item.DEPARTMENT_ID.HasValue)
{
throw new Exception("请设置部门,行:" + rowIndex + "");
}
rowIndex++;
}
rowIndex++;
}
this.UnifiedCommit(() =>
{

View File

@ -217,7 +217,7 @@ namespace APT.BS.WebApi.Controllers.Api
{
List<FilterRule> filterRules = filter.FilterGroup.Rules.ToList();
var guid = new Guid(filterRules[0].Value.ToString());
var modelSub = GetEntity<T_BS_RISK_SUBMIT>(e => e.ID == guid, new string[] { "Nav_CheckType", "Nav_CheckTypeLevel.Nav_Enums", "Nav_Files.Nav_ImgFile.Nav_File", "Nav_User" });
var modelSub = GetEntity<T_BS_RISK_SUBMIT>(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;
@ -6329,7 +6330,8 @@ namespace APT.BS.WebApi.Controllers.Api
entity.CHECK_TYPE_ID = entityContent.CHECK_TYPE_ID;
if (entityContent.CHECK_TYPE_LEVEL_ID.HasValue)
entity.CHECK_TYPE_LEVEL_ID = entityContent.CHECK_TYPE_LEVEL_ID;
entity.CHECKOBJECT = entityContent.CHECKOBJECT;
if (entity.CHECKOBJECT == null && entityContent.CHECKOBJECT != null)
entity.CHECKOBJECT = entityContent.CHECKOBJECT;
}
var files = entityContent.Nav_Files;
entityContent.Nav_Files = null;

View File

@ -8138,9 +8138,9 @@ namespace APT.BS.WebApi.Controllers.Api
IEnumerable<T_BS_SAFE_CHECK_PROJECT_CATEGORY> listCheakCategory = null;
if (entity.SAFE_CHECK_ID != Guid.Empty)
{
listCheakProject = GetEntities<T_BS_SAFE_CHECK_PROJECT>(e => e.SAFE_CHECK_ID == entity.CHECK_TYPE_ID, null, null);
listCheakArea = GetEntities<T_BS_SAFE_CHECK_RISK_AREA>(e => e.SAFE_CHECK_ID == entity.CHECK_TYPE_ID, null, null);
listCheakCategory = GetEntities<T_BS_SAFE_CHECK_PROJECT_CATEGORY>(e => e.SAFE_CHECK_ID == entity.CHECK_TYPE_ID, null, null);
listCheakProject = GetEntities<T_BS_SAFE_CHECK_PROJECT>(e => e.SAFE_CHECK_ID == entity.SAFE_CHECK_ID, null, null);
listCheakArea = GetEntities<T_BS_SAFE_CHECK_RISK_AREA>(e => e.SAFE_CHECK_ID == entity.SAFE_CHECK_ID, null, null);
listCheakCategory = GetEntities<T_BS_SAFE_CHECK_PROJECT_CATEGORY>(e => e.SAFE_CHECK_ID == entity.SAFE_CHECK_ID, null, null);
}
return SafeExecute(() =>
{
@ -8203,8 +8203,6 @@ namespace APT.BS.WebApi.Controllers.Api
T_BS_CHECK_MAIN modelMain = null;
int NUM = 0;
T_BS_SAFE_CHECK_RISK_AREA cheakAreaAdd = null;
List<T_BS_SAFE_CHECK_PROJECT> listCheakProjectAdd = new List<T_BS_SAFE_CHECK_PROJECT>();
List<T_BS_SAFE_CHECK_PROJECT_CATEGORY> listCheakCategoryAdd = new List<T_BS_SAFE_CHECK_PROJECT_CATEGORY>();
@ -8323,11 +8321,12 @@ namespace APT.BS.WebApi.Controllers.Api
//判断 完善 检查表 项目与项目分类信息
var checkProj = listCheakProject.FirstOrDefault(e => e.CHECK_PROJECT_ID == item.CHECK_PROJECT_ID);
if (checkProj == null)
checkProj = listCheakProjectAdd.FirstOrDefault(e => e.CHECK_PROJECT_ID == item.CHECK_PROJECT_ID);
if (checkProj == null)
{
listCheakProjectAdd.Add(new T_BS_SAFE_CHECK_PROJECT()
{
ID = Guid.NewGuid(),
ORG_ID = entity.ORG_ID,
CREATER_ID = loginId,
@ -8338,11 +8337,12 @@ namespace APT.BS.WebApi.Controllers.Api
});
}
var checkCategory = listCheakCategory.FirstOrDefault(e => e.CHECK_PROJECT_CATEGORY_ID == item.CHECK_PROJECT_CATEGORY_ID);
if (checkCategory == null)
checkCategory = listCheakCategoryAdd.FirstOrDefault(e => e.CHECK_PROJECT_CATEGORY_ID == item.CHECK_PROJECT_CATEGORY_ID);
if (checkCategory == null)
{
listCheakCategoryAdd.Add(new T_BS_SAFE_CHECK_PROJECT_CATEGORY()
{
ID = Guid.NewGuid(),
ORG_ID = entity.ORG_ID,
CREATER_ID = loginId,

View File

@ -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 减少长度