From 0e6ee801349cb2f9fb205e24de7a516bb14746e6 Mon Sep 17 00:00:00 2001 From: gaofei1985 <181547018@qq.com> Date: Mon, 10 Jul 2023 15:00:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E6=8A=A5=E9=9B=86?= =?UTF-8?q?=E5=9B=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BLL/JDGL/WBS/WorkloadStatisticsService.cs | 330 +++++++++--------- SGGL/BLL/WebService/CNCECHSSEWebService.cs | 1 + SGGL/BLL/ZHGL/DataSync/ServerService.cs | 3 + .../SysManage/SysConstSet.aspx.cs | 2 + 4 files changed, 173 insertions(+), 163 deletions(-) diff --git a/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs b/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs index 640adfea..427ca372 100644 --- a/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs +++ b/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs @@ -2787,7 +2787,7 @@ namespace BLL if (wbsSet != null) { list.Add(wbsSetId); - GetAllWbsIds(list,wbsSet.SuperWbsSetId); + GetAllWbsIds(list, wbsSet.SuperWbsSetId); } } @@ -2822,17 +2822,7 @@ namespace BLL } } - private static IQueryable getCostControls = from x in db.WBS_CostControl select x; - private static IQueryable getDetails = from x in db.View_WBS_CostControlDetail select x; - private static IQueryable getParentDetails = from x in db.View_WBS_CostControlParentDetail select x; - private static IQueryable getWbsSets = from x in db.Wbs_WbsSet select x; - private static IQueryable getWbsSetInits = from x in db.WBS_WbsSetInit select x; - private static IQueryable getUnitProjects = from x in db.Wbs_UnitProject select x; - private static IQueryable getUnitProjectInits = from x in db.Wbs_UnitProjectInit select x; - private static IQueryable getCnProfessions = from x in db.WBS_CnProfession select x; - private static IQueryable getCnProfessionInits = from x in db.WBS_CnProfessionInit select x; - private static IQueryable getInstallations = from x in db.Project_Installation select x; - private static IQueryable getCostControlDetailStatisticss = from x in db.View_WBS_CostControlDetailStatistics select x; + /// @@ -2841,178 +2831,192 @@ namespace BLL /// public static DataTable GetAllTreeDataTable(string projectId, string IsOut) { - List CostControlDetailStatisticsList = new List(); - DataTable table = new DataTable(); - var installation = Funs.DB.Project_Installation.FirstOrDefault(x => x.SuperInstallationId == "0" && x.ProjectId == projectId); - if (installation != null) + using (var db = new Model.SGGLDB(Funs.ConnString)) { - DateTime startDate, endDate, startMonth, endMonth; - List months = new List(); - if (installation.StartDate != null && installation.EndDate != null) + IQueryable getCostControls = from x in db.WBS_CostControl select x; + IQueryable getDetails = from x in db.View_WBS_CostControlDetail select x; + IQueryable getParentDetails = from x in db.View_WBS_CostControlParentDetail select x; + IQueryable getWbsSets = from x in db.Wbs_WbsSet select x; + IQueryable getWbsSetInits = from x in db.WBS_WbsSetInit select x; + IQueryable getUnitProjects = from x in db.Wbs_UnitProject select x; + IQueryable getUnitProjectInits = from x in db.Wbs_UnitProjectInit select x; + IQueryable getCnProfessions = from x in db.WBS_CnProfession select x; + IQueryable getCnProfessionInits = from x in db.WBS_CnProfessionInit select x; + IQueryable getInstallations = from x in db.Project_Installation select x; + IQueryable getCostControlDetailStatisticss = from x in db.View_WBS_CostControlDetailStatistics select x; + List CostControlDetailStatisticsList = new List(); + DataTable table = new DataTable(); + var installation = db.Project_Installation.FirstOrDefault(x => x.SuperInstallationId == "0" && x.ProjectId == projectId); + if (installation != null) { - startDate = Convert.ToDateTime(installation.StartDate); - endDate = Convert.ToDateTime(installation.EndDate); - startMonth = Convert.ToDateTime(startDate.Year + "-" + startDate.Month + "-01"); - endMonth = Convert.ToDateTime(endDate.Year + "-" + endDate.Month + "-01"); - do + DateTime startDate, endDate, startMonth, endMonth; + List months = new List(); + if (installation.StartDate != null && installation.EndDate != null) { - months.Add(startMonth); - startMonth = startMonth.AddMonths(1); - } while (startMonth <= endMonth); - } - - table.Columns.Add(new DataColumn("Id", typeof(String))); - table.Columns.Add(new DataColumn("SupId", typeof(String))); - table.Columns.Add(new DataColumn("Name", typeof(String))); - table.Columns.Add(new DataColumn("ProjectId", typeof(String))); - table.Columns.Add(new DataColumn("Unit", typeof(String))); - table.Columns.Add(new DataColumn("TotalNum", typeof(String))); - table.Columns.Add(new DataColumn("RealPrice", typeof(String))); - table.Columns.Add(new DataColumn("PlanPrice", typeof(String))); - table.Columns.Add(new DataColumn("PlanStartDate", typeof(DateTime))); - table.Columns.Add(new DataColumn("PlanEndDate", typeof(DateTime))); - table.Columns.Add(new DataColumn("RealStartDate", typeof(DateTime))); - table.Columns.Add(new DataColumn("RealEndDate", typeof(DateTime))); - for (int i = 0; i < months.Count; i++) - { - table.Columns.Add(new DataColumn("PlanNum" + (i + 1).ToString(), typeof(String))); - table.Columns.Add(new DataColumn("ThisNum" + (i + 1).ToString(), typeof(String))); - } - 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(); - 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); + startDate = Convert.ToDateTime(installation.StartDate); + endDate = Convert.ToDateTime(installation.EndDate); + startMonth = Convert.ToDateTime(startDate.Year + "-" + startDate.Month + "-01"); + endMonth = Convert.ToDateTime(endDate.Year + "-" + endDate.Month + "-01"); + do + { + months.Add(startMonth); + startMonth = startMonth.AddMonths(1); + } while (startMonth <= endMonth); } - else + + table.Columns.Add(new DataColumn("Id", typeof(String))); + table.Columns.Add(new DataColumn("SupId", typeof(String))); + table.Columns.Add(new DataColumn("Name", typeof(String))); + table.Columns.Add(new DataColumn("ProjectId", typeof(String))); + table.Columns.Add(new DataColumn("Unit", typeof(String))); + table.Columns.Add(new DataColumn("TotalNum", typeof(String))); + table.Columns.Add(new DataColumn("RealPrice", typeof(String))); + table.Columns.Add(new DataColumn("PlanPrice", typeof(String))); + table.Columns.Add(new DataColumn("PlanStartDate", typeof(DateTime))); + table.Columns.Add(new DataColumn("PlanEndDate", typeof(DateTime))); + table.Columns.Add(new DataColumn("RealStartDate", typeof(DateTime))); + table.Columns.Add(new DataColumn("RealEndDate", typeof(DateTime))); + for (int i = 0; i < months.Count; i++) { - AddDetailOut(newList, CostControlDetailStatisticsList, item.Id, string.Empty); + table.Columns.Add(new DataColumn("PlanNum" + (i + 1).ToString(), typeof(String))); + table.Columns.Add(new DataColumn("ThisNum" + (i + 1).ToString(), typeof(String))); } - } - 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) + 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(); + var installationList = CostControlDetailStatisticsList.Where(x => x.WBSType == "Installation" && x.SupId == "0"); + foreach (var item in installationList) { - row[4] = costControl.Unit;//单位 - if (costControl.TotalNum != null) + newList.Add(item); + if (string.IsNullOrEmpty(IsOut)) { - row[5] = decimal.Round(Convert.ToDecimal(costControl.TotalNum), 2);//合同工作量 + AddDetail(newList, CostControlDetailStatisticsList, item.Id); } - if (costControl.RealPrice != null) + else { - row[6] = decimal.Round(Convert.ToDecimal(costControl.RealPrice), 2);//成本单价 + AddDetailOut(newList, CostControlDetailStatisticsList, item.Id, string.Empty); } - if (costControl.PlanPrice != null) + } + 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[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[4] = costControl.Unit;//单位 + if (costControl.TotalNum != null) { - row[12 + index * 2] = decimal.Round(Convert.ToDecimal(item1.PlanNum), 2); + row[5] = decimal.Round(Convert.ToDecimal(costControl.TotalNum), 2);//合同工作量 } - if (item1.ThisNum != 0) + if (costControl.RealPrice != null) { - row[13 + index * 2] = decimal.Round(Convert.ToDecimal(item1.ThisNum), 2); + 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); + } + } + //for (int i = 0; i < months.Count; i++) + //{ + // Model.View_WBS_CostControlDetail detail = details.FirstOrDefault(x => x.CostControlId == item.Id && x.Months == months[i]); + // if (detail != null) + // { + // if (detail.PlanNum != 0) + // { + // row[12 + i * 2] = decimal.Round(Convert.ToDecimal(detail.PlanNum), 2); + // } + // if (detail.ThisNum != 0) + // { + // row[13 + i * 2] = decimal.Round(Convert.ToDecimal(detail.ThisNum), 2); + // } + // } + //} + row[14 + (months.Count - 1) * 2] = item.Id; + //row[10] = decimal.Round(Convert.ToDecimal(detail.ThisRealCost), 2);//本月实际成本 + //row[11] = decimal.Round(Convert.ToDecimal(detail.ThisPlanValue), 2);//本月计划完成预算 + //row[12] = decimal.Round(Convert.ToDecimal(detail.ThisPlanCost), 2);//本月完成预算 + //row[13] = decimal.Round(Convert.ToDecimal(detail.TotalPlanNum), 2);//累计计划完成量 + //row[14] = decimal.Round(Convert.ToDecimal(detail.TotalThisNum), 2);//累计完成量 + //row[15] = decimal.Round(Convert.ToDecimal(detail.TotalRealCost), 2);//累计完成成本 + //row[16] = decimal.Round(Convert.ToDecimal(detail.TotalPlanValue), 2);//累计计划完成预算 + //row[17] = decimal.Round(Convert.ToDecimal(detail.TotalPlanCost), 2);//累计完成预算 } - //for (int i = 0; i < months.Count; i++) - //{ - // Model.View_WBS_CostControlDetail detail = details.FirstOrDefault(x => x.CostControlId == item.Id && x.Months == months[i]); - // if (detail != null) - // { - // if (detail.PlanNum != 0) - // { - // row[12 + i * 2] = decimal.Round(Convert.ToDecimal(detail.PlanNum), 2); - // } - // if (detail.ThisNum != 0) - // { - // row[13 + i * 2] = decimal.Round(Convert.ToDecimal(detail.ThisNum), 2); - // } - // } - //} - row[14 + (months.Count - 1) * 2] = item.Id; - //row[10] = decimal.Round(Convert.ToDecimal(detail.ThisRealCost), 2);//本月实际成本 - //row[11] = decimal.Round(Convert.ToDecimal(detail.ThisPlanValue), 2);//本月计划完成预算 - //row[12] = decimal.Round(Convert.ToDecimal(detail.ThisPlanCost), 2);//本月完成预算 - //row[13] = decimal.Round(Convert.ToDecimal(detail.TotalPlanNum), 2);//累计计划完成量 - //row[14] = decimal.Round(Convert.ToDecimal(detail.TotalThisNum), 2);//累计完成量 - //row[15] = decimal.Round(Convert.ToDecimal(detail.TotalRealCost), 2);//累计完成成本 - //row[16] = decimal.Round(Convert.ToDecimal(detail.TotalPlanValue), 2);//累计计划完成预算 - //row[17] = decimal.Round(Convert.ToDecimal(detail.TotalPlanCost), 2);//累计完成预算 + else + { + //Model.View_WBS_CostControlParentDetail parentDetail = parentDetails.FirstOrDefault(x => x.ParentId == item.Id && x.Months == months); + //if (parentDetail != null) + //{ + // row[10] = decimal.Round(Convert.ToDecimal(parentDetail.ThisRealCost), 2);//本月实际成本 + // row[11] = decimal.Round(Convert.ToDecimal(parentDetail.ThisPlanValue), 2);//本月计划完成预算 + // row[12] = decimal.Round(Convert.ToDecimal(parentDetail.ThisPlanCost), 2);//本月完成预算 + // row[15] = decimal.Round(Convert.ToDecimal(parentDetail.TotalRealCost), 2);//累计完成成本 + // row[16] = decimal.Round(Convert.ToDecimal(parentDetail.TotalPlanValue), 2);//累计计划完成预算 + // row[17] = decimal.Round(Convert.ToDecimal(parentDetail.TotalPlanCost), 2);//累计完成预算 + //} + //else + //{ + // Model.View_WBS_CostControlParentDetail parentLastDetail = parentDetails.OrderByDescending(x => x.Months).FirstOrDefault(x => x.ParentId == item.Id); + // if (parentLastDetail != null && parentLastDetail.Months <= months) + // { + // row[15] = decimal.Round(Convert.ToDecimal(parentLastDetail.TotalRealCost), 2);//累计完成成本 + // row[16] = decimal.Round(Convert.ToDecimal(parentLastDetail.TotalPlanValue), 2);//累计计划完成预算 + // row[17] = decimal.Round(Convert.ToDecimal(parentLastDetail.TotalPlanCost), 2);//累计完成预算 + // } + //} + } + table.Rows.Add(row); } - else - { - //Model.View_WBS_CostControlParentDetail parentDetail = parentDetails.FirstOrDefault(x => x.ParentId == item.Id && x.Months == months); - //if (parentDetail != null) - //{ - // row[10] = decimal.Round(Convert.ToDecimal(parentDetail.ThisRealCost), 2);//本月实际成本 - // row[11] = decimal.Round(Convert.ToDecimal(parentDetail.ThisPlanValue), 2);//本月计划完成预算 - // row[12] = decimal.Round(Convert.ToDecimal(parentDetail.ThisPlanCost), 2);//本月完成预算 - // row[15] = decimal.Round(Convert.ToDecimal(parentDetail.TotalRealCost), 2);//累计完成成本 - // row[16] = decimal.Round(Convert.ToDecimal(parentDetail.TotalPlanValue), 2);//累计计划完成预算 - // row[17] = decimal.Round(Convert.ToDecimal(parentDetail.TotalPlanCost), 2);//累计完成预算 - //} - //else - //{ - // Model.View_WBS_CostControlParentDetail parentLastDetail = parentDetails.OrderByDescending(x => x.Months).FirstOrDefault(x => x.ParentId == item.Id); - // if (parentLastDetail != null && parentLastDetail.Months <= months) - // { - // row[15] = decimal.Round(Convert.ToDecimal(parentLastDetail.TotalRealCost), 2);//累计完成成本 - // row[16] = decimal.Round(Convert.ToDecimal(parentLastDetail.TotalPlanValue), 2);//累计计划完成预算 - // row[17] = decimal.Round(Convert.ToDecimal(parentLastDetail.TotalPlanCost), 2);//累计完成预算 - // } - //} - } - table.Rows.Add(row); } + return table; } - return table; } } diff --git a/SGGL/BLL/WebService/CNCECHSSEWebService.cs b/SGGL/BLL/WebService/CNCECHSSEWebService.cs index 4b730a04..90f6befc 100644 --- a/SGGL/BLL/WebService/CNCECHSSEWebService.cs +++ b/SGGL/BLL/WebService/CNCECHSSEWebService.cs @@ -47,6 +47,7 @@ var client = new RestClient(baseurl); client.Timeout = -1; var request = new RestRequest(Method.POST); + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; request.AddHeader("Content-Type", "multipart/form-data");//注意头部必须是form-data // client.UserAgent = "apifox/1.0.0 (https://www.apifox.cn)"; //request.AddFile("file", @"E:\微信\WeChat\WeChat Files\wxid_9140361403112\FileStorage\File\2022-08\焊接管理尾项20220809.docx"); diff --git a/SGGL/BLL/ZHGL/DataSync/ServerService.cs b/SGGL/BLL/ZHGL/DataSync/ServerService.cs index 35047713..14ee45b7 100644 --- a/SGGL/BLL/ZHGL/DataSync/ServerService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ServerService.cs @@ -4,6 +4,7 @@ using RestSharp; using System; using System.Collections.Generic; using System.Linq; +using System.Net; using System.Security.Policy; using System.Text; using System.Threading.Tasks; @@ -20,6 +21,7 @@ namespace BLL var client = new RestClient(baseurl); client.Timeout = -1; var request = new RestRequest(Method.POST); + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; var thisUnit = UnitService.GetUnitByUnitId(Const.UnitId_CWCEC); request.AddParameter("UnitName", thisUnit.UnitName); request.AddParameter("CollCropCode", thisUnit.CollCropCode); @@ -54,6 +56,7 @@ namespace BLL var client = new RestClient(baseurl); client.Timeout = -1; var request = new RestRequest(Method.POST); + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; var tokenItem = GetToken(); request.AddHeader("token", tokenItem.Token); request.AddJsonBody(JsonBody); diff --git a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs index 0c0a5173..0ae23761 100644 --- a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs +++ b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs @@ -8,6 +8,7 @@ using BLL; using Newtonsoft.Json; using RestSharp; using Model; +using System.Net; namespace FineUIPro.Web.SysManage { @@ -970,6 +971,7 @@ namespace FineUIPro.Web.SysManage var client = new RestClient(baseurl); client.Timeout = -1; var request = new RestRequest(Method.POST); + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; var thisUnit = BLL.UnitService.GetUnitByUnitId(BLL.Const.UnitId_CWCEC); request.AddParameter("UnitName", thisUnit.UnitName); request.AddParameter("CollCropCode", thisUnit.CollCropCode);