This commit is contained in:
geh
2026-03-23 15:22:29 +08:00
parent 94584d242b
commit c38590add8
173 changed files with 19679 additions and 4413 deletions
@@ -203,138 +203,148 @@ namespace FineUIPro.Web.HSSE.SitePerson
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
string unitId = string.Empty;
string projectId = string.Empty;
if (this.tvProjectAndUnit != null && !string.IsNullOrEmpty(this.tvProjectAndUnit.SelectedNodeID))
{
string id = this.tvProjectAndUnit.SelectedNodeID;
string unitId = string.Empty;
string projectId = string.Empty;
var str = id.Split('|');
if (str.Count() > 1)
{
unitId = str[0];
projectId = str[1];
}
}
string strSql = "select * from View_SitePerson_Person Where ProjectId=@ProjectId ";
List<SqlParameter> listStr = new List<SqlParameter>
{
new SqlParameter("@ProjectId", this.ProjectId)
};
if (!string.IsNullOrEmpty(unitId) && unitId != "0")
{
strSql += " AND UnitId =@UnitId ";
listStr.Add(new SqlParameter("@UnitId", unitId));
}
else
{
strSql += " AND UnitId IS NULL";
}
if (drpIsUsedTypeName.SelectedValue == "待审核")
{
strSql += " AND IsUsedTypeName = @IsUsedTypeName";
listStr.Add(new SqlParameter("@IsUsedTypeName", "待审核"));
}
else if (drpIsUsedTypeName.SelectedValue == "在岗")
{
strSql += " AND IsUsedTypeName = @IsUsedTypeName";
listStr.Add(new SqlParameter("@IsUsedTypeName", "在岗"));
}
else if (drpIsUsedTypeName.SelectedValue == "离岗")
{
strSql += " AND IsUsedTypeName = @IsUsedTypeName";
listStr.Add(new SqlParameter("@IsUsedTypeName", "离岗"));
}
if (!string.IsNullOrEmpty(this.txtPersonName.Text.Trim()))
{
strSql += " AND PersonName LIKE @PersonName";
listStr.Add(new SqlParameter("@PersonName", "%" + this.txtPersonName.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(this.txtCardNo.Text.Trim()))
{
strSql += " AND CardNo LIKE @CardNo";
listStr.Add(new SqlParameter("@CardNo", "%" + this.txtCardNo.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(this.txtIdentityCard.Text.Trim()))
{
strSql += " AND IdentityCard LIKE @IdentityCard";
listStr.Add(new SqlParameter("@IdentityCard", "%" + this.txtIdentityCard.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(this.drpTreamGroup.SelectedValue) && this.drpTreamGroup.SelectedValue != BLL.Const._Null)
{
strSql += " AND TeamGroupId = @TeamGroupId";
listStr.Add(new SqlParameter("@TeamGroupId", this.drpTreamGroup.SelectedValue));
}
string strSql = "select * from View_SitePerson_Person Where ProjectId=@ProjectId ";
List<SqlParameter> listStr = new List<SqlParameter>
{
new SqlParameter("@ProjectId", this.ProjectId)
};
if (!string.IsNullOrEmpty(unitId) && unitId != "0")
{
strSql += " AND UnitId =@UnitId ";
listStr.Add(new SqlParameter("@UnitId", unitId));
}
// else
// {
// strSql += " AND UnitId IS NULL";
// }
if (this.drpPost.SelectedItemArray.Count() > 1 || (this.drpPost.SelectedValue != BLL.Const._Null && this.drpPost.SelectedItemArray.Count() == 1))
if (drpIsUsedTypeName.SelectedValue == "待审核")
{
strSql += " AND IsUsedTypeName = @IsUsedTypeName";
listStr.Add(new SqlParameter("@IsUsedTypeName", "待审核"));
}
else if (drpIsUsedTypeName.SelectedValue == "在岗")
{
strSql += " AND IsUsedTypeName = @IsUsedTypeName";
listStr.Add(new SqlParameter("@IsUsedTypeName", "在岗"));
}
else if (drpIsUsedTypeName.SelectedValue == "离岗")
{
strSql += " AND IsUsedTypeName = @IsUsedTypeName";
listStr.Add(new SqlParameter("@IsUsedTypeName", "离岗"));
}
if (!string.IsNullOrEmpty(this.txtPersonName.Text.Trim()))
{
strSql += " AND PersonName LIKE @PersonName";
listStr.Add(new SqlParameter("@PersonName", "%" + this.txtPersonName.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(this.txtCardNo.Text.Trim()))
{
strSql += " AND CardNo LIKE @CardNo";
listStr.Add(new SqlParameter("@CardNo", "%" + this.txtCardNo.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(this.txtIdentityCard.Text.Trim()))
{
strSql += " AND IdentityCard LIKE @IdentityCard";
listStr.Add(new SqlParameter("@IdentityCard", "%" + this.txtIdentityCard.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(this.drpTreamGroup.SelectedValue) &&
this.drpTreamGroup.SelectedValue != BLL.Const._Null)
{
strSql += " AND TeamGroupId = @TeamGroupId";
listStr.Add(new SqlParameter("@TeamGroupId", this.drpTreamGroup.SelectedValue));
}
if (this.drpPost.SelectedItemArray.Count() > 1 || (this.drpPost.SelectedValue != BLL.Const._Null &&
this.drpPost.SelectedItemArray.Count() == 1))
{
strSql += " AND (1=2 ";
int i = 0;
foreach (var item in this.drpPost.SelectedValueArray)
{
strSql += " AND (1=2 ";
int i = 0;
foreach (var item in this.drpPost.SelectedValueArray)
if (!string.IsNullOrEmpty(item) && item != BLL.Const._Null)
{
if (!string.IsNullOrEmpty(item) && item != BLL.Const._Null)
{
strSql += " OR WorkPostId = @WorkPostId" + i.ToString();
listStr.Add(new SqlParameter("@WorkPostId" + i.ToString(), item));
}
i++;
strSql += " OR WorkPostId = @WorkPostId" + i.ToString();
listStr.Add(new SqlParameter("@WorkPostId" + i.ToString(), item));
}
strSql += ")";
}
if (this.ckTrain.Checked)
{
strSql += " AND TrainCount =0";
}
if (this.ckIdCardInfoNotOK.Checked)
{
strSql += " AND (IdcardType is null or IdentityCard is null or PhotoUrl is null or (select count(*) from AttachFile where ToKeyId=PersonId+'#1')=0 or (select count(*) from AttachFile where ToKeyId=PersonId+'#5')=0)";
i++;
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
strSql += ")";
}
Grid1.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
if (this.ckTrain.Checked)
{
strSql += " AND TrainCount =0";
}
for (int i = 0; i < Grid1.Rows.Count; i++)
if (this.ckIdCardInfoNotOK.Checked)
{
strSql +=
" AND (IdcardType is null or IdentityCard is null or PhotoUrl is null or (select count(*) from AttachFile where ToKeyId=PersonId+'#1')=0 or (select count(*) from AttachFile where ToKeyId=PersonId+'#5')=0)";
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
for (int i = 0; i < Grid1.Rows.Count; i++)
{
string personId = Grid1.Rows[i].DataKeys[0].ToString();
var person = BLL.PersonService.GetPersonById(personId);
var idCard = person.IdentityCard;
//根据身份证号码获取出生日期
if (!string.IsNullOrEmpty(idCard))
{
string personId = Grid1.Rows[i].DataKeys[0].ToString();
var person = BLL.PersonService.GetPersonById(personId);
var idCard = person.IdentityCard;
//根据身份证号码获取出生日期
if (!string.IsNullOrEmpty(idCard))
string birthDateStr = string.Empty;
if (idCard.Length == 18)
{
string birthDateStr = string.Empty;
if (idCard.Length == 18)
// 18位身份证号码,出生日期在第7位到第14位
birthDateStr = idCard.Substring(6, 8);
}
else if (idCard.Length == 15)
{
// 15位身份证号码,出生日期在第7位到第12位,需要加上"19"前缀
birthDateStr = "19" + idCard.Substring(6, 6);
}
if (!string.IsNullOrEmpty(birthDateStr))
{
// 解析日期字符串为DateTime对象
var birthDate = DateTime.ParseExact(birthDateStr, "yyyyMMdd", null);
if (birthDate.AddYears(60) < DateTime.Now)
{
// 18位身份证号码,出生日期在第7位到第14位
birthDateStr = idCard.Substring(6, 8);
}
else if (idCard.Length == 15)
{
// 15位身份证号码,出生日期在第7位到第12位,需要加上"19"前缀
birthDateStr = "19" + idCard.Substring(6, 6);
}
if (!string.IsNullOrEmpty(birthDateStr))
{
// 解析日期字符串为DateTime对象
var birthDate = DateTime.ParseExact(birthDateStr, "yyyyMMdd", null);
if (birthDate.AddYears(60) < DateTime.Now)
{
Grid1.Rows[i].RowCssClass = "Yellow";
}
Grid1.Rows[i].RowCssClass = "Yellow";
}
}
// if (person.IsUsedType=="2") //待审批
// {
// Grid1.Rows[i].RowCssClass = "Yellow";
// }
}
// if (person.IsUsedType=="2") //待审批
// {
// Grid1.Rows[i].RowCssClass = "Yellow";
// }
}
}
}