Merge branch 'master' of http://47.104.102.122:3000/panhf/CNCEC_SUBQHSE_WUHUAN
This commit is contained in:
@@ -61,11 +61,14 @@ namespace BLL
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
string re = string.Empty;
|
||||
response = (HttpWebResponse)ex.Response;
|
||||
ResponseStream = response.GetResponseStream();
|
||||
StreamReader = new StreamReader(ResponseStream, Encoding.GetEncoding("utf-8"));
|
||||
|
||||
string re = StreamReader.ReadToEnd();
|
||||
if (response != null)
|
||||
{
|
||||
ResponseStream = response.GetResponseStream();
|
||||
StreamReader = new StreamReader(ResponseStream, Encoding.GetEncoding("utf-8"));
|
||||
re = StreamReader.ReadToEnd();
|
||||
}
|
||||
return re;
|
||||
}
|
||||
finally
|
||||
|
||||
+3
-1
@@ -132,6 +132,7 @@
|
||||
<Compile Include="API\HSSE\APITrainingPlanService.cs" />
|
||||
<Compile Include="API\HSSE\APITrainingTaskService.cs" />
|
||||
<Compile Include="API\HSSE\APITrainRecordService.cs" />
|
||||
<Compile Include="BaseInfo\QualificationService.cs" />
|
||||
<Compile Include="BaseInfo\SuperviseCheckTypeService.cs" />
|
||||
<Compile Include="BaseInfo\AccidentTypeService.cs" />
|
||||
<Compile Include="BaseInfo\BaseFactoryService.cs" />
|
||||
@@ -609,6 +610,8 @@
|
||||
<Compile Include="JDGL\Check\UndergroundPipeCompletionService.cs" />
|
||||
<Compile Include="JDGL\Check\WeekItemService.cs" />
|
||||
<Compile Include="JDGL\Check\WeekPlanService.cs" />
|
||||
<Compile Include="JDGL\SGManPower\ManPowerPlanService.cs" />
|
||||
<Compile Include="JDGL\SGManPower\SGManPowerService.cs" />
|
||||
<Compile Include="JDGL\WBSCompleteAndReal\WBSReportService.cs" />
|
||||
<Compile Include="JDGL\WBS\CnProfessionInitService.cs" />
|
||||
<Compile Include="JDGL\WBS\CnProfessionService.cs" />
|
||||
@@ -1311,7 +1314,6 @@
|
||||
<Version>5.0.0</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class QualificationService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据主键获取信息
|
||||
/// </summary>
|
||||
/// <param name="groupId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Base_Qualification GetQualificationById(string QualificationId)
|
||||
{
|
||||
return Funs.DB.Base_Qualification.FirstOrDefault(e => e.QualificationId == QualificationId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取信息
|
||||
/// </summary>
|
||||
/// <param name="groupId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Base_Qualification GetQualificationByName(string QualificationName)
|
||||
{
|
||||
return Funs.DB.Base_Qualification.FirstOrDefault(e => e.QualificationName == QualificationName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加
|
||||
/// </summary>
|
||||
/// <param name="?"></param>
|
||||
public static void AddQualification(Model.Base_Qualification model)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Base_Qualification newModel = new Model.Base_Qualification
|
||||
{
|
||||
QualificationId = model.QualificationId,
|
||||
QualificationCode = model.QualificationCode,
|
||||
QualificationName = model.QualificationName,
|
||||
QualificationType = model.QualificationType,
|
||||
Remark = model.Remark
|
||||
};
|
||||
|
||||
db.Base_Qualification.InsertOnSubmit(newModel);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改
|
||||
/// </summary>
|
||||
/// <param name="teamGroup"></param>
|
||||
public static void UpdateQualification(Model.Base_Qualification model)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Base_Qualification newModel = db.Base_Qualification.FirstOrDefault(e => e.QualificationId == model.QualificationId);
|
||||
if (newModel != null)
|
||||
{
|
||||
newModel.QualificationCode = model.QualificationCode;
|
||||
newModel.QualificationName = model.QualificationName;
|
||||
newModel.QualificationType = model.QualificationType;
|
||||
newModel.Remark = model.Remark;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除信息
|
||||
/// </summary>
|
||||
/// <param name="QualificationId"></param>
|
||||
public static void DeleteQualificationById(string QualificationId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Base_Qualification model = db.Base_Qualification.FirstOrDefault(e => e.QualificationId == QualificationId);
|
||||
{
|
||||
db.Base_Qualification.DeleteOnSubmit(model);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取类别下拉项
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_Qualification> GetQualificationList()
|
||||
{
|
||||
var list = (from x in Funs.DB.Base_Qualification orderby x.QualificationCode select x).ToList();
|
||||
return list;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取建筑业企业资质下拉选项
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_Qualification> GetQualificationDropDownList()
|
||||
{
|
||||
var list = (from x in Funs.DB.Base_Qualification orderby x.QualificationCode select x).ToList();
|
||||
return list;
|
||||
}
|
||||
|
||||
#region 建筑业企业资质表下拉框
|
||||
/// <summary>
|
||||
/// 建筑业企业资质表下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName">下拉框名字</param>
|
||||
/// <param name="isShowPlease">是否显示请选择</param>
|
||||
public static void InitQualificationDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "QualificationId";
|
||||
dropName.DataTextField = "QualificationName";
|
||||
dropName.DataSource = BLL.QualificationService.GetQualificationDropDownList();
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取信息
|
||||
/// </summary>
|
||||
/// <param name="groupId"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetQualificationNameById(string QualificationId)
|
||||
{
|
||||
string name = string.Empty;
|
||||
var getType= Funs.DB.Base_Qualification.FirstOrDefault(e => e.QualificationId == QualificationId);
|
||||
if (getType != null)
|
||||
{
|
||||
name = getType.QualificationName;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1096,6 +1096,10 @@ namespace BLL
|
||||
/// </summary>
|
||||
public const string ProjectTypeMenuId = "AEB427BD-AE1A-47CC-9337-368BB06B37F7";
|
||||
/// <summary>
|
||||
/// 建筑业企业资质
|
||||
/// </summary>
|
||||
public const string QualificationMenuId = "CEB340BE-640E-4C95-ACB1-5E6207D4EDDA";
|
||||
/// <summary>
|
||||
/// 执业资格证书证书
|
||||
/// </summary>
|
||||
public const string PracticeCertificateMenuId = "1390195D8-874B-4E7B-8DBF-D81A5984E973";
|
||||
@@ -3310,6 +3314,9 @@ namespace BLL
|
||||
/// 月度计划情况导入模版文件原始的虚拟路径
|
||||
/// </summary>
|
||||
public const string MonthPlanTemplateUrl = "File\\Excel\\DataIn\\月度计划情况导入模板.xls";
|
||||
/// 施工人力计划导入模版文件原始的虚拟路径
|
||||
/// </summary>
|
||||
public const string SGManPowerTemplateUrl = "File\\Excel\\DataIn\\施工人力计划导入模板.xls";
|
||||
/// <summary>
|
||||
/// 周进度计划导入模版文件原始的虚拟路径
|
||||
/// </summary>
|
||||
@@ -3937,6 +3944,11 @@ namespace BLL
|
||||
/// 档案文件库
|
||||
/// </summary>
|
||||
public const string ArchivesLibMenuId = "13E3544E-AC56-48F9-9BC0-EB14EF4620FF";
|
||||
|
||||
/// <summary>
|
||||
/// 档案文件下发
|
||||
/// </summary>
|
||||
public const string ArchivesLibIssueMenuId = "7FF0C99B-64E6-4AE5-BE90-26AB3EF1B662";
|
||||
#endregion
|
||||
|
||||
#region 质量共检
|
||||
@@ -6043,6 +6055,10 @@ namespace BLL
|
||||
/// 月进度计划
|
||||
/// </summary>
|
||||
public const string MonthPlanMenuId = "94287B92-7E96-4B90-BC6F-DAF30AE3B314";
|
||||
/// <summary>
|
||||
/// 施工人力计划
|
||||
/// </summary>
|
||||
public const string SGManPowerMenuId = "D87CD627-A18C-4C5D-962D-424E582F2379";
|
||||
|
||||
/// <summary>
|
||||
/// 周进度计划
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace BLL
|
||||
{
|
||||
SubUnitQualityId = subUnitQuality.SubUnitQualityId,
|
||||
UnitId = subUnitQuality.UnitId,
|
||||
QualityId = subUnitQuality.QualityId,
|
||||
SubUnitQualityCode = subUnitQuality.SubUnitQualityCode,
|
||||
SubUnitQualityName = subUnitQuality.SubUnitQualityName,
|
||||
BusinessLicense = subUnitQuality.BusinessLicense,
|
||||
@@ -84,6 +85,7 @@ namespace BLL
|
||||
if (newSubUnitQuality != null)
|
||||
{
|
||||
newSubUnitQuality.UnitId = subUnitQuality.UnitId;
|
||||
newSubUnitQuality.QualityId = subUnitQuality.QualityId;
|
||||
newSubUnitQuality.SubUnitQualityCode = subUnitQuality.SubUnitQualityCode;
|
||||
newSubUnitQuality.SubUnitQualityName = subUnitQuality.SubUnitQualityName;
|
||||
newSubUnitQuality.BusinessLicense = subUnitQuality.BusinessLicense;
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class ManPowerPlanService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取施工人力计划情况
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.JDGL_SGManPower GetSGManPowerById(string Id)
|
||||
{
|
||||
return Funs.DB.JDGL_SGManPower.FirstOrDefault(x => x.Id == Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加施工人力计划
|
||||
/// </summary>
|
||||
/// <param name="SGManPower"></param>
|
||||
public static void AddSGManPower(Model.JDGL_SGManPower SGManPower)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.JDGL_SGManPower newSGManPower = new Model.JDGL_SGManPower
|
||||
{
|
||||
Id = SGManPower.Id,
|
||||
ProjectId = SGManPower.ProjectId,
|
||||
UnitId = SGManPower.UnitId,
|
||||
UnitWorkId = SGManPower.UnitWorkId,
|
||||
WorkPostId = SGManPower.WorkPostId,
|
||||
Version = SGManPower.Version,
|
||||
Quantity = SGManPower.Quantity,
|
||||
PlanDate = SGManPower.PlanDate,
|
||||
CompileMan = SGManPower.CompileMan,
|
||||
CompileTime = SGManPower.CompileTime,
|
||||
Remarks = SGManPower.Remarks,
|
||||
};
|
||||
db.JDGL_SGManPower.InsertOnSubmit(newSGManPower);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改施工人力计划
|
||||
/// </summary>
|
||||
/// <param name="SGManPower"></param>
|
||||
public static void UpdateSGManPower(Model.JDGL_SGManPower SGManPower)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.JDGL_SGManPower newSGManPower =
|
||||
db.JDGL_SGManPower.FirstOrDefault(x => x.Id == SGManPower.Id);
|
||||
if (newSGManPower != null)
|
||||
{
|
||||
newSGManPower.UnitId = SGManPower.UnitId;
|
||||
newSGManPower.UnitWorkId = SGManPower.UnitWorkId;
|
||||
newSGManPower.WorkPostId = SGManPower.WorkPostId;
|
||||
newSGManPower.Version = SGManPower.Version;
|
||||
newSGManPower.Quantity = SGManPower.Quantity;
|
||||
newSGManPower.PlanDate = SGManPower.PlanDate;
|
||||
newSGManPower.CompileMan = SGManPower.CompileMan;
|
||||
newSGManPower.CompileTime = SGManPower.CompileTime;
|
||||
newSGManPower.Remarks = SGManPower.Remarks;
|
||||
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除施工人力计划
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
public static void DeleteSGManPowerById(string Id)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = (from x in db.JDGL_SGManPower where x.Id == Id select x).FirstOrDefault();
|
||||
if (q != null)
|
||||
{
|
||||
db.JDGL_SGManPower.DeleteOnSubmit(q);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据项目获取工力计划版本
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
public static List<string> getGroupVersion(string projectId)
|
||||
{
|
||||
var versions = Funs.DB.JDGL_SGManPower
|
||||
.Where(x => x.ProjectId == projectId)
|
||||
.GroupBy(x => x.Version)
|
||||
.Select(g => g.Key)
|
||||
.OrderByDescending(v => v)
|
||||
.ToList();
|
||||
|
||||
return versions;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,491 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Model;
|
||||
using System.Data;
|
||||
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class SGManPowerService
|
||||
{
|
||||
/// <summary>
|
||||
/// 检查并发送人力资源预警
|
||||
/// </summary>
|
||||
public static Model.ResponeData CheckAndSendPersonWarning()
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
// 合并两个集合
|
||||
var allItems = new List<ToDoItem>();
|
||||
var projects = Funs.DB.Base_Project.Where(p => p.ProjectState == BLL.Const.ProjectState_1).ToList();
|
||||
// foreach (var project in projects)
|
||||
// {
|
||||
// 检查管理人员到期未到岗情况
|
||||
var items1 = CheckManagerNotArrived("c7ade79e-7646-4c59-a8fd-020a7e3138c6");
|
||||
|
||||
// 检查作业人员人力偏差情况
|
||||
var items2 = CheckWorkerDeviation("c7ade79e-7646-4c59-a8fd-020a7e3138c6");
|
||||
|
||||
|
||||
if (items1 != null)
|
||||
{
|
||||
allItems.AddRange(items1);
|
||||
}
|
||||
|
||||
if (items2 != null)
|
||||
{
|
||||
allItems.AddRange(items2);
|
||||
}
|
||||
|
||||
// }
|
||||
responeData.data = allItems;
|
||||
responeData.message = "人员预警";
|
||||
return responeData;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 检查管理人员到期未到岗情况(超过一周发出预警)
|
||||
/// </summary>
|
||||
/// <param name="projectId">项目ID</param>
|
||||
private static IEnumerable<ToDoItem> CheckManagerNotArrived(string projectId)
|
||||
{
|
||||
//获取计划的最新版本
|
||||
var version = "1";
|
||||
var sgMan = Funs.DB.JDGL_SGManPower.Where(x => x.ProjectId == projectId).OrderByDescending(x => x.Version)
|
||||
.FirstOrDefault();
|
||||
if (sgMan != null)
|
||||
{
|
||||
version = sgMan.Version;
|
||||
}
|
||||
|
||||
// 先获取计划表超过一周的管理岗位有哪些
|
||||
var dataList = (from x in Funs.DB.JDGL_SGManPower
|
||||
join p in Funs.DB.Base_WorkPost on x.WorkPostId equals p.WorkPostId into pp
|
||||
from y in pp.DefaultIfEmpty()
|
||||
where x.ProjectId == projectId && (y.PostType == "4" || y.PostType == "1") &&
|
||||
x.PlanDate <= DateTime.Now.AddDays(-7) && x.Version == version
|
||||
select x).ToList();
|
||||
|
||||
var lItems = new List<ToDoItem>();
|
||||
//循环检查实际考勤中的人数
|
||||
foreach (var data in dataList)
|
||||
{
|
||||
//根据人员计划表获取计划中的管理人员数
|
||||
int num = getInOutRecordNum(data);
|
||||
if (data.Quantity > num)
|
||||
{
|
||||
lItems = SendManagerWarning(data.UnitId, projectId, data.UnitWorkId, data.PlanDate, data.Quantity, num);
|
||||
}
|
||||
}
|
||||
|
||||
return lItems;
|
||||
}
|
||||
|
||||
//获取实际考勤人员数
|
||||
private static int getInOutRecordNum(JDGL_SGManPower sgManPower)
|
||||
{
|
||||
string strSql = @"
|
||||
SELECT e.UnitId, e.PostId, e.RecordDate, p.WorkAreaId as UnitWorkId
|
||||
FROM T_d_EmployInOutRecord e INNER JOIN SitePerson_Person p ON e.IDCardNo = p.IdentityCard AND e.ProjectId = p.ProjectId
|
||||
WHERE e.PostId IS NOT NULL AND e.PostId != ''
|
||||
AND e.ProjectId = @ProjectId
|
||||
AND e.RecordDate = @RecordDate
|
||||
AND e.UnitId = @UnitId
|
||||
AND e.PostId = @PostId";
|
||||
|
||||
var parameters = new List<System.Data.SqlClient.SqlParameter>
|
||||
{
|
||||
new System.Data.SqlClient.SqlParameter("@ProjectId", sgManPower.ProjectId),
|
||||
new System.Data.SqlClient.SqlParameter("@RecordDate", sgManPower.PlanDate),
|
||||
new System.Data.SqlClient.SqlParameter("@UnitId", sgManPower.UnitId),
|
||||
new System.Data.SqlClient.SqlParameter("@PostId", sgManPower.WorkPostId),
|
||||
};
|
||||
|
||||
// 执行查询获取分组数据
|
||||
var dt = SQLHelper.GetDataTableRunText(strSql, parameters.ToArray());
|
||||
|
||||
// 创建一个新的DataTable来存储处理后的数据
|
||||
DataTable processedDt = dt.Clone();
|
||||
|
||||
foreach (System.Data.DataRow row in dt.Rows)
|
||||
{
|
||||
string ids = row["UnitWorkId"] != DBNull.Value ? row["UnitWorkId"].ToString() : string.Empty;
|
||||
if (!string.IsNullOrEmpty(ids))
|
||||
{
|
||||
string[] unitWorkIdArray = ids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string unitWorkId in unitWorkIdArray)
|
||||
{
|
||||
// 往processedDt里面添加数据,每个UnitWorkId一行
|
||||
DataRow newRow = processedDt.NewRow();
|
||||
newRow["UnitId"] = row["UnitId"];
|
||||
newRow["PostId"] = row["PostId"];
|
||||
newRow["RecordDate"] = row["RecordDate"];
|
||||
newRow["UnitWorkId"] = unitWorkId.Trim();
|
||||
processedDt.Rows.Add(newRow);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DataRow newRow = processedDt.NewRow();
|
||||
newRow["UnitId"] = row["UnitId"];
|
||||
newRow["PostId"] = row["PostId"];
|
||||
newRow["RecordDate"] = row["RecordDate"];
|
||||
newRow["UnitWorkId"] = string.Empty;
|
||||
processedDt.Rows.Add(newRow);
|
||||
}
|
||||
}
|
||||
|
||||
// 确定要用于后续处理的数据源
|
||||
IEnumerable<DataRow> dataSource = processedDt.AsEnumerable();
|
||||
|
||||
if (string.IsNullOrEmpty(sgManPower.UnitWorkId))
|
||||
{
|
||||
dataSource = dataSource.Where(x => x["UnitWorkId"] == null);
|
||||
}
|
||||
else
|
||||
{
|
||||
dataSource = dataSource.Where(x => x["UnitWorkId"] != DBNull.Value && x["UnitWorkId"].ToString() == sgManPower.UnitWorkId);
|
||||
}
|
||||
|
||||
return dataSource.Count();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送管理人员预警
|
||||
/// </summary>
|
||||
/// <param name="projectId">项目ID</param>
|
||||
/// <param name="unitId">单位id</param>
|
||||
private static List<ToDoItem> SendManagerWarning(string unitId, string projectId, string unitWorkId, DateTime? planDate, int? quantity, int num)
|
||||
{
|
||||
// 发送预警信息
|
||||
var toDoItems = new List<ToDoItem>();
|
||||
|
||||
var unitWorks = (from x in Funs.DB.WBS_UnitWork
|
||||
where x.UnitWorkId == unitWorkId
|
||||
select new { x.UnitWorkId, x.UnitWorkName }).FirstOrDefault();
|
||||
|
||||
var projectUnits = (from x in Funs.DB.Project_ProjectUnit
|
||||
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
|
||||
where x.UnitId == unitId
|
||||
select new { x.UnitId, y.UnitName, x.UnitType }).FirstOrDefault();
|
||||
if (projectUnits != null)
|
||||
{
|
||||
List<string> toUserIds = new List<string>();
|
||||
|
||||
// 施工单位人员推送至施工单位项目经理和总包单位施工经理
|
||||
if (projectUnits.UnitType == Const.ProjectUnitType_2) // 施工分包单位
|
||||
{
|
||||
// 获取施工单位项目经理
|
||||
var constructionManagers = (from x in Funs.DB.Project_ProjectUser
|
||||
where x.ProjectId == projectId && x.UnitId == unitId && x.IsPost == true &&
|
||||
x.RoleId.Contains(Const.ProjectManager)
|
||||
select x).ToList();
|
||||
|
||||
if (constructionManagers.Count > 0)
|
||||
{
|
||||
foreach (var projectUser in constructionManagers)
|
||||
{
|
||||
toUserIds.Add(projectUser.UserId);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取总包单位施工经理
|
||||
var generalContractorUnit = Funs.DB.Project_ProjectUnit.FirstOrDefault(pu =>
|
||||
pu.ProjectId == projectId && pu.UnitType == Const.ProjectUnitType_1); // 总包单位
|
||||
|
||||
if (generalContractorUnit != null)
|
||||
{
|
||||
var constructionManagerGCs = (from x in Funs.DB.Project_ProjectUser
|
||||
where x.ProjectId == projectId && x.UnitId == generalContractorUnit.UnitId &&
|
||||
x.IsPost == true && x.RoleId.Contains(Const.ConstructionManager)
|
||||
select x).ToList();
|
||||
if (constructionManagerGCs.Count > 0)
|
||||
{
|
||||
foreach (var projectUser in constructionManagerGCs)
|
||||
{
|
||||
toUserIds.Add(projectUser.UserId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 总包单位人员推送到总包单位施工经理和项目经理
|
||||
else if (projectUnits.UnitType == Const.ProjectUnitType_1) // 总包单位
|
||||
{
|
||||
// 获取总包单位施工经理
|
||||
var constructionManagers = (from x in Funs.DB.Project_ProjectUser
|
||||
where x.ProjectId == projectId && x.UnitId == unitId && x.IsPost == true &&
|
||||
x.RoleId.Contains(Const.ConstructionManager)
|
||||
select x).ToList();
|
||||
if (constructionManagers.Count() > 0)
|
||||
{
|
||||
foreach (var projectUser in constructionManagers)
|
||||
{
|
||||
toUserIds.Add(projectUser.UserId);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取总包单位项目经理
|
||||
var projectManagers = (from x in Funs.DB.Project_ProjectUser
|
||||
where x.ProjectId == projectId && x.UnitId == unitId && x.IsPost == true &&
|
||||
x.RoleId.Contains(Const.ProjectManager)
|
||||
select x).ToList();
|
||||
if (projectManagers.Count() > 0)
|
||||
{
|
||||
foreach (var projectUser in projectManagers)
|
||||
{
|
||||
toUserIds.Add(projectUser.UserId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string warningContent = string.Empty;
|
||||
if (unitWorks != null)
|
||||
{
|
||||
warningContent = $"{projectUnits.UnitName}单位{unitWorks.UnitWorkName}装置计划{planDate}投入人力{quantity}人,实际考勤为{num}人。";
|
||||
}
|
||||
else
|
||||
{
|
||||
warningContent = $"{projectUnits.UnitName}单位计划{planDate}投入人力{quantity}人,实际考勤为{num}人。";
|
||||
}
|
||||
|
||||
foreach (var userId in toUserIds)
|
||||
{
|
||||
Model.ToDoItem toDoItem = new Model.ToDoItem();
|
||||
toDoItem.DataId = SQLHelper.GetNewID(typeof(Model.ToDoItem));
|
||||
toDoItem.MenuId = "";
|
||||
toDoItem.MenuName = "管理人员到岗预警";
|
||||
toDoItem.Content = warningContent;
|
||||
toDoItem.UserId = userId;
|
||||
toDoItem.UserName = UserService.GetUserNameByUserId(userId);
|
||||
toDoItem.DataTime = DateTime.Now;
|
||||
toDoItem.DataTimeStr = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
toDoItem.PCUrl = "";
|
||||
toDoItem.UrlStr = "pages/exam/examjs";
|
||||
toDoItems.Add(toDoItem);
|
||||
}
|
||||
}
|
||||
|
||||
return toDoItems;
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// 检查作业人员人力偏差情况(一周内累计偏差值超过计划的10%)
|
||||
// /// </summary>
|
||||
// /// <param name="projectId">项目ID</param>
|
||||
private static IEnumerable<ToDoItem> CheckWorkerDeviation(string projectId)
|
||||
{
|
||||
//获取计划的最新版本
|
||||
var version = "1";
|
||||
var sgMan = Funs.DB.JDGL_SGManPower.Where(x => x.ProjectId == projectId).OrderByDescending(x => x.Version)
|
||||
.FirstOrDefault();
|
||||
if (sgMan != null)
|
||||
{
|
||||
version = sgMan.Version;
|
||||
}
|
||||
|
||||
// 先获取计划表一周的作业岗位有哪些
|
||||
var dataList = (from x in Funs.DB.JDGL_SGManPower
|
||||
join p in Funs.DB.Base_WorkPost on x.WorkPostId equals p.WorkPostId into pp
|
||||
from y in pp.DefaultIfEmpty()
|
||||
where x.ProjectId == projectId && (y.PostType == "2" || y.PostType == "3") &&
|
||||
x.PlanDate >= DateTime.Now.AddDays(-7) && x.PlanDate <= DateTime.Now && x.Version == version
|
||||
group x by new
|
||||
{
|
||||
x.UnitId,
|
||||
x.UnitWorkId,
|
||||
x.WorkPostId
|
||||
}
|
||||
into g
|
||||
select new
|
||||
{
|
||||
UnitId = g.Key.UnitId,
|
||||
UnitWorkId = g.Key.UnitWorkId,
|
||||
WorkPostId = g.Key.WorkPostId,
|
||||
QuantitySum = g.Sum(x => x.Quantity)
|
||||
}).ToList();
|
||||
|
||||
var lItems = new List<ToDoItem>();
|
||||
//循环检查实际考勤中的人数
|
||||
foreach (var data in dataList)
|
||||
{
|
||||
//根据人员计划表获取计划中的作业人员数
|
||||
int num = getInOutRecordNum1(data.UnitId, data.UnitWorkId, data.WorkPostId,projectId);
|
||||
|
||||
// 计算偏差百分比
|
||||
if (data.QuantitySum > num)
|
||||
{
|
||||
double deviationPercentage = Math.Abs((double)((data.QuantitySum - num) / data.QuantitySum));
|
||||
// 如果偏差超过10%,发出预警
|
||||
if (deviationPercentage > 0.1)
|
||||
{
|
||||
lItems = SendWorkerDeviationWarning(data.UnitId, projectId, data.UnitWorkId, data.QuantitySum, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return lItems;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//获取实际考勤人员数
|
||||
private static int getInOutRecordNum1(string unitId, string unitWorkId, string workPostId, string projectId)
|
||||
{
|
||||
string strSql = @"
|
||||
SELECT e.UnitId, e.PostId, e.RecordDate, p.WorkAreaId as UnitWorkId
|
||||
FROM T_d_EmployInOutRecord e INNER JOIN SitePerson_Person p ON e.IDCardNo = p.IdentityCard AND e.ProjectId = p.ProjectId
|
||||
WHERE e.PostId IS NOT NULL AND e.PostId != ''
|
||||
AND e.ProjectId = @ProjectId
|
||||
AND e.UnitId = @UnitId
|
||||
AND e.PostId = @PostId
|
||||
AND e.RecordDate >= @StartDate
|
||||
AND e.RecordDate <= @EndDate";
|
||||
|
||||
var parameters = new List<System.Data.SqlClient.SqlParameter>
|
||||
{
|
||||
new System.Data.SqlClient.SqlParameter("@ProjectId", projectId),
|
||||
new System.Data.SqlClient.SqlParameter("@UnitId", unitId),
|
||||
new System.Data.SqlClient.SqlParameter("@PostId", workPostId),
|
||||
new System.Data.SqlClient.SqlParameter("@StartDate", DateTime.Now.AddDays(-7)),
|
||||
new System.Data.SqlClient.SqlParameter("@EndDate", DateTime.Now),
|
||||
};
|
||||
|
||||
// 执行查询获取分组数据
|
||||
var dt = SQLHelper.GetDataTableRunText(strSql, parameters.ToArray());
|
||||
|
||||
// 创建一个新的DataTable来存储处理后的数据
|
||||
DataTable processedDt = dt.Clone();
|
||||
|
||||
foreach (System.Data.DataRow row in dt.Rows)
|
||||
{
|
||||
string ids = row["UnitWorkId"] != DBNull.Value ? row["UnitWorkId"].ToString() : string.Empty;
|
||||
if (!string.IsNullOrEmpty(ids))
|
||||
{
|
||||
string[] unitWorkIdArray = ids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string id in unitWorkIdArray)
|
||||
{
|
||||
// 往processedDt里面添加数据,每个UnitWorkId一行
|
||||
DataRow newRow = processedDt.NewRow();
|
||||
newRow["UnitId"] = row["UnitId"];
|
||||
newRow["PostId"] = row["PostId"];
|
||||
newRow["RecordDate"] = row["RecordDate"];
|
||||
newRow["UnitWorkId"] = id.Trim();
|
||||
processedDt.Rows.Add(newRow);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DataRow newRow = processedDt.NewRow();
|
||||
newRow["UnitId"] = row["UnitId"];
|
||||
newRow["PostId"] = row["PostId"];
|
||||
newRow["RecordDate"] = row["RecordDate"];
|
||||
newRow["UnitWorkId"] = string.Empty;
|
||||
processedDt.Rows.Add(newRow);
|
||||
}
|
||||
}
|
||||
|
||||
// 确定要用于后续处理的数据源
|
||||
IEnumerable<DataRow> dataSource = processedDt.AsEnumerable();
|
||||
|
||||
if (string.IsNullOrEmpty(unitWorkId))
|
||||
{
|
||||
dataSource = dataSource.Where(x => x["UnitWorkId"] == null);
|
||||
}
|
||||
else
|
||||
{
|
||||
dataSource = dataSource.Where(x => x["UnitWorkId"] != DBNull.Value && x["UnitWorkId"].ToString() == unitWorkId);
|
||||
}
|
||||
|
||||
return dataSource.Count();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 发送作业人员偏差预警
|
||||
/// </summary>
|
||||
/// <param name="projectId">项目ID</param>
|
||||
/// <param name="unitId">单位ID</param>
|
||||
/// <param name="planTotal">计划总人数</param>
|
||||
/// <param name="actualTotal">实际总人数</param>
|
||||
/// <param name="deviationPercentage">偏差百分比</param>
|
||||
private static List<ToDoItem> SendWorkerDeviationWarning(string unitId, string projectId, string unitWorkId, int? quantity, int num)
|
||||
{
|
||||
|
||||
// 发送预警信息
|
||||
var toDoItems = new List<ToDoItem>();
|
||||
List<string> toUserIds = new List<string>();
|
||||
|
||||
var unitWorks = (from x in Funs.DB.WBS_UnitWork
|
||||
where x.UnitWorkId == unitWorkId
|
||||
select new { x.UnitWorkId, x.UnitWorkName }).FirstOrDefault();
|
||||
|
||||
var projectUnits = (from x in Funs.DB.Project_ProjectUnit
|
||||
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
|
||||
where x.UnitId == unitId
|
||||
select new { x.UnitId, y.UnitName, x.UnitType }).FirstOrDefault();
|
||||
|
||||
// 获取施工单位项目经理
|
||||
var constructionManagers = (from x in Funs.DB.Project_ProjectUser
|
||||
where x.ProjectId == projectId && x.UnitId == unitId && x.IsPost == true &&
|
||||
x.RoleId.Contains(Const.ProjectManager)
|
||||
select x).ToList();
|
||||
|
||||
if (constructionManagers.Count > 0)
|
||||
{
|
||||
foreach (var projectUser in constructionManagers)
|
||||
{
|
||||
toUserIds.Add(projectUser.UserId);
|
||||
}
|
||||
}
|
||||
// 获取总包单位施工经理
|
||||
var generalContractorUnit = Funs.DB.Project_ProjectUnit.FirstOrDefault(pu =>
|
||||
pu.ProjectId == projectId && pu.UnitType == Const.ProjectUnitType_1); // 总包单位
|
||||
|
||||
if (generalContractorUnit != null)
|
||||
{
|
||||
var constructionManagerGCs = (from x in Funs.DB.Project_ProjectUser
|
||||
where x.ProjectId == projectId && x.UnitId == generalContractorUnit.UnitId &&
|
||||
x.IsPost == true && x.RoleId.Contains(Const.ConstructionManager)
|
||||
select x).ToList();
|
||||
if (constructionManagerGCs.Count > 0)
|
||||
{
|
||||
foreach (var projectUser in constructionManagerGCs)
|
||||
{
|
||||
toUserIds.Add(projectUser.UserId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 构建预警信息内容
|
||||
string warningContent = string.Empty;
|
||||
if (unitWorks != null)
|
||||
{
|
||||
warningContent =
|
||||
$"{projectUnits.UnitName}单位{unitWorks.UnitWorkName}装置计划投入人力{quantity}人,实际考勤为{num}人。";
|
||||
}
|
||||
else
|
||||
{
|
||||
warningContent = $"{projectUnits.UnitName}单位计划投入人力{quantity}人,实际考勤为{num}人。";
|
||||
}
|
||||
|
||||
// 发送预警信息
|
||||
foreach (var userId in toUserIds)
|
||||
{
|
||||
Model.ToDoItem toDoItem = new Model.ToDoItem();
|
||||
toDoItem.DataId = SQLHelper.GetNewID(typeof(Model.ToDoItem));
|
||||
toDoItem.MenuId = "";
|
||||
toDoItem.MenuName = "人力资源偏差预警";
|
||||
toDoItem.Content = warningContent;
|
||||
toDoItem.UserId = userId;
|
||||
toDoItem.UserName = UserService.GetUserNameByUserId(userId);
|
||||
toDoItem.DataTime = DateTime.Now;
|
||||
toDoItem.DataTimeStr = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
toDoItem.PCUrl = "";
|
||||
toDoItem.UrlStr = "pages/exam/examjs";
|
||||
toDoItems.Add(toDoItem);
|
||||
}
|
||||
return toDoItems;
|
||||
}
|
||||
}
|
||||
}
|
||||
+104
-20
@@ -28,7 +28,7 @@ namespace BLL
|
||||
private static SqlCommand BuildIntCommand(string storedProcName, IDataParameter[] parameters)
|
||||
{
|
||||
SqlCommand command = BuildQueryCommand(storedProcName, parameters);
|
||||
|
||||
|
||||
command.Parameters.Add(new SqlParameter("ReturnValue",
|
||||
SqlDbType.Int,
|
||||
4, /* Size */
|
||||
@@ -71,7 +71,7 @@ namespace BLL
|
||||
finally
|
||||
{
|
||||
Connection.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(storedProcName, Connection)
|
||||
{
|
||||
@@ -222,7 +222,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(storedProcName, Connection)
|
||||
{
|
||||
@@ -260,7 +260,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(storedProcName, Connection)
|
||||
{
|
||||
@@ -295,7 +295,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(strSql, Connection)
|
||||
{
|
||||
@@ -332,7 +332,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = BuildQueryCommand(storedProcName, parameters);
|
||||
command.CommandTimeout = 0;
|
||||
@@ -344,6 +344,86 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行存储过程【无返回值】
|
||||
/// </summary>
|
||||
/// <param name="procedureName"></param>
|
||||
/// <param name="parameters"></param>
|
||||
public static void ExecuteNonQueryStoredProcedure(string procedureName, SqlParameter[] parameters = null)
|
||||
{
|
||||
using (SqlConnection connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
// 打开连接
|
||||
connection.Open();
|
||||
using (SqlCommand command = new SqlCommand(procedureName, connection))
|
||||
{
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
if (parameters != null)
|
||||
{
|
||||
command.Parameters.AddRange(parameters);
|
||||
}
|
||||
// 执行存储过程
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 处理异常,例如记录日志等
|
||||
Console.WriteLine("An error occurred: " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
connection.Close(); // Ensures the connection is closed even if an exception occurs
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行存储过程【返回int结果值】
|
||||
/// </summary>
|
||||
/// <param name="procedureName"></param>
|
||||
/// <param name="parameters"></param>
|
||||
/// <returns></returns>
|
||||
public static int ExecuteProcedure(string procedureName, SqlParameter[] parameters = null)
|
||||
{
|
||||
using (SqlConnection connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
// 打开连接
|
||||
connection.Open();
|
||||
using (SqlCommand command = new SqlCommand(procedureName, connection))
|
||||
{
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
if (parameters != null)
|
||||
{
|
||||
command.Parameters.AddRange(parameters);
|
||||
}
|
||||
command.Parameters["@returnVal"].Direction = ParameterDirection.Output;
|
||||
// 执行存储过程
|
||||
command.ExecuteNonQuery();
|
||||
// 获取返回值,如果存储过程有返回值参数,可以从参数中获取,例如:
|
||||
return (int)command.Parameters["returnVal"].Value;
|
||||
// 如果存储过程没有返回输出参数,而是通过其他方式(如SELECT语句)返回一个整数值,则需要修改为以下方式:
|
||||
//SqlCommand cmd = new SqlCommand("SELECT @RETURN_VALUE", connection); // 这里@RETURN_VALUE是你在存储过程中设置的变量名,例如SET @RETURN_VALUE = 1;
|
||||
//return (int)cmd.ExecuteScalar(); // 使用ExecuteScalar获取单个值结果
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 处理异常,例如记录日志等
|
||||
Console.WriteLine("An error occurred: " + ex.Message);
|
||||
return 0;
|
||||
}
|
||||
finally
|
||||
{
|
||||
connection.Close(); // Ensures the connection is closed even if an exception occurs
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取字符串
|
||||
/// </summary>
|
||||
@@ -355,7 +435,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(sql, Connection)
|
||||
{
|
||||
@@ -379,7 +459,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(sql, Connection)
|
||||
{
|
||||
@@ -405,7 +485,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(sql, Connection)
|
||||
{
|
||||
@@ -413,6 +493,10 @@ namespace BLL
|
||||
CommandType = CommandType.Text
|
||||
};
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -436,7 +520,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlDataAdapter sqlDA = new SqlDataAdapter
|
||||
{
|
||||
@@ -467,7 +551,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlDataAdapter sqlDA = new SqlDataAdapter
|
||||
{
|
||||
@@ -494,7 +578,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(strSql, Connection)
|
||||
{
|
||||
@@ -525,7 +609,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(strSql, Connection)
|
||||
{
|
||||
@@ -554,7 +638,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(strSql, Connection)
|
||||
{
|
||||
@@ -751,7 +835,7 @@ namespace BLL
|
||||
/// </summary>
|
||||
/// <param name="pur_name">存储过程名称</param>
|
||||
/// <param name="parmList">存储过程的{参数--值}的集合</param>
|
||||
public static void RunProcedure(string pur_name, Hashtable parmList, ref int returnValue)
|
||||
public static void RunProcedure(string pur_name, Hashtable parmList, ref int returnValue)
|
||||
{
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
@@ -823,7 +907,7 @@ namespace BLL
|
||||
SqlTransaction trans = null;
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
cmd.Connection.Open();
|
||||
trans = cmd.Connection.BeginTransaction();
|
||||
cmd.Transaction = trans;
|
||||
@@ -862,7 +946,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(storedProcName, Connection)
|
||||
{
|
||||
@@ -902,7 +986,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(storedProcName, Connection)
|
||||
{
|
||||
@@ -978,7 +1062,7 @@ namespace BLL
|
||||
/// </summary>
|
||||
/// <param name="storedProcName"></param>
|
||||
/// <returns></returns>
|
||||
public static int RunProcGetHsseKq(string ProjectId,DateTime startTime,DateTime endTime,string UnitId)
|
||||
public static int RunProcGetHsseKq(string ProjectId, DateTime startTime, DateTime endTime, string UnitId)
|
||||
{
|
||||
string str = "";
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
|
||||
@@ -33,6 +33,17 @@ namespace BLL
|
||||
var unit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitId != unitId && x.UnitName == unitName);
|
||||
return (unit != null);
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取单位信息是否存在
|
||||
/// </summary>
|
||||
/// <param name="unitId"></param>
|
||||
/// <param name="unitEnName"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExitUnitByUnitEnName(string unitId, string unitEnName)
|
||||
{
|
||||
var unit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitId != unitId && x.UnitEnName == unitEnName);
|
||||
return (unit != null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取单位信息是否存在
|
||||
@@ -58,6 +69,7 @@ namespace BLL
|
||||
UnitId = unit.UnitId,
|
||||
UnitCode = unit.UnitCode,
|
||||
UnitName = unit.UnitName,
|
||||
UnitEnName = unit.UnitEnName,
|
||||
ShortUnitName = unit.ShortUnitName,
|
||||
UnitTypeId = unit.UnitTypeId,
|
||||
Corporate = unit.Corporate,
|
||||
@@ -95,6 +107,7 @@ namespace BLL
|
||||
{
|
||||
newUnit.UnitCode = unit.UnitCode;
|
||||
newUnit.UnitName = unit.UnitName;
|
||||
newUnit.UnitEnName = unit.UnitEnName;
|
||||
newUnit.UnitTypeId = unit.UnitTypeId;
|
||||
newUnit.Corporate = unit.Corporate;
|
||||
newUnit.Address = unit.Address;
|
||||
@@ -684,6 +697,12 @@ namespace BLL
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有单位名称下拉选择项
|
||||
/// </summary>
|
||||
/// <param name="dropName"></param>
|
||||
/// <param name="isShowPlease"></param>
|
||||
public static void InitAllUnitDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "UnitId";
|
||||
|
||||
@@ -1095,6 +1095,7 @@
|
||||
#endregion
|
||||
|
||||
#region 建筑行业能源节约与生态环境保护汇总表上报
|
||||
|
||||
/// <summary>
|
||||
/// 建筑行业能源节约与生态环境保护汇总表上报
|
||||
/// </summary>
|
||||
@@ -1105,7 +1106,7 @@
|
||||
{
|
||||
try
|
||||
{
|
||||
CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
|
||||
|
||||
var upReport = from x in db.Environmental_ArchitectureReport
|
||||
where x.ArchitectureReportId == chemicalReportId
|
||||
select new Model.ArchitectureReport
|
||||
@@ -1113,7 +1114,7 @@
|
||||
ArchitectureReportId = x.ArchitectureReportId,
|
||||
UnitId = x.UnitId,
|
||||
Year = x.Year,
|
||||
Quarters = x.Quarters,
|
||||
Month = x.Month,
|
||||
FillingMan = x.FillingMan,
|
||||
FillingDate = x.FillingDate,
|
||||
DutyPerson = x.DutyPerson,
|
||||
@@ -1149,7 +1150,7 @@
|
||||
////更新 当前人要处理的意见
|
||||
ProjectDataFlowSetService.CloseFlowOperate(Const.ArchitectureReportMenuId, item, string.Empty);
|
||||
// //更新催报信息
|
||||
UrgeReportService.SetComplete(report.UnitId, Const.ReportType_1, report.Year.ToString(), report.Quarters.ToString());
|
||||
UrgeReportService.SetComplete(report.UnitId, Const.ReportType_1, report.Year.ToString(), report.Month.ToString());
|
||||
}
|
||||
}
|
||||
LogService.AddSys_Log(CurrUser, "【建筑行业能源节约与生态环境保护汇总表】上传到服务器" + upReport.Count().ToString() + "条数据;", null, BLL.Const.ArchitectureReportMenuId, BLL.Const.BtnUploadResources);
|
||||
@@ -1167,6 +1168,7 @@
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// UpApiArchitectureReportApi调用
|
||||
/// </summary>
|
||||
|
||||
@@ -57,12 +57,12 @@ namespace BLL
|
||||
/// </summary>
|
||||
/// <param name="ArchitectureReportItemId">建筑行业能源节约与生态环境保护汇总明细表Id</param>
|
||||
/// <returns>明细记录集合</returns>
|
||||
public static List<Model.Environmental_ArchitectureReportItem> GetYearSumItems(string unitId, int? year, int? Quarters)
|
||||
public static List<Model.Environmental_ArchitectureReportItem> GetYearSumItems(string unitId, int? year, int? Month)
|
||||
{
|
||||
return (from x in Funs.DB.Environmental_ArchitectureReportItem
|
||||
join y in Funs.DB.Environmental_ArchitectureReport
|
||||
on x.ArchitectureReportId equals y.ArchitectureReportId
|
||||
where y.UnitId == unitId && y.Year == year && y.Quarters == Quarters
|
||||
where y.UnitId == unitId && y.Year == year && y.Month == Month
|
||||
orderby x.SortIndex
|
||||
select x).Distinct().ToList();
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ namespace BLL
|
||||
/// <param name = "year" > 年度 </ param >
|
||||
/// <param name="month">月份</param>
|
||||
/// <returns>建筑行业能源节约与生态环境保护汇总表</returns>
|
||||
public static Model.Environmental_ArchitectureReport GetArchitectureReportByUnitIdAndYearAndQuarters(string unitId, int year, int Quarters)
|
||||
public static Model.Environmental_ArchitectureReport GetArchitectureReportByUnitIdAndYearAndQuarters(string unitId, int year, int month)
|
||||
{
|
||||
return Funs.DB.Environmental_ArchitectureReport.FirstOrDefault(e => e.UnitId == unitId && e.Quarters == Quarters && e.Year == year);
|
||||
return Funs.DB.Environmental_ArchitectureReport.FirstOrDefault(e => e.UnitId == unitId && e.Month == month && e.Year == year);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -50,7 +50,7 @@ namespace BLL
|
||||
{
|
||||
ArchitectureReportId = ArchitectureReport.ArchitectureReportId,
|
||||
Year = ArchitectureReport.Year,
|
||||
Quarters = ArchitectureReport.Quarters,
|
||||
Month = ArchitectureReport.Month,
|
||||
UnitId = ArchitectureReport.UnitId,
|
||||
FillingDate = ArchitectureReport.FillingDate,
|
||||
DutyPerson = ArchitectureReport.DutyPerson,
|
||||
@@ -72,7 +72,7 @@ namespace BLL
|
||||
if (newArchitectureReport != null)
|
||||
{
|
||||
newArchitectureReport.Year = ArchitectureReport.Year;
|
||||
newArchitectureReport.Quarters = ArchitectureReport.Quarters;
|
||||
newArchitectureReport.Month = ArchitectureReport.Month;
|
||||
newArchitectureReport.UnitId = ArchitectureReport.UnitId;
|
||||
newArchitectureReport.FillingDate = ArchitectureReport.FillingDate;
|
||||
newArchitectureReport.DutyPerson = ArchitectureReport.DutyPerson;
|
||||
@@ -83,7 +83,7 @@ namespace BLL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Id获取数据
|
||||
/// 根据Id删除数据
|
||||
/// </summary>
|
||||
/// <param name="ArchitectureReportId"></param>
|
||||
public static void DeleteArchitectureReportByArchitectureReportId(string ArchitectureReportId)
|
||||
@@ -101,9 +101,9 @@ namespace BLL
|
||||
/// </summary>
|
||||
/// <param name="Id">Id</param>
|
||||
/// <returns></returns>
|
||||
public static Model.Environmental_ArchitectureReport GetArchitectureReportByUnitIdDate(string unitId, int year, int Quarters)
|
||||
public static Model.Environmental_ArchitectureReport GetArchitectureReportByUnitIdDate(string unitId, int year, int month)
|
||||
{
|
||||
return Funs.DB.Environmental_ArchitectureReport.FirstOrDefault(e => e.UnitId == unitId && e.Year == year && e.Quarters == Quarters);
|
||||
return Funs.DB.Environmental_ArchitectureReport.FirstOrDefault(e => e.UnitId == unitId && e.Year == year && e.Month == month);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -57,12 +57,12 @@ namespace BLL
|
||||
/// </summary>
|
||||
/// <param name="ArchitectureReportItemId">建筑行业能源节约与生态环境保护汇总明细表Id</param>
|
||||
/// <returns>明细记录集合</returns>
|
||||
public static List<Model.Environmental_ProjectArchitectureReportItem> GetYearSumItems(string projectId, int? year, int? Quarters)
|
||||
public static List<Model.Environmental_ProjectArchitectureReportItem> GetYearSumItems(string projectId, int? year, int? Month)
|
||||
{
|
||||
return (from x in Funs.DB.Environmental_ProjectArchitectureReportItem
|
||||
join y in Funs.DB.Environmental_ProjectArchitectureReport
|
||||
on x.ArchitectureReportId equals y.ArchitectureReportId
|
||||
where y.ProjectId == projectId && y.Year == year && y.Quarters == Quarters
|
||||
where y.ProjectId == projectId && y.Year == year && y.Month == Month
|
||||
orderby x.SortIndex
|
||||
select x).Distinct().ToList();
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ namespace BLL
|
||||
/// <param name = "year" > 年度 </ param >
|
||||
/// <param name="month">月份</param>
|
||||
/// <returns>建筑行业能源节约与生态环境保护汇总表</returns>
|
||||
public static Model.Environmental_ProjectArchitectureReport GetArchitectureReportByProjectIdAndYearAndQuarters(string projectId, int year, int Quarters)
|
||||
public static Model.Environmental_ProjectArchitectureReport GetArchitectureReportByProjectIdAndYearAndQuarters(string projectId, int year, int Month)
|
||||
{
|
||||
return Funs.DB.Environmental_ProjectArchitectureReport.FirstOrDefault(e => e.ProjectId == projectId && e.Quarters == Quarters && e.Year == year);
|
||||
return Funs.DB.Environmental_ProjectArchitectureReport.FirstOrDefault(e => e.ProjectId == projectId && e.Month == Month && e.Year == year);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -50,7 +50,7 @@ namespace BLL
|
||||
{
|
||||
ArchitectureReportId = ArchitectureReport.ArchitectureReportId,
|
||||
Year = ArchitectureReport.Year,
|
||||
Quarters = ArchitectureReport.Quarters,
|
||||
Month = ArchitectureReport.Month,
|
||||
ProjectId = ArchitectureReport.ProjectId,
|
||||
FillingDate = ArchitectureReport.FillingDate,
|
||||
DutyPerson = ArchitectureReport.DutyPerson,
|
||||
@@ -72,7 +72,7 @@ namespace BLL
|
||||
if (newArchitectureReport != null)
|
||||
{
|
||||
newArchitectureReport.Year = ArchitectureReport.Year;
|
||||
newArchitectureReport.Quarters = ArchitectureReport.Quarters;
|
||||
newArchitectureReport.Month = ArchitectureReport.Month;
|
||||
newArchitectureReport.ProjectId = ArchitectureReport.ProjectId;
|
||||
newArchitectureReport.FillingDate = ArchitectureReport.FillingDate;
|
||||
newArchitectureReport.DutyPerson = ArchitectureReport.DutyPerson;
|
||||
@@ -101,9 +101,9 @@ namespace BLL
|
||||
/// </summary>
|
||||
/// <param name="Id">Id</param>
|
||||
/// <returns></returns>
|
||||
public static Model.Environmental_ProjectArchitectureReport GetArchitectureReportByProjectIdDate(string ProjectId, int year, int Quarters)
|
||||
public static Model.Environmental_ProjectArchitectureReport GetArchitectureReportByProjectIdDate(string ProjectId, int year, int Month)
|
||||
{
|
||||
return Funs.DB.Environmental_ProjectArchitectureReport.FirstOrDefault(e => e.ProjectId == ProjectId && e.Year == year && e.Quarters == Quarters);
|
||||
return Funs.DB.Environmental_ProjectArchitectureReport.FirstOrDefault(e => e.ProjectId == ProjectId && e.Year == year && e.Month == Month);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user