fix:修改

This commit is contained in:
geh 2025-04-17 11:38:17 +08:00
parent 3768e3788e
commit 7c301ceb72
18 changed files with 622 additions and 43 deletions

View File

@ -0,0 +1,109 @@
SELECT Person.PersonId,
Person.CardNo,
Person.PersonName,
Person.Sex,
(Case Person.Sex WHEN '1' THEN '' WHEN '2' THEN '' ELSE '' END) AS SexName,
Person.IdentityCard,
Person.Address,
Person.ProjectId,
Person.UnitId,
Person.Birthday,
Person.TeamGroupId,
Person.WorkAreaId,
Person.WorkPostId,
Person.InTime,
Person.OutTime,
Person.OutResult,
Person.Telephone,
Person.PositionId,
Person.PostTitleId,
Person.PhotoUrl,
Person.IsUsed,
(CASE Person.IsUsed WHEN 1 THEN '' ELSE '' END) AS IsUsedName,
Person.IsUsedType,
(CASE Person.IsUsedType WHEN '1' THEN '在岗' WHEN '0' THEN '离岗' ELSE '待审核' END) AS IsUsedTypeName,
Person.IsCardUsed,
(CASE Person.IsCardUsed WHEN 'TRUE' THEN '' ELSE '' END) AS IsCardUsedName,
Person.PersonIndex,
Project.ProjectCode,
Project.ProjectName,
Unit.UnitCode,
Unit.UnitName,
TeamGroup.TeamGroupName,
--WorkArea.UnitWorkCode AS WorkAreaCode,
WorkAreaCode= STUFF((SELECT ',' + UnitWorkCode FROM dbo.WBS_UnitWork where PATINDEX('%,' + RTRIM(UnitWorkId) + ',%',',' +Person.WorkAreaId + ',')>0 FOR XML PATH('')), 1, 1,''),
--WorkArea.UnitWorkName AS WorkAreaName
WorkAreaName= STUFF((SELECT ',' + UnitWorkName FROM dbo.WBS_UnitWork where PATINDEX('%,' + RTRIM(UnitWorkId) + ',%',',' +Person.WorkAreaId + ',')>0 FOR XML PATH('')), 1, 1,''),
Post.WorkPostName,
Position.PositionName,
Title.PostTitleName,
Depart.DepartName,
Depart.DepartId,
Post.PostType,
Post.IsHsse,
(SELECT COUNT(*) FROM EduTrain_TrainRecordDetail T WHERE T.PersonId=Person.PersonId) AS TrainCount,
Person.AuditorId,
sysUser.UserName AS AuditorName,
Person.AuditorDate,
Person.IDCardUrl,
Person.IsForeign,
case when Person.IsForeign=1 then '' else '' end as IsForeignStr,
Person.IdcardType,
BasicData1.dictName as IdcardTypeName,
Person.IdcardStartDate,
Person.IdcardEndDate,
Person.IdcardForever,
case when Person.IdcardForever='Y' then '' else '' end as IdcardForeverStr,
Person.PoliticsStatus,
BasicData2.dictName as PoliticsStatusName,
Person.IdcardAddress,
Person.Nation,
BasicData3.dictName as NationName,
Person.EduLevel,
BasicData4.dictName as EduLevelName,
Person.MaritalStatus,
BasicData5.dictName as MaritalStatusName,
Person.CountryCode,
Country.cname as CountryName,
Person.ProvinceCode,
City.cname as ProvinceName,
Person.MainCNProfessionalId,
CNProfessional.ProfessionalName as MainCNProfessionalName,
Person.ViceCNProfessionalId,
'' as ViceCNProfessionalName,
Person.IsOutside,
case when Person.IsOutside=1 then '' else '' end as IsOutsideStr
FROM SitePerson_Person AS Person
LEFT JOIN Base_Project AS Project ON Project.ProjectId=Person.ProjectId
LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = Person.UnitId
LEFT JOIN ProjectData_TeamGroup AS TeamGroup ON TeamGroup.TeamGroupId=Person.TeamGroupId
--LEFT JOIN WBS_UnitWork AS WorkArea ON WorkArea.UnitWorkId = Person.WorkAreaId
LEFT JOIN Base_WorkPost AS Post ON Post.WorkPostId = Person.WorkPostId
LEFT JOIN Base_Position AS Position ON Position.PositionId = Person.PositionId
Left JOIN Base_PostTitle AS Title ON Title.PostTitleId = Person.PostTitleId
Left JOIN Base_Depart AS Depart ON Depart.DepartId = Person.DepartId
Left JOIN Sys_User AS sysUser ON sysUser.UserId = Person.AuditorId
Left JOIN RealName_BasicData AS BasicData1 ON BasicData1.dictCode = Person.IdcardType
Left JOIN RealName_BasicData AS BasicData2 ON BasicData2.dictCode = Person.PoliticsStatus
Left JOIN RealName_BasicData AS BasicData3 ON BasicData3.dictCode = Person.Nation
Left JOIN RealName_BasicData AS BasicData4 ON BasicData4.dictCode = Person.EduLevel
Left JOIN RealName_BasicData AS BasicData5 ON BasicData5.dictCode = Person.MaritalStatus
Left JOIN RealName_Country AS Country ON Country.CountryId = Person.CountryCode
Left JOIN RealName_City AS City ON City.provinceCode = Person.ProvinceCode
Left JOIN Base_CNProfessional AS CNProfessional ON CNProfessional.CNProfessionalId = Person.MainCNProfessionalId
ALTER TABLE SitePerson_Person
ADD IsUsedType char(1) COLLATE Chinese_PRC_CI_AS NULL
go
EXEC sp_addextendedproperty
'MS_Description', N'人员状态',
'SCHEMA', N'dbo',
'TABLE', N'SitePerson_Person',
'COLUMN', N'IsUsedType'
GO

View File

@ -591,6 +591,7 @@ namespace BLL
Major = person.Major,
Languages = person.Languages,
PersonStates = person.PersonStates,
IsUsedType = person.IsUsedType,
};
if (person.InTime.HasValue)
@ -655,6 +656,7 @@ namespace BLL
newPerson.MaritalStatus = person.MaritalStatus;
newPerson.DepartId = person.DepartId;
newPerson.QRCodeAttachUrl = person.QRCodeAttachUrl;
newPerson.IsUsedType = person.IsUsedType;
newPerson.Password = GetPersonPassWord(person.IdentityCard);
if (!newPerson.OutTime.HasValue)
{

View File

@ -219,6 +219,10 @@ namespace FineUIPro.Web.Controls
}
}
}
else if (!string.IsNullOrEmpty(Request.Params["ProjectUnitId"]))
{
this.CreateCode_Simple(Request.Params["strCode"]);
}
this.Image1.ImageUrl = "~/" + this.QRCodeAttachUrl;
}

View File

@ -1099,6 +1099,7 @@ namespace FineUIPro.Web.HSSE.SitePerson
newPerson.IsForeign = persons[i].IsForeign;
newPerson.IsOutside = persons[i].IsOutside;
newPerson.IsUsed = persons[i].IsUsedName == "是" ? true : false;
newPerson.IsUsedType = persons[i].IsUsedName == "是" ? "1" : "0";
newPerson.IsCardUsed = persons[i].IsCardUsedName == "是" ? true : false;
BLL.PersonService.AddPerson(newPerson);
@ -1142,6 +1143,7 @@ namespace FineUIPro.Web.HSSE.SitePerson
getPerson.OutResult = persons[i].OutResult;
getPerson.Telephone = persons[i].Telephone;
getPerson.IsUsed = persons[i].IsUsedName == "是" ? true : false;
getPerson.IsUsedType = persons[i].IsUsedName == "是" ? "1" : "0";
getPerson.IsCardUsed = persons[i].IsCardUsedName == "是" ? true : false;
Funs.DB.SubmitChanges();
}

View File

@ -8,12 +8,9 @@
<title>人员信息</title>
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.f-grid-row.Red {
background-color: red;
}
.LabelColor {
color: Red;
.Yellow {
font-size: small;
background-color: Yellow;
}
</style>
</head>
@ -83,10 +80,12 @@
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Top" ToolbarAlign="Right" runat="server">
<Items>
<f:DropDownList ID="drpIsUsedName" runat="server" Label="是否在岗" EnableEdit="true"
Width="200px" LabelWidth="100px" LabelAlign="right" ForceSelection="false">
<f:ListItem Value="是" Text="是" />
<f:ListItem Value="否" Text="否" />
<f:DropDownList ID="drpIsUsedTypeName" runat="server" Label="状态" EnableEdit="true"
Width="200px" LabelWidth="70px" LabelAlign="right" ForceSelection="false">
<f:ListItem Value="" Text="请选择"/>
<f:ListItem Value="待审核" Text="待审核"/>
<f:ListItem Value="在岗" Text="在岗" />
<f:ListItem Value="离岗" Text="离岗"/>
</f:DropDownList>
<f:CheckBox runat="server" ID="ckIdCardInfoNotOK" Label="身份信息不齐全" LabelAlign="right" LabelWidth="120px">
</f:CheckBox>
@ -96,6 +95,8 @@
<f:Button ID="btSearch" ToolTip="查询" Icon="SystemSearch" runat="server" OnClick="TextBox_TextChanged" Text="查询"></f:Button>
<f:Button ID="btnNew" ToolTip="增加" Icon="Add" runat="server" Hidden="true" OnClick="btnNew_Click" Text="增加">
</f:Button>
<f:Button ID="btnApprove" ToolTip="批量审核" Icon="UserGo" runat="server" Hidden="true" Text="批量审核" OnClick="btnApprove_Click">
</f:Button>
<f:Button ID="btnPersonOut" ToolTip="批量出场" Icon="UserGo" runat="server" Hidden="true" Text="批量出场" OnClick="btnPersonOut_Click">
</f:Button>
<f:Button ID="btnImport" ToolTip="导入" Icon="ApplicationGet" Hidden="true" runat="server" Text="导入"
@ -149,7 +150,7 @@
<%-- <f:RenderField HeaderText="电话" ColumnID="Telephone" DataField="Telephone" SortField="Telephone"
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="110px">
</f:RenderField>--%>
<f:RenderField HeaderText="在场" ColumnID="IsUsedName" DataField="IsUsedName" SortField="IsUsedName"
<f:RenderField HeaderText="在场" ColumnID="IsUsedTypeName" DataField="IsUsedTypeName" SortField="IsUsedTypeName"
FieldType="String" HeaderTextAlign="Center" TextAlign="Center" Width="60px">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="OutTime" DataField="OutTime" SortField="OutTime"

View File

@ -228,15 +228,20 @@ namespace FineUIPro.Web.HSSE.SitePerson
{
strSql += " AND UnitId IS NULL";
}
if (drpIsUsedName.SelectedValue == "")
if (drpIsUsedTypeName.SelectedValue == "待审核")
{
strSql += " AND IsUsed = @IsUsed";
listStr.Add(new SqlParameter("@IsUsed", "1"));
strSql += " AND IsUsedType = @IsUsedType";
listStr.Add(new SqlParameter("@IsUsedType", "2"));
}
else
else if (drpIsUsedTypeName.SelectedValue == "在岗")
{
strSql += " AND IsUsed = @IsUsed";
listStr.Add(new SqlParameter("@IsUsed", "0"));
strSql += " AND IsUsedType = @IsUsedType";
listStr.Add(new SqlParameter("@IsUsedType", "1"));
}
else if (drpIsUsedTypeName.SelectedValue == "离岗")
{
strSql += " AND IsUsedType = @IsUsedType";
listStr.Add(new SqlParameter("@IsUsedType", "0"));
}
if (!string.IsNullOrEmpty(this.txtPersonName.Text.Trim()))
{
@ -294,19 +299,17 @@ namespace FineUIPro.Web.HSSE.SitePerson
Grid1.DataSource = table;
Grid1.DataBind();
//for (int i = 0; i < Grid1.Rows.Count; i++)
//{
// string personId = Grid1.Rows[i].DataKeys[0].ToString();
for (int i = 0; i < Grid1.Rows.Count; i++)
{
string personId = Grid1.Rows[i].DataKeys[0].ToString();
var person = BLL.PersonService.GetPersonById(personId);
if (person.IsUsedType=="2") //待审批
{
Grid1.Rows[i].RowCssClass = "Yellow";
}
}
// var isNull = from x in db.EduTrain_TrainRecordDetail
// join y in db.EduTrain_TrainRecord on x.TrainingId equals y.TrainingId
// where y.ProjectId == this.ProjectId && x.PersonId == personId
// select x;
// //if (isNull.Count() == 0) ////未参加过培训的人员
// //{
// // Grid1.Rows[i].RowCssClass = "Red";
// //}
//}
}
}
}
@ -569,6 +572,7 @@ namespace FineUIPro.Web.HSSE.SitePerson
this.btnMenuDelete.Hidden = false;
this.btnPersonUnit.Hidden = false;
}
this.btnApprove.Hidden = false;
}
}
#endregion
@ -711,6 +715,34 @@ namespace FineUIPro.Web.HSSE.SitePerson
}
#endregion
#region
/// <summary>
/// 批量审核
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnApprove_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
var ids = Grid1.SelectedRowIDArray;
foreach (var id in ids)
{
var person = PersonService.GetPersonById(id);
if (person.IsUsedType == "2")
{
person.IsUsedType = "1";
PersonService.UpdatePerson(person);
}
}
ShowNotify("操作完成!", MessageBoxIcon.Success);
}
#endregion
#region
/// <summary>
/// 查询

View File

@ -186,13 +186,13 @@ namespace FineUIPro.Web.HSSE.SitePerson
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// drpIsUsedName 控件。
/// drpIsUsedTypeName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpIsUsedName;
protected global::FineUIPro.DropDownList drpIsUsedTypeName;
/// <summary>
/// ckIdCardInfoNotOK 控件。
@ -239,6 +239,15 @@ namespace FineUIPro.Web.HSSE.SitePerson
/// </remarks>
protected global::FineUIPro.Button btnNew;
/// <summary>
/// btnApprove 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnApprove;
/// <summary>
/// btnPersonOut 控件。
/// </summary>

View File

@ -141,10 +141,16 @@
<f:CheckBox runat="server" ID="ckIsOutside" Label="外聘" LabelAlign="Right"></f:CheckBox>
<f:TextBox ID="txtTelephone" runat="server" Label="电话" LabelAlign="Right" MaxLength="50">
</f:TextBox>
<f:RadioButtonList ID="rblIsUsed" runat="server" Label="人员在场" LabelAlign="Right" Required="True" ShowRedStar="True">
<f:RadioItem Value="True" Text="是" />
<f:RadioItem Value="False" Text="否" />
</f:RadioButtonList>
<%-- <f:RadioButtonList ID="rblIsUsed" runat="server" Label="人员在场" LabelAlign="Right" Required="True" ShowRedStar="True"> --%>
<%-- <f:RadioItem Value="True" Text="是" /> --%>
<%-- <f:RadioItem Value="False" Text="否" /> --%>
<%-- </f:RadioButtonList> --%>
<f:DropDownList ID="drpIsUsedType" runat="server" Label="状态" EnableEdit="true" Required="True" ShowRedStar="True" LabelAlign="right" >
<f:ListItem Value="2" Text="待审核"/>
<f:ListItem Value="1" Text="在岗"/>
<f:ListItem Value="0" Text="离岗"/>
</f:DropDownList>
</Items>
</f:Panel>

View File

@ -169,8 +169,12 @@ namespace FineUIPro.Web.HSSE.SitePerson
{
this.drpMaritalStatus.SelectedValue = person.MaritalStatus;
}
if (!string.IsNullOrEmpty(person.IsUsedType))
{
this.drpIsUsedType.SelectedValue = person.IsUsedType;
}
this.txtIdcardAddress.Text = person.IdcardAddress;
this.rblIsUsed.SelectedValue = person.IsUsed ? "True" : "False";
// this.rblIsUsed.SelectedValue = person.IsUsed ? "True" : "False";
this.rblIsCardUsed.SelectedValue = person.IsCardUsed ? "True" : "False";
this.txtCardNo.Text = person.CardNo;
this.txtPersonName.Text = person.PersonName;
@ -270,7 +274,8 @@ namespace FineUIPro.Web.HSSE.SitePerson
this.txtCardNo.Text = string.Empty;
}
this.txtInTime.Text = string.Format("{0:yyyy-MM-dd}", System.DateTime.Now);
this.rblIsUsed.SelectedValue = "True";
// this.rblIsUsed.SelectedValue = "True";
this.drpIsUsedType.SelectedValue = "在岗";
this.rblIsCardUsed.SelectedValue = "True";
}
}
@ -421,9 +426,14 @@ namespace FineUIPro.Web.HSSE.SitePerson
{
person.PostTitleId = this.drpTitle.SelectedValue;
}
if (!string.IsNullOrEmpty(this.rblIsUsed.SelectedValue))
// if (!string.IsNullOrEmpty(this.rblIsUsed.SelectedValue))
// {
// person.IsUsed = Convert.ToBoolean(this.rblIsUsed.SelectedValue);
// }
person.IsUsed = true;
if (!string.IsNullOrEmpty(this.drpIsUsedType.SelectedValue))
{
person.IsUsed = Convert.ToBoolean(this.rblIsUsed.SelectedValue);
person.IsUsedType = this.drpIsUsedType.SelectedValue;
}
if (!string.IsNullOrEmpty(this.rblIsCardUsed.SelectedValue))
{

View File

@ -402,13 +402,13 @@ namespace FineUIPro.Web.HSSE.SitePerson
protected global::FineUIPro.TextBox txtTelephone;
/// <summary>
/// rblIsUsed 控件。
/// drpIsUsedType 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.RadioButtonList rblIsUsed;
protected global::FineUIPro.DropDownList drpIsUsedType;
/// <summary>
/// Panel5 控件。

View File

@ -122,6 +122,9 @@
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true" Hidden="true"
Icon="Pencil" runat="server" Text="编辑">
</f:MenuButton>
<f:MenuButton ID="btnORCode" OnClick="btnQR_Click" EnablePostBack="true" Hidden="true"
Icon="TableRefresh" runat="server" Text="二维码">
</f:MenuButton>
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true" Hidden="true"
Icon="Delete" ConfirmText="删除选中行?" ConfirmTarget="Parent" runat="server" Text="删除">
</f:MenuButton>

View File

@ -333,6 +333,7 @@ namespace FineUIPro.Web.ProjectData
this.btnMenuEdit.Hidden = true;
this.btnMenuDelete.Hidden = true;
}
this.btnORCode.Hidden = false;
}
#endregion
@ -406,5 +407,19 @@ namespace FineUIPro.Web.ProjectData
return sb.ToString();
}
#endregion
//二维码生成
protected void btnQR_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
string strCode = "https://lygcgs.com.cn/JT/web/index.html?ProjectUnitId=" + Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/Controls/SeeQRImage.aspx?ProjectUnitId={0}&strCode={1}", Grid1.SelectedRowID, strCode), "二维码查看", 400, 400));
}
}
}

View File

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

View File

@ -363517,6 +363517,8 @@ namespace Model
private System.Nullable<System.DateTime> _SignTime;
private string _IsUsedType;
private EntitySet<Accident_AccidentPersonRecord> _Accident_AccidentPersonRecord;
private EntitySet<Accident_AccidentReportOtherItem> _Accident_AccidentReportOtherItem;
@ -363721,6 +363723,8 @@ namespace Model
partial void OnPersonStatesChanged();
partial void OnSignTimeChanging(System.Nullable<System.DateTime> value);
partial void OnSignTimeChanged();
partial void OnIsUsedTypeChanging(string value);
partial void OnIsUsedTypeChanged();
#endregion
public SitePerson_Person()
@ -365171,6 +365175,26 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsUsedType", DbType="Char(1)")]
public string IsUsedType
{
get
{
return this._IsUsedType;
}
set
{
if ((this._IsUsedType != value))
{
this.OnIsUsedTypeChanging(value);
this.SendPropertyChanging();
this._IsUsedType = value;
this.SendPropertyChanged("IsUsedType");
this.OnIsUsedTypeChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Accident_AccidentPersonRecord_SitePerson_Person", Storage="_Accident_AccidentPersonRecord", ThisKey="PersonId", OtherKey="PersonId", DeleteRule="NO ACTION")]
public EntitySet<Accident_AccidentPersonRecord> Accident_AccidentPersonRecord
{
@ -486246,6 +486270,10 @@ namespace Model
private string _IsUsedName;
private string _IsUsedType;
private string _IsUsedTypeName;
private bool _IsCardUsed;
private string _IsCardUsedName;
@ -486700,6 +486728,38 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsUsedType", DbType="Char(1)")]
public string IsUsedType
{
get
{
return this._IsUsedType;
}
set
{
if ((this._IsUsedType != value))
{
this._IsUsedType = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsUsedTypeName", DbType="VarChar(6) NOT NULL", CanBeNull=false)]
public string IsUsedTypeName
{
get
{
return this._IsUsedTypeName;
}
set
{
if ((this._IsUsedTypeName != value))
{
this._IsUsedTypeName = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsCardUsed", DbType="Bit NOT NULL")]
public bool IsCardUsed
{

View File

@ -156,5 +156,51 @@ namespace WebAPI.Controllers.DataPenetrate
return responeData;
}
#endregion
#region ProjectUnitId获取信息
/// <summary>
/// 根据ProjectUnitId获取信息
/// </summary>
/// <param name="ProjectUnitId"></param>
/// <returns></returns>
[HttpGet]
public Model.ResponeData getDataByProjectUnitId(string ProjectUnitId)
{
var responeData = new Model.ResponeData();
try
{
var query = (from projectUnit in Funs.DB.Project_ProjectUnit
join project in Funs.DB.Base_Project
on projectUnit.ProjectId equals project.ProjectId into projectGroup
from project in projectGroup.DefaultIfEmpty()
join unit in Funs.DB.Base_Unit
on projectUnit.UnitId equals unit.UnitId into unitGroup
from unit in unitGroup.DefaultIfEmpty()
join sysConst in Funs.DB.Sys_Const
on new { GroupId = BLL.ConstValue.Group_ProjectUnitType, ConstValue = projectUnit.UnitType }
equals new { GroupId = sysConst.GroupId, ConstValue = sysConst.ConstValue } into sysConstGroup
from sysConst in sysConstGroup.DefaultIfEmpty()
where projectUnit.ProjectUnitId == ProjectUnitId
select new
{
ProjectUnitId = projectUnit.ProjectUnitId,
ProjectId = projectUnit.ProjectId,
ProjectName = project.ProjectName,
UnitId = projectUnit.UnitId,
UnitName = unit.UnitName,
}).FirstOrDefault();
responeData.data = new { query };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
}
}

View File

@ -51,7 +51,7 @@ namespace WebAPI.Controllers.HSSE
}
}
responeData.data = new { getData };
responeData.data = new { getData = getData, person = person };
}
catch (Exception ex)
{

View File

@ -7,6 +7,10 @@ using SgManager.AI;
using System.Configuration;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using System.Drawing;
using System.IO;
using System.Text;
using System.Web;
namespace WebAPI.Controllers
{
@ -1005,5 +1009,262 @@ namespace WebAPI.Controllers
// return responeData;
//}
#endregion
#region +
/// <summary>
/// 身份证上传+读取
/// </summary>
/// <returns></returns>
public Model.ResponeData PostAddUrl()
{
var responeData = new Model.ResponeData();
try
{
HttpFileCollection files = HttpContext.Current.Request.Files;
string typeName = HttpContext.Current.Request["typeName"];
if (string.IsNullOrEmpty(typeName))
{
typeName = "WebApi";
}
// 定义允许上传的文件类型列表
List<string> allowExtensions = BLL.Funs.AllowExtensions;
string reUrl = string.Empty;
if (files != null && files.Count > 0)
{
string folderUrl = "FileUpLoad/" + typeName + "/" + DateTime.Now.ToString("yyyy-MM") + "/";
string localRoot = ConfigurationManager.AppSettings["localRoot"] + folderUrl; //物理路径
if (!Directory.Exists(localRoot))
{
Directory.CreateDirectory(localRoot);
}
foreach (string key in files.AllKeys)
{
string rootUrl = string.Empty;
string fileName = string.Empty;
string extensionstr = string.Empty;
HttpPostedFile file = files[key]; //file.ContentLength文件长度
if (!allowExtensions.Contains(Path.GetExtension(file.FileName)))
{
responeData.data = BadRequest($"Invalid file extension: {file.FileName}");
return responeData;
}
if (!string.IsNullOrEmpty(file.FileName))
{
extensionstr = Path.GetExtension(file.FileName).ToLower();
fileName = SQLHelper.GetNewID() + extensionstr;
rootUrl = localRoot + fileName;
file.SaveAs(localRoot + fileName);
}
if (extensionstr == ".jpg" || extensionstr == ".gif" || extensionstr == ".bmp" ||
extensionstr == ".png")
{
string TakePicDateTime = string.Empty;
System.Drawing.Image image = System.Drawing.Image.FromStream(file.InputStream, true, false);
Encoding ascii = Encoding.ASCII;
//遍历图像文件元数据,检索所有属性
foreach (System.Drawing.Imaging.PropertyItem p in image.PropertyItems)
{
//如果是PropertyTagDateTime则返回该属性所对应的值
if (p.Id == 0x0132)
{
TakePicDateTime = ascii.GetString(p.Value);
}
}
TakePicDateTime = string.IsNullOrEmpty(TakePicDateTime)
? string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now)
: TakePicDateTime;
if (!string.IsNullOrEmpty(TakePicDateTime))
{
////获取元数据中的拍照日期时间,以字符串形式保存
//TakePicDateTime = GetTakePicDateTime(pi);
//分析字符串分别保存拍照日期和时间的标准格式
var SpaceLocation = TakePicDateTime.IndexOf(" ");
var dt = TakePicDateTime.Substring(0, SpaceLocation);
dt = dt.Replace(":", "-");
var tm = TakePicDateTime.Substring(SpaceLocation + 1,
TakePicDateTime.Length - SpaceLocation - 2);
TakePicDateTime = dt + " " + tm;
//由列表中的文件创建内存位图对象
var Pic = new Bitmap(rootUrl);
//由位图对象创建Graphics对象的实例
var g = Graphics.FromImage(Pic);
Font ft = new Font("宋体", 20, FontStyle.Regular, GraphicsUnit.Point,
((byte)(134))); //定义字体
//在Graphics表面绘制数码照片的日期/时间戳
g.DrawString(TakePicDateTime, ft, Brushes.Gold, 0, Pic.Height - 100);
// - 50);
string newRoot = localRoot + "newfile/";
if (!Directory.Exists(newRoot))
{
Directory.CreateDirectory(newRoot);
}
//将添加日期/时间戳后的图像进行保存
Pic.Save(newRoot + fileName);
fileName = "newfile/" + fileName;
//释放内存位图对象
Pic.Dispose();
}
}
if (!string.IsNullOrEmpty(fileName))
{
if (string.IsNullOrEmpty(reUrl))
{
reUrl += folderUrl + fileName;
}
else
{
reUrl += "," + folderUrl + fileName;
}
}
}
}
string url = Request.RequestUri.Scheme + "://" + Request.RequestUri.Host + ":" +
Request.RequestUri.Port +
"/JT/" + reUrl;
responeData.data = new {IDCard = APIIDCardInfoService.ReadIDCardInfo(url), IDCardUrl = reUrl,URL=url};
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region
/// <summary>
/// 小程序保存人员信息
/// </summary>
/// <param name="person">人员信息</param>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SavePerson([FromBody] Model.PersonItem person)
{
var responeData = new Model.ResponeData();
try
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
if (person != null && !string.IsNullOrEmpty(person.IdentityCard))
{
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == person.IdentityCard.Trim() && x.ProjectId == person.ProjectId);
if (getPerson != null)
{
responeData.code = -1;
responeData.message = "该身份证号码已存在两条记录,请联系管理员处理!";
}
else
{
Model.SitePerson_Person newPerson = new Model.SitePerson_Person
{
PersonId = SQLHelper.GetNewID(),
ProjectId = person.ProjectId,
UnitId = person.UnitId,
PersonName = person.PersonName,
Sex = person.Sex ,
IdentityCard = person.IdentityCard,
Telephone = person.Telephone,
WorkPostId = person.WorkPostId,
IsUsedType = "2",
IsUsed = true,
IsCardUsed = false,
// IdcardType = "SHENFEN_ZHENGJIAN",
// IdcardAddress = person.IdcardAddress,
// IdcardForever = "N",
// IdcardStartDate = Funs.GetNewDateTime(person.IdcardStartDate),
// IdcardEndDate = Funs.GetNewDateTime(person.IdcardEndDate),
// Address = person.Address,
// OutResult = person.OutResult,
// Birthday = person.Birthday,
// InTime = Funs.GetNewDateTimeOrNow(person.InTime),
// Password = BLL.PersonService.GetPersonPassWord(person.IdentityCard),
// Isprint = "0",
};
PersonService.AddPerson(newPerson);
Model.ToDoItem toDoItem = new Model.ToDoItem
{
MenuId = Const.PersonListMenuId,
DataId = newPerson.PersonId + "#1",
UrlStr = person.AttachUrl1,
};
if (!string.IsNullOrEmpty(person.AttachUrl1))
{
APIUpLoadFileService.SaveAttachUrl(toDoItem);
}
toDoItem.DataId = newPerson.PersonId + "#5";
toDoItem.UrlStr = person.AttachUrl5;
if (!string.IsNullOrEmpty(person.AttachUrl5))
{
APIUpLoadFileService.SaveAttachUrl(toDoItem);
}
responeData.code = 1;
responeData.message = "新增人员成功!";
}
}
else
{
responeData.code = -1;
responeData.message = "人员信息有误!";
}
}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region
public Model.ResponeData getWorkPostList(string WorkPostName)
{
var responeData = new Model.ResponeData();
try
{
var list = (from x in Funs.DB.Base_WorkPost
orderby x.WorkPostCode
select new
{
x.WorkPostId,
x.WorkPostName
}).ToList();
if (!string.IsNullOrEmpty(WorkPostName))
{
list = list.Where(x => x.WorkPostName.Contains(WorkPostName)).ToList();
}
responeData.data = new { list };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
}
}

View File

@ -142,7 +142,17 @@ namespace WebAPI.Filter
/// <summary>
///
/// </summary>
public static List<string> lists = new List<string> { "User*postLoginOn", "HazardRealTime*SaveHazardRealTime", "Api_14HJSync*OrganizationSync", "Api_14HJSync*UserSync", "HazardRegister*getHazardRegisterTotalCount", "HazardRegister*getHazardRegisterByProjectIdStates", "Project*pushProject" };
public static List<string> lists = new List<string>
{
"User*postLoginOn", "HazardRealTime*SaveHazardRealTime", "Api_14HJSync*OrganizationSync", "Api_14HJSync*UserSync", "HazardRegister*getHazardRegisterTotalCount", "HazardRegister*getHazardRegisterByProjectIdStates", "Project*pushProject"
, "IDCard*getIDCardInfo"
, "Person*SavePerson"
, "InformedConsentForm*updateSignTime"
, "InformedConsentForm*getFormByWorkPostName"
, "Person*PostAddUrl"
, "Person*getWorkPostList"
, "ProjectUnitPenetrate*getDataByProjectUnitId"
};
/// <summary>
///