河北专项检查和移动端

This commit is contained in:
2025-04-06 23:26:22 +08:00
parent 64c7be5db4
commit 8aba5b01bc
204 changed files with 41904 additions and 3226 deletions
@@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using Model;
using static BLL.SafetyResponsibilitiesService;
namespace BLL.OfficeCheck.Inspect
{
@@ -15,73 +11,179 @@ namespace BLL.OfficeCheck.Inspect
/// 添加安全专项检查
/// </summary>
/// <param name="Inspection"></param>
public static void AddInspection(Model.Inspect_Inspection Inspection)
public static Model.Inspect_Inspection SaveInspection(Model.Inspect_Inspection Inspection)
{
Model.SGGLDB db = Funs.DB;
int count = (from x in db.Inspect_Inspection where x.InspectType == "1" select x).Count();
if (Inspection.InspectionId == null)
{
Inspection.InspectionId = SQLHelper.GetNewID();
}
Model.Inspect_Inspection newInspection = new Model.Inspect_Inspection
{
InspectionId = Inspection.InspectionId,
InspectionCode = Inspection.InspectionCode,
InspectionCode = "1-"+count.ToString("D6"),
ProjectId = Inspection.ProjectId,
PersonResponsible = Inspection.PersonResponsible,
InspectTime = Inspection.InspectTime,
Description = Inspection.Description,
States = Inspection.States,
InspectMan = Inspection.InspectMan,
InspectType = Inspection.InspectType,
InspectItemSetId = Inspection.InspectItemSetId,
ProjectStates = Inspection.ProjectStates,
CreateMan = Inspection.CreateMan,
CreateTime = Inspection.CreateTime,
CreateTime = DateTime.Today,
CheckMan = Inspection.CheckMan,
PersonResponsible = Inspection.PersonResponsible,
InspectType = Inspection.InspectType,
ProblemTypeId = Inspection.ProblemTypeId,
ProblemTypeName = Inspection.ProblemTypeName,
Place = Inspection.Place,
};
db.Inspect_Inspection.InsertOnSubmit(newInspection);
db.SubmitChanges();
// ////增加一条编码记录
// BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.SafetyInspectionMenuId,
// Inspection.ProjectId, null, Inspection.InspectionId, new DateTime());
}
/// <summary>
/// 添加安全专项明细检查
/// </summary>
/// <param name="Inspection"></param>
public static void AddInspectionItem(Model.Inspect_InspectionItem InspectionItem)
return newInspection;
}
#region
public static void UpdateInspection(Model.Inspect_Inspection Inspection)
{
Model.SGGLDB db = Funs.DB;
Model.Inspect_Inspection newInspection =
db.Inspect_Inspection.FirstOrDefault(e => e.InspectionId == Inspection.InspectionId);
if (newInspection != null)
{
newInspection.States = Inspection.States;
db.SubmitChanges();
ClosedInspection(Inspection.InspectionId);
}
}
#endregion
#region ID获取专项信息
public static Object GetInspectionById(string InspectionId)
{
return (from x in Funs.DB.Inspect_Inspection
where x.InspectionId == InspectionId
select new
{
InspectionId = x.InspectionId,
InspectionCode = x.InspectionCode,
ProjectId = x.ProjectId,
ProjectName = (from y in Funs.DB.Base_Project where y.ProjectId == x.ProjectId select y).First().ProjectName,
Description = x.Description,
States = x.States,
PersonResponsible = x.PersonResponsible,
PersonResponsibleName = (from y in Funs.DB.Sys_User where y.UserId == x.PersonResponsible select y.UserName).FirstOrDefault(),
CreateTime = x.CreateTime,
CreateMan = x.CreateMan,
CheckMan = x.CheckMan,
CreateManName = (from y in Funs.DB.Sys_User where y.UserId == x.CreateMan select y.UserName).FirstOrDefault(),
ProblemTypeId = x.ProblemTypeId,
ProblemTypeName = x.ProblemTypeName,
Place = x.Place,
children = (from a in Funs.DB.Inspect_InspectionItem
where a.InspectionId == x.InspectionId
orderby a.CompileTime descending
select new
{
InspectionItemId = a.InspectionItemId,
InspectionId = a.InspectionId,
ProjectId = a.ProjectId,
BeforelUrl = a.BeforelUrl,
States = a.States,
CompileTime = a.CompileTime,
AfterUrl = a.AfterUrl,
RectificationDate = a.RectificationDate,
EvaluateResults = a.EvaluateResults,
WorkAreaName = a.WorkAreaName
}).ToList()
}).FirstOrDefault(e => e.InspectionId == InspectionId);
}
#endregion
/// <summary>
/// 添加安全专项子项检查
/// </summary>
/// <param name="Inspection"></param>
public static void SaveInspectionItem(Model.Inspect_InspectionItem InspectionItem)
{
Model.SGGLDB db = Funs.DB;
InspectionItem.InspectionItemId = SQLHelper.GetNewID();
Model.Inspect_InspectionItem newInspectionItem = new Model.Inspect_InspectionItem
{
InspectionItemId = InspectionItem.InspectionItemId,
InspectionId = InspectionItem.InspectionId,
InspectionItemCode = InspectionItem.InspectionItemCode,
ProblemDetial = InspectionItem.ProblemDetial,
ProjectId = InspectionItem.ProjectId,
InspectionDescribe = InspectionItem.InspectionDescribe,
PhotoUrl = InspectionItem.PhotoUrl,
VideoUrl = InspectionItem.VideoUrl,
ProblemTypeId = InspectionItem.ProblemTypeId,
BeforelUrl = InspectionItem.BeforelUrl,
EvaluateResults = InspectionItem.EvaluateResults,
TimeLimited = InspectionItem.TimeLimited,
RectificationDescription = InspectionItem.RectificationDescription,
RectificationResults = InspectionItem.RectificationResults,
States = InspectionItem.States,
CompileMan = InspectionItem.CompileMan,
CompileTime = DateTime.Now,
CreateMan = InspectionItem.CreateMan,
CompileTime = InspectionItem.CompileTime,
AfterUrl = InspectionItem.AfterUrl,
ResponsiblePersonId = InspectionItem.ResponsiblePersonId,
RectificationDate = InspectionItem.RectificationDate,
Level = InspectionItem.Level,
WorkAreaName = InspectionItem.WorkAreaName,
};
db.Inspect_InspectionItem.InsertOnSubmit(newInspectionItem);
db.SubmitChanges();
ClosedInspection(InspectionItem.InspectionId);
}
/// <summary>
/// 根据专项检查ID获取专项明细信息
/// </summary>
/// <param name="CheckSpecialName"></param>
/// <returns></returns>
public static Model.Inspect_InspectionItem GetInspectItemsById(string InspectionItemId)
#region
public static void ClosedInspection(string InspectionId)
{
return Funs.DB.Inspect_InspectionItem.FirstOrDefault(e => e.InspectionItemId == InspectionItemId);
int count = Funs.DB.Inspect_InspectionItem.Count(x=>x.InspectionId == InspectionId && x.States != "3");
if(count == 0)
{
Model.SGGLDB db = Funs.DB;
Model.Inspect_Inspection newInspection =
db.Inspect_Inspection.FirstOrDefault(e => e.InspectionId == InspectionId);
newInspection.States = "3";
db.SubmitChanges();
}
}
#endregion
#region
public static Object GetInspectItemsById(string InspectionItemId)
{
return (from x in Funs.DB.Inspect_InspectionItem
join y in Funs.DB.Inspect_Inspection on x.InspectionId equals y.InspectionId
//join b in Funs.DB.Technique_Rectify on x.ProblemTypeId equals b.RectifyId
where x.InspectionItemId == InspectionItemId
select new
{
InspectionItemId = x.InspectionItemId,
InspectionId = x.InspectionId,
ProjectId = x.ProjectId,
ProjectName = Funs.DB.Base_Project.FirstOrDefault(p => p.ProjectId == x.ProjectId).ProjectName,
CreateTime = x.CompileTime,
CreateMan = x.CreateMan,
CreateManName = Funs.DB.Sys_User.FirstOrDefault(u => u.UserId == x.CreateMan).UserName,
CheckMan = y.CheckMan,
EvaluateResults = x.EvaluateResults,
WorkAreaName = x.WorkAreaName,
States = x.States,
BeforelUrl = x.BeforelUrl,
RectificationResults = x.RectificationResults,
AfterUrl = x.AfterUrl,
RectificationDate = x.RectificationDate,
InspectionCode = y.InspectionCode,
Description = y.Description,
InspectType = y.InspectType,
ProblemTypeId = y.ProblemTypeId,
ProblemTypeName = y.ProblemTypeName,
Place = y.Place,
}
).FirstOrDefault(e => e.InspectionItemId == InspectionItemId);
}
#endregion
/// <summary>
/// 根据专项检查ID获取专项信息
@@ -93,27 +195,7 @@ namespace BLL.OfficeCheck.Inspect
return Funs.DB.Inspect_Inspection.FirstOrDefault(e => e.InspectionId == InspectionId);
}
/// <summary>
/// 修改安全专项检查
/// </summary>
/// <param name="Inspection"></param>
public static void UpdateInspection(Model.Inspect_Inspection Inspection)
{
Model.SGGLDB db = Funs.DB;
Model.Inspect_Inspection newInspection =
db.Inspect_Inspection.FirstOrDefault(e => e.InspectionId == Inspection.InspectionId);
if (newInspection != null)
{
newInspection.InspectionCode = Inspection.InspectionCode;
//newInspection.ProjectId = Inspection.ProjectId;
newInspection.PersonResponsible = Inspection.PersonResponsible;
newInspection.InspectTime = Inspection.InspectTime;
newInspection.Description = Inspection.Description;
newInspection.States = Inspection.States;
db.SubmitChanges();
}
}
/// <summary>
/// 修改安全专项检查状态信息
/// </summary>
@@ -141,19 +223,25 @@ namespace BLL.OfficeCheck.Inspect
db.Inspect_InspectionItem.FirstOrDefault(e => e.InspectionItemId == InspectionItem.InspectionItemId);
if (newInspectionItem != null)
{
newInspectionItem.InspectionItemCode = InspectionItem.InspectionItemCode;
//newInspection.ProjectId = Inspection.ProjectId;
newInspectionItem.InspectionDescribe = InspectionItem.InspectionDescribe;
newInspectionItem.PhotoUrl = InspectionItem.PhotoUrl;
newInspectionItem.VideoUrl = InspectionItem.VideoUrl;
newInspectionItem.InspectionItemId = InspectionItem.InspectionItemId;
newInspectionItem.InspectionId = InspectionItem.InspectionId;
newInspectionItem.EvaluateResults = InspectionItem.EvaluateResults;
newInspectionItem.TimeLimited = InspectionItem.TimeLimited;
newInspectionItem.RectificationDescription = InspectionItem.RectificationDescription;
newInspectionItem.BeforelUrl = InspectionItem.BeforelUrl;
newInspectionItem.States = InspectionItem.States;
newInspectionItem.RectificationResults = InspectionItem.RectificationResults;
newInspectionItem.AfterUrl = InspectionItem.AfterUrl;
newInspectionItem.AuditTime = InspectionItem.AuditTime;
newInspectionItem.AuditMan = InspectionItem.AuditMan;
newInspectionItem.BeforelUrl = InspectionItem.BeforelUrl;
newInspectionItem.RectificationResults = InspectionItem.RectificationResults;
newInspectionItem.States = InspectionItem.States;
newInspectionItem.CompileMan = InspectionItem.CompileMan;
newInspectionItem.CompileTime = InspectionItem.CompileTime;
newInspectionItem.ResponsiblePersonId = InspectionItem.ResponsiblePersonId;
newInspectionItem.RectificationDate = InspectionItem.RectificationDate;
newInspectionItem.WorkAreaName = InspectionItem.WorkAreaName;
db.SubmitChanges();
ClosedInspection(InspectionItem.InspectionId);
}
}
@@ -213,35 +301,29 @@ namespace BLL.OfficeCheck.Inspect
/// </summary>
/// <param name="SafetyResponsibilitiesId"></param>
/// <returns></returns>
public static List<InspectionDto> GetInspectionList(string ProjectId, string States, string PersonResponsible, int PageNumber, int PageSize)
public static List<InspectionDto> GetInspectionList(string ProjectId, string States, int PageNumber, int PageSize)
{
var getDataLists = (from x in Funs.DB.Inspect_Inspection
join user in Funs.DB.Sys_User on x.InspectMan equals user.UserId into userJoin1
from subUser1 in userJoin1.DefaultIfEmpty()
join user in Funs.DB.Sys_User on x.CreateMan equals user.UserId into userJoin2
from subUser2 in userJoin2.DefaultIfEmpty()
join user in Funs.DB.Sys_User on x.PersonResponsible equals user.UserId into userJoin3
from subUser3 in userJoin3.DefaultIfEmpty()
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into project
from pro in project.DefaultIfEmpty()
select new InspectionDto
{
InspectionId = x.InspectionId,
InspectionCode = x.InspectionCode,
ProjectId = x.ProjectId,
ProjectName = pro.ProjectName,
ProjectName = Funs.DB.Base_Project.FirstOrDefault(p=>p.ProjectId == x.ProjectId).ProjectName,
PersonResponsible = x.PersonResponsible,
PersonResponsibleName = subUser3.UserName,
InspectTime = x.InspectTime,
PersonResponsibleName = Funs.DB.Sys_User.FirstOrDefault(u => u.UserId == x.PersonResponsible).UserName,
Description = x.Description,
States = x.States,
InspectMan = subUser1.UserName,
InspectManId = x.InspectMan,
InspectType = x.InspectType,
InspectItemSetId = x.InspectItemSetId,
CreateMan = subUser2.UserName,
CreateManName = Funs.DB.Sys_User.FirstOrDefault(u=>u.UserId == x.CreateMan).UserName,
CreateMan = x.CreateMan,
CreateTime = x.CreateTime,
CheckMan = x.CheckMan,
InspectType = x.InspectType,
ProblemTypeId = x.ProblemTypeId,
ProblemTypeName = x.ProblemTypeName,
Place = x.Place,
ChildsCount = Funs.DB.Inspect_InspectionItem.Count(itm=>itm.InspectionId == x.InspectionId).ToString()
});
if (!string.IsNullOrEmpty(ProjectId))
{
@@ -253,11 +335,6 @@ namespace BLL.OfficeCheck.Inspect
getDataLists = getDataLists.Where(q => q.States == States);
}
if (!string.IsNullOrEmpty(PersonResponsible))
{
getDataLists = getDataLists.Where(q => q.PersonResponsible == PersonResponsible);
}
if (PageNumber > 0 && PageSize > 0)
{
getDataLists = getDataLists.Skip((PageNumber - 1) * PageSize).Take(PageSize);
@@ -276,28 +353,26 @@ namespace BLL.OfficeCheck.Inspect
{
List<InspectionItemDto> getDataLists = (from x in Funs.DB.Inspect_InspectionItem
join user in Funs.DB.Sys_User on x.CompileMan equals user.UserId into userJoin1
from subUser1 in userJoin1.DefaultIfEmpty()
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into project
from pro in project.DefaultIfEmpty()
where x.InspectionId == InspectionId
select new InspectionItemDto
{
InspectionItemId = x.InspectionItemId,
InspectionId = x.InspectionId,
InspectionItemCode = x.InspectionItemCode,
ProjectId = x.ProjectId,
ProjectName = pro.ProjectName,
InspectionDescribe = x.InspectionDescribe,
PhotoUrl = x.PhotoUrl,
VideoUrl = x.VideoUrl,
EvaluateResults = x.EvaluateResults,
TimeLimited = x.TimeLimited,
RectificationDescription = x.RectificationDescription,
RectificationResults = x.RectificationResults,
States = x.States,
CompileMan = subUser1.UserName,
CompileTime = x.CompileTime,
//InspectionItemId = x.InspectionItemId,
//InspectionId = x.InspectionId,
//InspectionItemCode = x.InspectionItemCode,
//ProjectId = x.ProjectId,
//ProjectName = pro.ProjectName,
//InspectionDescribe = x.InspectionDescribe,
//PhotoUrl = x.PhotoUrl,
//VideoUrl = x.VideoUrl,
//EvaluateResults = x.EvaluateResults,
//TimeLimited = x.TimeLimited,
//RectificationDescription = x.RectificationDescription,
//RectificationResults = x.RectificationResults,
//States = x.States,
//CompileMan = subUser1.UserName,
//CompileTime = x.CompileTime,
}).ToList();
if (PageNumber > 0 && PageSize > 0)
{
@@ -325,7 +400,6 @@ namespace BLL.OfficeCheck.Inspect
public class InspectionDto
{
public string InspectionId
{
get;
@@ -360,12 +434,6 @@ namespace BLL.OfficeCheck.Inspect
set;
}
public System.Nullable<System.DateTime> InspectTime
{
get;
set;
}
public string Description
{
get;
@@ -378,12 +446,6 @@ namespace BLL.OfficeCheck.Inspect
set;
}
public string InspectMan
{
get;
set;
}
public string InspectManId
{
get;
@@ -395,22 +457,36 @@ namespace BLL.OfficeCheck.Inspect
get;
set;
}
public string InspectItemSetId
{
get;
set;
}
public string CreateMan
{
get;
set;
}
public string CreateManName
{
get;
set;
}
public System.Nullable<System.DateTime> CreateTime
{
get;
set;
}
public string ProblemTypeId { get; set; }
public string ProblemTypeName { get; set; }
public string Place { get; set; }
public string CheckMan
{
get;
set;
}
public string ChildsCount
{
get;
set;
}
}