This commit is contained in:
gaofei 2022-06-27 15:36:34 +08:00
commit e8ad744948
29 changed files with 488 additions and 534 deletions

View File

@ -0,0 +1,4 @@
UPDATE Training_TestRecord SET TestType= P.PlanName
FROM Training_TestPlan AS P
WHERE Training_TestRecord.TestPlanId=P.TestPlanId
GO

View File

@ -0,0 +1,5 @@
--ADD BY Yanghongwei 2022-06-16
1、优化考勤记录导入优化出入记录写实名制推送记录表。
2、优化考试答题交卷接口方法。
3、优化写入培训记录。
--END

View File

@ -17,19 +17,20 @@ namespace BLL
/// <param name="changeTime">进出方式</param> /// <param name="changeTime">进出方式</param>
public static void SaveDoorInOutRecord(string projectId, string idCard, int isIn, DateTime changeTime, string Intype) public static void SaveDoorInOutRecord(string projectId, string idCard, int isIn, DateTime changeTime, string Intype)
{ {
Model.SitePerson_Person getPerson = new Model.SitePerson_Person();
int maxId = 0;
string name = string.Empty;
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{ {
int maxId = 0; getPerson = db.SitePerson_Person.Where(x => x.IdentityCard == idCard).OrderByDescending(x => x.InTime).FirstOrDefault();
string name = string.Empty; if (getPerson != null)
var getPersonByIdCard = db.SitePerson_Person.Where(x => x.IdentityCard == idCard).OrderByDescending(x=>x.InTime).FirstOrDefault();
if (getPersonByIdCard != null)
{ {
name = getPersonByIdCard.PersonName; name = getPerson.PersonName;
projectId = getPersonByIdCard.ProjectId; projectId = getPerson.ProjectId;
} }
else else
{ {
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == idCard && x.ProjectId == projectId); getPerson = db.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == idCard && x.ProjectId == projectId);
if (getPerson != null) if (getPerson != null)
{ {
name = getPerson.PersonName; name = getPerson.PersonName;
@ -41,7 +42,7 @@ namespace BLL
{ {
maxId = getmax.Max() + 1; maxId = getmax.Max() + 1;
} }
Model.T_d_facerecord newFacerecord = new Model.T_d_facerecord() Model.T_d_facerecord newFacerecord = new Model.T_d_facerecord()
{ {
NewID = SQLHelper.GetNewID(), NewID = SQLHelper.GetNewID(),
@ -56,7 +57,10 @@ namespace BLL
}; };
db.T_d_facerecord.InsertOnSubmit(newFacerecord); db.T_d_facerecord.InsertOnSubmit(newFacerecord);
db.SubmitChanges(); db.SubmitChanges();
}
if (getPerson != null)
{
///// 根据出入记录 写入考勤记录 ///// 根据出入记录 写入考勤记录
Model.t_d_facerecordItem facerecord = new Model.t_d_facerecordItem Model.t_d_facerecordItem facerecord = new Model.t_d_facerecordItem
{ {
@ -70,9 +74,10 @@ namespace BLL
RecordDes = Intype, RecordDes = Intype,
InOrOut = (isIn == 1 ? "进门" : "出门"), InOrOut = (isIn == 1 ? "进门" : "出门"),
}; };
DoorServerService.InsertEmployInOutRecord(facerecord);
DoorServerService.InsertEmployInOutRecord(facerecord, getPerson);
APIPersonService.getPersonInOut(getPerson, isIn, changeTime);
} }
APIPersonService.getPersonInOut(projectId, idCard, isIn, changeTime);
} }
} }
} }

View File

@ -1046,13 +1046,12 @@ namespace BLL
/// <param name="idCard"></param> /// <param name="idCard"></param>
/// <param name="isIn"></param> /// <param name="isIn"></param>
/// <param name="changeTime"></param> /// <param name="changeTime"></param>
public static void getPersonInOut(string projectId, string idCard, int isIn, DateTime changeTime) public static void getPersonInOut(Model.SitePerson_Person getPerson, int isIn, DateTime changeTime)
{ {
if (!string.IsNullOrEmpty(idCard)) if (!string.IsNullOrEmpty(getPerson.IdentityCard))
{ {
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{ {
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.ProjectId == projectId && x.IdentityCard == idCard);
if (getPerson != null) if (getPerson != null)
{ {
string postType = null; string postType = null;
@ -1061,13 +1060,13 @@ namespace BLL
{ {
postType = getWokPost.PostType; postType = getWokPost.PostType;
} }
var getPersonInOut = db.SitePerson_PersonInOut.FirstOrDefault(x => x.PersonId == getPerson.PersonId && x.ProjectId == projectId && x.ChangeTime == changeTime); var getPersonInOut = db.SitePerson_PersonInOut.FirstOrDefault(x => x.PersonId == getPerson.PersonId && x.ProjectId == getPerson.ProjectId && x.ChangeTime == changeTime);
if (getPersonInOut == null) if (getPersonInOut == null)
{ {
Model.SitePerson_PersonInOut newInOut = new Model.SitePerson_PersonInOut Model.SitePerson_PersonInOut newInOut = new Model.SitePerson_PersonInOut
{ {
PersonInOutId = SQLHelper.GetNewID(), PersonInOutId = SQLHelper.GetNewID(),
ProjectId = projectId, ProjectId = getPerson.ProjectId,
UnitId = getPerson.UnitId, UnitId = getPerson.UnitId,
PersonId = getPerson.PersonId, PersonId = getPerson.PersonId,
IsIn = isIn == 1 ? true : false, IsIn = isIn == 1 ? true : false,
@ -1079,7 +1078,7 @@ namespace BLL
db.SitePerson_PersonInOut.InsertOnSubmit(newInOut); db.SitePerson_PersonInOut.InsertOnSubmit(newInOut);
db.SubmitChanges(); db.SubmitChanges();
string proCode = ProjectService.GetJTProjectCodeByProjectId(projectId); string proCode = ProjectService.GetJTProjectCodeByProjectId(getPerson.ProjectId);
Model.SitePerson_PersonInOutNow newNow = new Model.SitePerson_PersonInOutNow Model.SitePerson_PersonInOutNow newNow = new Model.SitePerson_PersonInOutNow
{ {
PersonInOutId = newInOut.PersonInOutId, PersonInOutId = newInOut.PersonInOutId,

View File

@ -245,6 +245,14 @@ namespace BLL
TestType = item.TestType, TestType = item.TestType,
Duration = newTestPlan.Duration, Duration = newTestPlan.Duration,
}; };
if (string.IsNullOrEmpty(newTrainDetail.TestType))
{
var getTrainTypeName = db.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == newTrainDetail.TestPlanId);
if (getTrainTypeName != null)
{
newTrainDetail.TestType = getTrainTypeName.PlanName;
}
}
db.Training_TestRecord.InsertOnSubmit(newTrainDetail); db.Training_TestRecord.InsertOnSubmit(newTrainDetail);
db.SubmitChanges(); db.SubmitChanges();
} }

View File

@ -21,7 +21,6 @@ namespace BLL
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{ {
var getDataLists = (from x in db.Training_TestRecord var getDataLists = (from x in db.Training_TestRecord
join y in db.SitePerson_Person on x.TestManId equals y.PersonId
where x.TestPlanId == testPlanId where x.TestPlanId == testPlanId
orderby x.TestStartTime descending orderby x.TestStartTime descending
select new Model.TestRecordItem select new Model.TestRecordItem
@ -30,7 +29,7 @@ namespace BLL
ProjectId = x.ProjectId, ProjectId = x.ProjectId,
TestPlanId = x.TestPlanId, TestPlanId = x.TestPlanId,
TestManId = x.TestManId, TestManId = x.TestManId,
TestManName = y.PersonName, //TestManName = db.SitePerson_Person.First(p=>x.TestManId ==p.PersonId).PersonName,
TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime), TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime),
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime), TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
TestScores = x.TestScores ?? 0, TestScores = x.TestScores ?? 0,
@ -100,21 +99,20 @@ namespace BLL
{ {
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{ {
var getDataLists = from x in db.Training_TestRecord var getDataLists = from x in db.Training_TestRecord
join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
where x.TestRecordId == testRecordId where x.TestRecordId == testRecordId
select new Model.TestRecordItem select new Model.TestRecordItem
{ {
TestRecordId = x.TestRecordId, TestRecordId = x.TestRecordId,
ProjectId = x.ProjectId, ProjectId = x.ProjectId,
TestPlanId = x.TestPlanId, TestPlanId = x.TestPlanId,
TestPlanName = y.PlanName, TestPlanName = x.TestType,
TestManId = x.TestManId, TestManId = x.TestManId,
TestManName = db.SitePerson_Person.First(u => u.PersonId == x.TestManId).PersonName, TestManName = db.SitePerson_Person.First(u => u.PersonId == x.TestManId).PersonName,
TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime), TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime),
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime), TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
TestPlanEndTime = x.TestStartTime.HasValue ? string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime.Value.AddMinutes(x.Duration)) : "", TestPlanEndTime = x.TestStartTime.HasValue ? string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime.Value.AddMinutes(x.Duration)) : "",
Duration = y.Duration, Duration = x.Duration,
TestScores = x.TestScores ?? 0, TestScores = x.TestScores ?? 0,
TestType = x.TestType, TestType = x.TestType,
TemporaryUser = x.TemporaryUser, TemporaryUser = x.TemporaryUser,
@ -572,62 +570,17 @@ namespace BLL
var getRItem = db.Training_TestRecordItem.Where(x => x.TestRecordId == getTestRecord.TestRecordId); var getRItem = db.Training_TestRecordItem.Where(x => x.TestRecordId == getTestRecord.TestRecordId);
if (getRItem.Count() > 0) if (getRItem.Count() > 0)
{ {
getTestRecord.TestScores = getRItem.Sum(x => x.SubjectScore); getTestRecord.TestScores = getRItem.Sum(x => x.SubjectScore ?? 0);
} }
db.SubmitChanges(); db.SubmitChanges();
getCode = getTestRecord.TestScores ?? 0; getCode = getTestRecord.TestScores ?? 0;
} }
} }
return getCode; return getCode;
} }
#endregion #endregion
/// <summary>
///
/// </summary>
/// <param name="testPlanId"></param>
public static void updateAll(string testPlanId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
//// 获取考试计划
var getTestPlan = db.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == testPlanId);
if (getTestPlan != null)
{
//// 获取参加考试 记录
var getAllTestRecords = db.Training_TestRecord.Where(x => x.TestPlanId == getTestPlan.TestPlanId);
if (getAllTestRecords.Count() > 0)
{
/// 参加考试人数
int testManCout = getAllTestRecords.Select(x => x.TestManId).Distinct().Count();
//// 获取培训计划人员
var getAllTrainingTasks = db.Training_Task.Where(x => x.PlanId == getTestPlan.PlanId);
//// 考试人数大于等于 培训人数
if (testManCout >= getAllTrainingTasks.Count())
{
////所有人员 都交卷时 考试计划结束 状态置为3
var getAllTestRecord = getAllTestRecords.FirstOrDefault(x => !x.TestEndTime.HasValue);
if (getAllTestRecord == null)
{
var getTrainingTasks = getAllTrainingTasks.Where(x => x.States != "2" || x.States == null);
foreach (var item in getTrainingTasks)
{
item.States = "2";
db.SubmitChanges();
}
getTestPlan.States = "3";
db.SubmitChanges();
////TODO 讲培训计划 考试记录 写入到培训记录
APITrainRecordService.InsertTrainRecord(getTestPlan);
}
}
}
}
}
}
#region TestRecord生成一条补考记录 #region TestRecord生成一条补考记录
/// <summary> /// <summary>
/// 根据TestRecord生成一条补考记录 /// 根据TestRecord生成一条补考记录

View File

@ -412,7 +412,6 @@ namespace BLL
catch catch
{ {
return null; return null;
} }
} }
#endregion #endregion

View File

@ -42,6 +42,7 @@ namespace BLL
///删除文件柜A中数据 ///删除文件柜A中数据
// BLL.FileCabinetAItemService.DeleteFileCabinetAItemByID(dataId); // BLL.FileCabinetAItemService.DeleteFileCabinetAItemByID(dataId);
Funs.DB.Sys_CodeRecords.DeleteOnSubmit(codeRecords); Funs.DB.Sys_CodeRecords.DeleteOnSubmit(codeRecords);
Funs.DB.SubmitChanges();
} }
} }

View File

@ -305,49 +305,43 @@ namespace BLL
/// <param name="toKeyId"></param> /// <param name="toKeyId"></param>
public static void SaveAttachUrl(string source, string attachUrl,string menuId,string toKeyId) public static void SaveAttachUrl(string source, string attachUrl,string menuId,string toKeyId)
{ {
string rootUrl = ConfigurationManager.AppSettings["localRoot"]; using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
if (string.IsNullOrEmpty(rootUrl))
{ {
rootUrl = Funs.RootPath; string rootUrl = ConfigurationManager.AppSettings["localRoot"];
} if (string.IsNullOrEmpty(rootUrl))
List<Model.AttachFile> sour = (from x in Funs.DB.AttachFile
where x.MenuId == menuId && x.ToKeyId == toKeyId
select x).ToList();
if (sour.Count() == 0)
{
Model.AttachFile att = new Model.AttachFile
{ {
AttachFileId = SQLHelper.GetNewID(), rootUrl = Funs.RootPath;
ToKeyId = toKeyId,
AttachSource = source.ToString(),
AttachUrl = attachUrl,
MenuId = menuId,
//ImageByte= imageByte,
//AttachPath= attachPath,
};
if (menuId == Const.PersonListMenuId)
{
att.ImageByte = AttachFileService.SetImageToByteArray(rootUrl + attachUrl.Split(',')[0]);
} }
Funs.DB.AttachFile.InsertOnSubmit(att); var sour = db.AttachFile.FirstOrDefault(x => x.MenuId == menuId && x.ToKeyId == toKeyId);
Funs.DB.SubmitChanges(); if (sour == null)
}
else
{
Model.AttachFile att = Funs.DB.AttachFile.FirstOrDefault(x => x.MenuId == menuId && x.AttachFileId == sour.First().AttachFileId);
if (att != null)
{ {
att.ToKeyId = toKeyId; Model.AttachFile att = new Model.AttachFile
att.AttachSource = source.ToString(); {
att.AttachUrl = attachUrl; AttachFileId = SQLHelper.GetNewID(),
att.MenuId = menuId; ToKeyId = toKeyId,
AttachSource = source.ToString(),
AttachUrl = attachUrl,
MenuId = menuId,
//ImageByte= imageByte,
//AttachPath= attachPath,
};
if (menuId == Const.PersonListMenuId) if (menuId == Const.PersonListMenuId)
{ {
att.ImageByte = AttachFileService.SetImageToByteArray(rootUrl + attachUrl.Split(',')[0]); att.ImageByte = AttachFileService.SetImageToByteArray(rootUrl + attachUrl.Split(',')[0]);
} }
Funs.DB.SubmitChanges(); db.AttachFile.InsertOnSubmit(att);
db.SubmitChanges();
}
else
{
sour.AttachSource = source.ToString();
sour.AttachUrl = attachUrl;
if (menuId == Const.PersonListMenuId)
{
sour.ImageByte = AttachFileService.SetImageToByteArray(rootUrl + attachUrl.Split(',')[0]);
}
db.SubmitChanges();
} }
} }
} }

View File

@ -27,7 +27,7 @@ namespace BLL
/// <summary> /// <summary>
/// 根据出入记录 写入考勤记录 /// 根据出入记录 写入考勤记录
/// </summary> /// </summary>
public static void InsertEmployInOutRecord(Model.t_d_facerecordItem drecord) public static void InsertEmployInOutRecord(Model.t_d_facerecordItem drecord,Model.SitePerson_Person getPerson)
{ {
if (drecord.DateTimeRecord.HasValue) if (drecord.DateTimeRecord.HasValue)
{ {
@ -41,24 +41,19 @@ namespace BLL
RecordDate = drecord.DateTimeRecord.Value.Date, RecordDate = drecord.DateTimeRecord.Value.Date,
IDCardNo = drecord.IDCardNo, IDCardNo = drecord.IDCardNo,
}; };
////获取人员 ////获取人员
var getPserson = PersonService.GetPersonByIdentityCard(drecord.ProjectId, drecord.IDCardNo); if (getPerson != null)
if (getPserson == null)
{ {
getPserson = PersonService.GetPersonByName(drecord.ProjectId, drecord.EmployName); newInOutRecord.UnitId = getPerson.UnitId;
} newInOutRecord.UnitName = UnitService.GetUnitNameByUnitId(getPerson.UnitId);
if (getPserson != null) newInOutRecord.DepartmentID = getPerson.TeamGroupId;
{ newInOutRecord.DepartName = TeamGroupService.GetTeamGroupNameByTeamGroupId(getPerson.TeamGroupId);
newInOutRecord.UnitId = getPserson.UnitId; newInOutRecord.EmployNO = getPerson.CardNo;
newInOutRecord.UnitName = UnitService.GetUnitNameByUnitId(getPserson.UnitId); newInOutRecord.EmployName = getPerson.PersonName;
newInOutRecord.DepartmentID = getPserson.TeamGroupId; newInOutRecord.Nation = getPerson.Nation;
newInOutRecord.DepartName = TeamGroupService.GetTeamGroupNameByTeamGroupId(getPserson.TeamGroupId); newInOutRecord.NationName = BasicDataService.GetDictNameByDictCode(getPerson.Nation);
newInOutRecord.EmployNO = getPserson.CardNo; newInOutRecord.PostId = getPerson.WorkPostId;
newInOutRecord.EmployName = getPserson.PersonName; newInOutRecord.PostName = WorkPostService.getWorkPostNameById(getPerson.WorkPostId);
newInOutRecord.Nation = getPserson.Nation;
newInOutRecord.NationName = BasicDataService.GetDictNameByDictCode(getPserson.Nation);
newInOutRecord.PostId = getPserson.WorkPostId;
newInOutRecord.PostName = WorkPostService.getWorkPostNameById(getPserson.WorkPostId);
} }
else else
{ {

View File

@ -59,11 +59,24 @@ namespace BLL
/// <param name="companyTrainingId"></param> /// <param name="companyTrainingId"></param>
public static void DeleteCompanyTraining(string companyTrainingId) public static void DeleteCompanyTraining(string companyTrainingId)
{ {
Model.Training_CompanyTraining companyTraining = db.Training_CompanyTraining.FirstOrDefault(e => e.CompanyTrainingId == companyTrainingId); using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
if (companyTraining!=null)
{ {
db.Training_CompanyTraining.DeleteOnSubmit(companyTraining); var companyTraining = db.Training_CompanyTraining.FirstOrDefault(e => e.CompanyTrainingId == companyTrainingId);
db.SubmitChanges(); if (companyTraining != null)
{
var delItem = from x in db.Training_PlanItem where x.CompanyTrainingId == companyTrainingId select x;
if (delItem.Count() > 0)
{
db.Training_PlanItem.DeleteAllOnSubmit(delItem);
}
var delItemc = from x in db.Training_CompanyTrainingItem where x.CompanyTrainingId == companyTrainingId select x;
if (delItemc.Count() > 0)
{
db.Training_CompanyTrainingItem.DeleteAllOnSubmit(delItemc);
}
db.Training_CompanyTraining.DeleteOnSubmit(companyTraining);
db.SubmitChanges();
}
} }
} }

View File

@ -98,13 +98,12 @@ namespace BLL
/// </summary> /// </summary>
/// <param name="trainingId"></param> /// <param name="trainingId"></param>
public static void DeleteTrainDetailByTrainDetail(string trainDetailId) public static void DeleteTrainDetailByTrainDetail(string trainDetailId)
{ {
Model.SGGLDB db = Funs.DB;
Model.EduTrain_TrainRecordDetail trainDetails = Funs.DB.EduTrain_TrainRecordDetail.FirstOrDefault(e => e.TrainDetailId == trainDetailId); Model.EduTrain_TrainRecordDetail trainDetails = Funs.DB.EduTrain_TrainRecordDetail.FirstOrDefault(e => e.TrainDetailId == trainDetailId);
if (trainDetails != null) if (trainDetails != null)
{ {
db.EduTrain_TrainRecordDetail.DeleteOnSubmit(trainDetails); Funs.DB.EduTrain_TrainRecordDetail.DeleteOnSubmit(trainDetails);
db.SubmitChanges(); Funs.DB.SubmitChanges();
var rainRecord = EduTrain_TrainRecordService.GetTrainingByTrainingId(trainDetails.TrainingId); var rainRecord = EduTrain_TrainRecordService.GetTrainingByTrainingId(trainDetails.TrainingId);
if (rainRecord != null) if (rainRecord != null)

View File

@ -77,8 +77,7 @@ namespace BLL
/// <param name="training">教育培训实体</param> /// <param name="training">教育培训实体</param>
public static void UpdateTraining(Model.EduTrain_TrainRecord training) public static void UpdateTraining(Model.EduTrain_TrainRecord training)
{ {
Model.SGGLDB db = Funs.DB; Model.EduTrain_TrainRecord newTraining = Funs.DB.EduTrain_TrainRecord.FirstOrDefault(e => e.TrainingId == training.TrainingId);
Model.EduTrain_TrainRecord newTraining = db.EduTrain_TrainRecord.FirstOrDefault(e => e.TrainingId == training.TrainingId);
if (newTraining != null) if (newTraining != null)
{ {
newTraining.TrainingCode = training.TrainingCode; newTraining.TrainingCode = training.TrainingCode;
@ -107,7 +106,7 @@ namespace BLL
newTraining.TrainPersonNum = training.TrainPersonNum; newTraining.TrainPersonNum = training.TrainPersonNum;
newTraining.FromRecordId = training.FromRecordId; newTraining.FromRecordId = training.FromRecordId;
newTraining.WorkPostIds = training.WorkPostIds; newTraining.WorkPostIds = training.WorkPostIds;
db.SubmitChanges(); Funs.DB.SubmitChanges();
} }
} }

View File

@ -38,15 +38,10 @@ namespace BLL
if (string.IsNullOrEmpty(newTestRecord.TestType)) if (string.IsNullOrEmpty(newTestRecord.TestType))
{ {
var getTrainTypeName = (from x in db.Training_TestPlan var getTrainTypeName = db.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == testRecord.TestPlanId);
join y in db.Training_Plan on x.PlanId equals y.PlanId
join z in db.Base_TrainType on y.TrainTypeId equals z.TrainTypeId
where x.TestPlanId == testRecord.TestPlanId
select z).FirstOrDefault();
if (getTrainTypeName != null) if (getTrainTypeName != null)
{ {
testRecord.TestType = getTrainTypeName.TrainTypeName; newTestRecord.TestType = getTrainTypeName.PlanName;
} }
} }

View File

@ -63,18 +63,26 @@ namespace BLL
/// <param name="TrainingId"></param> /// <param name="TrainingId"></param>
public static void DeleteTestTrainingById(string TrainingId) public static void DeleteTestTrainingById(string TrainingId)
{ {
Model.SGGLDB db = Funs.DB; using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
Model.Training_TestTraining TestTraining = db.Training_TestTraining.FirstOrDefault(e => e.TrainingId == TrainingId);
if (TestTraining != null)
{ {
var TrainingItem = from x in db.Training_TestTrainingItem where x.TrainingId == TrainingId select x; var TestTraining = db.Training_TestTraining.FirstOrDefault(e => e.TrainingId == TrainingId);
if (TrainingItem.Count() > 0) if (TestTraining != null)
{ {
db.Training_TestTrainingItem.DeleteAllOnSubmit(TrainingItem); var testPlanTraining = from x in db.Training_TestPlanTraining where x.TrainingId == TrainingId select x;
} if (testPlanTraining.Count() > 0)
{
db.Training_TestPlanTraining.DeleteAllOnSubmit(testPlanTraining);
}
db.Training_TestTraining.DeleteOnSubmit(TestTraining); var TrainingItem = from x in db.Training_TestTrainingItem where x.TrainingId == TrainingId select x;
db.SubmitChanges(); if (TrainingItem.Count() > 0)
{
db.Training_TestTrainingItem.DeleteAllOnSubmit(TrainingItem);
}
db.Training_TestTraining.DeleteOnSubmit(TestTraining);
db.SubmitChanges();
}
} }
} }

View File

@ -73,11 +73,11 @@ namespace BLL
/// <param name="taskId"></param> /// <param name="taskId"></param>
public static void DeleteTaskById(string taskId) public static void DeleteTaskById(string taskId)
{ {
Model.Training_Task task = db.Training_Task.FirstOrDefault(e => e.TaskId == taskId); Model.Training_Task task = Funs.DB.Training_Task.FirstOrDefault(e => e.TaskId == taskId);
if (task != null) if (task != null)
{ {
db.Training_Task.DeleteOnSubmit(task); Funs.DB.Training_Task.DeleteOnSubmit(task);
db.SubmitChanges(); Funs.DB.SubmitChanges();
} }
} }
@ -86,18 +86,17 @@ namespace BLL
/// </summary> /// </summary>
/// <param name="planId"></param> /// <param name="planId"></param>
public static void DeleteTaskByPlanId(string planId) public static void DeleteTaskByPlanId(string planId)
{ {
Model.SGGLDB db = Funs.DB; var tasks = from x in Funs.DB.Training_Task where x.PlanId == planId select x;
var tasks = from x in db.Training_Task where x.PlanId == planId select x;
if (tasks.Count() > 0) if (tasks.Count() > 0)
{ {
var taskItems = from x in db.Training_TaskItem where x.PlanId == planId select x; var taskItems = from x in Funs.DB.Training_TaskItem where x.PlanId == planId select x;
if (tasks.Count() > 0) if (tasks.Count() > 0)
{ {
db.Training_TaskItem.DeleteAllOnSubmit(taskItems); Funs.DB.Training_TaskItem.DeleteAllOnSubmit(taskItems);
} }
db.Training_Task.DeleteAllOnSubmit(tasks); Funs.DB.Training_Task.DeleteAllOnSubmit(tasks);
} }
} }
} }

View File

@ -78,48 +78,50 @@ namespace BLL
/// <param name="hazardRegister">危险观察登记实体</param> /// <param name="hazardRegister">危险观察登记实体</param>
public static void UpdateHazardRegister(Model.HSSE_Hazard_HazardRegister hazardRegister) public static void UpdateHazardRegister(Model.HSSE_Hazard_HazardRegister hazardRegister)
{ {
Model.SGGLDB db = Funs.DB; using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
Model.HSSE_Hazard_HazardRegister newHazardRegister = db.HSSE_Hazard_HazardRegister.FirstOrDefault(e => e.HazardRegisterId == hazardRegister.HazardRegisterId);
if (newHazardRegister != null)
{ {
newHazardRegister.HazardCode = hazardRegister.HazardCode; Model.HSSE_Hazard_HazardRegister newHazardRegister = db.HSSE_Hazard_HazardRegister.FirstOrDefault(e => e.HazardRegisterId == hazardRegister.HazardRegisterId);
newHazardRegister.RegisterDef = hazardRegister.RegisterDef; if (newHazardRegister != null)
newHazardRegister.Rectification = hazardRegister.Rectification;
newHazardRegister.Place = hazardRegister.Place;
newHazardRegister.ResponsibleUnit = hazardRegister.ResponsibleUnit;
newHazardRegister.Observer = hazardRegister.Observer;
newHazardRegister.RectifiedDate = hazardRegister.RectifiedDate;
newHazardRegister.AttachUrl = hazardRegister.AttachUrl;
newHazardRegister.ProjectId = hazardRegister.ProjectId;
newHazardRegister.States = hazardRegister.States;
newHazardRegister.Requirements = hazardRegister.Requirements;
newHazardRegister.IsEffective = hazardRegister.IsEffective;
newHazardRegister.ResponsibleMan = hazardRegister.ResponsibleMan;
newHazardRegister.CheckManId = hazardRegister.CheckManId;
//newHazardRegister.CheckTime = hazardRegister.CheckTime;
newHazardRegister.RectificationPeriod = hazardRegister.RectificationPeriod;
newHazardRegister.ImageUrl = hazardRegister.ImageUrl;
newHazardRegister.RectificationImageUrl = hazardRegister.RectificationImageUrl;
newHazardRegister.RectificationTime = hazardRegister.RectificationTime;
newHazardRegister.ConfirmMan = hazardRegister.ConfirmMan;
newHazardRegister.ConfirmDate = hazardRegister.ConfirmDate;
newHazardRegister.HandleIdea = hazardRegister.HandleIdea;
newHazardRegister.CutPayment = hazardRegister.CutPayment;
newHazardRegister.ProblemTypes = hazardRegister.ProblemTypes;
newHazardRegister.DIC_ID = hazardRegister.DIC_ID;
//把附件表的路径复制过来
Model.AttachFile file = BLL.AttachFileService.GetAttachFile(hazardRegister.HazardRegisterId, Const.HSSE_HiddenRectificationListMenuId);
if (file != null)
{ {
newHazardRegister.ImageUrl = file.AttachUrl; newHazardRegister.HazardCode = hazardRegister.HazardCode;
} newHazardRegister.RegisterDef = hazardRegister.RegisterDef;
Model.AttachFile fileR = BLL.AttachFileService.GetAttachFile(hazardRegister.HazardRegisterId + "-R", Const.HSSE_HiddenRectificationListMenuId); newHazardRegister.Rectification = hazardRegister.Rectification;
if (fileR != null) newHazardRegister.Place = hazardRegister.Place;
{ newHazardRegister.ResponsibleUnit = hazardRegister.ResponsibleUnit;
newHazardRegister.RectificationImageUrl = fileR.AttachUrl; newHazardRegister.Observer = hazardRegister.Observer;
} newHazardRegister.RectifiedDate = hazardRegister.RectifiedDate;
newHazardRegister.AttachUrl = hazardRegister.AttachUrl;
newHazardRegister.ProjectId = hazardRegister.ProjectId;
newHazardRegister.States = hazardRegister.States;
newHazardRegister.Requirements = hazardRegister.Requirements;
newHazardRegister.IsEffective = hazardRegister.IsEffective;
newHazardRegister.ResponsibleMan = hazardRegister.ResponsibleMan;
newHazardRegister.CheckManId = hazardRegister.CheckManId;
//newHazardRegister.CheckTime = hazardRegister.CheckTime;
newHazardRegister.RectificationPeriod = hazardRegister.RectificationPeriod;
newHazardRegister.ImageUrl = hazardRegister.ImageUrl;
newHazardRegister.RectificationImageUrl = hazardRegister.RectificationImageUrl;
newHazardRegister.RectificationTime = hazardRegister.RectificationTime;
newHazardRegister.ConfirmMan = hazardRegister.ConfirmMan;
newHazardRegister.ConfirmDate = hazardRegister.ConfirmDate;
newHazardRegister.HandleIdea = hazardRegister.HandleIdea;
newHazardRegister.CutPayment = hazardRegister.CutPayment;
newHazardRegister.ProblemTypes = hazardRegister.ProblemTypes;
newHazardRegister.DIC_ID = hazardRegister.DIC_ID;
//把附件表的路径复制过来
Model.AttachFile file = BLL.AttachFileService.GetAttachFile(hazardRegister.HazardRegisterId, Const.HSSE_HiddenRectificationListMenuId);
if (file != null)
{
newHazardRegister.ImageUrl = file.AttachUrl;
}
Model.AttachFile fileR = BLL.AttachFileService.GetAttachFile(hazardRegister.HazardRegisterId + "-R", Const.HSSE_HiddenRectificationListMenuId);
if (fileR != null)
{
newHazardRegister.RectificationImageUrl = fileR.AttachUrl;
}
db.SubmitChanges(); db.SubmitChanges();
}
} }
} }
@ -129,8 +131,7 @@ namespace BLL
/// <param name="hazardRegisterId">危险观察登记主键</param> /// <param name="hazardRegisterId">危险观察登记主键</param>
public static void DeleteHazardRegisterByHazardRegisterId(string hazardRegisterId) public static void DeleteHazardRegisterByHazardRegisterId(string hazardRegisterId)
{ {
Model.SGGLDB db = Funs.DB; var hazardRegister = Funs.DB.HSSE_Hazard_HazardRegister.FirstOrDefault(e => e.HazardRegisterId == hazardRegisterId);
var hazardRegister = db.HSSE_Hazard_HazardRegister.FirstOrDefault(e => e.HazardRegisterId == hazardRegisterId);
if (hazardRegister != null) if (hazardRegister != null)
{ {
try try
@ -141,8 +142,8 @@ namespace BLL
catch (Exception) catch (Exception)
{ {
} }
db.HSSE_Hazard_HazardRegister.DeleteOnSubmit(hazardRegister); Funs.DB.HSSE_Hazard_HazardRegister.DeleteOnSubmit(hazardRegister);
db.SubmitChanges(); Funs.DB.SubmitChanges();
} }
} }

View File

@ -100,51 +100,54 @@ namespace BLL
/// <param name="updateHSSELog"></param> /// <param name="updateHSSELog"></param>
public static void UpdateHSSELog(Model.Manager_HSSELog updateHSSELog) public static void UpdateHSSELog(Model.Manager_HSSELog updateHSSELog)
{ {
Model.Manager_HSSELog newHSSELog = Funs.DB.Manager_HSSELog.FirstOrDefault(e => e.HSSELogId == updateHSSELog.HSSELogId); using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
if (newHSSELog != null)
{ {
newHSSELog.CompileDate = updateHSSELog.CompileDate; Model.Manager_HSSELog newHSSELog =db.Manager_HSSELog.FirstOrDefault(e => e.HSSELogId == updateHSSELog.HSSELogId);
newHSSELog.CompileMan = updateHSSELog.CompileMan; if (newHSSELog != null)
newHSSELog.Weather = updateHSSELog.Weather; {
newHSSELog.IsVisible = updateHSSELog.IsVisible; newHSSELog.CompileDate = updateHSSELog.CompileDate;
newHSSELog.Num11 = updateHSSELog.Num11; newHSSELog.CompileMan = updateHSSELog.CompileMan;
newHSSELog.Contents12 = updateHSSELog.Contents12; newHSSELog.Weather = updateHSSELog.Weather;
newHSSELog.Contents13 = updateHSSELog.Contents13; newHSSELog.IsVisible = updateHSSELog.IsVisible;
newHSSELog.Contents21 = updateHSSELog.Contents21; newHSSELog.Num11 = updateHSSELog.Num11;
newHSSELog.Num21 = updateHSSELog.Num21; newHSSELog.Contents12 = updateHSSELog.Contents12;
newHSSELog.Contents22 = updateHSSELog.Contents22; newHSSELog.Contents13 = updateHSSELog.Contents13;
newHSSELog.Num22 = updateHSSELog.Num22; newHSSELog.Contents21 = updateHSSELog.Contents21;
newHSSELog.Contents23 = updateHSSELog.Contents23; newHSSELog.Num21 = updateHSSELog.Num21;
newHSSELog.Num23 = updateHSSELog.Num23; newHSSELog.Contents22 = updateHSSELog.Contents22;
newHSSELog.Contents24 = updateHSSELog.Contents24; newHSSELog.Num22 = updateHSSELog.Num22;
newHSSELog.Num24 = updateHSSELog.Num24; newHSSELog.Contents23 = updateHSSELog.Contents23;
newHSSELog.Contents25 = updateHSSELog.Contents25; newHSSELog.Num23 = updateHSSELog.Num23;
newHSSELog.Num25 = updateHSSELog.Num25; newHSSELog.Contents24 = updateHSSELog.Contents24;
newHSSELog.Contents26 = updateHSSELog.Contents26; newHSSELog.Num24 = updateHSSELog.Num24;
newHSSELog.Num26 = updateHSSELog.Num26; newHSSELog.Contents25 = updateHSSELog.Contents25;
newHSSELog.Contents27 = updateHSSELog.Contents27; newHSSELog.Num25 = updateHSSELog.Num25;
newHSSELog.Num27 = updateHSSELog.Num27; newHSSELog.Contents26 = updateHSSELog.Contents26;
newHSSELog.Contents28 = updateHSSELog.Contents28; newHSSELog.Num26 = updateHSSELog.Num26;
newHSSELog.Num28 = updateHSSELog.Num28; newHSSELog.Contents27 = updateHSSELog.Contents27;
newHSSELog.Contents29 = updateHSSELog.Contents29; newHSSELog.Num27 = updateHSSELog.Num27;
newHSSELog.Num29 = updateHSSELog.Num29; newHSSELog.Contents28 = updateHSSELog.Contents28;
newHSSELog.Contents210 = updateHSSELog.Contents210; newHSSELog.Num28 = updateHSSELog.Num28;
newHSSELog.Num210 = updateHSSELog.Num210; newHSSELog.Contents29 = updateHSSELog.Contents29;
newHSSELog.Num211 = updateHSSELog.Num211; newHSSELog.Num29 = updateHSSELog.Num29;
newHSSELog.Contents31 = updateHSSELog.Contents31; newHSSELog.Contents210 = updateHSSELog.Contents210;
newHSSELog.Num31 = updateHSSELog.Num31; newHSSELog.Num210 = updateHSSELog.Num210;
newHSSELog.Contents32 = updateHSSELog.Contents32; newHSSELog.Num211 = updateHSSELog.Num211;
newHSSELog.Num32 = updateHSSELog.Num32; newHSSELog.Contents31 = updateHSSELog.Contents31;
newHSSELog.Contents33 = updateHSSELog.Contents33; newHSSELog.Num31 = updateHSSELog.Num31;
newHSSELog.Num33 = updateHSSELog.Num33; newHSSELog.Contents32 = updateHSSELog.Contents32;
newHSSELog.Contents34 = updateHSSELog.Contents34; newHSSELog.Num32 = updateHSSELog.Num32;
newHSSELog.Num34 = updateHSSELog.Num34; newHSSELog.Contents33 = updateHSSELog.Contents33;
newHSSELog.Contents41 = updateHSSELog.Contents41; newHSSELog.Num33 = updateHSSELog.Num33;
newHSSELog.Contents42 = updateHSSELog.Contents42; newHSSELog.Contents34 = updateHSSELog.Contents34;
newHSSELog.Contents43 = updateHSSELog.Contents43; newHSSELog.Num34 = updateHSSELog.Num34;
newHSSELog.Contents51 = updateHSSELog.Contents51; newHSSELog.Contents41 = updateHSSELog.Contents41;
newHSSELog.Contents52 = updateHSSELog.Contents52; newHSSELog.Contents42 = updateHSSELog.Contents42;
Funs.DB.SubmitChanges(); newHSSELog.Contents43 = updateHSSELog.Contents43;
newHSSELog.Contents51 = updateHSSELog.Contents51;
newHSSELog.Contents52 = updateHSSELog.Contents52;
db.SubmitChanges();
}
} }
} }

View File

@ -40,67 +40,60 @@ namespace BLL
/// <param name="PersonInOut"></param> /// <param name="PersonInOut"></param>
public static void InsertPersonInOutNowNow(Model.SitePerson_PersonInOutNow PersonInOut) public static void InsertPersonInOutNowNow(Model.SitePerson_PersonInOutNow PersonInOut)
{ {
Model.SGGLDB db = Funs.DB; using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
var getNow = db.SitePerson_PersonInOutNow.FirstOrDefault(x => x.PersonInOutId == PersonInOut.PersonInOutId);
if (getNow == null)
{ {
Model.SitePerson_PersonInOutNow newPersonInOut = new Model.SitePerson_PersonInOutNow var getNow = db.SitePerson_PersonInOutNow.FirstOrDefault(x => x.PersonInOutId == PersonInOut.PersonInOutId);
if (getNow == null)
{ {
PersonInOutId = PersonInOut.PersonInOutId, Model.SitePerson_PersonInOutNow newPersonInOut = new Model.SitePerson_PersonInOutNow
ProjectId = PersonInOut.ProjectId,
UnitId = PersonInOut.UnitId,
PersonId = PersonInOut.PersonId,
IsIn = PersonInOut.IsIn,
ChangeTime = PersonInOut.ChangeTime,
WorkPostId = PersonInOut.WorkPostId,
PostType = PersonInOut.PostType,
ProCode = PersonInOut.ProCode,
Name = PersonInOut.Name,
IdcardType = PersonInOut.IdcardType ?? "SHENFEN_ZHENGJIAN",
IdcardNumber = PersonInOut.IdcardNumber,
CheckType = "ZHENGCHANG_KAOQINLEIBIE",
CheckWay = "FACE_FANGSHI",
};
db.SitePerson_PersonInOutNow.InsertOnSubmit(newPersonInOut);
db.SubmitChanges();
/// 监理 业主 不进入
var getPUnit = db.Project_ProjectUnit.FirstOrDefault(x => x.ProjectId == newPersonInOut.ProjectId && x.UnitId == newPersonInOut.UnitId);
if (getPUnit.IsSynchro == true)
{
var getRealNameP = db.RealName_Project.FirstOrDefault(x => x.ProCode == newPersonInOut.ProCode);
if (getRealNameP != null)
{ {
Model.RealName_PersonInOutNow newR = new Model.RealName_PersonInOutNow PersonInOutId = PersonInOut.PersonInOutId,
ProjectId = PersonInOut.ProjectId,
UnitId = PersonInOut.UnitId,
PersonId = PersonInOut.PersonId,
IsIn = PersonInOut.IsIn,
ChangeTime = PersonInOut.ChangeTime,
WorkPostId = PersonInOut.WorkPostId,
PostType = PersonInOut.PostType,
ProCode = PersonInOut.ProCode,
Name = PersonInOut.Name,
IdcardType = PersonInOut.IdcardType ?? "SHENFEN_ZHENGJIAN",
IdcardNumber = PersonInOut.IdcardNumber,
CheckType = "ZHENGCHANG_KAOQINLEIBIE",
CheckWay = "FACE_FANGSHI",
};
db.SitePerson_PersonInOutNow.InsertOnSubmit(newPersonInOut);
db.SubmitChanges();
/// 监理 业主 不进入
var getPUnit = db.Project_ProjectUnit.FirstOrDefault(x => x.ProjectId == newPersonInOut.ProjectId && x.UnitId == newPersonInOut.UnitId);
if (getPUnit.IsSynchro == true)
{
var getRealNameP = db.RealName_Project.FirstOrDefault(x => x.ProCode == newPersonInOut.ProCode);
if (getRealNameP != null)
{ {
PersonInOutId = newPersonInOut.PersonInOutId, Model.RealName_PersonInOutNow newR = new Model.RealName_PersonInOutNow
ProjectId = newPersonInOut.ProjectId, {
UnitId = newPersonInOut.UnitId, PersonInOutId = newPersonInOut.PersonInOutId,
PersonId = newPersonInOut.PersonId, ProjectId = newPersonInOut.ProjectId,
IsIn = newPersonInOut.IsIn, UnitId = newPersonInOut.UnitId,
ChangeTime = newPersonInOut.ChangeTime, PersonId = newPersonInOut.PersonId,
WorkPostId = newPersonInOut.WorkPostId, IsIn = newPersonInOut.IsIn,
PostType = newPersonInOut.PostType, ChangeTime = newPersonInOut.ChangeTime,
ProCode = newPersonInOut.ProCode, WorkPostId = newPersonInOut.WorkPostId,
Name = newPersonInOut.Name, PostType = newPersonInOut.PostType,
IdcardType = newPersonInOut.IdcardType ?? "SHENFEN_ZHENGJIAN", ProCode = newPersonInOut.ProCode,
IdcardNumber = newPersonInOut.IdcardNumber, Name = newPersonInOut.Name,
CheckType = "ZHENGCHANG_KAOQINLEIBIE", IdcardType = newPersonInOut.IdcardType ?? "SHENFEN_ZHENGJIAN",
CheckWay = "FACE_FANGSHI", IdcardNumber = newPersonInOut.IdcardNumber,
}; CheckType = "ZHENGCHANG_KAOQINLEIBIE",
db.RealName_PersonInOutNow.InsertOnSubmit(newR); CheckWay = "FACE_FANGSHI",
db.SubmitChanges(); };
db.RealName_PersonInOutNow.InsertOnSubmit(newR);
db.SubmitChanges();
}
} }
} }
} }
var getLastList = from x in db.SitePerson_PersonInOutNow
where x.ChangeTime <= PersonInOut.ChangeTime.Value.AddHours(-48)
select x;
if (getLastList.Count() > 0)
{
db.SitePerson_PersonInOutNow.DeleteAllOnSubmit(getLastList);
db.SubmitChanges();
}
} }
/// <summary> /// <summary>
@ -109,18 +102,20 @@ namespace BLL
/// <param name="personId"></param> /// <param name="personId"></param>
public static void DeletePersonInOutByPersonId(string personId) public static void DeletePersonInOutByPersonId(string personId)
{ {
Model.SGGLDB db = Funs.DB; using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
var personInOut = from x in db.SitePerson_PersonInOut where x.PersonId == personId select x;
if (personInOut.Count() > 0)
{ {
db.SitePerson_PersonInOut.DeleteAllOnSubmit(personInOut); var personInOut = from x in db.SitePerson_PersonInOut where x.PersonId == personId select x;
db.SubmitChanges(); if (personInOut.Count() > 0)
} {
var rpersonInOut = from x in db.RealName_PersonInOutNow where x.PersonId == personId select x; db.SitePerson_PersonInOut.DeleteAllOnSubmit(personInOut);
if (rpersonInOut.Count() > 0) db.SubmitChanges();
{ }
db.RealName_PersonInOutNow.DeleteAllOnSubmit(rpersonInOut); var rpersonInOut = from x in db.RealName_PersonInOutNow where x.PersonId == personId select x;
db.SubmitChanges(); if (rpersonInOut.Count() > 0)
{
db.RealName_PersonInOutNow.DeleteAllOnSubmit(rpersonInOut);
db.SubmitChanges();
}
} }
} }
@ -130,16 +125,18 @@ namespace BLL
/// <param name="personId"></param> /// <param name="personId"></param>
public static void UpdateRealNameInOut(string personId, string oldCardNo, string newIdCardNo) public static void UpdateRealNameInOut(string personId, string oldCardNo, string newIdCardNo)
{ {
Model.SGGLDB db = Funs.DB; using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
var personInOuts = from x in db.RealName_PersonInOutNow {
var personInOuts = from x in db.RealName_PersonInOutNow
where x.PersonId == personId && x.IdcardNumber == oldCardNo where x.PersonId == personId && x.IdcardNumber == oldCardNo
select x; select x;
if (personInOuts.Count() > 0) if (personInOuts.Count() > 0)
{
foreach (var item in personInOuts)
{ {
item.IdcardNumber = newIdCardNo; foreach (var item in personInOuts)
db.SubmitChanges(); {
item.IdcardNumber = newIdCardNo;
db.SubmitChanges();
}
} }
} }
} }

View File

@ -93,27 +93,29 @@ namespace BLL
/// <param name="personInfo">人员考勤管理实体</param> /// <param name="personInfo">人员考勤管理实体</param>
public static void AddPersonInfo(Model.SitePerson_Checking personInfo) public static void AddPersonInfo(Model.SitePerson_Checking personInfo)
{ {
Model.SGGLDB db = Funs.DB; using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
Model.SitePerson_Checking newPersonInfo = new Model.SitePerson_Checking
{ {
CheckingId = personInfo.CheckingId, Model.SitePerson_Checking newPersonInfo = new Model.SitePerson_Checking
ProjectId = personInfo.ProjectId, {
UnitId = personInfo.UnitId, CheckingId = personInfo.CheckingId,
UnitName = personInfo.UnitName, ProjectId = personInfo.ProjectId,
PersonId = personInfo.PersonId, UnitId = personInfo.UnitId,
PersonName = personInfo.PersonName, UnitName = personInfo.UnitName,
IdentityCard = personInfo.IdentityCard, PersonId = personInfo.PersonId,
CardNo = personInfo.CardNo, PersonName = personInfo.PersonName,
WorkAreaId = personInfo.WorkAreaId, IdentityCard = personInfo.IdentityCard,
WorkAreaName = personInfo.WorkAreaName, CardNo = personInfo.CardNo,
IntoOutTime = personInfo.IntoOutTime, WorkAreaId = personInfo.WorkAreaId,
IntoOut = personInfo.IntoOut, WorkAreaName = personInfo.WorkAreaName,
Address = personInfo.Address, IntoOutTime = personInfo.IntoOutTime,
States = BLL.Const.State_2 IntoOut = personInfo.IntoOut,
}; Address = personInfo.Address,
States = BLL.Const.State_2
};
db.SitePerson_Checking.InsertOnSubmit(newPersonInfo); db.SitePerson_Checking.InsertOnSubmit(newPersonInfo);
db.SubmitChanges(); db.SubmitChanges();
}
if (!string.IsNullOrEmpty(personInfo.ProjectId) && !string.IsNullOrEmpty(personInfo.IdentityCard) && personInfo.IntoOutTime.HasValue) if (!string.IsNullOrEmpty(personInfo.ProjectId) && !string.IsNullOrEmpty(personInfo.IdentityCard) && personInfo.IntoOutTime.HasValue)
{ {

View File

@ -280,80 +280,97 @@ namespace BLL
{ {
try try
{ {
/// 清理出入记录 using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
var getRecords = from x in Funs.DB.T_d_facerecord where x.DateTimeRecord.Value.AddDays(1) < DateTime.Now select x;
if (getRecords.Count() > 0)
{ {
foreach (var item in getRecords) /// 清理实名制未同步历史数据
var getLastList = from x in db.SitePerson_PersonInOutNow
where x.ChangeTime <= DateTime.Now.AddHours(-48)
select x;
if (getLastList.Count() > 0)
{ {
if (item.InOrOut == "进门") db.SitePerson_PersonInOutNow.DeleteAllOnSubmit(getLastList);
db.SubmitChanges();
}
}
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
/// 清理出入记录
var getRecords = from x in db.T_d_facerecord where x.DateTimeRecord.Value.AddDays(1) < DateTime.Now select x;
if (getRecords.Count() > 0)
{
foreach (var item in getRecords)
{ {
var getDelRecordsIn = from x in Funs.DB.T_d_facerecord if (item.InOrOut == "进门")
where x.ProjectId == item.ProjectId && x.EmployNO == item.EmployNO && x.InOrOut == item.InOrOut
&& x.DateTimeRecord.Value.Year == item.DateTimeRecord.Value.Year
&& x.DateTimeRecord.Value.Month == item.DateTimeRecord.Value.Month
&& x.DateTimeRecord.Value.Day == item.DateTimeRecord.Value.Day
&& x.DateTimeRecord > item.DateTimeRecord
select x;
if (getDelRecordsIn.Count() > 0)
{ {
Funs.DB.T_d_facerecord.DeleteAllOnSubmit(getDelRecordsIn); var getDelRecordsIn = from x in db.T_d_facerecord
Funs.DB.SubmitChanges(); where x.ProjectId == item.ProjectId && x.EmployNO == item.EmployNO && x.InOrOut == item.InOrOut
&& x.DateTimeRecord.Value.Year == item.DateTimeRecord.Value.Year
&& x.DateTimeRecord.Value.Month == item.DateTimeRecord.Value.Month
&& x.DateTimeRecord.Value.Day == item.DateTimeRecord.Value.Day
&& x.DateTimeRecord > item.DateTimeRecord
select x;
if (getDelRecordsIn.Count() > 0)
{
db.T_d_facerecord.DeleteAllOnSubmit(getDelRecordsIn);
db.SubmitChanges();
}
} }
} else
else
{
var getDelRecordsOut = from x in Funs.DB.T_d_facerecord
where x.ProjectId == item.ProjectId && x.EmployNO == item.EmployNO && x.InOrOut == item.InOrOut
&& x.DateTimeRecord.Value.Year == item.DateTimeRecord.Value.Year
&& x.DateTimeRecord.Value.Month == item.DateTimeRecord.Value.Month
&& x.DateTimeRecord.Value.Day == item.DateTimeRecord.Value.Day
&& x.DateTimeRecord < item.DateTimeRecord
select x;
if (getDelRecordsOut.Count() > 0)
{ {
Funs.DB.T_d_facerecord.DeleteAllOnSubmit(getDelRecordsOut); var getDelRecordsOut = from x in db.T_d_facerecord
Funs.DB.SubmitChanges(); where x.ProjectId == item.ProjectId && x.EmployNO == item.EmployNO && x.InOrOut == item.InOrOut
&& x.DateTimeRecord.Value.Year == item.DateTimeRecord.Value.Year
&& x.DateTimeRecord.Value.Month == item.DateTimeRecord.Value.Month
&& x.DateTimeRecord.Value.Day == item.DateTimeRecord.Value.Day
&& x.DateTimeRecord < item.DateTimeRecord
select x;
if (getDelRecordsOut.Count() > 0)
{
db.T_d_facerecord.DeleteAllOnSubmit(getDelRecordsOut);
db.SubmitChanges();
}
} }
} }
} }
} }
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
var getVRecords = from x in Funs.DB.T_d_validcardevent
where x.RecordDateTime.Value.AddDays(1) < DateTime.Now
select x;
if (getVRecords.Count() > 0)
{ {
foreach (var item in getVRecords) var getVRecords = from x in db.T_d_validcardevent
where x.RecordDateTime.Value.AddDays(1) < DateTime.Now
select x;
if (getVRecords.Count() > 0)
{ {
if (item.InOrOut == 1) foreach (var item in getVRecords)
{ {
var getDelVRecordsIn = from x in Funs.DB.T_d_validcardevent if (item.InOrOut == 1)
where x.ProjectId == item.ProjectId && x.IDCardNo == item.IDCardNo && x.InOrOut == item.InOrOut
&& x.RecordDateTime.Value.Year == item.RecordDateTime.Value.Year
&& x.RecordDateTime.Value.Month == item.RecordDateTime.Value.Month
&& x.RecordDateTime.Value.Day == item.RecordDateTime.Value.Day
&& x.RecordDateTime > item.RecordDateTime
select x;
if (getDelVRecordsIn.Count() > 0)
{ {
Funs.DB.T_d_validcardevent.DeleteAllOnSubmit(getDelVRecordsIn); var getDelVRecordsIn = from x in db.T_d_validcardevent
Funs.DB.SubmitChanges(); where x.ProjectId == item.ProjectId && x.IDCardNo == item.IDCardNo && x.InOrOut == item.InOrOut
&& x.RecordDateTime.Value.Year == item.RecordDateTime.Value.Year
&& x.RecordDateTime.Value.Month == item.RecordDateTime.Value.Month
&& x.RecordDateTime.Value.Day == item.RecordDateTime.Value.Day
&& x.RecordDateTime > item.RecordDateTime
select x;
if (getDelVRecordsIn.Count() > 0)
{
db.T_d_validcardevent.DeleteAllOnSubmit(getDelVRecordsIn);
db.SubmitChanges();
}
} }
} else
else
{
var getDelVRecordsOut = from x in Funs.DB.T_d_validcardevent
where x.ProjectId == item.ProjectId && x.IDCardNo == item.IDCardNo && x.InOrOut == item.InOrOut
&& x.RecordDateTime.Value.Year == item.RecordDateTime.Value.Year
&& x.RecordDateTime.Value.Month == item.RecordDateTime.Value.Month
&& x.RecordDateTime.Value.Day == item.RecordDateTime.Value.Day
&& x.RecordDateTime < item.RecordDateTime
select x;
if (getDelVRecordsOut.Count() > 0)
{ {
Funs.DB.T_d_validcardevent.DeleteAllOnSubmit(getDelVRecordsOut); var getDelVRecordsOut = from x in db.T_d_validcardevent
Funs.DB.SubmitChanges(); where x.ProjectId == item.ProjectId && x.IDCardNo == item.IDCardNo && x.InOrOut == item.InOrOut
&& x.RecordDateTime.Value.Year == item.RecordDateTime.Value.Year
&& x.RecordDateTime.Value.Month == item.RecordDateTime.Value.Month
&& x.RecordDateTime.Value.Day == item.RecordDateTime.Value.Day
&& x.RecordDateTime < item.RecordDateTime
select x;
if (getDelVRecordsOut.Count() > 0)
{
db.T_d_validcardevent.DeleteAllOnSubmit(getDelVRecordsOut);
db.SubmitChanges();
}
} }
} }
} }

View File

@ -1,75 +0,0 @@
错误信息开始=====>
错误类型:JsonReaderException
错误信息:Error reading JArray from JsonReader. Current JsonReader item is not an array: StartObject. Path '', line 1, position 1.
错误堆栈:
在 Newtonsoft.Json.Linq.JArray.Load(JsonReader reader, JsonLoadSettings settings)
在 Newtonsoft.Json.Linq.JArray.Parse(String json, JsonLoadSettings settings)
在 Newtonsoft.Json.Linq.JArray.Parse(String json)
在 FineUIPro.Web.HJGL.FL.NdtList.btnGet_Click(Object sender, EventArgs e) 位置 E:\工作\五环施工平台\SGGL_CWCEC\SGGL\FineUIPro.Web\HJGL\FL\NdtList.aspx.cs:行号 52
在 FineUIPro.Button.OnClick(EventArgs e)
在 (Button , EventArgs )
在 FineUIPro.Button.RaisePostBackEvent(String eventArgument)
在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
出错时间:05/27/2022 10:30:39
出错文件:http://localhost:8118/HJGL/FL/NdtList.aspx
IP地址:::1
操作人员:JT
出错时间:05/27/2022 10:30:39
错误信息开始=====>
错误类型:NullReferenceException
错误信息:未将对象引用设置到对象的实例。
错误堆栈:
在 FineUIPro.Web.JDGL.WBS.WorkloadInputEdit.Page_Load(Object sender, EventArgs e) 位置 E:\工作\五环施工平台\SGGL_CWCEC\SGGL\FineUIPro.Web\JDGL\WBS\WorkloadInputEdit.aspx.cs:行号 128
在 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
在 System.EventHandler.Invoke(Object sender, EventArgs e)
在 System.Web.UI.Control.OnLoad(EventArgs e)
在 System.Web.UI.Control.LoadRecursive()
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
出错时间:05/30/2022 11:04:57
出错文件:http://localhost:8118/JDGL/WBS/WorkloadInputEdit.aspx?Id=4d04c31f-aaf7-46ab-9b8b-6cd59c78733f
IP地址:::1
操作人员:JT
出错时间:05/30/2022 11:04:57
错误信息开始=====>
错误类型:NullReferenceException
错误信息:未将对象引用设置到对象的实例。
错误堆栈:
在 System.Data.Linq.SqlClient.QueryConverter.VisitInvocation(InvocationExpression invoke)
在 System.Data.Linq.SqlClient.QueryConverter.VisitInner(Expression node)
在 System.Data.Linq.SqlClient.QueryConverter.VisitExpression(Expression exp)
在 System.Data.Linq.SqlClient.QueryConverter.VisitBinary(BinaryExpression b)
在 System.Data.Linq.SqlClient.QueryConverter.VisitInner(Expression node)
在 System.Data.Linq.SqlClient.QueryConverter.VisitExpression(Expression exp)
在 System.Data.Linq.SqlClient.QueryConverter.VisitFirst(Expression sequence, LambdaExpression lambda, Boolean isFirst)
在 System.Data.Linq.SqlClient.QueryConverter.VisitSequenceOperatorCall(MethodCallExpression mc)
在 System.Data.Linq.SqlClient.QueryConverter.VisitMethodCall(MethodCallExpression mc)
在 System.Data.Linq.SqlClient.QueryConverter.VisitInner(Expression node)
在 System.Data.Linq.SqlClient.QueryConverter.ConvertOuter(Expression node)
在 System.Data.Linq.SqlClient.SqlProvider.BuildQuery(Expression query, SqlNodeAnnotations annotations)
在 System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
在 System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)
在 System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source, Expression`1 predicate)
在 FineUIPro.Web.JDGL.WBS.WorkloadInputEditAll.Save() 位置 E:\工作\五环施工平台\SGGL_CWCEC\SGGL\FineUIPro.Web\JDGL\WBS\WorkloadInputEditAll.aspx.cs:行号 175
在 FineUIPro.Web.JDGL.WBS.WorkloadInputEditAll.btnSave_Click(Object sender, EventArgs e) 位置 E:\工作\五环施工平台\SGGL_CWCEC\SGGL\FineUIPro.Web\JDGL\WBS\WorkloadInputEditAll.aspx.cs:行号 157
在 FineUIPro.Button.OnClick(EventArgs e)
在 (Button , EventArgs )
在 FineUIPro.Button.RaisePostBackEvent(String eventArgument)
在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
出错时间:05/30/2022 12:56:13
出错文件:http://localhost:8118/JDGL/WBS/WorkloadInputEditAll.aspx?ProjectId=310e790e-5ede-4345-98a4-8bd0866e69ef
IP地址:::1
操作人员:JT
出错时间:05/30/2022 12:56:13

View File

@ -35,14 +35,13 @@ namespace FineUIPro.Web.HJGL.FL
/// <param name="e"></param> /// <param name="e"></param>
protected void btnGet_Click(object sender, EventArgs e) protected void btnGet_Click(object sender, EventArgs e)
{ {
Model.SGGLDB db = Funs.DB; var HJGL_FL_TotalQuantitys = from x in Funs.DB.HJGL_FL_TotalQuantity where x.ProjectId == this.CurrUser.LoginProjectId select x;
var HJGL_FL_TotalQuantitys = from x in db.HJGL_FL_TotalQuantity where x.ProjectId == this.CurrUser.LoginProjectId select x;
if (HJGL_FL_TotalQuantitys.Count() > 0) if (HJGL_FL_TotalQuantitys.Count() > 0)
{ {
db.HJGL_FL_TotalQuantity.DeleteAllOnSubmit(HJGL_FL_TotalQuantitys); Funs.DB.HJGL_FL_TotalQuantity.DeleteAllOnSubmit(HJGL_FL_TotalQuantitys);
db.SubmitChanges(); Funs.DB.SubmitChanges();
} }
var project = db.Base_Project.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId); var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId);
if (project != null && !string.IsNullOrEmpty(project.HJProjectCode)) if (project != null && !string.IsNullOrEmpty(project.HJProjectCode))
{ {
//项目管道焊接工程量 //项目管道焊接工程量
@ -60,8 +59,8 @@ namespace FineUIPro.Web.HJGL.FL
tq.Unit = item1["unitName"].ToString(); tq.Unit = item1["unitName"].ToString();
tq.TotalWeldQuantity = item1["totalWeldingAmount"].ToString(); tq.TotalWeldQuantity = item1["totalWeldingAmount"].ToString();
tq.TotalCompleted = item1["finishedAmount"].ToString(); tq.TotalCompleted = item1["finishedAmount"].ToString();
db.HJGL_FL_TotalQuantity.InsertOnSubmit(tq); Funs.DB.HJGL_FL_TotalQuantity.InsertOnSubmit(tq);
db.SubmitChanges(); Funs.DB.SubmitChanges();
} }
ShowNotify("获取成功!", MessageBoxIcon.Success); ShowNotify("获取成功!", MessageBoxIcon.Success);
} }
@ -83,7 +82,7 @@ namespace FineUIPro.Web.HJGL.FL
from dbo.HJGL_FL_TotalQuantity c from dbo.HJGL_FL_TotalQuantity c
where c.ProjectId=@ProjectId order by c.DeviceName,DeviceCode "; where c.ProjectId=@ProjectId order by c.DeviceName,DeviceCode ";
List<SqlParameter> listStr = new List<SqlParameter>(); List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId)); listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId ?? ""));
SqlParameter[] parameter = listStr.ToArray(); SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count; Grid1.RecordCount = tb.Rows.Count;

View File

@ -93,7 +93,7 @@ namespace WebAPI.Controllers
RecordDes = "白名单:允许通行", RecordDes = "白名单:允许通行",
InOrOut = (item.attendanceType == 1 ? "进门" : "出门"), InOrOut = (item.attendanceType == 1 ? "进门" : "出门"),
}; };
DoorServerService.InsertEmployInOutRecord(facerecord); DoorServerService.InsertEmployInOutRecord(facerecord, getPerson);
if (facerecord.DateTimeRecord.HasValue) if (facerecord.DateTimeRecord.HasValue)
{ {
int isIn = 0; int isIn = 0;
@ -101,7 +101,7 @@ namespace WebAPI.Controllers
{ {
isIn = 1; isIn = 1;
} }
APIPersonService.getPersonInOut(facerecord.ProjectId, facerecord.EmployNO, isIn, facerecord.DateTimeRecord.Value); APIPersonService.getPersonInOut(getPerson, isIn, facerecord.DateTimeRecord.Value);
} }
} }
responeData.message = "插入成功!"; responeData.message = "插入成功!";

View File

@ -239,16 +239,16 @@ namespace WebAPI.Controllers
{ {
string projectId = facerecord.ProjectId; string projectId = facerecord.ProjectId;
string personName = facerecord.EmployName; string personName = facerecord.EmployName;
Model.SitePerson_Person getPerson = new Model.SitePerson_Person();
string ProjectId_19261 = "1be62038-2b94-4ac2-9b5f-80cef85deeb2"; string ProjectId_19261 = "1be62038-2b94-4ac2-9b5f-80cef85deeb2";
string ProjectId_20041 = "e9fe4b89-f62d-4b3a-a40c-57c87010aa92"; string ProjectId_20041 = "e9fe4b89-f62d-4b3a-a40c-57c87010aa92";
if (projectId == ProjectId_19261 || projectId == ProjectId_20041) if (projectId == ProjectId_19261 || projectId == ProjectId_20041)
{ {
var getPersonByIdCard = db.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == facerecord.EmployNO && (x.ProjectId == ProjectId_19261 || x.ProjectId == ProjectId_20041) && !x.OutTime.HasValue); getPerson = db.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == facerecord.EmployNO && (x.ProjectId == ProjectId_19261 || x.ProjectId == ProjectId_20041) && !x.OutTime.HasValue);
if (getPersonByIdCard != null) if (getPerson != null)
{ {
personName = getPersonByIdCard.PersonName; personName = getPerson.PersonName;
projectId = getPersonByIdCard.ProjectId; projectId = getPerson.ProjectId;
} }
} }
@ -256,11 +256,11 @@ namespace WebAPI.Controllers
string ProjectId_21126 = "a7f692aa-4bd5-4fb3-87f8-ba1ab8f94cc2"; string ProjectId_21126 = "a7f692aa-4bd5-4fb3-87f8-ba1ab8f94cc2";
if (projectId == ProjectId_20197 || projectId == ProjectId_21126) if (projectId == ProjectId_20197 || projectId == ProjectId_21126)
{ {
var getPersonByIdCard = db.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == facerecord.EmployNO && (x.ProjectId == ProjectId_20197 || x.ProjectId == ProjectId_21126) && !x.OutTime.HasValue); getPerson = db.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == facerecord.EmployNO && (x.ProjectId == ProjectId_20197 || x.ProjectId == ProjectId_21126) && !x.OutTime.HasValue);
if (getPersonByIdCard != null) if (getPerson != null)
{ {
personName = getPersonByIdCard.PersonName; personName = getPerson.PersonName;
projectId = getPersonByIdCard.ProjectId; projectId = getPerson.ProjectId;
} }
} }
@ -294,7 +294,7 @@ namespace WebAPI.Controllers
db.SubmitChanges(); db.SubmitChanges();
///// 根据出入记录 写入考勤记录 ///// 根据出入记录 写入考勤记录
facerecord.IDCardNo = facerecord.EmployNO; facerecord.IDCardNo = facerecord.EmployNO;
DoorServerService.InsertEmployInOutRecord(facerecord); DoorServerService.InsertEmployInOutRecord(facerecord, getPerson);
if (facerecord.DateTimeRecord.HasValue) if (facerecord.DateTimeRecord.HasValue)
{ {
int isIn = 0; int isIn = 0;
@ -302,7 +302,7 @@ namespace WebAPI.Controllers
{ {
isIn = 1; isIn = 1;
} }
APIPersonService.getPersonInOut(projectId, facerecord.EmployNO, isIn, facerecord.DateTimeRecord.Value); APIPersonService.getPersonInOut(getPerson, isIn, facerecord.DateTimeRecord.Value);
} }
} }
} }
@ -393,15 +393,20 @@ namespace WebAPI.Controllers
DateTimeRecord = validcardevent.RecordDateTime, DateTimeRecord = validcardevent.RecordDateTime,
InOrOut = validcardevent.InOrOut == 1 ? "进门" : "出门", InOrOut = validcardevent.InOrOut == 1 ? "进门" : "出门",
}; };
DoorServerService.InsertEmployInOutRecord(newFacerecord);
if (validcardevent.RecordDateTime.HasValue) var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.ProjectId == validcardevent.ProjectId && x.IdentityCard == validcardevent.IDCardNo);
if (getPerson != null)
{ {
int isIn = 0; DoorServerService.InsertEmployInOutRecord(newFacerecord, getPerson);
if (validcardevent.InOrOut == 1) if (validcardevent.RecordDateTime.HasValue)
{ {
isIn = 1; int isIn = 0;
if (validcardevent.InOrOut == 1)
{
isIn = 1;
}
APIPersonService.getPersonInOut(getPerson, isIn, validcardevent.RecordDateTime.Value);
} }
APIPersonService.getPersonInOut(validcardevent.ProjectId, validcardevent.IDCardNo, isIn, validcardevent.RecordDateTime.Value);
} }
} }
} }
@ -438,7 +443,11 @@ namespace WebAPI.Controllers
{ {
///// 根据出入记录 写入考勤记录 ///// 根据出入记录 写入考勤记录
facerecord.IDCardNo = facerecord.EmployNO; facerecord.IDCardNo = facerecord.EmployNO;
DoorServerService.InsertEmployInOutRecord(facerecord); var getPerson = Funs.DB.SitePerson_Person.FirstOrDefault(x => x.ProjectId == facerecord.ProjectId && x.IdentityCard == facerecord.EmployNO);
if (getPerson != null)
{
DoorServerService.InsertEmployInOutRecord(facerecord, getPerson);
}
} }
else else
{ {
@ -455,7 +464,6 @@ namespace WebAPI.Controllers
return responeData; return responeData;
} }
#endregion #endregion
#region #region
/// <summary> /// <summary>
/// 获取人员信息出入场记录 /// 获取人员信息出入场记录

View File

@ -188,15 +188,20 @@ namespace WebAPI.Controllers
db.SubmitChanges(); db.SubmitChanges();
///// 根据出入记录 写入考勤记录 ///// 根据出入记录 写入考勤记录
facerecord.IDCardNo = facerecord.EmployNO; facerecord.IDCardNo = facerecord.EmployNO;
DoorServerService.InsertEmployInOutRecord(facerecord);
if (facerecord.DateTimeRecord.HasValue) var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.ProjectId == newFacerecord.ProjectId && x.IdentityCard == newFacerecord.EmployNO);
if (getPerson != null)
{ {
int isIn = 0; DoorServerService.InsertEmployInOutRecord(facerecord, getPerson);
if (facerecord.InOrOut == "进门") if (facerecord.DateTimeRecord.HasValue)
{ {
isIn = 1; int isIn = 0;
if (facerecord.InOrOut == "进门")
{
isIn = 1;
}
APIPersonService.getPersonInOut(getPerson, isIn, facerecord.DateTimeRecord.Value);
} }
APIPersonService.getPersonInOut(facerecord.ProjectId, facerecord.EmployNO, isIn, facerecord.DateTimeRecord.Value);
} }
} }
} }
@ -288,15 +293,19 @@ namespace WebAPI.Controllers
DateTimeRecord = validcardevent.RecordDateTime, DateTimeRecord = validcardevent.RecordDateTime,
InOrOut = validcardevent.InOrOut == 1 ? "进门" : "出门", InOrOut = validcardevent.InOrOut == 1 ? "进门" : "出门",
}; };
DoorServerService.InsertEmployInOutRecord(newFacerecord); var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.ProjectId == validcardevent.ProjectId && x.IdentityCard == validcardevent.IDCardNo);
if (validcardevent.RecordDateTime.HasValue) if (getPerson != null)
{ {
int isIn = 0; DoorServerService.InsertEmployInOutRecord(newFacerecord, getPerson);
if (validcardevent.InOrOut == 1) if (validcardevent.RecordDateTime.HasValue)
{ {
isIn = 1; int isIn = 0;
if (validcardevent.InOrOut == 1)
{
isIn = 1;
}
APIPersonService.getPersonInOut(getPerson, isIn, validcardevent.RecordDateTime.Value);
} }
APIPersonService.getPersonInOut(validcardevent.ProjectId, validcardevent.IDCardNo, isIn, validcardevent.RecordDateTime.Value);
} }
} }
} }
@ -333,7 +342,11 @@ namespace WebAPI.Controllers
{ {
///// 根据出入记录 写入考勤记录 ///// 根据出入记录 写入考勤记录
facerecord.IDCardNo = facerecord.EmployNO; facerecord.IDCardNo = facerecord.EmployNO;
DoorServerService.InsertEmployInOutRecord(facerecord); var getPerson = Funs.DB.SitePerson_Person.FirstOrDefault(x => x.ProjectId == facerecord.ProjectId && x.IdentityCard == facerecord.EmployNO);
if (getPerson != null)
{
DoorServerService.InsertEmployInOutRecord(facerecord, getPerson);
}
} }
else else
{ {

View File

@ -224,6 +224,14 @@ namespace WebAPI.Controllers
TestPlanId = getTestPlan.TestPlanId, TestPlanId = getTestPlan.TestPlanId,
TestManId = personId, TestManId = personId,
}; };
if (string.IsNullOrEmpty(newTestRecord.TestType))
{
var getTrainTypeName = Funs.DB.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == newTestRecord.TestPlanId);
if (getTrainTypeName != null)
{
newTestRecord.TestType = getTrainTypeName.PlanName;
}
}
TestRecordService.AddTestRecord(newTestRecord); TestRecordService.AddTestRecord(newTestRecord);
responeData.code = 3; responeData.code = 3;
responeData.message = "您已加入考试计划!"; responeData.message = "您已加入考试计划!";

View File

@ -322,13 +322,17 @@ namespace WebAPI.Controllers
if (getItem != null) if (getItem != null)
{ {
APITestRecordService.getTestRecordItemAnswerBySelectedItem(getItem, selectedItem); APITestRecordService.getTestRecordItemAnswerBySelectedItem(getItem, selectedItem);
//更新没有结束时间且超时的考试记录 var testRecord = Funs.DB.Training_TestRecord.FirstOrDefault(x => x.TestRecordId == getItem.TestRecordId && x.TestStartTime.Value.AddMinutes(x.Duration) < DateTime.Now);
int closeCount = TestRecordService.UpdateTestEndTimeNull(getItem.TestRecordId); if (testRecord != null)
if (closeCount > 0)
{ {
responeData.code = 2; //更新没有结束时间且超时的考试记录
responeData.message = "本次考试已结束,系统自动交卷!"; int closeCount = TestRecordService.UpdateTestEndTimeNull(getItem.TestRecordId);
} if (closeCount > 0)
{
responeData.code = 2;
responeData.message = "本次考试已结束,系统自动交卷!";
}
}
} }
else else
{ {
@ -375,13 +379,13 @@ namespace WebAPI.Controllers
} }
else else
{ {
APITestRecordService.updateAll(getTestRecord.TestPlanId); //APITestRecordService.updateAll(getTestRecord.TestPlanId);
responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,请再次参加培训后补考。"; responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,请再次参加培训后补考。";
} }
} }
else else
{ {
APITestRecordService.updateAll(getTestRecord.TestPlanId); //APITestRecordService.updateAll(getTestRecord.TestPlanId);
responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。"; responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。";
} }

View File

@ -301,17 +301,18 @@ namespace WebAPI.Controllers
var getItem = TestRecordItemService.GetTestRecordItemTestRecordItemId(testRecordItemId); var getItem = TestRecordItemService.GetTestRecordItemTestRecordItemId(testRecordItemId);
if (getItem != null) if (getItem != null)
{ {
//更新没有结束时间且超时的考试记录 APITestRecordService.getTestRecordItemAnswerBySelectedItem(getItem, selectedItem);
int closeCount = TestRecordService.UpdateTestEndTimeNull(getItem.TestRecordId); var testRecord = Funs.DB.Training_TestRecord.FirstOrDefault(x => x.TestRecordId == getItem.TestRecordId && x.TestStartTime.Value.AddMinutes(x.Duration) < DateTime.Now);
if (closeCount > 0) if (testRecord != null)
{ {
responeData.code = 2; //更新没有结束时间且超时的考试记录
responeData.message = "本次考试已结束,系统自动交卷!"; int closeCount = TestRecordService.UpdateTestEndTimeNull(getItem.TestRecordId);
} if (closeCount > 0)
else {
{ responeData.code = 2;
APITestRecordService.getTestRecordItemAnswerBySelectedItem(getItem, selectedItem); responeData.message = "本次考试已结束,系统自动交卷!";
} }
}
} }
else else
{ {
@ -358,13 +359,13 @@ namespace WebAPI.Controllers
} }
else else
{ {
APITestRecordService.updateAll(getTestRecord.TestPlanId); // APITestRecordService.updateAll(getTestRecord.TestPlanId);
responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,请再次参加培训后补考。"; responeData.message = "考试不合格!您的成绩为:【" + getTestScores.ToString() + "】,请再次参加培训后补考。";
} }
} }
else else
{ {
APITestRecordService.updateAll(getTestRecord.TestPlanId); // APITestRecordService.updateAll(getTestRecord.TestPlanId);
responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。"; responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。";
} }