fix:一人一档

This commit is contained in:
geh 2025-04-16 10:19:33 +08:00
parent 510b04d2fa
commit 3768e3788e
7 changed files with 335 additions and 14 deletions

View File

@ -1,5 +1,5 @@
ALTER TABLE Training_TestRecord
ADD COLUMN Signature NVARCHAR(1000),
ADD COLUMN Fingerprint NVARCHAR(1000),
ADD COLUMN CompanyTrainingItemId NVARCHAR(50);
ADD Signature NVARCHAR(1000),
ADD Fingerprint NVARCHAR(1000),
ADD CompanyTrainingItemId NVARCHAR(50);
go

View File

@ -0,0 +1,72 @@
CREATE TABLE [dbo].[InformedConsentForm] (
[FormId] nvarchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL,
[WorkPostName] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL,
[JobRiskNotice] nvarchar(max) NULL,
[HealthCommitment] nvarchar(max) NULL,
[SafetyCommitment] nvarchar(max) NULL,
[SafetyQualityResponsibility] nvarchar(max) NULL,
)
GO
EXEC sp_addextendedproperty
'MS_Description', N'主键',
'SCHEMA', N'dbo',
'TABLE', N'InformedConsentForm',
'COLUMN', N'FormId'
GO
EXEC sp_addextendedproperty
'MS_Description', N'岗位',
'SCHEMA', N'dbo',
'TABLE', N'InformedConsentForm',
'COLUMN', N'WorkPostName'
GO
EXEC sp_addextendedproperty
'MS_Description', N'岗位危险告知书',
'SCHEMA', N'dbo',
'TABLE', N'InformedConsentForm',
'COLUMN', N'JobRiskNotice'
GO
EXEC sp_addextendedproperty
'MS_Description', N'入场工人健康承诺书',
'SCHEMA', N'dbo',
'TABLE', N'InformedConsentForm',
'COLUMN', N'HealthCommitment'
GO
EXEC sp_addextendedproperty
'MS_Description', N'安全承诺书',
'SCHEMA', N'dbo',
'TABLE', N'InformedConsentForm',
'COLUMN', N'SafetyCommitment'
GO
EXEC sp_addextendedproperty
'MS_Description', N'安全质量责任书',
'SCHEMA', N'dbo',
'TABLE', N'InformedConsentForm',
'COLUMN', N'SafetyQualityResponsibility'
GO
EXEC sp_addextendedproperty
'MS_Description', N'告知承诺书',
'SCHEMA', N'dbo',
'TABLE', N'InformedConsentForm'
ALTER TABLE SitePerson_Person
ADD SignTime datetime NULL
go
EXEC sp_addextendedproperty
'MS_Description', N'签字时间',
'SCHEMA', N'dbo',
'TABLE', N'SitePerson_Person',
'COLUMN', N'SignTime'
GO

View File

@ -113,7 +113,7 @@
中化学建设投资集团安徽工程有限公司
合肥市五里庙复建点东区项目部
«projectName»
«date2»
@ -143,7 +143,7 @@
承诺人签字和按手印«sign3»
日期: 年 月 日
日期: «date2»
@ -168,7 +168,7 @@
承诺人«sign4»
承诺时间: 年 月 日
承诺时间: «date2»
@ -261,7 +261,7 @@
年 月 日 年 月 日
年 月 日 «date2»

View File

@ -777,6 +777,7 @@ namespace FineUIPro.Web.HSSE.SitePerson
}
var person = Funs.DB.View_SitePerson_Person.FirstOrDefault(x => x.PersonId == Grid1.SelectedRowID);
var personData = Funs.DB.SitePerson_Person.FirstOrDefault(x => x.PersonId == Grid1.SelectedRowID);
if (person != null)
{
@ -903,7 +904,6 @@ namespace FineUIPro.Web.HSSE.SitePerson
join user in Funs.DB.Sys_User on TestPlan.PlanManId equals user.UserId into gUser
from user in gUser.DefaultIfEmpty()
where x.TestManId == person.PersonId
// where x.TestManId == "d9f795a2-b8eb-4872-9e4c-4a3dba028b5c"
orderby x.TestEndTime descending
select new
{
@ -998,20 +998,16 @@ namespace FineUIPro.Web.HSSE.SitePerson
helper.AddImage(string.Empty, "sign2", 0, 0, 0, 0);
}
DateTime dateTime2 = new DateTime(2024, 6, 25);
// 构建格式化的字符串
string date2 = $" {dateTime2.Year} 年 {dateTime2.Month:D2} 月 {dateTime2.Day:D2} 日";
string date2 = personData.SignTime.HasValue
? $" {personData.SignTime.Value.Year} 年 {personData.SignTime.Value.Month:D2} 月 {personData.SignTime.Value.Day:D2} 日"
: "";
string IdentityCard = person.IdentityCard;
string Telephone = person.Telephone;
// 假设我们有一个DateTime对象
DateTime dateTime = new DateTime(2024, 6, 25);
// 提取年、月、日
int year = dateTime.Year;
int month = dateTime.Month;
int day = dateTime.Day;
string year = person.InTime.HasValue ? person.InTime.Value.Year.ToString() : "";
string month = person.InTime.HasValue ? person.InTime.Value.Month.ToString() : "";
string day = person.InTime.HasValue ? person.InTime.Value.Day.ToString() : "";
string sign3 = AttachFileService.getFileUrl(person.PersonId + "_3");
if (!string.IsNullOrEmpty(sign3))

View File

@ -6909,6 +6909,14 @@ namespace Model
}
}
public System.Data.Linq.Table<InformedConsentForm> InformedConsentForm
{
get
{
return this.GetTable<InformedConsentForm>();
}
}
public System.Data.Linq.Table<InterFaceLog> InterFaceLog
{
get
@ -237894,6 +237902,123 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.InformedConsentForm")]
public partial class InformedConsentForm
{
private string _FormId;
private string _WorkPostName;
private string _JobRiskNotice;
private string _HealthCommitment;
private string _SafetyCommitment;
private string _SafetyQualityResponsibility;
public InformedConsentForm()
{
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FormId", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
public string FormId
{
get
{
return this._FormId;
}
set
{
if ((this._FormId != value))
{
this._FormId = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPostName", DbType="NVarChar(50)")]
public string WorkPostName
{
get
{
return this._WorkPostName;
}
set
{
if ((this._WorkPostName != value))
{
this._WorkPostName = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_JobRiskNotice", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)]
public string JobRiskNotice
{
get
{
return this._JobRiskNotice;
}
set
{
if ((this._JobRiskNotice != value))
{
this._JobRiskNotice = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_HealthCommitment", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)]
public string HealthCommitment
{
get
{
return this._HealthCommitment;
}
set
{
if ((this._HealthCommitment != value))
{
this._HealthCommitment = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SafetyCommitment", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)]
public string SafetyCommitment
{
get
{
return this._SafetyCommitment;
}
set
{
if ((this._SafetyCommitment != value))
{
this._SafetyCommitment = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SafetyQualityResponsibility", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)]
public string SafetyQualityResponsibility
{
get
{
return this._SafetyQualityResponsibility;
}
set
{
if ((this._SafetyQualityResponsibility != value))
{
this._SafetyQualityResponsibility = value;
}
}
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.InterFaceLog")]
public partial class InterFaceLog : INotifyPropertyChanging, INotifyPropertyChanged
{
@ -363390,6 +363515,8 @@ namespace Model
private string _PersonStates;
private System.Nullable<System.DateTime> _SignTime;
private EntitySet<Accident_AccidentPersonRecord> _Accident_AccidentPersonRecord;
private EntitySet<Accident_AccidentReportOtherItem> _Accident_AccidentReportOtherItem;
@ -363592,6 +363719,8 @@ namespace Model
partial void OnLanguagesChanged();
partial void OnPersonStatesChanging(string value);
partial void OnPersonStatesChanged();
partial void OnSignTimeChanging(System.Nullable<System.DateTime> value);
partial void OnSignTimeChanged();
#endregion
public SitePerson_Person()
@ -365022,6 +365151,26 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SignTime", DbType="DateTime")]
public System.Nullable<System.DateTime> SignTime
{
get
{
return this._SignTime;
}
set
{
if ((this._SignTime != value))
{
this.OnSignTimeChanging(value);
this.SendPropertyChanging();
this._SignTime = value;
this.SendPropertyChanged("SignTime");
this.OnSignTimeChanged();
}
}
}
[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
{

View File

@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using BLL;
using Model;
namespace WebAPI.Controllers.HSSE
{
public class InformedConsentFormController:ApiController
{
#region
/// <summary>
/// </summary>
/// <param name="PersonId"></param>
/// <returns></returns>
public Model.ResponeData getFormByWorkPostName(string PersonId)
{
var responeData = new Model.ResponeData();
try
{
var person = Funs.DB.View_SitePerson_Person.FirstOrDefault(x => x.PersonId == PersonId);
InformedConsentForm getData = new InformedConsentForm();
if (person != null)
{
string projectName = Funs.DB.Base_Project.First(z => z.ProjectId == person.ProjectId).ProjectName;
string name = person.PersonName;
string IdentityCard = person.IdentityCard;
string Telephone = person.Telephone;
string year = person.InTime.HasValue ? person.InTime.Value.Year.ToString() : "";
string month = person.InTime.HasValue ? person.InTime.Value.Month.ToString() : "";
string day = person.InTime.HasValue ? person.InTime.Value.Day.ToString() : "";
getData = (from x in Funs.DB.InformedConsentForm
where x.WorkPostName == person.WorkPostName
select x).FirstOrDefault();
if (getData != null)
{
// 替换$name占位符
getData.JobRiskNotice = getData.JobRiskNotice.Replace("$name", name);
// 替换多个占位符
getData.HealthCommitment = getData.HealthCommitment.Replace("$name", name)
.Replace("$IdentityCard", IdentityCard)
.Replace("$Telephone", Telephone)
.Replace("$year", year)
.Replace("$month", month)
.Replace("$day", day)
.Replace("$projectName", projectName);
}
}
responeData.data = new { getData };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region id修改签字时间
/// <summary>
/// </summary> 保存签字图片的时格式是tokenkey=PersonId_1
/// <param name="PersonId"></param>
/// <returns></returns>
[HttpPost]
public Model.ResponeData updateSignTime(string PersonId, DateTime? newSignTime = null)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var responeData = new Model.ResponeData();
try
{
// 查找要修改的记录
var person = db.SitePerson_Person.FirstOrDefault(x => x.PersonId == PersonId);
if (person != null)
{
person.SignTime = newSignTime.HasValue ? newSignTime.Value : DateTime.Now; // 更新签字时间
db.SubmitChanges();
responeData.code = 1;
responeData.message = "保存成功。";
}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
#endregion
}
}

View File

@ -201,6 +201,7 @@
<Compile Include="Controllers\HSSE\GeneralEquipmentQualityController.cs" />
<Compile Include="Controllers\HSSE\GoodsManageController.cs" />
<Compile Include="Controllers\HSSE\HazardRealTimeController.cs" />
<Compile Include="Controllers\HSSE\InformedConsentFormController.cs" />
<Compile Include="Controllers\HSSE\MaterialController.cs" />
<Compile Include="Controllers\HSSE\ModelTestRecordController.cs" />
<Compile Include="Controllers\HSSE\TrainTestRecordController.cs" />