From 9838978a8c7c7bb2d89727384a855ef3754cf5f1 Mon Sep 17 00:00:00 2001 From: gaofei1985 <181547018@qq.com> Date: Tue, 25 Jul 2023 17:32:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=9A=E7=9B=9B=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=92=8C=E8=BF=9B=E5=BA=A6=E5=BD=95=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SGGL/BLL/BoSheng/BOSHENGMonitorService.cs | 59 ++++++++++++++----- .../BLL/JDGL/WBS/WorkloadStatisticsService.cs | 35 ++++++++--- SGGL/BLL/SysManage/UnitService.cs | 16 +++++ .../JDGL/WBS/WorkloadInput.aspx.cs | 9 +-- .../JDGL/WBS/WorkloadInputEditAll.aspx.cs | 3 +- .../JDGL/WBS/WorkloadInputIn.aspx.cs | 8 +-- 6 files changed, 95 insertions(+), 35 deletions(-) diff --git a/SGGL/BLL/BoSheng/BOSHENGMonitorService.cs b/SGGL/BLL/BoSheng/BOSHENGMonitorService.cs index bc18dd98..def6f804 100644 --- a/SGGL/BLL/BoSheng/BOSHENGMonitorService.cs +++ b/SGGL/BLL/BoSheng/BOSHENGMonitorService.cs @@ -19,7 +19,7 @@ namespace BLL /// public static void StartMonitor() { - int adTimeJ = 30; + int adTimeJ = 30; if (messageTimer != null) { messageTimer.Stop(); @@ -91,15 +91,15 @@ namespace BLL JArray arr = JArray.Parse(obj["Data"].ToString()); string projectId = string.Empty; ////根据传值项目主键 - var getProjectByFromProjectId = Funs.DB.Base_Project.FirstOrDefault(x => x.FromProjectId == fromprojectId && x.ProjectCode== OtherDepartId); + var getProjectByFromProjectId = Funs.DB.Base_Project.FirstOrDefault(x => x.FromProjectId == fromprojectId && x.ProjectCode == OtherDepartId); if (getProjectByFromProjectId != null) { projectId = getProjectByFromProjectId.ProjectId; } else { - - var getPByCode= Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectCode == OtherDepartId); + + var getPByCode = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectCode == OtherDepartId); if (getPByCode != null) { getPByCode.FromProjectId = fromprojectId; @@ -216,11 +216,12 @@ namespace BLL try { List insertPersons = new List(); + List insertSitePersons = new List(); foreach (var item in arr) { string getID = item["ID"].ToString(); var getPerson = db.Bo_Sheng_Person.FirstOrDefault(x => x.ID == getID); - if (!string.IsNullOrEmpty(getID) ) + if (!string.IsNullOrEmpty(getID)) { if (getPerson == null) { @@ -291,14 +292,40 @@ namespace BLL db.SubmitChanges(); } } - } + var getSitePerson = db.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == item["IdentifyID"].ToString()); + if (!string.IsNullOrEmpty(getID)) + { + if (getSitePerson == null) + { + Model.SitePerson_Person newPerson = new Model.SitePerson_Person + { + PersonId = SQLHelper.GetNewID(), + ProjectId = projectId, + PersonName = item["Name"].ToString(), + Sex = item["Sex"].ToString(), + Birthday = Funs.GetNewDateTime(item["BirthDay"].ToString()), + Address = item["Address"].ToString(), + Nation = item["Nation"].ToString(), + IdentityCard = item["IdentifyID"].ToString(), + UnitId = BLL.UnitService.GetUnitIdByUnitName(item["DepartName"].ToString()), + Telephone = item["Telephone"].ToString(), + MaritalStatus = item["MaritalStatus"].ToString(), + }; + insertSitePersons.Add(newPerson); + } + } - if (insertPersons.Count() > 0) - { - db.Bo_Sheng_Person.InsertAllOnSubmit(insertPersons); - db.SubmitChanges(); + if (insertPersons.Count() > 0) + { + db.Bo_Sheng_Person.InsertAllOnSubmit(insertPersons); + db.SubmitChanges(); + } + if (insertSitePersons.Count() > 0) + { + db.SitePerson_Person.InsertAllOnSubmit(insertSitePersons); + db.SubmitChanges(); + } } - } catch (Exception ex) { @@ -370,7 +397,7 @@ namespace BLL { db.Bo_Sheng_Unit.InsertAllOnSubmit(insertUnits); db.SubmitChanges(); - } + } } catch (Exception ex) { @@ -454,7 +481,7 @@ namespace BLL { db.Bo_Sheng_Train.InsertAllOnSubmit(insertTrains); db.SubmitChanges(); - } + } } catch (Exception ex) { @@ -541,7 +568,7 @@ namespace BLL { db.Bo_Sheng_TrainPerson.InsertAllOnSubmit(insertTrainPersons); db.SubmitChanges(); - } + } } catch (Exception ex) { @@ -612,7 +639,7 @@ namespace BLL { db.Bo_Sheng_Exam.InsertAllOnSubmit(insertExams); db.SubmitChanges(); - } + } } catch (Exception ex) { @@ -693,7 +720,7 @@ namespace BLL { db.Bo_Sheng_PersonTrainRecord.InsertAllOnSubmit(insertPersonTrainRecords); db.SubmitChanges(); - } + } } catch (Exception ex) { diff --git a/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs b/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs index 427ca372..5586385e 100644 --- a/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs +++ b/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs @@ -2829,7 +2829,7 @@ namespace BLL /// 获取模拟树表格 /// /// - public static DataTable GetAllTreeDataTable(string projectId, string IsOut) + public static DataTable GetAllTreeDataTable(string projectId, string IsOut, string Id) { using (var db = new Model.SGGLDB(Funs.ConnString)) { @@ -2897,17 +2897,36 @@ namespace BLL 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) + if (string.IsNullOrEmpty(Id)) //加载全项目记录 { - newList.Add(item); - if (string.IsNullOrEmpty(IsOut)) + var installationList = CostControlDetailStatisticsList.Where(x => x.WBSType == "Installation" && x.SupId == "0"); + foreach (var item in installationList) { - AddDetail(newList, CostControlDetailStatisticsList, item.Id); + newList.Add(item); + if (string.IsNullOrEmpty(IsOut)) + { + AddDetail(newList, CostControlDetailStatisticsList, item.Id); + } + else + { + AddDetailOut(newList, CostControlDetailStatisticsList, item.Id, string.Empty); + } } - else + } + else //加载选择节点及其子级 + { + var node = CostControlDetailStatisticsList.FirstOrDefault(x => x.Id == Id); + if (node != null) { - AddDetailOut(newList, CostControlDetailStatisticsList, item.Id, string.Empty); + newList.Add(node); + if (string.IsNullOrEmpty(IsOut)) + { + AddDetail(newList, CostControlDetailStatisticsList, node.Id); + } + else + { + AddDetailOut(newList, CostControlDetailStatisticsList, node.Id, string.Empty); + } } } DataRow row; diff --git a/SGGL/BLL/SysManage/UnitService.cs b/SGGL/BLL/SysManage/UnitService.cs index 334b02d0..dbe2aed1 100644 --- a/SGGL/BLL/SysManage/UnitService.cs +++ b/SGGL/BLL/SysManage/UnitService.cs @@ -308,6 +308,22 @@ namespace BLL return name; } + /// + /// 获取单位Id + /// + /// + /// + public static string GetUnitIdByUnitName(string unitName) + { + string name = null; + var unit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitName == unitName); + if (unit != null) + { + name = unit.UnitId; + } + return name; + } + /// /// 获取单位简称 /// diff --git a/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadInput.aspx.cs b/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadInput.aspx.cs index 98de4b7d..4697bc61 100644 --- a/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadInput.aspx.cs +++ b/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadInput.aspx.cs @@ -7,7 +7,7 @@ using System.Data.SqlClient; using System.Linq; using System.Web.UI.WebControls; -namespace FineUIPro.Web.JDGL.WBS +namespace FineUIPro.Web.JDGL.WBS { public partial class WorkloadInput : PageBase { @@ -337,11 +337,8 @@ namespace FineUIPro.Web.JDGL.WBS { if (this.trWBS.SelectedNode != null) { - if (this.trWBS.SelectedNode.CommandName != "project" && this.trWBS.SelectedNode.CommandName != "installation" && this.trWBS.SelectedNode.CommandName != "cnProfession") //非项目、装置、专业节点可以修改 - { - this.hdSelectId.Text = this.trWBS.SelectedNode.NodeID; - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WorkloadInputEdit.aspx?Id={0}", this.trWBS.SelectedNode.NodeID, "编辑 - "))); - } + this.hdSelectId.Text = this.trWBS.SelectedNode.NodeID; + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WorkloadInputEditAll.aspx?Id={0}", this.trWBS.SelectedNode.NodeID, "编辑 - "))); } else { diff --git a/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadInputEditAll.aspx.cs b/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadInputEditAll.aspx.cs index 918d4819..86afde62 100644 --- a/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadInputEditAll.aspx.cs +++ b/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadInputEditAll.aspx.cs @@ -127,7 +127,8 @@ namespace FineUIPro.Web.JDGL.WBS if (!IsPostBack) { errorInfos = string.Empty; - DataTable table = BLL.WorkloadStatisticsService.GetAllTreeDataTable(this.CurrUser.LoginProjectId, string.Empty); + string Id = Request.Params["Id"]; + DataTable table = BLL.WorkloadStatisticsService.GetAllTreeDataTable(this.CurrUser.LoginProjectId, string.Empty, Id); Grid1.DataSource = table; Grid1.DataBind(); for (int i = 0; i < this.Grid1.Rows.Count; i++) diff --git a/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadInputIn.aspx.cs b/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadInputIn.aspx.cs index b962d88c..3e6aebce 100644 --- a/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadInputIn.aspx.cs +++ b/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadInputIn.aspx.cs @@ -133,7 +133,7 @@ namespace FineUIPro.Web.JDGL.WBS errorInfos = string.Empty; this.hdFileName.Text = string.Empty; this.hdCheckResult.Text = string.Empty; - DataTable table = BLL.WorkloadStatisticsService.GetAllTreeDataTable(this.CurrUser.LoginProjectId, string.Empty); + DataTable table = BLL.WorkloadStatisticsService.GetAllTreeDataTable(this.CurrUser.LoginProjectId, string.Empty,string.Empty); Grid1.DataSource = table; Grid1.DataBind(); } @@ -153,14 +153,14 @@ namespace FineUIPro.Web.JDGL.WBS Response.ContentType = "application/excel"; Response.ContentEncoding = Encoding.UTF8; this.Grid1.Columns[ColumnNum - 1].Hidden = false; - DataTable tableOut = BLL.WorkloadStatisticsService.GetAllTreeDataTable(this.CurrUser.LoginProjectId, "Out"); + DataTable tableOut = BLL.WorkloadStatisticsService.GetAllTreeDataTable(this.CurrUser.LoginProjectId, "Out", string.Empty); Grid1.DataSource = tableOut; Grid1.DataBind(); this.Grid1.PageSize = Grid1.RecordCount; Response.Write(GetGridTableHtml2(Grid1)); Response.End(); this.Grid1.Columns[ColumnNum - 1].Hidden = true; - DataTable table = BLL.WorkloadStatisticsService.GetAllTreeDataTable(this.CurrUser.LoginProjectId, string.Empty); + DataTable table = BLL.WorkloadStatisticsService.GetAllTreeDataTable(this.CurrUser.LoginProjectId, string.Empty, string.Empty); Grid1.DataSource = table; Grid1.DataBind(); } @@ -393,7 +393,7 @@ namespace FineUIPro.Web.JDGL.WBS ImportXlsToData2(rootPath + initPath + this.hdFileName.Text); hdCheckResult.Text = string.Empty; ShowNotify("导入成功!", MessageBoxIcon.Success); - DataTable table = BLL.WorkloadStatisticsService.GetAllTreeDataTable(this.CurrUser.LoginProjectId, string.Empty); + DataTable table = BLL.WorkloadStatisticsService.GetAllTreeDataTable(this.CurrUser.LoginProjectId, string.Empty, string.Empty); Grid1.DataSource = table; Grid1.DataBind(); }