This commit is contained in:
2026-01-15 13:18:03 +08:00
parent 4cf26d85e9
commit a5a8b130e5
+46 -32
View File
@@ -198,22 +198,29 @@ namespace BLL
{ {
for (int i = 0; i < j2.data.Count; i++) for (int i = 0; i < j2.data.Count; i++)
{ {
var msg = JsonConvert.DeserializeObject(j2.data[i]["content"].ToString()); try
if (!string.IsNullOrEmpty(Convert.ToString(msg.employeeNo)))
{ {
string deviceSerial = Convert.ToString(msg.deviceSerial); var msg = JsonConvert.DeserializeObject(j2.data[i]["content"].ToString());
string employeeNo = Convert.ToString(msg.employeeNo); if (!string.IsNullOrEmpty(Convert.ToString(msg.employeeNo)))
DateTime dateTime = Convert.ToDateTime(Convert.ToString(msg.dateTime));
var devices = db.Project_Devices.FirstOrDefault(x => x.DeviceSerial == deviceSerial);
Model.SitePerson_PersonInOut newInOut = new Model.SitePerson_PersonInOut
{ {
ProjectId = devices.ProjectId, string deviceSerial = Convert.ToString(msg.deviceSerial);
IdentityCard = employeeNo, string employeeNo = Convert.ToString(msg.employeeNo);
IsIn = true, DateTime dateTime = Convert.ToDateTime(Convert.ToString(msg.dateTime));
ChangeTime = dateTime, var devices = db.Project_Devices.FirstOrDefault(x => x.DeviceSerial == deviceSerial);
InOutWay = Const.InOutWay_1, Model.SitePerson_PersonInOut newInOut = new Model.SitePerson_PersonInOut
}; {
InsertInOut(newInOut); ProjectId = devices.ProjectId,
IdentityCard = employeeNo,
IsIn = true,
ChangeTime = dateTime,
InOutWay = Const.InOutWay_1,
};
InsertInOut(newInOut);
}
}
catch (Exception e)
{
ErrLogInfo.WriteLog(e.StackTrace);
} }
} }
@@ -235,29 +242,36 @@ namespace BLL
{ {
for (int i = 0; i < j2.data.Count; i++) for (int i = 0; i < j2.data.Count; i++)
{ {
var msg = JsonConvert.DeserializeObject(j2.data[i]["content"].ToString()); try
if (!string.IsNullOrEmpty(Convert.ToString(msg.employeeNo)))
{ {
string deviceSerial = Convert.ToString(msg.deviceSerial); var msg = JsonConvert.DeserializeObject(j2.data[i]["content"].ToString());
string employeeNo = Convert.ToString(msg.employeeNo); if (!string.IsNullOrEmpty(Convert.ToString(msg.employeeNo)))
DateTime dateTime = Convert.ToDateTime(Convert.ToString(msg.dateTime));
var devices = Funs.DB.Project_Devices.FirstOrDefault(x => x.DeviceSerial == deviceSerial);
//身份证号时
if (employeeNo.Length == 18)
{ {
Model.SitePerson_PersonInOut newInOut = new Model.SitePerson_PersonInOut string deviceSerial = Convert.ToString(msg.deviceSerial);
{ string employeeNo = Convert.ToString(msg.employeeNo);
ProjectId = devices.ProjectId, DateTime dateTime = Convert.ToDateTime(Convert.ToString(msg.dateTime));
IdentityCard = employeeNo,
IsIn = true,
ChangeTime = dateTime,
InOutWay = Const.InOutWay_1,
};
InsertInOut(newInOut);
var devices = Funs.DB.Project_Devices.FirstOrDefault(x => x.DeviceSerial == deviceSerial);
//身份证号时
// if (employeeNo.Length == 18)
{
Model.SitePerson_PersonInOut newInOut = new Model.SitePerson_PersonInOut
{
ProjectId = devices.ProjectId,
IdentityCard = employeeNo,
IsIn = true,
ChangeTime = dateTime,
InOutWay = Const.InOutWay_1,
};
InsertInOut(newInOut);
}
} }
} }
catch (Exception e)
{
ErrLogInfo.WriteLog(e.StackTrace);
}
} }
//提交偏移量 //提交偏移量