From f42d330b005f74be1b4417d40df633172218b870 Mon Sep 17 00:00:00 2001 From: yhw0507 Date: Fri, 3 Mar 2023 14:58:36 +0800 Subject: [PATCH] =?UTF-8?q?20230303=E6=96=B0=E5=A2=9E=E6=B8=85=E9=99=A4?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=BB=8F=E5=8E=86=E9=87=8D=E5=A4=8D=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SGGL/FineUIPro.Web/Person/DepartPerson.aspx | 3 + .../FineUIPro.Web/Person/DepartPerson.aspx.cs | 81 ++++++++++++++++++- .../Person/DepartPerson.aspx.designer.cs | 9 +++ .../Person/ProjectPersonEdit.aspx | 15 +++- .../Person/ProjectPersonEdit.aspx.cs | 27 +++++++ .../Person/ProjectPersonEdit.aspx.designer.cs | 9 +++ SGGL/Model/Model.cs | 18 ++--- 7 files changed, 148 insertions(+), 14 deletions(-) diff --git a/SGGL/FineUIPro.Web/Person/DepartPerson.aspx b/SGGL/FineUIPro.Web/Person/DepartPerson.aspx index dfd51b36..518ac4a8 100644 --- a/SGGL/FineUIPro.Web/Person/DepartPerson.aspx +++ b/SGGL/FineUIPro.Web/Person/DepartPerson.aspx @@ -51,6 +51,9 @@ + diff --git a/SGGL/FineUIPro.Web/Person/DepartPerson.aspx.cs b/SGGL/FineUIPro.Web/Person/DepartPerson.aspx.cs index 22fd6056..da3926d4 100644 --- a/SGGL/FineUIPro.Web/Person/DepartPerson.aspx.cs +++ b/SGGL/FineUIPro.Web/Person/DepartPerson.aspx.cs @@ -1,5 +1,7 @@ using BLL; +using Model; using System; +using System.Collections.Generic; using System.Linq; using System.Text; @@ -28,6 +30,11 @@ namespace FineUIPro.Web.Person Funs.FineUIPleaseSelect(drpPersonType, "按员工类别查询"); // 绑定表格 this.BindGrid(); + + if (this.CurrUser.PersonId == Const.sysglyId || this.CurrUser.PersonId == Const.hfnbdId) + { + this.btnResetItem.Hidden = false; + } } else { @@ -314,16 +321,82 @@ namespace FineUIPro.Web.Person return; } var getPerson = Person_PersonsService.GetPerson_PersonsById(Grid1.SelectedRowID); - if (getPerson != null && getPerson.IsPost == true && getPerson.CurrentProjectId == null) + if (getPerson != null && getPerson.IsPost == true) { - ////人员直接派遣时候 - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ProjectPersonEdit.aspx?PersonId={0}&Type=P", Grid1.SelectedRowID, "查看 - "))); + var getcuuProject = Funs.DB.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == getPerson.IdentityCard && x.States == Const.ProjectPersonStates_1); + if (getcuuProject == null || getPerson.MultiProject == true) + { + ////人员直接派遣时候 + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ProjectPersonEdit.aspx?PersonId={0}&Type=P", Grid1.SelectedRowID, "查看 - "))); + } + else + { + var getProjectName = ProjectService.GetProjectNameByProjectId(getcuuProject.ProjectId) ?? ""; + Alert.ShowInParent("当前人员已在项目:"+getProjectName+"任职,请选择不在项目的人员派遣!", MessageBoxIcon.Warning); + return; + } } else { - Alert.ShowInParent("请选择在岗且不在项目的人员派遣!", MessageBoxIcon.Warning); + Alert.ShowInParent("请选择在岗人员派遣!", MessageBoxIcon.Warning); return; } } + + protected void btnResetItem_Click(object sender, EventArgs e) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + int count = 0; + var getSitePersons = db.SitePerson_PersonItem.Where(x=>x.IdentityCard != null).Select(x => x.IdentityCard).Distinct(); + if (getSitePersons.Count() > 0) + { + foreach (var item in getSitePersons) + { + var getItems = db.SitePerson_PersonItem.Where(x => x.IdentityCard == item && x.OutTime.HasValue); + if (getItems.Count() > 0) + { + List getDelte = new List(); + foreach (var ip in getItems) + { + var a = ip.InTime; + var b = ip.OutTime; + + var getEx = getItems.FirstOrDefault(x => x.ProjectId == ip.ProjectId && x.PersonItemId != ip.PersonItemId && x.InTime <= ip.InTime && (x.OutTime > ip.OutTime || !x.OutTime.HasValue)); + if (getEx != null) + { + count++; + getDelte.Add(ip); + } + } + if (getDelte.Count() > 0) + { + db.SitePerson_PersonItem.DeleteAllOnSubmit(getDelte); + db.SubmitChanges(); + } + } + + var getProjetItems = from x in getItems + join y in db.Base_Project on x.ProjectId equals y.ProjectId + where x.OutTime > y.EndDate + select x; + if (getProjetItems.Count() > 0) + { + foreach (var pitm in getProjetItems) + { + var getP = db.Base_Project.FirstOrDefault(x => x.ProjectId == pitm.ProjectId); + if (getP != null && getP.EndDate.HasValue) + { + pitm.OutTime = getP.EndDate; + db.SubmitChanges(); + } + } + } + } + } + + Alert.ShowInParent("操作完成!共清理" + count.ToString() + "行。", MessageBoxIcon.Warning); + } + } } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/DepartPerson.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/DepartPerson.aspx.designer.cs index 38ded037..9c1a5ae5 100644 --- a/SGGL/FineUIPro.Web/Person/DepartPerson.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/Person/DepartPerson.aspx.designer.cs @@ -140,6 +140,15 @@ namespace FineUIPro.Web.Person /// protected global::FineUIPro.Button btnOut; + /// + /// btnResetItem 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnResetItem; + /// /// lblNumber 控件。 /// diff --git a/SGGL/FineUIPro.Web/Person/ProjectPersonEdit.aspx b/SGGL/FineUIPro.Web/Person/ProjectPersonEdit.aspx index f00877b0..f0ae833f 100644 --- a/SGGL/FineUIPro.Web/Person/ProjectPersonEdit.aspx +++ b/SGGL/FineUIPro.Web/Person/ProjectPersonEdit.aspx @@ -141,7 +141,6 @@ - + <%-- + + + + + + + --%> @@ -587,6 +596,10 @@ + + ///// 上传附件 + ///// + ///// + ///// + //protected void btnAttachUrl2_Click(object sender, EventArgs e) + //{ + // if (string.IsNullOrEmpty(this.PersonId)) + // { + // btnSave_Click(); + // } + // PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/PersonBaseInfo&menuId={1}&strParam=2", this.PersonId, BLL.Const.PersonListMenuId))); + //} + ///// + ///// 上传附件 + ///// + ///// + ///// + //protected void btnAttachUrl3_Click(object sender, EventArgs e) + //{ + // if (string.IsNullOrEmpty(this.PersonId)) + // { + // SaveData(); + // } + // PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/PersonBaseInfo&menuId={1}&strParam=3", this.PersonId, BLL.Const.PersonListMenuId))); + //} } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Person/ProjectPersonEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/Person/ProjectPersonEdit.aspx.designer.cs index e063f720..8449c38d 100644 --- a/SGGL/FineUIPro.Web/Person/ProjectPersonEdit.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/Person/ProjectPersonEdit.aspx.designer.cs @@ -941,6 +941,15 @@ namespace FineUIPro.Web.Person /// protected global::FineUIPro.Window Window1; + /// + /// WindowAtt 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window WindowAtt; + /// /// MenuCertificate 控件。 /// diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index beb5e8d8..ce8dcb0b 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -73403,7 +73403,7 @@ namespace Model OnCreated(); } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialCode", DbType="NVarChar(15) NOT NULL", CanBeNull=false, IsPrimaryKey=true)] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialCode", DbType="NVarChar(50) NOT NULL", CanBeNull=false, IsPrimaryKey=true)] public string MaterialCode { get @@ -73507,7 +73507,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialDef", DbType="NVarChar(3000)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialDef", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)] public string MaterialDef { get @@ -78097,7 +78097,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialCode", DbType="NVarChar(15)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialCode", DbType="NVarChar(50)")] public string MaterialCode { get @@ -82445,7 +82445,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CanWelderCode", DbType="NVarChar(200)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CanWelderCode", DbType="NVarChar(1000)")] public string CanWelderCode { get @@ -121814,7 +121814,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialName", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialName", DbType="NVarChar(100)")] public string MaterialName { get @@ -121834,7 +121834,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SpecificationAndModel", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SpecificationAndModel", DbType="NVarChar(200)")] public string SpecificationAndModel { get @@ -121854,7 +121854,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialCode", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialCode", DbType="NVarChar(100)")] public string MaterialCode { get @@ -121874,7 +121874,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Material", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Material", DbType="NVarChar(100)")] public string Material { get @@ -234659,7 +234659,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CanWelderCode", DbType="NVarChar(200)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CanWelderCode", DbType="NVarChar(1000)")] public string CanWelderCode { get