diff --git a/SGGL/FineUIPro.Web/Personal/TestRunPerformance.aspx.cs b/SGGL/FineUIPro.Web/Personal/TestRunPerformance.aspx.cs index 362d5110..2c7c370e 100644 --- a/SGGL/FineUIPro.Web/Personal/TestRunPerformance.aspx.cs +++ b/SGGL/FineUIPro.Web/Personal/TestRunPerformance.aspx.cs @@ -36,7 +36,7 @@ namespace FineUIPro.Web.Personal /// private void BindGrid() { - string strSql = @"SELECT performance.TestRunPerformanceId,performance.ProjectId,performance.UserId,performance.Months,performance.JobContent,performance.TestRunPerformanceStandardId,Users.UserName,case when performance.ProjectId='0' then '本部' else Project.ProjectName end as ProjectName,Standard.Type,Standard.Item,Standard.Unit,Standard.Days " + string strSql = @"SELECT performance.TestRunPerformanceId,performance.ProjectId,performance.UserId,performance.Months,performance.JobContent,performance.TestRunPerformanceStandardId,Users.UserName,case when performance.ProjectId='0' then '本部' else Project.ProjectName end as ProjectName,Standard.Type,Standard.Item,Standard.Unit,performance.Days " + @" From dbo.Person_TestRunPerformance AS performance" + @" LEFT JOIN Sys_User AS Users ON Users.UserId=performance.UserId" + @" LEFT JOIN Base_Project AS Project ON Project.ProjectId=performance.ProjectId" diff --git a/SGGL/FineUIPro.Web/Web.config b/SGGL/FineUIPro.Web/Web.config index 90e05489..56282e91 100644 --- a/SGGL/FineUIPro.Web/Web.config +++ b/SGGL/FineUIPro.Web/Web.config @@ -12,8 +12,7 @@ - - + diff --git a/SGGL/FineUIPro.Web/ZHGL/TestRunPerformance/TestRunPerformanceMonthReportEdit.aspx b/SGGL/FineUIPro.Web/ZHGL/TestRunPerformance/TestRunPerformanceMonthReportEdit.aspx index 37cdf526..6ad76329 100644 --- a/SGGL/FineUIPro.Web/ZHGL/TestRunPerformance/TestRunPerformanceMonthReportEdit.aspx +++ b/SGGL/FineUIPro.Web/ZHGL/TestRunPerformance/TestRunPerformanceMonthReportEdit.aspx @@ -136,9 +136,21 @@ + + + + diff --git a/SGGL/FineUIPro.Web/ZHGL/TestRunPerformance/TestRunPerformanceMonthReportEdit.aspx.cs b/SGGL/FineUIPro.Web/ZHGL/TestRunPerformance/TestRunPerformanceMonthReportEdit.aspx.cs index 8a396bd0..337d5cca 100644 --- a/SGGL/FineUIPro.Web/ZHGL/TestRunPerformance/TestRunPerformanceMonthReportEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/ZHGL/TestRunPerformance/TestRunPerformanceMonthReportEdit.aspx.cs @@ -60,7 +60,8 @@ namespace FineUIPro.Web.ZHGL.TestRunPerformance var getTestRunPerformances = (from x in db.Person_TestRunPerformance join y in db.Base_TestRunPerformanceStandard on x.TestRunPerformanceStandardId equals y.TestRunPerformanceStandardId where x.UserId == this.drpUser.SelectedValue && x.Months >= startDate && x.Months < endDate - select new { x.Months, x.ProjectId, x.JobContent, y.Type, y.Item, y.Unit, y.Days }).ToList(); + orderby x.ProjectId + select new { x.Months, x.ProjectId, x.JobContent, y.Type, y.Item, y.Unit, x.Days, y.Code1 }).ToList(); IQueryable getTrips = from x in db.Person_BusinessTrip where x.UserId == this.drpUser.SelectedValue && x.LeaveDate >= startDate && x.ArriveDate < endDate select x; @@ -126,10 +127,131 @@ namespace FineUIPro.Web.ZHGL.TestRunPerformance table.Columns.Add(new DataColumn("OtherTripDays", typeof(String))); table.Columns.Add(new DataColumn("SumDays1", typeof(String))); table.Columns.Add(new DataColumn("SumDays3", typeof(String))); + DataRow row; + row = table.NewRow(); + //row["Id"] = SQLHelper.GetNewID(); + row["Id"] = "AAA"; + row["ProjectName"] = "年度累计数据"; + row["Item1"] = getTestRunPerformances.Where(x => x.Type == "部门基础工作").Sum(x => x.Days ?? 0); + row["Item2"] = getTestRunPerformances.Where(x => x.Type == "公司培训").Sum(x => x.Days ?? 0); + row["Item3"] = getTestRunPerformances.Where(x => x.Type == "项目投标").Sum(x => x.Days ?? 0); + row["Item4"] = getTestRunPerformances.Where(x => x.Type == "开车策划").Sum(x => x.Days ?? 0); + row["Item5"] = getTestRunPerformances.Where(x => x.Type == "开车培训").Sum(x => x.Days ?? 0); + row["Item6"] = getTestRunPerformances.Where(x => x.Type == "合同管理").Sum(x => x.Days ?? 0); + row["Item7"] = getTestRunPerformances.Where(x => x.Type == "预试车").Sum(x => x.Days ?? 0); + row["Item8"] = getTestRunPerformances.Where(x => x.Type == "试车").Sum(x => x.Days ?? 0); + row["Item9"] = getTestRunPerformances.Where(x => x.Type == "试运行及考核").Sum(x => x.Days ?? 0); + row["Item10"] = getTestRunPerformances.Where(x => x.Type == "开车收尾").Sum(x => x.Days ?? 0); + row["Item11"] = getTestRunPerformances.Where(x => x.Type == "项目协调").Sum(x => x.Days ?? 0); + row["Item12"] = getTestRunPerformances.Where(x => x.Type == "其他").Sum(x => x.Days ?? 0); + + double sumDaysA = 0, sumDays1A = 0, SumDays3A = 0; + foreach (var item in getTestRunPerformances) + { + bool isForeign = false; + var project = projects.FirstOrDefault(x => x.ProjectId == item.ProjectId); + if (project != null) + { + if (project.IsForeign == true) + { + isForeign = true; + } + } + if (isForeign) //境外项目 + { + if (item.Code1 != 1 && item.Code1 != 2 && item.Code1 != 12) + { + sumDaysA += item.Days * 1.2 ?? 0; + if (item.Code1 == 3) + { + SumDays3A += item.Days * 1.2 ?? 0; + } + } + else + { + sumDaysA += item.Days ?? 0; + if (item.Code1 == 3) + { + SumDays3A += item.Days ?? 0; + } + } + } + else + { + sumDaysA += item.Days ?? 0; + if (item.Code1 == 3) + { + SumDays3A += item.Days ?? 0; + } + } + if (item.Code1 == 1) + { + sumDays1A += item.Days ?? 0; + } + } + row["SumDays"] = sumDaysA; + row["SumDays1"] = sumDays1A; + row["SumDays3"] = SumDays3A; + int projectTripDaysA = 0; + var monthProjectTripsA = getTrips.Where(x => x.Type == "1"); + foreach (var item in monthProjectTripsA) + { + if (item.ArriveDate < startDate) + { + if (item.LeaveDate == null || item.LeaveDate >= endDate) + { + projectTripDaysA += (endDate - startDate).Days; + } + else + { + projectTripDaysA += (item.LeaveDate.Value - startDate).Days + 1; + } + } + else + { + if (item.LeaveDate == null || item.LeaveDate >= endDate) + { + projectTripDaysA += (endDate - item.ArriveDate.Value).Days; + } + else + { + projectTripDaysA += (item.LeaveDate.Value - item.ArriveDate.Value).Days + 1; + } + } + } + int otherTripDaysA = 0; + var monthOtherTripsA = getTrips.Where(x => x.Type == "2"); + foreach (var item in monthOtherTripsA) + { + if (item.ArriveDate < startDate) + { + if (item.LeaveDate == null || item.LeaveDate >= endDate) + { + otherTripDaysA += (endDate - startDate).Days; + } + else + { + otherTripDaysA += (item.LeaveDate.Value - startDate).Days + 1; + } + } + else + { + if (item.LeaveDate == null || item.LeaveDate >= endDate) + { + otherTripDaysA += (endDate - item.ArriveDate.Value).Days; + } + else + { + otherTripDaysA += (item.LeaveDate.Value - item.ArriveDate.Value).Days + 1; + } + } + } + row["ProjectTripDays"] = projectTripDaysA; + row["OtherTripDays"] = otherTripDaysA; + table.Rows.Add(row); int a = 1; for (int i = 0; i < months.Count; i++) { - DataRow row; row = table.NewRow(); row["Id"] = SQLHelper.GetNewID(); row["Code"] = GetNum(i + 1); @@ -146,20 +268,130 @@ namespace FineUIPro.Web.ZHGL.TestRunPerformance row["Item10"] = getTestRunPerformances.Where(x => x.Months == months[i] && x.Type == "开车收尾").Sum(x => x.Days ?? 0); row["Item11"] = getTestRunPerformances.Where(x => x.Months == months[i] && x.Type == "项目协调").Sum(x => x.Days ?? 0); row["Item12"] = getTestRunPerformances.Where(x => x.Months == months[i] && x.Type == "其他").Sum(x => x.Days ?? 0); - table.Rows.Add(row); var monthList = getTestRunPerformances.Where(x => x.Months == months[i]); + double sumDays = 0, sumDays1 = 0, SumDays3 = 0; + foreach (var item in monthList) + { + bool isForeign = false; + var project = projects.FirstOrDefault(x => x.ProjectId == item.ProjectId); + if (project != null) + { + if (project.IsForeign == true) + { + isForeign = true; + } + } + if (isForeign) //境外项目 + { + if (item.Code1 != 1 && item.Code1 != 2 && item.Code1 != 12) + { + sumDays += item.Days * 1.2 ?? 0; + if (item.Code1 == 3) + { + SumDays3 += item.Days * 1.2 ?? 0; + } + } + else + { + sumDays += item.Days ?? 0; + if (item.Code1 == 3) + { + SumDays3 += item.Days ?? 0; + } + } + } + else + { + sumDays += item.Days ?? 0; + if (item.Code1 == 3) + { + SumDays3 += item.Days ?? 0; + } + } + if (item.Code1 == 1) + { + sumDays1 += item.Days ?? 0; + } + } + row["SumDays"] = sumDays; + row["SumDays1"] = sumDays1; + row["SumDays3"] = SumDays3; + int projectTripDays = 0; + var monthProjectTrips = getTrips.Where(x => x.LeaveDate >= months[i] && x.ArriveDate < months[i].AddMonths(1) && x.Type == "1"); + foreach (var item in monthProjectTrips) + { + if (item.ArriveDate < months[i]) + { + if (item.LeaveDate == null || item.LeaveDate >= months[i].AddMonths(1)) + { + projectTripDays += (months[i].AddMonths(1) - months[i]).Days; + } + else + { + projectTripDays += (item.LeaveDate.Value - months[i]).Days + 1; + } + } + else + { + if (item.LeaveDate == null || item.LeaveDate >= months[i].AddMonths(1)) + { + projectTripDays += (months[i].AddMonths(1) - item.ArriveDate.Value).Days; + } + else + { + projectTripDays += (item.LeaveDate.Value - item.ArriveDate.Value).Days + 1; + } + } + } + int otherTripDays = 0; + var monthOtherTrips = getTrips.Where(x => x.LeaveDate >= months[i] && x.ArriveDate < months[i].AddMonths(1) && x.Type == "2"); + foreach (var item in monthOtherTrips) + { + if (item.ArriveDate < months[i]) + { + if (item.LeaveDate == null || item.LeaveDate >= months[i].AddMonths(1)) + { + otherTripDays += (months[i].AddMonths(1) - months[i]).Days; + } + else + { + otherTripDays += (item.LeaveDate.Value - months[i]).Days + 1; + } + } + else + { + if (item.LeaveDate == null || item.LeaveDate >= months[i].AddMonths(1)) + { + otherTripDays += (months[i].AddMonths(1) - item.ArriveDate.Value).Days; + } + else + { + otherTripDays += (item.LeaveDate.Value - item.ArriveDate.Value).Days + 1; + } + } + } + row["ProjectTripDays"] = projectTripDays; + row["OtherTripDays"] = otherTripDays; + table.Rows.Add(row); a = 1; + string projectName = string.Empty; foreach (var item in monthList) { row = table.NewRow(); row["Id"] = SQLHelper.GetNewID(); row["Code"] = a; + bool isForeign = false; var project = projects.FirstOrDefault(x => x.ProjectId == item.ProjectId); if (project != null) { - row["ProjectName"] = project.ProjectName; + if (string.IsNullOrEmpty(projectName) || projectName != project.ProjectName) + { + row["ProjectName"] = project.ProjectName; + projectName = row["ProjectName"].ToString(); + } if (project.IsForeign == true) { + isForeign = true; row["IsForeign"] = "是"; } else @@ -169,129 +401,55 @@ namespace FineUIPro.Web.ZHGL.TestRunPerformance } else { - row["ProjectName"] = "本部"; + if (string.IsNullOrEmpty(projectName) || projectName != "本部") + { + row["ProjectName"] = "本部"; + projectName = row["ProjectName"].ToString(); + } row["IsForeign"] = "否"; } row["JobContent"] = item.JobContent; - - - - + row["Item" + item.Code1.ToString()] = item.Item; + row["Unit" + item.Code1.ToString()] = item.Unit; + if (table.Columns.Contains("Days" + item.Code1.ToString()) && item.Unit.Contains("手动输入")) + { + row["Days" + item.Code1.ToString()] = item.Days; + } + if (isForeign) //境外项目 + { + if (item.Code1 != 1 && item.Code1 != 2 && item.Code1 != 12) + { + row["SumDays"] = item.Days * 1.2; + } + else + { + row["SumDays"] = item.Days; + } + } + else + { + row["SumDays"] = item.Days; + } + if (item.Code1 == 1) + { + row["SumDays1"] = item.Days; + } + else + { + row["SumDays1"] = 0; + } + if (item.Code1 == 3) + { + row["SumDays3"] = item.Days; + } + else + { + row["SumDays3"] = 0; + } table.Rows.Add(row); a++; } - } - //table.Columns.Add(new DataColumn("ShowId", typeof(String))); - - //var costControls = getCostControls.Where(x => x.ProjectId == projectId); - //var details = getDetails.Where(x => x.ProjectId == projectId); - //var parentDetails = getParentDetails; - //var wbsSets = getWbsSets.Where(x => x.ProjectId == projectId); - //var wbsSetInits = getWbsSetInits; - - //var unitProjects = getUnitProjects.Where(x => x.ProjectId == projectId); - //var unitProjectInits = getUnitProjectInits; - //var cnProfessions = getCnProfessions.Where(x => x.ProjectId == projectId); - //var cnProfessionInits = getCnProfessionInits; - //var installations = getInstallations.Where(x => x.ProjectId == projectId); - - //CostControlDetailStatisticsList = getCostControlDetailStatisticss.Where(x => x.ProjectId == projectId).Distinct().ToList(); - //List newList = new List(); - //if (string.IsNullOrEmpty(Id)) //加载全项目记录 - //{ - // var installationList = CostControlDetailStatisticsList.Where(x => x.WBSType == "Installation" && x.SupId == "0"); - // foreach (var item in installationList) - // { - // newList.Add(item); - // if (string.IsNullOrEmpty(IsOut)) - // { - // AddDetail(newList, CostControlDetailStatisticsList, item.Id); - // } - // else - // { - // AddDetailOut(newList, CostControlDetailStatisticsList, item.Id, string.Empty); - // } - // } - //} - //else //加载选择节点及其子级 - //{ - // var node = CostControlDetailStatisticsList.FirstOrDefault(x => x.Id == Id); - // if (node != null) - // { - // newList.Add(node); - // if (string.IsNullOrEmpty(IsOut)) - // { - // AddDetail(newList, CostControlDetailStatisticsList, node.Id); - // } - // else - // { - // AddDetailOut(newList, CostControlDetailStatisticsList, node.Id, string.Empty); - // } - // } - //} - //DataRow row; - //foreach (Model.View_WBS_CostControlDetailStatistics item in newList) - //{ - // row = table.NewRow(); - // row[0] = item.Id; - // row[1] = item.SupId; - // row[2] = item.Name; - // row[3] = item.ProjectId; - // Model.WBS_CostControl costControl = costControls.FirstOrDefault(x => x.CostControlId == item.Id); - // if (costControl != null) - // { - // row[4] = costControl.Unit;//单位 - // if (costControl.TotalNum != null) - // { - // row[5] = decimal.Round(Convert.ToDecimal(costControl.TotalNum), 2);//合同工作量 - // } - // if (costControl.RealPrice != null) - // { - // row[6] = decimal.Round(Convert.ToDecimal(costControl.RealPrice), 2);//成本单价 - // } - // if (costControl.PlanPrice != null) - // { - // row[7] = decimal.Round(Convert.ToDecimal(costControl.PlanPrice), 2);//控制预算单价 - // } - // if (costControl.PlanStartDate != null) - // { - // row[8] = costControl.PlanStartDate;//计划开始时间 - // } - // if (costControl.PlanEndDate != null) - // { - // row[9] = costControl.PlanEndDate;//计划完成时间 - // } - // if (costControl.RealStartDate != null) - // { - // row[10] = costControl.RealStartDate;//实际开始时间 - // } - // if (costControl.RealEndDate != null) - // { - // row[11] = costControl.RealEndDate;//实际完成时间 - // } - // var detail = details.Where(x => x.CostControlId == item.Id).ToList(); - // foreach (var item1 in detail) - // { - // var index = months.FindIndex(x => x.Equals(item1.Months)); - // if (item1.PlanNum != 0) - // { - // row[12 + index * 2] = decimal.Round(Convert.ToDecimal(item1.PlanNum), 2); - // } - // if (item1.ThisNum != 0) - // { - // row[13 + index * 2] = decimal.Round(Convert.ToDecimal(item1.ThisNum), 2); - // } - - // } - // row[14 + (months.Count - 1) * 2] = item.Id; - // } - // else - // { - - // } - // table.Rows.Add(row); - //} this.Grid1.DataSource = table; this.Grid1.DataBind(); } @@ -359,14 +517,41 @@ namespace FineUIPro.Web.ZHGL.TestRunPerformance /// 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.GetHideReference()); + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } private void Save() { - + string TestRunPerformanceMonthReportId = Request.Params["TestRunPerformanceMonthReportId"]; + Model.ZHGL_TestRunPerformanceMonthReport newItem = new Model.ZHGL_TestRunPerformanceMonthReport(); + 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(TestRunPerformanceMonthReportId)) + { + newItem.TestRunPerformanceMonthReportId = SQLHelper.GetNewID(); + BLL.TestRunPerformanceMonthReportService.AddTestRunPerformanceMonthReport(newItem); + BLL.LogService.AddSys_Log(this.CurrUser, newItem.Year.ToString(), newItem.TestRunPerformanceMonthReportId, BLL.Const.ControlItemInitSetMenuId, "增加试车绩效报告!"); + } + else + { + newItem.TestRunPerformanceMonthReportId = TestRunPerformanceMonthReportId; + BLL.TestRunPerformanceMonthReportService.UpdateTestRunPerformanceMonthReport(newItem); + BLL.LogService.AddSys_Log(this.CurrUser, newItem.Year.ToString(), newItem.TestRunPerformanceMonthReportId, BLL.Const.ControlItemInitSetMenuId, "修改试车绩效报告!"); + } } #endregion diff --git a/SGGL/FineUIPro.Web/bin.rar b/SGGL/FineUIPro.Web/bin.rar deleted file mode 100644 index 36329031..00000000 Binary files a/SGGL/FineUIPro.Web/bin.rar and /dev/null differ diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index db57033c..bb27d5c1 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -22,7 +22,7 @@ namespace Model using System; - public partial class SGGLDB : System.Data.Linq.DataContext + public partial class SGGLDB_WH : System.Data.Linq.DataContext { private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource(); @@ -2596,25 +2596,25 @@ namespace Model partial void DeleteZHGL_WorkHandoverDetail(ZHGL_WorkHandoverDetail instance); #endregion - public SGGLDB(string connection) : + public SGGLDB_WH(string connection) : base(connection, mappingSource) { OnCreated(); } - public SGGLDB(System.Data.IDbConnection connection) : + public SGGLDB_WH(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public SGGLDB(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public SGGLDB_WH(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public SGGLDB(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public SGGLDB_WH(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); diff --git a/SGGL/SgManager.AI/SgManager.AI.csproj b/SGGL/SgManager.AI/SgManager.AI.csproj index 6e58277e..83e8a86a 100644 --- a/SGGL/SgManager.AI/SgManager.AI.csproj +++ b/SGGL/SgManager.AI/SgManager.AI.csproj @@ -35,7 +35,7 @@ ..\packages\Baidu.AI.4.15.9\lib\net45\AipSdk.dll - bin\AOP.Common.dll + bin\Debug\AOP.Common.dll ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll