|
|
|
@ -30,6 +30,7 @@ namespace SlnMesnac.WPF.ViewModel
|
|
|
|
|
public class EmployeeLoginViewModel : INotifyPropertyChanged
|
|
|
|
|
{
|
|
|
|
|
private readonly ILogger<EmployeeLoginViewModel> _logger;
|
|
|
|
|
private readonly DatabaseHandleBusniess _databaseHandleBusniess;
|
|
|
|
|
private readonly RfidHandleBusniess _rfidHandleBusniess;
|
|
|
|
|
private IBaseStaffService baseStaffService;
|
|
|
|
|
private IRecordStaffAttendanceService _recordStaffAttendanceService;
|
|
|
|
@ -261,6 +262,7 @@ namespace SlnMesnac.WPF.ViewModel
|
|
|
|
|
baseStaffService = App.ServiceProvider.GetService<IBaseStaffService>();
|
|
|
|
|
_recordStaffAttendanceService = App.ServiceProvider.GetService<IRecordStaffAttendanceService>();
|
|
|
|
|
_recordStaffCommuteService = App.ServiceProvider.GetService<IRecordStaffCommuteService>();
|
|
|
|
|
_databaseHandleBusniess = App.ServiceProvider.GetService<DatabaseHandleBusniess>();
|
|
|
|
|
_rfidHandleBusniess = App.ServiceProvider.GetService<RfidHandleBusniess>();
|
|
|
|
|
IConfigurationBuilder configurationBuilder = new ConfigurationBuilder()
|
|
|
|
|
.SetBasePath(System.AppContext.BaseDirectory)
|
|
|
|
@ -318,7 +320,7 @@ namespace SlnMesnac.WPF.ViewModel
|
|
|
|
|
if (RemoveConfirmViewModel.times == 1)
|
|
|
|
|
{
|
|
|
|
|
var theUser = baseStaffService.GetStaffInfoByStaffId(staffId);
|
|
|
|
|
_rfidHandleBusniess.HandleAndInsertRemove(theUser, 2);
|
|
|
|
|
_rfidHandleBusniess.HandleAndInsertRemove(theUser, 2);//在打卡记录表里记录强退
|
|
|
|
|
var list = _rfidHandleBusniess.HandleAndInsertStaffRealTime(theUser, 2);
|
|
|
|
|
if (list.Count>=0)
|
|
|
|
|
{
|
|
|
|
@ -366,33 +368,7 @@ namespace SlnMesnac.WPF.ViewModel
|
|
|
|
|
RecordStaffAttendance recordStaffAttendance = _recordStaffAttendanceService.GetRecordStaffAttendanceByStaffId(user.StaffId, RfidHandleBusniess.stationCode);
|
|
|
|
|
if (recordStaffAttendance != null)
|
|
|
|
|
{
|
|
|
|
|
var createTime = recordStaffAttendance.CreateTime;
|
|
|
|
|
var nowTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
TimeSpan timeDiff = DateTime.Parse(nowTime) - DateTime.Parse(createTime);
|
|
|
|
|
if (timeDiff.TotalHours >= 10)//
|
|
|
|
|
{
|
|
|
|
|
if (recordStaffAttendance.AttendanceType == "1") //下班卡
|
|
|
|
|
{
|
|
|
|
|
if (recordStaffAttendance.AttendanceType == status.ToString() || recordStaffAttendance.AttendanceType == "2")
|
|
|
|
|
{
|
|
|
|
|
StatusText = "未打上班卡,请联系管理员!";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (recordStaffAttendance.AttendanceType == "0")
|
|
|
|
|
{
|
|
|
|
|
if (recordStaffAttendance.AttendanceType == status.ToString())
|
|
|
|
|
{
|
|
|
|
|
StatusText = "未打下班卡,请联系管理员!";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
StaffIdText = user.StaffId;
|
|
|
|
|
CheckStatus = user.StaffName + " " + user.TeamCode + " 打卡成功!";
|
|
|
|
|
_rfidHandleBusniess.HandleAndInsertStaffAttendance(user, isCheckOn);
|
|
|
|
|
ShowStaffAttendances(user, isCheckOn);
|
|
|
|
|
_rfidHandleBusniess.HandleStaffCommute(user, isCheckOn);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//判断与上次打卡类型是否重复(主要为上班)
|
|
|
|
|
if (recordStaffAttendance.AttendanceType != status.ToString())
|
|
|
|
|
{
|
|
|
|
|
StaffIdText = user.StaffId;
|
|
|
|
@ -405,7 +381,46 @@ namespace SlnMesnac.WPF.ViewModel
|
|
|
|
|
{
|
|
|
|
|
StatusText = "请勿重复打卡!";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//var createTime = recordStaffAttendance.CreateTime;
|
|
|
|
|
//var nowTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
//TimeSpan timeDiff = DateTime.Parse(nowTime) - DateTime.Parse(createTime);
|
|
|
|
|
//if (timeDiff.TotalHours >= 10)//
|
|
|
|
|
//{
|
|
|
|
|
// if (recordStaffAttendance.AttendanceType == "1") //下班卡
|
|
|
|
|
// {
|
|
|
|
|
// if (recordStaffAttendance.AttendanceType == status.ToString() || recordStaffAttendance.AttendanceType == "2")
|
|
|
|
|
// {
|
|
|
|
|
// StatusText = "未打上班卡,请联系管理员!";
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// else if (recordStaffAttendance.AttendanceType == "0")
|
|
|
|
|
// {
|
|
|
|
|
// if (recordStaffAttendance.AttendanceType == status.ToString())
|
|
|
|
|
// {
|
|
|
|
|
// StatusText = "未打下班卡,请联系管理员!";
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// StaffIdText = user.StaffId;
|
|
|
|
|
// CheckStatus = user.StaffName + " " + user.TeamCode + " 打卡成功!";
|
|
|
|
|
// _rfidHandleBusniess.HandleAndInsertStaffAttendance(user, isCheckOn);
|
|
|
|
|
// ShowStaffAttendances(user, isCheckOn);
|
|
|
|
|
// _rfidHandleBusniess.HandleStaffCommute(user, isCheckOn);
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// if (recordStaffAttendance.AttendanceType != status.ToString())
|
|
|
|
|
// {
|
|
|
|
|
// StaffIdText = user.StaffId;
|
|
|
|
|
// CheckStatus = user.StaffName + " " + user.TeamCode + " 打卡成功!";
|
|
|
|
|
// _rfidHandleBusniess.HandleAndInsertStaffAttendance(user, isCheckOn);
|
|
|
|
|
// ShowStaffAttendances(user, isCheckOn);
|
|
|
|
|
// _rfidHandleBusniess.HandleStaffCommute(user, isCheckOn);
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// StatusText = "请勿重复打卡!";
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|