三库三期
This commit is contained in:
@@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
@@ -52,6 +53,172 @@ namespace BLL
|
||||
|
||||
#region 业务更新
|
||||
|
||||
#region 班前喊话发起记录
|
||||
|
||||
/// <summary>
|
||||
/// 更新班前喊话发起记录
|
||||
/// </summary>
|
||||
/// <param name="recordId">班前会id</param>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public static string UpdateWorkBriefingRecord(string recordId, ref string message)
|
||||
{
|
||||
string result = string.Empty;
|
||||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||||
{
|
||||
var models = from tba in db.Meeting_ClassMeeting
|
||||
join bu in db.Base_Unit on tba.UnitId equals bu.UnitId
|
||||
join suc in db.Sys_User on tba.CompileMan equals suc.UserId
|
||||
join ppu in db.Project_ProjectUser on tba.CompileMan equals ppu.UserId
|
||||
join ppusr in db.Sys_Role on ppu.RoleId equals ppusr.RoleId
|
||||
join bp in db.Base_Project on tba.ProjectId equals bp.ProjectId
|
||||
join pms in db.Ads_pms_pro_info_build on bp.MasterSysId equals pms.Pro_id
|
||||
where tba.ClassMeetingId == recordId
|
||||
select new SankuWorkBriefing
|
||||
{
|
||||
RECORD_ID = tba.ClassMeetingId,
|
||||
//PROJECT_CODE = pms.Pro_code.ToString(),
|
||||
PROJECT_CODE = pms.Pro_code,
|
||||
PROJECT_NAME = pms.Pro_name,
|
||||
SUBCONTRACTOR_ID = bu.MasterAdOrgCode,
|
||||
SUBCONTRACTOR_CODE = bu.CollCropCode,
|
||||
SUBCONTRACTOR_NAME = bu.UnitName,
|
||||
PERSONNEL_ID_NUMBER = suc.IdentityCard,
|
||||
PERSONNEL_NAME = suc.UserName,
|
||||
BRIEFING_TIME = (DateTime)tba.ClassMeetingDate,
|
||||
BRIEFING_DATE = ((DateTime)tba.ClassMeetingDate).AddDays(-1),
|
||||
POSITION_NAME = ppusr != null ? ppusr.RoleName : "安全员",
|
||||
BRIEFING_CONTENT = WorkContent(tba.ClassMeetingName, tba.ClassMeetingContents),
|
||||
PARTICIPANT_COUNT = tba.AttentPersonNum ?? 1,
|
||||
SUBMITTER_ID_NUMBER = suc.IdentityCard,
|
||||
SUBMITTER_NAME = suc.UserName,
|
||||
UPDATE_TIME = tba.CompileDate != null ? (DateTime)tba.CompileDate : (DateTime)tba.ClassMeetingDate,
|
||||
CREATE_TIME = tba.CompileDate != null ? (DateTime)tba.CompileDate : (DateTime)tba.ClassMeetingDate
|
||||
};
|
||||
var model = models.ToList().FirstOrDefault();
|
||||
List<string> errMsgs = new List<string>();
|
||||
if (model != null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(model.PROJECT_CODE))
|
||||
{
|
||||
errMsgs.Add("项目未关联集团主数据");
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(model.SUBCONTRACTOR_ID) && string.IsNullOrWhiteSpace(model.SUBCONTRACTOR_CODE))
|
||||
{
|
||||
errMsgs.Add("单位未关联主数据组织且统一社会信用代码为空");
|
||||
}
|
||||
else if (string.IsNullOrWhiteSpace(model.SUBCONTRACTOR_ID) && !string.IsNullOrWhiteSpace(model.SUBCONTRACTOR_CODE) && model.SUBCONTRACTOR_CODE.Length != 18)
|
||||
{
|
||||
errMsgs.Add("单位未关联主数据组织且统一社会信用代码异常");
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(model.PERSONNEL_ID_NUMBER) && model.PERSONNEL_ID_NUMBER.Length != 18)
|
||||
{
|
||||
errMsgs.Add("整理人身份证异常");
|
||||
}
|
||||
//if (!string.IsNullOrWhiteSpace(model.SUBMITTER_ID_NUMBER) && model.SUBMITTER_ID_NUMBER.Length != 18)
|
||||
//{
|
||||
// errMsgs.Add("填报人身份证异常");
|
||||
//}
|
||||
if (errMsgs.Any())
|
||||
{
|
||||
message = $"无法更新三库,数据异常:{string.Join(",", errMsgs)}";
|
||||
}
|
||||
else
|
||||
{
|
||||
var exist = db.SANKU_WORK_BRIEFING.Where(x => x.RECORD_ID == model.RECORD_ID).FirstOrDefault();
|
||||
if (exist != null)
|
||||
{
|
||||
//更新三库
|
||||
exist.RECORD_ID = model.RECORD_ID;
|
||||
exist.PROJECT_CODE = model.PROJECT_CODE;
|
||||
exist.PROJECT_NAME = model.PROJECT_NAME;
|
||||
exist.SUBCONTRACTOR_ID = model.SUBCONTRACTOR_ID;
|
||||
exist.SUBCONTRACTOR_CODE = model.SUBCONTRACTOR_CODE;
|
||||
exist.SUBCONTRACTOR_NAME = model.SUBCONTRACTOR_NAME;
|
||||
exist.PERSONNEL_ID_NUMBER = model.PERSONNEL_ID_NUMBER;
|
||||
exist.PERSONNEL_NAME = model.PERSONNEL_NAME;
|
||||
exist.BRIEFING_TIME = model.BRIEFING_TIME;
|
||||
exist.BRIEFING_DATE = model.BRIEFING_DATE;
|
||||
exist.POSITION_NAME = model.POSITION_NAME;
|
||||
exist.BRIEFING_CONTENT = model.BRIEFING_CONTENT;
|
||||
exist.SUBMITTER_ID_NUMBER = model.SUBMITTER_ID_NUMBER;
|
||||
exist.SUBMITTER_NAME = model.SUBMITTER_NAME;
|
||||
exist.UPDATE_TIME = DateTime.Now;
|
||||
//exist.UPDATE_TIME = model.UPDATE_TIME;
|
||||
//exist.CREATE_TIME = model.CREATE_TIME;
|
||||
exist.ReportDate = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
//新增三库
|
||||
var newModel = new SANKU_WORK_BRIEFING();
|
||||
newModel.RECORD_ID = model.RECORD_ID;
|
||||
newModel.PROJECT_CODE = model.PROJECT_CODE;
|
||||
newModel.PROJECT_NAME = model.PROJECT_NAME;
|
||||
newModel.SUBCONTRACTOR_ID = model.SUBCONTRACTOR_ID;
|
||||
newModel.SUBCONTRACTOR_CODE = model.SUBCONTRACTOR_CODE;
|
||||
newModel.SUBCONTRACTOR_NAME = model.SUBCONTRACTOR_NAME;
|
||||
newModel.PERSONNEL_ID_NUMBER = model.PERSONNEL_ID_NUMBER;
|
||||
newModel.PERSONNEL_NAME = model.PERSONNEL_NAME;
|
||||
newModel.BRIEFING_TIME = model.BRIEFING_TIME;
|
||||
newModel.BRIEFING_DATE = model.BRIEFING_DATE;
|
||||
newModel.POSITION_NAME = model.POSITION_NAME;
|
||||
newModel.BRIEFING_CONTENT = model.BRIEFING_CONTENT;
|
||||
newModel.PARTICIPANT_COUNT = model.PARTICIPANT_COUNT;
|
||||
newModel.SUBMITTER_ID_NUMBER = model.SUBMITTER_ID_NUMBER;
|
||||
newModel.SUBMITTER_NAME = model.SUBMITTER_NAME;
|
||||
newModel.UPDATE_TIME = DateTime.Now;
|
||||
//newModel.UPDATE_TIME = model.UPDATE_TIME;
|
||||
newModel.CREATE_TIME = model.CREATE_TIME;
|
||||
db.SANKU_WORK_BRIEFING.InsertOnSubmit(newModel);
|
||||
}
|
||||
db.SubmitChanges();
|
||||
|
||||
//收集班前会参与记录
|
||||
var subresult = Funs.DB.SP_SANKU_DATA_INIT("SANKU_WORK_BRIEFING_PARTICIPANT", 1);
|
||||
string subresultStr = "成功";
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 班前会内容
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string WorkContent(string name, string htmlContent)
|
||||
{
|
||||
string result = name;
|
||||
htmlContent = ClearHtmlByRegex(htmlContent);
|
||||
if (!string.IsNullOrWhiteSpace(htmlContent))
|
||||
{
|
||||
result = $"{name}:{htmlContent}";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除html标签,返回纯文本,自动处理转义字符 < >
|
||||
/// </summary>
|
||||
/// <param name="html">富文本内容</param>
|
||||
/// <returns></returns>
|
||||
public static string ClearHtmlByRegex(string html)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(html))
|
||||
return "";
|
||||
// 还原转义标签
|
||||
html = html.Replace("<", "<").Replace(">", ">");
|
||||
// 删除所有标签
|
||||
html = Regex.Replace(html, "<[^>]*>", "", RegexOptions.IgnoreCase);
|
||||
// 合并连续空白
|
||||
html = Regex.Replace(html, @"\s+", " ");
|
||||
return html.Trim();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 事故事件
|
||||
|
||||
/// <summary>
|
||||
@@ -1604,8 +1771,6 @@ namespace BLL
|
||||
ENGINEERING_DATE = tba.ExpectedTime == null ? DateTime.Now : (DateTime)tba.ExpectedTime,
|
||||
ENGINEERING_NAME = tba.HazardName,
|
||||
ENGINEERING_TYPE = LargerHazardType(tba.HazardType),
|
||||
ENGINEERING_LEVEL = tba.IsSuperLargerHazard != null && tba.IsSuperLargerHazard == true ? "超规模危大" : "普通危大",
|
||||
ENGINEERING_STATE = LargerHazardState(tba.States),
|
||||
ENGINEERING_ADDRESS = tba.Address,
|
||||
ENGINEERING_DESC = tba.Descriptions,
|
||||
STANDBY_PERSONNEL_ID_NUMBER = spp.IdentityCard,
|
||||
@@ -1659,8 +1824,6 @@ namespace BLL
|
||||
exist.ENGINEERING_DATE = model.ENGINEERING_DATE;
|
||||
exist.ENGINEERING_NAME = model.ENGINEERING_NAME;
|
||||
exist.ENGINEERING_TYPE = model.ENGINEERING_TYPE;
|
||||
exist.ENGINEERING_LEVEL = model.ENGINEERING_LEVEL;
|
||||
exist.ENGINEERING_STATE = model.ENGINEERING_STATE;
|
||||
exist.ENGINEERING_ADDRESS = model.ENGINEERING_ADDRESS;
|
||||
exist.ENGINEERING_DESC = model.ENGINEERING_DESC;
|
||||
exist.STANDBY_PERSONNEL_ID_NUMBER = model.STANDBY_PERSONNEL_ID_NUMBER;
|
||||
@@ -1687,8 +1850,6 @@ namespace BLL
|
||||
newModel.ENGINEERING_DATE = model.ENGINEERING_DATE;
|
||||
newModel.ENGINEERING_NAME = model.ENGINEERING_NAME;
|
||||
newModel.ENGINEERING_TYPE = model.ENGINEERING_TYPE;
|
||||
newModel.ENGINEERING_LEVEL = model.ENGINEERING_LEVEL;
|
||||
newModel.ENGINEERING_STATE = model.ENGINEERING_STATE;
|
||||
newModel.ENGINEERING_ADDRESS = model.ENGINEERING_ADDRESS;
|
||||
newModel.ENGINEERING_DESC = model.ENGINEERING_DESC;
|
||||
newModel.STANDBY_PERSONNEL_ID_NUMBER = model.STANDBY_PERSONNEL_ID_NUMBER;
|
||||
@@ -1703,40 +1864,18 @@ namespace BLL
|
||||
db.SANKU_DANGEROUS_ENGINEERING.InsertOnSubmit(newModel);
|
||||
}
|
||||
db.SubmitChanges();
|
||||
|
||||
//收集危大工程履职记录
|
||||
var subresult = Funs.DB.SP_SANKU_DATA_INIT("SANKU_DANGEROUS_ENGINEERING_DUTY_RECORD", 1);
|
||||
//收集危大工程交底记录
|
||||
var subresult2 = Funs.DB.SP_SANKU_DATA_INIT("SANKU_SAFETY_TECH_BRIEFING", 1);
|
||||
string subresultStr = "成功";
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 危大工程状态
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static string LargerHazardState(string value)
|
||||
{
|
||||
string result = string.Empty;
|
||||
if (!string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case "1":
|
||||
result = "施工准备";
|
||||
break;
|
||||
case "2":
|
||||
result = "正在施工";
|
||||
break;
|
||||
case "3":
|
||||
result = "验收完成";
|
||||
break;
|
||||
default:
|
||||
result = "正在施工";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 危大工程类型
|
||||
@@ -1781,7 +1920,6 @@ namespace BLL
|
||||
var models = from tba in db.HSSE_Hazard_HazardRegister
|
||||
join bp in db.Base_Project on tba.ProjectId equals bp.ProjectId
|
||||
join pms in db.Ads_pms_pro_info_build on bp.MasterSysId equals pms.Pro_id
|
||||
join wbsu in db.WBS_UnitWork on tba.Place equals wbsu.UnitWorkId
|
||||
join suzg in db.Sys_User on tba.CheckManId equals suzg.UserId
|
||||
join bu in db.Base_Unit on suzg.UnitId equals bu.UnitId
|
||||
where tba.HazardRegisterId == hazardId
|
||||
@@ -1795,8 +1933,6 @@ namespace BLL
|
||||
SUBCONTRACTOR_NAME = bu.UnitName,
|
||||
PERSONNEL_ID_NUMBER = suzg.IdentityCard,
|
||||
PERSONNEL_NAME = suzg.UserName,
|
||||
PATROL_WORKITEMS = "巡检单位工程:" + wbsu.UnitWorkName,
|
||||
PATROL_RECEIVEDATE = tba.CheckTime == null ? DateTime.Now.AddDays(-1) : ((DateTime)tba.CheckTime).AddDays(-1),
|
||||
PATROL_TIME = tba.CheckTime == null ? DateTime.Now : (DateTime)tba.CheckTime,
|
||||
PATROL_STATUS = "已完成",
|
||||
SUBMITTER_ID_NUMBER = suzg.IdentityCard,
|
||||
@@ -1848,13 +1984,11 @@ namespace BLL
|
||||
newModel.RECORD_ID = model.RECORD_ID;
|
||||
newModel.PROJECT_CODE = model.PROJECT_CODE;
|
||||
newModel.PROJECT_NAME = model.PROJECT_NAME;
|
||||
newModel.SUBCONTRACTOR_ID = model.SUBCONTRACTOR_ID;
|
||||
exist.SUBCONTRACTOR_ID = model.SUBCONTRACTOR_ID;
|
||||
newModel.SUBCONTRACTOR_CODE = model.SUBCONTRACTOR_CODE;
|
||||
newModel.SUBCONTRACTOR_NAME = model.SUBCONTRACTOR_NAME;
|
||||
newModel.PERSONNEL_ID_NUMBER = model.PERSONNEL_ID_NUMBER;
|
||||
newModel.PERSONNEL_NAME = model.PERSONNEL_NAME;
|
||||
newModel.PATROL_WORKITEMS = model.PATROL_WORKITEMS;
|
||||
newModel.PATROL_RECEIVEDATE = model.PATROL_RECEIVEDATE;
|
||||
newModel.PATROL_TIME = model.PATROL_TIME;
|
||||
newModel.PATROL_STATUS = model.PATROL_STATUS;
|
||||
//newModel.SOURCE_SYSTEM_ID = model.SOURCE_SYSTEM_ID;
|
||||
@@ -1875,10 +2009,245 @@ namespace BLL
|
||||
|
||||
#endregion
|
||||
|
||||
#region 安全技术交底
|
||||
|
||||
///// <summary>
|
||||
///// 更新安全技术交底数据
|
||||
///// </summary>
|
||||
///// <param name="hseTechnicalId">安全技术交底id</param>
|
||||
///// <param name="message"></param>
|
||||
///// <returns></returns>
|
||||
//public static string UpdateSafetyTechBriefingRecord(string hseTechnicalId, ref string message)
|
||||
//{
|
||||
// string result = string.Empty;
|
||||
// using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||||
// {
|
||||
// var list = db.SANKU_SAFETY_TECH_BRIEFING.Where(x => x.RECORD_ID == hseTechnicalId);
|
||||
// db.SANKU_SAFETY_TECH_BRIEFING.DeleteAllOnSubmit(list);
|
||||
// db.SubmitChanges();
|
||||
|
||||
// //收集危大工程履职记录
|
||||
// var subresult = Funs.DB.SP_SANKU_DATA_INIT("SANKU_SAFETY_TECH_BRIEFING", 1);
|
||||
// return result;
|
||||
// }
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region 汇总上报
|
||||
|
||||
#region 班前喊话发起记录
|
||||
|
||||
/// <summary>
|
||||
/// 汇总上报班前喊话发起记录数据
|
||||
/// </summary>
|
||||
/// <param name="userName">操作人,为空:定时任务自动上报</param>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public static string ReportWorkBriefingRecords(string userName, ref string message)
|
||||
{
|
||||
string code = "0";
|
||||
string result = "失败";
|
||||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||||
{
|
||||
var thisUnit = CommonService.GetIsThisUnit();
|
||||
string filePath = Funs.SGGLUrl;
|
||||
|
||||
//获取班前喊话发起记录数据
|
||||
List<Model.SANKU_WORK_BRIEFING> reportDatas = (from x in db.SANKU_WORK_BRIEFING where x.ReportDate == null select x).ToList();
|
||||
int total = reportDatas.Count();
|
||||
int succ = 0;
|
||||
|
||||
if (!reportDatas.Any())
|
||||
{
|
||||
message = "暂无需要上报的班前喊话发起记录数据!无需上报!";
|
||||
return code;
|
||||
}
|
||||
|
||||
#region 上报数据
|
||||
|
||||
string opType = !string.IsNullOrWhiteSpace(userName) ? "手动上报" : "自动上报";
|
||||
userName = !string.IsNullOrWhiteSpace(userName) ? userName : "定时任务";
|
||||
try
|
||||
{
|
||||
string baseurl = $"{SysConstSetService.CNCECPath}/api/SanKu/ReportWorkBriefingRecords";
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
Hashtable newToken = new Hashtable
|
||||
{
|
||||
{ "token", ServerService.GetToken().Token }
|
||||
};
|
||||
var pushData = new SankuReportWorkBriefing
|
||||
{
|
||||
CollCropCode = thisUnit.CollCropCode,//分包单位社会统一信用码
|
||||
UnitId = thisUnit.UnitId,//分包单位Id
|
||||
UnitName = thisUnit.UnitName,//分包单位名称
|
||||
OpType = opType,
|
||||
Operator = userName,
|
||||
Items = reportDatas,
|
||||
};
|
||||
var pushContent = JsonConvert.SerializeObject(pushData);
|
||||
|
||||
//ErrLogInfo.WriteLog($"【三库:汇总上报班前喊话发起记录数据】:{pushContent}");
|
||||
var strJosn = APIGetHttpService.Http(baseurl, "Post", contenttype, newToken, pushContent);
|
||||
if (!string.IsNullOrEmpty(strJosn))
|
||||
{
|
||||
//ErrLogInfo.WriteLog($"【三库:汇总上报班前喊话发起记录数据】:{strJosn}");
|
||||
JObject obj = JObject.Parse(strJosn);
|
||||
code = obj["code"].ToString();
|
||||
message = obj["message"].ToString();
|
||||
if (code == "1")
|
||||
{
|
||||
var dateNow = DateTime.Now;
|
||||
foreach (var o in reportDatas)
|
||||
{
|
||||
var item = db.SANKU_WORK_BRIEFING.FirstOrDefault(e => e.BRIEFING_ID == o.BRIEFING_ID);
|
||||
if (item != null)
|
||||
{
|
||||
item.ReportDate = dateNow;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
result = "成功";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
message = "无返回结果";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result = "异常";
|
||||
message = JsonConvert.SerializeObject(ex);
|
||||
//message = ex.Message.ToString();
|
||||
}
|
||||
|
||||
//记录上报结果日志
|
||||
Model.SANKU_REPORT_LOG newModel = new Model.SANKU_REPORT_LOG();
|
||||
newModel.OPTYPE = opType;
|
||||
newModel.CONTENT = "上报班前喊话发起记录数据";
|
||||
newModel.RESULT = result;
|
||||
newModel.DETAIL = message;
|
||||
newModel.OPERATOR = userName;
|
||||
newModel.CREATE_TIME = DateTime.Now;
|
||||
db.SANKU_REPORT_LOG.InsertOnSubmit(newModel);
|
||||
db.SubmitChanges();
|
||||
|
||||
#endregion
|
||||
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 班前喊话参与记录
|
||||
|
||||
/// <summary>
|
||||
/// 汇总上报班前喊话参与记录数据
|
||||
/// </summary>
|
||||
/// <param name="userName">操作人,为空:定时任务自动上报</param>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public static string ReportWorkBriefingParticipantRecords(string userName, ref string message)
|
||||
{
|
||||
string code = "0";
|
||||
string result = "失败";
|
||||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||||
{
|
||||
var thisUnit = CommonService.GetIsThisUnit();
|
||||
string filePath = Funs.SGGLUrl;
|
||||
|
||||
//获取班前喊话参与记录数据
|
||||
List<Model.SANKU_WORK_BRIEFING_PARTICIPANT> reportDatas = (from x in db.SANKU_WORK_BRIEFING_PARTICIPANT where x.ReportDate == null select x).ToList();
|
||||
int total = reportDatas.Count();
|
||||
int succ = 0;
|
||||
|
||||
if (!reportDatas.Any())
|
||||
{
|
||||
message = "暂无需要上报的班前喊话参与记录数据!无需上报!";
|
||||
return code;
|
||||
}
|
||||
|
||||
#region 上报数据
|
||||
|
||||
string opType = !string.IsNullOrWhiteSpace(userName) ? "手动上报" : "自动上报";
|
||||
userName = !string.IsNullOrWhiteSpace(userName) ? userName : "定时任务";
|
||||
try
|
||||
{
|
||||
string baseurl = $"{SysConstSetService.CNCECPath}/api/SanKu/ReportWorkBriefingParticipantRecords";
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
Hashtable newToken = new Hashtable
|
||||
{
|
||||
{ "token", ServerService.GetToken().Token }
|
||||
};
|
||||
var pushData = new SankuReportWorkBriefingParticipant
|
||||
{
|
||||
CollCropCode = thisUnit.CollCropCode,//分包单位社会统一信用码
|
||||
UnitId = thisUnit.UnitId,//分包单位Id
|
||||
UnitName = thisUnit.UnitName,//分包单位名称
|
||||
OpType = opType,
|
||||
Operator = userName,
|
||||
Items = reportDatas,
|
||||
};
|
||||
var pushContent = JsonConvert.SerializeObject(pushData);
|
||||
|
||||
//ErrLogInfo.WriteLog($"【三库:汇总上报班前喊话参与记录数据】:{pushContent}");
|
||||
var strJosn = APIGetHttpService.Http(baseurl, "Post", contenttype, newToken, pushContent);
|
||||
if (!string.IsNullOrEmpty(strJosn))
|
||||
{
|
||||
//ErrLogInfo.WriteLog($"【三库:汇总上报班前喊话参与记录数据】:{strJosn}");
|
||||
JObject obj = JObject.Parse(strJosn);
|
||||
code = obj["code"].ToString();
|
||||
message = obj["message"].ToString();
|
||||
if (code == "1")
|
||||
{
|
||||
var dateNow = DateTime.Now;
|
||||
foreach (var o in reportDatas)
|
||||
{
|
||||
var item = db.SANKU_WORK_BRIEFING_PARTICIPANT.FirstOrDefault(e => e.PARTICIPANT_ID == o.PARTICIPANT_ID);
|
||||
if (item != null)
|
||||
{
|
||||
item.ReportDate = dateNow;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
result = "成功";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
message = "无返回结果";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result = "异常";
|
||||
message = JsonConvert.SerializeObject(ex);
|
||||
//message = ex.Message.ToString();
|
||||
}
|
||||
|
||||
//记录上报结果日志
|
||||
Model.SANKU_REPORT_LOG newModel = new Model.SANKU_REPORT_LOG();
|
||||
newModel.OPTYPE = opType;
|
||||
newModel.CONTENT = "上报班前喊话参与记录数据";
|
||||
newModel.RESULT = result;
|
||||
newModel.DETAIL = message;
|
||||
newModel.OPERATOR = userName;
|
||||
newModel.CREATE_TIME = DateTime.Now;
|
||||
db.SANKU_REPORT_LOG.InsertOnSubmit(newModel);
|
||||
db.SubmitChanges();
|
||||
|
||||
#endregion
|
||||
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 事故事件
|
||||
|
||||
/// <summary>
|
||||
@@ -2750,6 +3119,111 @@ namespace BLL
|
||||
|
||||
#endregion
|
||||
|
||||
#region 危大工程履职记录
|
||||
|
||||
/// <summary>
|
||||
/// 汇总上报危大工程履职记录数据
|
||||
/// </summary>
|
||||
/// <param name="userName">操作人,为空:定时任务自动上报</param>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public static string ReportDangerousEngineeringDutyRecords(string userName, ref string message)
|
||||
{
|
||||
string code = "0";
|
||||
string result = "失败";
|
||||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||||
{
|
||||
var thisUnit = CommonService.GetIsThisUnit();
|
||||
string filePath = Funs.SGGLUrl;
|
||||
|
||||
//获取危大工程履职记录数据
|
||||
List<Model.SANKU_DANGEROUS_ENGINEERING_DUTY_RECORD> reportDatas = (from x in db.SANKU_DANGEROUS_ENGINEERING_DUTY_RECORD where x.ReportDate == null select x).ToList();
|
||||
int total = reportDatas.Count();
|
||||
int succ = 0;
|
||||
|
||||
if (!reportDatas.Any())
|
||||
{
|
||||
message = "暂无需要上报的危大工程履职记录数据!无需上报!";
|
||||
return code;
|
||||
}
|
||||
|
||||
#region 上报数据
|
||||
|
||||
string opType = !string.IsNullOrWhiteSpace(userName) ? "手动上报" : "自动上报";
|
||||
userName = !string.IsNullOrWhiteSpace(userName) ? userName : "定时任务";
|
||||
try
|
||||
{
|
||||
string baseurl = $"{SysConstSetService.CNCECPath}/api/SanKu/ReportDangerousEngineeringDutyRecords";
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
Hashtable newToken = new Hashtable
|
||||
{
|
||||
{ "token", ServerService.GetToken().Token }
|
||||
};
|
||||
var pushData = new SankuReportDangerousEngineeringDutyRecord
|
||||
{
|
||||
CollCropCode = thisUnit.CollCropCode,//分包单位社会统一信用码
|
||||
UnitId = thisUnit.UnitId,//分包单位Id
|
||||
UnitName = thisUnit.UnitName,//分包单位名称
|
||||
OpType = opType,
|
||||
Operator = userName,
|
||||
Items = reportDatas,
|
||||
};
|
||||
var pushContent = JsonConvert.SerializeObject(pushData);
|
||||
|
||||
//ErrLogInfo.WriteLog($"【三库:汇总上报危大工程履职记录数据】:{pushContent}");
|
||||
var strJosn = APIGetHttpService.Http(baseurl, "Post", contenttype, newToken, pushContent);
|
||||
if (!string.IsNullOrEmpty(strJosn))
|
||||
{
|
||||
//ErrLogInfo.WriteLog($"【三库:汇总上报危大工程履职记录数据】:{strJosn}");
|
||||
JObject obj = JObject.Parse(strJosn);
|
||||
code = obj["code"].ToString();
|
||||
message = obj["message"].ToString();
|
||||
if (code == "1")
|
||||
{
|
||||
var dateNow = DateTime.Now;
|
||||
foreach (var o in reportDatas)
|
||||
{
|
||||
var item = db.SANKU_DANGEROUS_ENGINEERING_DUTY_RECORD.FirstOrDefault(e => e.DUTY_RECORD_ID == o.DUTY_RECORD_ID);
|
||||
if (item != null)
|
||||
{
|
||||
item.ReportDate = dateNow;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
result = "成功";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
message = "无返回结果";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result = "异常";
|
||||
message = JsonConvert.SerializeObject(ex);
|
||||
//message = ex.Message.ToString();
|
||||
}
|
||||
|
||||
//记录上报结果日志
|
||||
Model.SANKU_REPORT_LOG newModel = new Model.SANKU_REPORT_LOG();
|
||||
newModel.OPTYPE = opType;
|
||||
newModel.CONTENT = "上报危大工程履职记录数据";
|
||||
newModel.RESULT = result;
|
||||
newModel.DETAIL = message;
|
||||
newModel.OPERATOR = userName;
|
||||
newModel.CREATE_TIME = DateTime.Now;
|
||||
db.SANKU_REPORT_LOG.InsertOnSubmit(newModel);
|
||||
db.SubmitChanges();
|
||||
|
||||
#endregion
|
||||
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 网格化巡查
|
||||
|
||||
/// <summary>
|
||||
@@ -2855,6 +3329,111 @@ namespace BLL
|
||||
|
||||
#endregion
|
||||
|
||||
#region 安全技术交底
|
||||
|
||||
/// <summary>
|
||||
/// 汇总上报安全技术交底数据
|
||||
/// </summary>
|
||||
/// <param name="userName">操作人,为空:定时任务自动上报</param>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public static string ReportSafetyTechBriefingRecords(string userName, ref string message)
|
||||
{
|
||||
string code = "0";
|
||||
string result = "失败";
|
||||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||||
{
|
||||
var thisUnit = CommonService.GetIsThisUnit();
|
||||
string filePath = Funs.SGGLUrl;
|
||||
|
||||
//获取安全技术交底数据
|
||||
List<Model.SANKU_SAFETY_TECH_BRIEFING> reportDatas = (from x in db.SANKU_SAFETY_TECH_BRIEFING where x.ReportDate == null select x).ToList();
|
||||
int total = reportDatas.Count();
|
||||
int succ = 0;
|
||||
|
||||
if (!reportDatas.Any())
|
||||
{
|
||||
message = "暂无需要上报的安全技术交底数据!无需上报!";
|
||||
return code;
|
||||
}
|
||||
|
||||
#region 上报数据
|
||||
|
||||
string opType = !string.IsNullOrWhiteSpace(userName) ? "手动上报" : "自动上报";
|
||||
userName = !string.IsNullOrWhiteSpace(userName) ? userName : "定时任务";
|
||||
try
|
||||
{
|
||||
string baseurl = $"{SysConstSetService.CNCECPath}/api/SanKu/ReportSafetyTechBriefingRecords";
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
Hashtable newToken = new Hashtable
|
||||
{
|
||||
{ "token", ServerService.GetToken().Token }
|
||||
};
|
||||
var pushData = new SankuReportSafetyTechBriefing
|
||||
{
|
||||
CollCropCode = thisUnit.CollCropCode,//分包单位社会统一信用码
|
||||
UnitId = thisUnit.UnitId,//分包单位Id
|
||||
UnitName = thisUnit.UnitName,//分包单位名称
|
||||
OpType = opType,
|
||||
Operator = userName,
|
||||
Items = reportDatas,
|
||||
};
|
||||
var pushContent = JsonConvert.SerializeObject(pushData);
|
||||
|
||||
//ErrLogInfo.WriteLog($"【三库:汇总上报安全技术交底数据】:{pushContent}");
|
||||
var strJosn = APIGetHttpService.Http(baseurl, "Post", contenttype, newToken, pushContent);
|
||||
if (!string.IsNullOrEmpty(strJosn))
|
||||
{
|
||||
//ErrLogInfo.WriteLog($"【三库:汇总上报安全技术交底数据】:{strJosn}");
|
||||
JObject obj = JObject.Parse(strJosn);
|
||||
code = obj["code"].ToString();
|
||||
message = obj["message"].ToString();
|
||||
if (code == "1")
|
||||
{
|
||||
var dateNow = DateTime.Now;
|
||||
foreach (var o in reportDatas)
|
||||
{
|
||||
var item = db.SANKU_SAFETY_TECH_BRIEFING.FirstOrDefault(e => e.TECH_BRIEFING_ID == o.TECH_BRIEFING_ID);
|
||||
if (item != null)
|
||||
{
|
||||
item.ReportDate = dateNow;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
result = "成功";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
message = "无返回结果";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result = "异常";
|
||||
message = JsonConvert.SerializeObject(ex);
|
||||
//message = ex.Message.ToString();
|
||||
}
|
||||
|
||||
//记录上报结果日志
|
||||
Model.SANKU_REPORT_LOG newModel = new Model.SANKU_REPORT_LOG();
|
||||
newModel.OPTYPE = opType;
|
||||
newModel.CONTENT = "上报安全技术交底数据";
|
||||
newModel.RESULT = result;
|
||||
newModel.DETAIL = message;
|
||||
newModel.OPERATOR = userName;
|
||||
newModel.CREATE_TIME = DateTime.Now;
|
||||
db.SANKU_REPORT_LOG.InsertOnSubmit(newModel);
|
||||
db.SubmitChanges();
|
||||
|
||||
#endregion
|
||||
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user