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>
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))
{
int maxId = 0;
string name = string.Empty;
var getPersonByIdCard = db.SitePerson_Person.Where(x => x.IdentityCard == idCard).OrderByDescending(x=>x.InTime).FirstOrDefault();
if (getPersonByIdCard != null)
getPerson = db.SitePerson_Person.Where(x => x.IdentityCard == idCard).OrderByDescending(x => x.InTime).FirstOrDefault();
if (getPerson != null)
{
name = getPersonByIdCard.PersonName;
projectId = getPersonByIdCard.ProjectId;
name = getPerson.PersonName;
projectId = getPerson.ProjectId;
}
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)
{
name = getPerson.PersonName;
@ -41,7 +42,7 @@ namespace BLL
{
maxId = getmax.Max() + 1;
}
Model.T_d_facerecord newFacerecord = new Model.T_d_facerecord()
{
NewID = SQLHelper.GetNewID(),
@ -56,7 +57,10 @@ namespace BLL
};
db.T_d_facerecord.InsertOnSubmit(newFacerecord);
db.SubmitChanges();
}
if (getPerson != null)
{
///// 根据出入记录 写入考勤记录
Model.t_d_facerecordItem facerecord = new Model.t_d_facerecordItem
{
@ -70,9 +74,10 @@ namespace BLL
RecordDes = Intype,
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="isIn"></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))
{
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.ProjectId == projectId && x.IdentityCard == idCard);
{
if (getPerson != null)
{
string postType = null;
@ -1061,13 +1060,13 @@ namespace BLL
{
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)
{
Model.SitePerson_PersonInOut newInOut = new Model.SitePerson_PersonInOut
{
PersonInOutId = SQLHelper.GetNewID(),
ProjectId = projectId,
ProjectId = getPerson.ProjectId,
UnitId = getPerson.UnitId,
PersonId = getPerson.PersonId,
IsIn = isIn == 1 ? true : false,
@ -1079,7 +1078,7 @@ namespace BLL
db.SitePerson_PersonInOut.InsertOnSubmit(newInOut);
db.SubmitChanges();
string proCode = ProjectService.GetJTProjectCodeByProjectId(projectId);
string proCode = ProjectService.GetJTProjectCodeByProjectId(getPerson.ProjectId);
Model.SitePerson_PersonInOutNow newNow = new Model.SitePerson_PersonInOutNow
{
PersonInOutId = newInOut.PersonInOutId,

View File

@ -245,6 +245,14 @@ namespace BLL
TestType = item.TestType,
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.SubmitChanges();
}

View File

@ -21,7 +21,6 @@ namespace BLL
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getDataLists = (from x in db.Training_TestRecord
join y in db.SitePerson_Person on x.TestManId equals y.PersonId
where x.TestPlanId == testPlanId
orderby x.TestStartTime descending
select new Model.TestRecordItem
@ -30,7 +29,7 @@ namespace BLL
ProjectId = x.ProjectId,
TestPlanId = x.TestPlanId,
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),
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
TestScores = x.TestScores ?? 0,
@ -100,21 +99,20 @@ namespace BLL
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getDataLists = from x in db.Training_TestRecord
join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
var getDataLists = from x in db.Training_TestRecord
where x.TestRecordId == testRecordId
select new Model.TestRecordItem
{
TestRecordId = x.TestRecordId,
ProjectId = x.ProjectId,
TestPlanId = x.TestPlanId,
TestPlanName = y.PlanName,
TestPlanName = x.TestType,
TestManId = x.TestManId,
TestManName = db.SitePerson_Person.First(u => u.PersonId == x.TestManId).PersonName,
TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime),
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
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,
TestType = x.TestType,
TemporaryUser = x.TemporaryUser,
@ -572,62 +570,17 @@ namespace BLL
var getRItem = db.Training_TestRecordItem.Where(x => x.TestRecordId == getTestRecord.TestRecordId);
if (getRItem.Count() > 0)
{
getTestRecord.TestScores = getRItem.Sum(x => x.SubjectScore);
getTestRecord.TestScores = getRItem.Sum(x => x.SubjectScore ?? 0);
}
db.SubmitChanges();
getCode = getTestRecord.TestScores ?? 0;
}
}
return getCode;
}
#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生成一条补考记录
/// <summary>
/// 根据TestRecord生成一条补考记录

View File

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

View File

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

View File

@ -305,49 +305,43 @@ namespace BLL
/// <param name="toKeyId"></param>
public static void SaveAttachUrl(string source, string attachUrl,string menuId,string toKeyId)
{
string rootUrl = ConfigurationManager.AppSettings["localRoot"];
if (string.IsNullOrEmpty(rootUrl))
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
rootUrl = Funs.RootPath;
}
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
string rootUrl = ConfigurationManager.AppSettings["localRoot"];
if (string.IsNullOrEmpty(rootUrl))
{
AttachFileId = SQLHelper.GetNewID(),
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]);
rootUrl = Funs.RootPath;
}
Funs.DB.AttachFile.InsertOnSubmit(att);
Funs.DB.SubmitChanges();
}
else
{
Model.AttachFile att = Funs.DB.AttachFile.FirstOrDefault(x => x.MenuId == menuId && x.AttachFileId == sour.First().AttachFileId);
if (att != null)
var sour = db.AttachFile.FirstOrDefault(x => x.MenuId == menuId && x.ToKeyId == toKeyId);
if (sour == null)
{
att.ToKeyId = toKeyId;
att.AttachSource = source.ToString();
att.AttachUrl = attachUrl;
att.MenuId = menuId;
Model.AttachFile att = new Model.AttachFile
{
AttachFileId = SQLHelper.GetNewID(),
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.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>
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)
{
@ -41,24 +41,19 @@ namespace BLL
RecordDate = drecord.DateTimeRecord.Value.Date,
IDCardNo = drecord.IDCardNo,
};
////获取人员
var getPserson = PersonService.GetPersonByIdentityCard(drecord.ProjectId, drecord.IDCardNo);
if (getPserson == null)
////获取人员
if (getPerson != null)
{
getPserson = PersonService.GetPersonByName(drecord.ProjectId, drecord.EmployName);
}
if (getPserson != null)
{
newInOutRecord.UnitId = getPserson.UnitId;
newInOutRecord.UnitName = UnitService.GetUnitNameByUnitId(getPserson.UnitId);
newInOutRecord.DepartmentID = getPserson.TeamGroupId;
newInOutRecord.DepartName = TeamGroupService.GetTeamGroupNameByTeamGroupId(getPserson.TeamGroupId);
newInOutRecord.EmployNO = getPserson.CardNo;
newInOutRecord.EmployName = getPserson.PersonName;
newInOutRecord.Nation = getPserson.Nation;
newInOutRecord.NationName = BasicDataService.GetDictNameByDictCode(getPserson.Nation);
newInOutRecord.PostId = getPserson.WorkPostId;
newInOutRecord.PostName = WorkPostService.getWorkPostNameById(getPserson.WorkPostId);
newInOutRecord.UnitId = getPerson.UnitId;
newInOutRecord.UnitName = UnitService.GetUnitNameByUnitId(getPerson.UnitId);
newInOutRecord.DepartmentID = getPerson.TeamGroupId;
newInOutRecord.DepartName = TeamGroupService.GetTeamGroupNameByTeamGroupId(getPerson.TeamGroupId);
newInOutRecord.EmployNO = getPerson.CardNo;
newInOutRecord.EmployName = getPerson.PersonName;
newInOutRecord.Nation = getPerson.Nation;
newInOutRecord.NationName = BasicDataService.GetDictNameByDictCode(getPerson.Nation);
newInOutRecord.PostId = getPerson.WorkPostId;
newInOutRecord.PostName = WorkPostService.getWorkPostNameById(getPerson.WorkPostId);
}
else
{

View File

@ -59,11 +59,24 @@ namespace BLL
/// <param name="companyTrainingId"></param>
public static void DeleteCompanyTraining(string companyTrainingId)
{
Model.Training_CompanyTraining companyTraining = db.Training_CompanyTraining.FirstOrDefault(e => e.CompanyTrainingId == companyTrainingId);
if (companyTraining!=null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Training_CompanyTraining.DeleteOnSubmit(companyTraining);
db.SubmitChanges();
var companyTraining = db.Training_CompanyTraining.FirstOrDefault(e => e.CompanyTrainingId == companyTrainingId);
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>
/// <param name="trainingId"></param>
public static void DeleteTrainDetailByTrainDetail(string trainDetailId)
{
Model.SGGLDB db = Funs.DB;
{
Model.EduTrain_TrainRecordDetail trainDetails = Funs.DB.EduTrain_TrainRecordDetail.FirstOrDefault(e => e.TrainDetailId == trainDetailId);
if (trainDetails != null)
{
db.EduTrain_TrainRecordDetail.DeleteOnSubmit(trainDetails);
db.SubmitChanges();
Funs.DB.EduTrain_TrainRecordDetail.DeleteOnSubmit(trainDetails);
Funs.DB.SubmitChanges();
var rainRecord = EduTrain_TrainRecordService.GetTrainingByTrainingId(trainDetails.TrainingId);
if (rainRecord != null)

View File

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

View File

@ -38,15 +38,10 @@ namespace BLL
if (string.IsNullOrEmpty(newTestRecord.TestType))
{
var getTrainTypeName = (from x in db.Training_TestPlan
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();
var getTrainTypeName = db.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == testRecord.TestPlanId);
if (getTrainTypeName != null)
{
testRecord.TestType = getTrainTypeName.TrainTypeName;
newTestRecord.TestType = getTrainTypeName.PlanName;
}
}

View File

@ -63,18 +63,26 @@ namespace BLL
/// <param name="TrainingId"></param>
public static void DeleteTestTrainingById(string TrainingId)
{
Model.SGGLDB db = Funs.DB;
Model.Training_TestTraining TestTraining = db.Training_TestTraining.FirstOrDefault(e => e.TrainingId == TrainingId);
if (TestTraining != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var TrainingItem = from x in db.Training_TestTrainingItem where x.TrainingId == TrainingId select x;
if (TrainingItem.Count() > 0)
var TestTraining = db.Training_TestTraining.FirstOrDefault(e => e.TrainingId == TrainingId);
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);
db.SubmitChanges();
var TrainingItem = from x in db.Training_TestTrainingItem where x.TrainingId == TrainingId select x;
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>
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)
{
db.Training_Task.DeleteOnSubmit(task);
db.SubmitChanges();
Funs.DB.Training_Task.DeleteOnSubmit(task);
Funs.DB.SubmitChanges();
}
}
@ -86,18 +86,17 @@ namespace BLL
/// </summary>
/// <param name="planId"></param>
public static void DeleteTaskByPlanId(string planId)
{
Model.SGGLDB db = Funs.DB;
var tasks = from x in db.Training_Task where x.PlanId == planId select x;
{
var tasks = from x in Funs.DB.Training_Task where x.PlanId == planId select x;
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)
{
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>
public static void UpdateHazardRegister(Model.HSSE_Hazard_HazardRegister hazardRegister)
{
Model.SGGLDB db = Funs.DB;
Model.HSSE_Hazard_HazardRegister newHazardRegister = db.HSSE_Hazard_HazardRegister.FirstOrDefault(e => e.HazardRegisterId == hazardRegister.HazardRegisterId);
if (newHazardRegister != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
newHazardRegister.HazardCode = hazardRegister.HazardCode;
newHazardRegister.RegisterDef = hazardRegister.RegisterDef;
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)
Model.HSSE_Hazard_HazardRegister newHazardRegister = db.HSSE_Hazard_HazardRegister.FirstOrDefault(e => e.HazardRegisterId == hazardRegister.HazardRegisterId);
if (newHazardRegister != null)
{
newHazardRegister.ImageUrl = file.AttachUrl;
}
Model.AttachFile fileR = BLL.AttachFileService.GetAttachFile(hazardRegister.HazardRegisterId + "-R", Const.HSSE_HiddenRectificationListMenuId);
if (fileR != null)
{
newHazardRegister.RectificationImageUrl = fileR.AttachUrl;
}
newHazardRegister.HazardCode = hazardRegister.HazardCode;
newHazardRegister.RegisterDef = hazardRegister.RegisterDef;
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;
}
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>
public static void DeleteHazardRegisterByHazardRegisterId(string hazardRegisterId)
{
Model.SGGLDB db = Funs.DB;
var hazardRegister = db.HSSE_Hazard_HazardRegister.FirstOrDefault(e => e.HazardRegisterId == hazardRegisterId);
var hazardRegister = Funs.DB.HSSE_Hazard_HazardRegister.FirstOrDefault(e => e.HazardRegisterId == hazardRegisterId);
if (hazardRegister != null)
{
try
@ -141,8 +142,8 @@ namespace BLL
catch (Exception)
{
}
db.HSSE_Hazard_HazardRegister.DeleteOnSubmit(hazardRegister);
db.SubmitChanges();
Funs.DB.HSSE_Hazard_HazardRegister.DeleteOnSubmit(hazardRegister);
Funs.DB.SubmitChanges();
}
}

View File

@ -100,51 +100,54 @@ namespace BLL
/// <param name="updateHSSELog"></param>
public static void UpdateHSSELog(Model.Manager_HSSELog updateHSSELog)
{
Model.Manager_HSSELog newHSSELog = Funs.DB.Manager_HSSELog.FirstOrDefault(e => e.HSSELogId == updateHSSELog.HSSELogId);
if (newHSSELog != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
newHSSELog.CompileDate = updateHSSELog.CompileDate;
newHSSELog.CompileMan = updateHSSELog.CompileMan;
newHSSELog.Weather = updateHSSELog.Weather;
newHSSELog.IsVisible = updateHSSELog.IsVisible;
newHSSELog.Num11 = updateHSSELog.Num11;
newHSSELog.Contents12 = updateHSSELog.Contents12;
newHSSELog.Contents13 = updateHSSELog.Contents13;
newHSSELog.Contents21 = updateHSSELog.Contents21;
newHSSELog.Num21 = updateHSSELog.Num21;
newHSSELog.Contents22 = updateHSSELog.Contents22;
newHSSELog.Num22 = updateHSSELog.Num22;
newHSSELog.Contents23 = updateHSSELog.Contents23;
newHSSELog.Num23 = updateHSSELog.Num23;
newHSSELog.Contents24 = updateHSSELog.Contents24;
newHSSELog.Num24 = updateHSSELog.Num24;
newHSSELog.Contents25 = updateHSSELog.Contents25;
newHSSELog.Num25 = updateHSSELog.Num25;
newHSSELog.Contents26 = updateHSSELog.Contents26;
newHSSELog.Num26 = updateHSSELog.Num26;
newHSSELog.Contents27 = updateHSSELog.Contents27;
newHSSELog.Num27 = updateHSSELog.Num27;
newHSSELog.Contents28 = updateHSSELog.Contents28;
newHSSELog.Num28 = updateHSSELog.Num28;
newHSSELog.Contents29 = updateHSSELog.Contents29;
newHSSELog.Num29 = updateHSSELog.Num29;
newHSSELog.Contents210 = updateHSSELog.Contents210;
newHSSELog.Num210 = updateHSSELog.Num210;
newHSSELog.Num211 = updateHSSELog.Num211;
newHSSELog.Contents31 = updateHSSELog.Contents31;
newHSSELog.Num31 = updateHSSELog.Num31;
newHSSELog.Contents32 = updateHSSELog.Contents32;
newHSSELog.Num32 = updateHSSELog.Num32;
newHSSELog.Contents33 = updateHSSELog.Contents33;
newHSSELog.Num33 = updateHSSELog.Num33;
newHSSELog.Contents34 = updateHSSELog.Contents34;
newHSSELog.Num34 = updateHSSELog.Num34;
newHSSELog.Contents41 = updateHSSELog.Contents41;
newHSSELog.Contents42 = updateHSSELog.Contents42;
newHSSELog.Contents43 = updateHSSELog.Contents43;
newHSSELog.Contents51 = updateHSSELog.Contents51;
newHSSELog.Contents52 = updateHSSELog.Contents52;
Funs.DB.SubmitChanges();
Model.Manager_HSSELog newHSSELog =db.Manager_HSSELog.FirstOrDefault(e => e.HSSELogId == updateHSSELog.HSSELogId);
if (newHSSELog != null)
{
newHSSELog.CompileDate = updateHSSELog.CompileDate;
newHSSELog.CompileMan = updateHSSELog.CompileMan;
newHSSELog.Weather = updateHSSELog.Weather;
newHSSELog.IsVisible = updateHSSELog.IsVisible;
newHSSELog.Num11 = updateHSSELog.Num11;
newHSSELog.Contents12 = updateHSSELog.Contents12;
newHSSELog.Contents13 = updateHSSELog.Contents13;
newHSSELog.Contents21 = updateHSSELog.Contents21;
newHSSELog.Num21 = updateHSSELog.Num21;
newHSSELog.Contents22 = updateHSSELog.Contents22;
newHSSELog.Num22 = updateHSSELog.Num22;
newHSSELog.Contents23 = updateHSSELog.Contents23;
newHSSELog.Num23 = updateHSSELog.Num23;
newHSSELog.Contents24 = updateHSSELog.Contents24;
newHSSELog.Num24 = updateHSSELog.Num24;
newHSSELog.Contents25 = updateHSSELog.Contents25;
newHSSELog.Num25 = updateHSSELog.Num25;
newHSSELog.Contents26 = updateHSSELog.Contents26;
newHSSELog.Num26 = updateHSSELog.Num26;
newHSSELog.Contents27 = updateHSSELog.Contents27;
newHSSELog.Num27 = updateHSSELog.Num27;
newHSSELog.Contents28 = updateHSSELog.Contents28;
newHSSELog.Num28 = updateHSSELog.Num28;
newHSSELog.Contents29 = updateHSSELog.Contents29;
newHSSELog.Num29 = updateHSSELog.Num29;
newHSSELog.Contents210 = updateHSSELog.Contents210;
newHSSELog.Num210 = updateHSSELog.Num210;
newHSSELog.Num211 = updateHSSELog.Num211;
newHSSELog.Contents31 = updateHSSELog.Contents31;
newHSSELog.Num31 = updateHSSELog.Num31;
newHSSELog.Contents32 = updateHSSELog.Contents32;
newHSSELog.Num32 = updateHSSELog.Num32;
newHSSELog.Contents33 = updateHSSELog.Contents33;
newHSSELog.Num33 = updateHSSELog.Num33;
newHSSELog.Contents34 = updateHSSELog.Contents34;
newHSSELog.Num34 = updateHSSELog.Num34;
newHSSELog.Contents41 = updateHSSELog.Contents41;
newHSSELog.Contents42 = updateHSSELog.Contents42;
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>
public static void InsertPersonInOutNowNow(Model.SitePerson_PersonInOutNow PersonInOut)
{
Model.SGGLDB db = Funs.DB;
var getNow = db.SitePerson_PersonInOutNow.FirstOrDefault(x => x.PersonInOutId == PersonInOut.PersonInOutId);
if (getNow == null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
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,
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.SitePerson_PersonInOutNow newPersonInOut = new Model.SitePerson_PersonInOutNow
{
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,
ProjectId = newPersonInOut.ProjectId,
UnitId = newPersonInOut.UnitId,
PersonId = newPersonInOut.PersonId,
IsIn = newPersonInOut.IsIn,
ChangeTime = newPersonInOut.ChangeTime,
WorkPostId = newPersonInOut.WorkPostId,
PostType = newPersonInOut.PostType,
ProCode = newPersonInOut.ProCode,
Name = newPersonInOut.Name,
IdcardType = newPersonInOut.IdcardType ?? "SHENFEN_ZHENGJIAN",
IdcardNumber = newPersonInOut.IdcardNumber,
CheckType = "ZHENGCHANG_KAOQINLEIBIE",
CheckWay = "FACE_FANGSHI",
};
db.RealName_PersonInOutNow.InsertOnSubmit(newR);
db.SubmitChanges();
Model.RealName_PersonInOutNow newR = new Model.RealName_PersonInOutNow
{
PersonInOutId = newPersonInOut.PersonInOutId,
ProjectId = newPersonInOut.ProjectId,
UnitId = newPersonInOut.UnitId,
PersonId = newPersonInOut.PersonId,
IsIn = newPersonInOut.IsIn,
ChangeTime = newPersonInOut.ChangeTime,
WorkPostId = newPersonInOut.WorkPostId,
PostType = newPersonInOut.PostType,
ProCode = newPersonInOut.ProCode,
Name = newPersonInOut.Name,
IdcardType = newPersonInOut.IdcardType ?? "SHENFEN_ZHENGJIAN",
IdcardNumber = newPersonInOut.IdcardNumber,
CheckType = "ZHENGCHANG_KAOQINLEIBIE",
CheckWay = "FACE_FANGSHI",
};
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>
@ -109,18 +102,20 @@ namespace BLL
/// <param name="personId"></param>
public static void DeletePersonInOutByPersonId(string personId)
{
Model.SGGLDB db = Funs.DB;
var personInOut = from x in db.SitePerson_PersonInOut where x.PersonId == personId select x;
if (personInOut.Count() > 0)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.SitePerson_PersonInOut.DeleteAllOnSubmit(personInOut);
db.SubmitChanges();
}
var rpersonInOut = from x in db.RealName_PersonInOutNow where x.PersonId == personId select x;
if (rpersonInOut.Count() > 0)
{
db.RealName_PersonInOutNow.DeleteAllOnSubmit(rpersonInOut);
db.SubmitChanges();
var personInOut = from x in db.SitePerson_PersonInOut where x.PersonId == personId select x;
if (personInOut.Count() > 0)
{
db.SitePerson_PersonInOut.DeleteAllOnSubmit(personInOut);
db.SubmitChanges();
}
var rpersonInOut = from x in db.RealName_PersonInOutNow where x.PersonId == personId select x;
if (rpersonInOut.Count() > 0)
{
db.RealName_PersonInOutNow.DeleteAllOnSubmit(rpersonInOut);
db.SubmitChanges();
}
}
}
@ -130,16 +125,18 @@ namespace BLL
/// <param name="personId"></param>
public static void UpdateRealNameInOut(string personId, string oldCardNo, string newIdCardNo)
{
Model.SGGLDB db = Funs.DB;
var personInOuts = from x in db.RealName_PersonInOutNow
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var personInOuts = from x in db.RealName_PersonInOutNow
where x.PersonId == personId && x.IdcardNumber == oldCardNo
select x;
if (personInOuts.Count() > 0)
{
foreach (var item in personInOuts)
if (personInOuts.Count() > 0)
{
item.IdcardNumber = newIdCardNo;
db.SubmitChanges();
foreach (var item in personInOuts)
{
item.IdcardNumber = newIdCardNo;
db.SubmitChanges();
}
}
}
}

View File

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

View File

@ -280,80 +280,97 @@ namespace BLL
{
try
{
/// 清理出入记录
var getRecords = from x in Funs.DB.T_d_facerecord where x.DateTimeRecord.Value.AddDays(1) < DateTime.Now select x;
if (getRecords.Count() > 0)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
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
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)
if (item.InOrOut == "进门")
{
Funs.DB.T_d_facerecord.DeleteAllOnSubmit(getDelRecordsIn);
Funs.DB.SubmitChanges();
var getDelRecordsIn = from x in 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 (getDelRecordsIn.Count() > 0)
{
db.T_d_facerecord.DeleteAllOnSubmit(getDelRecordsIn);
db.SubmitChanges();
}
}
}
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)
else
{
Funs.DB.T_d_facerecord.DeleteAllOnSubmit(getDelRecordsOut);
Funs.DB.SubmitChanges();
var getDelRecordsOut = from x in 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)
{
db.T_d_facerecord.DeleteAllOnSubmit(getDelRecordsOut);
db.SubmitChanges();
}
}
}
}
}
var getVRecords = from x in Funs.DB.T_d_validcardevent
where x.RecordDateTime.Value.AddDays(1) < DateTime.Now
select x;
if (getVRecords.Count() > 0)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
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
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)
if (item.InOrOut == 1)
{
Funs.DB.T_d_validcardevent.DeleteAllOnSubmit(getDelVRecordsIn);
Funs.DB.SubmitChanges();
var getDelVRecordsIn = from x in 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 (getDelVRecordsIn.Count() > 0)
{
db.T_d_validcardevent.DeleteAllOnSubmit(getDelVRecordsIn);
db.SubmitChanges();
}
}
}
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)
else
{
Funs.DB.T_d_validcardevent.DeleteAllOnSubmit(getDelVRecordsOut);
Funs.DB.SubmitChanges();
var getDelVRecordsOut = from x in 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)
{
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>
protected void btnGet_Click(object sender, EventArgs e)
{
Model.SGGLDB db = Funs.DB;
var HJGL_FL_TotalQuantitys = from x in db.HJGL_FL_TotalQuantity where x.ProjectId == this.CurrUser.LoginProjectId select x;
var HJGL_FL_TotalQuantitys = from x in Funs.DB.HJGL_FL_TotalQuantity where x.ProjectId == this.CurrUser.LoginProjectId select x;
if (HJGL_FL_TotalQuantitys.Count() > 0)
{
db.HJGL_FL_TotalQuantity.DeleteAllOnSubmit(HJGL_FL_TotalQuantitys);
db.SubmitChanges();
Funs.DB.HJGL_FL_TotalQuantity.DeleteAllOnSubmit(HJGL_FL_TotalQuantitys);
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))
{
//项目管道焊接工程量
@ -60,8 +59,8 @@ namespace FineUIPro.Web.HJGL.FL
tq.Unit = item1["unitName"].ToString();
tq.TotalWeldQuantity = item1["totalWeldingAmount"].ToString();
tq.TotalCompleted = item1["finishedAmount"].ToString();
db.HJGL_FL_TotalQuantity.InsertOnSubmit(tq);
db.SubmitChanges();
Funs.DB.HJGL_FL_TotalQuantity.InsertOnSubmit(tq);
Funs.DB.SubmitChanges();
}
ShowNotify("获取成功!", MessageBoxIcon.Success);
}
@ -83,7 +82,7 @@ namespace FineUIPro.Web.HJGL.FL
from dbo.HJGL_FL_TotalQuantity c
where c.ProjectId=@ProjectId order by c.DeviceName,DeviceCode ";
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();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;

View File

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

View File

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

View File

@ -188,15 +188,20 @@ namespace WebAPI.Controllers
db.SubmitChanges();
///// 根据出入记录 写入考勤记录
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;
if (facerecord.InOrOut == "进门")
DoorServerService.InsertEmployInOutRecord(facerecord, getPerson);
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,
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;
if (validcardevent.InOrOut == 1)
DoorServerService.InsertEmployInOutRecord(newFacerecord, getPerson);
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;
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
{

View File

@ -224,6 +224,14 @@ namespace WebAPI.Controllers
TestPlanId = getTestPlan.TestPlanId,
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);
responeData.code = 3;
responeData.message = "您已加入考试计划!";

View File

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

View File

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