20240125本部检查调整

This commit is contained in:
2024-01-25 17:24:20 +08:00
parent 6b5fb3a865
commit 2449c9fa32
14 changed files with 381 additions and 176 deletions
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using NPOI.SS.Formula;
using System.Collections.Generic;
using System.Linq;
namespace BLL
@@ -96,19 +97,34 @@ namespace BLL
/// <param name="checkNoticeId"></param>
public static void DeleteCheckNoticeByCheckNoticeId(string checkNoticeId)
{
Model.ProjectSupervision_CheckNotice checkNotice = Funs.DB.ProjectSupervision_CheckNotice.FirstOrDefault(e => e.CheckNoticeId == checkNoticeId);
if (checkNotice != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var checkTeams = from x in Funs.DB.ProjectSupervision_CheckTeam where x.CheckNoticeId == checkNoticeId select x;
if (checkTeams.Count() > 0)
var checkNotice = db.ProjectSupervision_CheckNotice.FirstOrDefault(e => e.CheckNoticeId == checkNoticeId);
if (checkNotice != null)
{
foreach (var item in checkTeams)
var checkTeams = from x in db.ProjectSupervision_CheckTeam where x.CheckNoticeId == checkNoticeId select x;
if (checkTeams.Count() > 0)
{
BLL.CheckTeamService.DeleteCheckTeamByCheckTeamId(item.CheckTeamId);
db.ProjectSupervision_CheckTeam.DeleteAllOnSubmit(checkTeams);
}
var getCheck1 = from x in db.ProjectSupervision_Check1 where x.CheckNoticeId == checkNoticeId select x;
if (getCheck1.Count() > 0)
{
db.ProjectSupervision_Check1.DeleteAllOnSubmit(getCheck1);
}
var getCheckTable1 = from x in db.ProjectSupervision_CheckTable1 where x.CheckNoticeId == checkNoticeId select x;
if (getCheckTable1.Count() > 0)
{
db.ProjectSupervision_CheckTable1.DeleteAllOnSubmit(getCheckTable1);
}
CheckReportService.DeleteCheckReportByCheckNoticeId(checkNoticeId);
ProjectSupervision_RectifyService.DeleteRectifyByCheckNoticeId(checkNoticeId);
db.ProjectSupervision_CheckNotice.DeleteOnSubmit(checkNotice);
db.SubmitChanges();
}
Funs.DB.ProjectSupervision_CheckNotice.DeleteOnSubmit(checkNotice);
Funs.DB.SubmitChanges();
}
}
@@ -119,44 +135,47 @@ namespace BLL
/// <returns></returns>
public static List<Model.ProjectSupervision_CheckNotice> GetCheckInfoList(string unitId, string userId, string roleId)
{
List<Model.ProjectSupervision_CheckNotice> checkInfoLists = new List<Model.ProjectSupervision_CheckNotice>();
var role = BLL.RoleService.GetRoleByRoleId(roleId);
if (userId == BLL.Const.sysglyId || (BLL.CommonService.IsMainUnitOrAdmin(unitId) && role != null))
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
checkInfoLists = (from x in Funs.DB.ProjectSupervision_CheckNotice orderby x.CheckStartTime select x).ToList();
}
else
{
var checkInfoIdList = (from x in Funs.DB.ProjectSupervision_CheckTeam
where x.UserId == userId && x.UnitId == unitId
select x.CheckNoticeId).Distinct().ToList();
if (checkInfoIdList.Count() > 0)
List<Model.ProjectSupervision_CheckNotice> checkInfoLists = new List<Model.ProjectSupervision_CheckNotice>();
var role = BLL.RoleService.GetRoleByRoleId(roleId);
if (userId == BLL.Const.sysglyId || (BLL.CommonService.IsMainUnitOrAdmin(unitId) && role != null))
{
checkInfoLists = (from x in Funs.DB.ProjectSupervision_CheckNotice
where checkInfoIdList.Contains(x.CheckNoticeId)
orderby x.CheckStartTime
select x).ToList();
checkInfoLists = (from x in db.ProjectSupervision_CheckNotice orderby x.CheckStartTime select x).ToList();
}
var checkInfoIdList1 = (from x in Funs.DB.ProjectSupervision_CheckNotice
where x.CompileMan == userId
orderby x.CheckStartTime
select x).ToList();
if (checkInfoIdList1.Count() > 0)
else
{
if (checkInfoLists.Count() > 0)
var checkInfoIdList = (from x in db.ProjectSupervision_CheckTeam
where x.UserId == userId && x.UnitId == unitId
select x.CheckNoticeId).Distinct().ToList();
if (checkInfoIdList.Count() > 0)
{
checkInfoLists.AddRange(checkInfoIdList1);
checkInfoLists = (from x in db.ProjectSupervision_CheckNotice
where checkInfoIdList.Contains(x.CheckNoticeId)
orderby x.CheckStartTime
select x).ToList();
}
else
{
checkInfoLists = checkInfoIdList1;
}
}
checkInfoLists = checkInfoLists.Distinct().ToList();
var checkInfoIdList1 = (from x in db.ProjectSupervision_CheckNotice
where x.CompileMan == userId
orderby x.CheckStartTime
select x).ToList();
if (checkInfoIdList1.Count() > 0)
{
if (checkInfoLists.Count() > 0)
{
checkInfoLists.AddRange(checkInfoIdList1);
}
else
{
checkInfoLists = checkInfoIdList1;
}
}
checkInfoLists = checkInfoLists.Distinct().ToList();
}
return checkInfoLists;
}
return checkInfoLists;
}
#region ID得到检查内容项
@@ -28,11 +28,14 @@ namespace BLL
/// <param name="checkReportId"></param>
public static void DeleteCheckReportItemByCheckReportId(string checkReportId)
{
var q = (from x in Funs.DB.ProjectSupervision_CheckReportItem where x.CheckReportId == checkReportId select x).ToList();
if (q != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Funs.DB.ProjectSupervision_CheckReportItem.DeleteAllOnSubmit(q);
Funs.DB.SubmitChanges();
var q = (from x in db.ProjectSupervision_CheckReportItem where x.CheckReportId == checkReportId select x).ToList();
if (q != null)
{
db.ProjectSupervision_CheckReportItem.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
}
}
@@ -61,11 +61,15 @@ namespace BLL
/// <param name="checkNoticeId"></param>
public static void DeleteCheckReportByCheckNoticeId(string checkNoticeId)
{
Model.ProjectSupervision_CheckReport checkReport = Funs.DB.ProjectSupervision_CheckReport.FirstOrDefault(e => e.CheckNoticeId == checkNoticeId);
if (checkReport != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Funs.DB.ProjectSupervision_CheckReport.DeleteOnSubmit(checkReport);
Funs.DB.SubmitChanges();
Model.ProjectSupervision_CheckReport checkReport = db.ProjectSupervision_CheckReport.FirstOrDefault(e => e.CheckNoticeId == checkNoticeId);
if (checkReport != null)
{
CheckReportItemService.DeleteCheckReportItemByCheckReportId(checkReport.CheckReportId);
db.ProjectSupervision_CheckReport.DeleteOnSubmit(checkReport);
db.SubmitChanges();
}
}
}
}
@@ -36,11 +36,14 @@ namespace BLL
public static void DeleteRectifyItemByRectifyId(string rectifyId)
{
var q = (from x in Funs.DB.ProjectSupervision_RectifyItem where x.RectifyId == rectifyId select x).ToList();
if (q != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Funs.DB.ProjectSupervision_RectifyItem.DeleteAllOnSubmit(q);
Funs.DB.SubmitChanges();
var q = (from x in db.ProjectSupervision_RectifyItem where x.RectifyId == rectifyId select x).ToList();
if (q != null)
{
db.ProjectSupervision_RectifyItem.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
}
@@ -75,13 +75,16 @@ namespace BLL
/// <param name="checkNoticeId"></param>
public static void DeleteRectifyByCheckNoticeId(string checkNoticeId)
{
Model.ProjectSupervision_Rectify newRectify = Funs.DB.ProjectSupervision_Rectify.FirstOrDefault(e => e.CheckNoticeId == checkNoticeId);
if (newRectify != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Funs.DB.ProjectSupervision_Rectify.DeleteOnSubmit(newRectify);
Funs.DB.SubmitChanges();
var newRectify = db.ProjectSupervision_Rectify.FirstOrDefault(e => e.CheckNoticeId == checkNoticeId);
if (newRectify != null)
{
ProjectSupervision_RectifyItemService.DeleteRectifyItemByRectifyId(newRectify.RectifyId);
db.ProjectSupervision_Rectify.DeleteOnSubmit(newRectify);
db.SubmitChanges();
}
}
}
}
}