20221119优化出入经历

This commit is contained in:
2022-11-19 16:17:11 +08:00
parent 940df6ea3d
commit db59f0641b
3 changed files with 35 additions and 80 deletions
@@ -192,18 +192,13 @@ namespace BLL
newitem.PersonName = getPerson.PersonName; newitem.PersonName = getPerson.PersonName;
newitem.IdentityCard = getPerson.IdentityCard; newitem.IdentityCard = getPerson.IdentityCard;
} }
var getPersonItem = db.SitePerson_PersonItem.FirstOrDefault(x => x.PersonId == getPerson.PersonId && x.InTime <= newitem.InTime && x.OutTime > newitem.InTime); var getPersonItem = db.SitePerson_PersonItem.FirstOrDefault(x => x.PersonId == getPerson.PersonId
&& x.InTime <= newitem.InTime && (x.OutTime > newitem.InTime || !x.OutTime.HasValue));
if (getPersonItem != null) if (getPersonItem != null)
{ {
if (newitem.OutTime.HasValue) getPersonItem.OutTime = null;
{
if ((getPersonItem.OutTime.HasValue && newitem.OutTime > getPersonItem.OutTime) || !getPersonItem.OutTime.HasValue)
{
getPersonItem.OutTime = newitem.OutTime.Value;
db.SubmitChanges(); db.SubmitChanges();
} }
}
}
else else
{ {
Model.SitePerson_PersonItem newPersonItem = new Model.SitePerson_PersonItem Model.SitePerson_PersonItem newPersonItem = new Model.SitePerson_PersonItem
@@ -213,8 +208,8 @@ namespace BLL
PersonName = newitem.PersonName, PersonName = newitem.PersonName,
IdentityCard = newitem.IdentityCard, IdentityCard = newitem.IdentityCard,
InTime = newitem.InTime, InTime = newitem.InTime,
OutTime = newitem.OutTime, // OutTime = newitem.OutTime,
OutResult = newitem.OutResult, // OutResult = newitem.OutResult,
}; };
if (!string.IsNullOrEmpty(newitem.ProjectId)) if (!string.IsNullOrEmpty(newitem.ProjectId))
{ {
-40
View File
@@ -1,40 +0,0 @@
错误信息开始=====>
错误类型:NullReferenceException
错误信息:未将对象引用设置到对象的实例。
错误堆栈:
在 FineUIPro.Web.HJGL.WeldingManage.WeldingPlan.Page_Load(Object sender, EventArgs e) 位置 D:\诺必达\赛鼎\SGGL_SeDin\SGGL\FineUIPro.Web\HJGL\WeldingManage\WeldingPlan.aspx.cs:行号 18
在 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)
出错时间:11/16/2022 19:30:50
出错文件:http://localhost:14901/HJGL/WeldingManage/WeldingPlan.aspx
IP地址:::1
出错时间:11/16/2022 19:30:50
错误信息开始=====>
错误类型:FormatException
错误信息:该字符串未被识别为有效的 DateTime。
错误堆栈:
在 System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
在 System.Convert.ToDateTime(String value)
在 BLL.PipelineService.GetStateByPipelineId(String pipelineId) 位置 D:\诺必达\赛鼎\SGGL_SeDin\SGGL\BLL\HJGL\WeldingManage\PipelineService.cs:行号 75
在 FineUIPro.Web.HJGL.WeldingManage.WeldingPlan.btnUpDateState_Click(Object sender, EventArgs e)
在 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)
出错时间:11/16/2022 19:35:57
出错文件:http://localhost:14901/HJGL/WeldingManage/WeldingPlan.aspx
IP地址:::1
操作人员:JT
出错时间:11/16/2022 19:35:57
+29 -29
View File
@@ -273,37 +273,37 @@ namespace FineUIPro.Web.Person
} }
info = "操作完成,共处理人员按身份证设置年龄" + countRecod.ToString() + "条。"; info = "操作完成,共处理人员按身份证设置年龄" + countRecod.ToString() + "条。";
var getPPersons = (from x in Funs.DB.SitePerson_Person //var getPPersons = (from x in Funs.DB.SitePerson_Person
join y in Funs.DB.Person_Persons on x.PersonId equals y.PersonId // join y in Funs.DB.Person_Persons on x.PersonId equals y.PersonId
where x.States == Const.ProjectPersonStates_1 && y.CurrentProjectId == null // where x.States == Const.ProjectPersonStates_1 && y.CurrentProjectId == null
select x).Take(1000); // select x).Take(1000);
foreach (var pitem in getPPersons) //foreach (var pitem in getPPersons)
{ //{
SitePerson_PersonItemService.SetPersonItemInOut(pitem); // SitePerson_PersonItemService.SetPersonItemInOut(pitem);
pCountRecod++; // pCountRecod++;
} //}
if (pCountRecod == 0) //if (pCountRecod == 0)
{ //{
var getPPersons2 = (from x in Funs.DB.SitePerson_Person // var getPPersons2 = (from x in Funs.DB.SitePerson_Person
join y in Funs.DB.Person_Persons on x.PersonId equals y.PersonId // join y in Funs.DB.Person_Persons on x.PersonId equals y.PersonId
where x.States == Const.ProjectPersonStates_0 && y.CurrentProjectId == null // where x.States == Const.ProjectPersonStates_0 && y.CurrentProjectId == null
select x).Take(1000); // select x).Take(1000);
foreach (var pitem2 in getPPersons2) // foreach (var pitem2 in getPPersons2)
{ // {
var getPersons = Funs.DB.Person_Persons.FirstOrDefault(x => x.PersonId == pitem2.PersonId); // var getPersons = Funs.DB.Person_Persons.FirstOrDefault(x => x.PersonId == pitem2.PersonId);
if (getPersons != null) // if (getPersons != null)
{ // {
getPersons.CurrentProjectId = pitem2.ProjectId; // getPersons.CurrentProjectId = pitem2.ProjectId;
getPersons.CurrentProjectRoleId = pitem2.RoleIds; // getPersons.CurrentProjectRoleId = pitem2.RoleIds;
getPersons.CurrentProjectWorkPostId = pitem2.WorkPostId; // getPersons.CurrentProjectWorkPostId = pitem2.WorkPostId;
Funs.DB.SubmitChanges(); // Funs.DB.SubmitChanges();
} // }
pCountRecod++; // pCountRecod++;
} // }
} //}
info += "共处理人员所在当前项目取值" + pCountRecod.ToString() + "条。"; //info += "共处理人员所在当前项目取值" + pCountRecod.ToString() + "条。";
Alert.ShowInParent(info, MessageBoxIcon.Information); Alert.ShowInParent(info, MessageBoxIcon.Information);
} }
} }