20221019 人员派遣功能实现
This commit is contained in:
@@ -22,15 +22,14 @@ namespace FineUIPro.Web.Person
|
||||
{
|
||||
Funs.DropDownPageSize(this.ddlPageSize);
|
||||
|
||||
BLL.ProjectService.InitProjectDropDownList(this.drpProject, false);
|
||||
Funs.FineUIPleaseSelect(this.drpProject, "请选择拟聘项目");
|
||||
this.btnNew.OnClientClick = Window1.GetShowReference("PersonEdit.aspx?Type=Shunt&UnitId=" + Const.UnitId_SEDIN + "&DepartId=" + Const.Depart_constructionId) + "return false;";
|
||||
|
||||
////权限按钮方法
|
||||
this.GetButtonPower();
|
||||
WorkPostService.InitWorkPostNameByTypeDropDownList2(this.drpWorkPost, "1", false); //加载管理岗位
|
||||
Funs.FineUIPleaseSelect(this.drpWorkPost, "请选择岗位");
|
||||
|
||||
WorkPostService.InitWorkPostNameByTypeDropDownList(this.drpWP, "1", true); //加载管理岗位
|
||||
//WorkPostService.InitWorkPostNameByTypeDropDownList(this.drpWP, "1", true); //加载管理岗位
|
||||
|
||||
PostTitleService.InitPostTitleDropDownList(this.drpPostTitle, false);
|
||||
Funs.FineUIPleaseSelect(this.drpPostTitle, "请选择职称");
|
||||
@@ -75,56 +74,27 @@ namespace FineUIPro.Web.Person
|
||||
/// <returns></returns>
|
||||
private void GetButtonPower()
|
||||
{
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.DepartPersonShuntMenuId);
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.DepartPersonShuntMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnSave))
|
||||
if (buttonList.Contains(BLL.Const.BtnAdd))
|
||||
{
|
||||
this.btnSure.Hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除数据
|
||||
/// <summary>
|
||||
/// 右键删除事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.DeleteData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除方法
|
||||
/// </summary>
|
||||
private void DeleteData()
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length > 0)
|
||||
{
|
||||
string strShowNotify = string.Empty;
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
BLL.Person_ShuntDetailService.DeleteShuntDetailByShuntId(rowID);
|
||||
BLL.Person_ShuntApproveService.DeleteShuntApprovesByShuntId(rowID);
|
||||
BLL.Person_ShuntService.DeleteShunt(rowID);
|
||||
}
|
||||
BindGrid();
|
||||
if (!string.IsNullOrEmpty(strShowNotify))
|
||||
{
|
||||
Alert.ShowInTop(strShowNotify, MessageBoxIcon.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
||||
this.btnNew.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnModify))
|
||||
{
|
||||
this.btnMenuEdit.Hidden = false;
|
||||
this.btnMenuDispatch.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnDelete))
|
||||
{
|
||||
this.btnMenuDelete.Hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 关闭弹出窗
|
||||
/// </summary>
|
||||
@@ -168,140 +138,6 @@ namespace FineUIPro.Web.Person
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 确定按钮事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSure_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.drpProject.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
bool b = true;
|
||||
foreach (JObject mergedRow in Grid1.GetMergedData())
|
||||
{
|
||||
JObject values = mergedRow.Value<JObject>("values");
|
||||
int i = mergedRow.Value<int>("index");
|
||||
if (this.Grid1.SelectedRowIndexArray.Contains(i))
|
||||
{
|
||||
AspNet.CheckBox cb = (AspNet.CheckBox)(this.Grid1.Rows[i].FindControl("cbSelect"));
|
||||
if (cb.Checked) //选择项
|
||||
{
|
||||
string workPost = values.Value<string>("WorkPost");
|
||||
if (string.IsNullOrEmpty(workPost))
|
||||
{
|
||||
b = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!b)
|
||||
{
|
||||
Alert.ShowInTop("勾选人员的拟聘岗位不能为空!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
Model.Person_Shunt shunt = new Model.Person_Shunt();
|
||||
shunt.Code = BLL.SQLHelper.RunProcNewId("SpGetNewCode3", "dbo.Person_Shunt", "Code", string.Empty);
|
||||
shunt.ProjectId = this.drpProject.SelectedValue;
|
||||
shunt.State = BLL.Const.Shunt_Complete;
|
||||
shunt.CompileDate = DateTime.Now;
|
||||
shunt.CompileMan = this.CurrUser.PersonId;
|
||||
shunt.ShuntId = SQLHelper.GetNewID();
|
||||
BLL.Person_ShuntService.AddShunt(shunt);
|
||||
|
||||
var workPosts = BLL.WorkPostService.GetWorkPostList();
|
||||
foreach (JObject mergedRow in Grid1.GetMergedData())
|
||||
{
|
||||
JObject values = mergedRow.Value<JObject>("values");
|
||||
int i = mergedRow.Value<int>("index");
|
||||
AspNet.CheckBox cb = (AspNet.CheckBox)(this.Grid1.Rows[i].FindControl("cbSelect"));
|
||||
if (cb.Checked) //选择项
|
||||
{
|
||||
Model.Person_ShuntDetail detail = new Model.Person_ShuntDetail();
|
||||
detail.ShuntDetailId = SQLHelper.GetNewID(typeof(Model.Person_ShuntDetail));
|
||||
detail.ShuntId = shunt.ShuntId;
|
||||
detail.UserId = this.Grid1.Rows[i].RowID;
|
||||
string workPost = values.Value<string>("WorkPost");
|
||||
var w = workPosts.FirstOrDefault(x => x.WorkPostName == workPost);
|
||||
if (w != null)
|
||||
{
|
||||
detail.WorkPostId = w.WorkPostId;
|
||||
}
|
||||
detail.SortIndex = i;
|
||||
BLL.Person_ShuntDetailService.AddShuntDetail(detail);
|
||||
|
||||
/////todo 修改人员注释掉的 后续优化
|
||||
//var currProjectUser = BLL.ProjectUserService.GetCurrProjectUserByUserId(detail.UserId);
|
||||
//if (currProjectUser != null)
|
||||
//{
|
||||
// currProjectUser.IsPost = false;
|
||||
// BLL.ProjectUserService.UpdateProjectUser(currProjectUser);
|
||||
//}
|
||||
//var projectUser = BLL.ProjectUserService.GetProjectUserByUserIdProjectId(shunt.ProjectId, detail.UserId);
|
||||
//if (projectUser == null)
|
||||
//{
|
||||
// var user = BLL.Person_PersonsService.GetPerson_PersonsById(detail.UserId);
|
||||
// if (user != null)
|
||||
// {
|
||||
// user.ProjectId = this.drpProject.SelectedValue;
|
||||
// user.ProjectWorkPostId = detail.WorkPostId;
|
||||
// BLL.Person_PersonsService.UpdateUser(user);
|
||||
// Model.Project_ProjectUser newProjectUser = new Model.Project_ProjectUser
|
||||
// {
|
||||
// ProjectId = shunt.ProjectId,
|
||||
// UserId = detail.UserId,
|
||||
// UnitId = user.UnitId,
|
||||
// RoleId = user.RoleIds,
|
||||
// IsPost = true
|
||||
// };
|
||||
// BLL.ProjectUserService.AddProjectUser(newProjectUser);
|
||||
// Model.Sys_RoleItem roleItem = new Model.Sys_RoleItem();
|
||||
// roleItem.ProjectId = shunt.ProjectId;
|
||||
// roleItem.UserId = detail.UserId;
|
||||
// roleItem.RoleId = user.RoleId;
|
||||
// roleItem.IntoDate = DateTime.Now;
|
||||
// BLL.RoleItemService.AddRoleItem(roleItem);
|
||||
// if (!string.IsNullOrEmpty(user.IdentityCard))
|
||||
// {
|
||||
// /////当前用户是否已经添加到项目现场人员中
|
||||
// //var sitePerson = BLL.Person_PersonsService.GetPerson_PersonsByIdentityCard(shunt.ProjectId, user.IdentityCard);
|
||||
// //if (sitePerson == null)
|
||||
// //{
|
||||
// // Model.SitePerson_Person newPerson = new Model.SitePerson_Person
|
||||
// // {
|
||||
// // PersonId = SQLHelper.GetNewID(typeof(Model.SitePerson_Person)),
|
||||
// // PersonName = user.PersonName,
|
||||
// // IdentityCard = user.IdentityCard,
|
||||
// // ProjectId = shunt.ProjectId,
|
||||
// // UnitId = user.UnitId,
|
||||
// // WorkPostId = detail.WorkPostId,
|
||||
// // };
|
||||
// // BLL.PersonService.AddPerson(newPerson);
|
||||
// //}
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
ShowNotify("拟聘成功!", MessageBoxIcon.Success);
|
||||
BindGrid();
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, shunt.Code, shunt.ShuntId, BLL.Const.DepartPersonShuntMenuId, "编辑分流管理");
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInParent("请选择拟聘项目!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 确定按钮事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnView_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ShuntList.aspx", "编辑 - ")));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Grid行双击事件
|
||||
@@ -328,142 +164,95 @@ namespace FineUIPro.Web.Person
|
||||
/// </summary>
|
||||
private void EditData()
|
||||
{
|
||||
//this.PageSize = this.Grid1.PageIndex;
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInParent("请至少选择一条记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string Id = Grid1.SelectedRowID;
|
||||
var shunt = BLL.Person_ShuntService.GetShunt(Id);
|
||||
|
||||
if (shunt != null)
|
||||
if (this.btnMenuEdit.Hidden)
|
||||
{
|
||||
if (shunt.State.Equals(Const.Shunt_Complete))
|
||||
{
|
||||
Alert.ShowInTop("您不是当前办理人,无法编辑,请右键查看!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
Model.Person_ShuntApprove approve = BLL.Person_ShuntApproveService.GetShuntApproveByShuntId(Id);
|
||||
if (approve != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(approve.ApproveMan))
|
||||
{
|
||||
if (this.CurrUser.PersonId == approve.ApproveMan || CurrUser.PersonId == Const.sysglyId)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DepartPersonShuntEdit.aspx?ShuntId={0}", Id, "编辑 - ")));
|
||||
return;
|
||||
}
|
||||
else if (shunt.State == BLL.Const.Shunt_Complete)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DepartPersonShuntView.aspx?ShuntId={0}", Id, "查看 - ")));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("您不是当前办理人,无法编辑,请右键查看!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
//if (this.btnMenuModify.Hidden || checks.State == BLL.Const.State_2) ////双击事件 编辑权限有:编辑页面,无:查看页面 或者状态是完成时查看页面
|
||||
//{
|
||||
// PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListView.aspx?CheckControlCode={0}", codes, "查看 - ")));
|
||||
// return;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListEdit.aspx?CheckControlCode={0}", codes, "编辑 - ")));
|
||||
// return;
|
||||
//}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("您不是当前办理人,无法编辑,请右键查看!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PersonView.aspx?PersonId={0}", Grid1.SelectedRowID, "查看 - ")));
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PersonEdit.aspx?PersonId={0}&UnitId={1}&DepartId={2}", Grid1.SelectedRowID, Const.sedinId, Const.Depart_constructionId, "编辑 - ")));
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnMenuView_Click(object sender, EventArgs e)
|
||||
#region 查看人员详细信息
|
||||
/// <summary>
|
||||
/// 查看人员详细信息
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSee_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
||||
Alert.ShowInParent("请选择一条记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string Id = Grid1.SelectedRowID;
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DepartPersonShuntView.aspx?ShuntId={0}", Id, "查看 - ")));
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PersonView.aspx?PersonId={0}", Grid1.SelectedRowID, "查看 - ")));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除数据
|
||||
/// <summary>
|
||||
/// 右键删除事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
// this.PageSize = this.Grid1.PageIndex;
|
||||
this.DeleteData();
|
||||
}
|
||||
|
||||
#region 判断是否可删除
|
||||
/// <summary>
|
||||
/// 判断是否可以删除
|
||||
/// 删除方法
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string judgementDelete(string id)
|
||||
private void DeleteData()
|
||||
{
|
||||
string content = string.Empty;
|
||||
if (Funs.DB.SitePerson_Person.FirstOrDefault(x => x.PersonId == id) != null)
|
||||
if (Grid1.SelectedRowIndexArray.Length > 0)
|
||||
{
|
||||
content += "已在【项目员工】中使用,不能删除!";
|
||||
string strShowNotify = Person_PersonsService.DeletePersons(Grid1.SelectedRowIDArray, this.CurrUser);
|
||||
BindGrid();
|
||||
if (!string.IsNullOrEmpty(strShowNotify))
|
||||
{
|
||||
Alert.ShowInTop(strShowNotify, MessageBoxIcon.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
}
|
||||
|
||||
return content;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 关闭导入弹出窗口
|
||||
/// 派遣
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Window2_Close(object sender, WindowCloseEventArgs e)
|
||||
protected void btnMenuDispatch_Click(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
protected void ckbAll_CheckedChanged(object sender, CheckedEventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 把状态转换代号为文字形式
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
protected string ConvertState(object state)
|
||||
{
|
||||
if (state != null)
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
if (state.ToString() == BLL.Const.Shunt_ReCompile)
|
||||
{
|
||||
return "重新编制";
|
||||
}
|
||||
else if (state.ToString() == BLL.Const.Shunt_Compile)
|
||||
{
|
||||
return "编制";
|
||||
}
|
||||
else if (state.ToString() == BLL.Const.Shunt_Audit)
|
||||
{
|
||||
return "审核";
|
||||
}
|
||||
else if (state.ToString() == BLL.Const.Shunt_Complete)
|
||||
{
|
||||
return "审批完成";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
Alert.ShowInParent("请至少选择一条记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var getPerson = Person_PersonsService.GetPerson_PersonsById(Grid1.SelectedRowID);
|
||||
if (getPerson != null && getPerson.IsPost == true)
|
||||
{
|
||||
////人员直接派遣时候
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ProjectPersonEdit.aspx?PersonId={0}&Type=P", Grid1.SelectedRowID, "查看 - ")));
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInParent("当前人员不在职,请完善个人信息签订合同后派遣!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user