1366 lines
59 KiB
C#
1366 lines
59 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Http;
|
|
using BLL;
|
|
using System.Data.SqlClient;
|
|
|
|
namespace WebAPI.Controllers.Customization._7HJ
|
|
{
|
|
public class Api_7HJ_CqmsController : ApiController
|
|
{
|
|
#region 质量人员和焊工人员详情
|
|
|
|
/// <summary>
|
|
/// 获取企业总部人员数据列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getCompanyPerson()
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
var getLists = (
|
|
from p in db.Person_CompanyBranchPerson
|
|
join u in db.Base_Unit on p.UnitId equals u.UnitId into unitGroup
|
|
from unit in unitGroup.DefaultIfEmpty()
|
|
join wp in db.Base_WorkPost on p.WorkPostId equals wp.WorkPostId into postGroup
|
|
from workPost in postGroup.DefaultIfEmpty()
|
|
let filteredItem = new Model.Customization._7HJ.CompanyBranchPersonData
|
|
{
|
|
CompanyBranchPersonId = p.CompanyBranchPersonId,
|
|
UnitName = unit.UnitName,
|
|
PersonName = p.PersonName,
|
|
SexStr = p.Sex.Equals('1') ? "男" : "女",
|
|
IdentityCard = p.IdentityCard,
|
|
WorkPostName = workPost.WorkPostName,
|
|
Telephone = p.Telephone,
|
|
IsOnJob = p.IsOnJob,
|
|
Remark = p.Remark,
|
|
UnitId = unit.UnitId,
|
|
WorkPostId = workPost.WorkPostId,
|
|
IsHsse = workPost.IsHsse
|
|
}
|
|
where (unit.UnitId == CommonService.GetThisUnitId())
|
|
&& (workPost.WorkPostId == Const.WorkPost_HSSEDirector || workPost.IsHsse == true)
|
|
select filteredItem
|
|
).ToList();
|
|
responeData.data = new { getLists };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 获取分支机构人员数据列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getBranchesPerson()
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
var getLists = (
|
|
from p in db.Person_CompanyBranchPerson
|
|
join u in db.Base_Unit on p.UnitId equals u.UnitId into unitGroup
|
|
from unit in unitGroup.DefaultIfEmpty()
|
|
join wp in db.Base_WorkPost on p.WorkPostId equals wp.WorkPostId into postGroup
|
|
from workPost in postGroup.DefaultIfEmpty()
|
|
let filteredItem = new Model.Customization._7HJ.CompanyBranchPersonData
|
|
{
|
|
CompanyBranchPersonId = p.CompanyBranchPersonId,
|
|
UnitName = unit.UnitName,
|
|
PersonName = p.PersonName,
|
|
SexStr = p.Sex.Equals('1') ? "男" : "女",
|
|
IdentityCard = p.IdentityCard,
|
|
WorkPostName = workPost.WorkPostName,
|
|
Telephone = p.Telephone,
|
|
IsOnJob = p.IsOnJob,
|
|
Remark = p.Remark,
|
|
UnitId = unit.UnitId,
|
|
WorkPostId = workPost.WorkPostId,
|
|
IsHsse = workPost.IsHsse
|
|
}
|
|
where (unit.UnitId != CommonService.GetThisUnitId())
|
|
&& (workPost.WorkPostId == Const.WorkPost_HSSEDirector || workPost.IsHsse == true)
|
|
select filteredItem
|
|
).ToList();
|
|
responeData.data = new { getLists };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 根据项目获取质量人员数据列表
|
|
/// </summary>
|
|
/// <param name="projectId"> </param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getQualityPersonByProjectId(string projectId)
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
// var getLists = (
|
|
// from person in db.SitePerson_Person
|
|
// join project in db.Base_Project on person.ProjectId equals project.ProjectId into projectJoin
|
|
// from project in projectJoin.DefaultIfEmpty()
|
|
// join unit in db.Base_Unit on person.UnitId equals unit.UnitId into unitJoin
|
|
// from unit in unitJoin.DefaultIfEmpty()
|
|
// join workPost in db.Base_WorkPost on person.WorkPostId equals workPost.WorkPostId into workPostJoin
|
|
// from workPost in workPostJoin.DefaultIfEmpty()
|
|
// where (person.ProjectId == projectId && workPost.IsCQMS.HasValue == true && workPost.IsCQMS == true)
|
|
// select new
|
|
// {
|
|
// ID = person.PersonId,
|
|
// unit.UnitName,
|
|
// project.ProjectName,
|
|
// person.PersonName,
|
|
// SexStr = person.Sex == "1" ? "男" : (person.Sex == "2" ? "女" : "男"),
|
|
// person.IdentityCard,
|
|
// workPost.WorkPostName,
|
|
// person.Telephone,
|
|
// person.Remark
|
|
// }
|
|
// ).ToList();
|
|
|
|
|
|
string strSql =
|
|
@"SELECT DISTINCT ProjectUser.ProjectUserId,ProjectUser.ProjectId,ProjectUser.UserId,ProjectUser.WorkAreaId,Users.UserCode,Users.UserName,ProjectUser.UnitId,Unit.UnitCode,Unit.UnitName,ProjectUnit.UnitType,sysConst.ConstText AS UnitTypeName,ProjectUser.RoleId,ProjectUser.IsPost,(CASE WHEN ProjectUser.IsPost = 1 THEN '在岗' ELSE '离岗' END) AS IsPostName,WorkPost.WorkPostName,UnitCode"
|
|
+ @" ,RoleName= STUFF(( SELECT ',' + RoleName FROM dbo.Sys_Role where PATINDEX('%,' + RTRIM(RoleId) + ',%',',' +ProjectUser.RoleId + ',')>0 FOR XML PATH('')), 1, 1,'')"
|
|
+ @" FROM Project_ProjectUser AS ProjectUser "
|
|
+ @" LEFT JOIN Base_Project AS Project ON ProjectUser.ProjectId = Project.ProjectId "
|
|
+ @" LEFT JOIN Sys_User AS Users ON ProjectUser.UserId = Users.UserId "
|
|
+ @" LEFT JOIN Sys_Role AS Role ON ProjectUser.RoleId = Role.RoleId "
|
|
+ @" LEFT JOIN Project_ProjectUnit AS ProjectUnit ON ProjectUser.UnitId = ProjectUnit.UnitId AND ProjectUser.ProjectId= ProjectUnit.ProjectId "
|
|
+ @" LEFT JOIN Base_Unit AS Unit ON ProjectUser.UnitId = Unit.UnitId "
|
|
+ @" LEFT JOIN SitePerson_Person AS Person ON ProjectUser.ProjectId =Person.ProjectId AND Users.IdentityCard = Person.IdentityCard "
|
|
+ @" LEFT JOIN Base_WorkPost AS WorkPost ON Person.WorkPostId =WorkPost.WorkPostId "
|
|
+ @" LEFT JOIN Sys_Const AS sysConst ON sysConst.GroupId = '" +
|
|
BLL.ConstValue.Group_ProjectUnitType + "' AND ProjectUnit.UnitType=sysConst.ConstValue "
|
|
+ @" WHERE 1=1 ";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
strSql += " AND ProjectUser.ProjectId = @ProjectId";
|
|
listStr.Add(new SqlParameter("@ProjectId", projectId));
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable data = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
string filterExpression = "RoleName LIKE '%质量%' OR WorkPostName LIKE '%质量%'";
|
|
DataTable getLists = data.Select(filterExpression).CopyToDataTable();
|
|
Debug.WriteLine(getLists.Rows.Count);
|
|
responeData.data = new { getLists };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 根据主键查询人员明细数据
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getQualityPersonById(string id)
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
var query = (from pu in db.Project_ProjectUser
|
|
join p in db.Base_Project on pu.ProjectId equals p.ProjectId into projectJoin
|
|
from p in projectJoin.DefaultIfEmpty()
|
|
join u in db.Sys_User on pu.UserId equals u.UserId into userJoin
|
|
from u in userJoin.DefaultIfEmpty()
|
|
join r in db.Sys_Role on pu.RoleId equals r.RoleId into roleJoin
|
|
from r in roleJoin.DefaultIfEmpty()
|
|
join puUnit in db.Project_ProjectUnit on new { pu.UnitId, pu.ProjectId } equals new
|
|
{ puUnit.UnitId, puUnit.ProjectId } into projectUnitJoin
|
|
from puUnit in projectUnitJoin.DefaultIfEmpty()
|
|
join unit in db.Base_Unit on pu.UnitId equals unit.UnitId into unitJoin
|
|
from unit in unitJoin.DefaultIfEmpty()
|
|
join person in db.SitePerson_Person on new { pu.ProjectId, u.IdentityCard } equals new
|
|
{ person.ProjectId, person.IdentityCard } into personJoin
|
|
from person in personJoin.DefaultIfEmpty()
|
|
join wp in db.Base_WorkPost on person.WorkPostId equals wp.WorkPostId into workPostJoin
|
|
from wp in workPostJoin.DefaultIfEmpty()
|
|
join sysConst in db.Sys_Const on new
|
|
{
|
|
GroupId = BLL.ConstValue.Group_ProjectUnitType, ConstValue = puUnit.UnitType
|
|
} equals
|
|
new { sysConst.GroupId, sysConst.ConstValue } into sysConstJoin
|
|
from sysConst in sysConstJoin.DefaultIfEmpty()
|
|
where pu.ProjectUserId == id
|
|
select new
|
|
{
|
|
pu.ProjectUserId,
|
|
pu.ProjectId,
|
|
pu.UserId,
|
|
pu.WorkAreaId,
|
|
u.UserCode,
|
|
u.UserName,
|
|
pu.UnitId,
|
|
unit.UnitCode,
|
|
unit.UnitName,
|
|
puUnit.UnitType,
|
|
UnitTypeName = sysConst.ConstText,
|
|
pu.RoleId,
|
|
pu.IsPost,
|
|
wp.WorkPostName,
|
|
RoleName = "",
|
|
IsPostName = pu.IsPost.HasValue ? "在岗" : "离岗",
|
|
}).FirstOrDefault();
|
|
List<string> roleName = new List<string>();
|
|
if (query != null)
|
|
{
|
|
|
|
var arr = query.RoleId.Split(',');
|
|
for (var i = 0; i < arr.Length; i++)
|
|
{
|
|
var name = db.Sys_Role.Where(role => role.RoleId == arr[i].Trim()).Select(role => role.RoleName).FirstOrDefault();
|
|
roleName.Add(name);
|
|
}
|
|
}
|
|
var getLists = new
|
|
{
|
|
query.ProjectUserId,
|
|
query.ProjectId,
|
|
query.UserId,
|
|
query.WorkAreaId,
|
|
query.UserCode,
|
|
query.UserName,
|
|
query.UnitId,
|
|
query.UnitCode,
|
|
query.UnitName,
|
|
query.UnitType,
|
|
query.UnitTypeName,
|
|
query.RoleId,
|
|
query.IsPost,
|
|
query.WorkPostName,
|
|
query.IsPostName,
|
|
RoleName = roleName.Count > 0 ? string.Join(",", roleName) : ""
|
|
};
|
|
|
|
responeData.data = new { getLists };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 根据项目获取焊工数据列表
|
|
/// </summary>
|
|
/// <param name="projectId"> </param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getWelderByProjectId(string projectId)
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
var getLists = (
|
|
from Welder in db.BS_Welder
|
|
join Unit in db.Base_Unit on Welder.WED_Unit equals Unit.UnitId into UnitGroup
|
|
from u in UnitGroup.DefaultIfEmpty()
|
|
join TeamGroup in db.ProjectData_TeamGroup on Welder.TeamGroupId equals TeamGroup.TeamGroupId
|
|
into pGroup
|
|
from p in pGroup.DefaultIfEmpty()
|
|
where (Welder.ProjectId == projectId && (Welder.WederType == null || Welder.WederType == "1"))
|
|
select new
|
|
{
|
|
Welder.WED_ID,
|
|
Welder.ProjectId,
|
|
Welder.WED_Unit,
|
|
Welder.TeamGroupId,
|
|
Welder.WED_Code,
|
|
Welder.WED_Name,
|
|
WED_Sex = Welder.WED_Sex.Equals('2') ? "女" : "男",
|
|
Welder.WED_Birthday,
|
|
Welder.WED_WorkCode,
|
|
Welder.WED_Class,
|
|
Welder.WederType,
|
|
WED_IfOnGuardName = Welder.WED_IfOnGuard.Value ? "是" : "否",
|
|
u.UnitName,
|
|
p.TeamGroupName,
|
|
}
|
|
).ToList();
|
|
Debug.WriteLine(getLists.Count());
|
|
responeData.data = new { getLists };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 根据主键获取焊工人员明细
|
|
/// </summary>
|
|
/// <param name="id"> </param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getWelderById(string id)
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
Hashtable tb = new Hashtable();
|
|
Model.BS_Welder welder = BLL.WelderService.GetWelderById(id);
|
|
if (welder != null)
|
|
{
|
|
tb.Add("WED_ID", welder.WED_ID);
|
|
if (!string.IsNullOrEmpty(welder.AttachUrl))
|
|
{
|
|
tb.Add("imgPhoto", "~/" + welder.AttachUrl);
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(welder.WED_Unit))
|
|
{
|
|
tb.Add("UnitId", welder.WED_Unit);
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(welder.TeamGroupId))
|
|
{
|
|
tb.Add("TeamGroupId", welder.TeamGroupId);
|
|
}
|
|
|
|
tb.Add("WED_Name", welder.WED_Name);
|
|
tb.Add("WED_Code", welder.WED_Code);
|
|
tb.Add("Birthday",
|
|
welder.WED_Birthday.HasValue ? string.Format("{0:yyyy-MM-dd}", welder.WED_Birthday) : "");
|
|
if (!string.IsNullOrEmpty(welder.WED_TYPE))
|
|
{
|
|
tb.Add("type", welder.WED_TYPE);
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(welder.WED_Sex))
|
|
{
|
|
tb.Add("sex", welder.WED_Sex.Trim());
|
|
}
|
|
|
|
tb.Add("WorkCode", welder.WED_WorkCode);
|
|
tb.Add("LimitDate",
|
|
welder.LimitDate.HasValue ? string.Format("{0:yyyy-MM-dd}", welder.LimitDate) : "");
|
|
tb.Add("Class", welder.WED_Class);
|
|
if (welder.WED_IfOnGuard.HasValue)
|
|
{
|
|
if (welder.WED_IfOnGuard.Value == true)
|
|
{
|
|
tb.Add("ifOnGuard", true);
|
|
}
|
|
else
|
|
{
|
|
tb.Add("ifOnGuard", false);
|
|
}
|
|
}
|
|
|
|
tb.Add("IdentityCard", welder.IdentityCard);
|
|
if (!string.IsNullOrEmpty(welder.WED_Remark))
|
|
tb.Add("Remark", welder.WED_Remark);
|
|
if (!string.IsNullOrEmpty(welder.SE_EquipmentID))
|
|
tb.Add("SE_EquipmentID", welder.SE_EquipmentID);
|
|
var items = from x in Funs.DB.BS_WeldMethodItem where x.WED_ID == welder.WED_ID select x.WME_ID;
|
|
tb.Add("WeldMethod", items.ToArray());
|
|
if (!string.IsNullOrEmpty(welder.JOT_Sch))
|
|
tb.Add("JOT_Sch", welder.JOT_Sch);
|
|
if (!string.IsNullOrEmpty(welder.Steels))
|
|
{
|
|
tb.Add("SteType", welder.Steels.Split(','));
|
|
}
|
|
}
|
|
|
|
responeData.data = new { tb };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 质量培训和质量交底详情
|
|
|
|
/// <summary>
|
|
/// 根据项目获取人员报验信息数据列表
|
|
/// </summary>
|
|
/// <param name="projectId"> </param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getInspectionPersonByProjectId(string projectId)
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
string timeString = "2023-01-01 00:00:00";
|
|
DateTime timeDate = DateTime.Parse(timeString);
|
|
var getLists = (
|
|
from c in db.Comprehensive_InspectionPerson
|
|
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitGroup
|
|
from unit in unitGroup.DefaultIfEmpty()
|
|
join cn in db.Base_CNProfessional on c.CNProfessionalId equals cn.CNProfessionalId into cnGroup
|
|
from cnPro in cnGroup.DefaultIfEmpty()
|
|
join wp in db.Base_WorkPost on c.PostId equals wp.WorkPostId into postGroup
|
|
from workPost in postGroup.DefaultIfEmpty()
|
|
join att in db.AttachFile on c.InspectionPersonId equals att.ToKeyId into attGroup
|
|
from attFile in attGroup.DefaultIfEmpty()
|
|
where (c.ProjectId == projectId && c.CompileDate.Value > timeDate)
|
|
select new Model.Customization._7HJ.InspectionPersonInfo
|
|
{
|
|
InspectionPersonId = c.InspectionPersonId,
|
|
InspectionPersonCode = c.InspectionPersonCode,
|
|
PersonName = c.PersonName,
|
|
Status = c.Status,
|
|
CertificateNumber = c.CertificateNumber,
|
|
QualifiedProjectCode = c.QualifiedProjectCode,
|
|
ValidityDate = c.ValidityDate,
|
|
ApprovalTime = c.ApprovalTime,
|
|
DepartureTime = c.DepartureTime,
|
|
AttachUrl = attFile.AttachUrl,
|
|
CompileMan = c.CompileMan,
|
|
CompileDate = c.CompileDate,
|
|
IsOnSite = c.IsOnSite,
|
|
UnitName = unit.UnitName,
|
|
ProfessionalName = cnPro.ProfessionalName,
|
|
PostName = workPost.WorkPostName,
|
|
}
|
|
).ToList();
|
|
Debug.WriteLine(getLists.Count());
|
|
responeData.data = new { getLists };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键获取人员报验明细
|
|
/// </summary>
|
|
/// <param name="id"> </param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getInspectionPersonById(string id)
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
var getLists = (
|
|
from c in db.Comprehensive_InspectionPerson
|
|
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitGroup
|
|
from unit in unitGroup.DefaultIfEmpty()
|
|
join cn in db.Base_CNProfessional on c.CNProfessionalId equals cn.CNProfessionalId into cnGroup
|
|
from cnPro in cnGroup.DefaultIfEmpty()
|
|
join wp in db.Base_WorkPost on c.PostId equals wp.WorkPostId into postGroup
|
|
from workPost in postGroup.DefaultIfEmpty()
|
|
join att in db.AttachFile on c.InspectionPersonId equals att.ToKeyId into attGroup
|
|
from attFile in attGroup.DefaultIfEmpty()
|
|
where (c.InspectionPersonId == id)
|
|
select new Model.Customization._7HJ.InspectionPersonInfo
|
|
{
|
|
InspectionPersonId = c.InspectionPersonId,
|
|
InspectionPersonCode = c.InspectionPersonCode,
|
|
PersonName = c.PersonName,
|
|
Status = c.Status,
|
|
CertificateNumber = c.CertificateNumber,
|
|
QualifiedProjectCode = c.QualifiedProjectCode,
|
|
ValidityDate = c.ValidityDate,
|
|
ApprovalTime = c.ApprovalTime,
|
|
DepartureTime = c.DepartureTime,
|
|
AttachUrl = attFile.AttachUrl,
|
|
CompileMan = c.CompileMan,
|
|
CompileDate = c.CompileDate,
|
|
IsOnSite = c.IsOnSite,
|
|
UnitName = unit.UnitName,
|
|
ProfessionalName = cnPro.ProfessionalName,
|
|
PostName = workPost.WorkPostName,
|
|
}
|
|
).FirstOrDefault();
|
|
responeData.data = new { getLists };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 根据项目获取设计交底信息数据列表
|
|
/// </summary>
|
|
/// <param name="projectId"> </param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getDesignDetailsByProjectId(string projectId)
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
string timeString = "2023-01-01 00:00:00";
|
|
DateTime timeDate = DateTime.Parse(timeString);
|
|
var getLists = (
|
|
from c in db.Comprehensive_DesignDetails
|
|
join cn in db.Base_CNProfessional on c.CNProfessionalId equals cn.CNProfessionalId into cnGroup
|
|
from cn in cnGroup.DefaultIfEmpty()
|
|
join att in db.AttachFile on c.DesignDetailsId equals att.ToKeyId into attGroup
|
|
from attFile in attGroup.DefaultIfEmpty()
|
|
where (c.ProjectId == projectId && c.CompileDate.Value > timeDate)
|
|
select new Model.Customization._7HJ.DesignDetailsInfo
|
|
{
|
|
DesignDetailsId = c.DesignDetailsId,
|
|
DesignDetailsCode = c.DesignDetailsCode,
|
|
DetailsMan = c.DetailsMan,
|
|
DetailsDate = c.DetailsDate,
|
|
UnitWorkId = c.UnitWorkId,
|
|
Status = c.Status,
|
|
UnitName = c.UnitName,
|
|
AttachUrl = attFile.AttachUrl,
|
|
CompileMan = c.CompileMan,
|
|
ProfessionalName = cn.ProfessionalName,
|
|
}
|
|
).ToList();
|
|
Debug.WriteLine(getLists.Count());
|
|
responeData.data = new { getLists };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键获取设计交底明细
|
|
/// </summary>
|
|
/// <param name="id"> </param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getDesignDetailsById(string id)
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
var getLists = (
|
|
from c in db.Comprehensive_DesignDetails
|
|
join cn in db.Base_CNProfessional on c.CNProfessionalId equals cn.CNProfessionalId into cnGroup
|
|
from cnPro in cnGroup.DefaultIfEmpty()
|
|
join att in db.AttachFile on c.DesignDetailsId equals att.ToKeyId into attGroup
|
|
from attFile in attGroup.DefaultIfEmpty()
|
|
where (c.DesignDetailsId == id)
|
|
select new Model.Customization._7HJ.DesignDetailsInfo
|
|
{
|
|
DesignDetailsId = c.DesignDetailsId,
|
|
DesignDetailsCode = c.DesignDetailsCode,
|
|
DetailsMan = c.DetailsMan,
|
|
DetailsDate = c.DetailsDate,
|
|
UnitWorkId = c.UnitWorkId,
|
|
Status = c.Status,
|
|
UnitName = c.UnitName,
|
|
AttachUrl = attFile.AttachUrl,
|
|
CompileMan = c.CompileMan,
|
|
ProfessionalName = cnPro.ProfessionalName,
|
|
}
|
|
).FirstOrDefault();
|
|
responeData.data = new { getLists };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 计量器具详情表
|
|
|
|
/// <summary>
|
|
/// 根据项目获取机具报验信息数据列表
|
|
/// </summary>
|
|
/// <param name="projectId"> </param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getInspectionMachineByProjectId(string projectId)
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
var getLists = (
|
|
from c in db.Comprehensive_InspectionMachine
|
|
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitGroup
|
|
from unit in unitGroup.DefaultIfEmpty()
|
|
join cn in db.Base_CNProfessional on c.CNProfessionalId equals cn.CNProfessionalId into cnGroup
|
|
from cn in cnGroup.DefaultIfEmpty()
|
|
join att in db.AttachFile on c.InspectionMachineId equals att.ToKeyId into attGroup
|
|
from attFile in attGroup.DefaultIfEmpty()
|
|
where (c.ProjectId == projectId)
|
|
select new Model.Customization._7HJ.InspectionMachineInfo
|
|
{
|
|
InspectionMachineId = c.InspectionMachineId,
|
|
InspectionMachineCode = c.InspectionMachineCode,
|
|
UnitName = unit.UnitName,
|
|
ProfessionalName = cn.ProfessionalName,
|
|
Status = c.Status,
|
|
InspectionMachineName = c.InspectionMachineName,
|
|
SpecificationModel = c.SpecificationModel,
|
|
NextTestDate = c.NextTestDate,
|
|
TestCycle = c.TestCycle,
|
|
InspectionDate = c.InspectionDate,
|
|
IsVerification = c.IsVerification.Value ? "是" : "否",
|
|
IsCheckOK = c.IsCheckOK.Value ? "是" : "否",
|
|
InspectionType = c.InspectionType,
|
|
LeaveDate = c.LeaveDate,
|
|
UnitsCount = c.UnitsCount,
|
|
AttachUrl = attFile.AttachUrl,
|
|
}
|
|
).ToList();
|
|
Debug.WriteLine(getLists.Count());
|
|
responeData.data = new { getLists };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键获取机具报验明细
|
|
/// </summary>
|
|
/// <param name="id"> </param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getInspectionMachineById(string id)
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
var getLists = (
|
|
from c in db.Comprehensive_InspectionMachine
|
|
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitGroup
|
|
from unit in unitGroup.DefaultIfEmpty()
|
|
join cn in db.Base_CNProfessional on c.CNProfessionalId equals cn.CNProfessionalId into cnGroup
|
|
from cn in cnGroup.DefaultIfEmpty()
|
|
join att in db.AttachFile on c.InspectionMachineId equals att.ToKeyId into attGroup
|
|
from attFile in attGroup.DefaultIfEmpty()
|
|
where (c.InspectionMachineId == id)
|
|
select new Model.Customization._7HJ.InspectionMachineInfo
|
|
{
|
|
InspectionMachineId = c.InspectionMachineId,
|
|
InspectionMachineCode = c.InspectionMachineCode,
|
|
UnitName = unit.UnitName,
|
|
ProfessionalName = cn.ProfessionalName,
|
|
Status = c.Status,
|
|
InspectionMachineName = c.InspectionMachineName,
|
|
SpecificationModel = c.SpecificationModel,
|
|
NextTestDate = c.NextTestDate,
|
|
TestCycle = c.TestCycle,
|
|
InspectionDate = c.InspectionDate,
|
|
IsVerification = c.IsVerification.Value ? "是" : "否",
|
|
IsCheckOK = c.IsCheckOK.Value ? "是" : "否",
|
|
InspectionType = c.InspectionType,
|
|
LeaveDate = c.LeaveDate,
|
|
UnitsCount = c.UnitsCount,
|
|
AttachUrl = attFile.AttachUrl,
|
|
}
|
|
).FirstOrDefault();
|
|
responeData.data = new { getLists };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 质量点控制数据
|
|
|
|
/// <summary>
|
|
/// 根据项目获取现场控制点资料柜数据列表
|
|
/// </summary>
|
|
/// <param name="projectId"> </param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getProjectControlPointByProjectId(string projectId)
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
var getLists = (
|
|
from bp in db.WBS_BreakdownProject
|
|
where (bp.ProjectId == projectId)
|
|
select new
|
|
{
|
|
bp.BreakdownProjectId,
|
|
bp.BreakdownCode,
|
|
bp.BreakdownName,
|
|
bp.Basis,
|
|
bp.CheckPoints,
|
|
bp.RecordAndCode,
|
|
bp.Class,
|
|
bp.FenBao,
|
|
bp.WuHuan,
|
|
bp.JianLi,
|
|
bp.YeZhu,
|
|
bp.Remark,
|
|
bp.ModelURL,
|
|
bp.CheckAcceptType
|
|
}
|
|
).ToList();
|
|
Debug.WriteLine(getLists.Count());
|
|
responeData.data = new { getLists };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键获取现场控制点资料柜明细
|
|
/// </summary>
|
|
/// <param name="id"> </param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getProjectControlPointById(string id)
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
var getLists = (
|
|
from bp in db.WBS_BreakdownProject
|
|
where (bp.BreakdownProjectId == id)
|
|
select new
|
|
{
|
|
bp.BreakdownProjectId,
|
|
bp.BreakdownCode,
|
|
bp.BreakdownName,
|
|
bp.Basis,
|
|
bp.CheckPoints,
|
|
bp.RecordAndCode,
|
|
bp.Class,
|
|
bp.FenBao,
|
|
bp.WuHuan,
|
|
bp.JianLi,
|
|
bp.YeZhu,
|
|
bp.Remark,
|
|
bp.ModelURL,
|
|
bp.CheckAcceptType
|
|
}
|
|
).FirstOrDefault();
|
|
|
|
responeData.data = new { getLists };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 质量检验详情
|
|
|
|
/// <summary>
|
|
/// 根据项目获取质量巡检信息数据列表
|
|
/// </summary>
|
|
/// <param name="projectId"> </param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getQualityCheckByProjectId(string projectId)
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
var getLists = (
|
|
from chec in db.Check_CheckControl
|
|
join unit in db.Base_Unit on chec.UnitId equals unit.UnitId into unitJoin
|
|
from unit in unitJoin.DefaultIfEmpty()
|
|
join cNProfessional in db.Base_CNProfessional on chec.CNProfessionalCode equals cNProfessional.CNProfessionalId into cNProfessionalJoin
|
|
from cNProfessional in cNProfessionalJoin.DefaultIfEmpty()
|
|
join unitWork in db.WBS_UnitWork on chec.UnitWorkId equals unitWork.UnitWorkId into unitWorkJoin
|
|
from unitWork in unitWorkJoin.DefaultIfEmpty()
|
|
join qualityQuestionType in db.Base_QualityQuestionType on chec.QuestionType equals qualityQuestionType.QualityQuestionTypeId into qualityQuestionTypeJoin
|
|
from qualityQuestionType in qualityQuestionTypeJoin.DefaultIfEmpty()
|
|
join u in db.Sys_User on chec.CheckMan equals u.UserId into userJoin
|
|
from u in userJoin.DefaultIfEmpty()
|
|
where (chec.ProjectId == projectId)
|
|
select new
|
|
{
|
|
chec.CheckControlCode,
|
|
chec.CheckSite,
|
|
chec.ProjectId,
|
|
unitId = chec.UnitId,
|
|
cNProfessional.ProfessionalName,
|
|
QuestionType = qualityQuestionType.QualityQuestionType,
|
|
checkman = chec.CheckMan,
|
|
chec.CheckDate,
|
|
chec.DocCode,
|
|
submitman = chec.SubmitMan,
|
|
state = chec.State,
|
|
chec.CNProfessionalCode,
|
|
unit.UnitName,
|
|
unitWork.UnitWorkName,
|
|
userName = u.UserName
|
|
}
|
|
).ToList();
|
|
Debug.WriteLine(getLists.Count());
|
|
responeData.data = new { getLists };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键获取质量巡检明细
|
|
/// </summary>
|
|
/// <param name="id"> </param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getQualityCheckById(string id)
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
Dictionary<string, object> dictionary = new Dictionary<string, object>();
|
|
var dt = CheckControlApproveService.getListData(id);
|
|
dictionary.Add("dt", dt);
|
|
Model.Check_CheckControl checkControl = CheckControlService.GetCheckControl(id);
|
|
dictionary.Add("CheckControlCode", checkControl.CheckControlCode);
|
|
dictionary.Add("DocCode", checkControl.DocCode);
|
|
if (!string.IsNullOrEmpty(checkControl.UnitId))
|
|
{
|
|
dictionary.Add("Unit", UnitService.GetUnitNameByUnitId(checkControl.UnitId));
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(checkControl.ProposeUnitId))
|
|
{
|
|
dictionary.Add("ProposeUnit", UnitService.GetUnitNameByUnitId(checkControl.ProposeUnitId));
|
|
}
|
|
|
|
if (checkControl.UnitWorkId != null)
|
|
{
|
|
dictionary.Add("UnitWork", UnitWorkService.GetNameById(checkControl.UnitWorkId));
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(checkControl.CNProfessionalCode))
|
|
{
|
|
dictionary.Add("CNProfessional",
|
|
CNProfessionalService.GetCNProfessional(checkControl.CNProfessionalCode).ProfessionalName);
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(checkControl.QuestionType))
|
|
{
|
|
var questionType = QualityQuestionTypeService.GetQualityQuestionType(checkControl.QuestionType);
|
|
if (questionType != null)
|
|
{
|
|
dictionary.Add("QuestionType", questionType.QualityQuestionType);
|
|
}
|
|
}
|
|
|
|
dictionary.Add("CheckSite", checkControl.CheckSite);
|
|
if (checkControl.CheckDate != null)
|
|
{
|
|
dictionary.Add("CheckDate", string.Format("{0:yyyy-MM-dd}", checkControl.CheckDate));
|
|
}
|
|
|
|
dictionary.Add("QuestionDef", checkControl.QuestionDef);
|
|
dictionary.Add("RectifyOpinion", checkControl.RectifyOpinion);
|
|
if (checkControl.LimitDate != null)
|
|
{
|
|
dictionary.Add("LimitDate", string.Format("{0:yyyy-MM-dd}", checkControl.LimitDate));
|
|
}
|
|
|
|
dictionary.Add("HandleWay", checkControl.HandleWay);
|
|
if (checkControl.RectifyDate != null)
|
|
{
|
|
dictionary.Add("RectifyDate", string.Format("{0:yyyy-MM-dd}", checkControl.RectifyDate));
|
|
}
|
|
|
|
responeData.data = new { dictionary };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 根据项目获取专项巡检信息数据列表
|
|
/// </summary>
|
|
/// <param name="projectId"> </param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getSpecialCheckByProjectId(string projectId)
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
var getLists = (
|
|
from chec in db.Check_CheckSpecialDataIn
|
|
where (chec.ProjectId == projectId)
|
|
select new
|
|
{
|
|
chec.CheckSpecialId,
|
|
chec.CheckSpecialCode,
|
|
chec.ProjectId,
|
|
chec.UnitId,
|
|
chec.CheckTime,
|
|
chec.CheckPerson,
|
|
chec.CheckPersonOther,
|
|
chec.WorkAreaId,
|
|
chec.CheckAreas,
|
|
chec.States,
|
|
chec.CompileMan,
|
|
chec.CheckUnitId,
|
|
chec.ResponseMan,
|
|
chec.ProblemType,
|
|
chec.ProblemDes,
|
|
chec.Suggest,
|
|
chec.LimitedTime,
|
|
chec.CNProfessionalCode,
|
|
chec.CheckType,
|
|
chec.CheckClass,
|
|
}
|
|
).ToList();
|
|
Debug.WriteLine(getLists.Count());
|
|
responeData.data = new { getLists };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键获取专项巡检明细
|
|
/// </summary>
|
|
/// <param name="id"> </param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getSpecialCheckById(string id)
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
Dictionary<string, object> dictionary = new Dictionary<string, object>();
|
|
Model.Check_CheckSpecialDataIn model = Funs.DB.Check_CheckSpecialDataIn.FirstOrDefault(x => x.CheckSpecialId == id);
|
|
if (model != null)
|
|
{
|
|
dictionary.Add("CheckSpecialId", model.CheckSpecialId);
|
|
if (model.UnitId != null)
|
|
{
|
|
var unit = UnitService.GetUnitByUnitId(model.UnitId);
|
|
if (unit != null)
|
|
{
|
|
dictionary.Add("Unit", unit.UnitName);
|
|
}
|
|
}
|
|
if (model.CheckTime != null)
|
|
{
|
|
dictionary.Add("CheckTime", Convert.ToDateTime(model.CheckTime).ToString("yyyy-MM-dd"));
|
|
}
|
|
dictionary.Add("CheckType", model.CheckType);
|
|
dictionary.Add("CheckClass", model.CheckClass);
|
|
|
|
|
|
if (model.CheckPerson != null)
|
|
{
|
|
dictionary.Add("CheckPerson", UserService.GetUserNameByUserId(model.CheckPerson));
|
|
}
|
|
dictionary.Add("CheckPersonOther", model.CheckPersonOther);
|
|
dictionary.Add("CheckAreas", model.CheckAreas);
|
|
|
|
if (model.WorkAreaId != null)
|
|
{
|
|
var type = UnitWorkService.getUnitWorkByUnitWorkId(model.WorkAreaId.ToString());
|
|
if (type != null)
|
|
{
|
|
dictionary.Add("WorkArea", type.UnitWorkName);
|
|
}
|
|
}
|
|
if (model.CNProfessionalCode != null)
|
|
{
|
|
var CNProfessionalModel = CNProfessionalService.GetCNProfessional(model.CNProfessionalCode.ToString());
|
|
if (CNProfessionalModel != null)
|
|
{
|
|
dictionary.Add("CNProfessionalCode", CNProfessionalModel.ProfessionalName);
|
|
}
|
|
}
|
|
if (model.CheckUnitId != null)
|
|
{
|
|
var unit = UnitService.GetUnitByUnitId(model.CheckUnitId);
|
|
if (unit != null)
|
|
{
|
|
dictionary.Add("CheckUnitId", unit.UnitName);
|
|
}
|
|
}
|
|
|
|
if (model.ResponseMan != null)
|
|
{
|
|
dictionary.Add("ResponseMan", UserService.GetUserNameByUserId(model.ResponseMan));
|
|
}
|
|
dictionary.Add("ProblemType", model.ProblemType);
|
|
dictionary.Add("ProblemDes", model.ProblemDes);
|
|
dictionary.Add("Suggest", model.Suggest);
|
|
|
|
if (model.LimitedTime != null)
|
|
{
|
|
dictionary.Add("LimitedTime", Convert.ToDateTime(model.LimitedTime).ToString("yyyy-MM-dd"));
|
|
}
|
|
}
|
|
|
|
responeData.data = new { dictionary };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 根据项目获取质量共检信息数据列表
|
|
/// </summary>
|
|
/// <param name="projectId"> </param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getJointCheckByProjectId(string projectId)
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
var getLists = (
|
|
from chec in db.Check_JointCheck
|
|
join unit in db.Base_Unit on chec.UnitId equals unit.UnitId into unitJoin
|
|
from unit in unitJoin.DefaultIfEmpty()
|
|
join u in db.Sys_User on chec.CheckMan equals u.UserId into userJoin
|
|
from u in userJoin.DefaultIfEmpty()
|
|
where (chec.ProjectId == projectId)
|
|
select new
|
|
{
|
|
chec.JointCheckId,
|
|
chec.JointCheckCode,
|
|
chec.State,
|
|
chec.CheckDate,
|
|
chec.CheckName,
|
|
chec.UnitId,
|
|
unit.UnitName,
|
|
CheckMan = u.UserName,
|
|
chec.CheckType
|
|
}
|
|
).ToList();
|
|
Debug.WriteLine(getLists.Count());
|
|
responeData.data = new { getLists };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键获取质量共检明细
|
|
/// </summary>
|
|
/// <param name="id"> </param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getJointCheckById(string id)
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
Dictionary<string, object> dictionary = new Dictionary<string, object>();
|
|
Model.Check_JointCheck jointCheck = BLL.JointCheckService.GetJointCheck(id);
|
|
dictionary.Add("JointCheckId", jointCheck.JointCheckId);
|
|
dictionary.Add("JointCheckCode", jointCheck.JointCheckCode);
|
|
dictionary.Add("Unit", UnitService.GetUnitNameByUnitId(jointCheck.UnitId));
|
|
dictionary.Add("CheckType", UserService.GetUserNameByUserId(JointCheckService.GetCheckTypeList2().FirstOrDefault(p => p.Value.Equals(jointCheck.CheckType)).Text));
|
|
dictionary.Add("CheckName", jointCheck.CheckName);
|
|
if (jointCheck.CheckDate != null)
|
|
{
|
|
dictionary.Add("CheckDate", Convert.ToDateTime(jointCheck.CheckDate).ToString("yyyy-MM-dd"));
|
|
}
|
|
dictionary.Add("ProposeUnit", UnitService.GetUnitNameByUnitId(jointCheck.ProposeUnitId));
|
|
if (!string.IsNullOrEmpty(jointCheck.JointCheckMans1))
|
|
{
|
|
dictionary.Add("JointCheckMans1", BLL.UserService.getUserNamesUserIds(jointCheck.JointCheckMans1));
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(jointCheck.JointCheckMans2))
|
|
{
|
|
dictionary.Add("JointCheckMans2", BLL.UserService.getUserNamesUserIds(jointCheck.JointCheckMans2));
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(jointCheck.JointCheckMans3))
|
|
{
|
|
dictionary.Add("JointCheckMans3", BLL.UserService.getUserNamesUserIds(jointCheck.JointCheckMans3));
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(jointCheck.JointCheckMans4))
|
|
{
|
|
dictionary.Add("JointCheckMans4", BLL.UserService.getUserNamesUserIds(jointCheck.JointCheckMans4));
|
|
}
|
|
var list = JointCheckDetailService.GetViewLists(id);
|
|
dictionary.Add("list", list);
|
|
var approves = JointCheckApproveService.getListData(id);
|
|
dictionary.Add("approves", approves);
|
|
|
|
responeData.data = new { dictionary };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region 质量整改详情
|
|
|
|
|
|
/// <summary>
|
|
/// 根据项目获取问题统计信息数据列表
|
|
/// </summary>
|
|
/// <param name="projectId"> </param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getJointCheckStatisticsByProjectId(string projectId)
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
var getLists = (
|
|
from d in db.View_Check_JointCheckDetail
|
|
join j in db.Check_JointCheckDetail on d.JointCheckDetailId equals j.JointCheckDetailId into jointDetailGroup
|
|
from j in jointDetailGroup.DefaultIfEmpty()
|
|
where (d.ProjectId == projectId)
|
|
select new
|
|
{
|
|
d.JointCheckDetailId,
|
|
d.JointCheckId,
|
|
d.UnitName,
|
|
d.CheckDate,
|
|
d.CheckTypeStr,
|
|
d.UnitWorkName,
|
|
d.ProfessionalName,
|
|
d.QuestionTypeStr,
|
|
d.CheckSite,
|
|
d.QuestionDef,
|
|
d.AttachUrl,
|
|
d.HandleWay,
|
|
d.ReAttachUrl,
|
|
lbState = j.State,
|
|
|
|
}
|
|
).ToList();
|
|
Debug.WriteLine(getLists.Count());
|
|
responeData.data = new { getLists };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键获取问题统计明细
|
|
/// </summary>
|
|
/// <param name="id"> </param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getJointCheckStatisticsById(string id)
|
|
{
|
|
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
var getLists = (
|
|
from d in db.View_Check_JointCheckDetail
|
|
join j in db.Check_JointCheckDetail on d.JointCheckDetailId equals j.JointCheckDetailId into jointDetailGroup
|
|
from j in jointDetailGroup.DefaultIfEmpty()
|
|
where (d.JointCheckDetailId == id)
|
|
select new
|
|
{
|
|
d.JointCheckDetailId,
|
|
d.JointCheckId,
|
|
d.UnitWorkId,
|
|
d.CNProfessionalCode,
|
|
d.QuestionDef,
|
|
d.QuestionType,
|
|
d.CheckSite,
|
|
d.Standard,
|
|
d.RectifyOpinion,
|
|
d.LimitDate,
|
|
d.AttachUrl,
|
|
d.HandleWay,
|
|
d.RectifyDate,
|
|
d.ReAttachUrl,
|
|
d.Feedback,
|
|
d.IsOK,
|
|
d.ProjectId,
|
|
d.CheckType,
|
|
d.UnitId,
|
|
d.UnitName,
|
|
d.CheckDate,
|
|
d.State,
|
|
d.CreateDate,
|
|
d.HandleMan,
|
|
d.SaveHandleMan,
|
|
d.CheckTypeStr,
|
|
d.QuestionTypeStr,
|
|
d.ProposeUnitName,
|
|
d.ProposeUnitType,
|
|
d.OKDate,
|
|
d.UnitWorkName,
|
|
d.ProfessionalName,
|
|
lbState = j.State
|
|
}
|
|
).FirstOrDefault();
|
|
|
|
responeData.data = new { getLists };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |