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)
{ {
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) Model.SitePerson_Person getPerson = new Model.SitePerson_Person();
{
int maxId = 0; int maxId = 0;
string name = string.Empty; string name = string.Empty;
var getPersonByIdCard = db.SitePerson_Person.Where(x => x.IdentityCard == idCard).OrderByDescending(x=>x.InTime).FirstOrDefault(); using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
if (getPersonByIdCard != null)
{ {
name = getPersonByIdCard.PersonName; getPerson = db.SitePerson_Person.Where(x => x.IdentityCard == idCard).OrderByDescending(x => x.InTime).FirstOrDefault();
projectId = getPersonByIdCard.ProjectId; if (getPerson != null)
{
name = getPerson.PersonName;
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;
@ -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(projectId, idCard, isIn, changeTime); APIPersonService.getPersonInOut(getPerson, 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,
@ -101,20 +100,19 @@ 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

@ -304,17 +304,16 @@ namespace BLL
/// <param name="menuId"></param> /// <param name="menuId"></param>
/// <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)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{ {
string rootUrl = ConfigurationManager.AppSettings["localRoot"]; string rootUrl = ConfigurationManager.AppSettings["localRoot"];
if (string.IsNullOrEmpty(rootUrl)) if (string.IsNullOrEmpty(rootUrl))
{ {
rootUrl = Funs.RootPath; rootUrl = Funs.RootPath;
} }
var sour = db.AttachFile.FirstOrDefault(x => x.MenuId == menuId && x.ToKeyId == toKeyId);
List<Model.AttachFile> sour = (from x in Funs.DB.AttachFile if (sour == null)
where x.MenuId == menuId && x.ToKeyId == toKeyId
select x).ToList();
if (sour.Count() == 0)
{ {
Model.AttachFile att = new Model.AttachFile Model.AttachFile att = new Model.AttachFile
{ {
@ -331,23 +330,18 @@ namespace BLL
{ {
att.ImageByte = AttachFileService.SetImageToByteArray(rootUrl + attachUrl.Split(',')[0]); att.ImageByte = AttachFileService.SetImageToByteArray(rootUrl + attachUrl.Split(',')[0]);
} }
Funs.DB.AttachFile.InsertOnSubmit(att); db.AttachFile.InsertOnSubmit(att);
Funs.DB.SubmitChanges(); db.SubmitChanges();
} }
else else
{ {
Model.AttachFile att = Funs.DB.AttachFile.FirstOrDefault(x => x.MenuId == menuId && x.AttachFileId == sour.First().AttachFileId); sour.AttachSource = source.ToString();
if (att != null) sour.AttachUrl = attachUrl;
{
att.ToKeyId = toKeyId;
att.AttachSource = source.ToString();
att.AttachUrl = attachUrl;
att.MenuId = menuId;
if (menuId == Const.PersonListMenuId) if (menuId == Const.PersonListMenuId)
{ {
att.ImageByte = AttachFileService.SetImageToByteArray(rootUrl + attachUrl.Split(',')[0]); sour.ImageByte = AttachFileService.SetImageToByteArray(rootUrl + attachUrl.Split(',')[0]);
} }
Funs.DB.SubmitChanges(); 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)
{ {
@ -42,23 +42,18 @@ namespace BLL
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,13 +59,26 @@ 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))
{
var companyTraining = db.Training_CompanyTraining.FirstOrDefault(e => e.CompanyTrainingId == companyTrainingId);
if (companyTraining != null) 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.Training_CompanyTraining.DeleteOnSubmit(companyTraining);
db.SubmitChanges(); db.SubmitChanges();
} }
} }
}
/// <summary> /// <summary>
/// 是否可删除资源节点 /// 是否可删除资源节点

View File

@ -99,12 +99,11 @@ namespace BLL
/// <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,10 +63,17 @@ 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); {
var TestTraining = db.Training_TestTraining.FirstOrDefault(e => e.TrainingId == TrainingId);
if (TestTraining != null) if (TestTraining != null)
{ {
var testPlanTraining = from x in db.Training_TestPlanTraining where x.TrainingId == TrainingId select x;
if (testPlanTraining.Count() > 0)
{
db.Training_TestPlanTraining.DeleteAllOnSubmit(testPlanTraining);
}
var TrainingItem = from x in db.Training_TestTrainingItem where x.TrainingId == TrainingId select x; var TrainingItem = from x in db.Training_TestTrainingItem where x.TrainingId == TrainingId select x;
if (TrainingItem.Count() > 0) if (TrainingItem.Count() > 0)
{ {
@ -77,6 +84,7 @@ namespace BLL
db.SubmitChanges(); db.SubmitChanges();
} }
} }
}
/// <summary> /// <summary>
/// 获取试题类型列表 /// 获取试题类型列表

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();
} }
} }
@ -87,17 +87,16 @@ namespace BLL
/// <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,7 +78,8 @@ 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); Model.HSSE_Hazard_HazardRegister newHazardRegister = db.HSSE_Hazard_HazardRegister.FirstOrDefault(e => e.HazardRegisterId == hazardRegister.HazardRegisterId);
if (newHazardRegister != null) if (newHazardRegister != null)
{ {
@ -122,6 +123,7 @@ namespace BLL
db.SubmitChanges(); db.SubmitChanges();
} }
} }
}
/// <summary> /// <summary>
/// 根据危险观察登记主键删除一个危险观察登记信息 /// 根据危险观察登记主键删除一个危险观察登记信息
@ -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,7 +100,9 @@ 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))
{
Model.Manager_HSSELog newHSSELog =db.Manager_HSSELog.FirstOrDefault(e => e.HSSELogId == updateHSSELog.HSSELogId);
if (newHSSELog != null) if (newHSSELog != null)
{ {
newHSSELog.CompileDate = updateHSSELog.CompileDate; newHSSELog.CompileDate = updateHSSELog.CompileDate;
@ -144,7 +146,8 @@ namespace BLL
newHSSELog.Contents43 = updateHSSELog.Contents43; newHSSELog.Contents43 = updateHSSELog.Contents43;
newHSSELog.Contents51 = updateHSSELog.Contents51; newHSSELog.Contents51 = updateHSSELog.Contents51;
newHSSELog.Contents52 = updateHSSELog.Contents52; newHSSELog.Contents52 = updateHSSELog.Contents52;
Funs.DB.SubmitChanges(); db.SubmitChanges();
}
} }
} }

View File

@ -40,7 +40,8 @@ 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); var getNow = db.SitePerson_PersonInOutNow.FirstOrDefault(x => x.PersonInOutId == PersonInOut.PersonInOutId);
if (getNow == null) if (getNow == null)
{ {
@ -92,14 +93,6 @@ namespace BLL
} }
} }
} }
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();
} }
} }
@ -109,7 +102,8 @@ 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; var personInOut = from x in db.SitePerson_PersonInOut where x.PersonId == personId select x;
if (personInOut.Count() > 0) if (personInOut.Count() > 0)
{ {
@ -123,6 +117,7 @@ namespace BLL
db.SubmitChanges(); db.SubmitChanges();
} }
} }
}
/// <summary> /// <summary>
/// 身份证号码发生变化时 修改实名制出入记录 /// 身份证号码发生变化时 修改实名制出入记录
@ -130,7 +125,8 @@ 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;
@ -143,6 +139,7 @@ namespace BLL
} }
} }
} }
}
/// <summary> /// <summary>
/// 获取出入记录人工时 /// 获取出入记录人工时

View File

@ -93,7 +93,8 @@ 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 Model.SitePerson_Checking newPersonInfo = new Model.SitePerson_Checking
{ {
CheckingId = personInfo.CheckingId, CheckingId = personInfo.CheckingId,
@ -114,6 +115,7 @@ namespace BLL
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

@ -279,16 +279,30 @@ namespace BLL
private static void CleanAttendance(object sender, ElapsedEventArgs e) private static void CleanAttendance(object sender, ElapsedEventArgs e)
{ {
try try
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
/// 清理实名制未同步历史数据
var getLastList = from x in db.SitePerson_PersonInOutNow
where x.ChangeTime <= DateTime.Now.AddHours(-48)
select x;
if (getLastList.Count() > 0)
{
db.SitePerson_PersonInOutNow.DeleteAllOnSubmit(getLastList);
db.SubmitChanges();
}
}
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; var getRecords = from x in db.T_d_facerecord where x.DateTimeRecord.Value.AddDays(1) < DateTime.Now select x;
if (getRecords.Count() > 0) if (getRecords.Count() > 0)
{ {
foreach (var item in getRecords) foreach (var item in getRecords)
{ {
if (item.InOrOut == "进门") if (item.InOrOut == "进门")
{ {
var getDelRecordsIn = from x in Funs.DB.T_d_facerecord var getDelRecordsIn = from x in db.T_d_facerecord
where x.ProjectId == item.ProjectId && x.EmployNO == item.EmployNO && x.InOrOut == 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.Year == item.DateTimeRecord.Value.Year
&& x.DateTimeRecord.Value.Month == item.DateTimeRecord.Value.Month && x.DateTimeRecord.Value.Month == item.DateTimeRecord.Value.Month
@ -297,13 +311,13 @@ namespace BLL
select x; select x;
if (getDelRecordsIn.Count() > 0) if (getDelRecordsIn.Count() > 0)
{ {
Funs.DB.T_d_facerecord.DeleteAllOnSubmit(getDelRecordsIn); db.T_d_facerecord.DeleteAllOnSubmit(getDelRecordsIn);
Funs.DB.SubmitChanges(); db.SubmitChanges();
} }
} }
else else
{ {
var getDelRecordsOut = from x in Funs.DB.T_d_facerecord var getDelRecordsOut = from x in db.T_d_facerecord
where x.ProjectId == item.ProjectId && x.EmployNO == item.EmployNO && x.InOrOut == 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.Year == item.DateTimeRecord.Value.Year
&& x.DateTimeRecord.Value.Month == item.DateTimeRecord.Value.Month && x.DateTimeRecord.Value.Month == item.DateTimeRecord.Value.Month
@ -312,14 +326,16 @@ namespace BLL
select x; select x;
if (getDelRecordsOut.Count() > 0) if (getDelRecordsOut.Count() > 0)
{ {
Funs.DB.T_d_facerecord.DeleteAllOnSubmit(getDelRecordsOut); db.T_d_facerecord.DeleteAllOnSubmit(getDelRecordsOut);
Funs.DB.SubmitChanges(); db.SubmitChanges();
} }
} }
} }
} }
}
var getVRecords = from x in Funs.DB.T_d_validcardevent using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getVRecords = from x in db.T_d_validcardevent
where x.RecordDateTime.Value.AddDays(1) < DateTime.Now where x.RecordDateTime.Value.AddDays(1) < DateTime.Now
select x; select x;
if (getVRecords.Count() > 0) if (getVRecords.Count() > 0)
@ -328,7 +344,7 @@ namespace BLL
{ {
if (item.InOrOut == 1) if (item.InOrOut == 1)
{ {
var getDelVRecordsIn = from x in Funs.DB.T_d_validcardevent var getDelVRecordsIn = from x in db.T_d_validcardevent
where x.ProjectId == item.ProjectId && x.IDCardNo == item.IDCardNo && x.InOrOut == item.InOrOut where x.ProjectId == item.ProjectId && x.IDCardNo == item.IDCardNo && x.InOrOut == item.InOrOut
&& x.RecordDateTime.Value.Year == item.RecordDateTime.Value.Year && x.RecordDateTime.Value.Year == item.RecordDateTime.Value.Year
&& x.RecordDateTime.Value.Month == item.RecordDateTime.Value.Month && x.RecordDateTime.Value.Month == item.RecordDateTime.Value.Month
@ -337,13 +353,13 @@ namespace BLL
select x; select x;
if (getDelVRecordsIn.Count() > 0) if (getDelVRecordsIn.Count() > 0)
{ {
Funs.DB.T_d_validcardevent.DeleteAllOnSubmit(getDelVRecordsIn); db.T_d_validcardevent.DeleteAllOnSubmit(getDelVRecordsIn);
Funs.DB.SubmitChanges(); db.SubmitChanges();
} }
} }
else else
{ {
var getDelVRecordsOut = from x in Funs.DB.T_d_validcardevent var getDelVRecordsOut = from x in db.T_d_validcardevent
where x.ProjectId == item.ProjectId && x.IDCardNo == item.IDCardNo && x.InOrOut == item.InOrOut where x.ProjectId == item.ProjectId && x.IDCardNo == item.IDCardNo && x.InOrOut == item.InOrOut
&& x.RecordDateTime.Value.Year == item.RecordDateTime.Value.Year && x.RecordDateTime.Value.Year == item.RecordDateTime.Value.Year
&& x.RecordDateTime.Value.Month == item.RecordDateTime.Value.Month && x.RecordDateTime.Value.Month == item.RecordDateTime.Value.Month
@ -352,8 +368,9 @@ namespace BLL
select x; select x;
if (getDelVRecordsOut.Count() > 0) if (getDelVRecordsOut.Count() > 0)
{ {
Funs.DB.T_d_validcardevent.DeleteAllOnSubmit(getDelVRecordsOut); db.T_d_validcardevent.DeleteAllOnSubmit(getDelVRecordsOut);
Funs.DB.SubmitChanges(); 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,7 +393,11 @@ 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 (getPerson != null)
{
DoorServerService.InsertEmployInOutRecord(newFacerecord, getPerson);
if (validcardevent.RecordDateTime.HasValue) if (validcardevent.RecordDateTime.HasValue)
{ {
int isIn = 0; int isIn = 0;
@ -401,7 +405,8 @@ namespace WebAPI.Controllers
{ {
isIn = 1; isIn = 1;
} }
APIPersonService.getPersonInOut(validcardevent.ProjectId, validcardevent.IDCardNo, isIn, validcardevent.RecordDateTime.Value); APIPersonService.getPersonInOut(getPerson, 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,7 +188,11 @@ namespace WebAPI.Controllers
db.SubmitChanges(); db.SubmitChanges();
///// 根据出入记录 写入考勤记录 ///// 根据出入记录 写入考勤记录
facerecord.IDCardNo = facerecord.EmployNO; facerecord.IDCardNo = facerecord.EmployNO;
DoorServerService.InsertEmployInOutRecord(facerecord);
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.ProjectId == newFacerecord.ProjectId && x.IdentityCard == newFacerecord.EmployNO);
if (getPerson != null)
{
DoorServerService.InsertEmployInOutRecord(facerecord, getPerson);
if (facerecord.DateTimeRecord.HasValue) if (facerecord.DateTimeRecord.HasValue)
{ {
int isIn = 0; int isIn = 0;
@ -196,7 +200,8 @@ namespace WebAPI.Controllers
{ {
isIn = 1; isIn = 1;
} }
APIPersonService.getPersonInOut(facerecord.ProjectId, facerecord.EmployNO, isIn, facerecord.DateTimeRecord.Value); APIPersonService.getPersonInOut(getPerson, isIn, facerecord.DateTimeRecord.Value);
}
} }
} }
} }
@ -288,7 +293,10 @@ 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 (getPerson != null)
{
DoorServerService.InsertEmployInOutRecord(newFacerecord, getPerson);
if (validcardevent.RecordDateTime.HasValue) if (validcardevent.RecordDateTime.HasValue)
{ {
int isIn = 0; int isIn = 0;
@ -296,7 +304,8 @@ namespace WebAPI.Controllers
{ {
isIn = 1; isIn = 1;
} }
APIPersonService.getPersonInOut(validcardevent.ProjectId, validcardevent.IDCardNo, isIn, validcardevent.RecordDateTime.Value); APIPersonService.getPersonInOut(getPerson, 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,6 +322,9 @@ 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);
if (testRecord != null)
{
//更新没有结束时间且超时的考试记录 //更新没有结束时间且超时的考试记录
int closeCount = TestRecordService.UpdateTestEndTimeNull(getItem.TestRecordId); int closeCount = TestRecordService.UpdateTestEndTimeNull(getItem.TestRecordId);
if (closeCount > 0) if (closeCount > 0)
@ -330,6 +333,7 @@ namespace WebAPI.Controllers
responeData.message = "本次考试已结束,系统自动交卷!"; responeData.message = "本次考试已结束,系统自动交卷!";
} }
} }
}
else else
{ {
responeData.code = 0; responeData.code = 0;
@ -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

@ -300,6 +300,10 @@ namespace WebAPI.Controllers
{ {
var getItem = TestRecordItemService.GetTestRecordItemTestRecordItemId(testRecordItemId); var getItem = TestRecordItemService.GetTestRecordItemTestRecordItemId(testRecordItemId);
if (getItem != null) if (getItem != null)
{
APITestRecordService.getTestRecordItemAnswerBySelectedItem(getItem, selectedItem);
var testRecord = Funs.DB.Training_TestRecord.FirstOrDefault(x => x.TestRecordId == getItem.TestRecordId && x.TestStartTime.Value.AddMinutes(x.Duration) < DateTime.Now);
if (testRecord != null)
{ {
//更新没有结束时间且超时的考试记录 //更新没有结束时间且超时的考试记录
int closeCount = TestRecordService.UpdateTestEndTimeNull(getItem.TestRecordId); int closeCount = TestRecordService.UpdateTestEndTimeNull(getItem.TestRecordId);
@ -308,9 +312,6 @@ namespace WebAPI.Controllers
responeData.code = 2; responeData.code = 2;
responeData.message = "本次考试已结束,系统自动交卷!"; responeData.message = "本次考试已结束,系统自动交卷!";
} }
else
{
APITestRecordService.getTestRecordItemAnswerBySelectedItem(getItem, selectedItem);
} }
} }
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() + "】。";
} }