Merge branch 'master' of http://47.104.102.122:3000/lpf/SGGL_SeDin_New
This commit is contained in:
@@ -386,6 +386,117 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region 新保存Check_CheckSpecial
|
||||
|
||||
/// <summary>
|
||||
/// 新保存Check_CheckSpecial
|
||||
/// </summary>
|
||||
/// <param name="newItem">处罚通知单</param>
|
||||
/// <returns></returns>
|
||||
public static string SaveCheckSpecialNew(Model.CheckSpecialItem newItem)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
string message = string.Empty;
|
||||
Model.Check_CheckSpecial newCheckSpecial = new Model.Check_CheckSpecial
|
||||
{
|
||||
CheckSpecialId = newItem.CheckSpecialId,
|
||||
CheckSpecialCode = newItem.CheckSpecialCode,
|
||||
CheckType = newItem.CheckType,
|
||||
ProjectId = newItem.ProjectId,
|
||||
CheckPerson = newItem.CheckPersonId,
|
||||
CheckTime = Funs.GetNewDateTime(newItem.CheckTime),
|
||||
DaySummary = System.Web.HttpUtility.HtmlEncode(newItem.DaySummary),
|
||||
PartInUnits = newItem.PartInUnitIds,
|
||||
PartInPersonIds = newItem.PartInPersonIds,
|
||||
PartInPersons = Person_PersonsService.getPersonsNamesPersonIds(newItem.PartInPersonIds),
|
||||
PartInPersonNames = newItem.PartInPersonNames2,
|
||||
CompileMan = newItem.CompileManId,
|
||||
States = Const.State_0,
|
||||
};
|
||||
if (newItem.CheckType == "0")
|
||||
{
|
||||
newCheckSpecial.CheckItemSetId = newItem.CheckItemSetId;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(newItem.States))
|
||||
{
|
||||
newCheckSpecial.States = newItem.States;
|
||||
}
|
||||
if (newItem.CheckSpecialDetailItems == null || newItem.CheckSpecialDetailItems.Count() == 0)
|
||||
{
|
||||
if (newItem.States == Const.State_1)
|
||||
{
|
||||
newCheckSpecial.States = Const.State_2;
|
||||
}
|
||||
}
|
||||
var updateCheckSpecial =
|
||||
db.Check_CheckSpecial.FirstOrDefault(x => x.CheckSpecialId == newItem.CheckSpecialId);
|
||||
if (updateCheckSpecial == null)
|
||||
{
|
||||
newCheckSpecial.CheckSpecialId = SQLHelper.GetNewID();
|
||||
newCheckSpecial.CheckSpecialCode =
|
||||
CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectCheckSpecialMenuId,
|
||||
newCheckSpecial.ProjectId, string.Empty);
|
||||
db.Check_CheckSpecial.InsertOnSubmit(newCheckSpecial);
|
||||
db.SubmitChanges();
|
||||
////增加一条编码记录
|
||||
BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ProjectCheckSpecialMenuId,
|
||||
newCheckSpecial.ProjectId, null, newCheckSpecial.CheckSpecialId, newCheckSpecial.CheckTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
Check_CheckSpecialService.UpdateCheckSpecial(newCheckSpecial);
|
||||
}
|
||||
|
||||
////保存附件
|
||||
if (!string.IsNullOrEmpty(newItem.AttachUrl1))
|
||||
{
|
||||
UploadFileService.SaveAttachUrl(
|
||||
UploadFileService.GetSourceByAttachUrl(newItem.AttachUrl1, 10, null), newItem.AttachUrl1,
|
||||
Const.ProjectCheckSpecialMenuId, newCheckSpecial.CheckSpecialId);
|
||||
}
|
||||
else
|
||||
{
|
||||
CommonService.DeleteAttachFileById(Const.ProjectCheckSpecialMenuId, newCheckSpecial.CheckSpecialId);
|
||||
}
|
||||
|
||||
///// 新增检查项
|
||||
if (newItem.CheckSpecialDetailItems != null && newItem.CheckSpecialDetailItems.Count() > 0)
|
||||
{
|
||||
foreach (var item in newItem.CheckSpecialDetailItems)
|
||||
{
|
||||
item.CheckSpecialId = newCheckSpecial.CheckSpecialId;
|
||||
SaveCheckSpecialDetail(item);
|
||||
}
|
||||
|
||||
//// 单据完成后 系统自动按照单位 整改要求生成隐患整改单
|
||||
if (newItem.States == Const.State_1)
|
||||
{
|
||||
var getC = newItem.CheckSpecialDetailItems.FirstOrDefault(x => x.CompleteStatus == false);
|
||||
if (getC == null)
|
||||
{
|
||||
newCheckSpecial.States = Const.State_2;
|
||||
Check_CheckSpecialService.UpdateCheckSpecial(newCheckSpecial);
|
||||
}
|
||||
else
|
||||
{
|
||||
var detailLists = db.Check_CheckSpecialDetail.Where(x =>
|
||||
x.CheckSpecialId == newCheckSpecial.CheckSpecialId && x.CompleteStatus == false);
|
||||
if (detailLists.Count() > 0)
|
||||
{
|
||||
message = Check_CheckSpecialService.IssueRectification(detailLists.ToList(),
|
||||
newCheckSpecial);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,6 +279,8 @@
|
||||
<Compile Include="Common\DataCleanupMergeHelper.cs" />
|
||||
<Compile Include="CQMS\ProjectHighlightsSite\ProjectHighlightsSiteService.cs" />
|
||||
<Compile Include="DataShare\APIDataShareSyncService.cs" />
|
||||
<Compile Include="DataShare\CQMS\APICheckControlSyncService.cs" />
|
||||
<Compile Include="DataShare\CQMS\APIInspectionMachineSyncService.cs" />
|
||||
<Compile Include="DataShare\HSSE\APICheckSpecialSyncService.cs" />
|
||||
<Compile Include="DataShare\HSSE\APIHazardRegisterSyncService.cs" />
|
||||
<Compile Include="DataShare\HSSE\APILicenseSyncService.cs" />
|
||||
|
||||
@@ -5314,5 +5314,45 @@ namespace BLL
|
||||
public const string UnitHazardRegisterMenuRecord_Quality = "15511354-9822-4A21-AB24-2483D889FDB8";
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 现场车辆管理导入模板
|
||||
/// </summary>
|
||||
public const string CarManagerTemplateUrl = "File\\Excel\\DataIn\\现场车辆管理导入模板.xls";
|
||||
|
||||
/// <summary>
|
||||
/// 企业大检查明细导入模板
|
||||
/// </summary>
|
||||
public const string UnitHazardRegisterDetailTemplateUrl = "File\\Excel\\DataIn\\企业大检查明细导入模板.xls";
|
||||
|
||||
/// <summary>
|
||||
/// 活动类型
|
||||
/// </summary>
|
||||
public const string ActivityTypeMenuId = "79116536-BE80-4323-A46F-10222601D5B5";
|
||||
|
||||
/// <summary>
|
||||
/// 货物单位类型
|
||||
/// </summary>
|
||||
public const string MaterialUnitMenuId = "3DD3F0E8-D3EA-41AA-BA1F-CA3168657D67";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 物资进出记录
|
||||
/// </summary>
|
||||
public const string MaterialInAndOutRecordMenuId = "5DAB5F9A-097A-46D4-8EB1-F60D1D65E812";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 奖励与惩罚
|
||||
/// </summary>
|
||||
public const string RewardAndPunishManagerMenuId = "621A9295-DD82-425A-863D-310AD319752B";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 质量会议
|
||||
/// </summary>
|
||||
public const string CQMS_MeetingMenuId = "30754DF1-CB18-4F53-BB66-2B2A398D7180";
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using System.Net;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
@@ -611,5 +611,46 @@ namespace BLL
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 下载并保存文件
|
||||
/// </summary>
|
||||
/// <param name="webUrl"></param>
|
||||
/// <param name="fileUrl"></param>
|
||||
/// <returns></returns>
|
||||
public static byte[] SafeDownloadHeadImageAsync(string webUrl, string fileUrl)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(fileUrl))
|
||||
return null;
|
||||
|
||||
// 构造完整的远程文件 URL
|
||||
string fullRemoteUrl = $"{webUrl.TrimEnd('/')}/{fileUrl.TrimStart('/')}";
|
||||
|
||||
// 构造本地文件路径
|
||||
string localFilePath = Path.Combine(ConfigurationManager.AppSettings["localRoot"], fileUrl);
|
||||
|
||||
// 确保本地目录存在
|
||||
string directoryPath = Path.GetDirectoryName(localFilePath);
|
||||
if (!string.IsNullOrEmpty(directoryPath) && !Directory.Exists(directoryPath))
|
||||
{
|
||||
Directory.CreateDirectory(directoryPath);
|
||||
}
|
||||
//下载文件到本地
|
||||
using (WebClient client = new WebClient())
|
||||
{
|
||||
byte[] fileData = client.DownloadData(fullRemoteUrl);
|
||||
// 将文件数据写入本地文件
|
||||
File.WriteAllBytes(localFilePath, fileData);
|
||||
return fileData;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
BLL.ErrLogInfo.WriteLog($"下载头像失败: {fileUrl}, 错误: {ex.Message}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,543 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Model;
|
||||
using Newtonsoft.Json;
|
||||
using RestSharp;
|
||||
using System.Net;
|
||||
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 质量巡检同步服务
|
||||
/// </summary>
|
||||
public class APICheckControlSyncService
|
||||
{
|
||||
#region 根据项目、单位获取质量巡检列表
|
||||
|
||||
/// <summary>
|
||||
/// 根据项目、单位获取质量巡检列表
|
||||
/// </summary>
|
||||
/// <param name="projectId">项目ID</param>
|
||||
/// <param name="unitId">单位ID</param>
|
||||
/// <param name="dataId">数据ID(可选,用于单条数据同步)</param>
|
||||
/// <returns>质量巡检数据列表</returns>
|
||||
public static List<Model.CheckControlSyncItem> GetCheckControlListsByProjectIdUnitIdPage(
|
||||
string projectId, string unitId, string dataId = "")
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var list = from x in db.Check_CheckControl
|
||||
where x.ProjectId == projectId
|
||||
select x;
|
||||
|
||||
if (!string.IsNullOrEmpty(unitId))
|
||||
{
|
||||
list = list.Where(x => x.UnitId == unitId);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(dataId))
|
||||
{
|
||||
list = list.Where(x => x.CheckControlCode == dataId);
|
||||
}
|
||||
|
||||
var dataList = (from x in list
|
||||
join unit in db.Base_Unit on x.UnitId equals unit.UnitId into unitTemp
|
||||
from unit in unitTemp.DefaultIfEmpty()
|
||||
join pro in db.Base_CNProfessional on x.CNProfessionalCode equals pro.CNProfessionalId into proTemp
|
||||
from pro in proTemp.DefaultIfEmpty()
|
||||
join uw in db.WBS_UnitWork on x.UnitWorkId equals uw.UnitWorkId into uwTemp
|
||||
from uw in uwTemp.DefaultIfEmpty()
|
||||
join qqt in db.Base_QualityQuestionType on x.QuestionType equals qqt.QualityQuestionTypeId into qqtTemp
|
||||
from qqt in qqtTemp.DefaultIfEmpty()
|
||||
join u1 in db.Person_Persons on x.CheckMan equals u1.PersonId into u1Temp
|
||||
from u1 in u1Temp.DefaultIfEmpty()
|
||||
join u2 in db.Person_Persons on x.SubmitMan equals u2.PersonId into u2Temp
|
||||
from u2 in u2Temp.DefaultIfEmpty()
|
||||
join pu in db.Base_Unit on x.ProposeUnitId equals pu.UnitId into puTemp
|
||||
from pu in puTemp.DefaultIfEmpty()
|
||||
join att in db.AttachFile on x.CheckControlCode equals att.ToKeyId into attTemp
|
||||
from att in attTemp.DefaultIfEmpty()
|
||||
join attRe in db.AttachFile on x.CheckControlCode+"r" equals attRe.ToKeyId into attReTemp
|
||||
from attRe in attReTemp.DefaultIfEmpty()
|
||||
select new CheckControlSyncItem
|
||||
{
|
||||
CheckControlCode = x.CheckControlCode,
|
||||
ProjectId = x.ProjectId,
|
||||
UnitWorkId = x.UnitWorkId,
|
||||
UnitWorkName = uw.UnitWorkName,
|
||||
UnitId = x.UnitId,
|
||||
UnitName = unit.UnitName,
|
||||
CheckDate = x.CheckDate,
|
||||
CheckMan = x.CheckMan,
|
||||
CheckManName = u1.PersonName,
|
||||
CheckSite = x.CheckSite,
|
||||
DocCode = x.DocCode,
|
||||
CNProfessionalCode = x.CNProfessionalCode,
|
||||
CNProfessionalName = pro.ProfessionalName,
|
||||
QuestionType = x.QuestionType,
|
||||
QuestionTypeName = qqt.QualityQuestionType,
|
||||
QuestionDef = x.QuestionDef,
|
||||
RectifyOpinion = x.RectifyOpinion,
|
||||
LimitDate = x.LimitDate,
|
||||
AttachUrl = att.AttachUrl,
|
||||
HandleWay = x.HandleWay,
|
||||
RectifyDate = x.RectifyDate,
|
||||
ReAttachUrl = attRe.AttachUrl,
|
||||
State = x.State,
|
||||
IsSubmit = x.IsSubmit,
|
||||
SubmitMan = x.SubmitMan,
|
||||
SubmitManName = u2.PersonName,
|
||||
IsOK = x.IsOK,
|
||||
ProposeUnitId = x.ProposeUnitId,
|
||||
ProposeUnitName = pu.UnitName,
|
||||
SaveHandleMan = x.SaveHandleMan,
|
||||
DataSource = "1"
|
||||
}).ToList();
|
||||
|
||||
return dataList;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 拉取质量巡检数据
|
||||
|
||||
/// <summary>
|
||||
/// 拉取质量巡检数据
|
||||
/// </summary>
|
||||
/// <returns>处理结果消息</returns>
|
||||
public static string getCheckControlLists(string projectId = "")
|
||||
{
|
||||
int code = 0;
|
||||
string message = "";
|
||||
try
|
||||
{
|
||||
string CollCropCode = string.Empty;
|
||||
string unitId = string.Empty;
|
||||
var thisUnit = CommonService.GetIsThisUnit(); //当前单位
|
||||
if (thisUnit != null)
|
||||
{
|
||||
CollCropCode = thisUnit.CollCropCode; //社会统一信用代码
|
||||
unitId = thisUnit.UnitId;
|
||||
}
|
||||
|
||||
var ProjectList = (from x in Funs.DB.Base_Project
|
||||
where x.SubjectUnit != null && x.SubjectProject != null
|
||||
select x).ToList();
|
||||
if (!string.IsNullOrEmpty(projectId))
|
||||
{
|
||||
ProjectList = ProjectList.Where(x => x.ProjectId == projectId).ToList();
|
||||
}
|
||||
if (ProjectList.Count > 0)
|
||||
{
|
||||
foreach (var project in ProjectList)
|
||||
{
|
||||
string SubjectUnitId = project.SubjectUnit; //集团的单位id
|
||||
string SubjectProjectId = project.SubjectProject; //集团的项目id
|
||||
|
||||
//获取对应单位的apiurl地址
|
||||
var Url = BLL.UnitService.getUnitApiUrlByUnitId(SubjectUnitId);
|
||||
//var Url = "http://localhost:14957/,http://localhost:8579/";
|
||||
|
||||
var ApiUrl = "";
|
||||
var WebUrl = "";
|
||||
if (!string.IsNullOrEmpty(Url))
|
||||
{
|
||||
var urls = Url.Split(',');
|
||||
ApiUrl = urls[0];
|
||||
if (urls.Length > 1)
|
||||
{
|
||||
WebUrl = urls[1];
|
||||
}
|
||||
}
|
||||
|
||||
string url = "/api/CheckControlSync/getCheckControlListByProjectIdAndCollCropCode?projectId=" +
|
||||
SubjectProjectId + "&collCropCode=" + CollCropCode;
|
||||
string baseurl = ApiUrl + url;
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
var strJosn = APIGetHttpService.Http(baseurl, "GET", contenttype, null, null);
|
||||
|
||||
if (!string.IsNullOrEmpty(strJosn))
|
||||
{
|
||||
JObject obj = JObject.Parse(strJosn);
|
||||
code = Funs.GetNewIntOrZero(obj["code"].ToString());
|
||||
message = obj["message"].ToString();
|
||||
|
||||
if (code == 1)
|
||||
{
|
||||
var getData = JsonConvert.DeserializeObject<List<CheckControlSyncItem>>(obj["data"].ToString());
|
||||
if (getData.Count() > 0)
|
||||
{
|
||||
ProcessCheckControlData(getData, project.ProjectId, unitId, WebUrl, "pull");
|
||||
}
|
||||
message = "获取成功:同步质量巡检数" + getData.Count().ToString() + "条";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
message = "获取失败:" + ex.Message;
|
||||
ErrLogInfo.WriteLog("质量巡检获取!", ex);
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 推送质量巡检数据
|
||||
|
||||
/// <summary>
|
||||
/// 推送质量巡检数据
|
||||
/// </summary>
|
||||
/// <param name="projectId">项目ID</param>
|
||||
/// <param name="dataId">数据ID(可选,用于单条数据推送)</param>
|
||||
/// <returns>推送结果</returns>
|
||||
public static ReturnData pushCheckControlLists(string projectId, string dataId = "")
|
||||
{
|
||||
Model.ReturnData responeData = new Model.ReturnData();
|
||||
responeData.code = 0;
|
||||
responeData.message = string.Empty;
|
||||
var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == projectId);
|
||||
|
||||
try
|
||||
{
|
||||
if (project != null)
|
||||
{
|
||||
//获取质量巡检数据
|
||||
var items = GetCheckControlListsByProjectIdUnitIdPage(projectId, "", dataId);
|
||||
|
||||
if (items.Count() > 0)
|
||||
{
|
||||
var thisUnit = CommonService.GetIsThisUnit(); //当前单位
|
||||
var apiurl = "/api/CheckControlSync/SaveCheckControlSyncData";
|
||||
|
||||
//总包单位接口地址
|
||||
var Url = BLL.UnitService.getUnitApiUrlByUnitId(project.SubjectUnit);
|
||||
//var Url = "http://localhost:14957/";
|
||||
var ApiUrl = "";
|
||||
var WebUrl = "";
|
||||
|
||||
if (!string.IsNullOrEmpty(Url))
|
||||
{
|
||||
var urls = Url.Split(',');
|
||||
ApiUrl = urls[0];
|
||||
if (urls.Length > 1)
|
||||
{
|
||||
WebUrl = urls[1];
|
||||
}
|
||||
}
|
||||
|
||||
var pushData = new CheckControlSyncData
|
||||
{
|
||||
CollCropCode = thisUnit.CollCropCode, //分包单位社会统一信用码
|
||||
ProjectId = project.SubjectProject, //主包项目Id
|
||||
UnitDomain = Funs.SGGLUrl, //分包单位域名地址【文件存储地址】
|
||||
Items = items //质量巡检数据
|
||||
};
|
||||
|
||||
var pushContent = JsonConvert.SerializeObject(pushData);
|
||||
string baseurl = ApiUrl + apiurl;
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
var returndata = APIGetHttpService.Http(baseurl, "Post", contenttype, null, pushContent);
|
||||
|
||||
if (!string.IsNullOrEmpty(returndata))
|
||||
{
|
||||
JObject obj = JObject.Parse(returndata);
|
||||
string code = obj["code"].ToString();
|
||||
string message = obj["message"].ToString();
|
||||
responeData.code = int.Parse(code);
|
||||
responeData.message = message;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "当前没有质量巡检数据";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.message = "同步到总包单位失败!";
|
||||
ErrLogInfo.WriteLog("【质量巡检】同步到总包单位失败!", ex);
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 接收保存质量巡检数据
|
||||
|
||||
/// <summary>
|
||||
/// 接收保存质量巡检数据
|
||||
/// </summary>
|
||||
/// <param name="items">质量巡检同步数据</param>
|
||||
/// <returns>处理结果消息</returns>
|
||||
public static string SaveCheckControlSyncData(Model.CheckControlSyncData items)
|
||||
{
|
||||
int code = 0;
|
||||
string message = "";
|
||||
try
|
||||
{
|
||||
if (items.Items.Count > 0 || items.Items.Count > 0)
|
||||
{
|
||||
var CollCropCode = items.CollCropCode; //分包单位社会统一信用码
|
||||
var ProjectId = items.ProjectId; //总包项目Id
|
||||
var UnitDomain = items.UnitDomain; //分包单位域名地址【文件存储地址】
|
||||
|
||||
var unit = Funs.DB.Base_Unit.FirstOrDefault(x => x.CollCropCode == CollCropCode); //根据CollCropCode获取单位id
|
||||
if (unit == null)
|
||||
{
|
||||
message = "总包单位不存在本单位,请登录总包系统检查维护本单位信息!";
|
||||
}
|
||||
else
|
||||
{
|
||||
//判断主包项目是否存在
|
||||
var porject = BLL.ProjectService.GetProjectByProjectId(ProjectId);
|
||||
if (porject == null)
|
||||
{
|
||||
message = "总包单位不存在本项目,请检查总包项目关联是否正确!";
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcessCheckControlData(items.Items, ProjectId, unit.UnitId, UnitDomain, "push");
|
||||
message = "数据推送成功!";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
message = "暂无质量巡检数据!";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 处理质量巡检数据的新增或更新逻辑
|
||||
|
||||
/// <summary>
|
||||
/// 处理质量巡检数据的新增或更新逻辑
|
||||
/// </summary>
|
||||
/// <param name="getData">质量巡检数据列表</param>
|
||||
/// <param name="projectId">项目id</param>
|
||||
/// <param name="unitId">单位ID</param>
|
||||
/// <param name="WebUrl">Web地址</param>
|
||||
///
|
||||
private static void ProcessCheckControlData(
|
||||
List<Model.CheckControlSyncItem> getData,
|
||||
string projectId,
|
||||
string unitId,
|
||||
string WebUrl, string type)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
foreach (var item in getData)
|
||||
{
|
||||
Model.Check_CheckControl model = db.Check_CheckControl.FirstOrDefault(x => x.CheckControlCode == item.CheckControlCode);
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
//新增
|
||||
Model.Check_CheckControl newModel = new Model.Check_CheckControl
|
||||
{
|
||||
CheckControlCode = item.CheckControlCode,
|
||||
ProjectId = projectId,
|
||||
UnitWorkId = APIDataShareSyncService.getUnitWorkId(item.UnitWorkName, projectId),
|
||||
UnitId = getUnitIdByUnitName(item.UnitName) ?? unitId,
|
||||
CheckDate = item.CheckDate,
|
||||
CheckMan = APIDataShareSyncService.getUserId(item.CheckManName),
|
||||
CheckSite = item.CheckSite,
|
||||
DocCode = item.DocCode,
|
||||
CNProfessionalCode = getCNProfessionalId(item.CNProfessionalName),
|
||||
QuestionType = getQualityQuestionTypeId(item.QuestionTypeName, projectId),
|
||||
QuestionDef = item.QuestionDef,
|
||||
RectifyOpinion = item.RectifyOpinion,
|
||||
LimitDate = item.LimitDate,
|
||||
AttachUrl = item.AttachUrl,
|
||||
HandleWay = item.HandleWay,
|
||||
RectifyDate = item.RectifyDate,
|
||||
ReAttachUrl = item.ReAttachUrl,
|
||||
State = item.State,
|
||||
IsSubmit = item.IsSubmit,
|
||||
SubmitMan = APIDataShareSyncService.getUserId(item.SubmitManName),
|
||||
IsOK = item.IsOK,
|
||||
ProposeUnitId = getUnitIdByUnitName(item.ProposeUnitName),
|
||||
SaveHandleMan = item.SaveHandleMan
|
||||
};
|
||||
if (type == "pull")
|
||||
{
|
||||
newModel.DataSource = item.DataSource;
|
||||
}
|
||||
db.Check_CheckControl.InsertOnSubmit(newModel);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
//更新
|
||||
model.ProjectId = projectId;
|
||||
model.UnitWorkId = APIDataShareSyncService.getUnitWorkId(item.UnitWorkName, projectId);
|
||||
model.UnitId = getUnitIdByUnitName(item.UnitName) ?? unitId;
|
||||
model.CheckDate = item.CheckDate;
|
||||
model.CheckMan = APIDataShareSyncService.getUserId(item.CheckManName);
|
||||
model.CheckSite = item.CheckSite;
|
||||
model.DocCode = item.DocCode;
|
||||
model.CNProfessionalCode = getCNProfessionalId(item.CNProfessionalName);
|
||||
model.QuestionType = getQualityQuestionTypeId(item.QuestionTypeName, projectId);
|
||||
model.QuestionDef = item.QuestionDef;
|
||||
model.RectifyOpinion = item.RectifyOpinion;
|
||||
model.LimitDate = item.LimitDate;
|
||||
model.AttachUrl = item.AttachUrl;
|
||||
model.HandleWay = item.HandleWay;
|
||||
model.RectifyDate = item.RectifyDate;
|
||||
model.ReAttachUrl = item.ReAttachUrl;
|
||||
model.State = item.State;
|
||||
model.IsSubmit = item.IsSubmit;
|
||||
model.SubmitMan = APIDataShareSyncService.getUserId(item.SubmitManName);
|
||||
model.IsOK = item.IsOK;
|
||||
model.ProposeUnitId = getUnitIdByUnitName(item.ProposeUnitName);
|
||||
model.SaveHandleMan = item.SaveHandleMan;
|
||||
if (type == "pull")
|
||||
{
|
||||
model.DataSource = item.DataSource;
|
||||
}
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
//处理整改前附件
|
||||
if (!string.IsNullOrEmpty(item.AttachUrl))
|
||||
{
|
||||
APIDataShareSyncService.OperationAttachFile(WebUrl, item.CheckControlCode,
|
||||
BLL.Const.CheckListMenuId, item.AttachUrl);
|
||||
}
|
||||
|
||||
//处理整改后附件
|
||||
if (!string.IsNullOrEmpty(item.ReAttachUrl))
|
||||
{
|
||||
APIDataShareSyncService.OperationAttachFile(WebUrl, item.CheckControlCode + "R",
|
||||
BLL.Const.CheckListMenuId, item.ReAttachUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 辅助映射方法
|
||||
|
||||
/// <summary>
|
||||
/// 获取质量问题类型ID(不存在则创建)
|
||||
/// </summary>
|
||||
/// <param name="questionTypeName">问题类型名称</param>
|
||||
/// <param name="projectId">项目ID</param>
|
||||
/// <returns>问题类型ID</returns>
|
||||
private static string getQualityQuestionTypeId(string questionTypeName, string projectId)
|
||||
{
|
||||
string questionTypeId = null;
|
||||
if (!string.IsNullOrEmpty(questionTypeName))
|
||||
{
|
||||
var qqt = Funs.DB.Base_QualityQuestionType.FirstOrDefault(x => x.QualityQuestionType == questionTypeName);
|
||||
if (qqt == null)
|
||||
{
|
||||
//不存在则创建
|
||||
Model.Base_QualityQuestionType newQqt = new Model.Base_QualityQuestionType
|
||||
{
|
||||
QualityQuestionTypeId = SQLHelper.GetNewID(typeof(Model.Base_QualityQuestionType)),
|
||||
QualityQuestionType = questionTypeName
|
||||
};
|
||||
QualityQuestionTypeService.AddQualityQuestionType(newQqt);
|
||||
questionTypeId = newQqt.QualityQuestionTypeId;
|
||||
}
|
||||
else
|
||||
{
|
||||
questionTypeId = qqt.QualityQuestionTypeId;
|
||||
}
|
||||
}
|
||||
return questionTypeId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取专业ID(不存在则创建)
|
||||
/// </summary>
|
||||
/// <param name="ProfessionalName"></param>
|
||||
/// <param name="projectId"></param>
|
||||
/// <returns></returns>
|
||||
private static string getCNProfessionalId(string ProfessionalName)
|
||||
{
|
||||
string Id = null;
|
||||
if (!string.IsNullOrEmpty(ProfessionalName))
|
||||
{
|
||||
var names = ProfessionalName.Split(',');
|
||||
List<string> IdList = new List<string>();
|
||||
foreach (var name in names)
|
||||
{
|
||||
var cnProfessional = Funs.DB.Base_CNProfessional.Where(x =>
|
||||
x.ProfessionalName == name).ToList();
|
||||
if (cnProfessional.Count == 0)
|
||||
{
|
||||
Model.Base_CNProfessional newCnProfessional = new Model.Base_CNProfessional
|
||||
{
|
||||
CNProfessionalId = SQLHelper.GetNewID(typeof(Model.WBS_UnitWork)),
|
||||
ProfessionalName = name,
|
||||
};
|
||||
CNProfessionalService.AddCNProfessional(newCnProfessional);
|
||||
IdList.Add(newCnProfessional.CNProfessionalId);
|
||||
}
|
||||
else
|
||||
{
|
||||
IdList.Add(cnProfessional.FirstOrDefault().CNProfessionalId);
|
||||
}
|
||||
}
|
||||
|
||||
Id = string.Join(",", IdList);
|
||||
}
|
||||
|
||||
return Id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取单位ID(根据名称)
|
||||
/// </summary>
|
||||
/// <param name="unitName">单位名称</param>
|
||||
/// <returns>单位ID</returns>
|
||||
private static string getUnitIdByUnitName(string unitName)
|
||||
{
|
||||
string unitId = null;
|
||||
if (!string.IsNullOrEmpty(unitName))
|
||||
{
|
||||
var unit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitName == unitName);
|
||||
if (unit != null)
|
||||
{
|
||||
unitId = unit.UnitId;
|
||||
}
|
||||
}
|
||||
return unitId;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,313 @@
|
||||
using Model;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 质量计量器具同步服务
|
||||
/// </summary>
|
||||
public class APIInspectionMachineSyncService
|
||||
{
|
||||
#region 分包单位推送数据到总包单位
|
||||
|
||||
/// <summary>
|
||||
/// 分包单位推送数据到总包单位
|
||||
/// </summary>
|
||||
/// <param name="projectId">项目ID</param>
|
||||
/// <param name="dataId">数据ID(可选,用于单条数据推送)</param>
|
||||
/// <returns>推送结果</returns>
|
||||
public static ReturnData PushInspectionMachineLists(string projectId, string dataId = "")
|
||||
{
|
||||
Model.ReturnData responeData = new Model.ReturnData();
|
||||
responeData.code = 0;
|
||||
responeData.message = string.Empty;
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
try
|
||||
{
|
||||
var project = db.Base_Project.FirstOrDefault(x => x.ProjectId == projectId);
|
||||
if (project != null)
|
||||
{
|
||||
//获取质量计量器具数据
|
||||
var list = from x in db.Comprehensive_InspectionMachine where x.ProjectId == projectId select x;
|
||||
|
||||
if (!string.IsNullOrEmpty(dataId))
|
||||
{
|
||||
list = list.Where(x => x.InspectionMachineId == dataId);
|
||||
}
|
||||
|
||||
var dataList = (from x in list
|
||||
join unit in db.Base_Unit on x.UnitId equals unit.UnitId into unitTemp
|
||||
from unit in unitTemp.DefaultIfEmpty()
|
||||
join pro in db.Base_CNProfessional on x.CNProfessionalId equals pro.CNProfessionalId into proTemp
|
||||
from pro in proTemp.DefaultIfEmpty()
|
||||
join u1 in db.Person_Persons on x.CompileMan equals u1.PersonId into u1Temp
|
||||
from u1 in u1Temp.DefaultIfEmpty()
|
||||
join att in db.AttachFile on x.InspectionMachineId equals att.ToKeyId into attTemp
|
||||
from att in attTemp.DefaultIfEmpty()
|
||||
select new InspectionMachineSyncItem
|
||||
{
|
||||
InspectionMachineId = x.InspectionMachineId,
|
||||
InspectionMachineCode = x.InspectionMachineCode,
|
||||
InspectionMachineName = x.InspectionMachineName,
|
||||
SpecificationModel = x.SpecificationModel,
|
||||
UnitsCount = x.UnitsCount,
|
||||
SType = x.SType,
|
||||
InspectionType = x.InspectionType,
|
||||
InspectionDate = x.InspectionDate,
|
||||
NextTestDate = x.NextTestDate,
|
||||
TestCycle = x.TestCycle,
|
||||
IsCheckOK = x.IsCheckOK,
|
||||
IsVerification = x.IsVerification,
|
||||
Status = x.Status,
|
||||
IsOnSite = x.IsOnSite,
|
||||
LeaveDate = x.LeaveDate,
|
||||
UnitId = x.UnitId,
|
||||
UnitName = unit.UnitName,
|
||||
CNProfessionalId = x.CNProfessionalId,
|
||||
CNProfessionalName = pro.ProfessionalName,
|
||||
CompileMan = x.CompileMan,
|
||||
CompileManName = u1.PersonName,
|
||||
CompileDate = x.CompileDate,
|
||||
ProjectId = x.ProjectId,
|
||||
AttachFileId = att.AttachFileId,
|
||||
ToKeyId = att.ToKeyId,
|
||||
AttachSource = att.AttachSource,
|
||||
AttachUrl = att.AttachUrl,
|
||||
}).ToList();
|
||||
|
||||
if (dataList.Count() > 0)
|
||||
{
|
||||
var thisUnit = CommonService.GetIsThisUnit(); //当前单位
|
||||
var apiurl = "/api/InspectionMachineSync/SaveInspectionMachineSyncData";
|
||||
|
||||
//总包单位接口地址
|
||||
string ApiUrl = project.SubjectUnitApiUrl;
|
||||
string WebUrl = project.SubjectUnitWebUrl;
|
||||
var pushData = new InspectionMachineSyncData
|
||||
{
|
||||
CollCropCode = thisUnit.CollCropCode,//分包单位社会统一信用码
|
||||
UnitId = thisUnit.UnitId,//分包单位Id
|
||||
UnitName = thisUnit.UnitName,//分包单位名称
|
||||
ShortUnitName = thisUnit.ShortUnitName,//分包单位简称
|
||||
UnitDomain = Funs.SGGLUrl,//分包单位域名地址【文件存储地址】
|
||||
SubjectUnit = project.SubjectUnit,//主包单位Id
|
||||
SubjectProject = project.SubjectProject,//主包项目Id
|
||||
Items = dataList//质量计量器具数据
|
||||
};
|
||||
|
||||
var pushContent = JsonConvert.SerializeObject(pushData);
|
||||
string baseurl = ApiUrl + apiurl;
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
var returndata = APIGetHttpService.Http(baseurl, "Post", contenttype, null, pushContent);
|
||||
|
||||
if (!string.IsNullOrEmpty(returndata))
|
||||
{
|
||||
JObject obj = JObject.Parse(returndata);
|
||||
string code = obj["code"].ToString();
|
||||
string message = obj["message"].ToString();
|
||||
responeData.code = int.Parse(code);
|
||||
responeData.message = message;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "当前没有质量计量器具数据";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.message = "同步到总包单位失败!";
|
||||
ErrLogInfo.WriteLog("【质量计量器具】同步到总包单位失败!", ex);
|
||||
}
|
||||
|
||||
}
|
||||
return responeData;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 总包单位接收分包单位推送数据
|
||||
|
||||
/// <summary>
|
||||
/// 总包单位接收分包单位推送数据
|
||||
/// </summary>
|
||||
/// <param name="items">质量计量器具同步数据</param>
|
||||
/// <returns>处理结果消息</returns>
|
||||
public static string SaveInspectionMachineSyncData(Model.InspectionMachineSyncData data)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
string result = string.Empty;
|
||||
|
||||
if (data.Items.Count > 0 || data.Items.Count > 0)
|
||||
{
|
||||
var CollCropCode = data.CollCropCode; //分包单位社会统一信用码
|
||||
var ProjectId = data.SubjectProject; //总包项目Id
|
||||
var UnitDomain = data.UnitDomain; //分包单位域名地址【文件存储地址】
|
||||
|
||||
//1、判断分包单位是否存在
|
||||
var unit = UnitService.getUnitByCollCropCodeUnitName(CollCropCode, data.UnitName);
|
||||
if (unit == null)
|
||||
{
|
||||
result = "总包单位不存在本单位,请登录总包系统检查维护本单位信息!";
|
||||
}
|
||||
else
|
||||
{
|
||||
//判断主包项目是否存在
|
||||
var porject = BLL.ProjectService.GetProjectByProjectId(ProjectId);
|
||||
if (porject == null)
|
||||
{
|
||||
result = "总包单位不存在本项目,请检查总包项目关联是否正确!";
|
||||
}
|
||||
else
|
||||
{
|
||||
int succ = 0;
|
||||
foreach (var item in data.Items)
|
||||
{
|
||||
try
|
||||
{
|
||||
Model.Comprehensive_InspectionMachine model = db.Comprehensive_InspectionMachine.FirstOrDefault(x => x.InspectionMachineId == item.InspectionMachineId);
|
||||
if (model == null)
|
||||
{
|
||||
//新增
|
||||
Model.Comprehensive_InspectionMachine newModel = new Model.Comprehensive_InspectionMachine
|
||||
{
|
||||
ProjectId = ProjectId,
|
||||
UnitId = unit.UnitId,
|
||||
InspectionMachineId = item.InspectionMachineId,
|
||||
InspectionMachineCode = item.InspectionMachineCode,
|
||||
InspectionMachineName = item.InspectionMachineName,
|
||||
SpecificationModel = item.SpecificationModel,
|
||||
NextTestDate = item.NextTestDate,
|
||||
TestCycle = item.TestCycle,
|
||||
IsVerification = item.IsVerification,
|
||||
InspectionDate = item.InspectionDate,
|
||||
AttachUrl = item.AttachUrl,
|
||||
CNProfessionalId = getCNProfessionalId(item.CNProfessionalName),
|
||||
//CompileMan = APIDataShareSyncService.getUserId(item.CompileManName),
|
||||
CompileDate = item.CompileDate,
|
||||
IsOnSite = item.IsOnSite,
|
||||
InspectionType = item.InspectionType,
|
||||
LeaveDate = item.LeaveDate,
|
||||
UnitsCount = item.UnitsCount,
|
||||
//AuditMan = item.AuditMan,
|
||||
Status = item.Status,
|
||||
IsCheckOK = item.IsCheckOK,
|
||||
SType = item.SType,
|
||||
SourceDes = $"{(!string.IsNullOrWhiteSpace(data.ShortUnitName) ? data.ShortUnitName : data.UnitName)}#{item.CompileManName}#专业名称:{item.CNProfessionalName}",
|
||||
};
|
||||
|
||||
db.Comprehensive_InspectionMachine.InsertOnSubmit(newModel);
|
||||
db.SubmitChanges();
|
||||
|
||||
//保存编码
|
||||
if (!string.IsNullOrEmpty(item.InspectionMachineCode))
|
||||
{
|
||||
Model.Sys_CodeRecords codeRecords = new Model.Sys_CodeRecords
|
||||
{
|
||||
CodeRecordId = SQLHelper.GetNewID(typeof(Model.Sys_CodeRecords)),
|
||||
DataId = item.InspectionMachineId,
|
||||
Code = item.InspectionMachineCode
|
||||
};
|
||||
db.Sys_CodeRecords.InsertOnSubmit(codeRecords);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//更新
|
||||
model.ProjectId = ProjectId;
|
||||
model.UnitId = unit.UnitId;
|
||||
model.InspectionMachineCode = item.InspectionMachineCode;
|
||||
model.InspectionMachineName = item.InspectionMachineName;
|
||||
model.SpecificationModel = item.SpecificationModel;
|
||||
model.NextTestDate = item.NextTestDate;
|
||||
model.TestCycle = item.TestCycle;
|
||||
model.IsVerification = item.IsVerification;
|
||||
model.InspectionDate = item.InspectionDate;
|
||||
model.AttachUrl = item.AttachUrl;
|
||||
model.CNProfessionalId = getCNProfessionalId(item.CNProfessionalName);
|
||||
//model.CompileMan = APIDataShareSyncService.getUserId(item.CompileManName);
|
||||
model.CompileDate = item.CompileDate;
|
||||
model.IsOnSite = item.IsOnSite;
|
||||
model.InspectionType = item.InspectionType;
|
||||
model.LeaveDate = item.LeaveDate;
|
||||
model.UnitsCount = item.UnitsCount;
|
||||
//model.AuditMan = item.AuditMan;
|
||||
model.Status = item.Status;
|
||||
model.IsCheckOK = item.IsCheckOK;
|
||||
model.SType = item.SType;
|
||||
model.SourceDes = $"{(!string.IsNullOrWhiteSpace(data.ShortUnitName) ? data.ShortUnitName : data.UnitName)}#{item.CompileManName}#专业名称:{item.CNProfessionalName}";
|
||||
|
||||
db.SubmitChanges();
|
||||
//更新编码
|
||||
if (!string.IsNullOrEmpty(item.InspectionMachineCode))
|
||||
{
|
||||
var codeRecords = db.Sys_CodeRecords.FirstOrDefault(x => x.DataId == item.InspectionMachineId);
|
||||
if (codeRecords != null)
|
||||
{
|
||||
codeRecords.Code = item.InspectionMachineCode;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
succ++;
|
||||
//附件处理:附件
|
||||
BLL.FileInsertService.SaveAttachFileRecords(data.UnitDomain, item.AttachFileId, item.ToKeyId, item.AttachSource, item.AttachUrl);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
BLL.ErrLogInfo.WriteLog($"【{porject.ProjectName}】计量器具数据推送总包失败", ex.Message);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
result = "数据推送成功!";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = "暂无质量计量器具数据!";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 辅助映射方法
|
||||
|
||||
/// <summary>
|
||||
/// 获取专业ID(根据名称)
|
||||
/// </summary>
|
||||
/// <param name="professionalName">专业名称</param>
|
||||
/// <returns>专业ID</returns>
|
||||
private static string getCNProfessionalId(string professionalName)
|
||||
{
|
||||
string professionalId = null;
|
||||
if (!string.IsNullOrEmpty(professionalName))
|
||||
{
|
||||
var pro = Funs.DB.Base_CNProfessional.FirstOrDefault(x => x.ProfessionalName == professionalName);
|
||||
if (pro != null)
|
||||
{
|
||||
professionalId = pro.CNProfessionalId;
|
||||
}
|
||||
}
|
||||
return professionalId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -173,19 +173,20 @@ namespace BLL
|
||||
string SubjectUnitId = project.SubjectUnit; //集团的单位id
|
||||
string SubjectProjectId = project.SubjectProject; //集团的单位id
|
||||
//获取对应单位的apiurl地址
|
||||
var Url = BLL.UnitService.getUnitApiUrlByUnitId(SubjectUnitId);
|
||||
var ApiUrl = "";
|
||||
var WebUrl = "";
|
||||
if (!string.IsNullOrEmpty(Url))
|
||||
{
|
||||
var urls = Url.Split(',');
|
||||
ApiUrl = urls[0];
|
||||
if (urls.Length > 1)
|
||||
{
|
||||
WebUrl = urls[1];
|
||||
}
|
||||
}
|
||||
|
||||
//var Url = BLL.UnitService.getUnitApiUrlByUnitId(SubjectUnitId);
|
||||
//var ApiUrl = "";
|
||||
//var WebUrl = "";
|
||||
//if (!string.IsNullOrEmpty(Url))
|
||||
//{
|
||||
// var urls = Url.Split(',');
|
||||
// ApiUrl = urls[0];
|
||||
// if (urls.Length > 1)
|
||||
// {
|
||||
// WebUrl = urls[1];
|
||||
// }
|
||||
//}
|
||||
string ApiUrl = project.SubjectUnitApiUrl;
|
||||
string WebUrl = project.SubjectUnitWebUrl;
|
||||
// CollCropCode = "913404001520228377Y"; //三化建 测试使用
|
||||
// SubjectProjectId = "B409A8D7-48C7-486E-84C7-E3E7B2C0E5B7";//测试使用
|
||||
|
||||
@@ -246,19 +247,20 @@ namespace BLL
|
||||
var thisUnit = CommonService.GetIsThisUnit(); //当前单位
|
||||
var apiurl = "/api/CheckSpecialSync/SaveCheckSpecialSyncData";
|
||||
//总包单位接口地址
|
||||
var Url = BLL.UnitService.getUnitApiUrlByUnitId(project.SubjectUnit);
|
||||
var ApiUrl = "";
|
||||
var WebUrl = "";
|
||||
if (!string.IsNullOrEmpty(Url))
|
||||
{
|
||||
var urls = Url.Split(',');
|
||||
ApiUrl = urls[0];
|
||||
if (urls.Length > 1)
|
||||
{
|
||||
WebUrl = urls[1];
|
||||
}
|
||||
}
|
||||
|
||||
//var Url = BLL.UnitService.getUnitApiUrlByUnitId(project.SubjectUnit);
|
||||
//var ApiUrl = "";
|
||||
//var WebUrl = "";
|
||||
//if (!string.IsNullOrEmpty(Url))
|
||||
//{
|
||||
// var urls = Url.Split(',');
|
||||
// ApiUrl = urls[0];
|
||||
// if (urls.Length > 1)
|
||||
// {
|
||||
// WebUrl = urls[1];
|
||||
// }
|
||||
//}
|
||||
string ApiUrl = project.SubjectUnitApiUrl;
|
||||
string WebUrl = project.SubjectUnitWebUrl;
|
||||
// thisUnit.CollCropCode = "913404001520228377Y";//测试使用
|
||||
// project.SubjectProject = "B409A8D7-48C7-486E-84C7-E3E7B2C0E5B7";//测试使用
|
||||
|
||||
|
||||
@@ -144,19 +144,20 @@ namespace BLL
|
||||
string SubjectUnitId = project.SubjectUnit; //集团的单位id
|
||||
string SubjectProjectId = project.SubjectProject; //集团的项目id
|
||||
//获取对应单位的apiurl地址
|
||||
var Url = BLL.UnitService.getUnitApiUrlByUnitId(SubjectUnitId);
|
||||
var ApiUrl = "";
|
||||
var WebUrl = "";
|
||||
if (!string.IsNullOrEmpty(Url))
|
||||
{
|
||||
var urls = Url.Split(',');
|
||||
ApiUrl = urls[0];
|
||||
if (urls.Length > 1)
|
||||
{
|
||||
WebUrl = urls[1];
|
||||
}
|
||||
}
|
||||
|
||||
//var Url = BLL.UnitService.getUnitApiUrlByUnitId(SubjectUnitId);
|
||||
//var ApiUrl = "";
|
||||
//var WebUrl = "";
|
||||
//if (!string.IsNullOrEmpty(Url))
|
||||
//{
|
||||
// var urls = Url.Split(',');
|
||||
// ApiUrl = urls[0];
|
||||
// if (urls.Length > 1)
|
||||
// {
|
||||
// WebUrl = urls[1];
|
||||
// }
|
||||
//}
|
||||
string ApiUrl = project.SubjectUnitApiUrl;
|
||||
string WebUrl = project.SubjectUnitWebUrl;
|
||||
// CollCropCode = "91420000177570439L"; //三化建 测试使用
|
||||
// SubjectProjectId = "c7ade79e-7646-4c59-a8fd-020a7e3138c6";//测试使用
|
||||
|
||||
@@ -217,18 +218,20 @@ namespace BLL
|
||||
var thisUnit = CommonService.GetIsThisUnit(); //当前单位
|
||||
var apiurl = "/api/HazardRegisterSync/SaveHazardRegisterSyncData";
|
||||
//总包单位接口地址
|
||||
var Url = BLL.UnitService.getUnitApiUrlByUnitId(project.SubjectUnit);
|
||||
var ApiUrl = "";
|
||||
var WebUrl = "";
|
||||
if (!string.IsNullOrEmpty(Url))
|
||||
{
|
||||
var urls = Url.Split(',');
|
||||
ApiUrl = urls[0];
|
||||
if (urls.Length > 1)
|
||||
{
|
||||
WebUrl = urls[1];
|
||||
}
|
||||
}
|
||||
//var Url = BLL.UnitService.getUnitApiUrlByUnitId(project.SubjectUnit);
|
||||
//var ApiUrl = "";
|
||||
//var WebUrl = "";
|
||||
//if (!string.IsNullOrEmpty(Url))
|
||||
//{
|
||||
// var urls = Url.Split(',');
|
||||
// ApiUrl = urls[0];
|
||||
// if (urls.Length > 1)
|
||||
// {
|
||||
// WebUrl = urls[1];
|
||||
// }
|
||||
//}
|
||||
string ApiUrl = project.SubjectUnitApiUrl;
|
||||
string WebUrl = project.SubjectUnitWebUrl;
|
||||
// thisUnit.CollCropCode = "913404001520228377Y";//测试使用
|
||||
// project.SubjectProject = "B409A8D7-48C7-486E-84C7-E3E7B2C0E5B7";//测试使用
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace BLL
|
||||
if (dataList.Count() > 0)
|
||||
{
|
||||
var thisUnit = CommonService.GetIsThisUnit();
|
||||
var porject = BLL.ProjectService.GetProjectByProjectId(projectId);
|
||||
var project = BLL.ProjectService.GetProjectByProjectId(projectId);
|
||||
var pushData = new LicenseManagerData
|
||||
{
|
||||
CollCropCode = thisUnit.CollCropCode,//分包单位社会统一信用码
|
||||
@@ -96,25 +96,27 @@ namespace BLL
|
||||
UnitName = thisUnit.UnitName,//分包单位名称
|
||||
ShortUnitName = thisUnit.ShortUnitName,//分包单位简称
|
||||
UnitDomain = Funs.SGGLUrl,//分包单位域名地址【文件存储地址】
|
||||
SubjectUnit = porject.SubjectUnit,//主包单位Id
|
||||
SubjectProject = porject.SubjectProject,//主包项目Id
|
||||
SubjectUnit = project.SubjectUnit,//主包单位Id
|
||||
SubjectProject = project.SubjectProject,//主包项目Id
|
||||
Items = dataList//数据
|
||||
};
|
||||
var pushContent = JsonConvert.SerializeObject(pushData);
|
||||
|
||||
//获取总包单位接口apiurl地址
|
||||
var Url = BLL.UnitService.getUnitApiUrlByUnitId(porject.SubjectUnit);
|
||||
var ApiUrl = string.Empty;
|
||||
var WebUrl = string.Empty;
|
||||
if (Url != null)
|
||||
{
|
||||
var urls = Url.Split(',');
|
||||
ApiUrl = urls[0];
|
||||
if (urls.Length > 1)
|
||||
{
|
||||
WebUrl = urls[1];
|
||||
}
|
||||
}
|
||||
//var Url = BLL.UnitService.getUnitApiUrlByUnitId(project.SubjectUnit);
|
||||
//var ApiUrl = string.Empty;
|
||||
//var WebUrl = string.Empty;
|
||||
//if (Url != null)
|
||||
//{
|
||||
// var urls = Url.Split(',');
|
||||
// ApiUrl = urls[0];
|
||||
// if (urls.Length > 1)
|
||||
// {
|
||||
// WebUrl = urls[1];
|
||||
// }
|
||||
//}
|
||||
string ApiUrl = project.SubjectUnitApiUrl;
|
||||
string WebUrl = project.SubjectUnitWebUrl;
|
||||
var baseurl = $"{ApiUrl}/api/LicenseSync/ReceiveSaveProjectLicenseManagerData";
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
//Hashtable newToken = new Hashtable
|
||||
@@ -126,7 +128,7 @@ namespace BLL
|
||||
var returndata = APIGetHttpService.Http(baseurl, "Post", contenttype, null, pushContent);
|
||||
if (!string.IsNullOrEmpty(returndata))
|
||||
{
|
||||
ErrLogInfo.WriteLog($"【作业票返回结果】接口地址:{baseurl};{returndata}");
|
||||
//ErrLogInfo.WriteLog($"【作业票返回结果】接口地址:{baseurl};{returndata}");
|
||||
JObject obj = JObject.Parse(returndata);
|
||||
string mess = obj["message"].ToString();
|
||||
string code = obj["code"].ToString();
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace BLL
|
||||
if (dataList.Count() > 0)
|
||||
{
|
||||
var thisUnit = CommonService.GetIsThisUnit();
|
||||
var porject = BLL.ProjectService.GetProjectByProjectId(projectId);
|
||||
var project = BLL.ProjectService.GetProjectByProjectId(projectId);
|
||||
var pushData = new ClassMeetingData
|
||||
{
|
||||
CollCropCode = thisUnit.CollCropCode,//分包单位社会统一信用码
|
||||
@@ -97,25 +97,27 @@ namespace BLL
|
||||
UnitName = thisUnit.UnitName,//分包单位名称
|
||||
ShortUnitName = thisUnit.ShortUnitName,//分包单位简称
|
||||
UnitDomain = Funs.SGGLUrl,//分包单位域名地址【文件存储地址】
|
||||
SubjectUnit = porject.SubjectUnit,//主包单位Id
|
||||
SubjectProject = porject.SubjectProject,//主包项目Id
|
||||
SubjectUnit = project.SubjectUnit,//主包单位Id
|
||||
SubjectProject = project.SubjectProject,//主包项目Id
|
||||
Items = dataList//会议数据
|
||||
};
|
||||
var pushContent = JsonConvert.SerializeObject(pushData);
|
||||
|
||||
//获取总包单位接口apiurl地址
|
||||
var Url = BLL.UnitService.getUnitApiUrlByUnitId(porject.SubjectUnit);
|
||||
var ApiUrl = string.Empty;
|
||||
var WebUrl = string.Empty;
|
||||
if (Url != null)
|
||||
{
|
||||
var urls = Url.Split(',');
|
||||
ApiUrl = urls[0];
|
||||
if (urls.Length > 1)
|
||||
{
|
||||
WebUrl = urls[1];
|
||||
}
|
||||
}
|
||||
//var Url = BLL.UnitService.getUnitApiUrlByUnitId(porject.SubjectUnit);
|
||||
//var ApiUrl = string.Empty;
|
||||
//var WebUrl = string.Empty;
|
||||
//if (Url != null)
|
||||
//{
|
||||
// var urls = Url.Split(',');
|
||||
// ApiUrl = urls[0];
|
||||
// if (urls.Length > 1)
|
||||
// {
|
||||
// WebUrl = urls[1];
|
||||
// }
|
||||
//}
|
||||
string ApiUrl = project.SubjectUnitApiUrl;
|
||||
string WebUrl = project.SubjectUnitWebUrl;
|
||||
var baseurl = $"{ApiUrl}/api/MeetingSync/ReceiveSaveProjectClassMeetingData";
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
//Hashtable newToken = new Hashtable
|
||||
|
||||
@@ -161,19 +161,20 @@ namespace BLL
|
||||
string SubjectUnitId = project.SubjectUnit; //集团的单位id
|
||||
string SubjectProjectId = project.SubjectProject; //集团的单位id
|
||||
//获取对应单位的apiurl地址
|
||||
var Url = BLL.UnitService.getUnitApiUrlByUnitId(SubjectUnitId);
|
||||
var ApiUrl = "";
|
||||
var WebUrl = "";
|
||||
if (!string.IsNullOrEmpty(Url))
|
||||
{
|
||||
var urls = Url.Split(',');
|
||||
ApiUrl = urls[0];
|
||||
if (urls.Length > 1)
|
||||
{
|
||||
WebUrl = urls[1];
|
||||
}
|
||||
}
|
||||
|
||||
//var Url = BLL.UnitService.getUnitApiUrlByUnitId(SubjectUnitId);
|
||||
//var ApiUrl = "";
|
||||
//var WebUrl = "";
|
||||
//if (!string.IsNullOrEmpty(Url))
|
||||
//{
|
||||
// var urls = Url.Split(',');
|
||||
// ApiUrl = urls[0];
|
||||
// if (urls.Length > 1)
|
||||
// {
|
||||
// WebUrl = urls[1];
|
||||
// }
|
||||
//}
|
||||
string ApiUrl = project.SubjectUnitApiUrl;
|
||||
string WebUrl = project.SubjectUnitWebUrl;
|
||||
// CollCropCode = "913404001520228377Y";//测试使用
|
||||
// SubjectProjectId = "B409A8D7-48C7-486E-84C7-E3E7B2C0E5B7";//测试使用
|
||||
// unitId = "aaa9e72b-e3a6-441e-a7bb-afc008adebc9";//测试使用
|
||||
@@ -243,19 +244,20 @@ namespace BLL
|
||||
var thisUnit = CommonService.GetIsThisUnit(); //当前单位
|
||||
var apiurl = "/api/PersonSync/SavePersonSyncData";
|
||||
//总包单位接口地址
|
||||
var Url = BLL.UnitService.getUnitApiUrlByUnitId(project.SubjectUnit);
|
||||
var ApiUrl = "";
|
||||
var WebUrl = "";
|
||||
if (!string.IsNullOrEmpty(Url))
|
||||
{
|
||||
var urls = Url.Split(',');
|
||||
ApiUrl = urls[0];
|
||||
if (urls.Length > 1)
|
||||
{
|
||||
WebUrl = urls[1];
|
||||
}
|
||||
}
|
||||
|
||||
//var Url = BLL.UnitService.getUnitApiUrlByUnitId(project.SubjectUnit);
|
||||
//var ApiUrl = "";
|
||||
//var WebUrl = "";
|
||||
//if (!string.IsNullOrEmpty(Url))
|
||||
//{
|
||||
// var urls = Url.Split(',');
|
||||
// ApiUrl = urls[0];
|
||||
// if (urls.Length > 1)
|
||||
// {
|
||||
// WebUrl = urls[1];
|
||||
// }
|
||||
//}
|
||||
string ApiUrl = project.SubjectUnitApiUrl;
|
||||
string WebUrl = project.SubjectUnitWebUrl;
|
||||
// thisUnit.CollCropCode = "913404001520228377Y"; //分包单位社会统一信用码 测试使用
|
||||
// project.SubjectProject = "B409A8D7-48C7-486E-84C7-E3E7B2C0E5B7";//测试使用
|
||||
|
||||
|
||||
@@ -321,5 +321,28 @@ namespace BLL
|
||||
handleSteps.Add(handleStep4);
|
||||
return handleSteps;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据危险观察登记主键删除一个危险观察登记信息
|
||||
/// </summary>
|
||||
/// <param name="hazardRegisterId">危险观察登记主键</param>
|
||||
public static void DeleteHazardRegisterByCheckSpecialId(string checkSpecialId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
List<Model.HSSE_Hazard_HazardRegister> hazardRegisters = db.HSSE_Hazard_HazardRegister.Where(e => e.CheckSpecialId == checkSpecialId).ToList();
|
||||
if (hazardRegisters.Count > 0)
|
||||
{
|
||||
foreach (var hazardRegister in hazardRegisters)
|
||||
{
|
||||
if (hazardRegister.IsUpdate != true)
|
||||
{
|
||||
BLL.UploadFileService.DeleteFile(Funs.RootPath, hazardRegister.ImageUrl);//删除整改前图片
|
||||
BLL.UploadFileService.DeleteFile(Funs.RootPath, hazardRegister.RectificationImageUrl);//删除整改后图片
|
||||
db.HSSE_Hazard_HazardRegister.DeleteOnSubmit(hazardRegister);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1390,5 +1390,26 @@ namespace BLL
|
||||
return str;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 根据UserId主键获取人员信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public static void UpdatePersonTypeByProjectIdAndIdentityCard(string projectId, string identityCard)
|
||||
{
|
||||
|
||||
var persons = Funs.DB.SitePerson_Person.Where(x => x.IdentityCard == identityCard).ToList();
|
||||
|
||||
foreach (var item in persons)
|
||||
{
|
||||
if (item.ProjectId != projectId && item.States == Const.ProjectPersonStates_1)
|
||||
{
|
||||
item.States = Const.ProjectPersonStates_2;
|
||||
item.OutTime = DateTime.Now;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,7 @@ namespace BLL
|
||||
TrainPersonNum = largerHazard.TrainPersonNum,
|
||||
IsSuperLargerHazard = largerHazard.IsSuperLargerHazard,
|
||||
Descriptions = largerHazard.Descriptions,
|
||||
ApprovalState = largerHazard.ApprovalState,
|
||||
OperativesNum = largerHazard.OperativesNum
|
||||
};
|
||||
|
||||
@@ -73,6 +74,7 @@ namespace BLL
|
||||
newLargerHazard.IsSuperLargerHazard = largerHazard.IsSuperLargerHazard;
|
||||
newLargerHazard.Descriptions = largerHazard.Descriptions;
|
||||
newLargerHazard.RecordTime = largerHazard.RecordTime;
|
||||
newLargerHazard.ApprovalState = largerHazard.ApprovalState;
|
||||
newLargerHazard.IsUpdate = null;
|
||||
newLargerHazard.OperativesNum = largerHazard.OperativesNum;
|
||||
db.SubmitChanges();
|
||||
|
||||
@@ -1567,5 +1567,56 @@ namespace BLL
|
||||
return users;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据单位Id获取用户下拉选项【单位本部在职人员】
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Person_Persons> GetIsOfficeUserListByUnitId(string unitId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
List<Model.Person_Persons> list = new List<Model.Person_Persons>();
|
||||
list = (from x in db.Person_Persons
|
||||
where x.UnitId == unitId && x.IsOffice == true && x.IsPost == true
|
||||
orderby x.PersonName
|
||||
select x).ToList();
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用户下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName">下拉框名字</param>
|
||||
/// <param name="isShowPlease">是否显示请选择</param>
|
||||
public static void InitIsOfficeUserUnitIdDropDownList(FineUIPro.DropDownList dropName, string unitId, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "PersonId";
|
||||
dropName.DataTextField = "PersonName";
|
||||
dropName.DataSource = GetIsOfficeUserListByUnitId(unitId);
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据用户获取用户名称
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetUserNameByUserId(string userId)
|
||||
{
|
||||
string userName = string.Empty;
|
||||
Model.Person_Persons user = Funs.DB.Person_Persons.FirstOrDefault(e => e.PersonId == userId);
|
||||
if (user != null)
|
||||
{
|
||||
userName = user.PersonName;
|
||||
}
|
||||
|
||||
return userName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,6 +126,8 @@
|
||||
EnglishRemark = project.EnglishRemark,
|
||||
ProjectRealCode = project.ProjectRealCode,
|
||||
IsCNCECShow = project.IsCNCECShow,
|
||||
SubjectUnitApiUrl = project.SubjectUnitApiUrl,
|
||||
SubjectUnitWebUrl = project.SubjectUnitWebUrl,
|
||||
MasterSysId = project.MasterSysId,
|
||||
SubjectUnit = project.SubjectUnit,
|
||||
SubjectProject = project.SubjectProject,
|
||||
@@ -177,6 +179,8 @@
|
||||
newProject.ProjectRealCode = project.ProjectRealCode;
|
||||
newProject.IsCNCECShow = project.IsCNCECShow;
|
||||
newProject.MasterSysId = project.MasterSysId;
|
||||
newProject.SubjectUnitApiUrl = project.SubjectUnitApiUrl;
|
||||
newProject.SubjectUnitWebUrl = project.SubjectUnitWebUrl;
|
||||
newProject.SubjectUnit = project.SubjectUnit;
|
||||
newProject.SubjectProject = project.SubjectProject;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
namespace BLL
|
||||
{
|
||||
using Model;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
//using System.Net.Http.Headers;
|
||||
@@ -2052,6 +2053,44 @@
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 集团督查检查驳回整改
|
||||
|
||||
/// <summary>
|
||||
/// 集团督查检查驳回整改
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static ResponeData RejectRectify(DCGLCheckRectifyReject data)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var respone = new ResponeData();
|
||||
var rectifItem = db.DCGL_Check_CheckRectifyItem.FirstOrDefault(x => x.CheckRectifyItemId == data.CheckRectifyItemId);
|
||||
rectifItem.RealEndDate = null;
|
||||
rectifItem.Verification = data.Reason;
|
||||
db.SubmitChanges();
|
||||
var rectify = db.DCGL_Check_CheckRectify.FirstOrDefault(x => x.CheckRectifyId == rectifItem.CheckRectifyId);
|
||||
if (rectify != null)
|
||||
{
|
||||
var getNoUpdateItem = db.DCGL_Check_CheckRectifyItem.FirstOrDefault(x => x.CheckRectifyId == rectifItem.CheckRectifyId && !x.RealEndDate.HasValue);
|
||||
if (getNoUpdateItem == null)
|
||||
{
|
||||
rectify.HandleState = "3";
|
||||
}
|
||||
else
|
||||
{
|
||||
rectify.HandleState = "2";
|
||||
}
|
||||
db.SubmitChanges();
|
||||
}
|
||||
return respone;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 督查大队:重点工程项目质量专项整治行动开展情况台账上报
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -43,6 +43,15 @@ namespace BLL
|
||||
NewWaterConsumption = newtable.NewWaterConsumption,
|
||||
HeadOfficeInspectorGeneralNum = newtable.HeadOfficeInspectorGeneralNum,
|
||||
HeadOfficeFullTimeNum = newtable.HeadOfficeFullTimeNum,
|
||||
LargerClosedNum = newtable.LargerClosedNum,
|
||||
LargerNotClosedNum = newtable.LargerNotClosedNum,
|
||||
|
||||
AwaitApprovalNum = newtable.AwaitApprovalNum,
|
||||
PendingApprovalNum = newtable.PendingApprovalNum,
|
||||
CompletedApprovalNum = newtable.CompletedApprovalNum,
|
||||
SuperAwaitApprovalNum = newtable.SuperAwaitApprovalNum,
|
||||
SuperPendingApprovalNum = newtable.SuperPendingApprovalNum,
|
||||
SuperCompletedApprovalNum = newtable.SuperCompletedApprovalNum,
|
||||
BranchInspectorGeneralNum = newtable.BranchInspectorGeneralNum,
|
||||
BranchFullTimeNum = newtable.BranchFullTimeNum,
|
||||
ProjectInspectorGeneralNum = newtable.ProjectInspectorGeneralNum,
|
||||
@@ -182,6 +191,17 @@ namespace BLL
|
||||
item.EnterpriseTopicsMeetingNum = dataHsse.EnterpriseTopicsMeetingNum;
|
||||
item.FinishedNum = dataHsse.FinishedNum;
|
||||
item.ArgumentNum = dataHsse.ArgumentNum;
|
||||
item.LargerClosedNum = dataHsse.LargerClosedNum;
|
||||
item.LargerNotClosedNum = dataHsse.LargerNotClosedNum;
|
||||
item.LargerRate = "";
|
||||
|
||||
item.AwaitApprovalNum = dataHsse.AwaitApprovalNum;
|
||||
item.PendingApprovalNum = dataHsse.PendingApprovalNum;
|
||||
item.CompletedApprovalNum = dataHsse.CompletedApprovalNum;
|
||||
item.SuperAwaitApprovalNum = dataHsse.SuperAwaitApprovalNum;
|
||||
item.SuperPendingApprovalNum = dataHsse.SuperPendingApprovalNum;
|
||||
item.SuperCompletedApprovalNum = dataHsse.SuperCompletedApprovalNum;
|
||||
|
||||
item.GeneralAccidentNum = dataHsse.GeneralAccidentNum;
|
||||
item.GeneralClosedNum = dataHsse.GeneralClosedNum;
|
||||
item.GeneralNotClosedNum = dataHsse.GeneralNotClosedNum;
|
||||
@@ -492,6 +512,15 @@ namespace BLL
|
||||
CertificateANum = projectData.Sum(x => x.CertificateANum),
|
||||
CertificateBNum = projectData.Sum(x => x.CertificateBNum),
|
||||
CertificateCNum = projectData.Sum(x => x.CertificateCNum),
|
||||
LargerClosedNum = projectData.Sum(x => x.LargerClosedNum),
|
||||
LargerNotClosedNum = projectData.Sum(x => x.LargerNotClosedNum),
|
||||
|
||||
AwaitApprovalNum = projectData.Sum(x => x.AwaitApprovalNum),
|
||||
PendingApprovalNum = projectData.Sum(x => x.PendingApprovalNum),
|
||||
CompletedApprovalNum = projectData.Sum(x => x.CompletedApprovalNum),
|
||||
SuperAwaitApprovalNum = projectData.Sum(x => x.SuperAwaitApprovalNum),
|
||||
SuperPendingApprovalNum = projectData.Sum(x => x.SuperPendingApprovalNum),
|
||||
SuperCompletedApprovalNum = projectData.Sum(x => x.SuperCompletedApprovalNum),
|
||||
SafetyCommitteeMeetingNum = GetSafetyCommitteeMeeting().Count,
|
||||
EnterpriseTopicsMeetingNum = GetEnterpriseTopicsMeetingNum(),
|
||||
ProjectSafetyLeadingGroupMeetingNum = projectData.Sum(x => x.ProjectSafetyLeadingGroupMeetingNum),
|
||||
@@ -668,7 +697,7 @@ namespace BLL
|
||||
var newWaterConsumptionTask = ChemicalReportItemService.GetLatstTimeNewWaterConsumption();
|
||||
var securityRiskOutputListTask = HSSEData_HSSEService.GetSecurityRiskOutputsAsync();
|
||||
var largeEngineeringOutputsTask = HSSEData_HSSEService.GetLargeEngineeringOutputsAsync();
|
||||
|
||||
var largerHiddenRectificationOutputsTask = HSSEData_HSSEService.GetLargerHiddenRectificationOutputsAsync();
|
||||
var safetyInjectionEngineerTask = HSSEData_HSSEService.GetSafetyInjectionEngineerAsync();
|
||||
var certificateATask = HSSEData_HSSEService.GetCertificateAAsync();
|
||||
var certificateBTask = HSSEData_HSSEService.GetCertificateBAsync();
|
||||
@@ -742,6 +771,7 @@ namespace BLL
|
||||
certificateATask,
|
||||
certificateBTask,
|
||||
certificateCTask,
|
||||
largerHiddenRectificationOutputsTask,
|
||||
qualityPersonNumTask,
|
||||
beUnderConstructionTask,
|
||||
shutdownTask,
|
||||
@@ -810,6 +840,7 @@ namespace BLL
|
||||
var certificateAList = await certificateATask;
|
||||
var certificateBList = await certificateBTask;
|
||||
var certificateCList = await certificateCTask;
|
||||
var largerHiddenRectificationOutputsList = await largerHiddenRectificationOutputsTask;
|
||||
var qualityPersonList = await qualityPersonNumTask;
|
||||
var beUnderConstructionList = await beUnderConstructionTask;
|
||||
var shutdownList = await shutdownTask;
|
||||
@@ -890,6 +921,16 @@ namespace BLL
|
||||
TotalWorkingHour = totalWorkingHour,
|
||||
LostWorkingHour = lostWorkingHour,
|
||||
SafeWorkingHour = safeWorkingHour,
|
||||
LargerClosedNum = largerHiddenRectificationOutputsList.Sum(x => x.RecNum),
|
||||
LargerNotClosedNum = largerHiddenRectificationOutputsList.Sum(x => x.NoRecNum),
|
||||
|
||||
AwaitApprovalNum = largeEngineeringOutputsTask.Result.Sum(x => x.AwaitApprovalNum),
|
||||
PendingApprovalNum = largeEngineeringOutputsTask.Result.Sum(x => x.PendingApprovalNum),
|
||||
CompletedApprovalNum = largeEngineeringOutputsTask.Result.Sum(x => x.CompletedApprovalNum),
|
||||
SuperAwaitApprovalNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperAwaitApprovalNum),
|
||||
SuperPendingApprovalNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperPendingApprovalNum),
|
||||
SuperCompletedApprovalNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperCompletedApprovalNum),
|
||||
|
||||
SafeTrainNum = safeTrainList.Sum(x => x.TrainPersonNum),
|
||||
SpecialTrainNum = specialTrainList.Sum(x => x.TrainPersonNum),
|
||||
SpecialOperationTrainNum = specialOperationTrainList.Sum(x => x.TrainPersonNum),
|
||||
@@ -978,6 +1019,12 @@ namespace BLL
|
||||
g => g.Key,
|
||||
g => new { ClosedNum = g.Sum(x => x.RecNum), NotClosedNum = g.Sum(x => x.NoRecNum) }
|
||||
);
|
||||
var largerHiddenRectificationOutputsDict = largerHiddenRectificationOutputsList
|
||||
.GroupBy(x => x.ProjectId)
|
||||
.ToDictionary(
|
||||
g => g.Key,
|
||||
g => new { ClosedNum = g.Sum(x => x.RecNum), NotClosedNum = g.Sum(x => x.NoRecNum) }
|
||||
);
|
||||
var majorHiddenRectificationOutputsDict = majorHiddenRectificationOutputsList
|
||||
.GroupBy(x => x.ProjectId)
|
||||
.ToDictionary(
|
||||
@@ -1015,12 +1062,19 @@ namespace BLL
|
||||
SuperOperativesNum = g.Sum(x => x.SuperOperativesNum),
|
||||
SuperConstructionNum = g.Sum(x => x.SuperConstructionNum),
|
||||
SuperFinishedNum = g.Sum(x => x.SuperFinishedNum),
|
||||
AwaitApprovalNum = g.Sum(x => x.AwaitApprovalNum),
|
||||
PendingApprovalNum = g.Sum(x => x.PendingApprovalNum),
|
||||
CompletedApprovalNum = g.Sum(x => x.CompletedApprovalNum),
|
||||
SuperAwaitApprovalNum = g.Sum(x => x.SuperAwaitApprovalNum),
|
||||
SuperPendingApprovalNum = g.Sum(x => x.SuperPendingApprovalNum),
|
||||
SuperCompletedApprovalNum = g.Sum(x => x.SuperCompletedApprovalNum),
|
||||
SuperArgumentNum = g.Sum(x => x.SuperArgumentNum)
|
||||
}
|
||||
);
|
||||
foreach (var projectid in BeUnderConstructionList)
|
||||
{
|
||||
generalHiddenRectificationOutputsDict.TryGetValue(projectid, out var generalHiddenRectificationOutputs);
|
||||
largerHiddenRectificationOutputsDict.TryGetValue(projectid, out var largerHiddenRectificationOutputs);
|
||||
majorHiddenRectificationOutputsDict.TryGetValue(projectid, out var majorHiddenRectificationOutputs);
|
||||
securityRiskOutputDict.TryGetValue(projectid, out var securityRiskOutputs);
|
||||
largeEngineeringOutputsDict.TryGetValue(projectid, out var largeEngineeringOutputs);
|
||||
@@ -1042,6 +1096,14 @@ namespace BLL
|
||||
SpecialOperationTrainNum = specialOperationTrainList.Where(x => x.ProjectId == projectid).Sum(x => x.TrainPersonNum),
|
||||
HseTechnicalNum = hseTechnicalList.Count(x => x.ProjectId == projectid),
|
||||
EnvironmentalTrainNum = 0,
|
||||
LargerClosedNum = largerHiddenRectificationOutputs?.ClosedNum ?? 0,
|
||||
LargerNotClosedNum = largerHiddenRectificationOutputs?.NotClosedNum ?? 0,
|
||||
AwaitApprovalNum = largeEngineeringOutputs?.AwaitApprovalNum ?? 0,
|
||||
PendingApprovalNum = largeEngineeringOutputs?.PendingApprovalNum ?? 0,
|
||||
CompletedApprovalNum = largeEngineeringOutputs?.CompletedApprovalNum ?? 0,
|
||||
SuperAwaitApprovalNum = largeEngineeringOutputs?.SuperAwaitApprovalNum ?? 0,
|
||||
SuperPendingApprovalNum = largeEngineeringOutputs?.SuperPendingApprovalNum ?? 0,
|
||||
SuperCompletedApprovalNum = largeEngineeringOutputs?.SuperCompletedApprovalNum ?? 0,
|
||||
TotalEnergyConsumption = 0,
|
||||
IncomeComprehensiveEnergyConsumption = 0,
|
||||
NewWaterConsumption = 0,
|
||||
@@ -1277,6 +1339,14 @@ namespace BLL
|
||||
table.SafeWorkingHour = newtable.SafeWorkingHour;
|
||||
table.SafeTrainNum = newtable.SafeTrainNum;
|
||||
table.SpecialTrainNum = newtable.SpecialTrainNum;
|
||||
table.LargerClosedNum = newtable.LargerClosedNum;
|
||||
table.LargerNotClosedNum = newtable.LargerNotClosedNum;
|
||||
table.AwaitApprovalNum = newtable.AwaitApprovalNum;
|
||||
table.PendingApprovalNum = newtable.PendingApprovalNum;
|
||||
table.CompletedApprovalNum = newtable.CompletedApprovalNum;
|
||||
table.SuperAwaitApprovalNum = newtable.SuperAwaitApprovalNum;
|
||||
table.SuperPendingApprovalNum = newtable.SuperPendingApprovalNum;
|
||||
table.SuperCompletedApprovalNum = newtable.SuperCompletedApprovalNum;
|
||||
table.SpecialOperationTrainNum = newtable.SpecialOperationTrainNum;
|
||||
table.HseTechnicalNum = newtable.HseTechnicalNum;
|
||||
table.EnvironmentalTrainNum = newtable.EnvironmentalTrainNum;
|
||||
@@ -3937,24 +4007,24 @@ namespace BLL
|
||||
{
|
||||
List<LicenseOutput> result = new List<LicenseOutput>();
|
||||
var result1 = (from x in Funs.DB.View_License_LicenseManager
|
||||
where BeUnderConstructionList.Contains(x.ProjectId) && x.IsHighRisk == true &&
|
||||
x.CompileDate > Const.DtmarkTime
|
||||
select new Model.LicenseOutput
|
||||
{
|
||||
Id = x.LicenseManagerId,
|
||||
ProjectId = x.ProjectId,
|
||||
ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId),
|
||||
UnitId = x.UnitId,
|
||||
UnitName = UnitService.GetUnitNameByUnitId(x.UnitId),
|
||||
LicenseTypeName = x.LicenseTypeName,
|
||||
UnitTypeName = "",
|
||||
IsHighRisk = x.IsHighRisk,
|
||||
WorkAreaName = "",
|
||||
CompileDate = x.CompileDate,
|
||||
StartDate = x.StartDate,
|
||||
EndDate = x.EndDate,
|
||||
WorkStatesStr = ""
|
||||
}).ToList();
|
||||
where BeUnderConstructionList.Contains(x.ProjectId) && x.IsHighRisk == true &&
|
||||
x.CompileDate > Const.DtmarkTime
|
||||
select new Model.LicenseOutput
|
||||
{
|
||||
Id = x.LicenseManagerId,
|
||||
ProjectId = x.ProjectId,
|
||||
ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId),
|
||||
UnitId = x.UnitId,
|
||||
UnitName = UnitService.GetUnitNameByUnitId(x.UnitId),
|
||||
LicenseTypeName = x.LicenseTypeName,
|
||||
UnitTypeName = "",
|
||||
IsHighRisk = x.IsHighRisk,
|
||||
WorkAreaName = "",
|
||||
CompileDate = x.CompileDate,
|
||||
StartDate = x.StartDate,
|
||||
EndDate = x.EndDate,
|
||||
WorkStatesStr = ""
|
||||
}).ToList();
|
||||
var result2 = (from x in Funs.DB.License_FireWork
|
||||
where BeUnderConstructionList.Contains(x.ProjectId)
|
||||
select new Model.LicenseOutput
|
||||
@@ -4162,7 +4232,7 @@ namespace BLL
|
||||
var query = (from x in Funs.DB.Base_Project
|
||||
join y in Funs.DB.HSSE_Hazard_HazardRegister on x.ProjectId equals y.ProjectId into yGroup
|
||||
from y in yGroup.DefaultIfEmpty()
|
||||
where BeUnderConstructionList.Contains(x.ProjectId) && y.ProblemTypes == "1" && (y.HazardValue == "0.3" || y.HazardValue == "1" || y.HazardValue == null) && y.CheckTime > Const.DtmarkTime
|
||||
where BeUnderConstructionList.Contains(x.ProjectId) && y.ProblemTypes == "1" && (y.HazardValue == "0.3" || y.HazardValue == null) && y.CheckTime > Const.DtmarkTime
|
||||
group y by new { x.ProjectId, x.ProjectName, x.ProjectCode } into gg
|
||||
select new HiddenRectificationOutput
|
||||
{
|
||||
@@ -4188,6 +4258,42 @@ namespace BLL
|
||||
return await Task.Run(GetGeneralHiddenRectificationOutputs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取较大隐患数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.HiddenRectificationOutput> GetLargerHiddenRectificationOutputs()
|
||||
{
|
||||
var query = (from x in Funs.DB.Base_Project
|
||||
join y in Funs.DB.HSSE_Hazard_HazardRegister on x.ProjectId equals y.ProjectId into yGroup
|
||||
from y in yGroup.DefaultIfEmpty()
|
||||
where BeUnderConstructionList.Contains(x.ProjectId) && y.ProblemTypes == "1" && y.HazardValue == "1" && y.CheckTime > Const.DtmarkTime
|
||||
group y by new { x.ProjectId, x.ProjectName, x.ProjectCode } into gg
|
||||
select new HiddenRectificationOutput
|
||||
{
|
||||
ProjectId = gg.Key.ProjectId,
|
||||
ProjectName = gg.Key.ProjectName,
|
||||
ProjectCode = gg.Key.ProjectCode,
|
||||
ProNum = gg.Count(y => y.States != "4" && y.States != "-1"),
|
||||
RecNum = gg.Count(y => y.States == "3"),
|
||||
NoRecNum = gg.Count(y => y.States != "3" && y.States != "4" && y.States != "-1"),
|
||||
RecRate = gg.Count(y => y.States != "4" && y.States != "-1") == 0 ? "0" :
|
||||
Math.Round(Convert.ToDecimal(gg.Count(y => y.States == "3") /
|
||||
gg.Count(y => y.States != "4" && y.States != "-1") * 100), 2, MidpointRounding.AwayFromZero).ToString()
|
||||
}).ToList();
|
||||
|
||||
foreach (var item in query)
|
||||
{
|
||||
item.RecRate = Math.Round(Convert.ToDecimal(item.RecRate), 2).ToString(); // 转换为字符串并格式化为两位小数
|
||||
}
|
||||
return query;
|
||||
}
|
||||
public static async Task<List<Model.HiddenRectificationOutput>> GetLargerHiddenRectificationOutputsAsync()
|
||||
{
|
||||
return await Task.Run(GetLargerHiddenRectificationOutputs);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取重大隐患数据
|
||||
/// </summary>
|
||||
@@ -4285,6 +4391,12 @@ namespace BLL
|
||||
SuperArgumentNum = gg.Count(x => x.IsArgument == true && x.IsSuperLargerHazard == true),
|
||||
OperativesNum = gg.Where(x => x.IsSuperLargerHazard == false).Sum(x => x.OperativesNum) ?? 0,
|
||||
SuperOperativesNum = gg.Where(x => x.IsSuperLargerHazard == true).Sum(x => x.OperativesNum) ?? 0,
|
||||
AwaitApprovalNum = gg.Count(x => x.ApprovalState == "0" && x.IsSuperLargerHazard == false),
|
||||
PendingApprovalNum = gg.Count(x => x.ApprovalState == "1" && x.IsSuperLargerHazard == false),
|
||||
CompletedApprovalNum = gg.Count(x => x.ApprovalState == "2" && x.IsSuperLargerHazard == false),
|
||||
SuperAwaitApprovalNum = gg.Count(x => x.ApprovalState == "0" && x.IsSuperLargerHazard == true),
|
||||
SuperPendingApprovalNum = gg.Count(x => x.ApprovalState == "1" && x.IsSuperLargerHazard == true),
|
||||
SuperCompletedApprovalNum = gg.Count(x => x.ApprovalState == "2" && x.IsSuperLargerHazard == true),
|
||||
}).ToList();
|
||||
return query;
|
||||
|
||||
@@ -4531,6 +4643,14 @@ namespace BLL
|
||||
x.SpecialTrainNum,
|
||||
x.SpecialOperationTrainNum,
|
||||
x.HseTechnicalNum,
|
||||
x.LargerClosedNum,
|
||||
x.LargerNotClosedNum,
|
||||
x.AwaitApprovalNum,
|
||||
x.PendingApprovalNum,
|
||||
x.CompletedApprovalNum,
|
||||
x.SuperAwaitApprovalNum,
|
||||
x.SuperPendingApprovalNum,
|
||||
x.SuperCompletedApprovalNum,
|
||||
x.EnvironmentalTrainNum,
|
||||
x.TotalEnergyConsumption,
|
||||
x.IncomeComprehensiveEnergyConsumption,
|
||||
|
||||
@@ -127,6 +127,16 @@ namespace BLL
|
||||
LostWorkingHour = newtable.LostWorkingHour,
|
||||
SafeWorkingHour = newtable.SafeWorkingHour,
|
||||
SafeTrainNum = newtable.SafeTrainNum,
|
||||
LargerClosedNum = newtable.LargerClosedNum,
|
||||
LargerNotClosedNum = newtable.LargerNotClosedNum,
|
||||
|
||||
AwaitApprovalNum = newtable.AwaitApprovalNum,
|
||||
PendingApprovalNum = newtable.PendingApprovalNum,
|
||||
CompletedApprovalNum = newtable.CompletedApprovalNum,
|
||||
SuperAwaitApprovalNum = newtable.SuperAwaitApprovalNum,
|
||||
SuperPendingApprovalNum = newtable.SuperPendingApprovalNum,
|
||||
SuperCompletedApprovalNum = newtable.SuperCompletedApprovalNum,
|
||||
|
||||
SpecialTrainNum = newtable.SpecialTrainNum,
|
||||
SpecialOperationTrainNum = newtable.SpecialOperationTrainNum,
|
||||
HseTechnicalNum = newtable.HseTechnicalNum,
|
||||
@@ -275,6 +285,18 @@ namespace BLL
|
||||
table.TotalEnergyConsumption = newtable.TotalEnergyConsumption;
|
||||
table.IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption;
|
||||
table.NewWaterConsumption = newtable.NewWaterConsumption;
|
||||
table.LargerClosedNum = newtable.LargerClosedNum;
|
||||
table.LargerNotClosedNum = newtable.LargerNotClosedNum;
|
||||
|
||||
table.ArgumentNum = newtable.ArgumentNum;
|
||||
table.SuperArgumentNum = newtable.SuperArgumentNum;
|
||||
table.AwaitApprovalNum = newtable.AwaitApprovalNum;
|
||||
table.PendingApprovalNum = newtable.PendingApprovalNum;
|
||||
table.CompletedApprovalNum = newtable.CompletedApprovalNum;
|
||||
table.SuperAwaitApprovalNum = newtable.SuperAwaitApprovalNum;
|
||||
table.SuperPendingApprovalNum = newtable.SuperPendingApprovalNum;
|
||||
table.SuperCompletedApprovalNum = newtable.SuperCompletedApprovalNum;
|
||||
|
||||
table.HeadOfficeInspectorGeneralNum = newtable.HeadOfficeInspectorGeneralNum;
|
||||
table.HeadOfficeFullTimeNum = newtable.HeadOfficeFullTimeNum;
|
||||
table.BranchInspectorGeneralNum = newtable.BranchInspectorGeneralNum;
|
||||
@@ -552,6 +574,9 @@ namespace BLL
|
||||
table.GeneralNotClosedNum = GetGeneralNotClosedNum(projectid);
|
||||
table.MajorClosedNum = GetMajorClosedNum(projectid);
|
||||
table.MajorNotClosedNum = GetMajorNotClosedNum(projectid);
|
||||
table.LargerClosedNum = GetLargerClosedNum(projectid);
|
||||
table.LargerNotClosedNum = GetLargerNotClosedNum(projectid);
|
||||
|
||||
}
|
||||
|
||||
if (hSseDateType == HSSEDateType.SecurityRisk || hSseDateType == HSSEDateType.All)
|
||||
@@ -616,6 +641,14 @@ namespace BLL
|
||||
table.SuperOperativesNum = GetSuperOperativesNum(projectid);
|
||||
table.SuperConstructionNum = GetSuperConstructionNum(projectid);
|
||||
table.SuperFinishedNum = GetSuperFinishedNum(projectid);
|
||||
table.ArgumentNum = GetArgumentNum(projectid);
|
||||
table.SuperArgumentNum = GetSuperArgumentNum(projectid);
|
||||
table.AwaitApprovalNum = GetAwaitApprovalNum(projectid);
|
||||
table.PendingApprovalNum = GetPendingApprovalNum(projectid);
|
||||
table.CompletedApprovalNum = GetCompletedApprovalNum(projectid);
|
||||
table.SuperAwaitApprovalNum = GetSuperAwaitApprovalNum(projectid);
|
||||
table.SuperPendingApprovalNum = GetSuperPendingApprovalNum(projectid);
|
||||
table.SuperCompletedApprovalNum = GetSuperCompletedApprovalNum(projectid);
|
||||
}
|
||||
|
||||
if (IsReportByToday(projectid))
|
||||
@@ -1389,7 +1422,7 @@ namespace BLL
|
||||
public static int GetGeneralClosedNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
|
||||
where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == "1" || x.HazardValue == null) && x.States == "3" &&
|
||||
where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == null) && x.States == "3" &&
|
||||
x.CheckTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
@@ -1402,7 +1435,33 @@ namespace BLL
|
||||
public static int GetGeneralNotClosedNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
|
||||
where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == "1" || x.HazardValue == null) && x.States != "3" && x.States != "-1" &&
|
||||
where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == null) && x.States != "3" && x.States != "-1" &&
|
||||
x.CheckTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取较大隐患整改闭环项
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static int GetLargerClosedNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
|
||||
where x.ProjectId == projectid && x.HazardValue == "1" && x.States == "3" &&
|
||||
x.CheckTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取较大隐患未整改完成项
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static int GetLargerNotClosedNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
|
||||
where x.ProjectId == projectid && x.HazardValue == "1" && x.States != "3" && x.States != "-1" &&
|
||||
x.CheckTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
@@ -1537,6 +1596,105 @@ namespace BLL
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取危大工程论证个数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static int GetArgumentNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.Solution_LargerHazard
|
||||
where x.ProjectId == projectid && x.IsArgument == true && x.IsSuperLargerHazard == false &&
|
||||
x.RecordTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取超危大工程论证个数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static int GetSuperArgumentNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.Solution_LargerHazard
|
||||
where x.ProjectId == projectid && x.IsArgument == true && x.IsSuperLargerHazard == true &&
|
||||
x.RecordTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取危大工程待审核个数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static int GetAwaitApprovalNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.Solution_LargerHazard
|
||||
where x.ProjectId == projectid && x.ApprovalState == "0" && x.IsSuperLargerHazard == false && x.RecordTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取超危大工程待审核个数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static int GetSuperAwaitApprovalNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.Solution_LargerHazard
|
||||
where x.ProjectId == projectid && x.ApprovalState == "0" && x.IsSuperLargerHazard == true && x.RecordTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取危大工程审核中个数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static int GetPendingApprovalNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.Solution_LargerHazard
|
||||
where x.ProjectId == projectid && x.ApprovalState == "1" && x.IsSuperLargerHazard == false && x.RecordTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取超危大工程审核中个数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static int GetSuperPendingApprovalNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.Solution_LargerHazard
|
||||
where x.ProjectId == projectid && x.ApprovalState == "1" && x.IsSuperLargerHazard == true && x.RecordTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取危大工程已完成个数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static int GetCompletedApprovalNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.Solution_LargerHazard
|
||||
where x.ProjectId == projectid && x.ApprovalState == "2" && x.IsSuperLargerHazard == false && x.RecordTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取超危大工程已完成个数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static int GetSuperCompletedApprovalNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.Solution_LargerHazard
|
||||
where x.ProjectId == projectid && x.ApprovalState == "2" && x.IsSuperLargerHazard == true && x.RecordTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取超危大工程审批完成数
|
||||
/// </summary>
|
||||
@@ -1639,6 +1797,18 @@ namespace BLL
|
||||
x.SafeWorkingHour,
|
||||
x.SafeTrainNum,
|
||||
x.SpecialTrainNum,
|
||||
x.LargerClosedNum,
|
||||
x.LargerNotClosedNum,
|
||||
|
||||
x.ArgumentNum,
|
||||
x.SuperArgumentNum,
|
||||
x.AwaitApprovalNum,
|
||||
x.PendingApprovalNum,
|
||||
x.CompletedApprovalNum,
|
||||
x.SuperAwaitApprovalNum,
|
||||
x.SuperPendingApprovalNum,
|
||||
x.SuperCompletedApprovalNum,
|
||||
|
||||
x.SpecialOperationTrainNum,
|
||||
x.TotalEnergyConsumption,
|
||||
x.IncomeComprehensiveEnergyConsumption,
|
||||
|
||||
@@ -214,10 +214,10 @@ namespace BLL
|
||||
ProjectId = r.ProjectId,
|
||||
CheckUnitName = u.UnitName,
|
||||
States = r.States,
|
||||
ProblemStatesName = i.CompleteStatus==1 ? "已整改":"未整改",
|
||||
ProblemStatesName = i.CompleteStatus == 1 ? "已整改" : "未整改",
|
||||
ProblemStates = i.CompleteStatus,
|
||||
InsResponsibleUserId = r.InsResponsibleUserId,
|
||||
InsResponsibleUserName= user.PersonName
|
||||
InsResponsibleUserName = user.PersonName
|
||||
};
|
||||
|
||||
// 应用检查大类过滤
|
||||
@@ -281,17 +281,24 @@ namespace BLL
|
||||
var thisUnit = BLL.CommonService.GetIsThisUnit();
|
||||
if (thisUnit.UnitId != input.UnitId)
|
||||
{
|
||||
// 先获取用户有权限的项目ID列表
|
||||
var projectIds = (from p in Funs.DB.Base_Project
|
||||
where p.UnitId == input.UnitId
|
||||
select p.ProjectId).ToList();
|
||||
//// 先获取用户有权限的项目ID列表
|
||||
//var projectIds = (from p in Funs.DB.Base_Project
|
||||
// where p.UnitId == input.UnitId
|
||||
// select p.ProjectId).ToList();
|
||||
|
||||
//// 过滤查询结果
|
||||
//query = query.Where(x => Funs.DB.Supervise_UnitHazardRegister
|
||||
// .Any(r => Funs.DB.Supervise_UnitHazardRegisterItem
|
||||
// .Any(i => i.UnitHazardRegisterItemId == x.UnitHazardRegisterItemId &&
|
||||
// i.UnitHazardRegisterId == r.UnitHazardRegisterId &&
|
||||
// projectIds.Contains(r.ProjectId))));
|
||||
|
||||
// 过滤查询结果
|
||||
query = query.Where(x => Funs.DB.Supervise_UnitHazardRegister
|
||||
.Any(r => Funs.DB.Supervise_UnitHazardRegisterItem
|
||||
.Any(i => i.UnitHazardRegisterItemId == x.UnitHazardRegisterItemId &&
|
||||
i.UnitHazardRegisterId == r.UnitHazardRegisterId &&
|
||||
projectIds.Contains(r.ProjectId))));
|
||||
input.UnitId == r.CheckUnitId)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace BLL
|
||||
|
||||
public enum StateInt : int
|
||||
{
|
||||
待提交 = 0,
|
||||
待整改= 1,
|
||||
部分整改 = 2,
|
||||
已闭环 = 3,
|
||||
待提交 = 0,
|
||||
待整改 = 1,
|
||||
部分整改 = 2,
|
||||
已闭环 = 3,
|
||||
}
|
||||
|
||||
#endregion Enums
|
||||
@@ -51,6 +51,7 @@ namespace BLL
|
||||
CheckDate = register.CheckDate,
|
||||
CheckMainType = register.CheckMainType,
|
||||
CheckType = register.CheckType,
|
||||
InspectionUnit = register.InspectionUnit,
|
||||
ProjectId = register.ProjectId,
|
||||
CheckUnitId = register.CheckUnitId,
|
||||
CheckTeam = register.CheckTeam,
|
||||
@@ -59,7 +60,7 @@ namespace BLL
|
||||
InsResponsibleUserId = register.InsResponsibleUserId,
|
||||
EvaluationResult = register.EvaluationResult,
|
||||
AttachUrl = register.AttachUrl,
|
||||
States = register.States??0,
|
||||
States = register.States ?? 0,
|
||||
CompileMan = register.CompileMan,
|
||||
CreateDate = DateTime.Now
|
||||
};
|
||||
@@ -118,8 +119,8 @@ namespace BLL
|
||||
}
|
||||
public static int GetCount(string checkMainType)
|
||||
{
|
||||
return (from x in Funs.DB.Supervise_UnitHazardRegister
|
||||
where x.CheckMainType ==checkMainType
|
||||
return (from x in Funs.DB.Supervise_UnitHazardRegister
|
||||
where x.CheckMainType == checkMainType
|
||||
select x.UnitHazardRegisterId).Count();
|
||||
}
|
||||
/// <summary>
|
||||
@@ -143,7 +144,7 @@ namespace BLL
|
||||
if (register == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 只有"待提交"状态可以删除,其他状态不能删除
|
||||
return register.States <= (int)StateInt.待提交;
|
||||
}
|
||||
@@ -171,6 +172,9 @@ namespace BLL
|
||||
on new { MainType = x.CheckMainType, TypeCode = x.CheckType }
|
||||
equals new { MainType = ct.CheckMainType, TypeCode = ct.CheckTypeCode } into ctGroup
|
||||
from ct in ctGroup.DefaultIfEmpty()
|
||||
join inu in db.Base_Unit
|
||||
on x.InspectionUnit equals inu.UnitId into inuGroup
|
||||
from inu in inuGroup.DefaultIfEmpty()
|
||||
join u in db.Base_Unit
|
||||
on x.CheckUnitId equals u.UnitId into uGroup
|
||||
from u in uGroup.DefaultIfEmpty()
|
||||
@@ -185,7 +189,9 @@ namespace BLL
|
||||
CheckMainTypeName = x.CheckMainType == "0" ? "安全" : "质量",
|
||||
CheckType = x.CheckType,
|
||||
CheckTypeName = ct.CheckTypeName,
|
||||
InspectionUnitName = inu.UnitName,
|
||||
CheckObjectText = p.ProjectName,
|
||||
CheckUnitId = x.CheckUnitId,
|
||||
CheckUnitName = u.UnitName,
|
||||
CheckTeam = x.CheckTeam,
|
||||
EvaluationResult = x.EvaluationResult,
|
||||
@@ -219,6 +225,10 @@ namespace BLL
|
||||
{
|
||||
query = query.Where(x => x.ProjectId != null && x.ProjectId == input.ProjectId);
|
||||
}
|
||||
if (input != null && !string.IsNullOrEmpty(input.CheckUnitId) && input.CheckUnitId != BLL.Const.UnitId_SEDIN)
|
||||
{
|
||||
query = query.Where(x => x.CheckUnitId != null && x.CheckUnitId == input.CheckUnitId);
|
||||
}
|
||||
|
||||
// 获取总数
|
||||
totalCount = query.Count();
|
||||
@@ -235,7 +245,7 @@ namespace BLL
|
||||
.Skip(pageIndex * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新企业级检查记录
|
||||
@@ -253,6 +263,7 @@ namespace BLL
|
||||
newRegister.CheckDate = register.CheckDate;
|
||||
newRegister.CheckMainType = register.CheckMainType;
|
||||
newRegister.CheckType = register.CheckType;
|
||||
newRegister.InspectionUnit = register.InspectionUnit;
|
||||
newRegister.ProjectId = register.ProjectId;
|
||||
newRegister.CheckUnitId = register.CheckUnitId;
|
||||
newRegister.CheckTeam = register.CheckTeam;
|
||||
|
||||
Reference in New Issue
Block a user