fix:一人一档导出

This commit is contained in:
geh 2025-04-14 19:47:49 +08:00
parent 24390f1ea0
commit 4d7e4d1806
13 changed files with 1483 additions and 299 deletions

View File

@ -897,5 +897,74 @@ namespace BLL
}
}
#endregion
public static List<Model.TestRecordItem> getTrainingTestRecordListByDepartId( string unitId, string departId, string strPass, string strParam)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
var getDataLists = (from x in db.Training_TestRecord
join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
join z in db.Sys_User on x.TestManId equals z.UserId
where x.ProjectId == null && x.TestStartTime.HasValue && x.TestEndTime.HasValue
orderby x.TestStartTime descending
select new Model.TestRecordItem
{
TestRecordId = x.TestRecordId,
ProjectId = x.ProjectId,
TestPlanId = x.TestPlanId,
TestPlanName = y.PlanName,
UnitId = z.UnitId,
UnitName = getUnitName(z.UnitId),
WorkPostId = z.WorkPostId,
WorkPostName = db.Base_WorkPost.FirstOrDefault(p => p.WorkPostId == z.WorkPostId).WorkPostName,
DepartId = z.DepartId,
TestManId = x.TestManId,
TestManName = db.SitePerson_Person.FirstOrDefault(p => p.PersonId == x.TestManId).PersonName,
TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime),
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
Duration = x.Duration,
TestPlanEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime.Value.AddMinutes(x.Duration)),
TotalScore = y.TotalScore ?? 0,
TestScores = x.TestScores ?? 0,
TestType = x.TestType,
TemporaryUser = x.TemporaryUser,
});
if (!string.IsNullOrEmpty(unitId))
{
getDataLists = getDataLists.Where(x => x.UnitId == unitId);
}
if (!string.IsNullOrEmpty(departId))
{
getDataLists = getDataLists.Where(x => x.DepartId == departId);
}
if (!string.IsNullOrEmpty(strParam))
{
getDataLists = getDataLists.Where(x => x.TestManName.Contains(strParam));
}
if (!string.IsNullOrEmpty(strPass))
{
int PassingScore = SysConstSetService.getPassScoreForApi();
if (strPass == "0")
{
getDataLists = getDataLists.Where(x => x.TestScores < PassingScore);
}
else
{
getDataLists = getDataLists.Where(x => x.TestScores >= PassingScore);
}
}
foreach(var item in getDataLists)
{
var depart = db.Base_Depart.FirstOrDefault(x => x.DepartId == item.DepartId);
if (depart != null)
{
item.DepartName = depart.DepartName;
}
}
return getDataLists.ToList();
}
}
}
}

View File

@ -67,8 +67,11 @@
<Reference Include="ICSharpCode.SharpZipLib, Version=1.3.3.11, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.1.3.3\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.9.0.0\lib\netstandard2.0\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\lib\net461\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.QualityTools.Testing.Fakes, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.QualityTools.Testing.Fakes.16.11.230815\lib\net35\Microsoft.QualityTools.Testing.Fakes.dll</HintPath>
@ -78,6 +81,7 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SqlServer.ManagedDTS\v4.0_16.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.ManagedDTS.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
@ -97,12 +101,18 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\FineUIPro\Reference BLL\NPOI.OpenXmlFormats.dll</HintPath>
</Reference>
<Reference Include="Pipelines.Sockets.Unofficial, Version=1.0.0.0, Culture=neutral, PublicKeyToken=42ea0a778e13fbe2, processorArchitecture=MSIL">
<HintPath>..\packages\Pipelines.Sockets.Unofficial.2.2.8\lib\net461\Pipelines.Sockets.Unofficial.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=3.7.0.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.3.7.0\lib\netstandard2.0\Quartz.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=106.15.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.106.15.0\lib\net452\RestSharp.dll</HintPath>
</Reference>
<Reference Include="StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46, processorArchitecture=MSIL">
<HintPath>..\packages\StackExchange.Redis.2.7.33\lib\net461\StackExchange.Redis.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
@ -119,6 +129,12 @@
</Reference>
<Reference Include="System.DirectoryServices" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
</Reference>
<Reference Include="System.IO.Pipelines, Version=5.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.5.0.1\lib\net461\System.IO.Pipelines.dll</HintPath>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
@ -129,6 +145,9 @@
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.Security.AccessControl, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
@ -142,6 +161,9 @@
</Reference>
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Threading.Channels, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Channels.5.0.0\lib\net461\System.Threading.Channels.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
@ -263,6 +285,9 @@
<Compile Include="Common\NPOIHelper.cs" />
<Compile Include="Common\PrinterDocService.cs" />
<Compile Include="Common\ProjectDataFlowSetService.cs" />
<Compile Include="Common\Redis\ICache.cs" />
<Compile Include="Common\Redis\Redis.cs" />
<Compile Include="Common\Redis\RedisHelper.cs" />
<Compile Include="Common\UploadFileService.cs" />
<Compile Include="Common\UpLoadImageService.cs" />
<Compile Include="Common\UserShowColumnsService.cs" />
@ -1504,6 +1529,13 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Microsoft.QualityTools.Testing.Fakes.16.11.230815\build\Microsoft.Qualitytools.Testing.Fakes.targets" Condition="Exists('..\packages\Microsoft.QualityTools.Testing.Fakes.16.11.230815\build\Microsoft.Qualitytools.Testing.Fakes.targets')" />
<Import Project="..\packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\build\Microsoft.Extensions.Logging.Abstractions.targets" Condition="Exists('..\packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\build\Microsoft.Extensions.Logging.Abstractions.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\build\Microsoft.Extensions.Logging.Abstractions.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\build\Microsoft.Extensions.Logging.Abstractions.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@ -8,6 +8,8 @@ using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using Aspose.Words.Drawing;
using Shape = Aspose.Words.Drawing.Shape;
namespace BLL
{
@ -29,6 +31,40 @@ namespace BLL
{
wordDoc = new Document(path);
}
/// <summary>
/// 添加图片
/// </summary>
/// <param name="filename">文件路径+文件名</param>
/// <param name="field">文本域名</param>
/// <param name="width">宽</param>
/// <param name="height">高</param>
public void AddImage(string filename, string field, double width, double height, double left, double top)
{
DocumentBuilder builder = new DocumentBuilder(wordDoc);
Shape shape = new Shape(wordDoc, ShapeType.Image);
if (!string.IsNullOrEmpty(filename))
{
shape.ImageData.SetImage(filename);
shape.Width = width;//设置宽和高
shape.Height = height;
shape.Left = left;
shape.Top = top;
shape.WrapType = WrapType.None;
shape.BehindText = true;
builder.MoveToMergeField(field);
builder.InsertNode(shape);
}
else
{
//没有图片用空替换占位域值
builder.MoveToMergeField(field);
builder.Write("");
}
}
/// <summary>
/// 书签赋值用法
@ -269,7 +305,7 @@ namespace BLL
/// </summary>
/// <param name="Html">html代码</param>
/// <param name="path">保存路径</param>
public static void HtmlIntoWord(string Html,string path)
public void HtmlIntoWord(string Html,string path)
{
StringBuilder sb = new StringBuilder();

View File

@ -1304,5 +1304,29 @@ namespace BLL
return personId;
}
public static string GetPersonIdByUserIdForApi(string userId)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
string personId = userId;
var getPerson = db.SitePerson_Person.FirstOrDefault(e => e.PersonId == userId);
if (getPerson == null)
{
var getUser = db.Sys_User.FirstOrDefault(e => e.UserId == userId);
if (getUser != null)
{
getPerson = db.SitePerson_Person.FirstOrDefault(e => e.IdentityCard == getUser.IdentityCard);
if (getPerson != null)
{
personId = getPerson.PersonId;
}
}
}
return personId;
}
}
}
}

View File

@ -394,5 +394,19 @@
}
}
#endregion
public static int getPassScoreForApi()
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
int passScore = 80;
var testRule = db.Sys_TestRule.FirstOrDefault();
if (testRule != null)
{
passScore = testRule.PassingScore;
}
return passScore;
}
}
}
}

View File

@ -0,0 +1,298 @@
中化学建设投资集团安徽工程有限公司
职工入场安全教育培训
(安徽成汉)
[pic]
培训单位: «projectName»
岗 位: 电工
被培训人: «name»
时 间: «time»
新工人入场三级安全教育登记卡
工程名称中化学建设投资集团安徽工程有限公司«projectName»
|姓 名 |«name» |«IdCardFront» «IdCardBack» |
|性 别 |«sex» | |
|进场日期 |«InTime» | |
|岗 位 |电工 | |
|三级安全教育内容 |学时 |教育人 |被教育人 |
|公司|进行安全基本知识、法规、法制教育,主 |15 |签名«sign» |签名«sign1|
|级教|要内容是: | | |» |
|育 |1.党和国家的安全生产方针、政策; | | | |
| |2.安全生产法规、标准和安全知识; | | | |
| |3.企业安全生产规章制度、安全纪律; | | | |
| |4.安全生产形势及重大事故案例教训; | | | |
| |5.发生事故后如何抢救伤员、排险、保护 | | | |
| |现场及时报告。 | | | |
| | | |日期: «date1» |
|项目|进入现场规章制度和遵章守纪教育,主要 |15 |签名«sign» |签名«sign1|
|级教|内容是: | | |_1» |
|育 |1.本项目施工特点、可能存在的不安全因 | | | |
| |素及必须遵守的事项; | | | |
| |2.本单位(包括施工、生产现场)安全生 | | | |
| |产制度、规定和安全注意事项; | | | |
| |3.本岗位的安全技术操作规程; | | | |
| |4.高处作业、机械设备、电气安全基础知 | | | |
| |识; | | | |
| |5.防火、防毒、防尘、防爆知识及紧急情 | | | |
| |况安全处置的安全疏散知识; | | | |
| |6.防护用品发放标准及防护用品、用具使 | | | |
| |用的基础知识。 | | | |
| | | |日期: «date1» |
|班组|进行本岗位安全操作及部门安全制度、纪 |20 |签名«sign» |签名«sign1|
|级教|律教育,主要内容是: | | |_2» |
|育 |1.本部门作业特点及安全操作规程; | | | |
| |2.部门安全活动制度及纪律; | | | |
| |3.爱护和正确使用安全防护装置(设施) | | | |
| |及个人防护用品; | | | |
| |4.本岗位易发生事故的不安全因素及其防 | | | |
| |范对策;本岗位事故案例剖析; | | | |
| |5.本岗位的作业环境及使用的机械设备、 | | | |
| |工具的安全要求。 | | | |
| | | |日期: «date1» |
填表说明:
1、应建立健全定期的安全生产教育培训制度。
2、新工人入场必须填写登记表个人部分的内容。
3、进行公司、项目部、班组每级安全教育后经教育人和受教育人分别签名。
岗位危险告知书
工种: 电工
«name»
你将从事的 电工 作业,存在着 触电、灼伤、电气火灾
等岗位危险,予以告知。你在作业时务必遵守相关的规章制度和操作规程,并熟记作业
要点及其特性,掌握好相应的安全防范技能;进入作业场所后,要进行重新检查,发现
异常情况和不安全因素必须及时采取有效措施排除;要正确使用和佩戴劳动保护用品,
在做好自我防范的同时,还要认真贯彻联保互保。同时对以下针对性措施必须经常对照
执行:
1、电工作业必须经专业安全技术培训考试合格并取得特种作业操作证后方可独立
上岗操作,非电工严禁进行电气作业。电工作业应按规定正确使用个人防护用品,酒后
不准进行电气操作。
2、电气设备的设置、安装、防护、使用、维修及线路架设必须符合有关安全技术规
范的要求。
3、线路上禁止带负荷接电或断电电气设备、维修保养、线路检修、安装时不准
带电操作。
4、各线路不得超过额定容量运行不可使用超过规定容量保险丝、保险片。
5、施工用电系统必须有保证灵敏可靠的两级及以上保护施工用电与生活用电线路
必须分开架设。
6、施工现场配电箱要有防雨措施门锁齐全有色标统一编号开关箱要做到一
机一闸一保险,箱内无杂物,开关箱、配电箱内严禁动力、照明混用。
7、各线路不得超过额定容量运行不可使用超过规定容量保险丝、保险片。
8、维修电器设备时必须首先切断电源取下熔断丝挂上警示牌经验电确认无
电才能作业。通电试验外壳要接地,禁止他人靠近。
9、高空作业必须有人监护、系安全带使用竹木梯要牢固平稳角度适当不准上下
抛掷工具物品。
10、凡裸体带荷电的空架配电线路在通过各种容易发生危险的地段应挂有警示标牌
,引人注意。
11、遇有异常雷雨时特别要注意电气设备的用电安全严防受潮漏电必要时应拉
闸停电,确保安全。
12、发生电气设备和触电事故时首先切断电源然后进行抢救、抢修。相关人员须
熟悉触电救护知识。
被告知者签字指印«sign2»
此告知书一式二份,一份交作业者本人留存,一份留项目部安质部存档备查。
中化学建设投资集团安徽工程有限公司
合肥市五里庙复建点东区项目部
«date2»
入场工人健康承诺书
本人: «name» (身份证: «IdentityCard»
手机号: «Telephone» )于 «year» 年
«month» 月 «day»
日进入«projectName»工作本人承诺未患有以下疾病或类似病例
1、未患有脑、神经系统及精神方面的疾病例如:反复头疼眩晕,美尼尔综合征、
脑部需要或已经做过手术或其它症状;
2、未患有心血管疾病例如:遗传性心脏病、高血压、动脉瘤、卒中、心梗等;
未患有呼吸系统疾病,例如:反复咳嗽、咯痰、咯血、肺气肿、肺心病、肺结核等;
4、未患有消化系统疾病例如:原因不明的短期内消瘦、肝区疼痛、乙肝等;
5、未患有癫痛疾病、3 级高血压;
6、未患有传染性皮肤病
7、未患有其它各种癌症疾病。
8、年龄超过50岁的人员进入施工现场必须进行健康体检提供健康报告健康体检
报告有效期为一年时间。
特别说明:
*以上如有隐瞒事实真相的,本人愿承担一切后果!!!
承诺单位(单位章):
承诺人签字和按手印«sign3»
日期: 年 月 日
安 全 承 诺 书
我已通过本岗位安全培训教育,掌握了工作内容所需的安全知识和安全防护常识,
会正确使用劳动保护用品、用具。本人承诺:
一、认真执行“安全第一,预防为主、综合治理”的安全生产方针,遵守各项安全生
产制度和规定,做到不伤害自己、不伤害他人、不被他人伤害。
二、服从项目部管理,不违章作业、不违反劳动纪律,抵制违章指挥,纠正违章行
为。
三、按规定着装上岗,穿戴好劳动防护用品、用具。
四、如因本人不服从现场管理,不遵守安全操作规程,违章乱纪、违规蛮干等行为
造成的安全事故(包括涉及本人的伤亡事故)均由本人承担一切经济损失和法律责任。
承诺人«sign4»
承诺时间: 年 月 日
安全质量责任书
甲方: 中化学建投安徽工程公司«projectName»
乙方: «name»
  
为了完成本班组与作业队签订的安全质量责任书中规定的各项指标,确保作业人员安
全和每道施工工序的施工质量,避免集体和个人经济(财产)损失等,按照层层包保,
分级负责的原则,经协商,签订本责任书。
第一条 责任范围
本岗位在该项目施工范围内的所有作业和相关活动。
第二条 责任目标
不制造职业健康安全隐患,不制造质量缺陷,不制造环境污染;保证不伤害自己,不
伤害他人,不被他人伤害,保护他人不受伤害。
第三条 责任承诺
乙方承诺服从工区和班组管理,严格遵守项目各项管理制度,做到以下相关要求:
3.1进场后接受项目的岗前安全质量培训,经考试合格后上岗;施工过程中接受必要
的安全质量和技能培训,没培训不上岗,培训不合格不上岗。
3.2进入施工现场后,正确佩戴安全帽、安全带等安全防护用品;积极配合群众安全
监督员的工作,对现场提出的涉及本人的安全质量问题及隐患,及时整改、落实到位。
3.3向甲方如实说明自己的身体状况,不隐瞒以往病史,定期进行体检,身体健康,
无酗酒、吸毒史,无现场施工行业所禁止的身体健康禁忌症。
3.4施工前认真聆听班组班前讲话和施工注意事项;施工中严格遵守,不违章,并能
对其他违章现象进行提醒和制止。
3.5接受项目的施工交底,熟悉各项工序施工的技术交底、安全技术交底和规范要求
,熟悉各项工序施工的安全和质量措施。
3.6严格按照交底和规范要求施工,对交底有疑问的及时咨询,不随意作业,不私自
降低施工标准,不偷工减料。
3.7本道工序施工完成后进行自检,自检合格后报工班长检查;对质量不合格的上道
工序不予接收。
3.8对各级检查发现的问题,严格按照项目整改通知书要求进行整改。
3.9严格遵守安全质量法律法规和施工现场安全质量管理相关制度,遵守劳动纪律,
杜绝违反制度、违反劳动纪律、违章操作等不安全、不文明行为。
3.10
施工中不带病作业,坚持不伤害自己、不伤害他人,不被他人伤害;按要求佩戴好劳动
防护用品。
3.11有权拒绝违章指挥。
3.12施工中发现安全质量隐患及时上报,并配合项目要求及时消除安全质量隐患;发
现有安全质量隐患并上报后,有权拒绝继续冒险作业。
3.13
不破坏施工现场的安全质量防护设施;施工现场的脚手架、安全标识、警示牌等,不私
自拆除及挪作他用。
3.14 不在仓库、油桶等有明确禁止吸烟的地方吸烟、生火。
3.15无证或有证但未经许可,不私自操作施工机械或其他特殊设备。
3.16
严格遵守项目环境保护制度,施工产生的建筑垃圾按照项目要求处理,不随便倾倒施工
垃圾,做到工完料尽,文明施工。
3.17 不在宿舍内私拉乱设电线和用电设备;严格遵守项目“五防”要求;
3.18 其他安全、质量、环保及职业健康相关要求。
第四条 责任追究
未遵守以上要求的违规行为,由工区给以一定金额的罚款,因此造成安全事故、质量缺
陷或环境污染事件的,将加重处罚:
4.1进入施工现场必须戴安全帽高空作业必须系安全带违者每次罚款100元。
4.2严禁私自乱接和摆弄电器设备,违者对造成损坏电器设备的除赔偿经济损失外,
对责任人罚款100元。
4.3氧气、乙炔瓶的安全距离5米及以上且氧气、乙炔瓶必须按照要求佩戴防震胶圈
不得使用没有标定的压力表氧气瓶平放乙炔瓶立放违者每次罚款100元。
4.4 小型机具必须定人定机使用违者每次罚款50元。
4.5现场机具必须悬挂安全操作规程牌,并严格按照安全规程进行操作,同时要求机
具设备良好各类安全防护齐全违者每次罚款50元。
4.6工作时间严禁穿拖鞋、高跟鞋等违者每次罚款50元。
4.7 严禁酒后作业违者每次罚款200元。
4.8高空施工必须设置爬梯不得沿着在建物进行上下违者每次罚款100元。
4.9 基坑施工中必须穿绝缘胶鞋焊接作业时要戴绝缘手套违者每次罚款50元。
4.10
对相同问题经提出整改要求后,拒不整改,再次连续出现的,对本人进行再次培训和考
核,合格后上岗作业仍多次出现相同问题的,予以辞退。
第五条 其他内容
5.1本责任书没有涉及的有关安全质量责任追究和处罚内容,按照《中化学建设投资集
团安徽工程有限公司合肥市五里庙复建点东区项目安全质量文明施工奖惩办法》规定执行
5.2本责任书一式两份,双方各执一份;自双方签字之日起生效,按年度考核。
甲方代表   乙方
(签章)  (签章)
«sign5»
年 月 日 年 月 日
| |
| |
| |
| |
| |
|中化学建投«projectName» |
|入场教育 |
|单位名称«unitName» |工种/职务«workPo|日期«TestStart|
| |stName» |Time» |
|姓名«testName» |身份证号«IdCard» |分数«TestScores»|
|一、单项选择题 (每题«SValue»分共«SValueCount»分) |
|«TableStart:TableS»«SProblem» |
|«SOption»«TableEnd:TableS» |
|二、多项选择题 (每题«MValue»分共«MValueCount»分) |
|«TableStart:TableM»«MProblem» |
|«MOption»«TableEnd:TableM» |
|三、判断题 (每题«JValue»分共«JValueCount»分) |
|«TableStart:TableJ»«data»«TableEnd:TableJ» |
| |
| | | |
|«imgStr1» |«imgStr2» |«imgStr3» |

View File

@ -149,6 +149,9 @@
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net" />
<Reference Include="System.Net.Http">
<HintPath>..\BLL\bin\Debug\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>

View File

@ -194,6 +194,9 @@
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true"
Hidden="true" runat="server" Text="修改" Icon="Pencil">
</f:MenuButton>
<f:MenuButton ID="btnPrinter" EnablePostBack="true" runat="server"
Text="导出" Icon="Printer" OnClick="butExport_Click" EnableAjax="false" DisableControlBeforePostBack="false">
</f:MenuButton>
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true"
Hidden="true" ConfirmText="删除选中行?" ConfirmTarget="Parent" runat="server" Icon="Delete" Text="删除">
</f:MenuButton>

View File

@ -7,6 +7,10 @@ using System.Data.SqlClient;
using System.Linq;
using System.Text;
using AspNet = System.Web.UI.WebControls;
using Aspose.Words;
using System.IO;
using System.Threading;
using Model;
namespace FineUIPro.Web.HSSE.SitePerson
{
@ -763,5 +767,519 @@ namespace FineUIPro.Web.HSSE.SitePerson
}
return age;
}
protected void butExport_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
var person = Funs.DB.View_SitePerson_Person.FirstOrDefault(x => x.PersonId == Grid1.SelectedRowID);
if (person != null)
{
string rootPath = Server.MapPath("~/");
string initTemplatePath = string.Empty;
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
if (person.WorkPostName == "电工")
{
initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(电工).doc";
}
// else if (person.WorkPostName == "电焊工")
// {
// initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(电焊工).doc";
// }
// else if (person.WorkPostName == "防水普工")
// {
// initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(防水普工).doc";
// }
// else if (person.WorkPostName == "钢筋工")
// {
// initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(钢筋工).doc";
// }
// else if (person.WorkPostName == "管理人员")
// {
// initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(管理人员).doc";
// }
// else if (person.WorkPostName == "架子工")
// {
// initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(架子工).doc";
// }
// else if (person.WorkPostName == "木工")
// {
// initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(木工).doc";
// }
// else if (person.WorkPostName == "普工")
// {
// initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(普工).doc";
// }
// else if (person.WorkPostName == "施工电梯司机")
// {
// initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(施工电梯司机).doc";
// }
// else if (person.WorkPostName == "水电工")
// {
// initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(水电工).doc";
// }
// else if (person.WorkPostName == "司索信号工")
// {
// initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(司索信号工).doc";
// }
// else if (person.WorkPostName == "塔吊司机")
// {
// initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(塔吊司机).doc";
// }
// else if (person.WorkPostName == "挖机司机")
// {
// initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(挖机司机).doc";
// }
// else if (person.WorkPostName == "瓦工")
// {
// initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(瓦工).doc";
// }
// else if (person.WorkPostName == "渣土车司机")
// {
// initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(渣土车司机).doc";
// }
// else if (person.WorkPostName == "桩基")
// {
// initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(桩基).doc";
// }
// else if (person.WorkPostName == "装配、灌浆工")
// {
// initTemplatePath = "File\\Word\\Person\\安全教育培训打印整套(装配、灌浆工).doc";
// }
else
{
Alert.ShowInTop("当前岗位类型不可导出!", MessageBoxIcon.Warning);
return;
}
uploadfilepath = rootPath + initTemplatePath;
newUrl = uploadfilepath.Replace(".doc", person.PersonName + ".doc");
if (File.Exists(newUrl))
{
File.Delete(newUrl);
}
File.Copy(uploadfilepath, newUrl);
AsposeWordHelper helper = new AsposeWordHelper();
helper.OpenTempelte(newUrl); //打开模板文件
string projectName = Funs.DB.Base_Project.First(z => z.ProjectId == person.ProjectId).ProjectName;
string name = person.PersonName;
string time = DateTime.Now.ToString("yyyy-MM-dd");
string sex = string.IsNullOrEmpty(person.Sex) ? "" : person.Sex == "1" ? "男" : "女";
string InTime = person.InTime.HasValue ? string.Format("{0:yyyy-MM-dd}", person.InTime) : "";
string IdCardFront = AttachFileService.getFileUrl(person.PersonId + "#1");
string IdCardBack = AttachFileService.getFileUrl(person.PersonId + "#5");
if (!string.IsNullOrEmpty(IdCardFront))
{
helper.AddImage(rootPath + IdCardFront, "IdCardFront", 100, 100, 10, 20);
}
else
{
helper.AddImage(string.Empty, "IdCardFront", 100, 100, 10, 20);
}
if (!string.IsNullOrEmpty(IdCardBack))
{
helper.AddImage(rootPath + IdCardBack, "IdCardBack", 100, 100, 120, 20);
}
else
{
helper.AddImage(string.Empty, "IdCardBack", 100, 100, 10, 20);
}
var gTrainingTestRecord =
(from x in Funs.DB.Training_TestRecord
join TestPlan in Funs.DB.Training_TestPlan on x.TestPlanId equals TestPlan.TestPlanId into
gTestPlan
from TestPlan in gTestPlan.DefaultIfEmpty()
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
{
TestRecordId = x.TestRecordId,
TestStartTime = x.TestStartTime,
TestEndTime = x.TestEndTime,
Signature = x.Signature,
TestScores = x.TestScores,
PlanManName = user == null ? "" : user.UserName
}).FirstOrDefault();
string date1 = "";
string sign = "";
string sign1 = "";
string TestRecordId = "";
decimal? TestScores = null;
DateTime? TestStartTime = null;
DateTime? dateTime1 = null;
string Signature = "";
string unitName = "";
string workPostName = "";
string testName = "";
string IdCard = "";
int SValue = 0;
int SValueCount = 0;
int MValue = 0;
int MValueCount = 0;
int JValue = 0;
int JValueCount = 0;
Sys_TestRule sysTestRule = null;
IQueryable<Training_TestRecordItem> getTestItems = null;
List<Training_TestRecordItem> getSingleItem = new List<Training_TestRecordItem>();
List<Training_TestRecordItem> getMultipleItem = new List<Training_TestRecordItem>();
List<Training_TestRecordItem> getIsTrueItem = new List<Training_TestRecordItem>();
if (gTrainingTestRecord != null)
{
testName = person.PersonName;
IdCard = person.IdentityCard;
Signature = gTrainingTestRecord.Signature;
TestScores = gTrainingTestRecord.TestScores;
TestStartTime = gTrainingTestRecord.TestStartTime;
TestRecordId = gTrainingTestRecord.TestRecordId;
sign = gTrainingTestRecord.PlanManName;
sign1 = AttachFileService.getFileUrl(person.PersonId + "_1");
dateTime1 = gTrainingTestRecord.TestStartTime.Value;
unitName = BLL.UnitService.GetUnitNameByUnitId(person.UnitId);
workPostName = WorkPostService.getWorkPostNamesWorkPostIds(person.WorkPostId);
sysTestRule = Funs.DB.Sys_TestRule.FirstOrDefault();
getTestItems = from x in Funs.DB.Training_TestRecordItem
where x.TestRecordId == TestRecordId
select x;
getSingleItem = getTestItems.Where(x => x.TestType == "1").ToList();
SValue = sysTestRule.SValue; //每题分数
SValueCount = sysTestRule.SValue * getSingleItem.Count; //总分
getMultipleItem = getTestItems.Where(x => x.TestType == "2").ToList();
MValue = sysTestRule.MValue; //每题分数
MValueCount = sysTestRule.MValue * getMultipleItem.Count; //总分
getIsTrueItem = getTestItems.Where(x => x.TestType == "3").ToList();
JValue = sysTestRule.JValue; //每题分数
JValueCount = sysTestRule.JValue * getIsTrueItem.Count; //总分
}
if (!string.IsNullOrEmpty(sign1))
{
helper.AddImage(rootPath + sign1, "sign1", 50, 25, 15, 30);
helper.AddImage(rootPath + sign1, "sign1_1", 50, 25, 15, 30);
helper.AddImage(rootPath + sign1, "sign1_2", 50, 25, 15, 30);
}
else
{
helper.AddImage(string.Empty, "sign1", 0, 0, 0, 0);
helper.AddImage(string.Empty, "sign1_1", 0, 0, 0, 0);
helper.AddImage(string.Empty, "sign1_2", 0, 0, 0, 0);
}
// 构建格式化的字符串
date1 = dateTime1.HasValue
? $" {dateTime1.Value.Year} 年 {dateTime1.Value.Month:D2} 月 {dateTime1.Value.Day:D2} 日"
: "";
string sign2 = AttachFileService.getFileUrl(person.PersonId + "_2");
if (!string.IsNullOrEmpty(sign2))
{
helper.AddImage(rootPath + sign2, "sign2", 50, 25, 130, 0);
}
else
{
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 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 sign3 = AttachFileService.getFileUrl(person.PersonId + "_3");
if (!string.IsNullOrEmpty(sign3))
{
helper.AddImage(rootPath + sign3, "sign3", 50, 25, 350, 5);
}
else
{
helper.AddImage(string.Empty, "sign3", 0, 0, 0, 0);
}
string sign4 = AttachFileService.getFileUrl(person.PersonId + "_4");
if (!string.IsNullOrEmpty(sign4))
{
helper.AddImage(rootPath + sign4, "sign4", 50, 25, 100, 5);
}
else
{
helper.AddImage(string.Empty, "sign4", 0, 0, 0, 0);
}
string sign5 = AttachFileService.getFileUrl(person.PersonId + "_5");
if (!string.IsNullOrEmpty(sign5))
{
helper.AddImage(rootPath + sign5, "sign5", 50, 25, 320, 5);
}
else
{
helper.AddImage(string.Empty, "sign5", 0, 0, 0, 0);
}
#region
#region
DataTable tableS = new DataTable("TableS");
tableS.Columns.Add("SProblem");
tableS.Columns.Add("SOption");
if (getSingleItem.Count > 0)
{
int num = 1;
foreach (var item in getSingleItem)
{
string Avstracts = item.Abstracts.Replace(" ", "").Replace(" ", "").Replace("", "(")
.Replace("", ")").Replace("()", "(" + item.SelectedItem + ")");
string SProblem = num + "、" + Avstracts + " 正确答案:" + item.AnswerItems;
string str = string.Empty;
if (!string.IsNullOrEmpty(item.AItem))
{
str += "A." + item.AItem;
}
if (!string.IsNullOrEmpty(item.BItem))
{
str += " B." + item.BItem;
}
if (!string.IsNullOrEmpty(item.CItem))
{
str += " C." + item.CItem;
}
if (!string.IsNullOrEmpty(item.DItem))
{
str += " D." + item.DItem;
}
if (!string.IsNullOrEmpty(item.EItem))
{
str += " E." + item.EItem;
}
string SOption = str;
tableS.Rows.Add(new object[] { SProblem, SOption });
num++;
}
}
else
{
tableS.Rows.Add(new object[] { "", "" });
}
#endregion
#region
DataTable tableM = new DataTable("TableM");
tableM.Columns.Add("MProblem");
tableM.Columns.Add("MOption");
if (getMultipleItem.Count > 0)
{
int num = 1;
foreach (var item in getMultipleItem)
{
string Avstracts = item.Abstracts.Replace(" ", "").Replace(" ", "").Replace("", "(")
.Replace("", ")").Replace("()", "(" + item.SelectedItem + ")");
string MProblem = num + "、" + Avstracts + " 正确答案:" + item.AnswerItems;
string str = string.Empty;
if (!string.IsNullOrEmpty(item.AItem))
{
str += "A." + item.AItem;
}
if (!string.IsNullOrEmpty(item.BItem))
{
str += " B." + item.BItem;
}
if (!string.IsNullOrEmpty(item.CItem))
{
str += " ;C." + item.CItem;
}
if (!string.IsNullOrEmpty(item.DItem))
{
str += " ;D." + item.DItem;
}
if (!string.IsNullOrEmpty(item.EItem))
{
str += " ;E." + item.EItem;
}
string MOption = str;
tableM.Rows.Add(new object[] { MProblem, MOption });
num++;
}
}
else
{
tableM.Rows.Add(new object[] { "", "" });
}
#endregion
#region
DataTable tableJ = new DataTable("TableJ");
tableJ.Columns.Add("data");
if (getIsTrueItem.Count > 0)
{
int num = 1;
foreach (var item in getIsTrueItem)
{
var Avstracts = item.Abstracts;
if (Avstracts.IndexOf("(") > -1)
{
Avstracts = Avstracts.Replace("(", "" + item.SelectedItem == "A" ? "(√" : "×");
}
else
{
if (Avstracts.IndexOf("") > -1)
Avstracts = Avstracts.Replace("", "" + item.SelectedItem == "A" ? "(√" : "×");
}
string data = num + "、" + Avstracts + " 正确答案:" + (item.AnswerItems == "A" ? "√" : "×");
tableJ.Rows.Add(new object[] { data });
num++;
}
}
else
{
tableJ.Rows.Add(new object[] { "" });
}
#endregion
helper.WriteTable(tableS); //集合赋值遍历
helper.WriteTable(tableM); //集合赋值遍历
helper.WriteTable(tableJ); //集合赋值遍历
//考试抓拍照片
var attachFile = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == TestRecordId);
if (attachFile != null && !string.IsNullOrEmpty(attachFile.AttachUrl))
{
List<string> listUrl = Funs.GetStrListByStr(attachFile.AttachUrl, ',');
int count = listUrl.Count();
if (count > 0)
{
helper.AddImage(rootPath + listUrl[0], "imgStr1", 70, 70, 10, 10);
if (count >= 2)
{
int cout2 = count / 2;
helper.AddImage(rootPath + listUrl[cout2], "imgStr2", 70, 70, 10, 10);
}
else
{
helper.AddImage(string.Empty, "imgStr2", 0, 0, 0, 0);
}
helper.AddImage(rootPath + listUrl[count - 1], "imgStr3", 70, 70, 10, 10);
}
}
else
{
helper.AddImage(string.Empty, "imgStr1", 0, 0, 0, 0);
helper.AddImage(string.Empty, "imgStr2", 0, 0, 0, 0);
helper.AddImage(string.Empty, "imgStr3", 0, 0, 0, 0);
}
#endregion
string[] fieldNames = { };
object[] fieldValues = { };
if (!string.IsNullOrEmpty(Signature))
{
helper.AddImage(rootPath + Signature, "testName", 50, 25, 10, 5);
fieldNames = new[]
{
"projectName", "name", "time", "sex", "InTime", "sign",
"date1", "date2", "IdentityCard", "Telephone", "year", "month", "day",
"unitName", "workPostName", "TestStartTime","IdCard", "TestScores", "SValue", "SValueCount", "MValue",
"MValueCount", "JValue", "JValueCount"
};
fieldValues = new object[]
{
projectName, name, time, sex, InTime, sign, date1, date2,
IdentityCard, Telephone, year, month, day,
unitName, workPostName, TestStartTime,IdCard, TestScores, SValue, SValueCount, MValue, MValueCount,
JValue, JValueCount
};
}
else
{
fieldNames = new[]
{
"projectName", "name", "time", "sex", "InTime", "sign",
"date1", "date2", "IdentityCard", "Telephone", "year", "month", "day",
"unitName", "workPostName", "TestStartTime", "testName", "IdCard", "TestScores", "SValue", "SValueCount",
"MValue", "MValueCount", "JValue", "JValueCount"
};
fieldValues = new object[]
{
projectName, name, time, sex, InTime, sign, date1, date2,
IdentityCard, Telephone, year, month, day,
unitName, workPostName, TestStartTime, testName, IdCard, TestScores, SValue, SValueCount,
MValue, MValueCount, JValue, JValueCount
};
}
helper.Executefield(fieldNames, fieldValues); //域赋值
helper.SaveDoc(newUrl); //文件保存保存为doc
// 验证文件是否存在
if (!File.Exists(newUrl))
{
throw new Exception("文件不存在: " + newUrl);
}
string fileName = Path.GetFileName(newUrl);
FileInfo info = new FileInfo(newUrl);
long fileSize = info.Length;
Response.Clear();
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition",
"attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.AddHeader("Content-Length", fileSize.ToString());
Response.TransmitFile(newUrl, 0, fileSize);
Response.Flush();
Response.Close();
File.Delete(newUrl);
}
}
}
}

View File

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

View File

@ -247,5 +247,19 @@ namespace Model
get;
set;
}
/// <summary>
/// 签名
/// </summary>
public string Signature
{
get;
set;
}
public string Fingerprint
{
get;
set;
}
}
}

View File

@ -2927,6 +2927,9 @@ namespace Model
partial void InsertZJ_Energy(ZJ_Energy instance);
partial void UpdateZJ_Energy(ZJ_Energy instance);
partial void DeleteZJ_Energy(ZJ_Energy instance);
partial void InsertZJ_EnvironmentalCheck(ZJ_EnvironmentalCheck instance);
partial void UpdateZJ_EnvironmentalCheck(ZJ_EnvironmentalCheck instance);
partial void DeleteZJ_EnvironmentalCheck(ZJ_EnvironmentalCheck instance);
partial void InsertZJ_SuperviseCheck(ZJ_SuperviseCheck instance);
partial void UpdateZJ_SuperviseCheck(ZJ_SuperviseCheck instance);
partial void DeleteZJ_SuperviseCheck(ZJ_SuperviseCheck instance);
@ -10290,14 +10293,6 @@ namespace Model
}
}
public System.Data.Linq.Table<UnitWorkTemp1> UnitWorkTemp1
{
get
{
return this.GetTable<UnitWorkTemp1>();
}
}
public System.Data.Linq.Table<Unqualified_WorkContact> Unqualified_WorkContact
{
get
@ -11858,6 +11853,14 @@ namespace Model
}
}
public System.Data.Linq.Table<ZJ_EnvironmentalCheck> ZJ_EnvironmentalCheck
{
get
{
return this.GetTable<ZJ_EnvironmentalCheck>();
}
}
public System.Data.Linq.Table<ZJ_SuperviseCheck> ZJ_SuperviseCheck
{
get
@ -291346,6 +291349,8 @@ namespace Model
private EntityRef<ProjectData_TeamGroup> _ProjectData_TeamGroup;
private EntityRef<SitePerson_Person> _SitePerson_Person;
private EntityRef<Sys_User> _Sys_User;
#region
@ -291437,6 +291442,7 @@ namespace Model
this._Base_Project = default(EntityRef<Base_Project>);
this._Base_Unit = default(EntityRef<Base_Unit>);
this._ProjectData_TeamGroup = default(EntityRef<ProjectData_TeamGroup>);
this._SitePerson_Person = default(EntityRef<SitePerson_Person>);
this._Sys_User = default(EntityRef<Sys_User>);
OnCreated();
}
@ -291564,6 +291570,10 @@ namespace Model
{
if ((this._PersonId != value))
{
if (this._SitePerson_Person.HasLoadedOrAssignedValue)
{
throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
}
this.OnPersonIdChanging(value);
this.SendPropertyChanging();
this._PersonId = value;
@ -292339,6 +292349,40 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Perfomance_PersonPerfomance_SitePerson_Person", Storage="_SitePerson_Person", ThisKey="PersonId", OtherKey="PersonId", IsForeignKey=true)]
public SitePerson_Person SitePerson_Person
{
get
{
return this._SitePerson_Person.Entity;
}
set
{
SitePerson_Person previousValue = this._SitePerson_Person.Entity;
if (((previousValue != value)
|| (this._SitePerson_Person.HasLoadedOrAssignedValue == false)))
{
this.SendPropertyChanging();
if ((previousValue != null))
{
this._SitePerson_Person.Entity = null;
previousValue.Perfomance_PersonPerfomance.Remove(this);
}
this._SitePerson_Person.Entity = value;
if ((value != null))
{
value.Perfomance_PersonPerfomance.Add(this);
this._PersonId = value.PersonId;
}
else
{
this._PersonId = default(string);
}
this.SendPropertyChanged("SitePerson_Person");
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Perfomance_PersonPerfomance_Sys_User", Storage="_Sys_User", ThisKey="CompileMan", OtherKey="UserId", IsForeignKey=true)]
public Sys_User Sys_User
{
@ -363368,6 +363412,8 @@ namespace Model
private EntitySet<HJGL_WeldJoint> _HJGL_WeldJoint_SitePerson_Person_CoverWelder;
private EntitySet<Perfomance_PersonPerfomance> _Perfomance_PersonPerfomance;
private EntitySet<QualityAudit_EquipmentPersonQuality> _QualityAudit_EquipmentPersonQuality;
private EntitySet<QualityAudit_PersonQuality> _QualityAudit_PersonQuality;
@ -363561,6 +363607,7 @@ namespace Model
this._HJGL_RepairRecord = new EntitySet<HJGL_RepairRecord>(new Action<HJGL_RepairRecord>(this.attach_HJGL_RepairRecord), new Action<HJGL_RepairRecord>(this.detach_HJGL_RepairRecord));
this._HJGL_WeldJoint = new EntitySet<HJGL_WeldJoint>(new Action<HJGL_WeldJoint>(this.attach_HJGL_WeldJoint), new Action<HJGL_WeldJoint>(this.detach_HJGL_WeldJoint));
this._HJGL_WeldJoint_SitePerson_Person_CoverWelder = new EntitySet<HJGL_WeldJoint>(new Action<HJGL_WeldJoint>(this.attach_HJGL_WeldJoint_SitePerson_Person_CoverWelder), new Action<HJGL_WeldJoint>(this.detach_HJGL_WeldJoint_SitePerson_Person_CoverWelder));
this._Perfomance_PersonPerfomance = new EntitySet<Perfomance_PersonPerfomance>(new Action<Perfomance_PersonPerfomance>(this.attach_Perfomance_PersonPerfomance), new Action<Perfomance_PersonPerfomance>(this.detach_Perfomance_PersonPerfomance));
this._QualityAudit_EquipmentPersonQuality = new EntitySet<QualityAudit_EquipmentPersonQuality>(new Action<QualityAudit_EquipmentPersonQuality>(this.attach_QualityAudit_EquipmentPersonQuality), new Action<QualityAudit_EquipmentPersonQuality>(this.detach_QualityAudit_EquipmentPersonQuality));
this._QualityAudit_PersonQuality = new EntitySet<QualityAudit_PersonQuality>(new Action<QualityAudit_PersonQuality>(this.attach_QualityAudit_PersonQuality), new Action<QualityAudit_PersonQuality>(this.detach_QualityAudit_PersonQuality));
this._QualityAudit_SafePersonQuality = new EntitySet<QualityAudit_SafePersonQuality>(new Action<QualityAudit_SafePersonQuality>(this.attach_QualityAudit_SafePersonQuality), new Action<QualityAudit_SafePersonQuality>(this.detach_QualityAudit_SafePersonQuality));
@ -365118,6 +365165,19 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Perfomance_PersonPerfomance_SitePerson_Person", Storage="_Perfomance_PersonPerfomance", ThisKey="PersonId", OtherKey="PersonId", DeleteRule="NO ACTION")]
public EntitySet<Perfomance_PersonPerfomance> Perfomance_PersonPerfomance
{
get
{
return this._Perfomance_PersonPerfomance;
}
set
{
this._Perfomance_PersonPerfomance.Assign(value);
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_QualityAudit_EquipmentPersonQuality_SitePerson_Person", Storage="_QualityAudit_EquipmentPersonQuality", ThisKey="PersonId", OtherKey="PersonId", DeleteRule="NO ACTION")]
public EntitySet<QualityAudit_EquipmentPersonQuality> QualityAudit_EquipmentPersonQuality
{
@ -365685,6 +365745,18 @@ namespace Model
entity.CoverWelder = null;
}
private void attach_Perfomance_PersonPerfomance(Perfomance_PersonPerfomance entity)
{
this.SendPropertyChanging();
entity.SitePerson_Person = this;
}
private void detach_Perfomance_PersonPerfomance(Perfomance_PersonPerfomance entity)
{
this.SendPropertyChanging();
entity.SitePerson_Person = null;
}
private void attach_QualityAudit_EquipmentPersonQuality(QualityAudit_EquipmentPersonQuality entity)
{
this.SendPropertyChanging();
@ -437275,6 +437347,12 @@ namespace Model
private string _UnitId;
private string _Signature;
private string _Fingerprint;
private string _CompanyTrainingItemId;
private EntityRef<Base_Project> _Base_Project;
private EntityRef<SitePerson_Person> _SitePerson_Person;
@ -437311,6 +437389,12 @@ namespace Model
partial void OnDurationChanged();
partial void OnUnitIdChanging(string value);
partial void OnUnitIdChanged();
partial void OnSignatureChanging(string value);
partial void OnSignatureChanged();
partial void OnFingerprintChanging(string value);
partial void OnFingerprintChanged();
partial void OnCompanyTrainingItemIdChanging(string value);
partial void OnCompanyTrainingItemIdChanged();
#endregion
public Training_TestRecord()
@ -437574,6 +437658,66 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Signature", DbType="NVarChar(1000)")]
public string Signature
{
get
{
return this._Signature;
}
set
{
if ((this._Signature != value))
{
this.OnSignatureChanging(value);
this.SendPropertyChanging();
this._Signature = value;
this.SendPropertyChanged("Signature");
this.OnSignatureChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Fingerprint", DbType="NVarChar(1000)")]
public string Fingerprint
{
get
{
return this._Fingerprint;
}
set
{
if ((this._Fingerprint != value))
{
this.OnFingerprintChanging(value);
this.SendPropertyChanging();
this._Fingerprint = value;
this.SendPropertyChanged("Fingerprint");
this.OnFingerprintChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompanyTrainingItemId", DbType="NVarChar(50)")]
public string CompanyTrainingItemId
{
get
{
return this._CompanyTrainingItemId;
}
set
{
if ((this._CompanyTrainingItemId != value))
{
this.OnCompanyTrainingItemIdChanging(value);
this.SendPropertyChanging();
this._CompanyTrainingItemId = value;
this.SendPropertyChanged("CompanyTrainingItemId");
this.OnCompanyTrainingItemIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Training_TestRecord_Base_Project", Storage="_Base_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true)]
public Base_Project Base_Project
{
@ -441126,105 +441270,6 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.UnitWorkTemp1")]
public partial class UnitWorkTemp1
{
private string _UnitId;
private string _UnitName;
private string _WorkPostId;
private string _WorkPostName;
private System.Nullable<int> _PNum;
public UnitWorkTemp1()
{
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitId", DbType="NVarChar(50)")]
public string UnitId
{
get
{
return this._UnitId;
}
set
{
if ((this._UnitId != value))
{
this._UnitId = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitName", DbType="NVarChar(200)")]
public string UnitName
{
get
{
return this._UnitName;
}
set
{
if ((this._UnitName != value))
{
this._UnitName = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPostId", DbType="NVarChar(50)")]
public string WorkPostId
{
get
{
return this._WorkPostId;
}
set
{
if ((this._WorkPostId != value))
{
this._WorkPostId = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPostName", DbType="VarChar(10) NOT NULL", CanBeNull=false)]
public string WorkPostName
{
get
{
return this._WorkPostName;
}
set
{
if ((this._WorkPostName != value))
{
this._WorkPostName = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Name="pNum", Storage="_PNum", DbType="Int")]
public System.Nullable<int> PNum
{
get
{
return this._PNum;
}
set
{
if ((this._PNum != value))
{
this._PNum = value;
}
}
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Unqualified_WorkContact")]
public partial class Unqualified_WorkContact : INotifyPropertyChanging, INotifyPropertyChanged
{
@ -516660,6 +516705,308 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.ZJ_EnvironmentalCheck")]
public partial class ZJ_EnvironmentalCheck : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private string _Id;
private string _ProjectId;
private System.Nullable<double> _Tsp;
private System.Nullable<double> _Temp;
private System.Nullable<double> _Noise;
private System.Nullable<double> _Humid;
private System.Nullable<double> _PmTwoPointFive;
private System.Nullable<double> _WindSpeed;
private System.Nullable<double> _PmTen;
private System.Nullable<System.DateTime> _Time;
private System.Nullable<System.DateTime> _CreateTime;
#region
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnIdChanging(string value);
partial void OnIdChanged();
partial void OnProjectIdChanging(string value);
partial void OnProjectIdChanged();
partial void OnTspChanging(System.Nullable<double> value);
partial void OnTspChanged();
partial void OnTempChanging(System.Nullable<double> value);
partial void OnTempChanged();
partial void OnNoiseChanging(System.Nullable<double> value);
partial void OnNoiseChanged();
partial void OnHumidChanging(System.Nullable<double> value);
partial void OnHumidChanged();
partial void OnPmTwoPointFiveChanging(System.Nullable<double> value);
partial void OnPmTwoPointFiveChanged();
partial void OnWindSpeedChanging(System.Nullable<double> value);
partial void OnWindSpeedChanged();
partial void OnPmTenChanging(System.Nullable<double> value);
partial void OnPmTenChanged();
partial void OnTimeChanging(System.Nullable<System.DateTime> value);
partial void OnTimeChanged();
partial void OnCreateTimeChanging(System.Nullable<System.DateTime> value);
partial void OnCreateTimeChanged();
#endregion
public ZJ_EnvironmentalCheck()
{
OnCreated();
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Id", DbType="NVarChar(50) NOT NULL", CanBeNull=false, IsPrimaryKey=true)]
public string Id
{
get
{
return this._Id;
}
set
{
if ((this._Id != value))
{
this.OnIdChanging(value);
this.SendPropertyChanging();
this._Id = value;
this.SendPropertyChanged("Id");
this.OnIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="NVarChar(50)")]
public string ProjectId
{
get
{
return this._ProjectId;
}
set
{
if ((this._ProjectId != value))
{
this.OnProjectIdChanging(value);
this.SendPropertyChanging();
this._ProjectId = value;
this.SendPropertyChanged("ProjectId");
this.OnProjectIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Tsp", DbType="Float")]
public System.Nullable<double> Tsp
{
get
{
return this._Tsp;
}
set
{
if ((this._Tsp != value))
{
this.OnTspChanging(value);
this.SendPropertyChanging();
this._Tsp = value;
this.SendPropertyChanged("Tsp");
this.OnTspChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Temp", DbType="Float")]
public System.Nullable<double> Temp
{
get
{
return this._Temp;
}
set
{
if ((this._Temp != value))
{
this.OnTempChanging(value);
this.SendPropertyChanging();
this._Temp = value;
this.SendPropertyChanged("Temp");
this.OnTempChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Noise", DbType="Float")]
public System.Nullable<double> Noise
{
get
{
return this._Noise;
}
set
{
if ((this._Noise != value))
{
this.OnNoiseChanging(value);
this.SendPropertyChanging();
this._Noise = value;
this.SendPropertyChanged("Noise");
this.OnNoiseChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Humid", DbType="Float")]
public System.Nullable<double> Humid
{
get
{
return this._Humid;
}
set
{
if ((this._Humid != value))
{
this.OnHumidChanging(value);
this.SendPropertyChanging();
this._Humid = value;
this.SendPropertyChanged("Humid");
this.OnHumidChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PmTwoPointFive", DbType="Float")]
public System.Nullable<double> PmTwoPointFive
{
get
{
return this._PmTwoPointFive;
}
set
{
if ((this._PmTwoPointFive != value))
{
this.OnPmTwoPointFiveChanging(value);
this.SendPropertyChanging();
this._PmTwoPointFive = value;
this.SendPropertyChanged("PmTwoPointFive");
this.OnPmTwoPointFiveChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WindSpeed", DbType="Float")]
public System.Nullable<double> WindSpeed
{
get
{
return this._WindSpeed;
}
set
{
if ((this._WindSpeed != value))
{
this.OnWindSpeedChanging(value);
this.SendPropertyChanging();
this._WindSpeed = value;
this.SendPropertyChanged("WindSpeed");
this.OnWindSpeedChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PmTen", DbType="Float")]
public System.Nullable<double> PmTen
{
get
{
return this._PmTen;
}
set
{
if ((this._PmTen != value))
{
this.OnPmTenChanging(value);
this.SendPropertyChanging();
this._PmTen = value;
this.SendPropertyChanged("PmTen");
this.OnPmTenChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Time", DbType="DateTime")]
public System.Nullable<System.DateTime> Time
{
get
{
return this._Time;
}
set
{
if ((this._Time != value))
{
this.OnTimeChanging(value);
this.SendPropertyChanging();
this._Time = value;
this.SendPropertyChanged("Time");
this.OnTimeChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CreateTime", DbType="DateTime")]
public System.Nullable<System.DateTime> CreateTime
{
get
{
return this._CreateTime;
}
set
{
if ((this._CreateTime != value))
{
this.OnCreateTimeChanging(value);
this.SendPropertyChanging();
this._CreateTime = value;
this.SendPropertyChanged("CreateTime");
this.OnCreateTimeChanged();
}
}
}
public event PropertyChangingEventHandler PropertyChanging;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void SendPropertyChanging()
{
if ((this.PropertyChanging != null))
{
this.PropertyChanging(this, emptyChangingEventArgs);
}
}
protected virtual void SendPropertyChanged(String propertyName)
{
if ((this.PropertyChanged != null))
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.ZJ_SuperviseCheck")]
public partial class ZJ_SuperviseCheck : INotifyPropertyChanging, INotifyPropertyChanged
{

View File

@ -1,10 +1,14 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using BLL;
using Model;
namespace WebAPI.Controllers
{
/// <summary>
@ -155,52 +159,20 @@ namespace WebAPI.Controllers
/// <param name="projectId">项目ID</param>
/// <param name="personId">人员ID(null查全部)</param>
/// <param name="pageIndex">页码</param>
/// <param name="unitId">单位id</param>
/// <returns>考试记录列表</returns>
public Model.ResponeData getTrainingTestRecordListByProjectIdPersonId(string projectId, string personId, int pageIndex=0,string unitId="")
public Model.ResponeData getTrainingTestRecordListByProjectIdPersonId(string projectId, string personId, int pageIndex)
{
var responeData = new Model.ResponeData();
try
{
if (string.IsNullOrEmpty(unitId))
personId = PersonService.GetPersonIdByUserIdForApi(personId);
var getDataLists = APITestRecordService.getTrainingTestRecordListByProjectIdPersonId(projectId, personId);
int pageCount = getDataLists.Count;
if (pageCount > 0 && pageIndex > 0)
{
//项目级
if (pageIndex == 0)
{
personId = PersonService.GetPersonIdByUserId(personId);
responeData.data = APITestRecordService.getTrainingTestRecordListByProjectIdPersonId(projectId, personId);
}
else {
personId = PersonService.GetPersonIdByUserId(personId);
var getDataLists = APITestRecordService.getTrainingTestRecordListByProjectIdPersonId(projectId, personId);
int pageCount = getDataLists.Count;
if (pageCount > 0 && pageIndex > 0)
{
getDataLists = getDataLists.OrderByDescending(x => x.TestStartTime).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
}
responeData.data = new { pageCount, getDataLists };
}
getDataLists = getDataLists.OrderByDescending(x => x.TestStartTime).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
}
else {
//公司级
if (pageIndex == 0)
{
personId = PersonService.GetPersonIdByUserId(personId);
responeData.data = APITestRecordService.getTrainingTestRecordListByUnitIdPersonId(unitId, personId);
}
else
{
personId = PersonService.GetPersonIdByUserId(personId);
var getDataLists = APITestRecordService.getTrainingTestRecordListByUnitIdPersonId(unitId, personId);
int pageCount = getDataLists.Count;
if (pageCount > 0 && pageIndex > 0)
{
getDataLists = getDataLists.OrderByDescending(x => x.TestStartTime).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
}
responeData.data = new { pageCount, getDataLists };
}
}
responeData.data = new { pageCount, getDataLists };
}
catch (Exception ex)
{
@ -250,17 +222,14 @@ namespace WebAPI.Controllers
/// <param name="strPass">0-未通过1通过空所有</param>
/// <param name="pageIndex">页码</param>
/// <returns>考试记录列表</returns>
public Model.ResponeData getTrainingTestRecordListQuery(string projectId, string unitId, string workPostId, string strPass, int pageIndex=0)
public Model.ResponeData getTrainingTestRecordListQuery(string projectId, string unitId, string workPostId, string departId, string strPass, int pageIndex)
{
var responeData = new Model.ResponeData();
try
{
if (pageIndex == 0)
if (!string.IsNullOrEmpty(departId))
{
responeData.data = APITestRecordService.getTrainingTestRecordListByProjectId(projectId, unitId, workPostId, strPass, string.Empty);
}
else {
var getDataLists = APITestRecordService.getTrainingTestRecordListByProjectId(projectId, unitId, workPostId, strPass, string.Empty);
var getDataLists = APITestRecordService.getTrainingTestRecordListByDepartId(unitId,departId,strPass,string.Empty);
int pageCount = getDataLists.Count;
if (pageCount > 0 && pageIndex > 0)
{
@ -268,6 +237,19 @@ namespace WebAPI.Controllers
}
responeData.data = new { pageCount, getDataLists };
}
else
{
var getDataLists = APITestRecordService.getTrainingTestRecordListByProjectId(projectId, unitId, workPostId, strPass, string.Empty);
int pageCount = getDataLists.Count;
if (pageCount > 0 && pageIndex > 0)
{
getDataLists = getDataLists.OrderByDescending(x => x.TestStartTime).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
}
responeData.data = new { pageCount, getDataLists };
}
}
catch (Exception ex)
{
@ -289,32 +271,7 @@ namespace WebAPI.Controllers
/// <param name="strParam">参数</param>
/// <param name="pageIndex">页码</param>
/// <returns>考试记录列表</returns>
public Model.ResponeData getTrainingTestRecordListQuery(string projectId, string unitId, string workPostId, string strPass,string strParam, int pageIndex=0)
{
var responeData = new Model.ResponeData();
try
{
if (pageIndex == 0)
{
responeData.data = APITestRecordService.getTrainingTestRecordListByProjectId(projectId, unitId, workPostId, strPass, strParam);
}
else {
var getDataLists = APITestRecordService.getTrainingTestRecordListByProjectId(projectId, unitId, workPostId, strPass, strParam);
int pageCount = getDataLists.Count;
if (pageCount > 0 && pageIndex > 0)
{
getDataLists = getDataLists.OrderByDescending(x => x.TestStartTime).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
}
responeData.data = new { pageCount, getDataLists };
}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region TestRecordItemIdselectedItem
@ -328,25 +285,129 @@ namespace WebAPI.Controllers
var responeData = new Model.ResponeData();
try
{
var getItem = TestRecordItemService.GetTestRecordItemTestRecordItemId(testRecordItemId);
if (getItem != null)
if (!string.IsNullOrEmpty(testRecordItemId) && !string.IsNullOrEmpty(selectedItem))
{
//更新没有结束时间且超时的考试记录
int closeCount = TestRecordService.UpdateTestEndTimeNull(getItem.TestRecordId);
if (closeCount > 0)
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
responeData.code = 2;
responeData.message = "本次考试已结束,系统自动交卷!";
}
else
{
APITestRecordService.getTestRecordItemAnswerBySelectedItem(getItem, selectedItem);
var getTItem = db.Training_TestRecordItem.FirstOrDefault(x => x.TestRecordItemId == testRecordItemId);
if (getTItem != null)
{
getTItem.SubjectScore = 0;
getTItem.SelectedItem = selectedItem;
if (!string.IsNullOrEmpty(selectedItem))
{
if (getTItem.AnswerItems == selectedItem)
{
getTItem.SubjectScore = getTItem.Score ?? 0;
}
else
{
var listA = Funs.GetStrListByStr(getTItem.AnswerItems.ToUpper(), ',');
var listS = Funs.GetStrListByStr(selectedItem.ToUpper(), ',');
if (getTItem.TestType == "2" && listA.Count >= listS.Count)
{
int i = 0;
foreach (var item in listS)
{
if (!listA.Contains(item))
{
i++;
break;
}
}
if (i == 0)
{
if (listA.Count == listS.Count)
{
getTItem.SubjectScore = getTItem.Score ?? 0;
}
else
{
getTItem.SubjectScore = Convert.ToDecimal((getTItem.Score ?? 0) * 1.0 / 2);
}
}
}
}
}
db.SubmitChanges();
}
}
}
else
{
responeData.code = 0;
responeData.message = "试题有问题!";
responeData.message = "答题为空选项!";
}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
public Model.ResponeData getTestRecordItemAnswerBySelectedItem(string testRecordId,string testRecordItemId, string selectedItem)
{
var responeData = new Model.ResponeData();
try
{
if (!string.IsNullOrEmpty(testRecordId) && !string.IsNullOrEmpty(testRecordItemId) && !string.IsNullOrEmpty(selectedItem))
{
BLL.RedisHelper redis = new RedisHelper();
var trainingTestRecordItems = redis.GetObjString<List<Training_TestRecordItem>>(testRecordId); //根据试卷ID获取试卷题目列表
var getTItem= trainingTestRecordItems?.FirstOrDefault(x => x.TestRecordItemId== testRecordItemId); //获取试题
if (getTItem==null)
{
responeData.code = 0;
responeData.message = "答题为空选项!";
return responeData;
}
getTItem.SubjectScore = 0;
getTItem.SelectedItem = selectedItem;
if (!string.IsNullOrEmpty(selectedItem))
{
if (getTItem.AnswerItems == selectedItem)
{
getTItem.SubjectScore = getTItem.Score ?? 0;
}
else
{
var listA = Funs.GetStrListByStr(getTItem.AnswerItems.ToUpper(), ',');
var listS = Funs.GetStrListByStr(selectedItem.ToUpper(), ',');
if (getTItem.TestType == "2" && listA.Count >= listS.Count)
{
int i = 0;
foreach (var item in listS)
{
if (!listA.Contains(item))
{
i++;
break;
}
}
if (i == 0)
{
if (listA.Count == listS.Count)
{
getTItem.SubjectScore = getTItem.Score ?? 0;
}
else
{
getTItem.SubjectScore = Convert.ToDecimal((getTItem.Score ?? 0) * 1.0 / 2);
}
}
}
}
}
redis.SetObjString(testRecordId, getTItem);
}
else
{
responeData.code = 0;
responeData.message = "参数不足!";
return responeData;
}
}
catch (Exception ex)
@ -364,62 +425,75 @@ namespace WebAPI.Controllers
/// 交卷
/// </summary>
/// <param name="testRecordId">试卷ID</param>
public Model.ResponeData getSubmitTestRecordByTestRecordId(string testRecordId)
public Model.ResponeData getSubmitTestRecordByTestRecordId(string testRecordId,string Signature)
{
var responeData = new Model.ResponeData();
try
{
var getTestRecord = Funs.DB.Training_TestRecord.FirstOrDefault(e => e.TestRecordId == testRecordId);
if (getTestRecord != null)
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
string returnTestRecordId = string.Empty;
////考试分数
decimal getTestScores = APITestRecordService.getSubmitTestRecord(getTestRecord);
////及格分数
//int getPassScores = SysConstSetService.getPassScore();
int getPassScores = SysConstSetService.getPassScore(getTestRecord.TestPlanId);
if (getTestScores >= getPassScores)
#region
RedisHelper redis = new RedisHelper();
var trainingTestRecordItems = redis.GetObjString<List<Training_TestRecordItem>>(testRecordId);
if (trainingTestRecordItems!=null)
{
APITestRecordService.updateAll(getTestRecord.TestPlanId);
responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。";
}
else
{
int testCount = Funs.DB.Training_TestRecord.Where(x => x.TestPlanId == getTestRecord.TestPlanId && x.TestManId == getTestRecord.TestManId).Count();
if (testCount < 2)
var testRecordItem = from x in db.Training_TestRecordItem
where x.TestRecordId == testRecordId
select x;
if (testRecordItem.Any())
{
////重新生成一条考试记录 以及考试试卷
returnTestRecordId = APITestRecordService.getResitTestRecord(getTestRecord);
responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,您将进入补考。";
db.Training_TestRecordItem.DeleteAllOnSubmit(testRecordItem);
db.SubmitChanges();
}
db.Training_TestRecordItem.InsertAllOnSubmit(trainingTestRecordItems);
}
#endregion
string returnTestRecordId = string.Empty;
decimal getTestScores = 0;
var getTestRecord = db.Training_TestRecord.FirstOrDefault(e => e.TestRecordId == testRecordId);
if (getTestRecord != null)
{
if (getTestRecord.TestStartTime.HasValue)
{
getTestRecord.Signature = Signature;
getTestRecord.TestEndTime = DateTime.Now;
// var getRItem = db.Training_TestRecordItem.Where(x => x.TestRecordId == testRecordId);
// if (getRItem.Count() > 0)
// {
getTestRecord.TestScores = db.Training_TestRecordItem.Where(x => x.TestRecordId == testRecordId).Sum(x => x.SubjectScore ?? 0);
// }
db.SubmitChanges();
getTestScores = getTestRecord.TestScores ?? 0;
}
////考试分数
int getPassScores = SysConstSetService.getPassScoreForApi();
if (getTestScores <= getPassScores)
{
int testCount = db.Training_TestRecord.Where(x => x.TestPlanId == getTestRecord.TestPlanId && x.TestManId == getTestRecord.TestManId).Count();
if (testCount < 2)
{
////重新生成一条考试记录 以及考试试卷
returnTestRecordId = APITestRecordService.getResitTestRecord(getTestRecord);
responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,您将进入补考。";
}
else
{
// APITestRecordService.updateAll(getTestRecord.TestPlanId);
responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,请再次参加培训后补考。";
}
}
else
{
APITestRecordService.updateAll(getTestRecord.TestPlanId);
responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,请再次参加培训后补考。";
// APITestRecordService.updateAll(getTestRecord.TestPlanId);
responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。";
}
}
//if (getTestScores <= getPassScores)
//{
// int testCount = Funs.DB.Training_TestRecord.Where(x => x.TestPlanId == getTestRecord.TestPlanId && x.TestManId == getTestRecord.TestManId).Count();
// if (testCount < 2)
// {
// ////重新生成一条考试记录 以及考试试卷
// returnTestRecordId = APITestRecordService.getResitTestRecord(getTestRecord);
// responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,您将进入补考。";
// }
// else
// {
// APITestRecordService.updateAll(getTestRecord.TestPlanId);
// responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,请再次参加培训后补考。";
// }
//}
//else
//{
// APITestRecordService.updateAll(getTestRecord.TestPlanId);
// responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。";
//}
responeData.data = new { getTestScores, getPassScores, returnTestRecordId };
responeData.data = new { getTestScores, getPassScores, returnTestRecordId };
}
}
}
catch (Exception ex)
@ -432,80 +506,121 @@ namespace WebAPI.Controllers
}
#endregion
#region
#region
/// <summary>
/// 根据TestRecordItemId、selectedItem 考生答题
/// 交卷
/// </summary>
/// <param name="testRecordItemId">题目ID</param>
/// <param name="selectedItem">选项</param>
public Model.ResponeData getTestRecordItemAnswerBySelectedItemNew(string testRecordItemId, string selectedItem)
public Model.ResponeData SaveSubmitTestRecordByTestRecordId(Model.TestRecordItem testRecordItem)
{
string testRecordId = testRecordItem.TestRecordId;
string Signature = testRecordItem.Signature;
string Fingerprint = testRecordItem.Fingerprint;
var responeData = new Model.ResponeData();
try
{
var getItem = TestRecordItemService.GetTestRecordItemTestRecordItemId(testRecordItemId);
if (getItem != null)
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
APITestRecordService.getTestRecordItemAnswerBySelectedItem(getItem, selectedItem);
}
else
{
responeData.code = 0;
responeData.message = "试题有问题!";
}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
#region
RedisHelper redis = new RedisHelper();
var trainingTestRecordItems = redis.GetObjString<List<Training_TestRecordItem>>(testRecordId);
return responeData;
}
/// <summary>
/// 交卷
/// </summary>
/// <param name="testRecordId"></param>
/// <returns></returns>
public Model.ResponeData getSubmitTestRecordByTestRecordIdNew(string testRecordId)
{
var responeData = new Model.ResponeData();
try
{
var getTestRecord = Funs.DB.Training_TestRecord.FirstOrDefault(e => e.TestRecordId == testRecordId);
if (getTestRecord != null)
{
string returnTestRecordId = string.Empty;
////考试分数
decimal getTestScores = APITestRecordService.getSubmitTestRecord(getTestRecord);
////及格分数
//int getPassScores = SysConstSetService.getPassScore();
int getPassScores = SysConstSetService.getPassScore(getTestRecord.TestPlanId);
if (getTestScores >= getPassScores)
if (trainingTestRecordItems!=null)
{
//APITestRecordService.updateAll(getTestRecord.TestPlanId);
responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。";
var modeltestRecordItem = from x in db.Training_TestRecordItem
where x.TestRecordId == testRecordId
select x;
if (modeltestRecordItem.Any())
{
db.Training_TestRecordItem.DeleteAllOnSubmit(modeltestRecordItem);
db.SubmitChanges();
}
db.Training_TestRecordItem.InsertAllOnSubmit(trainingTestRecordItems);
}
else
{
//APITestRecordService.updateAll(getTestRecord.TestPlanId);
responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,请再次重新扫码进行考试。";
#endregion
var getTestRecord = db.Training_TestRecord.FirstOrDefault(e => e.TestRecordId == testRecordId);
if (getTestRecord != null)
{
string rootUrl = ConfigurationManager.AppSettings["localRoot"];
string SignatureUrl = @"FileUpload\TestRecord\" + getTestRecord.TestRecordId + "~签名" + ".png";
string FingerprintUrl = @"FileUpload\TestRecord\" + getTestRecord.TestRecordId + "~指纹" + ".png";
string Signaturefilename = rootUrl + SignatureUrl;
string Fingerprintfilename = rootUrl + FingerprintUrl;
if (!string.IsNullOrEmpty(Signature))
{
Signature = Signature.Replace("data:image/svg+xml;base64,", "").Replace("data:image/png;base64,", "").Replace("data:image/jgp;base64,", "").Replace("data:image/jpg;base64,", "").Replace("data:image/jpeg;base64,", "");//将base64头部信息替换
byte[] bytes = Convert.FromBase64String(Signature);
MemoryStream memStream = new MemoryStream(bytes);
Image mImage = Image.FromStream(memStream);
Bitmap bp = new Bitmap(mImage);
MemoryStream ms = new MemoryStream();
bp.Save(Signaturefilename, System.Drawing.Imaging.ImageFormat.Png);
// System.IO.File.WriteAllBytes(Signaturefilename, Convert.FromBase64String(Signature));
getTestRecord.Signature = Signaturefilename.Replace(rootUrl, "");
}
if (!string.IsNullOrEmpty(Fingerprint))
{
Fingerprint = Fingerprint.Replace("data:image/svg+xml;base64,", "").Replace("data:image/png;base64,", "").Replace("data:image/jgp;base64,", "").Replace("data:image/jpg;base64,", "").Replace("data:image/jpeg;base64,", "");//将base64头部信息替换
byte[] bytes = Convert.FromBase64String(Fingerprint);
MemoryStream memStream = new MemoryStream(bytes);
Image mImage = Image.FromStream(memStream);
Bitmap bp = new Bitmap(mImage);
MemoryStream ms = new MemoryStream();
bp.Save(Fingerprintfilename, System.Drawing.Imaging.ImageFormat.Png);
getTestRecord.Fingerprint = Fingerprintfilename.Replace(rootUrl, "");
}
db.SubmitChanges();
// APITestRecordService.updateTestRecord(getTestRecord);
string returnTestRecordId = string.Empty;
////考试分数
decimal getTestScores = APITestRecordService.getSubmitTestRecord(getTestRecord);
if (!string.IsNullOrEmpty(getTestRecord.TestPlanId))
{ ////及格分数
int getPassScores = 80;
var testRule = db.Sys_TestRule.FirstOrDefault();
if (testRule != null)
{
getPassScores = testRule.PassingScore;
}
if (getTestScores <= getPassScores)
{
int testCount = db.Training_TestRecord.Where(x => x.TestPlanId == getTestRecord.TestPlanId && x.TestManId == getTestRecord.TestManId).Count();
if (testCount < 2)
{
////重新生成一条考试记录 以及考试试卷
returnTestRecordId = APITestRecordService.getResitTestRecord(getTestRecord);
responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,您将进入补考。";
}
else
{
APITestRecordService.updateAll(getTestRecord.TestPlanId);
responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,请再次参加培训后补考。";
}
}
else
{
APITestRecordService.updateAll(getTestRecord.TestPlanId);
responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。";
} responeData.data = new { getTestScores, getPassScores, returnTestRecordId };
}
else
{
responeData.data = new { getTestScores };
}
//int testCount = Funs.DB.Training_TestRecord.Where(x => x.TestPlanId == getTestRecord.TestPlanId && x.TestManId == getTestRecord.TestManId).Count();
//if (testCount < 2)
//{
// ////重新生成一条考试记录 以及考试试卷
// returnTestRecordId = APITestRecordService.getResitTestRecord(getTestRecord);
// responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,您将进入补考。";
//}
//else
//{
// APITestRecordService.updateAll(getTestRecord.TestPlanId);
// responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,请再次参加培训后补考。";
//}
}
responeData.data = new { getTestScores, getPassScores, returnTestRecordId };
}
}
catch (Exception ex)