施工人力
This commit is contained in:
parent
0899055e49
commit
ce55496fc0
|
@ -0,0 +1,112 @@
|
|||
INSERT INTO [dbo].[Sys_Menu] ([MenuId], [MenuName], [Icon], [Url], [SortIndex], [SuperMenu], [MenuType], [IsOffice], [IsEnd], [IsUsed]) VALUES (N'B1F87873-FEC8-4BEC-8AB6-AFDEDB26ECEE', N'现场考勤人力', NULL, N'JDGL/SGManPower/ManPowerWork.aspx', 20, N'1BCD283A-F33C-488C-8FCA-F7B7B9C1A003', N'Menu_JDGL', '0', '0', '1');
|
||||
INSERT INTO [dbo].[Sys_Menu] ([MenuId], [MenuName], [Icon], [Url], [SortIndex], [SuperMenu], [MenuType], [IsOffice], [IsEnd], [IsUsed]) VALUES (N'CE4D8228-3971-4F81-B992-5FC564CBFDA6', N'人力统计分析', NULL, N'JDGL/SGManPower/ManPowerStat.aspx', 30, N'1BCD283A-F33C-488C-8FCA-F7B7B9C1A003', N'Menu_JDGL', '0', '0', '1');
|
||||
INSERT INTO [dbo].[Sys_Menu] ([MenuId], [MenuName], [Icon], [Url], [SortIndex], [SuperMenu], [MenuType], [IsOffice], [IsEnd], [IsUsed]) VALUES (N'D87CD627-A18C-4C5D-962D-424E582F2379', N'施工人力计划', NULL, N'JDGL/SGManPower/ManPowerPlan.aspx', 10, N'1BCD283A-F33C-488C-8FCA-F7B7B9C1A003', N'Menu_JDGL', '0', '0', '1');
|
||||
go
|
||||
|
||||
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) VALUES (N'2DC82E2D-3578-445E-9AA2-11D65E3F8775', N'D87CD627-A18C-4C5D-962D-424E582F2379', N'删除', 3);
|
||||
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) VALUES (N'856EA8BF-DE2D-4344-B265-780358C69F8D', N'D87CD627-A18C-4C5D-962D-424E582F2379', N'增加', 1);
|
||||
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) VALUES (N'AC79636E-969A-42AB-82AC-19D3945EC703', N'D87CD627-A18C-4C5D-962D-424E582F2379', N'保存', 4);
|
||||
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) VALUES (N'FEDA3FD4-2436-460F-A75A-027D2D267CE4', N'D87CD627-A18C-4C5D-962D-424E582F2379', N'修改', 2);
|
||||
|
||||
go
|
||||
|
||||
|
||||
|
||||
--施工计划人力表
|
||||
CREATE TABLE [dbo].[JDGL_SGManPower] (
|
||||
[Id] 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,
|
||||
[Version] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
||||
[Quantity] int NULL,
|
||||
[PlanDate] datetime NULL,
|
||||
[CompileMan] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL,
|
||||
[CompileTime] datetime NULL,
|
||||
[Remarks] nvarchar(500) COLLATE Chinese_PRC_CI_AS NULL,
|
||||
CONSTRAINT [PK_JDGL_SGManPower] PRIMARY KEY CLUSTERED ([Id])
|
||||
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].[JDGL_SGManPower] SET (LOCK_ESCALATION = TABLE)
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'主健',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'JDGL_SGManPower',
|
||||
'COLUMN', N'Id'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'项目id',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'JDGL_SGManPower',
|
||||
'COLUMN', N'ProjectId'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'单位id',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'JDGL_SGManPower',
|
||||
'COLUMN', N'UnitId'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'装置id',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'JDGL_SGManPower',
|
||||
'COLUMN', N'UnitWorkId'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'岗位id',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'JDGL_SGManPower',
|
||||
'COLUMN', N'WorkPostId'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'版本',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'JDGL_SGManPower',
|
||||
'COLUMN', N'Version'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'数量',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'JDGL_SGManPower',
|
||||
'COLUMN', N'Quantity'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'日期',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'JDGL_SGManPower',
|
||||
'COLUMN', N'PlanDate'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'编制人',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'JDGL_SGManPower',
|
||||
'COLUMN', N'CompileMan'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'编制时间',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'JDGL_SGManPower',
|
||||
'COLUMN', N'CompileTime'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'备注',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'JDGL_SGManPower',
|
||||
'COLUMN', N'Remarks'
|
|
@ -609,6 +609,7 @@
|
|||
<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\WBSCompleteAndReal\WBSReportService.cs" />
|
||||
<Compile Include="JDGL\WBS\CnProfessionInitService.cs" />
|
||||
<Compile Include="JDGL\WBS\CnProfessionService.cs" />
|
||||
|
@ -1311,7 +1312,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.
|
||||
|
|
|
@ -3310,6 +3310,9 @@ namespace BLL
|
|||
/// 月度计划情况导入模版文件原始的虚拟路径
|
||||
/// </summary>
|
||||
public const string MonthPlanTemplateUrl = "File\\Excel\\DataIn\\月度计划情况导入模板.xls";
|
||||
/// 施工人力计划导入模版文件原始的虚拟路径
|
||||
/// </summary>
|
||||
public const string SGManPowerTemplateUrl = "File\\Excel\\DataIn\\施工人力计划导入模板.xls";
|
||||
/// <summary>
|
||||
/// 周进度计划导入模版文件原始的虚拟路径
|
||||
/// </summary>
|
||||
|
@ -6043,6 +6046,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>
|
||||
/// 周进度计划
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -1538,6 +1538,15 @@
|
|||
<Content Include="JDGL\CostAnalysis\PlanAdjust.aspx" />
|
||||
<Content Include="JDGL\CostAnalysis\RectificationMeasureSet.aspx" />
|
||||
<Content Include="JDGL\Progress\WbsManager.aspx" />
|
||||
<Content Include="JDGL\SGManPower\ManPowerPlan.aspx" />
|
||||
<Content Include="JDGL\SGManPower\ManPowerPlanChart.aspx" />
|
||||
<Content Include="JDGL\SGManPower\ManPowerPlanEdit.aspx" />
|
||||
<Content Include="JDGL\SGManPower\ManPowerPlanGrid.aspx" />
|
||||
<Content Include="JDGL\SGManPower\ManPowerPlanIn.aspx" />
|
||||
<Content Include="JDGL\SGManPower\ManPowerStat.aspx" />
|
||||
<Content Include="JDGL\SGManPower\ManPowerWork.aspx" />
|
||||
<Content Include="JDGL\SGManPower\ManPowerWorkChart.aspx" />
|
||||
<Content Include="JDGL\SGManPower\ManPowerWorkGrid.aspx" />
|
||||
<Content Include="JDGL\WBSCompleteAndReal\WBSCompleteAudit.aspx" />
|
||||
<Content Include="JDGL\WBSCompleteAndReal\WBSReport.aspx" />
|
||||
<Content Include="JDGL\WBSPlan\SeeDetailHistory.aspx" />
|
||||
|
@ -14917,6 +14926,69 @@
|
|||
<Compile Include="JDGL\Progress\WbsManager.aspx.designer.cs">
|
||||
<DependentUpon>WbsManager.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="JDGL\SGManPower\ManPowerPlan.aspx.cs">
|
||||
<DependentUpon>ManPowerPlan.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="JDGL\SGManPower\ManPowerPlan.aspx.designer.cs">
|
||||
<DependentUpon>ManPowerPlan.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="JDGL\SGManPower\ManPowerPlanChart.aspx.cs">
|
||||
<DependentUpon>ManPowerPlanChart.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="JDGL\SGManPower\ManPowerPlanChart.aspx.designer.cs">
|
||||
<DependentUpon>ManPowerPlanChart.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="JDGL\SGManPower\ManPowerPlanEdit.aspx.cs">
|
||||
<DependentUpon>ManPowerPlanEdit.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="JDGL\SGManPower\ManPowerPlanEdit.aspx.designer.cs">
|
||||
<DependentUpon>ManPowerPlanEdit.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="JDGL\SGManPower\ManPowerPlanGrid.aspx.cs">
|
||||
<DependentUpon>ManPowerPlanGrid.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="JDGL\SGManPower\ManPowerPlanGrid.aspx.designer.cs">
|
||||
<DependentUpon>ManPowerPlanGrid.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="JDGL\SGManPower\ManPowerPlanIn.aspx.cs">
|
||||
<DependentUpon>ManPowerPlanIn.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="JDGL\SGManPower\ManPowerPlanIn.aspx.designer.cs">
|
||||
<DependentUpon>ManPowerPlanIn.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="JDGL\SGManPower\ManPowerStat.aspx.cs">
|
||||
<DependentUpon>ManPowerStat.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="JDGL\SGManPower\ManPowerStat.aspx.designer.cs">
|
||||
<DependentUpon>ManPowerStat.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="JDGL\SGManPower\ManPowerWork.aspx.cs">
|
||||
<DependentUpon>ManPowerWork.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="JDGL\SGManPower\ManPowerWork.aspx.designer.cs">
|
||||
<DependentUpon>ManPowerWork.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="JDGL\SGManPower\ManPowerWorkChart.aspx.cs">
|
||||
<DependentUpon>ManPowerWorkChart.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="JDGL\SGManPower\ManPowerWorkChart.aspx.designer.cs">
|
||||
<DependentUpon>ManPowerWorkChart.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="JDGL\SGManPower\ManPowerWorkGrid.aspx.cs">
|
||||
<DependentUpon>ManPowerWorkGrid.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="JDGL\SGManPower\ManPowerWorkGrid.aspx.designer.cs">
|
||||
<DependentUpon>ManPowerWorkGrid.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="JDGL\WBSCompleteAndReal\WBSCompleteAudit.aspx.cs">
|
||||
<DependentUpon>WBSCompleteAudit.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManPowerPlan.aspx.cs" Inherits="FineUIPro.Web.JDGL.SGManPower.ManPowerPlan" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title>施工人力计划</title>
|
||||
<link href="../res/css/common.css" rel="stylesheet" type="text/css" />
|
||||
</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" EnableAjax="false" ShowHeader="false" Title="施工人力计划" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true" ForceFit="true"
|
||||
ClicksToEdit="1" DataIDField="Id" AllowSorting="true"
|
||||
SortDirection="ASC" EnableColumnLines="true"
|
||||
AllowPaging="true" IsDatabasePaging="true" PageSize="1000"
|
||||
AllowFilters="true" EnableTextSelection="True">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar1" Position="Top" runat="server" ToolbarAlign="Left">
|
||||
<Items>
|
||||
<f:DatePicker runat="server" ID="txtMonths" DateFormatString="yyyy-MM" AutoPostBack="true" DisplayType="Month"
|
||||
Label="月份" LabelWidth="50px" Width="150px" OnTextChanged="txtMonths_TextChanged">
|
||||
</f:DatePicker>
|
||||
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存" Hidden="true"
|
||||
OnClick="btnSave_Click">
|
||||
</f:Button>
|
||||
<f:ToolbarFill runat="server"></f:ToolbarFill>
|
||||
<f:Button ID="BtnAnalyse" ToolTip="统计" Icon="ChartPie" runat="server" OnClick="BtnAnalyse_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnNew" ToolTip="新增" Icon="Add" OnClick="btnNew_Click" runat="server"
|
||||
Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Icon="PackageIn" runat="server"
|
||||
OnClick="btnImport_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" Text="" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Columns>
|
||||
<f:TemplateField ColumnID="tfPageIndex" Width="55px" HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center"
|
||||
EnableLock="true" Locked="False">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblPageIndex" runat="server" Text='<%# Grid1.PageIndex * Grid1.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
<f:RenderField Width="150px" ColumnID="UnitName" DataField="UnitName"
|
||||
SortField="UnitName" FieldType="String" HeaderText="单位" TextAlign="center"
|
||||
HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
|
||||
<f:RenderField Width="150px" ColumnID="UnitWorkName" DataField="UnitWorkName"
|
||||
SortField="UnitWorkName" FieldType="String" HeaderText="装置" TextAlign="Center"
|
||||
HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="150px" ColumnID="WorkPostName" DataField="WorkPostName"
|
||||
SortField="WorkPostName" FieldType="String" HeaderText="岗位" TextAlign="Center"
|
||||
HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
|
||||
<f:RenderField Width="150px" ColumnID="Version" DataField="Version"
|
||||
SortField="Version" FieldType="String" HeaderText="版本" TextAlign="Center"
|
||||
HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="150px" ColumnID="Quantity" DataField="Quantity"
|
||||
SortField="Quantity" FieldType="String" HeaderText="人数" TextAlign="Center"
|
||||
HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
|
||||
<f:RenderField Width="120px" ColumnID="PlanDate" DataField="PlanDate" SortField="PlanDate"
|
||||
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderText="计划时间" TextAlign="Center" HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
|
||||
<f:RenderField Width="95px" ColumnID="CompileMan" DataField="CompileMan"
|
||||
SortField="CompileMan" FieldType="String" HeaderText="编制人" TextAlign="Center"
|
||||
HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
|
||||
<f:RenderField Width="120px" ColumnID="CompileTime" DataField="CompileTime" SortField="CompileTime"
|
||||
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderText="编制时间" TextAlign="Center" HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
|
||||
<f:RenderField Width="100px" ColumnID="Remarks" DataField="Remarks"
|
||||
SortField="Remarks" FieldType="String" HeaderText="备注" TextAlign="Center"
|
||||
HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
</Columns>
|
||||
<Listeners>
|
||||
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
|
||||
</Listeners>
|
||||
</f:Grid>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
<f:Window ID="Window1" Title="施工人力计划" Hidden="true" EnableIFrame="true" EnableMaximize="true"
|
||||
Target="Parent" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="false"
|
||||
CloseAction="HidePostBack" Width="1200px" Height="700px">
|
||||
</f:Window>
|
||||
<f:Menu ID="Menu1" runat="server">
|
||||
<Items>
|
||||
<f:MenuButton ID="btnMenuModify" EnablePostBack="true" runat="server" Hidden="true" Icon="Pencil" Text="修改"
|
||||
OnClick="btnMenuModify_Click">
|
||||
</f:MenuButton>
|
||||
<f:MenuButton ID="btnMenuDel" EnablePostBack="true" runat="server" Hidden="true" Icon="Delete" Text="删除" ConfirmText="确定删除当前数据?"
|
||||
OnClick="btnMenuDel_Click">
|
||||
</f:MenuButton>
|
||||
</Items>
|
||||
</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;
|
||||
}
|
||||
</script>
|
||||
</body>--%>
|
||||
|
||||
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel3" runat="server" />
|
||||
<f:Panel ID="Panel3" Margin="24px" runat="server" ShowBorder="false" ShowHeader="false" Layout="Region">
|
||||
<Items>
|
||||
<f:Panel runat="server" ID="panelCenterRegion" RegionPosition="Center" Layout="Fit" IFrameUrl="" EnableIFrame="True"
|
||||
Title="中间面板" ShowBorder="False" ShowHeader="false" BodyPadding="10px" IconFont="_RoundPlus">
|
||||
|
||||
</f:Panel>
|
||||
</Items>
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Right">
|
||||
<Items>
|
||||
<f:DropDownList ID="drpUnit" runat="server" Label="单位" AutoPostBack="true" AutoSelectFirstItem="True" LabelAlign="Right" EnableAjax="True"
|
||||
LabelWidth="140px" OnSelectedIndexChanged="DropMainContractCode_SelectedIndexChanged">
|
||||
</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:Button ID="btnSubmit" runat="server" Icon="SystemSearch" Text="确定"
|
||||
OnClick="DropMainContractCode_SelectedIndexChanged">
|
||||
</f:Button>
|
||||
<f:ToolbarFill runat="server" />
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
|
||||
</f:Panel>
|
||||
</form>
|
||||
</body>
|
||||
|
||||
|
||||
</html>
|
|
@ -0,0 +1,346 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using BLL;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
|
||||
namespace FineUIPro.Web.JDGL.SGManPower
|
||||
{
|
||||
public partial class ManPowerPlan : PageBase
|
||||
{
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
BLL.UnitService.GetUnit(this.drpUnit, this.CurrUser.LoginProjectId, 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));
|
||||
DropMainContractCode_SelectedIndexChanged(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void DropMainContractCode_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(drpUnit.SelectedValue))
|
||||
{
|
||||
panelCenterRegion.IFrameUrl = "./ManPowerPlanGrid.aspx?UnitId=" + drpUnit.SelectedValue +
|
||||
"&StartTime=" + this.txtStartTime.Text + "&EndTime=" +
|
||||
this.txtEndTime.Text;
|
||||
}
|
||||
}
|
||||
|
||||
/*protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
GetButtonPower();
|
||||
this.txtMonths.Text = string.Format("{0:yyyy-MM}", DateTime.Now);
|
||||
BindGrid();
|
||||
}
|
||||
}
|
||||
|
||||
#region 新增
|
||||
/// <summary>
|
||||
/// 新增
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ManPowerPlanEdit.aspx"), "新增 - 施工人力计划"));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取按钮权限
|
||||
/// <summary>
|
||||
/// 获取按钮权限
|
||||
/// </summary>
|
||||
/// <param name="button"></param>
|
||||
/// <returns></returns>
|
||||
private void GetButtonPower()
|
||||
{
|
||||
if (Request.Params["value"] == BLL.Const._Null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.SGManPowerMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnSave))
|
||||
{
|
||||
this.btnNew.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnModify))
|
||||
{
|
||||
this.btnMenuModify.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnDelete))
|
||||
{
|
||||
this.btnMenuDel.Hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void btnMenuModify_Click(object sender, EventArgs e)
|
||||
{
|
||||
EditData();
|
||||
}
|
||||
/// <summary>
|
||||
/// 编辑数据方法
|
||||
/// </summary>
|
||||
private void EditData()
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ManPowerPlanEdit.aspx?Id={0}", Grid1.SelectedRowID), "编辑 - 月度计划"));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 加载Grid
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
DataTable tb = BindData();
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private DataTable BindData()
|
||||
{
|
||||
string strSql = @"
|
||||
select mp.Id,mp.ProjectId,u.UnitName,uw.UnitWorkName,wp.WorkPostName,mp.Version,mp.Quantity,mp.PlanDate,su.UserName as CompileMan,mp.CompileTime,mp.Remarks from JDGL_SGManPower mp
|
||||
left join Base_Unit u on u.UnitId = mp.UnitId
|
||||
left join WBS_UnitWork uw on uw.UnitWorkId = mp.UnitWorkId
|
||||
left join Base_WorkPost wp on wp.WorkPostId = mp.WorkPostId
|
||||
left join Sys_User su on su.UserId = mp.CompileMan
|
||||
where mp.ProjectId=@ProjectId order by mp.CompileTime";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
return tb;
|
||||
}
|
||||
#region 月份选择事件
|
||||
/// <summary>
|
||||
/// 月份选择事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void txtMonths_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存按钮
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.Grid1.Rows.Count > 0)
|
||||
{
|
||||
JArray mergedData = Grid1.GetMergedData();
|
||||
foreach (JObject mergedRow in mergedData)
|
||||
{
|
||||
JObject values = mergedRow.Value<JObject>("values");
|
||||
int i = mergedRow.Value<int>("index");
|
||||
Model.JDGL_MonthPlan MonthPlan = BLL.MonthPlanService.GetMonthPlanById(this.Grid1.Rows[i].RowID);
|
||||
if (MonthPlan != null)
|
||||
{
|
||||
MonthPlan.CompileMan = this.CurrUser.UserId;
|
||||
MonthPlan.CompileDate = DateTime.Now;
|
||||
BLL.MonthPlanService.UpdateMonthPlan(MonthPlan);
|
||||
}
|
||||
}
|
||||
Alert.ShowInTop("保存成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void btnMenuDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length > 0)
|
||||
{
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
BLL.ManPowerPlanService.DeleteSGManPowerById(rowID);
|
||||
}
|
||||
BindGrid();
|
||||
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
}
|
||||
|
||||
#region 导入
|
||||
/// <summary>
|
||||
/// 导入按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ManPowerPlanIn.aspx?ProjectId={0}", this.CurrUser.LoginProjectId), "导入 - 施工人力计划"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关闭导入弹出窗口
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 统计
|
||||
/// <summary>
|
||||
/// 统计分析
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void BtnAnalyse_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("MonthPlanStatisc.aspx"), "统计 - 月度计划"));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.Rows.Count == 0)
|
||||
{
|
||||
ShowNotify("无数据可导出!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = string.Empty;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
string filePath = string.Empty;
|
||||
initTemplatePath = Const.MonthPlanOutTemplateUrl;
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
newUrl = uploadfilepath.Replace(".xlsx", "(" + this.txtMonths.Text.Trim() + ").xlsx");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
NPOI.SS.UserModel.IWorkbook workbook;
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(stream);
|
||||
}
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
DataTable tb = BindData();
|
||||
// 创建单元格样式
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
|
||||
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
cellStyle.WrapText = true;
|
||||
var font = workbook.CreateFont();
|
||||
font.FontHeightInPoints = 10;
|
||||
//font.FontHeightInPoints = (short)8.5;字号为小数时要转为short
|
||||
cellStyle.SetFont(font);
|
||||
// 第二步:创建新数据行
|
||||
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
||||
NPOI.SS.UserModel.IRow row = null;
|
||||
NPOI.SS.UserModel.ICell cell;
|
||||
int i = 1;
|
||||
for (int j = 0; j < tb.Rows.Count; j++)
|
||||
{
|
||||
// 第二步:创建新数据行
|
||||
row = sheet.CreateRow(i);
|
||||
// 添加数据
|
||||
cell = row.CreateCell(0);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(i.ToString());
|
||||
cell = row.CreateCell(1);
|
||||
cell.CellStyle = cellStyle;
|
||||
//string unitName = string.Empty;
|
||||
//var unit = units.FirstOrDefault(x => x.UnitId == item.UnitId);
|
||||
//if (unit != null)
|
||||
//{
|
||||
// unitName = unit.UnitName;
|
||||
//}
|
||||
cell.SetCellValue(tb.Rows[j]["UnitName"].ToString());
|
||||
cell = row.CreateCell(2);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(tb.Rows[j]["NodeContent"].ToString());
|
||||
cell = row.CreateCell(3);
|
||||
cell.CellStyle = cellStyle;
|
||||
string planDate = string.Empty;
|
||||
if (tb.Rows[j]["PlanDate"] != DBNull.Value)
|
||||
{
|
||||
planDate = string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(tb.Rows[j]["PlanDate"].ToString()));
|
||||
}
|
||||
cell.SetCellValue(planDate);
|
||||
cell = row.CreateCell(4);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(tb.Rows[j]["DutyPersonName"].ToString());
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
string realDate = string.Empty;
|
||||
if (tb.Rows[j]["RealDate"] != DBNull.Value)
|
||||
{
|
||||
realDate = string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(tb.Rows[j]["RealDate"].ToString()));
|
||||
}
|
||||
cell.SetCellValue(realDate);
|
||||
cell = row.CreateCell(6);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(tb.Rows[j]["IsOKStr"].ToString());
|
||||
cell = row.CreateCell(7);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(tb.Rows[j]["Remark"].ToString());
|
||||
i++;
|
||||
}
|
||||
// 第三步:写入文件流
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
workbook.Write(stream);
|
||||
workbook.Close();
|
||||
}
|
||||
string fileName = Path.GetFileName(newUrl);
|
||||
FileInfo info = new FileInfo(newUrl);
|
||||
long fileSize = info.Length;
|
||||
Response.Clear();
|
||||
Response.ContentType = "application/x-zip-compressed";
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
Response.TransmitFile(newUrl, 0, fileSize);
|
||||
Response.Flush();
|
||||
Response.Close();
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
#endregion*/
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.JDGL.SGManPower
|
||||
{
|
||||
|
||||
|
||||
public partial class ManPowerPlan
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// Panel3 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel3;
|
||||
|
||||
/// <summary>
|
||||
/// panelCenterRegion 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel panelCenterRegion;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar2;
|
||||
|
||||
/// <summary>
|
||||
/// drpUnit 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpUnit;
|
||||
|
||||
/// <summary>
|
||||
/// txtStartTime 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DatePicker txtStartTime;
|
||||
|
||||
/// <summary>
|
||||
/// txtEndTime 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DatePicker txtEndTime;
|
||||
|
||||
/// <summary>
|
||||
/// btnSubmit 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSubmit;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManPowerPlanChart.aspx.cs" Inherits="FineUIPro.Web.JDGL.SGManPower.ManPowerPlanChart" %>
|
||||
<%@ Register Src="~/Controls/ChartControl.ascx" TagName="ChartControl" TagPrefix="uc1" %>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>人力计划图表</title>
|
||||
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" runat="server" />
|
||||
<f:Panel ID="Panel1" runat="server" ShowBorder="false" ShowHeader="false"
|
||||
Layout="Region" Margin="5px">
|
||||
<Items>
|
||||
<f:Panel ID="panelCenterRegion" runat="server" RegionPosition="Center"
|
||||
ShowBorder="false" ShowHeader="false" Layout="Fit">
|
||||
<Items>
|
||||
<f:ContentPanel ID="ContentPanel1" runat="server" ShowBorder="false" ShowHeader="false">
|
||||
<div style="text-align: center; padding: 20px;">
|
||||
<uc1:ChartControl ID="Chart1" runat="server"
|
||||
ChartType="Column"
|
||||
Title="人力需求计划"
|
||||
YAxisTitle="人员数量"
|
||||
XAxisTitle="日期" />
|
||||
</div>
|
||||
</f:ContentPanel>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,191 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BLL;
|
||||
using System.Data;
|
||||
|
||||
|
||||
namespace FineUIPro.Web.JDGL.SGManPower
|
||||
{
|
||||
public partial class ManPowerPlanChart : PageBase
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
UnitId = Request.Params["UnitId"];
|
||||
StartTime = Request.Params["StartTime"];
|
||||
EndTime = Request.Params["EndTime"];
|
||||
UnitWorkId = Request.Params["UnitWorkId"];
|
||||
WorkPostId = Request.Params["WorkPostId"];
|
||||
Version = Request.Params["Version"];
|
||||
// 初始化图表数据
|
||||
InitializeChartData();
|
||||
}
|
||||
}
|
||||
|
||||
public string UnitId
|
||||
{
|
||||
get => (string)ViewState["UnitId"];
|
||||
set => ViewState["UnitId"] = value;
|
||||
}
|
||||
|
||||
public string StartTime
|
||||
{
|
||||
get => (string)ViewState["StartTime"];
|
||||
set => ViewState["StartTime"] = value;
|
||||
}
|
||||
|
||||
public string EndTime
|
||||
{
|
||||
get => (string)ViewState["EndTime"];
|
||||
set => ViewState["EndTime"] = 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 Version
|
||||
{
|
||||
get => (string)ViewState["Version"];
|
||||
set => ViewState["Version"] = value;
|
||||
}
|
||||
|
||||
private void InitializeChartData()
|
||||
{
|
||||
// 检查必要参数
|
||||
if (string.IsNullOrEmpty(StartTime) || string.IsNullOrEmpty(EndTime))
|
||||
{
|
||||
ShowNotify("缺少必要的参数,无法生成图表", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DateTime startDate = Convert.ToDateTime(StartTime);
|
||||
DateTime endDate = Convert.ToDateTime(EndTime);
|
||||
|
||||
// 获取人力计划数据
|
||||
var manpowerQuery = from x in Funs.DB.JDGL_SGManPower
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.PlanDate >= startDate && x.PlanDate <= endDate
|
||||
select x;
|
||||
|
||||
if (UnitId != Const._Null)
|
||||
{
|
||||
manpowerQuery = manpowerQuery.Where(x => x.UnitId == UnitId);
|
||||
}
|
||||
|
||||
// 添加装置筛选条件
|
||||
if (!string.IsNullOrEmpty(UnitWorkId))
|
||||
{
|
||||
manpowerQuery = manpowerQuery.Where(x => x.UnitWorkId == UnitWorkId);
|
||||
}
|
||||
|
||||
// 添加岗位筛选条件
|
||||
if (!string.IsNullOrEmpty(WorkPostId))
|
||||
{
|
||||
manpowerQuery = manpowerQuery.Where(x => x.WorkPostId == WorkPostId);
|
||||
}
|
||||
|
||||
// 添加版本筛选条件
|
||||
if (!string.IsNullOrEmpty(Version))
|
||||
{
|
||||
manpowerQuery = manpowerQuery.Where(x => x.Version == Version);
|
||||
}
|
||||
|
||||
var manpowerPlans = manpowerQuery.ToList();
|
||||
|
||||
// 按日期汇总人数
|
||||
var chartData = manpowerPlans
|
||||
.Where(x => x.PlanDate.HasValue && x.Quantity.HasValue)
|
||||
.GroupBy(x => x.PlanDate.Value.Date)
|
||||
.Select(g => new
|
||||
{
|
||||
Date = g.Key,
|
||||
TotalQuantity = g.Sum(x => x.Quantity.Value)
|
||||
})
|
||||
.OrderBy(x => x.Date)
|
||||
.ToList();
|
||||
|
||||
// 如果没有数据,显示提示信息
|
||||
if (chartData.Count == 0)
|
||||
{
|
||||
ShowNotify("在指定时间范围内没有找到人力计划数据", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
// 构建图表数据源
|
||||
DataTable dt = new DataTable();
|
||||
dt.Columns.Add("日期", typeof(string));
|
||||
dt.Columns.Add("人员数量", typeof(int));
|
||||
|
||||
foreach (var item in chartData)
|
||||
{
|
||||
DataRow row = dt.NewRow();
|
||||
row["日期"] = item.Date.ToString("MM-dd");
|
||||
row["人员数量"] = item.TotalQuantity;
|
||||
dt.Rows.Add(row);
|
||||
}
|
||||
|
||||
// 创建图表数据对象
|
||||
Model.DataSourceChart dataSourceChart = new Model.DataSourceChart
|
||||
{
|
||||
Title = "总人力需求计划",
|
||||
ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Column,
|
||||
Width = 1000,
|
||||
Height = 500,
|
||||
IsNotEnable3D = false
|
||||
};
|
||||
|
||||
// 创建数据系列
|
||||
Model.DataSourceTeam dataSourceTeam = new Model.DataSourceTeam
|
||||
{
|
||||
DataPointName = "人员数量",
|
||||
DataSourcePoints = new List<Model.DataSourcePoint>() // 确保初始化
|
||||
};
|
||||
|
||||
// 添加数据点
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
Model.DataSourcePoint point = new Model.DataSourcePoint
|
||||
{
|
||||
PointText = row["日期"].ToString(),
|
||||
PointValue = row["人员数量"].ToString()
|
||||
};
|
||||
// 确保DataSourcePoints不为空后再添加
|
||||
if (dataSourceTeam.DataSourcePoints != null)
|
||||
{
|
||||
dataSourceTeam.DataSourcePoints.Add(point);
|
||||
}
|
||||
}
|
||||
|
||||
// 确保DataSourceTeams不为空后再添加
|
||||
if (dataSourceChart.DataSourceTeams != null)
|
||||
{
|
||||
dataSourceChart.DataSourceTeams.Add(dataSourceTeam);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果DataSourceTeams为空,创建一个新的列表
|
||||
dataSourceChart.DataSourceTeams = new List<Model.DataSourceTeam> { dataSourceTeam };
|
||||
}
|
||||
|
||||
// 生成图表
|
||||
Chart1.CreateChart(dataSourceChart);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowNotify($"生成图表时发生错误: {ex.Message}", MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.JDGL.SGManPower
|
||||
{
|
||||
|
||||
|
||||
public partial class ManPowerPlanChart
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// Panel1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel1;
|
||||
|
||||
/// <summary>
|
||||
/// panelCenterRegion 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel panelCenterRegion;
|
||||
|
||||
/// <summary>
|
||||
/// ContentPanel1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ContentPanel ContentPanel1;
|
||||
|
||||
/// <summary>
|
||||
/// Chart1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::Web.Controls.ChartControl Chart1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManPowerPlanEdit.aspx.cs" Inherits="FineUIPro.Web.JDGL.SGManPower.ManPowerPlanEdit" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" runat="server" AutoSizePanelID="SimpleForm1" />
|
||||
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false"
|
||||
AutoScroll="true" BodyPadding="10px" runat="server" RedStarPosition="BeforeText"
|
||||
LabelAlign="Right">
|
||||
<Rows>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:DropDownList ID="drpUnit" runat="server" Label="单位" LabelWidth="150px" AutoSelectFirstItem="false" >
|
||||
</f:DropDownList>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:DropDownList ID="drpUnitWork" runat="server" Label="装置" LabelWidth="150px" AutoSelectFirstItem="false">
|
||||
</f:DropDownList>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:DropDownList ID="drpWorkPost" runat="server" Label="岗位" LabelWidth="150px" AutoSelectFirstItem="false">
|
||||
</f:DropDownList>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextBox ID="txtVersion" runat="server" Label="版本" LabelAlign="Right" LabelWidth="150px" ></f:TextBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:NumberBox ID="txtQuantity" runat="server" Label="人数" LabelAlign="Right" LabelWidth="150px" ></f:NumberBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:DatePicker ID="txtPlanDate" runat="server" Label="时间" LabelAlign="Right" LabelWidth="150px" >
|
||||
</f:DatePicker>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextArea ID="txtRemarks" runat="server" Label="备注" LabelAlign="Right" LabelWidth="150px"></f:TextArea>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
||||
</Rows>
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
|
||||
<Items>
|
||||
<f:ToolbarFill ID="ToolbarFill1" runat="server">
|
||||
</f:ToolbarFill>
|
||||
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存" ValidateForms="SimpleForm1" Text="保存"
|
||||
OnClick="btnSave_Click">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
</f:Form>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,130 @@
|
|||
using BLL;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.JDGL.SGManPower
|
||||
{
|
||||
public partial class ManPowerPlanEdit : PageBase
|
||||
{
|
||||
#region 定义项
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
private string Id
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["Id"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["Id"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 项目主键
|
||||
/// </summary>
|
||||
public string ProjectId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["ProjectId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["ProjectId"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.Id = Request.Params["Id"];
|
||||
this.ProjectId = this.CurrUser.LoginProjectId;
|
||||
BLL.UnitService.GetUnit(this.drpUnit, ProjectId, false);//单位
|
||||
UnitWorkService.InitUnitWorkDownList(drpUnitWork, ProjectId, false);//单位工程(装置)
|
||||
WorkPostService.InitWorkPostDropDownList(this.drpWorkPost, false);//岗位
|
||||
if (!string.IsNullOrEmpty(Id))
|
||||
{
|
||||
var model = Funs.DB.JDGL_SGManPower.FirstOrDefault(x => x.Id == Id);
|
||||
if (model != null)
|
||||
{
|
||||
drpUnit.SelectedValue = model.UnitId;
|
||||
drpUnitWork.SelectedValue = model.UnitWorkId;
|
||||
drpWorkPost.SelectedValue = model.WorkPostId;
|
||||
txtVersion.Text = model.Version;
|
||||
txtQuantity.Text = model.Quantity.HasValue ? model.Quantity.Value.ToString() : "";
|
||||
if (model.PlanDate != null)
|
||||
{
|
||||
this.txtPlanDate.Text = Convert.ToDateTime(model.PlanDate).ToString("yyyy-MM-dd");
|
||||
}
|
||||
txtRemarks.Text = model.Remarks;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
var model = new Model.JDGL_SGManPower
|
||||
{
|
||||
CompileMan = this.CurrUser.UserId,
|
||||
CompileTime = DateTime.Now,
|
||||
Remarks = this.txtRemarks.Text,
|
||||
};
|
||||
if (this.drpUnit.SelectedValue != Const._Null)
|
||||
{
|
||||
model.UnitId = drpUnit.SelectedValue;
|
||||
}
|
||||
if (this.drpUnitWork.SelectedValue != Const._Null)
|
||||
{
|
||||
model.UnitWorkId = drpUnitWork.SelectedValue;
|
||||
}
|
||||
if (this.drpWorkPost.SelectedValue != Const._Null)
|
||||
{
|
||||
model.WorkPostId = drpWorkPost.SelectedValue;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtVersion.Text))
|
||||
{
|
||||
model.Version = this.txtVersion.Text;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtQuantity.Text))
|
||||
{
|
||||
model.Quantity = int.Parse(this.txtQuantity.Text);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtPlanDate.Text))
|
||||
{
|
||||
model.PlanDate = Funs.GetNewDateTime(this.txtPlanDate.Text);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Id))
|
||||
{
|
||||
model.Id = Id;
|
||||
BLL.ManPowerPlanService.UpdateSGManPower(model);
|
||||
}
|
||||
else
|
||||
{
|
||||
model.Id = SQLHelper.GetNewID(typeof(Model.JDGL_MonthPlan));
|
||||
model.ProjectId = this.ProjectId;
|
||||
BLL.ManPowerPlanService.AddSGManPower(model);
|
||||
}
|
||||
Funs.DB.SubmitChanges();
|
||||
ShowNotify("保存成功", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.JDGL.SGManPower
|
||||
{
|
||||
|
||||
|
||||
public partial class ManPowerPlanEdit
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// SimpleForm1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Form SimpleForm1;
|
||||
|
||||
/// <summary>
|
||||
/// drpUnit 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpUnit;
|
||||
|
||||
/// <summary>
|
||||
/// drpUnitWork 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpUnitWork;
|
||||
|
||||
/// <summary>
|
||||
/// drpWorkPost 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpWorkPost;
|
||||
|
||||
/// <summary>
|
||||
/// txtVersion 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtVersion;
|
||||
|
||||
/// <summary>
|
||||
/// txtQuantity 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox txtQuantity;
|
||||
|
||||
/// <summary>
|
||||
/// txtPlanDate 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DatePicker txtPlanDate;
|
||||
|
||||
/// <summary>
|
||||
/// txtRemarks 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextArea txtRemarks;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarFill1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarFill ToolbarFill1;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManPowerPlanGrid.aspx.cs" Inherits="FineUIPro.Web.JDGL.SGManPower.ManPowerPlanGrid" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>施工人力计划</title>
|
||||
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
|
||||
<style type="text/css">
|
||||
|
||||
.f-grid-row .f-grid-cell-inner {
|
||||
white-space: normal;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.f-grid-row.yellow {
|
||||
background-color: YellowGreen;
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
.f-grid-row.red {
|
||||
background-color: Yellow;
|
||||
}
|
||||
.f-grid-cell[data-color=color1] {
|
||||
background-color: Yellow;
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel3" runat="server" />
|
||||
<f:Panel ID="Panel3" Margin="24px" runat="server" ShowBorder="false" ShowHeader="false" Layout="Region">
|
||||
<Items>
|
||||
<f:Panel runat="server" ID="panelCenterRegion" RegionPosition="Center" Layout="Fit"
|
||||
Title="中间面板" ShowBorder="True" ShowHeader="false" BodyPadding="10px" IconFont="_RoundPlus">
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="合同执行跟踪表" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true"
|
||||
ClicksToEdit="1" DataIDField="Id" AllowSorting="true" SortField="Id"
|
||||
SortDirection="DESC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowColumnLocking="true" EnableSummary="true" SummaryPosition="Bottom"
|
||||
AllowPaging="True" IsDatabasePaging="true" PageSize="50" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
EnableRowDoubleClickEvent="true" EnableRowClickEvent="True" EnableAfterEditEvent="true" OnAfterEdit="Grid1_AfterEdit" >
|
||||
<Toolbars>
|
||||
|
||||
<f:Toolbar ID="Toolbar4" Position="Top" runat="server" ToolbarAlign="Right">
|
||||
<Items>
|
||||
<f:DropDownList runat="server" ID="drpUnitWork" Label="装置"></f:DropDownList>
|
||||
<f:DropDownList runat="server" ID="drpWorkPost" Label="岗位"></f:DropDownList>
|
||||
<f:DropDownList runat="server" ID="drpVersion" AutoSelectFirstItem="True" Label="版本"></f:DropDownList>
|
||||
<f:ToolbarFill runat="server" />
|
||||
<f:Button ID="btnQuery" ToolTip="查询" Text="查询" Icon="SystemSearch" runat="server" EnablePostBack="true"
|
||||
OnClick="btnQuery_OnClick">
|
||||
</f:Button>
|
||||
<f:Button ID="btnNew" ToolTip="新增" Text="新增" Icon="Add" OnClick="btnNew_Click" runat="server"
|
||||
Hidden="true" EnablePostBack="true">
|
||||
</f:Button>
|
||||
<%-- <f:Button ID="btnSave" ToolTip="保存" Icon="PageSave" EnablePostBack="true" Text="保存" runat="server" OnClick="btnSave_OnClick"> --%>
|
||||
<%-- </f:Button> --%>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Text="导入" Icon="PackageIn" runat="server"
|
||||
OnClick="btnImport_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" Text="导出" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
<f:Button ID="btnGetChart" ToolTip="图表" Icon="ChartPie" Text="统计图表"
|
||||
EnablePostBack="true" OnClick="btnGetChart_Click" runat="server">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<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>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
<f:Window ID="Window1" runat="server" Hidden="true" ShowHeader="true"
|
||||
IsModal="true" Target="Parent" EnableMaximize="true" EnableResize="true"
|
||||
Title="编辑施工人力计划" EnableIFrame="true" Height="650px" OnClose="Window1_Close"
|
||||
Width="1200px">
|
||||
</f:Window>
|
||||
<f:Window ID="Window2" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
|
||||
Target="Top" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true"
|
||||
Width="1200px" Height="650px">
|
||||
</f:Window>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
|
||||
function reloadGrid() {
|
||||
__doPostBack(null, 'reloadGrid');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,188 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.JDGL.SGManPower
|
||||
{
|
||||
|
||||
|
||||
public partial class ManPowerPlanGrid
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// Panel3 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel3;
|
||||
|
||||
/// <summary>
|
||||
/// panelCenterRegion 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel panelCenterRegion;
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar4 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar4;
|
||||
|
||||
/// <summary>
|
||||
/// drpUnitWork 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpUnitWork;
|
||||
|
||||
/// <summary>
|
||||
/// drpWorkPost 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpWorkPost;
|
||||
|
||||
/// <summary>
|
||||
/// drpVersion 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpVersion;
|
||||
|
||||
/// <summary>
|
||||
/// btnQuery 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnQuery;
|
||||
|
||||
/// <summary>
|
||||
/// btnNew 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnNew;
|
||||
|
||||
/// <summary>
|
||||
/// btnImport 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// btnGetChart 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnGetChart;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarSeparator1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarText1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarText ToolbarText1;
|
||||
|
||||
/// <summary>
|
||||
/// ddlPageSize 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList ddlPageSize;
|
||||
|
||||
/// <summary>
|
||||
/// Window1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window1;
|
||||
|
||||
/// <summary>
|
||||
/// Window2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManPowerPlanIn.aspx.cs" Inherits="FineUIPro.Web.JDGL.SGManPower.ManPowerPlanIn" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title>导入信息</title>
|
||||
<link href="~/res/css/common.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" OnCustomEvent="PageManager1_CustomEvent"/>
|
||||
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
|
||||
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
|
||||
<Items>
|
||||
<f:ToolbarFill runat="server"></f:ToolbarFill>
|
||||
<f:Button ID="btnAudit" Icon="ApplicationEdit" runat="server" ToolTip="审核" Text="审核" ValidateForms="SimpleForm1"
|
||||
OnClick="btnAudit_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" Icon="ApplicationGet" runat="server" ToolTip="导入" Text="导入并保存" ValidateForms="SimpleForm1"
|
||||
OnClick="btnImport_Click">
|
||||
</f:Button>
|
||||
<%-- <f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存" ValidateForms="SimpleForm1" --%>
|
||||
<%-- OnClick="btnSave_Click"> --%>
|
||||
<%-- </f:Button> --%>
|
||||
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" ToolTip="下载模板" OnClick="btnDownLoad_Click">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Rows>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:FileUpload runat="server" ID="fuAttachUrl" EmptyText="选择要导入的文件" Label="选择要导入的文件"
|
||||
LabelWidth="150px">
|
||||
</f:FileUpload>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:Grid ID="gvErrorInfo" ShowBorder="true" EnableAjax="false" ShowHeader="false" Title="督查巡检表" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" AllowCellEditing="true" ClicksToEdit="2" AllowSorting="true"
|
||||
SortDirection="DESC" EnableColumnLines="true" ForceFit="true" AllowPaging="true" IsDatabasePaging="true" PageSize="10"
|
||||
EnableRowDoubleClickEvent="true" AllowFilters="true" EnableTextSelection="True">
|
||||
<Columns>
|
||||
<f:TemplateField ColumnID="tfPageIndex" Width="40px" HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center"
|
||||
EnableLock="true" Locked="False">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblPageIndex" runat="server" Text='<%# gvErrorInfo.PageIndex * gvErrorInfo.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
<f:BoundField DataField="Row" HeaderText="错误行号" Width="50px">
|
||||
</f:BoundField>
|
||||
<f:BoundField DataField="Column" HeaderText="错误列" Width="100px">
|
||||
</f:BoundField>
|
||||
<f:BoundField DataField="Reason" HeaderText="错误类型" MinWidth="220px">
|
||||
</f:BoundField>
|
||||
</Columns>
|
||||
</f:Grid>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:HiddenField ID="hdFileName" runat="server">
|
||||
</f:HiddenField>
|
||||
<f:HiddenField ID="hdCheckResult" runat="server">
|
||||
</f:HiddenField>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
</Rows>
|
||||
</f:Form>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,640 @@
|
|||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.OleDb;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.JDGL.SGManPower
|
||||
{
|
||||
public partial class ManPowerPlanIn : PageBase
|
||||
{
|
||||
#region 定义变量
|
||||
|
||||
/// <summary>
|
||||
/// 上传预设的虚拟路径
|
||||
/// </summary>
|
||||
private string initPath = Const.ExcelUrl;
|
||||
|
||||
/// <summary>
|
||||
/// 人力计划集合
|
||||
/// </summary>
|
||||
public static List<Model.JDGL_SGManPower> SGManPowers = new List<Model.JDGL_SGManPower>();
|
||||
/// <summary>
|
||||
/// 错误集合
|
||||
/// </summary>
|
||||
public static List<Model.ErrorInfo> errorInfos = new List<Model.ErrorInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// 项目ID
|
||||
/// </summary>
|
||||
public string ProjectId
|
||||
{
|
||||
get { return (string)ViewState["ProjectId"]; }
|
||||
set { ViewState["ProjectId"] = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 加载页面
|
||||
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.hdFileName.Text = string.Empty;
|
||||
if (SGManPowers != null)
|
||||
{
|
||||
SGManPowers.Clear();
|
||||
}
|
||||
|
||||
if (errorInfos != null)
|
||||
{
|
||||
errorInfos.Clear();
|
||||
}
|
||||
this.ProjectId = Request.Params["ProjectId"];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 审核
|
||||
|
||||
/// <summary>
|
||||
/// 审核
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnAudit_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (this.fuAttachUrl.HasFile == false)
|
||||
{
|
||||
ShowNotify("请您选择Excel文件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
string IsXls = Path.GetExtension(this.fuAttachUrl.FileName).ToString().Trim().ToLower();
|
||||
if (IsXls != ".xls")
|
||||
{
|
||||
ShowNotify("只可以选择Excel文件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (SGManPowers != null)
|
||||
{
|
||||
SGManPowers.Clear();
|
||||
}
|
||||
|
||||
if (errorInfos != null)
|
||||
{
|
||||
errorInfos.Clear();
|
||||
}
|
||||
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initFullPath = rootPath + initPath;
|
||||
if (!Directory.Exists(initFullPath))
|
||||
{
|
||||
Directory.CreateDirectory(initFullPath);
|
||||
}
|
||||
|
||||
this.hdFileName.Text = BLL.Funs.GetNewFileName() + IsXls;
|
||||
string filePath = initFullPath + this.hdFileName.Text;
|
||||
this.fuAttachUrl.PostedFile.SaveAs(filePath);
|
||||
ImportXlsToData(rootPath + initPath + this.hdFileName.Text);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowNotify("'" + ex.Message + "'", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
#region 读Excel提取数据
|
||||
|
||||
/// <summary>
|
||||
/// 从Excel提取数据--》Dataset
|
||||
/// </summary>
|
||||
/// <param name="filename">Excel文件路径名</param>
|
||||
private void ImportXlsToData(string fileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
string oleDBConnString = String.Empty;
|
||||
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
|
||||
oleDBConnString += "Data Source=";
|
||||
oleDBConnString += fileName;
|
||||
oleDBConnString += ";Extended Properties=Excel 8.0;";
|
||||
OleDbConnection oleDBConn = null;
|
||||
OleDbDataAdapter oleAdMaster = null;
|
||||
DataTable m_tableName = new DataTable();
|
||||
DataSet ds = new DataSet();
|
||||
|
||||
oleDBConn = new OleDbConnection(oleDBConnString);
|
||||
oleDBConn.Open();
|
||||
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
|
||||
|
||||
if (m_tableName != null && m_tableName.Rows.Count > 0)
|
||||
{
|
||||
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
|
||||
}
|
||||
|
||||
string sqlMaster;
|
||||
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
|
||||
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
|
||||
oleAdMaster.Fill(ds, "m_tableName");
|
||||
oleAdMaster.Dispose();
|
||||
oleDBConn.Close();
|
||||
oleDBConn.Dispose();
|
||||
|
||||
AddDatasetToSQL(ds.Tables[0], 4);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 将Dataset的数据导入数据库
|
||||
|
||||
/// <summary>
|
||||
/// 将Dataset的数据导入数据库
|
||||
/// </summary>
|
||||
/// <param name="pds">数据集</param>
|
||||
/// <param name="Cols">数据集行数</param>
|
||||
/// <returns></returns>
|
||||
private bool AddDatasetToSQL(DataTable pds, int Cols)
|
||||
{
|
||||
string result = string.Empty;
|
||||
int ic, ir;
|
||||
ic = pds.Columns.Count;
|
||||
if (ic < Cols)
|
||||
{
|
||||
Alert.ShowInTop("导入Excel格式错误!Excel只有" + ic.ToString().Trim() + "行", MessageBoxIcon.Warning);
|
||||
}
|
||||
|
||||
ir = pds.Rows.Count;
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var projectUnits = from x in db.Project_ProjectUnit
|
||||
join y in db.Base_Unit on x.UnitId equals y.UnitId
|
||||
where x.ProjectId == this.ProjectId
|
||||
select new { x.UnitId, y.UnitName, x.UnitType };
|
||||
|
||||
var unitWorks = from x in Funs.DB.WBS_UnitWork
|
||||
where x.ProjectId == ProjectId && (x.SuperUnitWork == null || x.SuperUnitWork == "0")
|
||||
select new { x.UnitWorkId, x.UnitWorkName };
|
||||
|
||||
var workPosts = from x in Funs.DB.Base_WorkPost
|
||||
select new { x.WorkPostId, x.WorkPostName, x.PostType };
|
||||
|
||||
if (pds != null && ir > 0)
|
||||
{
|
||||
var UnitType = string.Empty; //1:总包 2:分包
|
||||
var PostType = string.Empty; //1:一般管理岗位 4:特种管理岗位
|
||||
string UnitId = null;
|
||||
string UnitWorkId = null;
|
||||
string WorkPostId = null;
|
||||
for (int i = 0; i < ir; i++)
|
||||
{
|
||||
string col0 = pds.Rows[i][0].ToString().Trim();
|
||||
if (string.IsNullOrEmpty(col0))
|
||||
{
|
||||
result += $"{i + 2}&单位&不能为空!|";
|
||||
}
|
||||
else
|
||||
{
|
||||
var unit = projectUnits.FirstOrDefault(e => e.UnitName == col0);
|
||||
if (unit == null)
|
||||
{
|
||||
result += $"{i + 2}&单位&不在项目单位中!|";
|
||||
}
|
||||
else
|
||||
{
|
||||
UnitType = unit.UnitType;
|
||||
UnitId = unit.UnitId;
|
||||
}
|
||||
}
|
||||
|
||||
string col2 = pds.Rows[i][2].ToString().Trim(); //岗位
|
||||
if (string.IsNullOrEmpty(col2))
|
||||
{
|
||||
result += $"{i + 2}&岗位&不能为空!|";
|
||||
}
|
||||
else
|
||||
{
|
||||
var workPost = workPosts.FirstOrDefault(e => e.WorkPostName == col2);
|
||||
if (workPost == null)
|
||||
{
|
||||
result += $"{i + 2}&岗位&不存在此岗位名称!|";
|
||||
}
|
||||
else
|
||||
{
|
||||
PostType = workPost.PostType;
|
||||
WorkPostId = workPost.WorkPostId;
|
||||
}
|
||||
}
|
||||
|
||||
string col1 = pds.Rows[i][1].ToString().Trim(); //装置
|
||||
if (UnitType == "1" || (UnitType == "2" && (PostType == "1" || PostType == "4")))
|
||||
{
|
||||
//可以不选装置
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(col1))
|
||||
{
|
||||
result += $"{i + 2}&装置&总承包单位不需要区分装置,施工分包单位管理人员不需要区分装置,作业人员需要区分装置!!|";
|
||||
}
|
||||
else
|
||||
{
|
||||
var unitWork = unitWorks.FirstOrDefault(e => e.UnitWorkName == col1);
|
||||
if (unitWork == null)
|
||||
{
|
||||
result += $"{i + 2}&装置&不在项目装置中!|";
|
||||
}else
|
||||
{
|
||||
UnitWorkId = unitWork.UnitWorkId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string col3 = pds.Rows[i][3].ToString().Trim(); //版本
|
||||
if (string.IsNullOrEmpty(col3))
|
||||
{
|
||||
result += $"{i + 2}&版本&不能为空!|";
|
||||
}
|
||||
|
||||
// 遍历日期列
|
||||
for (int col = 4; col < ic; col++)
|
||||
{
|
||||
string dateStr = pds.Columns[col].ColumnName;
|
||||
string quantityStr = pds.Rows[i][col].ToString().Trim();
|
||||
|
||||
if (!string.IsNullOrEmpty(dateStr) && !string.IsNullOrEmpty(quantityStr))
|
||||
{
|
||||
DateTime planDate;
|
||||
if (!DateTime.TryParse(dateStr, out planDate))
|
||||
{
|
||||
result += $"{i + 2}&日期&格式错误!|";
|
||||
continue;
|
||||
}
|
||||
|
||||
int quantity;
|
||||
if (!int.TryParse(quantityStr, out quantity))
|
||||
{
|
||||
result += $"{i + 2}&数量&格式错误!|";
|
||||
continue;
|
||||
}
|
||||
|
||||
// 检查数据是否重复
|
||||
var lists = (from x in Funs.DB.JDGL_SGManPower
|
||||
where x.ProjectId == this.ProjectId && x.UnitId == UnitId &&
|
||||
(UnitWorkId == null ? x.UnitWorkId == null : x.UnitWorkId == UnitWorkId) &&
|
||||
x.WorkPostId == WorkPostId && x.Version == col3 && x.PlanDate.HasValue &&
|
||||
x.PlanDate.Value == planDate
|
||||
select x).ToList();
|
||||
|
||||
if (lists.Count > 0)
|
||||
{
|
||||
result += $"{i + 2}&{dateStr}&数据已存在!|";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(result))
|
||||
{
|
||||
result = result.Substring(0, result.LastIndexOf("|"));
|
||||
}
|
||||
errorInfos.Clear();
|
||||
if (!string.IsNullOrEmpty(result))
|
||||
{
|
||||
string results = result;
|
||||
List<string> errorInfoList = results.Split('|').ToList();
|
||||
foreach (var item in errorInfoList)
|
||||
{
|
||||
string[] errors = item.Split('&');
|
||||
Model.ErrorInfo errorInfo = new Model.ErrorInfo();
|
||||
errorInfo.Row = errors[0];
|
||||
errorInfo.Column = errors[1];
|
||||
errorInfo.Reason = errors[2];
|
||||
errorInfos.Add(errorInfo);
|
||||
}
|
||||
if (errorInfos.Count > 0)
|
||||
{
|
||||
this.gvErrorInfo.DataSource = errorInfos;
|
||||
this.gvErrorInfo.DataBind();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("审核完成,请点击导入!", MessageBoxIcon.Success);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region 导入
|
||||
|
||||
/// <summary>
|
||||
/// 导入
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (errorInfos.Count <= 0)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.hdFileName.Text))
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
ImportXlsToData2(rootPath + initPath + this.hdFileName.Text);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("请先审核要导入的文件!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("请先将错误数据修正,再重新导入保存!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
#region Excel提取数据
|
||||
|
||||
/// <summary>
|
||||
/// 从Excel提取数据--》Dataset
|
||||
/// </summary>
|
||||
/// <param name="filename">Excel文件路径名</param>
|
||||
private void ImportXlsToData2(string fileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
string oleDBConnString = String.Empty;
|
||||
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
|
||||
oleDBConnString += "Data Source=";
|
||||
oleDBConnString += fileName;
|
||||
oleDBConnString += ";Extended Properties=Excel 8.0;";
|
||||
OleDbConnection oleDBConn = null;
|
||||
OleDbDataAdapter oleAdMaster = null;
|
||||
DataTable m_tableName = new DataTable();
|
||||
DataSet ds = new DataSet();
|
||||
|
||||
oleDBConn = new OleDbConnection(oleDBConnString);
|
||||
oleDBConn.Open();
|
||||
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
|
||||
|
||||
if (m_tableName != null && m_tableName.Rows.Count > 0)
|
||||
{
|
||||
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
|
||||
}
|
||||
|
||||
string sqlMaster;
|
||||
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
|
||||
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
|
||||
oleAdMaster.Fill(ds, "m_tableName");
|
||||
oleAdMaster.Dispose();
|
||||
oleDBConn.Close();
|
||||
oleDBConn.Dispose();
|
||||
|
||||
AddDatasetToSQL2(ds.Tables[0], 4);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 将Dataset的数据导入数据库
|
||||
|
||||
/// <summary>
|
||||
/// 将Dataset的数据导入数据库
|
||||
/// </summary>
|
||||
/// <param name="pds">数据集</param>
|
||||
/// <param name="Cols">数据集列数</param>
|
||||
/// <returns></returns>
|
||||
private bool AddDatasetToSQL2(DataTable pds, int Cols)
|
||||
{
|
||||
int ic, ir;
|
||||
SGManPowers.Clear();
|
||||
ic = pds.Columns.Count;
|
||||
if (ic < Cols)
|
||||
{
|
||||
Alert.ShowInTop("导入Excel格式错误!Excel只有" + ic.ToString().Trim() + "列", MessageBoxIcon.Warning);
|
||||
}
|
||||
|
||||
ir = pds.Rows.Count;
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var projectUnits = from x in db.Project_ProjectUnit
|
||||
join y in db.Base_Unit on x.UnitId equals y.UnitId
|
||||
where x.ProjectId == this.ProjectId
|
||||
select new { x.UnitId, y.UnitName };
|
||||
|
||||
var unitWorks = from x in Funs.DB.WBS_UnitWork
|
||||
where x.ProjectId == ProjectId && (x.SuperUnitWork == null || x.SuperUnitWork == "0")
|
||||
select new { x.UnitWorkId, x.UnitWorkName };
|
||||
|
||||
var workPosts = from x in Funs.DB.Base_WorkPost
|
||||
select new { x.WorkPostId, x.WorkPostName };
|
||||
|
||||
|
||||
if (pds != null && ir > 0)
|
||||
{
|
||||
for (int i = 0; i < ir; i++)
|
||||
{
|
||||
string col0 = pds.Rows[i][0].ToString().Trim(); // 单位
|
||||
string col1 = pds.Rows[i][1].ToString().Trim(); // 装置
|
||||
string col2 = pds.Rows[i][2].ToString().Trim(); // 岗位
|
||||
string col3 = pds.Rows[i][3].ToString().Trim(); // 版本
|
||||
|
||||
if (!string.IsNullOrEmpty(col0)) // 单位
|
||||
{
|
||||
var projectUnit = projectUnits.FirstOrDefault(x => x.UnitName == col0);
|
||||
if (projectUnit != null)
|
||||
{
|
||||
// 遍历日期列(从第5列开始)
|
||||
for (int col = 4; col < ic; col++)
|
||||
{
|
||||
string colDate = pds.Columns[col].ColumnName; // 日期列名
|
||||
string colQuantity = pds.Rows[i][col].ToString().Trim(); // 人数
|
||||
|
||||
if (!string.IsNullOrEmpty(colQuantity) && int.TryParse(colQuantity, out int quantity))
|
||||
{
|
||||
// 确保日期列名是有效的日期格式
|
||||
if (DateTime.TryParse(colDate, out DateTime planDate))
|
||||
{
|
||||
Model.JDGL_SGManPower newManPower = new Model.JDGL_SGManPower
|
||||
{
|
||||
UnitId = projectUnit.UnitId,
|
||||
UnitWorkId = string.IsNullOrEmpty(col1)
|
||||
? null
|
||||
: unitWorks.FirstOrDefault(x => x.UnitWorkName == col1)?.UnitWorkId,
|
||||
WorkPostId = workPosts.FirstOrDefault(x => x.WorkPostName == col2)
|
||||
?.WorkPostId,
|
||||
Version = col3,
|
||||
Quantity = quantity,
|
||||
PlanDate = planDate,
|
||||
Id = SQLHelper.GetNewID(typeof(Model.JDGL_SGManPower))
|
||||
};
|
||||
|
||||
SGManPowers.Add(newManPower);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int a = SGManPowers.Count();
|
||||
for (int i = 0; i < a; i++)
|
||||
{
|
||||
Model.JDGL_SGManPower newData = new Model.JDGL_SGManPower();
|
||||
newData.Id = SQLHelper.GetNewID(typeof(Model.JDGL_SGManPower));
|
||||
newData.ProjectId = this.ProjectId;
|
||||
newData.UnitId = SGManPowers[i].UnitId;
|
||||
newData.UnitWorkId = SGManPowers[i].UnitWorkId;
|
||||
newData.WorkPostId = SGManPowers[i].WorkPostId;
|
||||
newData.Version = SGManPowers[i].Version;
|
||||
newData.Quantity = SGManPowers[i].Quantity;
|
||||
newData.PlanDate = SGManPowers[i].PlanDate;
|
||||
newData.CompileMan = this.CurrUser.UserId;
|
||||
newData.CompileTime = DateTime.Now;
|
||||
newData.Remarks = SGManPowers[i].Remarks;
|
||||
BLL.ManPowerPlanService.AddSGManPower(newData);
|
||||
}
|
||||
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initFullPath = rootPath + initPath;
|
||||
string filePath = initFullPath + this.hdFileName.Text;
|
||||
if (filePath != string.Empty && System.IO.File.Exists(filePath))
|
||||
{
|
||||
System.IO.File.Delete(filePath); //删除上传的XLS文件
|
||||
}
|
||||
|
||||
ShowNotify("导入成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 下载模板
|
||||
|
||||
/// <summary>
|
||||
/// 下载模板按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnDownLoad_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Confirm.GetShowReference("确定下载导入模板吗?", String.Empty,
|
||||
MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK"),
|
||||
PageManager1.GetCustomEventReference("Confirm_Cancel")));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下载导入模板
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void PageManager1_CustomEvent(object sender, CustomEventArgs e)
|
||||
{
|
||||
if (e.EventArgument == "Confirm_OK")
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string uploadfilepath = rootPath + Const.SGManPowerTemplateUrl;
|
||||
string filePath = Const.SGManPowerTemplateUrl;
|
||||
string fileName = Path.GetFileName(filePath);
|
||||
FileInfo info = new FileInfo(uploadfilepath);
|
||||
long fileSize = info.Length;
|
||||
Response.ClearContent();
|
||||
Response.AddHeader("Content-Disposition",
|
||||
"attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
Response.ContentType = "excel/plain";
|
||||
Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||||
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
|
||||
Response.TransmitFile(uploadfilepath, 0, fileSize);
|
||||
Response.End();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 根据id获取姓名
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="registrationId"></param>
|
||||
/// <returns></returns>
|
||||
protected string ConvertUnitName(object UnitId)
|
||||
{
|
||||
string name = string.Empty;
|
||||
if (UnitId != null)
|
||||
{
|
||||
name = BLL.UnitService.GetUnitNameByUnitId(UnitId.ToString());
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
protected string ConvertUnitWorkName(object UnitWorkId)
|
||||
{
|
||||
string name = string.Empty;
|
||||
if (UnitWorkId != null)
|
||||
{
|
||||
name = BLL.UnitWorkService.GetNameById(UnitWorkId.ToString());
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
protected string ConvertWorkPostName(object WorkPostId)
|
||||
{
|
||||
string name = string.Empty;
|
||||
if (WorkPostId != null)
|
||||
{
|
||||
name = BLL.WorkPostService.getWorkPostNameById(WorkPostId.ToString());
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.JDGL.SGManPower
|
||||
{
|
||||
|
||||
|
||||
public partial class ManPowerPlanIn
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// SimpleForm1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Form SimpleForm1;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar2;
|
||||
|
||||
/// <summary>
|
||||
/// btnAudit 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnAudit;
|
||||
|
||||
/// <summary>
|
||||
/// btnImport 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnDownLoad 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnDownLoad;
|
||||
|
||||
/// <summary>
|
||||
/// fuAttachUrl 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.FileUpload fuAttachUrl;
|
||||
|
||||
/// <summary>
|
||||
/// gvErrorInfo 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid gvErrorInfo;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblPageIndex;
|
||||
|
||||
/// <summary>
|
||||
/// hdFileName 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField hdFileName;
|
||||
|
||||
/// <summary>
|
||||
/// hdCheckResult 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField hdCheckResult;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,720 @@
|
|||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManPowerStat.aspx.cs" Inherits="FineUIPro.Web.JDGL.SGManPower.ManPowerStat" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head id="Head1" runat="server">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>人力统计</title>
|
||||
<link href="../../res/index/css/reset.css" rel="stylesheet" />
|
||||
<link href="../../res/index/css/home.css" rel="stylesheet" />
|
||||
<link href="../../res/index/css/swiper-3.4.2.min.css" rel="stylesheet" />
|
||||
<style type="text/css">
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.flexV {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.wrap {
|
||||
height: 100%;
|
||||
padding: 15px;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
.iteml {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.itemb {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.bottom-wrap {
|
||||
padding: 0;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.bottom-wrap:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.bw-b-bottom {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.bw-b-bottom-up {
|
||||
border-radius: 0;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.bw-item-content {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.top {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.bw-b {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.tab-wrap {
|
||||
left: auto;
|
||||
right: 15px;
|
||||
top: 5px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tab .t-item {
|
||||
width: auto;
|
||||
padding: 5px 10px;
|
||||
color: #363636;
|
||||
}
|
||||
|
||||
.tit-item {
|
||||
padding: 0 10px;
|
||||
justify-content: space-between;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tab-wrap .tab .t-item {
|
||||
color: #1C1C1C;
|
||||
}
|
||||
|
||||
.tip-item {
|
||||
margin-left: 10px;
|
||||
align-items: center;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.tip {
|
||||
width: 25px;
|
||||
height: 13px;
|
||||
background-color: #258F76;
|
||||
border-radius: 2px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.tip-next {
|
||||
background-color: #4F4F4F;
|
||||
}
|
||||
|
||||
.myTableClass {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
margin: 2px 1px;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid #BEBEBE;
|
||||
background: #ffffff;
|
||||
color: #8B8989;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.tab-title {
|
||||
height: 48px;
|
||||
color: #3CB371;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.tab-header {
|
||||
height: 36px;
|
||||
color: #1C86EE;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
td, th {
|
||||
border: 1px solid #BEBEBE;
|
||||
}
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.filter-options {
|
||||
justify-content: flex-end;
|
||||
padding: 10px;
|
||||
background-color: #f8f8f8;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.filter-options label {
|
||||
margin-left: 10px;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.filter-options input[type="radio"] {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.loading-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
display: none;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.loading-spinner {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border: 5px solid #f3f3f3;
|
||||
border-top: 5px solid #3498db;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.chart-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 300px;
|
||||
}
|
||||
|
||||
.error-message {
|
||||
color: red;
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="filter-options">
|
||||
<label>
|
||||
<input type="radio" name="data-filter" value="total" checked> 总数
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" name="data-filter" value="annual"> 年度
|
||||
</label>
|
||||
<select id="year-select" style="display: none; margin-left: 10px; padding: 2px; font-size: 14px;">
|
||||
<!-- 年份选项将通过JavaScript动态填充 -->
|
||||
</select>
|
||||
<label>
|
||||
<input type="radio" name="data-filter" value="monthly"> 月度
|
||||
</label>
|
||||
<select id="month-select" style="display: none; margin-left: 10px; padding: 2px; font-size: 14px;">
|
||||
<option value="1">1月</option>
|
||||
<option value="2">2月</option>
|
||||
<option value="3">3月</option>
|
||||
<option value="4">4月</option>
|
||||
<option value="5">5月</option>
|
||||
<option value="6">6月</option>
|
||||
<option value="7">7月</option>
|
||||
<option value="8">8月</option>
|
||||
<option value="9">9月</option>
|
||||
<option value="10">10月</option>
|
||||
<option value="11">11月</option>
|
||||
<option value="12">12月</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="wrap flex flexV">
|
||||
<div class="bottom-wrap flex1">
|
||||
<div class="top flex">
|
||||
<div class="item flex2 iteml">
|
||||
<div class="bw-b-bottom">
|
||||
<div class="bw-b-bottom-up">
|
||||
<div class="bw-item-content">
|
||||
<div id='one' class="chart-container"></div>
|
||||
<div id='one-error' class="error-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item flex2 iteml">
|
||||
<div class="bw-b-bottom">
|
||||
<div class="bw-b-bottom-up">
|
||||
<div class="bw-item-content">
|
||||
<div id='two' class="chart-container"></div>
|
||||
<div id='two-error' class="error-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom-wrap flex1">
|
||||
<div class="top flex">
|
||||
<div class="item flex2 iteml">
|
||||
<div class="bw-b-bottom">
|
||||
<div class="bw-b-bottom-up">
|
||||
<div class="bw-item-content">
|
||||
<div id='three' class="chart-container"></div>
|
||||
<div id='three-error' class="error-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item flex2 iteml">
|
||||
<div class="bw-b-bottom">
|
||||
<div class="bw-b-bottom-up">
|
||||
<div class="bw-item-content">
|
||||
<div id='four' class="chart-container"></div>
|
||||
<div id='four-error' class="error-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 加载动画 -->
|
||||
<div id="loadingOverlay" class="loading-overlay">
|
||||
<div class="loading-spinner"></div>
|
||||
</div>
|
||||
</body>
|
||||
<script type="text/javascript" src="../../res/index/js/jquery-3.4.1.min.js"></script>
|
||||
<script type="text/javascript" src="../../res/index/js/swiper-3.4.2.jquery.min.js"></script>
|
||||
<script type="text/javascript" src="../../res/index/js/echarts.min.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
// 存储各图表的实例
|
||||
var chartInstances = {};
|
||||
|
||||
// 页面加载完成后初始化图表
|
||||
$(document).ready(function() {
|
||||
// 填充年份下拉框
|
||||
populateYearSelect();
|
||||
|
||||
// 获取当前URL中的type参数,如果没有则默认为total
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
var currentType = urlParams.get('type') || 'total';
|
||||
|
||||
// 设置对应的单选按钮为选中状态
|
||||
$('input[name="data-filter"][value="' + currentType + '"]').prop('checked', true);
|
||||
|
||||
// 根据选中的类型显示/隐藏年份下拉框
|
||||
toggleYearSelect(currentType);
|
||||
|
||||
// 初始化图表
|
||||
loadAndRenderCharts(currentType);
|
||||
|
||||
// 监听单选按钮变化事件
|
||||
$('input[name="data-filter"]').change(function() {
|
||||
var dataType = $(this).val();
|
||||
toggleYearSelect(dataType);
|
||||
});
|
||||
|
||||
// 监听年份下拉框变化事件
|
||||
$('#year-select').change(function() {
|
||||
var dataType = $('input[name="data-filter"]:checked').val();
|
||||
if (dataType === 'annual' || dataType === 'monthly') {
|
||||
loadAndRenderCharts(dataType);
|
||||
}
|
||||
});
|
||||
|
||||
// 监听月份下拉框变化事件
|
||||
$('#month-select').change(function() {
|
||||
var dataType = $('input[name="data-filter"]:checked').val();
|
||||
if (dataType === 'monthly') {
|
||||
loadAndRenderCharts(dataType);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 填充年份下拉框
|
||||
function populateYearSelect() {
|
||||
var currentYear = new Date().getFullYear();
|
||||
var yearSelect = $('#year-select');
|
||||
|
||||
// 添加最近10年的选项
|
||||
for (var i = currentYear; i >= currentYear - 10; i--) {
|
||||
yearSelect.append($('<option></option>').attr('value', i).text(i));
|
||||
}
|
||||
|
||||
// 默认选中当前年份
|
||||
yearSelect.val(currentYear);
|
||||
}
|
||||
|
||||
// 根据选中的数据类型显示/隐藏年份下拉框
|
||||
function toggleYearSelect(dataType) {
|
||||
if (dataType === 'annual') {
|
||||
$('#year-select').show();
|
||||
$('#month-select').hide();
|
||||
// 不再立即触发数据查询,只显示年份选择框
|
||||
} else if (dataType === 'monthly') {
|
||||
$('#year-select').show();
|
||||
$('#month-select').show();
|
||||
// 不再立即触发数据查询,只显示年份和月份选择框
|
||||
} else {
|
||||
$('#year-select').hide();
|
||||
$('#month-select').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// 通过Ajax加载数据并渲染图表
|
||||
function loadAndRenderCharts(type) {
|
||||
// 显示加载状态
|
||||
showLoading();
|
||||
|
||||
// 隐藏所有错误信息
|
||||
$('.error-message').hide();
|
||||
|
||||
// 获取选中的年份或月份
|
||||
var selectedYear = $('#year-select').val();
|
||||
var selectedMonth = $('#month-select').val();
|
||||
|
||||
// 使用Ajax并行获取四个图表的数据
|
||||
$.when(
|
||||
$.ajax({
|
||||
url: 'ManPowerStat.aspx/GetChartData',
|
||||
type: 'POST',
|
||||
data: JSON.stringify(createParams(type, 'One', selectedYear, selectedMonth)),
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
dataType: 'json',
|
||||
timeout: 30000 // 30秒超时
|
||||
}),
|
||||
$.ajax({
|
||||
url: 'ManPowerStat.aspx/GetChartData',
|
||||
type: 'POST',
|
||||
data: JSON.stringify(createParams(type, 'Two', selectedYear, selectedMonth)),
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
dataType: 'json',
|
||||
timeout: 30000
|
||||
}),
|
||||
$.ajax({
|
||||
url: 'ManPowerStat.aspx/GetChartData',
|
||||
type: 'POST',
|
||||
data: JSON.stringify(createParams(type, 'Three', selectedYear, selectedMonth)),
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
dataType: 'json',
|
||||
timeout: 30000
|
||||
}),
|
||||
$.ajax({
|
||||
url: 'ManPowerStat.aspx/GetChartData',
|
||||
type: 'POST',
|
||||
data: JSON.stringify(createParams(type, 'Four', selectedYear, selectedMonth)),
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
dataType: 'json',
|
||||
timeout: 30000
|
||||
})
|
||||
).done(function(oneResult, twoResult, threeResult, fourResult) {
|
||||
try {
|
||||
// 渲染四个图表
|
||||
renderChart('one', oneResult[0].d, '五环管理人员统计分析');
|
||||
renderChart('two', twoResult[0].d, '施工单位管理人员统计分析');
|
||||
renderChart('three', threeResult[0].d, '作业人员统计分析');
|
||||
renderChart('four', fourResult[0].d, '过程人力统计分析');
|
||||
} catch (e) {
|
||||
console.error('图表渲染错误:', e);
|
||||
showError('图表渲染失败,请重试');
|
||||
}
|
||||
|
||||
// 隐藏加载状态
|
||||
hideLoading();
|
||||
}).fail(function(jqXHR, textStatus, errorThrown) {
|
||||
// 处理错误情况
|
||||
console.error('Ajax请求失败:', textStatus, errorThrown);
|
||||
console.error('响应内容:', jqXHR.responseText);
|
||||
|
||||
var errorMessage = '数据加载失败';
|
||||
if (textStatus === 'timeout') {
|
||||
errorMessage = '请求超时,请重试';
|
||||
} else if (jqXHR.responseText) {
|
||||
try {
|
||||
var errorResponse = JSON.parse(jqXHR.responseText);
|
||||
if (errorResponse.Message) {
|
||||
errorMessage = errorResponse.Message;
|
||||
}
|
||||
} catch (e) {
|
||||
errorMessage = jqXHR.responseText;
|
||||
}
|
||||
}
|
||||
|
||||
showError(errorMessage);
|
||||
hideLoading();
|
||||
});
|
||||
}
|
||||
|
||||
// 创建传递给后端的参数对象
|
||||
function createParams(type, chart, year, month) {
|
||||
debugger
|
||||
var params = {
|
||||
type: type,
|
||||
chart: chart ,
|
||||
year:null,
|
||||
month:null,
|
||||
};
|
||||
|
||||
// 只有在需要时才添加year和month参数
|
||||
if (type === 'annual' && year) {
|
||||
params.year = year;
|
||||
} else if (type === 'monthly' && year && month) {
|
||||
params.year = year;
|
||||
params.month = month;
|
||||
}
|
||||
|
||||
// 确保参数对象中不包含值为undefined的属性
|
||||
for (var key in params) {
|
||||
if (params[key] === undefined) {
|
||||
delete params[key];
|
||||
}
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
// 渲染单个图表的通用方法
|
||||
function renderChart(chartId, data, title) {
|
||||
try {
|
||||
// 隐藏错误信息
|
||||
$('#' + chartId + '-error').hide();
|
||||
|
||||
// 解析数据
|
||||
var chartData;
|
||||
if (typeof data === 'string') {
|
||||
chartData = JSON.parse(data);
|
||||
} else {
|
||||
chartData = data;
|
||||
}
|
||||
|
||||
// 验证数据
|
||||
if (!chartData || !chartData.categories || !chartData.series) {
|
||||
throw new Error('数据格式不正确');
|
||||
}
|
||||
|
||||
// 如果图表实例已存在,先销毁
|
||||
if (chartInstances[chartId]) {
|
||||
chartInstances[chartId].dispose();
|
||||
}
|
||||
|
||||
var chartContainer = document.getElementById(chartId);
|
||||
if (!chartContainer) {
|
||||
throw new Error('找不到图表容器: ' + chartId);
|
||||
}
|
||||
|
||||
var myChart = echarts.init(chartContainer);
|
||||
var xArr = chartData.categories;
|
||||
var num = chartData.xFontNum || 6;
|
||||
|
||||
// 确保series数据存在
|
||||
var seriesData = [];
|
||||
if (chartData.series && chartData.series.length >= 2) {
|
||||
seriesData = [
|
||||
{
|
||||
name: '计划',
|
||||
type: 'line',
|
||||
data: chartData.series[1].data || [],
|
||||
label: {
|
||||
show: true,
|
||||
position: 'top',
|
||||
textStyle: {
|
||||
fontSize: '12px',
|
||||
color: '#363636'
|
||||
},
|
||||
formatter: function (params) {
|
||||
return params.value === 0 ? '' : params.value;
|
||||
},
|
||||
},
|
||||
itemStyle: { normal: { color: 'rgba(255,0,0, 0.5)' } },
|
||||
smooth: true
|
||||
},
|
||||
{
|
||||
name: '实际',
|
||||
type: 'line',
|
||||
data: chartData.series[0].data || [],
|
||||
label: {
|
||||
show: true,
|
||||
position: 'top',
|
||||
textStyle: {
|
||||
fontSize: '12px',
|
||||
color: '#363636'
|
||||
},
|
||||
formatter: function (params) {
|
||||
return params.value === 0 ? '' : params.value;
|
||||
},
|
||||
},
|
||||
itemStyle: { normal: { color: 'rgba(0,100,0,0.8)' } },
|
||||
smooth: true
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
var option = {
|
||||
title: {
|
||||
text: title,
|
||||
textStyle: {
|
||||
color: '#1C1C1C',
|
||||
fontSize: 16,
|
||||
fontWeight: 700
|
||||
},
|
||||
show: true
|
||||
},
|
||||
tooltip: {},
|
||||
legend: {
|
||||
left: '80%',
|
||||
show: true,
|
||||
textStyle: {
|
||||
color: '#363636',
|
||||
fontSize: 12,
|
||||
}
|
||||
},
|
||||
dataZoom: [
|
||||
{
|
||||
type: 'slider',
|
||||
maxValueSpan: 6,
|
||||
show: xArr && xArr.length > 6, // 只有数据超过6个才显示缩放
|
||||
xAxisIndex: [0],
|
||||
bottom: 0, height: 10,
|
||||
backgroundColor: 'rgba(0,0,0,0)',
|
||||
borderColor: 'none',
|
||||
brushSelect: false,
|
||||
textStyle: {
|
||||
color: 'rgba(0,0,0,0)'
|
||||
},
|
||||
selectedDataBackground: {
|
||||
areaStyle: {
|
||||
color: 'red',
|
||||
borderWidth: 0
|
||||
}
|
||||
},
|
||||
handleStyle: {
|
||||
color: "#0a1449"
|
||||
},
|
||||
moveHandleStyle: {
|
||||
color: '#0a1449'
|
||||
}
|
||||
}
|
||||
],
|
||||
xAxis: {
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: 'rgba(0,0,0, 0.3)',
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
show: true,
|
||||
textStyle: {
|
||||
color: 'rgba(0,0,0, 0.8)'
|
||||
},
|
||||
interval: 0,
|
||||
rotate: -15,
|
||||
formatter: function (value) {
|
||||
if (!value) return '';
|
||||
var ret = "";
|
||||
var maxLength = num;
|
||||
var valLength = value.length;
|
||||
var rowN = Math.ceil(valLength / maxLength);
|
||||
if (rowN > 1) {
|
||||
for (var i = 0; i < rowN; i++) {
|
||||
var temp = "";
|
||||
var start = i * maxLength;
|
||||
var end = start + maxLength;
|
||||
temp = value.substring(start, end) + (i == rowN - 1 ? "" : "\n");
|
||||
ret += temp;
|
||||
}
|
||||
return ret;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},
|
||||
type: 'category',
|
||||
data: xArr || [],
|
||||
boundaryGap: [0, 0.01],
|
||||
},
|
||||
yAxis: {
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
axisLine: {
|
||||
show: false,
|
||||
lineStyle: {
|
||||
color: 'rgba(0,0,0, 0.3)'
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
show: true,
|
||||
textStyle: {
|
||||
color: 'rgba(0,0,0, 0.8)'
|
||||
}
|
||||
},
|
||||
},
|
||||
series: seriesData,
|
||||
grid: {
|
||||
top: '20%',
|
||||
left: '0%',
|
||||
right: '0%',
|
||||
bottom: 40,
|
||||
containLabel: true,
|
||||
backgroundColor: 'rgba(0,162,233, 0.01)',
|
||||
},
|
||||
backgroundColor: 'rgba(0,162,233, 0.01)',
|
||||
textStyle: {
|
||||
color: 'rgba(0,0,0, 0.3)'
|
||||
}
|
||||
};
|
||||
|
||||
myChart.setOption(option);
|
||||
chartInstances[chartId] = myChart;
|
||||
|
||||
// 监听窗口大小变化,重新调整图表大小
|
||||
var resizeHandler = function() {
|
||||
if (chartInstances[chartId]) {
|
||||
chartInstances[chartId].resize();
|
||||
}
|
||||
};
|
||||
|
||||
// 避免重复绑定事件
|
||||
if (window.addEventListener) {
|
||||
window.removeEventListener('resize', resizeHandler);
|
||||
window.addEventListener('resize', resizeHandler);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('渲染图表失败 [' + chartId + ']:', e);
|
||||
showError('图表渲染失败: ' + e.message, chartId);
|
||||
}
|
||||
}
|
||||
|
||||
// 显示错误信息
|
||||
function showError(message, chartId) {
|
||||
if (chartId) {
|
||||
$('#' + chartId + '-error').text(message).show();
|
||||
} else {
|
||||
// 全局错误显示
|
||||
alert(message);
|
||||
}
|
||||
}
|
||||
|
||||
// 显示加载状态
|
||||
function showLoading() {
|
||||
document.getElementById('loadingOverlay').style.display = 'flex';
|
||||
}
|
||||
|
||||
// 隐藏加载状态
|
||||
function hideLoading() {
|
||||
document.getElementById('loadingOverlay').style.display = 'none';
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
</html>
|
|
@ -0,0 +1,377 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Services;
|
||||
using BLL;
|
||||
|
||||
namespace FineUIPro.Web.JDGL.SGManPower
|
||||
{
|
||||
public partial class ManPowerStat : PageBase
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#region Ajax方法
|
||||
|
||||
/// <summary>
|
||||
/// 通过Ajax获取图表数据
|
||||
/// </summary>
|
||||
/// <param name="type">数据类型: total, annual, monthly</param>
|
||||
/// <param name="chart">图表标识: One, Two, Three, Four</param>
|
||||
/// <returns>序列化的图表数据</returns>
|
||||
[WebMethod(EnableSession = true)]
|
||||
public static string GetChartData(string type, string chart, string year = null, string month = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 创建页面实例以访问非静态方法
|
||||
ManPowerStat pageInstance = new ManPowerStat();
|
||||
|
||||
string title = "";
|
||||
switch (chart)
|
||||
{
|
||||
case "One":
|
||||
title = "五环管理人员统计分析";
|
||||
break;
|
||||
case "Two":
|
||||
title = "施工单位管理人员统计分析";
|
||||
break;
|
||||
case "Three":
|
||||
title = "作业人员统计分析";
|
||||
break;
|
||||
case "Four":
|
||||
title = "过程人力统计分析";
|
||||
break;
|
||||
}
|
||||
|
||||
string result = pageInstance.GetManpowerData(type, title, year, month);
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 记录异常日志
|
||||
throw new Exception("数据获取失败: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 辅助方法
|
||||
|
||||
// ... existing code ...
|
||||
/// <summary>
|
||||
/// 获取人力统计数据
|
||||
/// </summary>
|
||||
/// <param name="filterType">筛选类型</param>
|
||||
/// <param name="chartTitle">图表标题</param>
|
||||
/// <param name="year">年份(可选)</param>
|
||||
/// <param name="month">月份(可选)</param>
|
||||
/// <returns>BusinessColumn对象</returns>
|
||||
public string GetManpowerData(string filterType, string chartTitle, string year = null, string month = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
||||
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
||||
List<string> listCategories = new List<string>();
|
||||
businessColumn.title = chartTitle;
|
||||
businessColumn.xFontNum = 8;
|
||||
|
||||
// 延迟执行查询,只获取需要的数据
|
||||
var actualBaseQuery = Funs.DB.T_d_EmployInOutRecord.Where(x =>
|
||||
x.ProjectId == this.CurrUser.LoginProjectId);
|
||||
|
||||
var planBaseQuery =
|
||||
Funs.DB.JDGL_SGManPower.Where(x => x.ProjectId == this.CurrUser.LoginProjectId);
|
||||
|
||||
//var UnitType = string.Empty; //1:总包 2:分包
|
||||
// var PostType = string.Empty; //1:一般管理岗位 4:特种管理岗位
|
||||
var Units = (from x in Funs.DB.Project_ProjectUnit
|
||||
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitType == "2"
|
||||
select x.UnitId).ToList();
|
||||
|
||||
var workPosts = (from x in Funs.DB.Base_WorkPost
|
||||
where (x.PostType == "1" || x.PostType == "4")
|
||||
select x.WorkPostId).ToList();
|
||||
|
||||
if (chartTitle == "五环管理人员统计分析")
|
||||
{
|
||||
actualBaseQuery = actualBaseQuery.Where(x => x.UnitId == Const.UnitId_CWCEC);
|
||||
planBaseQuery = planBaseQuery.Where(x => x.UnitId == Const.UnitId_CWCEC);
|
||||
}
|
||||
else if (chartTitle == "施工单位管理人员统计分析")
|
||||
{
|
||||
actualBaseQuery =
|
||||
actualBaseQuery.Where(x => Units.Contains(x.UnitId) && workPosts.Contains(x.PostId));
|
||||
planBaseQuery =
|
||||
planBaseQuery.Where(x => Units.Contains(x.UnitId) && workPosts.Contains(x.WorkPostId));
|
||||
}
|
||||
else if (chartTitle == "作业人员统计分析")
|
||||
{
|
||||
actualBaseQuery =
|
||||
actualBaseQuery.Where(x => Units.Contains(x.UnitId) && !workPosts.Contains(x.PostId));
|
||||
planBaseQuery =
|
||||
planBaseQuery.Where(x => Units.Contains(x.UnitId) && !workPosts.Contains(x.WorkPostId));
|
||||
}
|
||||
else if (chartTitle == "过程人力统计分析")
|
||||
{
|
||||
}
|
||||
|
||||
// 根据年份或月份筛选数据
|
||||
if (filterType == "annual" && !string.IsNullOrEmpty(year))
|
||||
{
|
||||
int selectedYear = int.Parse(year);
|
||||
actualBaseQuery = actualBaseQuery.Where(x =>
|
||||
x.RecordDate.HasValue && x.RecordDate.Value.Year == selectedYear);
|
||||
planBaseQuery =
|
||||
planBaseQuery.Where(x => x.PlanDate.HasValue && x.PlanDate.Value.Year == selectedYear);
|
||||
}
|
||||
else if (filterType == "monthly" && !string.IsNullOrEmpty(year) && !string.IsNullOrEmpty(month))
|
||||
{
|
||||
int selectedYear = int.Parse(year);
|
||||
int selectedMonth = int.Parse(month);
|
||||
actualBaseQuery = actualBaseQuery.Where(x => x.RecordDate.HasValue &&
|
||||
x.RecordDate.Value.Year == selectedYear &&
|
||||
x.RecordDate.Value.Month == selectedMonth);
|
||||
planBaseQuery = planBaseQuery.Where(x => x.PlanDate.HasValue &&
|
||||
x.PlanDate.Value.Year == selectedYear &&
|
||||
x.PlanDate.Value.Month == selectedMonth);
|
||||
}
|
||||
|
||||
// 根据筛选类型进行不同的分组统计
|
||||
Dictionary<DateTime, double> actualData;
|
||||
Dictionary<DateTime, double> planData;
|
||||
|
||||
switch (filterType)
|
||||
{
|
||||
case "annual":
|
||||
// 按月分组(年度视图显示每个月的数据)
|
||||
var actualAnnualQuery = from x in actualBaseQuery
|
||||
where x.RecordDate.HasValue
|
||||
group x by new { x.RecordDate.Value.Year, x.RecordDate.Value.Month }
|
||||
into g
|
||||
select new
|
||||
{
|
||||
Year = g.Key.Year,
|
||||
Month = g.Key.Month,
|
||||
ActualCount = g.Count()
|
||||
};
|
||||
|
||||
var planAnnualQuery = from x in planBaseQuery
|
||||
where x.PlanDate.HasValue
|
||||
group x by new { x.PlanDate.Value.Year, x.PlanDate.Value.Month }
|
||||
into g
|
||||
select new
|
||||
{
|
||||
Year = g.Key.Year,
|
||||
Month = g.Key.Month,
|
||||
PlanCount = g.Sum(x => x.Quantity ?? 0)
|
||||
};
|
||||
|
||||
actualData = actualAnnualQuery.ToDictionary(
|
||||
x => new DateTime(x.Year, x.Month, 1),
|
||||
x => (double)x.ActualCount);
|
||||
|
||||
planData = planAnnualQuery.ToDictionary(
|
||||
x => new DateTime(x.Year, x.Month, 1),
|
||||
x => (double)x.PlanCount);
|
||||
break;
|
||||
|
||||
case "monthly":
|
||||
// 按天分组(月度视图显示每天的数据)
|
||||
var actualMonthlyQuery = from x in actualBaseQuery
|
||||
where x.RecordDate.HasValue
|
||||
group x by new { x.RecordDate.Value.Year, x.RecordDate.Value.Month, x.RecordDate.Value.Day }
|
||||
into g
|
||||
select new
|
||||
{
|
||||
Year = g.Key.Year,
|
||||
Month = g.Key.Month,
|
||||
Day = g.Key.Day,
|
||||
ActualCount = g.Count()
|
||||
};
|
||||
|
||||
var planMonthlyQuery = from x in planBaseQuery
|
||||
where x.PlanDate.HasValue
|
||||
group x by new { x.PlanDate.Value.Year, x.PlanDate.Value.Month, x.PlanDate.Value.Day }
|
||||
into g
|
||||
select new
|
||||
{
|
||||
Year = g.Key.Year,
|
||||
Month = g.Key.Month,
|
||||
Day = g.Key.Day,
|
||||
PlanCount = g.Sum(x => x.Quantity ?? 0)
|
||||
};
|
||||
|
||||
actualData = actualMonthlyQuery.ToDictionary(
|
||||
x => new DateTime(x.Year, x.Month, x.Day),
|
||||
x => (double)x.ActualCount);
|
||||
|
||||
planData = planMonthlyQuery.ToDictionary(
|
||||
x => new DateTime(x.Year, x.Month, x.Day),
|
||||
x => (double)x.PlanCount);
|
||||
break;
|
||||
|
||||
case "total":
|
||||
default:
|
||||
// 按月分组(默认情况)
|
||||
var actualDefaultQuery = from x in actualBaseQuery
|
||||
where x.RecordDate.HasValue
|
||||
group x by new { x.RecordDate.Value.Year, x.RecordDate.Value.Month }
|
||||
into g
|
||||
select new
|
||||
{
|
||||
Year = g.Key.Year,
|
||||
Month = g.Key.Month,
|
||||
ActualCount = g.Count()
|
||||
};
|
||||
|
||||
var planDefaultQuery = from x in planBaseQuery
|
||||
where x.PlanDate.HasValue
|
||||
group x by new { x.PlanDate.Value.Year, x.PlanDate.Value.Month }
|
||||
into g
|
||||
select new
|
||||
{
|
||||
Year = g.Key.Year,
|
||||
Month = g.Key.Month,
|
||||
PlanCount = g.Sum(x => x.Quantity ?? 0)
|
||||
};
|
||||
|
||||
actualData = actualDefaultQuery.ToDictionary(
|
||||
x => new DateTime(x.Year, x.Month, 1),
|
||||
x => (double)x.ActualCount);
|
||||
|
||||
planData = planDefaultQuery.ToDictionary(
|
||||
x => new DateTime(x.Year, x.Month, 1),
|
||||
x => (double)x.PlanCount);
|
||||
break;
|
||||
}
|
||||
|
||||
// 获取所有日期并排序
|
||||
var allDates = actualData.Keys.Union(planData.Keys).Distinct().OrderBy(d => d).ToList();
|
||||
|
||||
// 准备数据系列
|
||||
List<double> actualSeries =
|
||||
allDates.Select(date => actualData.ContainsKey(date) ? actualData[date] : 0).ToList();
|
||||
List<double> planSeries =
|
||||
allDates.Select(date => planData.ContainsKey(date) ? planData[date] : 0).ToList();
|
||||
|
||||
// 准备类别(横坐标)
|
||||
switch (filterType)
|
||||
{
|
||||
case "annual":
|
||||
// 显示选定年份的12个月份
|
||||
listCategories = allDates.Select(date => date.ToString("yyyy年MM月")).ToList();
|
||||
break;
|
||||
case "monthly":
|
||||
// 显示选定月份的每日数据
|
||||
listCategories = allDates.Select(date => date.ToString("MM月dd日")).ToList();
|
||||
break;
|
||||
case "total":
|
||||
default:
|
||||
listCategories = allDates.Select(date => date.ToString("yyyy年MM月")).ToList();
|
||||
break;
|
||||
}
|
||||
|
||||
// 实际数据系列
|
||||
Model.SingleSerie actualSerie = new Model.SingleSerie
|
||||
{
|
||||
name = "实际",
|
||||
data = actualSeries
|
||||
};
|
||||
series.Add(actualSerie);
|
||||
|
||||
// 计划数据系列
|
||||
Model.SingleSerie planSerie = new Model.SingleSerie
|
||||
{
|
||||
name = "计划",
|
||||
data = planSeries
|
||||
};
|
||||
series.Add(planSerie);
|
||||
|
||||
businessColumn.categories = listCategories;
|
||||
businessColumn.series = series;
|
||||
return JsonConvert.SerializeObject(businessColumn);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 记录异常日志
|
||||
// LogHelper.Error("获取人力统计数据失败", ex);
|
||||
throw new Exception("数据获取失败: " + ex.Message);
|
||||
}
|
||||
}
|
||||
// ... existing code ...
|
||||
|
||||
#endregion
|
||||
|
||||
#region 五环管理人员统计分析
|
||||
|
||||
/// <summary>
|
||||
/// 五环管理人员统计分析
|
||||
/// </summary>
|
||||
public string One
|
||||
{
|
||||
get
|
||||
{
|
||||
string dataType = Request.QueryString["type"] ?? "total";
|
||||
return GetManpowerData(dataType, "五环管理人员统计分析");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 施工单位管理人员统计分析
|
||||
|
||||
/// <summary>
|
||||
/// 施工单位管理人员统计分析
|
||||
/// </summary>
|
||||
public string Two
|
||||
{
|
||||
get
|
||||
{
|
||||
string dataType = Request.QueryString["type"] ?? "total";
|
||||
return GetManpowerData(dataType, "施工单位管理人员统计分析");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 作业人员统计分析
|
||||
|
||||
/// <summary>
|
||||
/// 作业人员统计分析
|
||||
/// </summary>
|
||||
public string Three
|
||||
{
|
||||
get
|
||||
{
|
||||
string dataType = Request.QueryString["type"] ?? "total";
|
||||
return GetManpowerData(dataType, "作业人员统计分析");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 过程人力统计分析
|
||||
|
||||
/// <summary>
|
||||
/// 过程人力统计分析
|
||||
/// </summary>
|
||||
public string Four
|
||||
{
|
||||
get
|
||||
{
|
||||
string dataType = Request.QueryString["type"] ?? "total";
|
||||
return GetManpowerData(dataType, "过程人力统计分析");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.JDGL.SGManPower
|
||||
{
|
||||
|
||||
|
||||
public partial class ManPowerStat
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Head1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlHead Head1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManPowerWork.aspx.cs" Inherits="FineUIPro.Web.JDGL.SGManPower.ManPowerWork" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title>现场人力考勤</title>
|
||||
<link href="../res/css/common.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel3" runat="server" />
|
||||
<f:Panel ID="Panel3" Margin="24px" runat="server" ShowBorder="false" ShowHeader="false" Layout="Region">
|
||||
<Items>
|
||||
<f:Panel runat="server" ID="panelCenterRegion" RegionPosition="Center" Layout="Fit" IFrameUrl="" EnableIFrame="True"
|
||||
Title="中间面板" ShowBorder="False" ShowHeader="false" BodyPadding="10px" IconFont="_RoundPlus">
|
||||
|
||||
</f:Panel>
|
||||
</Items>
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Right">
|
||||
<Items>
|
||||
<f:DropDownList ID="drpUnit" runat="server" Label="单位" AutoPostBack="true" AutoSelectFirstItem="True" LabelAlign="Right" EnableAjax="True"
|
||||
LabelWidth="140px" OnSelectedIndexChanged="DropMainContractCode_SelectedIndexChanged">
|
||||
</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:Button ID="btnSubmit" runat="server" Icon="SystemSearch" Text="确定"
|
||||
OnClick="DropMainContractCode_SelectedIndexChanged">
|
||||
</f:Button>
|
||||
<f:ToolbarFill runat="server" />
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
|
||||
</f:Panel>
|
||||
</form>
|
||||
</body>
|
||||
|
||||
|
||||
</html>
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.JDGL.SGManPower
|
||||
{
|
||||
public partial class ManPowerWork : PageBase
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
BLL.UnitService.GetUnit(this.drpUnit, this.CurrUser.LoginProjectId, 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));
|
||||
DropMainContractCode_SelectedIndexChanged(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void DropMainContractCode_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(drpUnit.SelectedValue))
|
||||
{
|
||||
panelCenterRegion.IFrameUrl = "./ManPowerWorkGrid.aspx?UnitId=" + drpUnit.SelectedValue +
|
||||
"&StartTime=" + this.txtStartTime.Text + "&EndTime=" +
|
||||
this.txtEndTime.Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.JDGL.SGManPower
|
||||
{
|
||||
|
||||
|
||||
public partial class ManPowerWork
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// Panel3 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel3;
|
||||
|
||||
/// <summary>
|
||||
/// panelCenterRegion 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel panelCenterRegion;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar2;
|
||||
|
||||
/// <summary>
|
||||
/// drpUnit 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpUnit;
|
||||
|
||||
/// <summary>
|
||||
/// txtStartTime 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DatePicker txtStartTime;
|
||||
|
||||
/// <summary>
|
||||
/// txtEndTime 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DatePicker txtEndTime;
|
||||
|
||||
/// <summary>
|
||||
/// btnSubmit 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSubmit;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManPowerWorkChart.aspx.cs" Inherits="FineUIPro.Web.JDGL.SGManPower.ManPowerWorkChart" %>
|
||||
<%@ Register Src="~/Controls/ChartControl.ascx" TagName="ChartControl" TagPrefix="uc1" %>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>现场考勤人力图表</title>
|
||||
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
|
||||
<style type="text/css"> .chart-container {
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.chart-content {
|
||||
display: inline-block;
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
.chart-wrapper {
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.scroll-hint {
|
||||
text-align: center;
|
||||
color: #666;
|
||||
font-size: 12px;
|
||||
margin-bottom: 10px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.chart-container::-webkit-scrollbar {
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
.chart-container::-webkit-scrollbar-track {
|
||||
background: #f1f1f1;
|
||||
}
|
||||
|
||||
.chart-container::-webkit-scrollbar-thumb {
|
||||
background: #c1c1c1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.chart-container::-webkit-scrollbar-thumb:hover {
|
||||
background: #a1a1a1;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" runat="server" />
|
||||
<f:Panel ID="Panel1" runat="server" ShowBorder="false" ShowHeader="false"
|
||||
Layout="Region" Margin="5px">
|
||||
<Items>
|
||||
<f:Panel ID="panelCenterRegion" runat="server" RegionPosition="Center"
|
||||
ShowBorder="false" ShowHeader="false" Layout="Fit">
|
||||
<Items>
|
||||
<f:ContentPanel ID="ContentPanel1" runat="server" ShowBorder="false" ShowHeader="false">
|
||||
<div class="scroll-hint" id="scrollHint" runat="server">← 左右滑动查看图表 →</div>
|
||||
<div class="chart-container" id="chartContainer" runat="server">
|
||||
<div class="chart-content">
|
||||
<div class="chart-wrapper">
|
||||
<%-- <h2>总人力需求计划</h2> --%>
|
||||
<uc1:ChartControl ID="Chart1" runat="server"
|
||||
ChartType="Column"
|
||||
Title="人力需求计划"
|
||||
YAxisTitle="人员数量"
|
||||
XAxisTitle="日期" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</f:ContentPanel>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
</form>
|
||||
<script type="text/javascript"> function checkScroll() {
|
||||
var container = document.getElementById('<%= chartContainer.ClientID %>');
|
||||
var hint = document.getElementById('<%= scrollHint.ClientID %>');
|
||||
|
||||
if (container && hint) {
|
||||
// 如果内容宽度大于容器宽度,显示滚动提示
|
||||
if (container.scrollWidth > container.clientWidth) {
|
||||
hint.style.display = 'block';
|
||||
} else {
|
||||
hint.style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 页面加载完成后检查是否需要显示滚动提示
|
||||
window.addEventListener('load', function() {
|
||||
setTimeout(checkScroll, 100); // 稍微延迟以确保图表已渲染
|
||||
});
|
||||
|
||||
// 窗口大小改变时重新检查
|
||||
window.addEventListener('resize', checkScroll);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,136 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using BLL;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace FineUIPro.Web.JDGL.SGManPower
|
||||
{
|
||||
public partial class ManPowerWorkChart : PageBase
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
// 初始化图表数据
|
||||
InitializeChartData();
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeChartData()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 获取查询参数
|
||||
string unitId = Request.Params["UnitId"];
|
||||
string startTime = Request.Params["StartTime"];
|
||||
string endTime = Request.Params["EndTime"];
|
||||
string workPostId = Request.Params["WorkPostId"];
|
||||
|
||||
// 检查必要参数
|
||||
if (string.IsNullOrEmpty(startTime) || string.IsNullOrEmpty(endTime))
|
||||
{
|
||||
ShowNotify("缺少必要的参数,无法生成图表", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
DateTime startDate = Convert.ToDateTime(startTime);
|
||||
DateTime endDate = Convert.ToDateTime(endTime);
|
||||
|
||||
// 使用原生SQL查询直接在数据库中进行聚合计算,提高性能
|
||||
string strSql = @"
|
||||
SELECT
|
||||
RecordDate,
|
||||
COUNT(1) as TotalCount
|
||||
FROM T_d_EmployInOutRecord
|
||||
WHERE ProjectId = @ProjectId
|
||||
AND RecordDate >= @StartDate
|
||||
AND RecordDate <= @EndDate";
|
||||
|
||||
var parameters = new List<SqlParameter>
|
||||
{
|
||||
new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId),
|
||||
new SqlParameter("@StartDate", startDate),
|
||||
new SqlParameter("@EndDate", endDate)
|
||||
};
|
||||
|
||||
// 添加单位筛选条件
|
||||
if (!string.IsNullOrEmpty(unitId) && unitId != Const._Null)
|
||||
{
|
||||
strSql += " AND UnitId = @UnitId";
|
||||
parameters.Add(new SqlParameter("@UnitId", unitId));
|
||||
}
|
||||
|
||||
// 添加岗位筛选条件
|
||||
if (!string.IsNullOrEmpty(workPostId) && workPostId != Const._Null)
|
||||
{
|
||||
strSql += " AND PostId = @WorkPostId";
|
||||
parameters.Add(new SqlParameter("@WorkPostId", workPostId));
|
||||
}
|
||||
|
||||
// 按日期分组并排序
|
||||
strSql += " GROUP BY RecordDate ORDER BY RecordDate";
|
||||
|
||||
// 执行查询
|
||||
var dt = SQLHelper.GetDataTableRunText(strSql, parameters.ToArray());
|
||||
|
||||
// 如果没有数据,显示提示信息
|
||||
if (dt.Rows.Count == 0)
|
||||
{
|
||||
ShowNotify("在指定时间范围内没有找到人力统计数据", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
// 根据数据点数量动态调整图表宽度,确保每个数据点有足够的显示空间
|
||||
int chartWidth = Math.Max(1000, dt.Rows.Count * 50); // 每个数据点至少50像素宽,最小1000像素
|
||||
|
||||
// 创建图表数据对象
|
||||
Model.DataSourceChart dataSourceChart = new Model.DataSourceChart
|
||||
{
|
||||
Title = "现场考勤人力统计图表",
|
||||
ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Column,
|
||||
Width = chartWidth,
|
||||
Height = 500,
|
||||
IsNotEnable3D = false
|
||||
};
|
||||
|
||||
// 创建数据系列
|
||||
Model.DataSourceTeam dataSourceTeam = new Model.DataSourceTeam
|
||||
{
|
||||
DataPointName = "人员数量",
|
||||
DataSourcePoints = new List<Model.DataSourcePoint>()
|
||||
};
|
||||
|
||||
// 添加数据点
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
if (row["RecordDate"] != DBNull.Value)
|
||||
{
|
||||
DateTime recordDate = Convert.ToDateTime(row["RecordDate"]);
|
||||
int totalCount = Convert.ToInt32(row["TotalCount"]);
|
||||
|
||||
Model.DataSourcePoint point = new Model.DataSourcePoint
|
||||
{
|
||||
PointText = recordDate.ToString("MM-dd"),
|
||||
PointValue = totalCount.ToString()
|
||||
};
|
||||
dataSourceTeam.DataSourcePoints.Add(point);
|
||||
}
|
||||
}
|
||||
|
||||
dataSourceChart.DataSourceTeams = new List<Model.DataSourceTeam> { dataSourceTeam };
|
||||
|
||||
// 生成图表
|
||||
Chart1.CreateChart(dataSourceChart);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowNotify($"生成图表时发生错误: {ex.Message}", MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.JDGL.SGManPower
|
||||
{
|
||||
|
||||
|
||||
public partial class ManPowerWorkChart
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// Panel1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel1;
|
||||
|
||||
/// <summary>
|
||||
/// panelCenterRegion 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel panelCenterRegion;
|
||||
|
||||
/// <summary>
|
||||
/// ContentPanel1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ContentPanel ContentPanel1;
|
||||
|
||||
/// <summary>
|
||||
/// scrollHint 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlGenericControl scrollHint;
|
||||
|
||||
/// <summary>
|
||||
/// chartContainer 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlGenericControl chartContainer;
|
||||
|
||||
/// <summary>
|
||||
/// Chart1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::Web.Controls.ChartControl Chart1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManPowerWorkGrid.aspx.cs" Inherits="FineUIPro.Web.JDGL.SGManPower.ManPowerWorkGrid" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<title>施工人力计划</title>
|
||||
<link href="../../res/css/common.css" rel="stylesheet" type="text/css"/>
|
||||
<style type="text/css">
|
||||
|
||||
.f-grid-row .f-grid-cell-inner {
|
||||
white-space: normal;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.f-grid-row.yellow {
|
||||
background-color: YellowGreen;
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
.f-grid-row.red {
|
||||
background-color: Yellow;
|
||||
}
|
||||
.f-grid-cell[data-color=color1] {
|
||||
background-color: Yellow;
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel3" runat="server"/>
|
||||
<f:Panel ID="Panel3" Margin="24px" runat="server" ShowBorder="false" ShowHeader="false" Layout="Region">
|
||||
<Items>
|
||||
<f:Panel runat="server" ID="panelCenterRegion" RegionPosition="Center" Layout="Fit"
|
||||
Title="中间面板" ShowBorder="True" ShowHeader="false" BodyPadding="10px" IconFont="_RoundPlus">
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="合同执行跟踪表" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true"
|
||||
ClicksToEdit="1" DataIDField="Id" AllowSorting="true" SortField="Id"
|
||||
SortDirection="DESC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowColumnLocking="true" EnableSummary="true" SummaryPosition="Bottom"
|
||||
AllowPaging="True" IsDatabasePaging="true" PageSize="50" OnPageIndexChange="Grid1_PageIndexChange"
|
||||
EnableRowDoubleClickEvent="true">
|
||||
<Toolbars>
|
||||
|
||||
<f:Toolbar ID="Toolbar4" Position="Top" runat="server" ToolbarAlign="Right">
|
||||
<Items>
|
||||
<f:DropDownList runat="server" ID="drpWorkPost" Label="岗位"></f:DropDownList>
|
||||
<f:ToolbarFill runat="server"/>
|
||||
<f:Button ID="btnQuery" ToolTip="查询" Text="查询" Icon="SystemSearch" runat="server" EnablePostBack="true"
|
||||
OnClick="btnQuery_OnClick">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" Text="导出" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
<f:Button ID="btnGetChart" ToolTip="图表" Icon="ChartPie" Text="统计图表"
|
||||
EnablePostBack="true" OnClick="btnGetChart_Click" runat="server">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<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>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
<f:Window ID="Window1" runat="server" Hidden="true" ShowHeader="true"
|
||||
IsModal="true" Target="Parent" EnableMaximize="true" EnableResize="true"
|
||||
Title="编辑施工人力计划" EnableIFrame="true" Height="650px" OnClose="Window1_Close"
|
||||
Width="1200px">
|
||||
</f:Window>
|
||||
<f:Window ID="Window2" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
|
||||
Target="Top" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true"
|
||||
Width="1200px" Height="650px">
|
||||
</f:Window>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
|
||||
function reloadGrid() {
|
||||
__doPostBack(null, 'reloadGrid');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,741 @@
|
|||
using BLL;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace FineUIPro.Web.JDGL.SGManPower
|
||||
{
|
||||
public partial class ManPowerWorkGrid : PageBase
|
||||
{
|
||||
#region Page_Init
|
||||
|
||||
// 注意:动态创建的代码需要放置于Page_Init(不是Page_Load),这样每次构造页面时都会执行
|
||||
protected void Page_Init(object sender, EventArgs e)
|
||||
{
|
||||
InitGrid();
|
||||
}
|
||||
|
||||
public DataTable GridTable = new DataTable();
|
||||
|
||||
private void InitGrid()
|
||||
{
|
||||
FineUIPro.BoundField bf;
|
||||
FineUIPro.RenderField rf;
|
||||
FineUIPro.TextBox txTextBox;
|
||||
|
||||
// 设置Grid的编辑属性
|
||||
Grid1.AllowCellEditing = true;
|
||||
Grid1.ClicksToEdit = 1;
|
||||
Grid1.EnableAfterEditEvent = true;
|
||||
|
||||
UnitId = Request.Params["UnitId"];
|
||||
StartTime = Request.Params["StartTime"];
|
||||
EndTime = Request.Params["EndTime"];
|
||||
|
||||
GridTable.Columns.Add("Id");
|
||||
|
||||
// 添加隐藏列来存储额外的ID信息
|
||||
GridTable.Columns.Add("UnitId");
|
||||
GridTable.Columns.Add("WorkPostId");
|
||||
|
||||
ListItem[] list = new ListItem[4];
|
||||
list[0] = new ListItem("序号", "SerialNumber");
|
||||
list[1] = new ListItem("单位", "UnitName");
|
||||
list[2] = new ListItem("岗位", "WorkPostName");
|
||||
list[3] = new ListItem("累计", "TotalCount");
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
bf = new FineUIPro.BoundField();
|
||||
bf.ColumnID = item.Value;
|
||||
bf.DataField = item.Value;
|
||||
bf.HeaderText = item.Text;
|
||||
bf.HeaderTextAlign = TextAlign.Center;
|
||||
bf.TextAlign = TextAlign.Center;
|
||||
bf.Locked = true;
|
||||
Grid1.Columns.Add(bf);
|
||||
GridTable.Columns.Add(item.Value);
|
||||
}
|
||||
|
||||
// 动态获取日期范围
|
||||
DateTime startDate = Convert.ToDateTime(StartTime);
|
||||
DateTime endDate = Convert.ToDateTime(EndTime);
|
||||
var dateRange = Enumerable.Range(0, (endDate - startDate).Days + 1)
|
||||
.Select(i => startDate.AddDays(i))
|
||||
.ToList();
|
||||
|
||||
// 按年分组日期
|
||||
var groupedByYear = dateRange.GroupBy(d => d.Year)
|
||||
.OrderBy(g => g.Key)
|
||||
.ToList();
|
||||
|
||||
foreach (var yearGroup in groupedByYear)
|
||||
{
|
||||
GroupField yearGroupField = new GroupField();
|
||||
yearGroupField.HeaderText = $"{yearGroup.Key}年";
|
||||
yearGroupField.TextAlign = TextAlign.Center;
|
||||
|
||||
// 按月分组
|
||||
var groupedByMonth = yearGroup.GroupBy(d => d.Month)
|
||||
.OrderBy(g => g.Key)
|
||||
.ToList();
|
||||
|
||||
foreach (var monthGroup in groupedByMonth)
|
||||
{
|
||||
GroupField monthGroupField = new GroupField();
|
||||
monthGroupField.HeaderText = $"{monthGroup.Key}月";
|
||||
monthGroupField.TextAlign = TextAlign.Center;
|
||||
|
||||
// 添加具体日期的列
|
||||
foreach (var date in monthGroup.OrderBy(d => d))
|
||||
{
|
||||
bf = new FineUIPro.BoundField();
|
||||
bf.ColumnID = date.ToString("yyyy-MM-dd");
|
||||
bf.DataField = date.ToString("yyyy-MM-dd");
|
||||
bf.HeaderText = date.ToString("dd");
|
||||
bf.HeaderTextAlign = TextAlign.Center;
|
||||
bf.TextAlign = TextAlign.Center;
|
||||
monthGroupField.Columns.Add(bf);
|
||||
GridTable.Columns.Add(date.ToString("yyyy-MM-dd"));
|
||||
}
|
||||
|
||||
yearGroupField.Columns.Add(monthGroupField);
|
||||
}
|
||||
|
||||
Grid1.Columns.Add(yearGroupField);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public string UnitId
|
||||
{
|
||||
get => (string)ViewState["UnitId"];
|
||||
set => ViewState["UnitId"] = value;
|
||||
}
|
||||
|
||||
public string StartTime
|
||||
{
|
||||
get => (string)ViewState["StartTime"];
|
||||
set => ViewState["StartTime"] = value;
|
||||
}
|
||||
|
||||
public string EndTime
|
||||
{
|
||||
get => (string)ViewState["EndTime"];
|
||||
set => ViewState["EndTime"] = value;
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
Funs.DropDownPageSize(this.ddlPageSize);
|
||||
// 设置Grid的PageSize与下拉框默认值一致
|
||||
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
||||
WorkPostService.InitWorkPostDropDownList(this.drpWorkPost, true); //岗位
|
||||
|
||||
// 绑定表格
|
||||
this.BindGrid();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region 绑定数据
|
||||
|
||||
/// <summary>
|
||||
/// 绑定数据
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
// 清空现有数据
|
||||
GridTable.Clear();
|
||||
// 重新添加列定义(保持列结构)
|
||||
if (GridTable.Columns.Count == 0)
|
||||
{
|
||||
GridTable.Columns.Add("Id");
|
||||
GridTable.Columns.Add("UnitId");
|
||||
GridTable.Columns.Add("WorkPostId");
|
||||
|
||||
// 添加动态日期列(这部分已经在InitGrid中定义了)
|
||||
ListItem[] list = new ListItem[4];
|
||||
list[0] = new ListItem("序号", "SerialNumber");
|
||||
list[1] = new ListItem("单位", "UnitName");
|
||||
list[2] = new ListItem("岗位", "WorkPostName");
|
||||
list[3] = new ListItem("累计", "TotalCount");
|
||||
foreach (var item in list)
|
||||
{
|
||||
GridTable.Columns.Add(item.Value);
|
||||
}
|
||||
|
||||
// 日期列会在InitGrid中添加,这里不需要重复添加
|
||||
}
|
||||
else
|
||||
{
|
||||
// 清空行数据但保持列结构
|
||||
GridTable.Rows.Clear();
|
||||
}
|
||||
|
||||
// 使用原生SQL查询来提高性能,直接在数据库层面进行分组统计
|
||||
string strSql = @"
|
||||
SELECT UnitId, PostId, RecordDate, COUNT(1) as RecordCount
|
||||
FROM T_d_EmployInOutRecord
|
||||
WHERE ProjectId = @ProjectId
|
||||
AND RecordDate >= @StartDate
|
||||
AND RecordDate <= @EndDate";
|
||||
|
||||
var parameters = new List<System.Data.SqlClient.SqlParameter>
|
||||
{
|
||||
new System.Data.SqlClient.SqlParameter("@ProjectId", this.CurrUser.LoginProjectId),
|
||||
new System.Data.SqlClient.SqlParameter("@StartDate", Convert.ToDateTime(StartTime)),
|
||||
new System.Data.SqlClient.SqlParameter("@EndDate", Convert.ToDateTime(EndTime))
|
||||
};
|
||||
|
||||
if (UnitId != Const._Null)
|
||||
{
|
||||
strSql += " AND UnitId = @UnitId";
|
||||
parameters.Add(new System.Data.SqlClient.SqlParameter("@UnitId", UnitId));
|
||||
}
|
||||
|
||||
if (drpWorkPost.SelectedValue != Const._Null)
|
||||
{
|
||||
strSql += " AND PostId = @PostId";
|
||||
parameters.Add(new System.Data.SqlClient.SqlParameter("@PostId", drpWorkPost.SelectedValue));
|
||||
}
|
||||
|
||||
strSql += " GROUP BY UnitId, PostId, RecordDate";
|
||||
|
||||
// 执行查询获取分组数据
|
||||
var dt = SQLHelper.GetDataTableRunText(strSql, parameters.ToArray());
|
||||
|
||||
// 将数据转换为更易处理的格式
|
||||
var groupedData = new List<dynamic>();
|
||||
var groupedDict = new Dictionary<string, dynamic>();
|
||||
|
||||
foreach (System.Data.DataRow row in dt.Rows)
|
||||
{
|
||||
string key = $"{row["UnitId"]}_{row["PostId"]}";
|
||||
DateTime recordDate = Convert.ToDateTime(row["RecordDate"]);
|
||||
int count = Convert.ToInt32(row["RecordCount"]);
|
||||
|
||||
if (!groupedDict.ContainsKey(key))
|
||||
{
|
||||
dynamic group = new System.Dynamic.ExpandoObject();
|
||||
group.UnitId = row["UnitId"];
|
||||
group.PostId = row["PostId"];
|
||||
group.DailyCounts = new Dictionary<DateTime, int>();
|
||||
group.TotalCount = 0;
|
||||
groupedDict[key] = group;
|
||||
groupedData.Add(group);
|
||||
}
|
||||
|
||||
groupedDict[key].DailyCounts[recordDate] = count;
|
||||
groupedDict[key].TotalCount += count;
|
||||
}
|
||||
|
||||
Grid1.RecordCount = groupedData.Count();
|
||||
|
||||
// 分页处理
|
||||
var pagedData = groupedData.Skip(Grid1.PageSize * Grid1.PageIndex).Take(Grid1.PageSize).ToList();
|
||||
|
||||
// 只获取当前页需要的单位和岗位信息,避免加载全部数据
|
||||
var unitIds = pagedData.Where(x => x.UnitId != null).Select(x => x.UnitId.ToString()).Distinct().ToList();
|
||||
var postIds = pagedData.Where(x => x.PostId != null).Select(x => x.PostId.ToString()).Distinct().ToList();
|
||||
|
||||
var units = new Dictionary<string, string>();
|
||||
var workPosts = new Dictionary<string, string>();
|
||||
|
||||
if (unitIds.Any())
|
||||
{
|
||||
var unitQuery = from u in Funs.DB.Base_Unit
|
||||
where unitIds.Contains(u.UnitId)
|
||||
select new { u.UnitId, u.UnitName };
|
||||
foreach (var u in unitQuery)
|
||||
{
|
||||
units[u.UnitId] = u.UnitName;
|
||||
}
|
||||
}
|
||||
|
||||
if (postIds.Any())
|
||||
{
|
||||
var postQuery = from p in Funs.DB.Base_WorkPost
|
||||
where postIds.Contains(p.WorkPostId)
|
||||
select new { p.WorkPostId, p.WorkPostName };
|
||||
foreach (var p in postQuery)
|
||||
{
|
||||
workPosts[p.WorkPostId] = p.WorkPostName;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var group in pagedData)
|
||||
{
|
||||
DataRow row = GridTable.NewRow();
|
||||
|
||||
// 基本信息
|
||||
row["Id"] = Guid.NewGuid().ToString(); // 生成唯一ID用于行标识
|
||||
row["SerialNumber"] = GridTable.Rows.Count + 1; // 序号
|
||||
|
||||
// 单位信息
|
||||
string unitName = "";
|
||||
if (group.UnitId != null && units.ContainsKey(group.UnitId.ToString()))
|
||||
{
|
||||
unitName = units[group.UnitId.ToString()];
|
||||
}
|
||||
row["UnitName"] = unitName;
|
||||
row["UnitId"] = group.UnitId ?? (object)DBNull.Value;
|
||||
|
||||
// 岗位信息
|
||||
string workPostName = "";
|
||||
if (group.PostId != null && workPosts.ContainsKey(group.PostId.ToString()))
|
||||
{
|
||||
workPostName = workPosts[group.PostId.ToString()];
|
||||
}
|
||||
row["WorkPostName"] = workPostName;
|
||||
row["WorkPostId"] = group.PostId ?? (object)DBNull.Value;
|
||||
|
||||
// 每日数量填充
|
||||
foreach (var kvp in group.DailyCounts)
|
||||
{
|
||||
string dateColumnId = kvp.Key.ToString("yyyy-MM-dd");
|
||||
|
||||
// 确保列存在
|
||||
if (GridTable.Columns.Contains(dateColumnId))
|
||||
{
|
||||
row[dateColumnId] = kvp.Value;
|
||||
}
|
||||
}
|
||||
|
||||
// 设置累计数量
|
||||
row["TotalCount"] = group.TotalCount;
|
||||
|
||||
GridTable.Rows.Add(row);
|
||||
}
|
||||
|
||||
Grid1.DataSource = GridTable;
|
||||
Grid1.DataBind();
|
||||
// 计算汇总数据
|
||||
OutputSummaryData();
|
||||
}
|
||||
|
||||
#region 计算合计
|
||||
|
||||
/// <summary>
|
||||
/// 计算合计
|
||||
/// </summary>
|
||||
private void OutputSummaryData()
|
||||
{
|
||||
// 创建用于存储合计值的对象
|
||||
JObject summary = new JObject();
|
||||
|
||||
// 设置固定列的合计值
|
||||
summary.Add("UnitName", "合计");
|
||||
|
||||
// 计算TotalCount列的合计值
|
||||
int totalCountSum = 0;
|
||||
foreach (DataRow row in GridTable.Rows)
|
||||
{
|
||||
if (row["TotalCount"] != DBNull.Value && row["TotalCount"] != null)
|
||||
{
|
||||
int value;
|
||||
if (int.TryParse(row["TotalCount"].ToString(), out value))
|
||||
{
|
||||
totalCountSum += value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
summary.Add("TotalCount", totalCountSum.ToString());
|
||||
|
||||
// 计算日期列的合计值
|
||||
foreach (DataColumn column in GridTable.Columns)
|
||||
{
|
||||
// 检查是否为日期列(格式为 yyyy-MM-dd)
|
||||
DateTime date;
|
||||
if (DateTime.TryParseExact(column.ColumnName, "yyyy-MM-dd", null,
|
||||
System.Globalization.DateTimeStyles.None, out date))
|
||||
{
|
||||
// 计算该列的合计值
|
||||
int columnSum = 0;
|
||||
foreach (DataRow row in GridTable.Rows)
|
||||
{
|
||||
if (row[column.ColumnName] != DBNull.Value && row[column.ColumnName] != null)
|
||||
{
|
||||
int value;
|
||||
if (int.TryParse(row[column.ColumnName].ToString(), out value))
|
||||
{
|
||||
columnSum += value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
summary.Add(column.ColumnName, columnSum.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
// 设置汇总数据
|
||||
Grid1.SummaryData = summary;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GV 数据操作
|
||||
|
||||
/// <summary>
|
||||
/// 分页
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||||
{
|
||||
this.Grid1.PageIndex = e.NewPageIndex;
|
||||
this.BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
||||
{
|
||||
this.Grid1.SortDirection = e.SortDirection;
|
||||
this.Grid1.SortField = e.SortField;
|
||||
this.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);
|
||||
this.BindGrid();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 数据查询
|
||||
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
/// <param name="button"></param>
|
||||
/// <returns></returns>
|
||||
protected void btnQuery_OnClick(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 统计图表
|
||||
/// </summary>
|
||||
/// <param name="button"></param>
|
||||
/// <returns></returns>
|
||||
protected void btnGetChart_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(UnitId) && !string.IsNullOrEmpty(StartTime) && !string.IsNullOrEmpty(EndTime))
|
||||
{
|
||||
// 构建基础URL参数
|
||||
string urlParams = string.Format("UnitId={0}&StartTime={1}&EndTime={2}", UnitId, StartTime, EndTime);
|
||||
|
||||
// 添加岗位参数(如果已选择)
|
||||
if (drpWorkPost.SelectedValue != Const._Null && !string.IsNullOrEmpty(drpWorkPost.SelectedValue))
|
||||
{
|
||||
urlParams += "&WorkPostId=" + drpWorkPost.SelectedValue;
|
||||
}
|
||||
|
||||
PageContext.RegisterStartupScript(
|
||||
Window2.GetShowReference(string.Format("ManPowerWorkChart.aspx?{0}", urlParams), "人力计划图表"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("请先选确保时间范围已设置", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 关闭弹出窗
|
||||
|
||||
/// <summary>
|
||||
/// 关闭弹出窗
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 导出按钮
|
||||
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
Response.ClearContent();
|
||||
string filename = Funs.GetNewFileName();
|
||||
Response.AddHeader("content-disposition",
|
||||
"attachment; filename=" +
|
||||
System.Web.HttpUtility.UrlEncode("现场考勤人力表" + filename, System.Text.Encoding.UTF8) + ".xls");
|
||||
Response.ContentType = "application/excel";
|
||||
Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||||
this.BindGrid();
|
||||
// 生成并写入Excel表格
|
||||
Response.Write(GetGridTableHtml(Grid1));
|
||||
Response.End();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出方法 - 支持多级表头
|
||||
/// </summary>
|
||||
/// <param name="grid"></param>
|
||||
/// <returns></returns>
|
||||
/// <summary>
|
||||
private string GetGridTableHtml(Grid grid)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
MultiHeaderTable mht = new MultiHeaderTable();
|
||||
mht.ResolveMultiHeaderTable(grid.Columns);
|
||||
|
||||
sb.Append("<meta http-equiv=\"Content-Type\" content=\"application/vnd.ms-excel;charset=utf-8\"/>");
|
||||
sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
|
||||
|
||||
// 生成多级表头
|
||||
foreach (List<object[]> rows in mht.MultiTable)
|
||||
{
|
||||
sb.Append("<tr>");
|
||||
foreach (object[] cell in rows)
|
||||
{
|
||||
int rowspan = 1;
|
||||
int colspan = Convert.ToInt32(cell[1]);
|
||||
GridColumn column = cell[2] as GridColumn;
|
||||
|
||||
// 对于锁定列(固定列),确保rowspan为3
|
||||
if (column.Locked)
|
||||
{
|
||||
rowspan = 3;
|
||||
}
|
||||
|
||||
sb.AppendFormat("<th{0}{1}{2}>{3}</th>",
|
||||
" rowspan=\"" + rowspan + "\"",
|
||||
colspan != 1 ? " colspan=\"" + colspan + "\"" : "",
|
||||
colspan != 1 ? " style=\"text-align:center;\"" : "",
|
||||
column.HeaderText);
|
||||
}
|
||||
|
||||
sb.Append("</tr>");
|
||||
}
|
||||
|
||||
// 生成数据行
|
||||
foreach (GridRow row in grid.Rows)
|
||||
{
|
||||
sb.Append("<tr>");
|
||||
|
||||
foreach (GridColumn column in mht.Columns)
|
||||
{
|
||||
string html = row.Values[column.ColumnIndex].ToString();
|
||||
|
||||
// 特殊处理固定列
|
||||
if (column.ColumnID == "UnitName")
|
||||
{
|
||||
html = row.Values[column.ColumnIndex].ToString();
|
||||
}
|
||||
else if (column.ColumnID == "WorkPostName")
|
||||
{
|
||||
html = row.Values[column.ColumnIndex].ToString();
|
||||
}
|
||||
else if (column.ColumnID == "TotalCount")
|
||||
{
|
||||
html = row.Values[column.ColumnIndex].ToString();
|
||||
}
|
||||
// 处理日期列(格式为 yyyy-MM-dd)
|
||||
else if (DateTime.TryParseExact(column.ColumnID, "yyyy-MM-dd", null,
|
||||
System.Globalization.DateTimeStyles.None, out _))
|
||||
{
|
||||
html = row.Values[column.ColumnIndex].ToString();
|
||||
}
|
||||
|
||||
sb.AppendFormat("<td>{0}</td>", html);
|
||||
}
|
||||
|
||||
sb.Append("</tr>");
|
||||
}
|
||||
|
||||
// 添加合计行
|
||||
if (grid.SummaryData != null)
|
||||
{
|
||||
sb.Append("<tr style=\"font-weight:bold;\">");
|
||||
|
||||
foreach (GridColumn column in mht.Columns)
|
||||
{
|
||||
string summaryValue = "";
|
||||
// 检查SummaryData中是否有该列的合计值
|
||||
if (grid.SummaryData.Properties().Any(p => p.Name == column.ColumnID))
|
||||
{
|
||||
var property = grid.SummaryData.Properties().FirstOrDefault(p => p.Name == column.ColumnID);
|
||||
if (property != null)
|
||||
{
|
||||
summaryValue = property.Value.ToString();
|
||||
}
|
||||
}
|
||||
else if (column.ColumnID == "UnitName")
|
||||
{
|
||||
summaryValue = "合计";
|
||||
}
|
||||
|
||||
sb.AppendFormat("<td>{0}</td>", summaryValue);
|
||||
}
|
||||
|
||||
sb.Append("</tr>");
|
||||
}
|
||||
|
||||
sb.Append("</table>");
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
|
||||
#region 多表头处理
|
||||
|
||||
/// <summary>
|
||||
/// 处理多表头的类
|
||||
/// </summary>
|
||||
public class MultiHeaderTable
|
||||
{
|
||||
// 包含 rowspan,colspan 的多表头,方便生成 HTML 的 table 标签
|
||||
public List<List<object[]>> MultiTable = new List<List<object[]>>();
|
||||
|
||||
// 最终渲染的列数组
|
||||
public List<GridColumn> Columns = new List<GridColumn>();
|
||||
|
||||
public void ResolveMultiHeaderTable(GridColumnCollection columns)
|
||||
{
|
||||
List<object[]> row = new List<object[]>();
|
||||
foreach (GridColumn column in columns)
|
||||
{
|
||||
object[] cell = new object[4];
|
||||
cell[0] = 1; // rowspan
|
||||
cell[1] = 1; // colspan
|
||||
cell[2] = column;
|
||||
cell[3] = null;
|
||||
|
||||
row.Add(cell);
|
||||
}
|
||||
|
||||
ResolveMultiTable(row, 0);
|
||||
ResolveColumns(row);
|
||||
}
|
||||
|
||||
private void ResolveColumns(List<object[]> row)
|
||||
{
|
||||
foreach (object[] cell in row)
|
||||
{
|
||||
GroupField groupField = cell[2] as GroupField;
|
||||
if (groupField != null && groupField.Columns.Count > 0)
|
||||
{
|
||||
List<object[]> subrow = new List<object[]>();
|
||||
foreach (GridColumn column in groupField.Columns)
|
||||
{
|
||||
subrow.Add(new object[]
|
||||
{
|
||||
1,
|
||||
1,
|
||||
column,
|
||||
groupField
|
||||
});
|
||||
}
|
||||
|
||||
ResolveColumns(subrow);
|
||||
}
|
||||
else
|
||||
{
|
||||
Columns.Add(cell[2] as GridColumn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ResolveMultiTable(List<object[]> row, int level)
|
||||
{
|
||||
List<object[]> nextrow = new List<object[]>();
|
||||
|
||||
foreach (object[] cell in row)
|
||||
{
|
||||
GroupField groupField = cell[2] as GroupField;
|
||||
if (groupField != null && groupField.Columns.Count > 0)
|
||||
{
|
||||
// 如果当前列包含子列,则更改当前列的 colspan,以及增加父列(向上递归)的colspan
|
||||
cell[1] = Convert.ToInt32(groupField.Columns.Count);
|
||||
PlusColspan(level - 1, cell[3] as GridColumn, groupField.Columns.Count - 1);
|
||||
|
||||
foreach (GridColumn column in groupField.Columns)
|
||||
{
|
||||
nextrow.Add(new object[]
|
||||
{
|
||||
1,
|
||||
1,
|
||||
column,
|
||||
groupField
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果当前列不包含子列,但不是最末级列(不是叶子节点),则增加rowspan
|
||||
if (level > 0)
|
||||
{
|
||||
cell[0] = level + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MultiTable.Add(row);
|
||||
|
||||
if (nextrow.Count > 0)
|
||||
{
|
||||
ResolveMultiTable(nextrow, level + 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void PlusColspan(int level, GridColumn column, int colspan)
|
||||
{
|
||||
if (level < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (List<object[]> rows in MultiTable)
|
||||
{
|
||||
foreach (object[] cells in rows)
|
||||
{
|
||||
if (cells[2] == column)
|
||||
{
|
||||
cells[1] = Convert.ToInt32(cells[1]) + colspan;
|
||||
|
||||
PlusColspan(level - 1, cells[3] as GridColumn, colspan);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,152 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.JDGL.SGManPower
|
||||
{
|
||||
|
||||
|
||||
public partial class ManPowerWorkGrid
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// Panel3 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel3;
|
||||
|
||||
/// <summary>
|
||||
/// panelCenterRegion 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel panelCenterRegion;
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar4 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar4;
|
||||
|
||||
/// <summary>
|
||||
/// drpWorkPost 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpWorkPost;
|
||||
|
||||
/// <summary>
|
||||
/// btnQuery 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnQuery;
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// btnGetChart 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnGetChart;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarSeparator1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarText1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarText ToolbarText1;
|
||||
|
||||
/// <summary>
|
||||
/// ddlPageSize 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList ddlPageSize;
|
||||
|
||||
/// <summary>
|
||||
/// Window1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window1;
|
||||
|
||||
/// <summary>
|
||||
/// Window2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window2;
|
||||
}
|
||||
}
|
|
@ -1412,6 +1412,9 @@ namespace Model
|
|||
partial void InsertJDGL_QuantityList(JDGL_QuantityList instance);
|
||||
partial void UpdateJDGL_QuantityList(JDGL_QuantityList instance);
|
||||
partial void DeleteJDGL_QuantityList(JDGL_QuantityList instance);
|
||||
partial void InsertJDGL_SGManPower(JDGL_SGManPower instance);
|
||||
partial void UpdateJDGL_SGManPower(JDGL_SGManPower instance);
|
||||
partial void DeleteJDGL_SGManPower(JDGL_SGManPower instance);
|
||||
partial void InsertJDGL_SteelStructureCompletion(JDGL_SteelStructureCompletion instance);
|
||||
partial void UpdateJDGL_SteelStructureCompletion(JDGL_SteelStructureCompletion instance);
|
||||
partial void DeleteJDGL_SteelStructureCompletion(JDGL_SteelStructureCompletion instance);
|
||||
|
@ -6544,6 +6547,14 @@ namespace Model
|
|||
}
|
||||
}
|
||||
|
||||
public System.Data.Linq.Table<JDGL_SGManPower> JDGL_SGManPower
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetTable<JDGL_SGManPower>();
|
||||
}
|
||||
}
|
||||
|
||||
public System.Data.Linq.Table<JDGL_SteelStructureCompletion> JDGL_SteelStructureCompletion
|
||||
{
|
||||
get
|
||||
|
@ -228031,6 +228042,308 @@ namespace Model
|
|||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.JDGL_SGManPower")]
|
||||
public partial class JDGL_SGManPower : INotifyPropertyChanging, INotifyPropertyChanged
|
||||
{
|
||||
|
||||
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
|
||||
|
||||
private string _Id;
|
||||
|
||||
private string _ProjectId;
|
||||
|
||||
private string _UnitId;
|
||||
|
||||
private string _UnitWorkId;
|
||||
|
||||
private string _WorkPostId;
|
||||
|
||||
private string _Version;
|
||||
|
||||
private System.Nullable<int> _Quantity;
|
||||
|
||||
private System.Nullable<System.DateTime> _PlanDate;
|
||||
|
||||
private string _CompileMan;
|
||||
|
||||
private System.Nullable<System.DateTime> _CompileTime;
|
||||
|
||||
private string _Remarks;
|
||||
|
||||
#region 可扩展性方法定义
|
||||
partial void OnLoaded();
|
||||
partial void OnValidate(System.Data.Linq.ChangeAction action);
|
||||
partial void OnCreated();
|
||||
partial void OnIdChanging(string value);
|
||||
partial void OnIdChanged();
|
||||
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 OnVersionChanging(string value);
|
||||
partial void OnVersionChanged();
|
||||
partial void OnQuantityChanging(System.Nullable<int> value);
|
||||
partial void OnQuantityChanged();
|
||||
partial void OnPlanDateChanging(System.Nullable<System.DateTime> value);
|
||||
partial void OnPlanDateChanged();
|
||||
partial void OnCompileManChanging(string value);
|
||||
partial void OnCompileManChanged();
|
||||
partial void OnCompileTimeChanging(System.Nullable<System.DateTime> value);
|
||||
partial void OnCompileTimeChanged();
|
||||
partial void OnRemarksChanging(string value);
|
||||
partial void OnRemarksChanged();
|
||||
#endregion
|
||||
|
||||
public JDGL_SGManPower()
|
||||
{
|
||||
OnCreated();
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Id", DbType="NVarChar(50) NOT NULL", CanBeNull=false, IsPrimaryKey=true)]
|
||||
public string Id
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Id;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._Id != value))
|
||||
{
|
||||
this.OnIdChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._Id = value;
|
||||
this.SendPropertyChanged("Id");
|
||||
this.OnIdChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[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="_Version", DbType="NVarChar(50)")]
|
||||
public string Version
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Version;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._Version != value))
|
||||
{
|
||||
this.OnVersionChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._Version = value;
|
||||
this.SendPropertyChanged("Version");
|
||||
this.OnVersionChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Quantity", DbType="Int")]
|
||||
public System.Nullable<int> Quantity
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Quantity;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._Quantity != value))
|
||||
{
|
||||
this.OnQuantityChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._Quantity = value;
|
||||
this.SendPropertyChanged("Quantity");
|
||||
this.OnQuantityChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PlanDate", DbType="DateTime")]
|
||||
public System.Nullable<System.DateTime> PlanDate
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._PlanDate;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._PlanDate != value))
|
||||
{
|
||||
this.OnPlanDateChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._PlanDate = value;
|
||||
this.SendPropertyChanged("PlanDate");
|
||||
this.OnPlanDateChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompileMan", DbType="NVarChar(50)")]
|
||||
public string CompileMan
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._CompileMan;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._CompileMan != value))
|
||||
{
|
||||
this.OnCompileManChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._CompileMan = value;
|
||||
this.SendPropertyChanged("CompileMan");
|
||||
this.OnCompileManChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompileTime", DbType="DateTime")]
|
||||
public System.Nullable<System.DateTime> CompileTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._CompileTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._CompileTime != value))
|
||||
{
|
||||
this.OnCompileTimeChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._CompileTime = value;
|
||||
this.SendPropertyChanged("CompileTime");
|
||||
this.OnCompileTimeChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Remarks", DbType="NVarChar(500)")]
|
||||
public string Remarks
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Remarks;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._Remarks != value))
|
||||
{
|
||||
this.OnRemarksChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._Remarks = value;
|
||||
this.SendPropertyChanged("Remarks");
|
||||
this.OnRemarksChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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.JDGL_SteelStructureCompletion")]
|
||||
public partial class JDGL_SteelStructureCompletion : INotifyPropertyChanging, INotifyPropertyChanged
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue