20230303新增清除工作经历重复功能按钮

This commit is contained in:
杨红卫 2023-03-03 14:58:36 +08:00
parent ffc4cb849e
commit f42d330b00
7 changed files with 148 additions and 14 deletions

View File

@ -51,6 +51,9 @@
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" Text="导出" Icon="FolderUp"
EnableAjax="false" DisableControlBeforePostBack="false">
</f:Button>
<f:Button ID="btnResetItem" Text="清理工作经历" Icon="ArrowRefresh" runat="server"
Hidden="true" OnClick="btnResetItem_Click" AjaxLoadingText="清理工作经历中....." AjaxLoadingType="Default">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>

View File

@ -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<Model.SitePerson_PersonItem> getDelte = new List<Model.SitePerson_PersonItem>();
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);
}
}
}
}

View File

@ -140,6 +140,15 @@ namespace FineUIPro.Web.Person
/// </remarks>
protected global::FineUIPro.Button btnOut;
/// <summary>
/// btnResetItem 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnResetItem;
/// <summary>
/// lblNumber 控件。
/// </summary>

View File

@ -141,7 +141,6 @@
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="drpTeamGroup" runat="server" Label="班组" EnableEdit="true"
@ -341,6 +340,16 @@
</f:TextBox>
</Items>
</f:FormRow>
<%-- <f:FormRow>
<Items>
<f:Button ID="btnAttachUrl2" Text="保险" ToolTip="保险查看" Icon="TableCell" runat="server"
OnClick="btnAttachUrl2_Click" ValidateForms="SimpleForm1" MarginLeft="5px">
</f:Button>
<f:Button ID="btnAttachUrl3" Text="体检证明" ToolTip="体检证明查看" Icon="TableCell" runat="server"
OnClick="btnAttachUrl3_Click" ValidateForms="SimpleForm1" MarginLeft="5px">
</f:Button>
</Items>
</f:FormRow>--%>
</Rows>
</f:Form>
</Items>
@ -587,6 +596,10 @@
<f:Window ID="Window1" Title="编辑信息" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="1000px"
Height="600px">
</f:Window>
<f:Window ID="WindowAtt" Title="附件" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px"
Height="500px">
</f:Window>
<f:Menu ID="MenuCertificate" runat="server">
<f:MenuButton ID="btnCertificateEdit" OnClick="btnCertificateEdit_Click" EnablePostBack="true"

View File

@ -1310,5 +1310,32 @@ namespace FineUIPro.Web.Person
}
#endregion
#endregion
///// <summary>
///// 上传附件
///// </summary>
///// <param name="sender"></param>
///// <param name="e"></param>
//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)));
//}
///// <summary>
///// 上传附件
///// </summary>
///// <param name="sender"></param>
///// <param name="e"></param>
//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)));
//}
}
}

View File

@ -941,6 +941,15 @@ namespace FineUIPro.Web.Person
/// </remarks>
protected global::FineUIPro.Window Window1;
/// <summary>
/// WindowAtt 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window WindowAtt;
/// <summary>
/// MenuCertificate 控件。
/// </summary>

View File

@ -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