This commit is contained in:
geh
2025-11-11 11:09:49 +08:00
parent aff5d8e4d1
commit f19a09ab98
9 changed files with 1927 additions and 38 deletions
@@ -0,0 +1,102 @@
<%@ Page Language="C#" CodeBehind="SGWarningDetailsEdit.aspx.cs" Inherits="FineUIPro.Web.JDGL.SGManPower.SGWarningDetailsEdit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Title</title>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server"/>
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="人力预警" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="Id" EnableColumnLines="true" DataIDField="Id"
AllowSorting="true" SortDirection="DESC" OnSort="Grid1_Sort" AllowPaging="true"
IsDatabasePaging="true" PageSize="15" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true"
EnableRowDoubleClickEvent="true" EnableTextSelection="True">
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Top" runat="server">
<Items>
<f:DropDownList ID="drpUnit" runat="server" Label="单位" AutoPostBack="true" AutoSelectFirstItem="True" LabelAlign="Right" EnableAjax="True"
LabelWidth="140px">
</f:DropDownList>
<f:DatePicker ID="txtStartTime" runat="server" Label="开始日期" LabelWidth="80px" Width="220px" DateFormatString="yyyy-MM-dd">
</f:DatePicker>
<f:DatePicker ID="txtEndTime" runat="server" Label="结束日期" LabelWidth="80px" Width="220px" DateFormatString="yyyy-MM-dd">
</f:DatePicker>
<f:DropDownList runat="server" ID="drpUnitWork" Label="装置"></f:DropDownList>
<f:DropDownList runat="server" ID="drpWorkPost" Label="岗位"></f:DropDownList>
<f:ToolbarFill ID="ToolbarFill1" runat="server">
</f:ToolbarFill>
<f:Button ID="btnQuery" ToolTip="查询" Text="查询" Icon="SystemSearch" runat="server" EnablePostBack="true"
OnClick="btnQuery_OnClick">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号" Width="50px" HeaderTextAlign="Center"
TextAlign="Center"/>
<f:TemplateField Width="260px" HeaderText="单位" HeaderTextAlign="Center" TextAlign="Left" ColumnID="tfUnitName">
<ItemTemplate>
<asp:Label ID="lbUnitName" runat="server" Text='<%#ConvertUnitName(Eval("UnitId")) %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:TemplateField Width="150px" HeaderText="装置" HeaderTextAlign="Center" TextAlign="Left" ColumnID="tfUnitWorkName">
<ItemTemplate>
<asp:Label ID="lbUnitWorkName" runat="server" Text='<%#ConvertUnitWorkName(Eval("UnitWorkId")) %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:TemplateField Width="150px" HeaderText="岗位" HeaderTextAlign="Center" TextAlign="Left" ColumnID="tfWorkPostName">
<ItemTemplate>
<asp:Label ID="lbtfWorkPostName" runat="server" Text='<%#ConvertWorkPostName(Eval("WorkPostId")) %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField Width="120px" ColumnID="PlanDate" DataField="PlanDate" SortField="PlanDate"
FieldType="Date" Renderer="Date" HeaderText="时间" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="Quantity" DataField="Quantity"
HeaderText="计划人力" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="ActualQuantity" DataField="ActualQuantity"
HeaderText="实际考勤" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu"/>
</Listeners>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</f:ToolbarSeparator>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
</f:DropDownList>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
<f:Menu ID="Menu1" runat="server">
</f:Menu>
</form>
<script type="text/javascript">
var menuID = '<%= Menu1.ClientID %>';
// 返回false,来阻止浏览器右键菜单
function onRowContextMenu(event, rowId) {
F(menuID).show(); //showAt(event.pageX, event.pageY);
return false;
}
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
</script>
</body>
</html>
@@ -0,0 +1,314 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
namespace FineUIPro.Web.JDGL.SGManPower
{
public partial class SGWarningDetailsEdit : PageBase
{
#region
/// <summary>
/// 项目主键
/// </summary>
public string ProjectId
{
get { return (string)ViewState["ProjectId"]; }
set { ViewState["ProjectId"] = value; }
}
public string UnitId
{
get => (string)ViewState["UnitId"];
set => ViewState["UnitId"] = value;
}
public string UnitWorkId
{
get => (string)ViewState["UnitWorkId"];
set => ViewState["UnitWorkId"] = value;
}
public string WorkPostId
{
get => (string)ViewState["WorkPostId"];
set => ViewState["WorkPostId"] = value;
}
public string StartTime
{
get => (string)ViewState["StartTime"];
set => ViewState["StartTime"] = value;
}
public string EndTime
{
get => (string)ViewState["EndTime"];
set => ViewState["EndTime"] = value;
}
private static string Version = "1";
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.ProjectId = this.CurrUser.LoginProjectId;
// 判断projectId参数是否为空
if (!string.IsNullOrEmpty(Request.Params["projectId"]))
{
this.ProjectId = Request.Params["projectId"];
}
Funs.DropDownPageSize(this.ddlPageSize);
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
BLL.UnitService.GetUnit(this.drpUnit, this.ProjectId, true);//单位
this.txtStartTime.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddDays(-30));
this.txtEndTime.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddDays(30));
WorkPostService.InitWorkPostDropDownList(this.drpWorkPost, true); //岗位
UnitWorkService.InitUnitWorkDownList(drpUnitWork, this.ProjectId, true); //单位工程(装置)
this.UnitId = Request.Params["unitId"];
this.UnitWorkId = Request.Params["unitWorkId"];
this.WorkPostId = Request.Params["workPostId"];
this.StartTime = Request.Params["startTime"];
this.EndTime = Request.Params["endTime"];
if (!string.IsNullOrEmpty(this.UnitId))
{
this.drpUnit.SelectedValue = UnitId;
}
if (!string.IsNullOrEmpty(this.UnitWorkId))
{
this.drpUnitWork.SelectedValue = UnitWorkId;
}
if (!string.IsNullOrEmpty(this.WorkPostId))
{
this.drpWorkPost.SelectedValue = WorkPostId;
}
if (!string.IsNullOrEmpty(this.StartTime))
{
this.txtStartTime.Text = StartTime;
}
if (!string.IsNullOrEmpty(this.EndTime))
{
this.txtEndTime.Text = EndTime;
}
var sgMan = Funs.DB.JDGL_SGManPower.Where(x => x.ProjectId == this.ProjectId).OrderByDescending(x => x.Version)
.FirstOrDefault();
if (sgMan != null)
{
Version = sgMan.Version;
}
// 绑定表格
BindGrid();
}
}
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
string strSql =
@"SELECT
p.Id,
p.ProjectId,
p.UnitId,
p.UnitWorkId,
p.WorkPostId,
p.Version,
p.Quantity,
p.PlanDate,
ISNULL(a.ActualQuantity, 0) AS ActualQuantity
FROM JDGL_SGManPower p
LEFT JOIN (
SELECT * from View_EmployInOutRecord
) a ON p.ProjectId = a.ProjectId
AND p.UnitId = a.UnitId
AND p.WorkPostId = a.PostId
AND p.PlanDate = a.RecordDate
AND ISNULL(p.UnitWorkId, '') = ISNULL(a.UnitWorkId, '') where p.Version = '" + Version + "'";
List<SqlParameter> listStr = new List<SqlParameter>();
if (!string.IsNullOrEmpty(this.ProjectId))
{
strSql += " AND p.ProjectId = @ProjectId ";
listStr.Add(new SqlParameter("@ProjectId", this.ProjectId));
}
if (!string.IsNullOrEmpty(this.drpUnit.SelectedValue) && this.drpUnit.SelectedValue != "null")
{
strSql += " AND p.UnitId = @UnitId ";
listStr.Add(new SqlParameter("@UnitId", this.drpUnit.SelectedValue));
}
if (!string.IsNullOrEmpty(this.drpUnitWork.SelectedValue) && this.drpUnitWork.SelectedValue != "null")
{
strSql += " AND p.UnitWorkId = @UnitWorkId ";
listStr.Add(new SqlParameter("@UnitWorkId", this.drpUnitWork.SelectedValue));
}
if (!string.IsNullOrEmpty(this.drpWorkPost.SelectedValue) && this.drpWorkPost.SelectedValue != "null")
{
strSql += " AND p.WorkPostId = @WorkPostId ";
listStr.Add(new SqlParameter("@WorkPostId", this.drpWorkPost.SelectedValue));
}
if (!string.IsNullOrEmpty(this.txtStartTime.Text))
{
strSql += " AND p.PlanDate >= @StartTime ";
listStr.Add(new SqlParameter("@StartTime", Convert.ToDateTime(this.txtStartTime.Text)));
}
if (!string.IsNullOrEmpty(this.txtEndTime.Text))
{
strSql += " AND p.PlanDate <= @EndTime ";
listStr.Add(new SqlParameter("@EndTime", Convert.ToDateTime(this.txtEndTime.Text)));
}
strSql += " ORDER BY p.PlanDate, p.UnitId, p.UnitWorkId, p.WorkPostId";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
}
#endregion
#region
/// <summary>
/// 分页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
Grid1.PageIndex = e.NewPageIndex;
BindGrid();
}
/// <summary>
/// 分页显示条数下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
BindGrid();
}
#endregion
#region
/// <summary>
/// 格式化受伤情况
/// </summary>
/// <param name="injury"></param>
/// <returns></returns>
protected string ConvertWorkPostName(object workPostId)
{
string name = string.Empty;
if (workPostId != null)
{
name = BLL.WorkPostService.getWorkPostNameById(workPostId.ToString());
}
return name;
}
protected string ConvertUnitName(object unitId)
{
string name = string.Empty;
if (unitId != null)
{
name = UnitService.GetUnitNameByUnitId(unitId);
}
return name;
}
/// <summary>
/// 格式化受伤情况
/// </summary>
/// <param name="injury"></param>
/// <returns></returns>
protected string ConvertUnitWorkName(object unitWorkId)
{
string name = string.Empty;
if (unitWorkId != null)
{
name = BLL.UnitWorkService.GetNameById(unitWorkId.ToString());
}
return name;
}
#endregion
#region
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnQuery_OnClick(object sender, EventArgs e)
{
if (drpUnit.SelectedValue != Const._Null && !string.IsNullOrEmpty(drpUnit.SelectedValue))
{
UnitId = drpUnit.SelectedValue;
}
if (drpUnitWork.SelectedValue != Const._Null && !string.IsNullOrEmpty(drpUnitWork.SelectedValue))
{
UnitWorkId = drpUnitWork.SelectedValue;
}
if (drpWorkPost.SelectedValue != Const._Null && !string.IsNullOrEmpty(drpWorkPost.SelectedValue))
{
WorkPostId = drpWorkPost.SelectedValue;
}
if ( !string.IsNullOrEmpty(this.txtStartTime.Text))
{
StartTime = this.txtStartTime.Text;
}
if ( !string.IsNullOrEmpty(this.txtStartTime.Text))
{
EndTime = this.txtEndTime.Text;
}
this.BindGrid();
}
#endregion
}
}
@@ -0,0 +1,188 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.JDGL.SGManPower
{
public partial class SGWarningDetailsEdit
{
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Grid1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// Toolbar1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// drpUnit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.DropDownList drpUnit;
/// <summary>
/// txtStartTime control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.DatePicker txtStartTime;
/// <summary>
/// txtEndTime control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.DatePicker txtEndTime;
/// <summary>
/// drpUnitWork control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.DropDownList drpUnitWork;
/// <summary>
/// drpWorkPost control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.DropDownList drpWorkPost;
/// <summary>
/// ToolbarFill1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnQuery control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnQuery;
/// <summary>
/// lbUnitName control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lbUnitName;
/// <summary>
/// lbUnitWorkName control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lbUnitWorkName;
/// <summary>
/// lbtfWorkPostName control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lbtfWorkPostName;
/// <summary>
/// ToolbarSeparator1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
/// <summary>
/// ToolbarText1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Menu1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Menu Menu1;
}
}