三库四期:关键岗位人员
This commit is contained in:
@@ -53,6 +53,45 @@ namespace BLL
|
||||
|
||||
#region 业务更新
|
||||
|
||||
#region 项目关键岗位人员
|
||||
|
||||
/// <summary>
|
||||
/// 更新项目关键岗位人员
|
||||
/// </summary>
|
||||
/// <param name="recordId">人员id</param>
|
||||
/// <param name="projectId">项目id</param>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public static string UpdatePersonRecord(string recordId, string projectId, ref string message)
|
||||
{
|
||||
string result = string.Empty;
|
||||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||||
{
|
||||
string status = string.Empty;
|
||||
//查询项目人员当前状态
|
||||
var puser = db.Project_ProjectUser.Where(x => x.UserId == recordId && x.ProjectId == projectId).FirstOrDefault();
|
||||
status = puser != null && puser.IsPost == true ? "在岗" : "离岗";
|
||||
var pro = db.Base_Project.Where(x => x.ProjectId == projectId).FirstOrDefault();
|
||||
if (pro != null && !string.IsNullOrWhiteSpace(pro.MasterSysId))
|
||||
{
|
||||
var mpro = db.Ads_pms_pro_info_build.Where(x => x.Pro_id == pro.MasterSysId).FirstOrDefault();
|
||||
if (mpro != null)
|
||||
{
|
||||
var exist = db.SANKU_PERSONNEL.Where(x => x.RECORD_ID == recordId && x.PROJECT_CODE == mpro.Pro_code).FirstOrDefault();
|
||||
if (exist != null)
|
||||
{
|
||||
exist.STATUS = status;
|
||||
exist.ReportDate = null;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 班前喊话发起记录
|
||||
|
||||
/// <summary>
|
||||
@@ -1769,6 +1808,7 @@ namespace BLL
|
||||
SUBCONTRACTOR_CODE = bu.CollCropCode,
|
||||
SUBCONTRACTOR_NAME = bu.UnitName,
|
||||
ENGINEERING_DATE = tba.ExpectedTime == null ? DateTime.Now : (DateTime)tba.ExpectedTime,
|
||||
ENGINEERING_CODE = tba.HazardCode,
|
||||
ENGINEERING_NAME = tba.HazardName,
|
||||
ENGINEERING_TYPE = LargerHazardType(tba.HazardType),
|
||||
ENGINEERING_ADDRESS = tba.Address,
|
||||
@@ -1821,7 +1861,8 @@ namespace BLL
|
||||
exist.SUBCONTRACTOR_ID = model.SUBCONTRACTOR_ID;
|
||||
exist.SUBCONTRACTOR_CODE = model.SUBCONTRACTOR_CODE;
|
||||
exist.SUBCONTRACTOR_NAME = model.SUBCONTRACTOR_NAME;
|
||||
exist.ENGINEERING_DATE = model.ENGINEERING_DATE;
|
||||
exist.ENGINEERING_DATE = model.ENGINEERING_DATE;
|
||||
exist.ENGINEERING_CODE = model.ENGINEERING_CODE;
|
||||
exist.ENGINEERING_NAME = model.ENGINEERING_NAME;
|
||||
exist.ENGINEERING_TYPE = model.ENGINEERING_TYPE;
|
||||
exist.ENGINEERING_ADDRESS = model.ENGINEERING_ADDRESS;
|
||||
@@ -1848,6 +1889,7 @@ namespace BLL
|
||||
newModel.SUBCONTRACTOR_CODE = model.SUBCONTRACTOR_CODE;
|
||||
newModel.SUBCONTRACTOR_NAME = model.SUBCONTRACTOR_NAME;
|
||||
newModel.ENGINEERING_DATE = model.ENGINEERING_DATE;
|
||||
newModel.ENGINEERING_CODE = model.ENGINEERING_CODE;
|
||||
newModel.ENGINEERING_NAME = model.ENGINEERING_NAME;
|
||||
newModel.ENGINEERING_TYPE = model.ENGINEERING_TYPE;
|
||||
newModel.ENGINEERING_ADDRESS = model.ENGINEERING_ADDRESS;
|
||||
@@ -2038,6 +2080,111 @@ namespace BLL
|
||||
|
||||
#region 汇总上报
|
||||
|
||||
#region 项目关键岗位人员
|
||||
|
||||
/// <summary>
|
||||
/// 汇总上报项目关键岗位人员数据
|
||||
/// </summary>
|
||||
/// <param name="userName">操作人,为空:定时任务自动上报</param>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public static string ReportPersonRecords(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_PERSONNEL> reportDatas = (from x in db.SANKU_PERSONNEL 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/ReportPersonRecords";
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
Hashtable newToken = new Hashtable
|
||||
{
|
||||
{ "token", ServerService.GetToken().Token }
|
||||
};
|
||||
var pushData = new SankuReportPerson
|
||||
{
|
||||
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_PERSONNEL.FirstOrDefault(e => e.PERSONNEL_ID == o.PERSONNEL_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>
|
||||
|
||||
Reference in New Issue
Block a user