This commit is contained in:
李超 2026-01-15 13:18:03 +08:00
parent 4cf26d85e9
commit a5a8b130e5
1 changed files with 46 additions and 32 deletions

View File

@ -198,22 +198,29 @@ namespace BLL
{
for (int i = 0; i < j2.data.Count; i++)
{
var msg = JsonConvert.DeserializeObject(j2.data[i]["content"].ToString());
if (!string.IsNullOrEmpty(Convert.ToString(msg.employeeNo)))
try
{
string deviceSerial = Convert.ToString(msg.deviceSerial);
string employeeNo = 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
var msg = JsonConvert.DeserializeObject(j2.data[i]["content"].ToString());
if (!string.IsNullOrEmpty(Convert.ToString(msg.employeeNo)))
{
ProjectId = devices.ProjectId,
IdentityCard = employeeNo,
IsIn = true,
ChangeTime = dateTime,
InOutWay = Const.InOutWay_1,
};
InsertInOut(newInOut);
string deviceSerial = Convert.ToString(msg.deviceSerial);
string employeeNo = 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,
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++)
{
var msg = JsonConvert.DeserializeObject(j2.data[i]["content"].ToString());
if (!string.IsNullOrEmpty(Convert.ToString(msg.employeeNo)))
try
{
string deviceSerial = Convert.ToString(msg.deviceSerial);
string employeeNo = 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)
var msg = JsonConvert.DeserializeObject(j2.data[i]["content"].ToString());
if (!string.IsNullOrEmpty(Convert.ToString(msg.employeeNo)))
{
Model.SitePerson_PersonInOut newInOut = new Model.SitePerson_PersonInOut
{
ProjectId = devices.ProjectId,
IdentityCard = employeeNo,
IsIn = true,
ChangeTime = dateTime,
InOutWay = Const.InOutWay_1,
};
InsertInOut(newInOut);
string deviceSerial = Convert.ToString(msg.deviceSerial);
string employeeNo = 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
{
ProjectId = devices.ProjectId,
IdentityCard = employeeNo,
IsIn = true,
ChangeTime = dateTime,
InOutWay = Const.InOutWay_1,
};
InsertInOut(newInOut);
}
}
}
catch (Exception e)
{
ErrLogInfo.WriteLog(e.StackTrace);
}
}
//提交偏移量