This commit is contained in:
杨红卫 2021-06-30 16:00:32 +08:00
parent 8bc3189f9f
commit 957d206c2b
8 changed files with 209 additions and 13 deletions

View File

@ -33,8 +33,8 @@ namespace FineUIPro.Web.Door
}
Funs.DropDownPageSize(this.ddlPageSize);
UnitService.InitUnitDropDownList(this.drpUnit, this.ProjectId, true);
this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd HH:mm}", DateTime.Now);
this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd HH:mm}", DateTime.Now.AddDays(1));
this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd HH:mm}", DateTime.Now.AddDays(-1));
this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd HH:mm}", DateTime.Now);
if (this.CurrUser != null && this.CurrUser.PageSize.HasValue)
{
Grid1.PageSize = this.CurrUser.PageSize.Value;

View File

@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Model
{
/// <summary>
/// 项目出入记录-潮州华赢
/// </summary>
public class attendanceItem
{
/// <summary>
/// ID
/// </summary>
public string ProjectId
{
get;
set;
}
/// <summary>
/// 设备序列号
/// </summary>
public string deviceSn
{
get;
set;
}
/// <summary>
/// 证件号码
/// </summary>
public string idCardNumber
{
get;
set;
}
/// <summary>
/// 考勤时间
/// </summary>
public string attendanceTime
{
get;
set;
}
/// <summary>
/// 打卡类型(0:无效,1:进门,2出门)
/// </summary>
public int attendanceType
{
get;
set;
}
/// <summary>
/// 考勤照片
/// </summary>
public string attendanceImage
{
get;
set;
}
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Model
{
/// <summary>
/// 项目出入记录-潮州华赢
/// </summary>
public class attendanceItems
{
/// <summary>
/// ID
/// </summary>
public List<attendanceItem> records
{
get;
set;
}
}
}

View File

@ -156,6 +156,8 @@
<Compile Include="CQMS\PassWelderStatisc.cs" />
<Compile Include="CQMS\SteelItem.cs" />
<Compile Include="CQMS\WelderItem.cs" />
<Compile Include="DoorServer\attendanceItems.cs" />
<Compile Include="DoorServer\attendanceItem.cs" />
<Compile Include="DoorServer\AbsenceDutyItem.cs" />
<Compile Include="DoorServer\InOutListItem.cs" />
<Compile Include="DoorServer\t_d_departmentItem.cs" />

View File

@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using BLL;
using WebAPI.Filter;
namespace WebAPI.Controllers
{
/// <summary>
///
/// </summary>
public class uploadController : ApiController
{
#region
/// <summary>
/// 保存出入记录信息
/// </summary>
/// <param name="records">出入记录信息</param>
/// <returns></returns>
[HttpPost]
public Model.ResponeData attendance([FromBody] Model.attendanceItems records)
{
var responeData = new Model.ResponeData();
try
{
if (records != null && records.records.Count() > 0)
{
List<Model.attendanceItem> attendanceItems = records.records;
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
string projectId = "310e790e-5ede-4345-98a4-8bd0866e69ef"; ////潮州华瀛
int maxId = 0;
var getmax = db.T_d_facerecord.Where(x => x.ProjectId == projectId && x.RoleID == "白名单").Select(x => x.ID);
if (getmax.Count() > 0)
{
maxId = getmax.Max() + 1;
}
foreach (var item in attendanceItems)
{
string name = string.Empty;
string cardNo = string.Empty;
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == item.idCardNumber);
if (getPerson != null)
{
name = getPerson.PersonName;
cardNo = getPerson.CardNo;
}
Model.T_d_facerecord newFacerecord = new Model.T_d_facerecord()
{
NewID = SQLHelper.GetNewID(),
ProjectId = projectId,
ID = maxId + 1,
EmployName = name,
EmployNO = item.idCardNumber,
RoleID = "白名单",
DateTimeRecord = Funs.GetNewDateTime(item.attendanceTime),
RecordDes = "白名单:允许通行",
InOrOut = (item.attendanceType == 1 ? "进门" : "出门"),
};
db.T_d_facerecord.InsertOnSubmit(newFacerecord);
db.SubmitChanges();
///// 根据出入记录 写入考勤记录
Model.t_d_facerecordItem facerecord = new Model.t_d_facerecordItem
{
ID = maxId + 1,
EmployName = name,
IDCardNo = item.idCardNumber,
EmployNO = item.idCardNumber,
ProjectId = projectId,
RoleID = "白名单",
DateTimeRecord = Funs.GetNewDateTime(item.attendanceTime),
RecordDes = "白名单:允许通行",
InOrOut = (item.attendanceType == 1 ? "进门" : "出门"),
};
DoorServerService.InsertEmployInOutRecord(facerecord);
if (facerecord.DateTimeRecord.HasValue)
{
int isIn = 0;
if (facerecord.InOrOut == "进门")
{
isIn = 1;
}
APIPersonService.getPersonInOut(facerecord.ProjectId, facerecord.EmployNO, isIn, facerecord.DateTimeRecord.Value);
}
}
responeData.code = 0;
}
}
else
{
responeData.message ="数据为空!";
}
}
catch (Exception ex)
{
responeData.code = -1;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
}
}

View File

@ -59,7 +59,7 @@ namespace WebAPI.Controllers
return ("$" + DepartmentID.ToString() + "$" + EmployID.ToString() + "$" + ID.ToString() + "$" + ValidEventID.ToString() + "$");
}
#endregion
#region
/// <summary>
/// 保存部门信息
@ -76,7 +76,7 @@ namespace WebAPI.Controllers
{
if (department != null)
{
var getDep = db.T_d_department.FirstOrDefault(x => x.DepartmentID == department.DepartmentID && x.ProjectId ==department.ProjectId);
var getDep = db.T_d_department.FirstOrDefault(x => x.DepartmentID == department.DepartmentID && x.ProjectId == department.ProjectId);
if (getDep == null)
{
Model.T_d_department newDep = new Model.T_d_department()
@ -128,7 +128,7 @@ namespace WebAPI.Controllers
{
if (employinfo != null)
{
var getEm = db.T_d_employinfo.FirstOrDefault(x => x.EmployID == employinfo.EmployID && x.ProjectId ==employinfo.ProjectId);
var getEm = db.T_d_employinfo.FirstOrDefault(x => x.EmployID == employinfo.EmployID && x.ProjectId == employinfo.ProjectId);
if (getEm == null)
{
Model.T_d_employinfo newEmploy = new Model.T_d_employinfo()
@ -181,11 +181,11 @@ namespace WebAPI.Controllers
{
if (getDep.ParentID == 0)
{
newEmploy.InstallationId = getDep.DepartmentID;
newEmploy.InstallationId = getDep.DepartmentID;
}
else
{
var getDep0 =BLL.DoorServerService.GetSupDep(newEmploy.ProjectId, getDep.ParentID, 0);
var getDep0 = BLL.DoorServerService.GetSupDep(newEmploy.ProjectId, getDep.ParentID, 0);
if (getDep0 != null)
{
newEmploy.UnitId = newEmploy.GroupID;
@ -237,7 +237,7 @@ namespace WebAPI.Controllers
{
if (facerecord != null)
{
var getFacerecord = db.T_d_facerecord.FirstOrDefault(x => x.ID == facerecord.ID && x.ProjectId == facerecord.ProjectId && x.RoleID ==facerecord.RoleID);
var getFacerecord = db.T_d_facerecord.FirstOrDefault(x => x.ID == facerecord.ID && x.ProjectId == facerecord.ProjectId && x.RoleID == facerecord.RoleID);
if (getFacerecord == null)
{
Model.T_d_facerecord newFacerecord = new Model.T_d_facerecord()
@ -444,7 +444,7 @@ namespace WebAPI.Controllers
{
string unitId = null;
string postId = null;
responeData.data = Funs.DB.spInOutManHoursReport(projectId, unitId, postId, startDate, endDate).ToList();
responeData.data = Funs.DB.spInOutManHoursReport(projectId, unitId, postId, startDate, endDate).ToList();
}
catch (Exception ex)
{
@ -462,13 +462,13 @@ namespace WebAPI.Controllers
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <returns></returns>
public Model.ResponeData getUnitSumInOutstatistics(string projectId, string unitId,DateTime startDate, DateTime endDate)
public Model.ResponeData getUnitSumInOutstatistics(string projectId, string unitId, DateTime startDate, DateTime endDate)
{
var responeData = new Model.ResponeData();
try
{
string postId = null;
var getData= Funs.DB.spInOutManHoursReport(projectId, unitId, postId, startDate, endDate).ToList();
var getData = Funs.DB.spInOutManHoursReport(projectId, unitId, postId, startDate, endDate).ToList();
responeData.data = getData.Sum(x => x.ManCountSum);
}
catch (Exception ex)

View File

@ -779,7 +779,7 @@ namespace WebAPI.Controllers
var responeData = new Model.ResponeData();
try
{
responeData.data = from x in Funs.DB.SitePerson_Person_Bak
responeData.data = (from x in Funs.DB.SitePerson_Person_Bak
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
where x.ProjectId == projectId
&& !x.ExchangeTime.HasValue
@ -806,7 +806,7 @@ namespace WebAPI.Controllers
x.ExchangeTime,
x.ExchangeTime2,
x.PhotoUrl,
};
}).Take(200).ToList();
}
catch (Exception ex)
{

View File

@ -174,6 +174,7 @@
<Compile Include="Controllers\BaseInfoController.cs" />
<Compile Include="Controllers\CommonController.cs" />
<Compile Include="Controllers\CQMS\WBSController.cs" />
<Compile Include="Controllers\DoorProject\uploadController.cs" />
<Compile Include="Controllers\FaceController.cs" />
<Compile Include="Controllers\DoorServerController.cs" />
<Compile Include="Controllers\Person\PersonCheckController.cs" />