专项检查

This commit is contained in:
2025-04-15 20:48:53 +08:00
parent 80ea8ec450
commit 1c6dca4612
36 changed files with 29955 additions and 932 deletions
+140 -244
View File
@@ -1,17 +1,88 @@
using Model;
using System;
using System.Collections;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
namespace BLL
{
public class CheckControlService
{
#region
public static Object GetListDataForApi(string state, string name, string projectId, int index, int page)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
var list = db.Check_CheckControl.Select(x => new {
CheckControlCode = x.CheckControlCode,
DocCode = x.DocCode,
ProjectId = x.ProjectId,
States = x.State,
CheckSite = x.CheckSite,
QuestionDef = x.QuestionDef,
CheckDate = String.Format("{0:yyyy-MM-dd}", x.CheckDate),
LimitDate = String.Format("{0:yyyy-MM-dd}", x.LimitDate),
RectifyOpinion = x.RectifyOpinion,
CheckMan = x.CheckMan,
UnitWorkId = x.UnitWorkId,
UnitWorkName = (from y in db.WBS_UnitWork where y.UnitWorkId == x.UnitWorkId select y.UnitWorkName).First(),
CheckManName = (from y in db.Sys_User where y.UserId == x.CheckMan select y.UserName).First(),
PrincipalMan = x.DutyMan,
PrincipalManName = db.Sys_User.FirstOrDefault(e => e.UserId == x.DutyMan).UserName,
CNProfessionalCode = x.CNProfessionalCode,
CNProfessionalCodeName = db.Base_CNProfessional.FirstOrDefault(e => e.CNProfessionalId == x.CNProfessionalCode).ProfessionalName,
QuestionType = x.QuestionType,
QuestionTypeName = db.Base_QualityQuestionType.FirstOrDefault(e => e.QualityQuestionTypeId == x.QuestionType).QualityQuestionType,
}).Where(e => e.ProjectId == projectId);
if (state != "0")
{
list = list.Where(x => x.States == state);
}
return list.ToList().Skip(index * page).Take(page);
}
}
#endregion
#region
public static object GetCheckControlForApi(string CheckControlCode)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
object x = db.Check_CheckControl.Select(x => new {
CheckControlCode = x.CheckControlCode,
ProjectId = x.ProjectId,
ProjectName = db.Base_Project.FirstOrDefault(p => p.ProjectId == x.ProjectId).ProjectName,
DocCode = x.DocCode,
States = x.State,
CheckSite = x.CheckSite,
QuestionDef = x.QuestionDef,
CheckDate = String.Format("{0:yyyy-MM-dd}", x.CheckDate),
LimitDate = String.Format("{0:yyyy-MM-dd}", x.LimitDate),
RectifyOpinion = x.RectifyOpinion,
CheckMan = x.CheckMan,
UnitWorkId = x.UnitWorkId,
AttachUrl = x.AttachUrl,
HandleWay = x.HandleWay,
RectifyDate = String.Format("{0:yyyy-MM-dd}", x.RectifyDate),
ReAttachUrl = x.ReAttachUrl,
IsOk = x.IsOK,
OKDescr = x.OKDescr,
UnitWorkName = (from y in db.WBS_UnitWork where y.UnitWorkId == x.UnitWorkId select y.UnitWorkName).First(),
CheckManName = (from y in db.Sys_User where y.UserId == x.CheckMan select y.UserName).First(),
PrincipalMan = x.DutyMan,
PrincipalManName = db.Sys_User.FirstOrDefault(e => e.UserId == x.DutyMan).UserName,
CNProfessionalCode = x.CNProfessionalCode,
CNProfessionalCodeName = db.Base_CNProfessional.FirstOrDefault(e => e.CNProfessionalId == x.CNProfessionalCode).ProfessionalName,
QuestionType = x.QuestionType,
QuestionTypeName = db.Base_QualityQuestionType.FirstOrDefault(e => e.QualityQuestionTypeId == x.QuestionType).QualityQuestionType,
}).FirstOrDefault(e => e.CheckControlCode == CheckControlCode);
return x;
}
}
#endregion
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 根据质量检查与控制Id删除一个质量检查与控制信息
@@ -50,7 +121,7 @@ namespace BLL
{
dropName.DataValueField = "Value";
dropName.DataTextField = "Text";
dropName.DataSource = GetDHandleTypeByState(state);
//dropName.DataSource = GetDHandleTypeByState(state);
dropName.DataBind();
if (isShowPlease)
{
@@ -73,7 +144,6 @@ namespace BLL
newCheckControl.UnitId = CheckControl.UnitId;
newCheckControl.CheckDate = CheckControl.CheckDate;
newCheckControl.CheckMan = CheckControl.CheckMan;
newCheckControl.IsSubmit = CheckControl.IsSubmit;
newCheckControl.SubmitMan = CheckControl.SubmitMan;
newCheckControl.CNProfessionalCode = CheckControl.CNProfessionalCode;
newCheckControl.QuestionType = CheckControl.QuestionType;
@@ -86,7 +156,7 @@ namespace BLL
newCheckControl.RectifyDate = CheckControl.RectifyDate;
newCheckControl.ReAttachUrl = CheckControl.ReAttachUrl;
newCheckControl.State = CheckControl.State;
newCheckControl.SaveHandleMan = CheckControl.SaveHandleMan;
newCheckControl.DutyMan = CheckControl.DutyMan;
db.Check_CheckControl.InsertOnSubmit(newCheckControl);
db.SubmitChanges();
@@ -104,7 +174,6 @@ namespace BLL
newCheckControl.UnitId = CheckControl.UnitId;
newCheckControl.CheckDate = CheckControl.CheckDate;
newCheckControl.CheckMan = CheckControl.CheckMan;
newCheckControl.IsSubmit = CheckControl.IsSubmit;
newCheckControl.SubmitMan = CheckControl.SubmitMan;
newCheckControl.CNProfessionalCode = CheckControl.CNProfessionalCode;
newCheckControl.QuestionType = CheckControl.QuestionType;
@@ -117,7 +186,7 @@ namespace BLL
newCheckControl.RectifyDate = CheckControl.RectifyDate;
newCheckControl.ReAttachUrl = CheckControl.ReAttachUrl;
newCheckControl.State = CheckControl.State;
newCheckControl.SaveHandleMan = CheckControl.SaveHandleMan;
newCheckControl.DutyMan = CheckControl.DutyMan;
db.Check_CheckControl.InsertOnSubmit(newCheckControl);
db.SubmitChanges();
@@ -131,88 +200,59 @@ namespace BLL
{
return Funs.DB.Check_CheckControl.FirstOrDefault(e => e.CheckControlCode == CheckControlCode);
}
public static Model.Check_CheckControl GetCheckControlForApi(string CheckControlCode)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
Model.Check_CheckControl x = db.Check_CheckControl.FirstOrDefault(e => e.CheckControlCode == CheckControlCode);
x.AttachUrl = AttachFileService.getFileUrl(x.CheckControlCode);
x.ReAttachUrl = AttachFileService.getFileUrl(x.CheckControlCode + "r");
x.QuestionType = x.QuestionType + "$" + BLL.QualityQuestionTypeService.GetQualityQuestionType(x.QuestionType).QualityQuestionType;
var unit = UnitService.GetUnitByUnitId(x.UnitId);
x.UnitId = x.UnitId + "$" + unit.UnitName;
var ppunit = UnitService.GetUnitByUnitId(x.ProposeUnitId);
var punit = ProjectUnitService.GetProjectUnitByUnitIdProjectId(x.ProjectId, x.ProposeUnitId);
if (punit != null)
{
x.ProposeUnitId = x.ProposeUnitId + "$" + ppunit.UnitName + "$" + punit.UnitType;
}
else
{
x.ProposeUnitId = x.ProposeUnitId + "$" + "$";
}
Sys_User checkMen = UserService.GetUserByUserId(x.CheckMan);
x.CheckMan = (checkMen != null ? checkMen.UserName : "") + "$" + UnitWorkService.GetNameById(x.UnitWorkId) + "$" + ConvertManAndID(x.CheckControlCode);
x.CNProfessionalCode = x.CNProfessionalCode + "$" + CNProfessionalService.GetCNProfessionalNameByCode(x.CNProfessionalCode);
return x;
}
}
/// <summary>
/// 根据状态选择下一步办理类型
/// </summary>
/// <param name="state"></param>
/// <returns></returns>
public static ListItem[] GetDHandleTypeByState(string state)
{
if (state == Const.CheckControl_Compile || state == Const.CheckControl_ReCompile) //无是否同意
{
ListItem[] lis = new ListItem[2];
lis[0] = new ListItem("分包专业工程师回复", Const.CheckControl_Audit2);
lis[1] = new ListItem("总包负责人审核", Const.CheckControl_Audit1);
return lis;
}
else if (state == Const.CheckControl_Audit1)//有是否同意
{
ListItem[] lis = new ListItem[2];
lis[0] = new ListItem("分包专业工程师回复", Const.CheckControl_Audit2);//是 加载
lis[1] = new ListItem("重新编制", Const.CheckControl_ReCompile);//否加载
return lis;
}
else if (state == Const.CheckControl_Audit2 || state == Const.CheckControl_ReCompile2)//无是否同意
{
ListItem[] lis = new ListItem[1];
lis[0] = new ListItem("总包专业工程师确认", Const.CheckControl_Audit4);
return lis;
}
else if (state == Const.CheckControl_Audit3)//有是否同意
{
ListItem[] lis = new ListItem[2];
lis[0] = new ListItem("总包专业工程师确认", Const.CheckControl_Audit4);//是 加载
lis[1] = new ListItem("分包专业工程师重新回复", Const.CheckControl_ReCompile2);//否加载
return lis;
}
else if (state == Const.CheckControl_Audit4)//有是否同意
{
ListItem[] lis = new ListItem[2];
// lis[0] = new ListItem("总包负责人确认", Const.CheckControl_Audit5);//是 加载
lis[0] = new ListItem("审批完成", Const.CheckControl_Complete);//是 加载
lis[1] = new ListItem("分包专业工程师重新回复", Const.CheckControl_ReCompile2);//否加载
return lis;
}
else if (state == Const.CheckControl_Audit5)//有是否同意
{
ListItem[] lis = new ListItem[2];
lis[0] = new ListItem("审批完成", Const.CheckControl_Complete);//是 加载
lis[1] = new ListItem("分包专业工程师重新回复", Const.CheckControl_ReCompile2);//否加载
return lis;
}
else
return null;
}
//public static ListItem[] GetDHandleTypeByState(string state)
//{
// if (state == Const.CheckControl_Compile || state == Const.CheckControl_ReCompile) //无是否同意
// {
// ListItem[] lis = new ListItem[2];
// lis[0] = new ListItem("分包专业工程师回复", Const.CheckControl_Audit2);
// lis[1] = new ListItem("总包负责人审核", Const.CheckControl_Audit1);
// return lis;
// }
// else if (state == Const.CheckControl_Audit1)//有是否同意
// {
// ListItem[] lis = new ListItem[2];
// lis[0] = new ListItem("分包专业工程师回复", Const.CheckControl_Audit2);//是 加载
// lis[1] = new ListItem("重新编制", Const.CheckControl_ReCompile);//否加载
// return lis;
// }
// else if (state == Const.CheckControl_Audit2 || state == Const.CheckControl_ReCompile2)//无是否同意
// {
// ListItem[] lis = new ListItem[1];
// lis[0] = new ListItem("总包专业工程师确认", Const.CheckControl_Audit4);
// return lis;
// }
// else if (state == Const.CheckControl_Audit3)//有是否同意
// {
// ListItem[] lis = new ListItem[2];
// lis[0] = new ListItem("总包专业工程师确认", Const.CheckControl_Audit4);//是 加载
// lis[1] = new ListItem("分包专业工程师重新回复", Const.CheckControl_ReCompile2);//否加载
// return lis;
// }
// else if (state == Const.CheckControl_Audit4)//有是否同意
// {
// ListItem[] lis = new ListItem[2];
// // lis[0] = new ListItem("总包负责人确认", Const.CheckControl_Audit5);//是 加载
// lis[0] = new ListItem("审批完成", Const.CheckControl_Complete);//是 加载
// lis[1] = new ListItem("分包专业工程师重新回复", Const.CheckControl_ReCompile2);//否加载
// return lis;
// }
// else if (state == Const.CheckControl_Audit5)//有是否同意
// {
// ListItem[] lis = new ListItem[2];
// lis[0] = new ListItem("审批完成", Const.CheckControl_Complete);//是 加载
// lis[1] = new ListItem("分包专业工程师重新回复", Const.CheckControl_ReCompile2);//否加载
// return lis;
// }
// else
// return null;
//}
/// <summary>
/// 修改质量检查与控制
/// </summary>
@@ -226,7 +266,6 @@ namespace BLL
newCheckControl.UnitWorkId = CheckControl.UnitWorkId;
newCheckControl.UnitId = CheckControl.UnitId;
newCheckControl.CheckDate = CheckControl.CheckDate;
newCheckControl.IsSubmit = CheckControl.IsSubmit;
newCheckControl.SubmitMan = CheckControl.SubmitMan;
newCheckControl.IsOK = CheckControl.IsOK;
newCheckControl.CNProfessionalCode = CheckControl.CNProfessionalCode;
@@ -240,123 +279,11 @@ namespace BLL
newCheckControl.RectifyDate = CheckControl.RectifyDate;
newCheckControl.ReAttachUrl = CheckControl.ReAttachUrl;
newCheckControl.State = CheckControl.State;
newCheckControl.SaveHandleMan = CheckControl.SaveHandleMan;
newCheckControl.DutyMan = CheckControl.DutyMan;
db.SubmitChanges();
}
public static List<Model.Check_CheckControl> GetListDataForApi(string state, string name, string projectId, int index, int page)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
IQueryable<Model.Check_CheckControl> q = db.Check_CheckControl;
List<string> ids = new List<string>();
if (!string.IsNullOrEmpty(name))
{
var qunit = from u in Funs.DB.Base_Unit
where u.UnitName.Contains(name)
select u.UnitId;
ids = qunit.ToList();
q = q.Where(e => ids.Contains(e.UnitId));
}
if (!string.IsNullOrEmpty(projectId))
{
q = q.Where(e => e.ProjectId == projectId);
}
switch (state)
{
case "1": // 未整改
q = q.Where(e => e.State != BLL.Const.CheckControl_Audit4
&& e.State != BLL.Const.CheckControl_Audit5
&& e.State != BLL.Const.CheckControl_Complete
&& e.LimitDate > DateTime.Now);
break;
case "2": // 待确认 5/6
q = q.Where(e => e.State == BLL.Const.CheckControl_Audit4 || e.State == BLL.Const.CheckControl_Audit5);
break;
case "3": // 已闭环 7
q = q.Where(e => e.State == BLL.Const.CheckControl_Complete);
break;
case "4": // 超期未整改
q = q.Where(e => e.State != BLL.Const.CheckControl_Audit4
&& e.State != BLL.Const.CheckControl_Audit5
&& e.State != BLL.Const.CheckControl_Complete
&& e.LimitDate < DateTime.Now);
break;
}
var qq1 = from x in q
orderby x.DocCode descending
select new
{
x.CheckControlCode,
x.DocCode,
x.UnitId,
x.ProposeUnitId,
x.UnitWorkId,
x.CheckDate,
x.State,
x.CheckSite,
x.IsSubmit,
x.AttachUrl,
x.QuestionDef,
x.QuestionType,
x.RectifyOpinion,
x.LimitDate,
x.CNProfessionalCode,
CNProfessionalName = (from y in db.Base_CNProfessional where y.CNProfessionalId == x.CNProfessionalCode select y.ProfessionalName).First(),
UnitWork = (from y in db.WBS_UnitWork where y.UnitWorkId == x.UnitWorkId select y.UnitWorkCode + "-" + y.UnitWorkName + (y.ProjectType == "1" ? "(建筑)" : "(安装)")).First(),
CheckMan = (from y in db.Sys_User where y.UserId == x.CheckMan select y.UserName).First()
};
var list = qq1.Skip(index * page).Take(page).ToList();
List<Model.Check_CheckControl> listRes = new List<Model.Check_CheckControl>();
for (int i = 0; i < list.Count; i++)
{
try
{
Model.Check_CheckControl x = new Model.Check_CheckControl();
x.CheckControlCode = list[i].CheckControlCode;
x.DocCode = list[i].DocCode;
x.UnitWorkId = list[i].UnitWorkId;
x.CheckDate = list[i].CheckDate;
x.UnitId = list[i].UnitId + "$" + UnitService.GetUnitNameByUnitId(list[i].UnitId);
var punit = ProjectUnitService.GetProjectUnitByUnitIdProjectId(projectId, list[i].ProposeUnitId);
string unitType = string.Empty;
if (punit != null)
{
unitType = punit.UnitType;
}
x.ProposeUnitId = list[i].ProposeUnitId + "$" + UnitService.GetUnitNameByUnitId(list[i].ProposeUnitId) + "$" + unitType;
x.CheckMan = list[i].CheckMan + "$" + list[i].UnitWork + "$" + ConvertManAndID(list[i].CheckControlCode);
x.State = list[i].State;
x.CheckSite = list[i].CheckSite;
x.IsSubmit = list[i].IsSubmit;
x.AttachUrl = list[i].AttachUrl;
x.QuestionDef = list[i].QuestionDef;
if (!string.IsNullOrEmpty(list[i].QuestionType))
{
var qualityQuestionType = BLL.QualityQuestionTypeService.GetQualityQuestionType(list[i].QuestionType);
x.QuestionType = list[i].QuestionType + "$" + qualityQuestionType.QualityQuestionType
+ "$" + (qualityQuestionType.Type.HasValue&&qualityQuestionType.Type.Value==1? "建筑工程" : "安装工程");
}
x.RectifyOpinion = list[i].RectifyOpinion;
x.LimitDate = list[i].LimitDate;
x.CNProfessionalCode = list[i].CNProfessionalCode + "$" + list[i].CNProfessionalName;
x.AttachUrl = AttachFileService.getFileUrl(x.CheckControlCode);
x.ReAttachUrl = AttachFileService.getFileUrl(x.CheckControlCode + "r");
listRes.Add(x);
}
catch (Exception e)
{
}
}
return listRes;
}
}
// 查询数量
public static string GetListCountStr(string projectId, string searchWord, string unitId, string unitWork, string problemType, string professional, string dateA, string dateZ)
{
@@ -518,7 +445,6 @@ namespace BLL
x.CheckDate,
x.State,
x.CheckSite,
x.IsSubmit,
x.AttachUrl,
x.QuestionDef,
x.QuestionType,
@@ -546,7 +472,6 @@ namespace BLL
x.CheckMan = list[i].CheckMan + "$" + list[i].UnitWork + "$" + ConvertManAndID(list[i].CheckControlCode);
x.State = list[i].State;
x.CheckSite = list[i].CheckSite;
x.IsSubmit = list[i].IsSubmit;
x.AttachUrl = list[i].AttachUrl;
x.QuestionDef = list[i].QuestionDef;
if (!string.IsNullOrEmpty(list[i].QuestionType))
@@ -607,45 +532,16 @@ namespace BLL
using (var db = new Model.SGGLDB(Funs.ConnString))
{
Model.Check_CheckControl newCheckControl = db.Check_CheckControl.First(e => e.CheckControlCode == CheckControl.CheckControlCode);
if (!string.IsNullOrEmpty(CheckControl.DocCode))
newCheckControl.DocCode = CheckControl.DocCode;
if (!string.IsNullOrEmpty(CheckControl.UnitWorkId))
newCheckControl.UnitWorkId = CheckControl.UnitWorkId;
if (!string.IsNullOrEmpty(CheckControl.UnitId))
newCheckControl.UnitId = CheckControl.UnitId;
if (CheckControl.CheckDate.HasValue)
newCheckControl.CheckDate = CheckControl.CheckDate;
if (CheckControl.IsSubmit.HasValue)
newCheckControl.IsSubmit = CheckControl.IsSubmit;
if (!string.IsNullOrEmpty(CheckControl.SubmitMan))
newCheckControl.SubmitMan = CheckControl.SubmitMan;
if (CheckControl.IsOK.HasValue)
newCheckControl.IsOK = CheckControl.IsOK;
if (!string.IsNullOrEmpty(CheckControl.CNProfessionalCode))
newCheckControl.CNProfessionalCode = CheckControl.CNProfessionalCode;
if (!string.IsNullOrEmpty(CheckControl.QuestionType))
newCheckControl.QuestionType = CheckControl.QuestionType;
if (!string.IsNullOrEmpty(CheckControl.CheckSite))
newCheckControl.CheckSite = CheckControl.CheckSite;
if (!string.IsNullOrEmpty(CheckControl.QuestionDef))
newCheckControl.QuestionDef = CheckControl.QuestionDef;
if (CheckControl.LimitDate.HasValue)
newCheckControl.LimitDate = CheckControl.LimitDate;
if (!string.IsNullOrEmpty(CheckControl.RectifyOpinion))
newCheckControl.RectifyOpinion = CheckControl.RectifyOpinion;
if (!string.IsNullOrEmpty(CheckControl.AttachUrl))
newCheckControl.AttachUrl = CheckControl.AttachUrl;
if (!string.IsNullOrEmpty(CheckControl.HandleWay))
newCheckControl.HandleWay = CheckControl.HandleWay;
if (CheckControl.RectifyDate.HasValue)
newCheckControl.RectifyDate = CheckControl.RectifyDate;
if (!string.IsNullOrEmpty(CheckControl.ReAttachUrl))
newCheckControl.ReAttachUrl = CheckControl.ReAttachUrl;
if (!string.IsNullOrEmpty(CheckControl.State))
newCheckControl.State = CheckControl.State;
if (!string.IsNullOrEmpty(CheckControl.ProposeUnitId))
newCheckControl.ProposeUnitId = CheckControl.ProposeUnitId;
Model.Check_CheckControl item = db.Check_CheckControl.First(e => e.CheckControlCode == CheckControl.CheckControlCode);
item.DocCode = item.DocCode??CheckControl.DocCode;
item.UnitWorkId = item.UnitWorkId??CheckControl.UnitWorkId;
item.ReAttachUrl = item.ReAttachUrl??CheckControl.ReAttachUrl;
item.RectifyDate = item.RectifyDate??CheckControl.RectifyDate;
item.HandleWay = CheckControl.HandleWay;
item.State = CheckControl.State;
item.OKDescr = CheckControl.OKDescr;
item.IsOK = item.IsOK??CheckControl.IsOK;
db.SubmitChanges();
}
}