提交代码

This commit is contained in:
2024-03-28 10:14:38 +08:00
parent 1791d28bde
commit 7a938af201
82 changed files with 13644 additions and 144 deletions
@@ -14,7 +14,7 @@
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="开车绩效记录" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="TestRunPerformanceMonthReportId" EnableColumnLines="true" DataIDField="TestRunPerformanceMonthReportId"
runat="server" BoxFlex="1" DataKeyNames="TestRunMonthSummaryReportId" EnableColumnLines="true" DataIDField="TestRunMonthSummaryReportId"
AllowSorting="true" SortField="Year" SortDirection="DESC" OnSort="Grid1_Sort" ForceFit="true"
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True">
@@ -9,9 +9,195 @@ namespace FineUIPro.Web.ZHGL.TestRunPerformance
{
public partial class TestRunMonthSummaryReport : PageBase
{
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Funs.DropDownPageSize(this.ddlPageSize);
if (this.CurrUser != null && this.CurrUser.PageSize.HasValue)
{
Grid1.PageSize = this.CurrUser.PageSize.Value;
}
this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
// 绑定表格
this.BindGrid();
////权限按钮方法
this.GetButtonPower();
}
}
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
string strSql = @"SELECT performance.TestRunMonthSummaryReportId,performance.Year,performance.UserId,performance.CompileDate,Users.UserName "
+ @" From dbo.ZHGL_TestRunMonthSummaryReport AS performance"
+ @" LEFT JOIN Sys_User AS Users ON Users.UserId=performance.UserId"
+ @" WHERE 1=1";
List<SqlParameter> listStr = new List<SqlParameter>();
if (this.CurrUser.UserId != BLL.Const.sysglyId && this.CurrUser.UserId != BLL.Const.hfnbdId)
{
strSql += " AND performance.UserId = @UserId";
listStr.Add(new SqlParameter("@UserId", this.CurrUser.UserId));
}
if (!string.IsNullOrEmpty(this.txtUserName.Text.Trim()))
{
strSql += " AND UserName LIKE @UserName";
listStr.Add(new SqlParameter("@UserName", "%" + this.txtUserName.Text.Trim() + "%"));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
}
#region
/// <summary>
/// 分页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid();
}
/// <summary>
/// 分页显示条数下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
BindGrid();
}
#endregion
#region
/// <summary>
/// 批量删除数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
var performance = TestRunMonthSummaryReportService.GetTestRunMonthSummaryReportById(rowID);
if (performance != null)
{
BLL.TestRunMonthSummaryReportService.DeleteTestRunMonthSummaryReportById(rowID);
}
}
BindGrid();
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
}
else
{
ShowNotify("请至少选中一行!", MessageBoxIcon.Warning);
}
}
#endregion
protected void btnNew_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TestRunMonthSummaryReportEdit.aspx", "编辑 - ")));
}
#region
/// <summary>
/// 编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
string Id = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TestRunMonthSummaryReportEdit.aspx?TestRunMonthSummaryReportId={0}", Id, "编辑 - ")));
}
/// <summary>
/// Grid行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnMenuEdit_Click(null, null);
}
#endregion
#region
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TextBox_TextChanged(object sender, EventArgs e)
{
this.BindGrid();
}
#endregion
#region
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower()
{
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.TestRunMonthSummaryReportMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnAdd))
{
this.btnNew.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnModify))
{
this.btnMenuEdit.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnDelete))
{
this.btnMenuDelete.Hidden = false;
}
}
}
#endregion
protected void Window1_Close(object sender, EventArgs e)
{
BindGrid();
}
}
}
@@ -0,0 +1,65 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestRunMonthSummaryReportEdit.aspx.cs" Inherits="FineUIPro.Web.ZHGL.TestRunPerformance.TestRunMonthSummaryReportEdit" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.f-grid-row.noEdit {
pointer-events: none;
}
.f-grid-colheader-text {
white-space: normal;
word-break: break-all;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="" BoxFlex="1" AllowColumnLocking="true"
runat="server" EnableCollapse="true" DataKeyNames="Id" EnableTree="true" EnableColumnLines="true"
DataIDField="Id">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server">
<Items>
<f:DropDownList runat="server" ID="drpUser" Label="开车人员" LabelWidth="100px" LabelAlign="Right" AutoPostBack="true" OnSelectedIndexChanged="drpUser_SelectedIndexChanged"></f:DropDownList>
<f:DatePicker runat="server" Label="年份" ID="txtYear" LabelWidth="100px" LabelAlign="Right" DisplayType="Year" DateFormatString="yyyy" AutoPostBack="true" OnTextChanged="drpUser_SelectedIndexChanged"></f:DatePicker>
<f:TextBox runat="server" ID="hdId" Hidden="true"></f:TextBox>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存"
OnClick="btnSave_Click">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:BoundField Width="60px" ColumnID="Code" DataField="Code" HeaderTextAlign="Center"
HeaderText="序号" />
<f:BoundField Width="200px" ColumnID="ProjectName" DataField="ProjectName" HeaderText="项目名称/项目号或本部" TextAlign="Center" />
<f:BoundField Width="100px" ColumnID="ProcessName" DataField="ProcessName" HeaderText="工序名称" TextAlign="Center" />
<f:RenderField Width="100px" ColumnID="RaiseDate" DataField="RaiseDate"
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderText="提出时间"
HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="300px" ColumnID="ProblemDescription" DataField="ProblemDescription"
FieldType="String" HeaderText="问题描述" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="300px" ColumnID="HandleMethod" DataField="HandleMethod" ExpandUnusedSpace="true"
FieldType="String" HeaderText="处理方法" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="300px" ColumnID="ExperienceOrSuggestion" DataField="ExperienceOrSuggestion"
FieldType="String" HeaderText="体会或建议" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
</Columns>
</f:Grid>
</Items>
</f:Panel>
</form>
</body>
</html>
@@ -0,0 +1,246 @@
using BLL;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.ZHGL.TestRunPerformance
{
public partial class TestRunMonthSummaryReportEdit : PageBase
{
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string Id = Request.Params["TestRunMonthSummaryReportId"];
Model.SGGLDB db = Funs.DB;
var userIds = (from x in db.Person_TestRunMonthSummary select x.UserId).Distinct().ToList();
var users = from x in db.Sys_User where userIds.Contains(x.UserId) select x;
this.drpUser.DataTextField = "UserName";
this.drpUser.DataValueField = "UserId";
this.drpUser.DataSource = users;
this.drpUser.DataBind();
Funs.FineUIPleaseSelect(this.drpUser);
this.drpUser.SelectedValue = this.CurrUser.UserId;
Model.ZHGL_TestRunMonthSummaryReport report = BLL.TestRunMonthSummaryReportService.GetTestRunMonthSummaryReportById(Id);
if (report != null)
{
if (!string.IsNullOrEmpty(report.UserId))
{
this.drpUser.SelectedValue = report.UserId;
}
if (report.Year != null)
{
this.txtYear.Text = report.Year.ToString();
}
if (this.drpUser.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.txtYear.Text.Trim()))
{
BindGrid();
}
}
}
}
#endregion
private void BindGrid()
{
Model.SGGLDB db = Funs.DB;
DateTime startDate = Convert.ToDateTime(this.txtYear.Text + "-01" + "-01");
DateTime endDate = startDate.AddYears(1);
var projects = from x in db.Base_Project select x;
var getTestRunMonthSummarys = (from x in db.Person_TestRunMonthSummary
join y in db.Sys_User on x.UserId equals y.UserId
where x.UserId == this.drpUser.SelectedValue && x.RaiseDate >= startDate && x.RaiseDate < endDate
orderby x.ProjectId
select new { x.TestRunMonthSummaryId, x.ProjectId, x.UserId, y.UserName, x.ProcessName, x.RaiseDate, x.ProblemDescription, x.HandleMethod, x.ExperienceOrSuggestion }).ToList();
if (getTestRunMonthSummarys.Count() > 0)
{
DataTable table = new DataTable();
DateTime startMonth;
List<DateTime> months = new List<DateTime>();
startMonth = startDate;
do
{
months.Add(startMonth);
startMonth = startMonth.AddMonths(1);
} while (startMonth < endDate);
table.Columns.Add(new DataColumn("Id", typeof(String)));
table.Columns.Add(new DataColumn("Code", typeof(String)));
table.Columns.Add(new DataColumn("ProjectName", typeof(String)));
table.Columns.Add(new DataColumn("ProcessName", typeof(String)));
table.Columns.Add(new DataColumn("RaiseDate", typeof(String)));
table.Columns.Add(new DataColumn("ProblemDescription", typeof(String)));
table.Columns.Add(new DataColumn("HandleMethod", typeof(String)));
table.Columns.Add(new DataColumn("ExperienceOrSuggestion", typeof(String)));
DataRow row;
int a = 1;
for (int i = 0; i < months.Count; i++)
{
row = table.NewRow();
row["Id"] = i;
row["Code"] = GetNum(i + 1);
row["ProjectName"] = months[i].Year + "年" + months[i].Month + "月份开车技术总结";
DateTime monthEndDate = months[i].AddMonths(1);
var monthList = getTestRunMonthSummarys.Where(x => x.RaiseDate >= months[i] && x.RaiseDate < monthEndDate).OrderBy(x => x.RaiseDate);
table.Rows.Add(row);
a = 1;
string projectName = string.Empty;
foreach (var item in monthList)
{
row = table.NewRow();
row["Id"] = SQLHelper.GetNewID();
var project = projects.FirstOrDefault(x => x.ProjectId == item.ProjectId);
if (project != null)
{
if (string.IsNullOrEmpty(projectName) || projectName != project.ProjectName)
{
row["ProjectName"] = project.ProjectName;
projectName = row["ProjectName"].ToString();
}
}
else
{
if (string.IsNullOrEmpty(projectName) || projectName != "本部")
{
row["ProjectName"] = "本部";
projectName = row["ProjectName"].ToString();
}
}
row["ProcessName"] = item.ProcessName;
row["RaiseDate"] = item.RaiseDate;
row["ProblemDescription"] = item.ProblemDescription;
row["HandleMethod"] = item.HandleMethod;
row["ExperienceOrSuggestion"] = item.ExperienceOrSuggestion;
table.Rows.Add(row);
a++;
}
}
//rows = rows.Substring(0, rows.Length - 1);
this.Grid1.DataSource = table;
this.Grid1.DataBind();
}
}
private string GetNum(int i)
{
string num = string.Empty;
if (i == 1)
{
num = "一";
}
else if (i == 2)
{
num = "二";
}
else if (i == 3)
{
num = "三";
}
else if (i == 4)
{
num = "四";
}
else if (i == 5)
{
num = "五";
}
else if (i == 6)
{
num = "六";
}
else if (i == 7)
{
num = "七";
}
else if (i == 8)
{
num = "八";
}
else if (i == 9)
{
num = "九";
}
else if (i == 10)
{
num = "十";
}
else if (i == 11)
{
num = "十一";
}
else if (i == 12)
{
num = "十二";
}
return num;
}
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (this.drpUser.SelectedValue == BLL.Const._Null)
{
Alert.ShowInTop("请选择开车人员!", MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(this.txtYear.Text.Trim()))
{
Alert.ShowInTop("请选择年份!", MessageBoxIcon.Warning);
return;
}
Save();
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
private void Save()
{
string TestRunMonthSummaryReportId = Request.Params["TestRunMonthSummaryReportId"];
Model.ZHGL_TestRunMonthSummaryReport newItem = new Model.ZHGL_TestRunMonthSummaryReport();
newItem.Year = Funs.GetNewInt(this.txtYear.Text.Trim());
newItem.UserId = this.drpUser.SelectedValue;
newItem.CompileMan = this.CurrUser.UserId;
newItem.CompileDate = DateTime.Now;
if (string.IsNullOrEmpty(TestRunMonthSummaryReportId))
{
newItem.TestRunMonthSummaryReportId = SQLHelper.GetNewID();
BLL.TestRunMonthSummaryReportService.AddTestRunMonthSummaryReport(newItem);
BLL.LogService.AddSys_Log(this.CurrUser, newItem.Year.ToString(), newItem.TestRunMonthSummaryReportId, BLL.Const.TestRunMonthSummaryReportMenuId, "增加开车月技术总结!");
}
else
{
newItem.TestRunMonthSummaryReportId = TestRunMonthSummaryReportId;
BLL.TestRunMonthSummaryReportService.UpdateTestRunMonthSummaryReport(newItem);
BLL.LogService.AddSys_Log(this.CurrUser, newItem.Year.ToString(), newItem.TestRunMonthSummaryReportId, BLL.Const.TestRunMonthSummaryReportMenuId, "修改开车月技术总结!");
}
}
#endregion
protected void drpUser_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.drpUser.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.txtYear.Text.Trim()))
{
BindGrid();
}
else
{
this.Grid1.DataSource = null;
this.Grid1.DataBind();
}
}
}
}
@@ -0,0 +1,96 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.ZHGL.TestRunPerformance {
public partial class TestRunMonthSummaryReportEdit {
/// <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>
/// Grid1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// Toolbar2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// drpUser 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpUser;
/// <summary>
/// txtYear 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtYear;
/// <summary>
/// hdId 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox hdId;
/// <summary>
/// btnSave 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSave;
}
}
@@ -66,16 +66,6 @@ namespace FineUIPro.Web.ZHGL.TestRunPerformance
IQueryable<Model.Person_BusinessTrip> getTrips = from x in db.Person_BusinessTrip
where x.UserId == this.drpUser.SelectedValue && x.LeaveDate >= startDate && x.ArriveDate < endDate
select x;
IQueryable<Model.View_WBS_CostControlParentDetail> getParentDetails = from x in db.View_WBS_CostControlParentDetail select x;
IQueryable<Model.Wbs_WbsSet> getWbsSets = from x in db.Wbs_WbsSet select x;
IQueryable<Model.WBS_WbsSetInit> getWbsSetInits = from x in db.WBS_WbsSetInit select x;
IQueryable<Model.Wbs_UnitProject> getUnitProjects = from x in db.Wbs_UnitProject select x;
IQueryable<Model.Wbs_UnitProjectInit> getUnitProjectInits = from x in db.Wbs_UnitProjectInit select x;
IQueryable<Model.WBS_CnProfession> getCnProfessions = from x in db.WBS_CnProfession select x;
IQueryable<Model.WBS_CnProfessionInit> getCnProfessionInits = from x in db.WBS_CnProfessionInit select x;
IQueryable<Model.Project_Installation> getInstallations = from x in db.Project_Installation select x;
IQueryable<Model.View_WBS_CostControlDetailStatistics> getCostControlDetailStatisticss = from x in db.View_WBS_CostControlDetailStatistics select x;
List<Model.View_WBS_CostControlDetailStatistics> CostControlDetailStatisticsList = new List<Model.View_WBS_CostControlDetailStatistics>();
if (getTestRunPerformances.Count() > 0)
{
DataTable table = new DataTable();
@@ -545,13 +535,13 @@ namespace FineUIPro.Web.ZHGL.TestRunPerformance
{
newItem.TestRunPerformanceMonthReportId = SQLHelper.GetNewID();
BLL.TestRunPerformanceMonthReportService.AddTestRunPerformanceMonthReport(newItem);
BLL.LogService.AddSys_Log(this.CurrUser, newItem.Year.ToString(), newItem.TestRunPerformanceMonthReportId, BLL.Const.ControlItemInitSetMenuId, "增加试车绩效报告!");
BLL.LogService.AddSys_Log(this.CurrUser, newItem.Year.ToString(), newItem.TestRunPerformanceMonthReportId, BLL.Const.TestRunPerformanceMonthReportMenuId, "增加试车绩效报告!");
}
else
{
newItem.TestRunPerformanceMonthReportId = TestRunPerformanceMonthReportId;
BLL.TestRunPerformanceMonthReportService.UpdateTestRunPerformanceMonthReport(newItem);
BLL.LogService.AddSys_Log(this.CurrUser, newItem.Year.ToString(), newItem.TestRunPerformanceMonthReportId, BLL.Const.ControlItemInitSetMenuId, "修改试车绩效报告!");
BLL.LogService.AddSys_Log(this.CurrUser, newItem.Year.ToString(), newItem.TestRunPerformanceMonthReportId, BLL.Const.TestRunPerformanceMonthReportMenuId, "修改试车绩效报告!");
}
}
#endregion