小程序

This commit is contained in:
2024-09-20 08:49:45 +08:00
parent 5f6e21c6ff
commit 1aeb40d1df
15 changed files with 1413 additions and 119 deletions
@@ -0,0 +1,393 @@
using Model.CQMS;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL.API.CQMS
{
public class ApiInspectionManagementService
{
public static bool AddInspectionManagement(InspectionManagement inspectionManagement)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
Model.ProcessControl_InspectionManagement newInspectionManagement = null;
if (!string.IsNullOrEmpty(inspectionManagement.InspectionId))
{
newInspectionManagement = db.ProcessControl_InspectionManagement.FirstOrDefault(x => x.InspectionId == inspectionManagement.InspectionId);
}
if (newInspectionManagement == null)
{
newInspectionManagement = new Model.ProcessControl_InspectionManagement();
newInspectionManagement.InspectionId = Guid.NewGuid().ToString();
}
newInspectionManagement.InspectionId = inspectionManagement.InspectionId;
newInspectionManagement.ProjectId = inspectionManagement.ProjectId;
newInspectionManagement.UnitId = inspectionManagement.UnitId;
newInspectionManagement.CNProfessionalId = inspectionManagement.CNProfessionalId;
newInspectionManagement.InspectionCode = inspectionManagement.InspectionCode;
newInspectionManagement.UnitWorkId = inspectionManagement.UnitWorkId;
newInspectionManagement.Branch = inspectionManagement.Branch;
newInspectionManagement.ControlPointType = inspectionManagement.ControlPointType;
newInspectionManagement.AcceptanceSite = inspectionManagement.AcceptanceSite;
newInspectionManagement.IsOnceQualified = inspectionManagement.IsOnceQualified == "true" ? true : false;
if (!string.IsNullOrEmpty(inspectionManagement.InspectionDate))
newInspectionManagement.InspectionDate = DateTime.Parse(inspectionManagement.InspectionDate);
newInspectionManagement.AttachUrl = inspectionManagement.AttachUrl;
newInspectionManagement.AttachUrl2 = inspectionManagement.AttachUrl2;
newInspectionManagement.NoticeCode = inspectionManagement.NoticeCode;
newInspectionManagement.ParentDivisionProjectId = inspectionManagement.ParentDivisionProjectId;
if (!string.IsNullOrEmpty(inspectionManagement.CheckDate))
newInspectionManagement.CheckDate = DateTime.Parse(inspectionManagement.CheckDate);
newInspectionManagement.CheckMan = inspectionManagement.CheckMan;
newInspectionManagement.CompileMan = inspectionManagement.CompileMan;
//newInspectionManagement.CompileMan2 = inspectionManagement.CompileMan2;
if (!string.IsNullOrEmpty(inspectionManagement.CompileDate))
newInspectionManagement.CompileDate = DateTime.Parse(inspectionManagement.CompileDate);
newInspectionManagement.UnqualifiedReason = inspectionManagement.UnqualifiedReason;
newInspectionManagement.AcceptanceCheckMan = inspectionManagement.AcceptanceCheckMan;
newInspectionManagement.FileType = inspectionManagement.FileType;
//newInspectionManagement.CCUnitIds = inspectionManagement.CCUnitIds;
//newInspectionManagement.MainSendUnitId = inspectionManagement.MainSendUnitId;
//newInspectionManagement.AuditMan = inspectionManagement.AuditMan;
//newInspectionManagement.Status = inspectionManagement.Status;
//if (!string.IsNullOrEmpty(inspectionManagement.PlanComplateDate))
// newInspectionManagement.PlanComplateDate = DateTime.Parse(inspectionManagement.PlanComplateDate);
db.ProcessControl_InspectionManagement.InsertOnSubmit(newInspectionManagement);
db.SubmitChanges();
foreach (var InspectionDetail in inspectionManagement.inspectionManagementDetails)
{
Model.ProcessControl_InspectionManagementDetail newInspectionDetail = new Model.ProcessControl_InspectionManagementDetail();
newInspectionDetail.InspectionDetailId = InspectionDetail.InspectionDetailId;
newInspectionDetail.InspectionId = newInspectionManagement.InspectionId;
newInspectionDetail.UnitWorkId = InspectionDetail.UnitWorkId;
newInspectionDetail.Branch = InspectionDetail.Branch;
newInspectionDetail.ControlPointType = InspectionDetail.ControlPointType;
if (!string.IsNullOrEmpty(InspectionDetail.CreateDate))
newInspectionDetail.CreateDate = DateTime.Parse(InspectionDetail.CreateDate);
db.ProcessControl_InspectionManagementDetail.InsertOnSubmit(newInspectionDetail);
}
db.SubmitChanges();
}
return true;
}
/// <summary>
/// 获取分部
/// </summary>
/// <param name="Branch"></param>
/// <returns></returns>
protected static string ConvertBranch(object Branch)
{
string name = string.Empty;
if (Branch != null)
{
var branch = BLL.DivisionProjectService.GetDivisionProjectById(Branch.ToString());
if (branch != null)
{
name = branch.DivisionName;
}
}
return name;
}
/// <summary>
/// 获取控制点内容
/// </summary>
/// <param name="ControlPointType"></param>
/// <returns></returns>
protected static string ConvertControlPointType(object ControlPointType)
{
string name = string.Empty;
if (ControlPointType != null)
{
var controlPointType = BLL.BreakdownProjectService.GetBreakdownProjectById(ControlPointType.ToString());
if (controlPointType != null)
{
name = controlPointType.BreakdownName;
}
}
return name;
}
/// <summary>
/// 获取控制点等级
/// </summary>
/// <param name="ControlPointType"></param>
/// <returns></returns>
protected static string ConvertClass(object ControlPointType)
{
string name = string.Empty;
if (ControlPointType != null)
{
var controlPointType = BLL.BreakdownProjectService.GetBreakdownProjectById(ControlPointType.ToString());
if (controlPointType != null)
{
name = controlPointType.Class;
}
}
return name;
}
public static List<InspectionManagementDetail> getInspectionManagementDetail(string projectId, int index, int page, string state, string name)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
var dataList = from x in db.ProcessControl_InspectionManagementDetail
where x.ProcessControl_InspectionManagement.ProjectId == projectId
select x;
var listRes = dataList.Skip(index * page).Take(page);
List<InspectionManagementDetail> list = new List<InspectionManagementDetail>();
foreach (var item in listRes)
{
InspectionManagementDetail detail = new InspectionManagementDetail()
{
InspectionDetailId = item.InspectionDetailId,
UnitWorkId = item.UnitWorkId,
UnitWorkName = db.WBS_UnitWork.FirstOrDefault(x => x.UnitWorkId == item.UnitWorkId).UnitWorkName,
ControlPointType = item.ControlPointType,
CreateDate = item.CreateDate.HasValue ? item.CreateDate.Value.ToString("yyyy-MM-dd") : "",
Branch = item.Branch,
BranchName= ConvertBranch(item.Branch),
ControlPointTypeName= ConvertControlPointType(item.ControlPointType),
ControlPointTypeLevel= ConvertClass(item.ControlPointType)
};
InspectionManagement inspectionManagement = new InspectionManagement();
inspectionManagement.InspectionId = item.ProcessControl_InspectionManagement.InspectionId;
inspectionManagement.ProjectId = item.ProcessControl_InspectionManagement.ProjectId;
inspectionManagement.ProjectName = db.Base_Project.FirstOrDefault(x => x.ProjectId == item.ProcessControl_InspectionManagement.ProjectId).ProjectName;
inspectionManagement.UnitId = item.ProcessControl_InspectionManagement.UnitId;
inspectionManagement.UnitName = db.Base_Unit.FirstOrDefault(x => x.UnitId == item.ProcessControl_InspectionManagement.UnitId).UnitName;
inspectionManagement.CNProfessionalId = item.ProcessControl_InspectionManagement.CNProfessionalId;
if (!string.IsNullOrEmpty(inspectionManagement.CNProfessionalId))
{
inspectionManagement.CNProfessionalName = db.Base_CNProfessional.FirstOrDefault(x => x.CNProfessionalId == item.ProcessControl_InspectionManagement.CNProfessionalId).ProfessionalName;
}
inspectionManagement.InspectionCode = item.ProcessControl_InspectionManagement.InspectionCode;
inspectionManagement.UnitWorkId = item.ProcessControl_InspectionManagement.UnitWorkId;
if (!string.IsNullOrEmpty(inspectionManagement.UnitWorkId))
{
inspectionManagement.UnitWorkName = db.WBS_UnitWork.FirstOrDefault(x => x.UnitWorkId == item.ProcessControl_InspectionManagement.UnitWorkId).UnitWorkName;
}
inspectionManagement.Branch = item.ProcessControl_InspectionManagement.Branch;
inspectionManagement.ControlPointType = item.ProcessControl_InspectionManagement.ControlPointType;
inspectionManagement.AcceptanceSite = item.ProcessControl_InspectionManagement.AcceptanceSite;
inspectionManagement.IsOnceQualified = item.ProcessControl_InspectionManagement.IsOnceQualified.HasValue ? item.ProcessControl_InspectionManagement.IsOnceQualified.Value.ToString() : "";
inspectionManagement.InspectionDate = item.ProcessControl_InspectionManagement.InspectionDate.HasValue ? "" : "";
inspectionManagement.AttachUrl = item.ProcessControl_InspectionManagement.AttachUrl;
inspectionManagement.CheckDate = item.ProcessControl_InspectionManagement.CheckDate.HasValue ? item.ProcessControl_InspectionManagement.CheckDate.Value.ToString("yyyy-MM-dd") : "";
inspectionManagement.CheckMan = item.ProcessControl_InspectionManagement.CheckMan;
inspectionManagement.CheckMan = item.ProcessControl_InspectionManagement.CheckMan;
inspectionManagement.UnqualifiedReason = item.ProcessControl_InspectionManagement.UnqualifiedReason;
inspectionManagement.NoticeCode = item.ProcessControl_InspectionManagement.NoticeCode;
inspectionManagement.AcceptanceCheckMan = item.ProcessControl_InspectionManagement.AcceptanceCheckMan;
inspectionManagement.ParentDivisionProjectId = item.ProcessControl_InspectionManagement.ParentDivisionProjectId;
inspectionManagement.CompileMan = item.ProcessControl_InspectionManagement.CompileMan;
if (!string.IsNullOrEmpty(inspectionManagement.CompileMan))
{
inspectionManagement.CompileManName = db.Sys_User.FirstOrDefault(x => x.UserId == item.ProcessControl_InspectionManagement.CompileMan).UserName; //item.ProcessControl_InspectionManagement.CompileManName;
}
inspectionManagement.CompileDate = item.ProcessControl_InspectionManagement.CompileDate.HasValue ? item.ProcessControl_InspectionManagement.CompileDate.Value.ToString("yyyy-MM-dd") : "";
inspectionManagement.FileType = item.ProcessControl_InspectionManagement.FileType;
inspectionManagement.AttachUrl2 = item.ProcessControl_InspectionManagement.AttachUrl2;
//inspectionManagement.MainSendUnitId = item.ProcessControl_InspectionManagement.MainSendUnitId;
if (!string.IsNullOrEmpty(inspectionManagement.MainSendUnitId))
inspectionManagement.MainSendUnitName = UnitService.getUnitNamesUnitIds(inspectionManagement.MainSendUnitId);//item.ProcessControl_InspectionManagement.MainSendUnitName;
//inspectionManagement.CCUnitIds = item.ProcessControl_InspectionManagement.CCUnitIds;
if (!string.IsNullOrEmpty(inspectionManagement.CCUnitIds))
{
inspectionManagement.CCUnitName = UnitService.getUnitNamesUnitIds(inspectionManagement.CCUnitIds);// item.ProcessControl_InspectionManagement.CCUnitName;
}
//inspectionManagement.PlanComplateDate = item.ProcessControl_InspectionManagement.PlanComplateDate.HasValue ? item.ProcessControl_InspectionManagement.PlanComplateDate.Value.ToString("yyyy-MM-dd") : "";
//inspectionManagement.Status = item.ProcessControl_InspectionManagement.Status;
//inspectionManagement.CompileMan2 = item.ProcessControl_InspectionManagement.CompileMan2;
//inspectionManagement.AuditMan = item.ProcessControl_InspectionManagement.AuditMan;
//if (!string.IsNullOrEmpty(inspectionManagement.AuditMan))
//{ inspectionManagement.AuditManName = db.Sys_User.FirstOrDefault(x => x.UserId == item.ProcessControl_InspectionManagement.AuditMan).UserName; }
detail.inspectionManagement = inspectionManagement;
list.Add(detail);
}
return list;
}
}
public static List<InspectionManagement> getInspectionManagement(string projectId, int index, int page, string state, string name)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
var dataList = from x in db.ProcessControl_InspectionManagement
where x.ProjectId == projectId
select x;
var listRes = dataList.Skip(index * page).Take(page);
List<InspectionManagement> list = new List<InspectionManagement>();
foreach (var item in listRes)
{
InspectionManagement inspectionManagement = new InspectionManagement();
inspectionManagement.InspectionId = item.InspectionId;
inspectionManagement.ProjectId = item.ProjectId;
inspectionManagement.ProjectName = db.Base_Project.FirstOrDefault(x => x.ProjectId == item.ProjectId).ProjectName;
inspectionManagement.UnitId = item.UnitId;
inspectionManagement.UnitName = db.Base_Unit.FirstOrDefault(x => x.UnitId == item.UnitId).UnitName;
inspectionManagement.CNProfessionalId = item.CNProfessionalId;
if (!string.IsNullOrEmpty(inspectionManagement.CNProfessionalId))
{
inspectionManagement.CNProfessionalName = db.Base_CNProfessional.FirstOrDefault(x => x.CNProfessionalId == item.CNProfessionalId).ProfessionalName;
}
inspectionManagement.InspectionCode = item.InspectionCode;
inspectionManagement.UnitWorkId = item.UnitWorkId;
if (!string.IsNullOrEmpty(inspectionManagement.UnitWorkId))
{
inspectionManagement.UnitWorkName = db.WBS_UnitWork.FirstOrDefault(x => x.UnitWorkId == item.UnitWorkId).UnitWorkName;
}
inspectionManagement.Branch = item.Branch;
inspectionManagement.ControlPointType = item.ControlPointType;
inspectionManagement.AcceptanceSite = item.AcceptanceSite;
inspectionManagement.IsOnceQualified = item.IsOnceQualified.HasValue ? item.IsOnceQualified.Value.ToString() : "";
inspectionManagement.InspectionDate = item.InspectionDate.HasValue ? "" : "";
inspectionManagement.AttachUrl = item.AttachUrl;
inspectionManagement.CheckDate = item.CheckDate.HasValue ? item.CheckDate.Value.ToString("yyyy-MM-dd") : "";
inspectionManagement.CheckMan = item.CheckMan;
inspectionManagement.CheckMan = item.CheckMan;
inspectionManagement.UnqualifiedReason = item.UnqualifiedReason;
inspectionManagement.NoticeCode = item.NoticeCode;
inspectionManagement.AcceptanceCheckMan = item.AcceptanceCheckMan;
inspectionManagement.ParentDivisionProjectId = item.ParentDivisionProjectId;
inspectionManagement.CompileMan = item.CompileMan;
if (!string.IsNullOrEmpty(inspectionManagement.CompileMan))
{
inspectionManagement.CompileManName = db.Sys_User.FirstOrDefault(x => x.UserId == item.CompileMan).UserName; //item.CompileManName;
}
inspectionManagement.CompileDate = item.CompileDate.HasValue ? item.CompileDate.Value.ToString("yyyy-MM-dd") : "";
inspectionManagement.FileType = item.FileType;
inspectionManagement.AttachUrl2 = item.AttachUrl2;
//inspectionManagement.MainSendUnitId = item.MainSendUnitId;
if (!string.IsNullOrEmpty(inspectionManagement.MainSendUnitId))
inspectionManagement.MainSendUnitName = UnitService.getUnitNamesUnitIds(inspectionManagement.MainSendUnitId);//item.MainSendUnitName;
//inspectionManagement.CCUnitIds = item.CCUnitIds;
if (!string.IsNullOrEmpty(inspectionManagement.CCUnitIds))
{
inspectionManagement.CCUnitName = UnitService.getUnitNamesUnitIds(inspectionManagement.CCUnitIds);// item.CCUnitName;
}
//inspectionManagement.PlanComplateDate = item.PlanComplateDate.HasValue ? item.PlanComplateDate.Value.ToString("yyyy-MM-dd") : "";
//inspectionManagement.Status = item.Status;
//inspectionManagement.CompileMan2 = item.CompileMan2;
//inspectionManagement.AuditMan = item.AuditMan;
//if (!string.IsNullOrEmpty(inspectionManagement.AuditMan))
//{ inspectionManagement.AuditManName = db.Sys_User.FirstOrDefault(x => x.UserId == item.AuditMan).UserName; }
list.Add(inspectionManagement);
}
return list;
}
}
public static List<InspectionManagementDetail> getInspectionManagementDetailByinspectionId(string inspectionId)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
var dataList = from x in db.ProcessControl_InspectionManagementDetail
where x.InspectionId == inspectionId
select x;
var listRes = dataList.ToList();
List<InspectionManagementDetail> list = new List<InspectionManagementDetail>();
foreach (var item in listRes)
{
InspectionManagementDetail detail = new InspectionManagementDetail(){ };
detail.InspectionDetailId = item.InspectionDetailId;
detail.UnitWorkId = item.UnitWorkId;
detail.UnitWorkName = db.WBS_UnitWork.FirstOrDefault(x => x.UnitWorkId == item.UnitWorkId).UnitWorkName;
detail.ControlPointType = item.ControlPointType;
detail.CreateDate = item.CreateDate.HasValue ? item.CreateDate.Value.ToString("yyyy-MM-dd") : "";
detail.Branch = item.Branch;
detail.BranchName = ConvertBranch(item.Branch);
detail.ControlPointTypeName = ConvertControlPointType(item.ControlPointType);
detail.ControlPointTypeLevel = ConvertClass(item.ControlPointType);
InspectionManagement inspectionManagement = new InspectionManagement();
inspectionManagement.InspectionId = item.ProcessControl_InspectionManagement.InspectionId;
inspectionManagement.ProjectId = item.ProcessControl_InspectionManagement.ProjectId;
inspectionManagement.ProjectName = db.Base_Project.FirstOrDefault(x => x.ProjectId == item.ProcessControl_InspectionManagement.ProjectId).ProjectName;
inspectionManagement.UnitId = item.ProcessControl_InspectionManagement.UnitId;
inspectionManagement.UnitName = db.Base_Unit.FirstOrDefault(x => x.UnitId == item.ProcessControl_InspectionManagement.UnitId).UnitName;
inspectionManagement.CNProfessionalId = item.ProcessControl_InspectionManagement.CNProfessionalId;
if (!string.IsNullOrEmpty(inspectionManagement.CNProfessionalId))
{
inspectionManagement.CNProfessionalName = db.Base_CNProfessional.FirstOrDefault(x => x.CNProfessionalId == item.ProcessControl_InspectionManagement.CNProfessionalId).ProfessionalName;
}
inspectionManagement.InspectionCode = item.ProcessControl_InspectionManagement.InspectionCode;
inspectionManagement.UnitWorkId = item.ProcessControl_InspectionManagement.UnitWorkId;
if (!string.IsNullOrEmpty(inspectionManagement.UnitWorkId))
{
inspectionManagement.UnitWorkName = db.WBS_UnitWork.FirstOrDefault(x => x.UnitWorkId == item.ProcessControl_InspectionManagement.UnitWorkId).UnitWorkName;
}
inspectionManagement.Branch = item.ProcessControl_InspectionManagement.Branch;
inspectionManagement.ControlPointType = item.ProcessControl_InspectionManagement.ControlPointType;
inspectionManagement.AcceptanceSite = item.ProcessControl_InspectionManagement.AcceptanceSite;
inspectionManagement.IsOnceQualified = item.ProcessControl_InspectionManagement.IsOnceQualified.HasValue ? item.ProcessControl_InspectionManagement.IsOnceQualified.Value.ToString() : "";
inspectionManagement.InspectionDate = item.ProcessControl_InspectionManagement.InspectionDate.HasValue ? "" : "";
//inspectionManagement.AttachUrl = item.ProcessControl_InspectionManagement.AttachUrl;
inspectionManagement.AttachUrl = APIUpLoadFileService.getFileUrl(item.InspectionId, null);
inspectionManagement.CheckDate = item.ProcessControl_InspectionManagement.CheckDate.HasValue ? item.ProcessControl_InspectionManagement.CheckDate.Value.ToString("yyyy-MM-dd") : "";
inspectionManagement.CheckMan = item.ProcessControl_InspectionManagement.CheckMan;
inspectionManagement.CheckMan = item.ProcessControl_InspectionManagement.CheckMan;
inspectionManagement.UnqualifiedReason = item.ProcessControl_InspectionManagement.UnqualifiedReason;
inspectionManagement.NoticeCode = item.ProcessControl_InspectionManagement.NoticeCode;
inspectionManagement.AcceptanceCheckMan = item.ProcessControl_InspectionManagement.AcceptanceCheckMan;
inspectionManagement.ParentDivisionProjectId = item.ProcessControl_InspectionManagement.ParentDivisionProjectId;
inspectionManagement.CompileMan = item.ProcessControl_InspectionManagement.CompileMan;
if (!string.IsNullOrEmpty(inspectionManagement.CompileMan))
{
inspectionManagement.CompileManName = db.Sys_User.FirstOrDefault(x => x.UserId == item.ProcessControl_InspectionManagement.CompileMan).UserName; //item.ProcessControl_InspectionManagement.CompileManName;
}
inspectionManagement.CompileDate = item.ProcessControl_InspectionManagement.CompileDate.HasValue ? item.ProcessControl_InspectionManagement.CompileDate.Value.ToString("yyyy-MM-dd") : "";
inspectionManagement.FileType = item.ProcessControl_InspectionManagement.FileType;
inspectionManagement.AttachUrl2 = item.ProcessControl_InspectionManagement.AttachUrl2;
//inspectionManagement.MainSendUnitId = item.ProcessControl_InspectionManagement.MainSendUnitId;
if (!string.IsNullOrEmpty(inspectionManagement.MainSendUnitId))
inspectionManagement.MainSendUnitName = UnitService.getUnitNamesUnitIds(inspectionManagement.MainSendUnitId);//item.ProcessControl_InspectionManagement.MainSendUnitName;
//inspectionManagement.CCUnitIds = item.ProcessControl_InspectionManagement.CCUnitIds;
if (!string.IsNullOrEmpty(inspectionManagement.CCUnitIds))
{
inspectionManagement.CCUnitName = UnitService.getUnitNamesUnitIds(inspectionManagement.CCUnitIds);// item.ProcessControl_InspectionManagement.CCUnitName;
}
//inspectionManagement.PlanComplateDate = item.ProcessControl_InspectionManagement.PlanComplateDate.HasValue ? item.ProcessControl_InspectionManagement.PlanComplateDate.Value.ToString("yyyy-MM-dd") : "";
//inspectionManagement.Status = item.ProcessControl_InspectionManagement.Status;
//inspectionManagement.CompileMan2 = item.ProcessControl_InspectionManagement.CompileMan2;
//inspectionManagement.AuditMan = item.ProcessControl_InspectionManagement.AuditMan;
//if (!string.IsNullOrEmpty(inspectionManagement.AuditMan))
//{ inspectionManagement.AuditManName = db.Sys_User.FirstOrDefault(x => x.UserId == item.ProcessControl_InspectionManagement.AuditMan).UserName; }
detail.inspectionManagement = inspectionManagement;
list.Add(detail);
}
return list;
}
}
}
}
@@ -0,0 +1,51 @@
using Model.CQMS;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL.API.CQMS
{
public class BreakdownProjectService
{
public static List<BreakdownProject> getBreakdowns(string projectId, string keyWord)
{
List<BreakdownProject> res = new List<BreakdownProject>();
using (var db = new Model.SGGLDB(Funs.ConnString))
{
var q = from x in db.View_WBS_BreakdownProject
where x.ProjectId == projectId && x.IsSelected == true
where keyWord == "" || x.BreakdownName.Contains(keyWord)
select x;
var list = q.ToList();
foreach (var item in list)
{
BreakdownProject breakdownProject = new BreakdownProject();
breakdownProject.AttachUrl = item.AttachUrl;
breakdownProject.BreakdownProjectId = item.BreakdownProjectId;
breakdownProject.ProjectId = item.ProjectId;
breakdownProject.BreakdownCode = item.BreakdownCode;
breakdownProject.BreakdownName = item.BreakdownName;
breakdownProject.DivisionProjectId = item.DivisionProjectId;
breakdownProject.Basis = item.Basis;
breakdownProject.CheckPoints = item.CheckPoints;
breakdownProject.RecordAndCode = item.RecordAndCode;
breakdownProject.Class = item.Class;
breakdownProject.SortIndex = item.SortIndex.HasValue ? item.SortIndex.Value.ToString() : "";
breakdownProject.Remark = item.Remark;
breakdownProject.AttachUrl = item.AttachUrl;
breakdownProject.IsAcceptance = item.IsAcceptance.HasValue ? item.IsAcceptance.Value.ToString() : "";
breakdownProject.FenBao = item.FenBao;
breakdownProject.WuHuan = item.WuHuan;
breakdownProject.JianLi = item.JianLi;
breakdownProject.YeZhu = item.YeZhu;
breakdownProject.IsSelected = item.IsSelected.HasValue ? "" : "";
res.Add(breakdownProject);
}
}
return res;
}
}
}
@@ -0,0 +1,349 @@
using System;
using System.Collections.Generic;
using System.Data.Linq.SqlClient;
using System.Linq;
namespace BLL
{
public class QualityAssuranceService
{
#region
public class Comprehensive_DesignDetailsDto : Model.Comprehensive_DesignDetails {
/// <summary>
/// 专业名称
/// </summary>
public string ProfessionalName { get; set; }
/// <summary>
/// 单位工程名称
/// </summary>
public string UnitWorkNames { get; set; }
/// <summary>
/// 单位名称
/// </summary>
public string UnitNames { get; set; }
public string DetailsDates { get; set; }
}
/// <summary>
/// 设计交底列表
/// </summary>
/// <param name="projectId"></param>
/// <returns></returns>
public static List<Comprehensive_DesignDetailsDto> getDesignDetailsList(string projectId,string cNProfessionalId="") {
var list = (from x in Funs.DB.Comprehensive_DesignDetails
join y in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals y.CNProfessionalId
where x.ProjectId == projectId
select new Comprehensive_DesignDetailsDto()
{
DesignDetailsId=x.DesignDetailsId,
CNProfessionalId=x.CNProfessionalId,
ProfessionalName = y.ProfessionalName,
DesignDetailsCode=x.DesignDetailsCode,
DetailsMan=x.DetailsMan,
DetailsDates = string.Format("{0:yyyy-MM-dd}", x.DetailsDate),
UnitWorkNames= ConvertUnitWork(x.UnitWorkId),
UnitNames= ConvertCarryUnit(x.UnitName),
}).ToList();
if (!string.IsNullOrEmpty(cNProfessionalId))
{
list = list.Where(x => x.CNProfessionalId == cNProfessionalId).ToList();
}
return list;
}
public static Comprehensive_DesignDetailsDto getDesignDetails(string Id)
{
var list = (from x in Funs.DB.Comprehensive_DesignDetails
join y in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals y.CNProfessionalId
where x.DesignDetailsId == Id
select new Comprehensive_DesignDetailsDto()
{
DesignDetailsId = x.DesignDetailsId,
ProfessionalName = y.ProfessionalName,
DesignDetailsCode = x.DesignDetailsCode,
DetailsMan = x.DetailsMan,
DetailsDates = string.Format("{0:yyyy-MM-dd}", x.DetailsDate),
UnitWorkNames = ConvertUnitWork(x.UnitWorkId),
UnitNames = ConvertCarryUnit(x.UnitName),
JoinPersonNum=x.JoinPersonNum,
RemarCode = x.RemarCode,
AttachUrl = APIUpLoadFileService.getFileUrl(x.DesignDetailsId, null),
}).First();
return list;
}
/// <summary>
/// 获取单位工程名称
/// </summary>
/// <param name="CarryUnitWorks"></param>
/// <returns></returns>
protected static string ConvertUnitWork(object CarryUnitWorks)
{
string CarryUnitWorkName = string.Empty;
if (CarryUnitWorks != null)
{
string[] Ids = CarryUnitWorks.ToString().Split(',');
foreach (string t in Ids)
{
var UnitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(t);
if (UnitWork != null)
{
CarryUnitWorkName += UnitWork.UnitWorkName + ",";
}
}
}
if (CarryUnitWorkName != string.Empty)
{
return CarryUnitWorkName.Substring(0, CarryUnitWorkName.Length - 1);
}
else
{
return "";
}
}
/// <summary>
/// 获取单位名称
/// </summary>
/// <param name="CarryUnitIds"></param>
/// <returns></returns>
protected static string ConvertCarryUnit(object CarryUnitIds)
{
string CarryUnitName = string.Empty;
if (CarryUnitIds != null)
{
string[] Ids = CarryUnitIds.ToString().Split(',');
foreach (string t in Ids)
{
var type = BLL.UnitService.GetUnitByUnitId(t);
if (type != null)
{
CarryUnitName += type.UnitName + ",";
}
}
}
if (CarryUnitName != string.Empty)
{
return CarryUnitName.Substring(0, CarryUnitName.Length - 1);
}
else
{
return "";
}
}
#endregion
#region
public class Comprehensive_ReviewDrawingsDto : Model.Comprehensive_ReviewDrawings {
public string ProfessionalName { get; set; }
public string ReviewDates { get; set; }
public string UnitWorkNames { get; set; }
public string ReceiveUnitss { get; set; }
public string AttachUrl { get; set; }
}
/// <summary>
/// 图纸会审列表
/// </summary>
/// <param name="projectId"></param>
/// <param name="cNProfessionalId"></param>
/// <returns></returns>
public static List<Comprehensive_ReviewDrawingsDto> getReviewDrawingsList(string projectId, string cNProfessionalId = "")
{
var list = (from x in Funs.DB.Comprehensive_ReviewDrawings
join y in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals y.CNProfessionalId
where x.ProjectId == projectId
select new Comprehensive_ReviewDrawingsDto
{
Id = x.Id,
CNProfessionalId = x.CNProfessionalId,
ProfessionalName = y.ProfessionalName,
DraCode = x.DraCode,
UnitWorkNames = ConvertUnitWork(x.UnitWorkId),
ReceiveUnitss = ConvertCarryUnit(x.ReceiveUnits),
ReviewDates = string.Format("{0:yyyy-MM-dd}", x.ReviewDate),
}).ToList();
if (!string.IsNullOrEmpty(cNProfessionalId))
{
list = list.Where(x => x.CNProfessionalId == cNProfessionalId).ToList();
}
return list;
}
/// <summary>
/// 图纸会审详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public static Comprehensive_ReviewDrawingsDto getReviewDrawings(string Id) {
var list = (from x in Funs.DB.Comprehensive_ReviewDrawings
join y in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals y.CNProfessionalId
where x.Id == Id
select new Comprehensive_ReviewDrawingsDto
{
Id = x.Id,
CNProfessionalId = x.CNProfessionalId,
ProfessionalName = y.ProfessionalName,
DraCode=x.DraCode,
UnitWorkNames = ConvertUnitWork(x.UnitWorkId),
ReceiveUnitss = ConvertCarryUnit(x.ReceiveUnits),
ReviewDates = string.Format("{0:yyyy-MM-dd}", x.ReviewDate),
RemarkCode=x.RemarkCode,
Remarks=x.Remarks,
AttachUrl= APIUpLoadFileService.getFileUrl(x.Id, null),
}).First();
return list;
}
#endregion
#region
public class Comprehensive_ConTechnologyDisclosureDto : Model.Comprehensive_ConTechnologyDisclosure {
public string ProfessionalName { get; set; }
public string UnitName { get; set; }
public string UnitWorkNames { get; set; }
public string DisclosureDates { get; set; }
}
public static List<Comprehensive_ConTechnologyDisclosureDto> getConTechnologyDisclosureList(string projectId, string cNProfessionalId = "") {
var list = (from x in Funs.DB.Comprehensive_ConTechnologyDisclosure
join y in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals y.CNProfessionalId
join z in Funs.DB.Base_Unit on x.UnitId equals z.UnitId
where x.ProjectId == projectId
select new Comprehensive_ConTechnologyDisclosureDto
{
ConTechnologyDisclosureId=x.ConTechnologyDisclosureId,
ProfessionalName = y.ProfessionalName,
DisclosureCode=x.DisclosureCode,
DisclosureName=x.DisclosureName,
UnitName=z.UnitName,
DisclosureMan=x.DisclosureMan,
DisclosureDates = string.Format("{0:yyyy-MM-dd}", x.DisclosureDate),
UnitWorkNames= ConvertUnitWork(x.UnitWorkId),
AttendMan=x.AttendMan,
}).ToList();
if (!string.IsNullOrEmpty(cNProfessionalId))
{
list = list.Where(x => x.CNProfessionalId == cNProfessionalId).ToList();
}
return list;
}
public static Comprehensive_ConTechnologyDisclosureDto getConTechnologyDisclosure(string Id) {
var list = (from x in Funs.DB.Comprehensive_ConTechnologyDisclosure
join y in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals y.CNProfessionalId
join z in Funs.DB.Base_Unit on x.UnitId equals z.UnitId
where x.ConTechnologyDisclosureId == Id
select new Comprehensive_ConTechnologyDisclosureDto
{
ConTechnologyDisclosureId = x.ConTechnologyDisclosureId,
ProfessionalName = y.ProfessionalName,
DisclosureCode = x.DisclosureCode,
DisclosureName = x.DisclosureName,
UnitName = z.UnitName,
DisclosureMan = x.DisclosureMan,
DisclosureDates = string.Format("{0:yyyy-MM-dd}", x.DisclosureDate),
UnitWorkNames = ConvertUnitWork(x.UnitWorkId),
RemarkCode=x.RemarkCode,
AttendMan = x.AttendMan,
}).First();
return list;
}
#endregion
#region
public class Comprehensive_InspectionPersonDto : Model.Comprehensive_InspectionPerson {
public string UnitName { get; set; }
public string ProfessionalName { get; set; }
public string UnitWorkNames { get; set; }
public string PostName { get; set; }
public string ValidityDates { get; set; }
public string ApprovalTimes { get; set; }
public string DepartureTimes { get; set; }
}
/// <summary>
/// 人员报验列表
/// </summary>
/// <param name="projectId"></param>
/// <param name="searchText"></param>
/// <returns></returns>
public static List<Comprehensive_InspectionPersonDto> getInspectionPersonList(string projectId, string searchText = "") {
var list = (from x in Funs.DB.Comprehensive_InspectionPerson
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
join Cn in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals Cn.CNProfessionalId
join z in Funs.DB.Base_Post on x.PostId equals z.PostId
where x.ProjectId==projectId
select new Comprehensive_InspectionPersonDto
{
}).ToList();
return list;
}
/// <summary>
/// 详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public static Comprehensive_InspectionPersonDto getInspectionPerson(string Id)
{
var list = (from x in Funs.DB.Comprehensive_InspectionPerson
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
join Cn in Funs.DB.Base_CNProfessional on x.CNProfessionalId equals Cn.CNProfessionalId
join z in Funs.DB.Base_Post on x.PostId equals z.PostId
where x.InspectionPersonId ==Id
select new Comprehensive_InspectionPersonDto
{
}).First();
return list;
}
#endregion
#region
#endregion
#region
#endregion
#region
#endregion
#region
#endregion
#region
#endregion
#region
#endregion
#region
#endregion
}
}