This commit is contained in:
geh 2026-01-08 15:13:25 +08:00
parent 6bbf6d34b4
commit fb6c53dd62
4 changed files with 422 additions and 154 deletions

View File

@ -0,0 +1,28 @@
---
CREATE TABLE [dbo].[SGManPower_WarningResult] (
[WarningId] nvarchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL,
[ProjectId] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL,
[UnitId] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL,
[UnitWorkId] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL,
[WorkPostId] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL,
[WarningType] nvarchar(20) COLLATE Chinese_PRC_CI_AS NULL,
[ContinuousDays] int NULL,
[StartDate] date NULL,
[EndDate] date NULL,
[PlanQuantity] int NULL,
[ActualQuantity] int NULL,
CONSTRAINT [PK__SGManPow__21457158BE7F041D] PRIMARY KEY CLUSTERED ([WarningId])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
)
ON [PRIMARY]
GO
ALTER TABLE [dbo].[SGManPower_WarningResult] SET (LOCK_ESCALATION = TABLE)
GO
CREATE NONCLUSTERED INDEX [IX_SGManPower_WarningResult_ProjectId_WarningType]
ON [dbo].[SGManPower_WarningResult] (
[ProjectId] ASC,
[WarningType] ASC
)

View File

@ -20,21 +20,27 @@ namespace BLL
var projects = Funs.DB.Base_Project.Where(p => p.ProjectState == BLL.Const.ProjectState_1).ToList();
foreach (var project in projects)
{
// 检查管理人员到期未到岗情况
var items1 = CheckHistoricalContinuousShortage(project.ProjectId);
// 检查作业人员人力偏差情况
var items2 = CheckWorkerDeviation(project.ProjectId);
if (items1 != null)
// // 检查管理人员到期未到岗情况
// var items1 = CheckHistoricalContinuousShortage(project.ProjectId);
//
// // 检查作业人员人力偏差情况
// var items2 = CheckWorkerDeviation(project.ProjectId);
//
//
// if (items1 != null)
// {
// allItems.AddRange(items1);
// }
//
// if (items2 != null)
// {
// allItems.AddRange(items2);
// }
// 从预计算表获取预警数据
var items = GetWarningItemsFromTable(project.ProjectId);
if (items != null)
{
allItems.AddRange(items1);
}
if (items2 != null)
{
allItems.AddRange(items2);
allItems.AddRange(items);
}
}
@ -479,7 +485,7 @@ namespace BLL
warningContent = $"{projectUnits.UnitName}单位计划投入人力{quantity}人,实际考勤为{num}人。";
}
string urlParams = "JDGL/SGManPower/SGWarningDetails.aspx?projectId=" + projectId;
string urlParams = "JDGL/SGManPower/SGWarningDetailsEdit.aspx?projectId=" + projectId;
// 添加单位参数(如果已选择)
if (!string.IsNullOrEmpty(unitId))
{
@ -499,10 +505,15 @@ namespace BLL
}
// 添加时间参数
if (startDate.HasValue && endDate.HasValue)
if (startDate.HasValue)
{
urlParams += "&planDate=" + string.Format("{0:yyyy-MM-dd}", startDate) + "~" +
string.Format("{0:yyyy-MM-dd}", endDate);
urlParams += "&startTime=" + string.Format("{0:yyyy-MM-dd}", startDate);
}
// 添加时间参数
if (endDate.HasValue)
{
urlParams += "&endTime=" + string.Format("{0:yyyy-MM-dd}", endDate);
}
// 发送预警信息
@ -526,5 +537,46 @@ namespace BLL
}
#endregion
private static IEnumerable<ToDoItem> GetWarningItemsFromTable(string projectId)
{
var strSql = @"SELECT * FROM SGManPower_WarningResult
WHERE ProjectId = @ProjectId ";
var parameters = new List<System.Data.SqlClient.SqlParameter>
{
new System.Data.SqlClient.SqlParameter("@ProjectId", projectId)
};
var dt = SQLHelper.GetDataTableRunText(strSql, parameters.ToArray());
var warningItems = new List<ToDoItem>();
foreach (DataRow row in dt.Rows)
{
var warningType = row["WarningType"].ToString();
var unitId = row["UnitId"].ToString();
var workPostId = row["WorkPostId"].ToString();
var unitWorkId = row["UnitWorkId"].ToString();
var startDate = Convert.ToDateTime(row["StartDate"]);
var endDate = Convert.ToDateTime(row["EndDate"]);
var planQuantity = Convert.ToInt32(row["PlanQuantity"]);
var actualQuantity = Convert.ToInt32(row["ActualQuantity"]);
if (warningType == "Shortage")
{
warningItems.AddRange(SendManagerWarning(unitId, projectId, workPostId, unitWorkId,
startDate, endDate, planQuantity, actualQuantity));
}
else if (warningType == "Deviation")
{
warningItems.AddRange(SendWorkerDeviationWarning(unitId, projectId, workPostId, unitWorkId,
startDate, endDate, planQuantity, actualQuantity));
}
}
return warningItems;
}
}
}

View File

@ -144,17 +144,17 @@ namespace FineUIPro.Web
string returnDbHtml = "";
var getDataList = Funs.DB.Sp_WorkBench_GetToDoItems(userId, sType).ToList();
//调人力预警接口
// if (sType != "2")
// {
// var sgList = SGManPowerService.CheckAndSendPersonWarning(userId);
// if (sgList != null)
// {
// foreach (var item in sgList)
// {
// getDataList.Add(item);
// }
// }
// }
if (sType != "2")
{
var sgList = SGManPowerService.CheckAndSendPersonWarning(userId);
if (sgList != null)
{
foreach (var item in sgList)
{
getDataList.Add(item);
}
}
}
//把getDataList和sgList的数据合并
foreach (var item in getDataList)
{

View File

@ -2294,6 +2294,9 @@ namespace Model
partial void InsertSeDin_MonthReportFlowOperate(SeDin_MonthReportFlowOperate instance);
partial void UpdateSeDin_MonthReportFlowOperate(SeDin_MonthReportFlowOperate instance);
partial void DeleteSeDin_MonthReportFlowOperate(SeDin_MonthReportFlowOperate instance);
partial void InsertSGManPower_WarningResult(SGManPower_WarningResult instance);
partial void UpdateSGManPower_WarningResult(SGManPower_WarningResult instance);
partial void DeleteSGManPower_WarningResult(SGManPower_WarningResult instance);
partial void InsertSitePerson_Checking(SitePerson_Checking instance);
partial void UpdateSitePerson_Checking(SitePerson_Checking instance);
partial void DeleteSitePerson_Checking(SitePerson_Checking instance);
@ -8917,6 +8920,14 @@ namespace Model
}
}
public System.Data.Linq.Table<SGManPower_WarningResult> SGManPower_WarningResult
{
get
{
return this.GetTable<SGManPower_WarningResult>();
}
}
public System.Data.Linq.Table<SitePerson_Checking> SitePerson_Checking
{
get
@ -10245,14 +10256,6 @@ namespace Model
}
}
public System.Data.Linq.Table<View_EmployInOutRecord> View_EmployInOutRecord
{
get
{
return this.GetTable<View_EmployInOutRecord>();
}
}
public System.Data.Linq.Table<View_Environmental_ArchitectureReport> View_Environmental_ArchitectureReport
{
get
@ -351010,6 +351013,308 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.SGManPower_WarningResult")]
public partial class SGManPower_WarningResult : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private string _WarningId;
private string _ProjectId;
private string _UnitId;
private string _UnitWorkId;
private string _WorkPostId;
private string _WarningType;
private System.Nullable<int> _ContinuousDays;
private System.Nullable<System.DateTime> _StartDate;
private System.Nullable<System.DateTime> _EndDate;
private System.Nullable<int> _PlanQuantity;
private System.Nullable<int> _ActualQuantity;
#region
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnWarningIdChanging(string value);
partial void OnWarningIdChanged();
partial void OnProjectIdChanging(string value);
partial void OnProjectIdChanged();
partial void OnUnitIdChanging(string value);
partial void OnUnitIdChanged();
partial void OnUnitWorkIdChanging(string value);
partial void OnUnitWorkIdChanged();
partial void OnWorkPostIdChanging(string value);
partial void OnWorkPostIdChanged();
partial void OnWarningTypeChanging(string value);
partial void OnWarningTypeChanged();
partial void OnContinuousDaysChanging(System.Nullable<int> value);
partial void OnContinuousDaysChanged();
partial void OnStartDateChanging(System.Nullable<System.DateTime> value);
partial void OnStartDateChanged();
partial void OnEndDateChanging(System.Nullable<System.DateTime> value);
partial void OnEndDateChanged();
partial void OnPlanQuantityChanging(System.Nullable<int> value);
partial void OnPlanQuantityChanged();
partial void OnActualQuantityChanging(System.Nullable<int> value);
partial void OnActualQuantityChanged();
#endregion
public SGManPower_WarningResult()
{
OnCreated();
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WarningId", DbType="NVarChar(50) NOT NULL", CanBeNull=false, IsPrimaryKey=true)]
public string WarningId
{
get
{
return this._WarningId;
}
set
{
if ((this._WarningId != value))
{
this.OnWarningIdChanging(value);
this.SendPropertyChanging();
this._WarningId = value;
this.SendPropertyChanged("WarningId");
this.OnWarningIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="NVarChar(50)")]
public string ProjectId
{
get
{
return this._ProjectId;
}
set
{
if ((this._ProjectId != value))
{
this.OnProjectIdChanging(value);
this.SendPropertyChanging();
this._ProjectId = value;
this.SendPropertyChanged("ProjectId");
this.OnProjectIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitId", DbType="NVarChar(50)")]
public string UnitId
{
get
{
return this._UnitId;
}
set
{
if ((this._UnitId != value))
{
this.OnUnitIdChanging(value);
this.SendPropertyChanging();
this._UnitId = value;
this.SendPropertyChanged("UnitId");
this.OnUnitIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitWorkId", DbType="NVarChar(50)")]
public string UnitWorkId
{
get
{
return this._UnitWorkId;
}
set
{
if ((this._UnitWorkId != value))
{
this.OnUnitWorkIdChanging(value);
this.SendPropertyChanging();
this._UnitWorkId = value;
this.SendPropertyChanged("UnitWorkId");
this.OnUnitWorkIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPostId", DbType="NVarChar(50)")]
public string WorkPostId
{
get
{
return this._WorkPostId;
}
set
{
if ((this._WorkPostId != value))
{
this.OnWorkPostIdChanging(value);
this.SendPropertyChanging();
this._WorkPostId = value;
this.SendPropertyChanged("WorkPostId");
this.OnWorkPostIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WarningType", DbType="NVarChar(20)")]
public string WarningType
{
get
{
return this._WarningType;
}
set
{
if ((this._WarningType != value))
{
this.OnWarningTypeChanging(value);
this.SendPropertyChanging();
this._WarningType = value;
this.SendPropertyChanged("WarningType");
this.OnWarningTypeChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContinuousDays", DbType="Int")]
public System.Nullable<int> ContinuousDays
{
get
{
return this._ContinuousDays;
}
set
{
if ((this._ContinuousDays != value))
{
this.OnContinuousDaysChanging(value);
this.SendPropertyChanging();
this._ContinuousDays = value;
this.SendPropertyChanged("ContinuousDays");
this.OnContinuousDaysChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartDate", DbType="Date")]
public System.Nullable<System.DateTime> StartDate
{
get
{
return this._StartDate;
}
set
{
if ((this._StartDate != value))
{
this.OnStartDateChanging(value);
this.SendPropertyChanging();
this._StartDate = value;
this.SendPropertyChanged("StartDate");
this.OnStartDateChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EndDate", DbType="Date")]
public System.Nullable<System.DateTime> EndDate
{
get
{
return this._EndDate;
}
set
{
if ((this._EndDate != value))
{
this.OnEndDateChanging(value);
this.SendPropertyChanging();
this._EndDate = value;
this.SendPropertyChanged("EndDate");
this.OnEndDateChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PlanQuantity", DbType="Int")]
public System.Nullable<int> PlanQuantity
{
get
{
return this._PlanQuantity;
}
set
{
if ((this._PlanQuantity != value))
{
this.OnPlanQuantityChanging(value);
this.SendPropertyChanging();
this._PlanQuantity = value;
this.SendPropertyChanged("PlanQuantity");
this.OnPlanQuantityChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ActualQuantity", DbType="Int")]
public System.Nullable<int> ActualQuantity
{
get
{
return this._ActualQuantity;
}
set
{
if ((this._ActualQuantity != value))
{
this.OnActualQuantityChanging(value);
this.SendPropertyChanging();
this._ActualQuantity = value;
this.SendPropertyChanged("ActualQuantity");
this.OnActualQuantityChanged();
}
}
}
public event PropertyChangingEventHandler PropertyChanging;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void SendPropertyChanging()
{
if ((this.PropertyChanging != null))
{
this.PropertyChanging(this, emptyChangingEventArgs);
}
}
protected virtual void SendPropertyChanged(String propertyName)
{
if ((this.PropertyChanged != null))
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.SitePerson_Checking")]
public partial class SitePerson_Checking : INotifyPropertyChanging, INotifyPropertyChanged
{
@ -432044,123 +432349,6 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.View_EmployInOutRecord")]
public partial class View_EmployInOutRecord
{
private string _ProjectId;
private string _UnitId;
private string _PostId;
private System.Nullable<System.DateTime> _RecordDate;
private string _UnitWorkId;
private System.Nullable<int> _ActualQuantity;
public View_EmployInOutRecord()
{
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="NVarChar(50)")]
public string ProjectId
{
get
{
return this._ProjectId;
}
set
{
if ((this._ProjectId != value))
{
this._ProjectId = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitId", DbType="VarChar(100)")]
public string UnitId
{
get
{
return this._UnitId;
}
set
{
if ((this._UnitId != value))
{
this._UnitId = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PostId", DbType="NVarChar(50)")]
public string PostId
{
get
{
return this._PostId;
}
set
{
if ((this._PostId != value))
{
this._PostId = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_RecordDate", DbType="DateTime")]
public System.Nullable<System.DateTime> RecordDate
{
get
{
return this._RecordDate;
}
set
{
if ((this._RecordDate != value))
{
this._RecordDate = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitWorkId", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)]
public string UnitWorkId
{
get
{
return this._UnitWorkId;
}
set
{
if ((this._UnitWorkId != value))
{
this._UnitWorkId = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ActualQuantity", DbType="Int")]
public System.Nullable<int> ActualQuantity
{
get
{
return this._ActualQuantity;
}
set
{
if ((this._ActualQuantity != value))
{
this._ActualQuantity = value;
}
}
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.View_Environmental_ArchitectureReport")]
public partial class View_Environmental_ArchitectureReport
{