/// <summary> /// 查询等待记录 /// </summary> /// <param name="cardNo"></param> /// <param name="date"></param> /// <returns></returns> public List <WaitSeatLogInfo> QueryWaitSeatLogs(string cardNo, DateTime date) { //TODO:查询当天的等待记录 DateTime beginDate = DateTime.Parse(date.ToShortDateString() + " 0:0:0"); DateTime endDate = DateTime.Parse(date.ToShortDateString() + " 23:59:59"); List <WaitSeatLogInfo> waitLogs = T_SM_SeatWaiting.GetWaitSeatList(cardNo, null, beginDate.ToString(), endDate.ToString(), null); return(waitLogs); }
/// <summary> /// 开馆处理 /// </summary> /// <param name="readingRooms"></param> private void OpenReadingRoom(ReadingRoomInfo room) { DateTime nowDateTime = ServiceDateTime.Now; try { //获取昨天的进出记录 List <EnterOutLogInfo> eolList = T_SM_EnterOutLog.GetEnterOutLogByStatus(null, room.No, null, enterOutLogTypeList, LogStatus.Valid, "1900-1-1", ServiceDateTime.Now.ToShortDateString()); foreach (EnterOutLogInfo eol in eolList) { if ((eol.EnterOutState == EnterOutLogType.ShortLeave) && (eol.Flag == Operation.Admin || eol.Flag == Operation.OtherReader)) { //获取昨天的等待记录 List <WaitSeatLogInfo> wsllist = T_SM_SeatWaiting.GetWaitSeatList(null, eol.EnterOutLogID, null, null, new List <EnterOutLogType> { EnterOutLogType.Waiting }); if (wsllist.Count > 0) { wsllist[0].WaitingState = EnterOutLogType.WaitingCancel; wsllist[0].StatsChangeTime = nowDateTime; T_SM_SeatWaiting.UpdateWaitLog(wsllist[0]); } } eol.EnterOutState = EnterOutLogType.Leave; eol.EnterOutTime = nowDateTime; eol.Flag = Operation.Service; eol.Remark = string.Format("在{0},{1}号座位,闭馆释放座位", eol.ReadingRoomName, eol.SeatNo.Substring(eol.SeatNo.Length - room.Setting.SeatNumAmount)); int logdi = 0; EnterOutOperate.AddEnterOutLog(eol, ref logdi); WriteLog.Write(string.Format("监控服务:读者{0},{1}", eol.CardNo, eol.Remark)); } //预约记录处理 TimeSpan span = nowDateTime - DateTime.Parse("2010-1-1"); List <BespeakLogInfo> blilist = T_SM_SeatBespeak.GetBespeakList(null, room.No, nowDateTime.AddDays(-1), span.Days, new List <BookingStatus> { BookingStatus.Waiting }); if (blilist.Count <= 0) { return; } foreach (BespeakLogInfo bli in blilist.Where(bli => bli.BsepeakTime.Date < nowDateTime.Date)) { bli.CancelTime = bli.BsepeakTime.AddMinutes(int.Parse(room.Setting.SeatBespeak.ConfirmTime.EndTime)); bli.CancelPerson = Operation.Service; bli.BsepeakState = BookingStatus.Cencaled; bli.Remark = string.Format("读者,在{0},{1}号座位,预约,闭馆取消预约", bli.ReadingRoomName, bli.SeatNo.Substring(bli.SeatNo.Length - room.Setting.SeatNumAmount)); T_SM_SeatBespeak.UpdateBespeakList(bli); WriteLog.Write(string.Format("监控服务:读者{0},{1}", bli.CardNo, bli.Remark)); } } catch (Exception ex) { WriteLog.Write(string.Format("监控服务:执行开馆处理遇到错误:{0}", ex.Message)); } }
/// <summary> /// 暂离回来操作 /// </summary> public void CometoBack() { Clientobject.EnterOutLogData.EnterOutlog.EnterOutState = EnterOutLogType.ComeBack;//设置读者状态为暂回来 Clientobject.EnterOutLogData.EnterOutlog.TerminalNum = Clientobject.ClientSetting.ClientNo; TimeSpan shortleavetimelong = ServiceDateTime.Now - Clientobject.EnterOutLogData.EnterOutlog.EnterOutTime; Clientobject.EnterOutLogData.EnterOutlog.Remark = string.Format("在终端{0}刷卡暂离回来,暂离时长{1}分钟,继续使用{2} {3}号座位", Clientobject.ClientSetting.ClientNo, shortleavetimelong.Minutes, Clientobject.EnterOutLogData.EnterOutlog.ReadingRoomName, Clientobject.EnterOutLogData.EnterOutlog.ShortSeatNo); int newLogId = -1; PopupWindowsObject.GetInstance().Window.ShowMessage(EnterOutOperate.AddEnterOutLog(Clientobject.EnterOutLogData.EnterOutlog, ref newLogId) == HandleResult.Failed ? TipType.Exception : TipType.ComeToBack); if (Clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.NoManagement.Used) { List <WaitSeatLogInfo> waitSeatLogs = T_SM_SeatWaiting.GetWaitSeatList("", Clientobject.EnterOutLogData.EnterOutlog.EnterOutLogID, null, null, null); if (waitSeatLogs.Count > 0) { WaitSeatLogInfo waitSeatLog = waitSeatLogs[0]; waitSeatLog.NowState = LogStatus.Fail; waitSeatLog.OperateType = Operation.OtherReader; waitSeatLog.WaitingState = EnterOutLogType.WaitingCancel; T_SM_SeatWaiting.UpdateWaitLog(waitSeatLog); } } if (!Clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatUsedTimeLimit.Used) { return; } if (Clientobject.EnterOutLogData.Student.CanContinuedTime.AddMinutes(Clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatUsedTimeLimit.CanDelayTime) > ServiceDateTime.Now) { return; } if (Clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatUsedTimeLimit.ContinuedTimes == 0 || Clientobject.EnterOutLogData.Student.ContinuedTimeCount < Clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatUsedTimeLimit.ContinuedTimes) { Clientobject.EnterOutLogData.EnterOutlog.EnterOutState = EnterOutLogType.ContinuedTime; Clientobject.EnterOutLogData.EnterOutlog.Flag = Operation.Service; Clientobject.EnterOutLogData.EnterOutlog.TerminalNum = Clientobject.ClientSetting.ClientNo; Clientobject.EnterOutLogData.EnterOutlog.Remark = string.Format("在终端{0}刷卡暂离回来,暂离期间在座超时,系统自动延长{1} {2}号座位使用时间", Clientobject.ClientSetting.ClientNo, Clientobject.EnterOutLogData.Student.AtReadingRoom.Name, Clientobject.EnterOutLogData.EnterOutlog.ShortSeatNo); PopupWindowsObject.GetInstance().Window.ShowMessage(EnterOutOperate.AddEnterOutLog(Clientobject.EnterOutLogData.EnterOutlog, ref newLogId) == HandleResult.Successed ? TipType.AutoContinuedTime : TipType.Exception); } else { Clientobject.EnterOutLogData.EnterOutlog.EnterOutState = EnterOutLogType.Leave; Clientobject.EnterOutLogData.EnterOutlog.Flag = Operation.Service; Clientobject.EnterOutLogData.EnterOutlog.TerminalNum = Clientobject.ClientSetting.ClientNo; Clientobject.EnterOutLogData.EnterOutlog.Remark = string.Format("在终端{0}刷卡暂离回来,暂离期间在座超时,续时次数已用完,系统自动释放{1} {2}号座位", Clientobject.ClientSetting.ClientNo, Clientobject.EnterOutLogData.Student.AtReadingRoom.Name, Clientobject.EnterOutLogData.EnterOutlog.ShortSeatNo); PopupWindowsObject.GetInstance().Window.ShowMessage(EnterOutOperate.AddEnterOutLog(Clientobject.EnterOutLogData.EnterOutlog, ref newLogId) == HandleResult.Successed ? TipType.AutoContinuedTimeNoCount : TipType.Exception); } }
/// <summary> /// 闭馆处理 /// </summary> /// <param name="readingRooms"></param> private void CloseReadingRoom(ReadingRoomInfo room) { DateTime nowDateTime = ServiceDateTime.Now; //添加记录状态 try { //获取今天的进出记录 List <EnterOutLogInfo> eolList = T_SM_EnterOutLog.GetEnterOutLogByStatus(null, room.No, null, enterOutLogTypeList, LogStatus.Valid, nowDateTime.ToShortDateString(), null); foreach (EnterOutLogInfo eol in eolList) { if ((eol.EnterOutState == EnterOutLogType.ShortLeave) && (eol.Flag == Operation.Admin || eol.Flag == Operation.OtherReader)) { //获取今天的的等待记录 List <WaitSeatLogInfo> wsllist = T_SM_SeatWaiting.GetWaitSeatList(null, eol.EnterOutLogID, null, null, new List <EnterOutLogType> { EnterOutLogType.Waiting }); if (wsllist.Count > 0) { wsllist[0].WaitingState = EnterOutLogType.WaitingCancel; wsllist[0].StatsChangeTime = nowDateTime; T_SM_SeatWaiting.UpdateWaitLog(wsllist[0]); } } eol.EnterOutState = EnterOutLogType.Leave; eol.EnterOutTime = nowDateTime; eol.Flag = Operation.Service; eol.Remark = string.Format("在{0},{1}号座位,闭馆释放座位", eol.ReadingRoomName, eol.SeatNo.Substring(eol.SeatNo.Length - room.Setting.SeatNumAmount)); int logdi = 0; EnterOutOperate.AddEnterOutLog(eol, ref logdi); //PushMsgInfo msg = new PushMsgInfo(); //msg.Title = "您好,您的座位已被释放"; //msg.MsgType = MsgPushType.ToTime; //msg.StudentNum = eol.CardNo; //msg.Message = eol.Remark; //SeatManage.Bll.T_SM_ReaderNotice.SendPushMsg(msg); WriteLog.Write(string.Format("监控服务:读者{0},{1}", eol.CardNo, eol.Remark)); } } catch (Exception ex) { WriteLog.Write(string.Format("监控服务:执行闭馆处理遇到错误:{0}", ex.Message)); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["LoginId"] == null) { Response.Redirect("../Login.aspx"); } if (!IsPostBack) { BindReadingRoomList(Session[CookiesManager.LoginID].ToString()); GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value); } cmd = Request.Form["subCmd"]; if (cmd != null) { #region 座位相关操作 switch (cmd) { case "search": //查询座位 try { GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value); } catch { } break; case "ShortLeave": //设置暂离 try { string seatStr = hidSeatNo.Value; string[] noArr = seatStr.Split(','); string seatNo = ""; for (int i = 0; i < noArr.Length; i++) { seatNo = noArr[i].Trim(); EnterOutLogInfo enterOutLog = T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo); if (enterOutLog != null && enterOutLog.EnterOutState != EnterOutLogType.ShortLeave) { ReadingRoomInfo roomInfo = T_SM_ReadingRoom.GetSingleRoomInfo(enterOutLog.ReadingRoomNo); enterOutLog.EnterOutState = EnterOutLogType.ShortLeave; enterOutLog.Flag = Operation.Admin; enterOutLog.Remark = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备设置为暂离", roomInfo.Name, enterOutLog.ShortSeatNo, Session["LoginID"]); int newId = -1; HandleResult result = EnterOutOperate.AddEnterOutLog(enterOutLog, ref newId); if (result == HandleResult.Successed) { Page.RegisterStartupScript("", "<script>alert('设置读者暂离成功');</script>"); GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value); } else { Page.RegisterStartupScript("", "<script>alert('设置读者暂离失败');</script>"); } } } } catch { } break; case "ReleaseShortLeave": //取消暂离 try { string seatStr = hidSeatNo.Value; string[] noArr = seatStr.Split(','); string seatNo = ""; for (int i = 0; i < noArr.Length; i++) { seatNo = noArr[i].Trim(); EnterOutLogInfo enterOutLog = T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo); if (enterOutLog != null && enterOutLog.EnterOutState == EnterOutLogType.ShortLeave) { ReadingRoomInfo roomInfo = T_SM_ReadingRoom.GetSingleRoomInfo(enterOutLog.ReadingRoomNo); enterOutLog.EnterOutState = EnterOutLogType.ComeBack; enterOutLog.Flag = Operation.Admin; enterOutLog.Remark = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备取消暂离,恢复为在座", roomInfo.Name, enterOutLog.ShortSeatNo, Session["LoginID"]); int newId = -1; HandleResult result = EnterOutOperate.AddEnterOutLog(enterOutLog, ref newId); if (result == HandleResult.Successed) { List <WaitSeatLogInfo> waitSeatLogs = T_SM_SeatWaiting.GetWaitSeatList("", enterOutLog.EnterOutLogID, null, null, null); WaitSeatLogInfo waitSeatLog = null; if (waitSeatLogs.Count > 0) { waitSeatLog = waitSeatLogs[0]; waitSeatLog.NowState = LogStatus.Fail; waitSeatLog.OperateType = Operation.OtherReader; waitSeatLog.WaitingState = EnterOutLogType.WaitingCancel; if (T_SM_SeatWaiting.UpdateWaitLog(waitSeatLog)) { Page.RegisterStartupScript("", "<script>alert('取消读者暂离成功');</script>"); GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value); } else { Page.RegisterStartupScript("", "<script>alert('取消读者暂离成功,取消读者等待失败');</script>"); GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value); } } else { Page.RegisterStartupScript("", "<script>alert('取消读者暂离成功');</script>"); GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value); } } else { Page.RegisterStartupScript("", "<script>alert('取消读者暂离失败');</script>"); } } } } catch { } break; case "Release": //释放座位 try { string seatStr = hidSeatNo.Value; string[] noArr = seatStr.Split(','); string seatNo = ""; for (int i = 0; i < noArr.Length; i++) { seatNo = noArr[i].Trim(); EnterOutLogInfo enterOutLog = T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo); if (enterOutLog != null && enterOutLog.EnterOutState != EnterOutLogType.Leave) { ReadingRoomInfo roomInfo = T_SM_ReadingRoom.GetSingleRoomInfo(enterOutLog.ReadingRoomNo); enterOutLog.EnterOutState = EnterOutLogType.Leave; enterOutLog.Flag = Operation.Admin; enterOutLog.Remark = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, Session["LoginID"]); int newId = -1; HandleResult result = EnterOutOperate.AddEnterOutLog(enterOutLog, ref newId); if (result == HandleResult.Successed) { RegulationRulesSetting rulesSet = T_SM_SystemSet.GetRegulationRulesSetting(); if (roomInfo.Setting.IsRecordViolate) { if (roomInfo.Setting.BlackListSetting.Used) { if (roomInfo.Setting.BlackListSetting.ViolateRoule[ViolationRecordsType.LeaveByAdmin]) { ViolationRecordsLogInfo violationRecords = new ViolationRecordsLogInfo(); violationRecords.CardNo = enterOutLog.CardNo; violationRecords.SeatID = enterOutLog.SeatNo.Substring(enterOutLog.SeatNo.Length - roomInfo.Setting.SeatNumAmount, roomInfo.Setting.SeatNumAmount); violationRecords.ReadingRoomID = enterOutLog.ReadingRoomNo; violationRecords.EnterOutTime = ServiceDateTime.Now.ToString(); violationRecords.EnterFlag = ViolationRecordsType.LeaveByAdmin; violationRecords.Remark = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, Session["LoginID"]); violationRecords.BlacklistID = "-1"; T_SM_ViolateDiscipline.AddViolationRecords(violationRecords); } } else if (rulesSet.BlacklistSet.Used && rulesSet.BlacklistSet.ViolateRoule[ViolationRecordsType.LeaveByAdmin]) { ViolationRecordsLogInfo violationRecords = new ViolationRecordsLogInfo(); violationRecords.CardNo = enterOutLog.CardNo; violationRecords.SeatID = enterOutLog.SeatNo.Substring(enterOutLog.SeatNo.Length - roomInfo.Setting.SeatNumAmount, roomInfo.Setting.SeatNumAmount); violationRecords.ReadingRoomID = enterOutLog.ReadingRoomNo; violationRecords.EnterOutTime = ServiceDateTime.Now.ToString(); violationRecords.EnterFlag = ViolationRecordsType.LeaveByAdmin; violationRecords.Remark = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, Session["LoginID"]); violationRecords.BlacklistID = "-1"; T_SM_ViolateDiscipline.AddViolationRecords(violationRecords); } } Page.RegisterStartupScript("", "<script>alert('设置读者离开成功');</script>"); GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value); } else { Page.RegisterStartupScript("", "<script>alert('设置读者离开失败');</script>"); } } } } catch { } break; case "onTime": //计时 try { string seatStr = hidSeatNo.Value; string[] noArr = seatStr.Split(','); string seatNo = ""; for (int i = 0; i < noArr.Length; i++) { seatNo = noArr[i].Trim(); EnterOutLogInfo enterOutLog = T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo); if (enterOutLog != null && enterOutLog.EnterOutState != EnterOutLogType.ShortLeave) { DateTime markTime = ServiceDateTime.Now; EnterOutOperate.UpdateMarkTime(enterOutLog.EnterOutLogID, markTime); GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value); } } } catch { } break; case "offTime": //取消计时 try { string seatStr = hidSeatNo.Value; string[] noArr = seatStr.Split(','); string seatNo = ""; for (int i = 0; i < noArr.Length; i++) { seatNo = noArr[i].Trim(); EnterOutLogInfo enterOutLog = T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo); if (enterOutLog != null && !string.IsNullOrEmpty(enterOutLog.MarkTime.ToString()) && enterOutLog.MarkTime.CompareTo(DateTime.Parse("1900/1/1")) != 0) { DateTime markTime = DateTime.Parse("1900-1-1"); EnterOutOperate.UpdateMarkTime(enterOutLog.EnterOutLogID, markTime); GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value); } } } catch { } break; case "AddBlacklist": try { string seatStr = hidSeatNo.Value; string[] noArr = seatStr.Split(','); string seatNo = ""; int newId = -1; RegulationRulesSetting rulesSet = T_SM_SystemSet.GetRegulationRulesSetting(); for (int i = 0; i < noArr.Length; i++) { newId = -1; seatNo = noArr[i].Trim(); EnterOutLogInfo enterOutLog = T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo); if (enterOutLog != null && enterOutLog.EnterOutState != EnterOutLogType.Leave) { ReadingRoomInfo roomInfo = T_SM_ReadingRoom.GetSingleRoomInfo(enterOutLog.ReadingRoomNo); if (roomInfo != null && roomInfo.Setting.BlackListSetting.Used) { BlackListInfo blacklistModel = new BlackListInfo(); blacklistModel.AddTime = ServiceDateTime.Now; blacklistModel.ReadingRoomID = roomInfo.No; blacklistModel.BlacklistState = LogStatus.Valid; blacklistModel.CardNo = enterOutLog.CardNo; blacklistModel.OutBlacklistMode = roomInfo.Setting.BlackListSetting.LeaveBlacklist; if (blacklistModel.OutBlacklistMode == LeaveBlacklistMode.AutomaticMode) { blacklistModel.ReMark = string.Format("管理员{0}通过手持设备{0}把读者加入黑名单,记录黑名单{1}天", Session["LoginID"], roomInfo.Setting.BlackListSetting.LimitDays); blacklistModel.OutTime = blacklistModel.AddTime.AddDays(roomInfo.Setting.BlackListSetting.LimitDays); } else { blacklistModel.ReMark = string.Format("管理员{0}通过手持设备把读者加入黑名单,手动离开黑名单", Session["LoginID"]); } blacklistModel.ReadingRoomID = roomInfo.No; newId = T_SM_Blacklist.AddBlackList(blacklistModel); } else if (rulesSet.BlacklistSet.Used) { BlackListInfo blacklistModel = new BlackListInfo(); blacklistModel.AddTime = ServiceDateTime.Now; blacklistModel.OutTime = blacklistModel.AddTime.AddDays(rulesSet.BlacklistSet.LimitDays); blacklistModel.BlacklistState = LogStatus.Valid; blacklistModel.CardNo = enterOutLog.CardNo; blacklistModel.OutBlacklistMode = rulesSet.BlacklistSet.LeaveBlacklist; if (blacklistModel.OutBlacklistMode == LeaveBlacklistMode.AutomaticMode) { blacklistModel.ReMark = string.Format("管理员{0}通过手持设备把读者加入黑名单,记录黑名单{1}天", Session["LoginID"], rulesSet.BlacklistSet.LimitDays); blacklistModel.OutTime = blacklistModel.AddTime.AddDays(rulesSet.BlacklistSet.LimitDays); } else { blacklistModel.ReMark = string.Format("管理员{0}通过手持设备把读者加入黑名单,手动离开黑名单", Session["LoginID"]); } blacklistModel.ReadingRoomID = roomInfo.No; newId = T_SM_Blacklist.AddBlackList(blacklistModel); } else { Page.RegisterStartupScript("", "<script>alert('对不起,此阅览室以及图书馆没有启用黑名单功能');</script>"); return; } if (newId > 0) { enterOutLog.EnterOutState = EnterOutLogType.Leave; enterOutLog.Flag = Operation.Admin; enterOutLog.Remark = string.Format("在{0},{1}号座位,被管理员{2},通过手持设备设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, Session["LoginID"]); HandleResult result = EnterOutOperate.AddEnterOutLog(enterOutLog, ref newId); if (result == HandleResult.Successed) { Page.RegisterStartupScript("", "<script>alert('设置读者黑名单成功');</script>"); GetSeatList(selectReadingRomm.Items[selectReadingRomm.SelectedIndex].Value, selectSeatState.Items[selectSeatState.SelectedIndex].Value); } else { Page.RegisterStartupScript("", "<script>alert('设置读者黑名单失败');</script>"); } } } } } catch { } break; case "LoginOut": HttpCookie aCookie; string cookieName; int limit = Request.Cookies.Count; for (int i = 0; i < limit; i++) { cookieName = Request.Cookies[i].Name; aCookie = new HttpCookie(cookieName); aCookie.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(aCookie); } Response.Redirect("../Login.aspx"); break; } #endregion } }
/// <summary> /// 暂离回来操作 /// </summary> public void CometoBack() { clientobject.EnterOutLogData.EnterOutlog.EnterOutState = EnterOutLogType.ComeBack;//设置读者状态为暂回来 clientobject.EnterOutLogData.EnterOutlog.Flag = Operation.Reader; List <WaitSeatLogInfo> waitSeatLogs = T_SM_SeatWaiting.GetWaitSeatList("", clientobject.EnterOutLogData.EnterOutlog.EnterOutLogID, null, null, null); WaitSeatLogInfo waitSeatLog = null; int newLogId = -1; System.TimeSpan shortleavetimelong = ServiceDateTime.Now - clientobject.EnterOutLogData.EnterOutlog.EnterOutTime; clientobject.EnterOutLogData.EnterOutlog.Remark = string.Format("在终端{0}刷卡暂离回来,暂离时长{1}分钟,继续使用{2} {3}号座位", clientobject.ClientSetting.ClientNo, shortleavetimelong.Minutes, clientobject.EnterOutLogData.EnterOutlog.ReadingRoomName, clientobject.EnterOutLogData.EnterOutlog.ShortSeatNo); clientobject.EnterOutLogData.EnterOutlog.TerminalNum = clientobject.ClientSetting.ClientNo; HandleResult result = EnterOutOperate.AddEnterOutLog(clientobject.EnterOutLogData.EnterOutlog, ref newLogId);//插入进出记录 if (result == HandleResult.Successed) { if (waitSeatLogs.Count > 0) { waitSeatLog = waitSeatLogs[0]; waitSeatLog.NowState = LogStatus.Fail; waitSeatLog.OperateType = Operation.OtherReader; waitSeatLog.WaitingState = EnterOutLogType.WaitingCancel; T_SM_SeatWaiting.UpdateWaitLog(waitSeatLog); } PopupWindow popWindow = new PopupWindow(TipType.ComeToBack); popWindow.ShowDialog(); if (clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatUsedTimeLimit.Used && clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatUsedTimeLimit.Mode == "Free") { List <EnterOutLogType> typeList = new List <EnterOutLogType>(); typeList.Add(EnterOutLogType.BookingConfirmation); typeList.Add(EnterOutLogType.SelectSeat); typeList.Add(EnterOutLogType.ReselectSeat); typeList.Add(EnterOutLogType.WaitingSuccess); typeList.Add(EnterOutLogType.ContinuedTime); List <EnterOutLogInfo> seatTimeEnterOutLog = SeatManage.Bll.T_SM_EnterOutLog.GetEnterOutLogByNo(clientobject.EnterOutLogData.EnterOutlog.EnterOutLogNo, typeList, 1); if (seatTimeEnterOutLog.Count > 0) { if (seatTimeEnterOutLog[0].EnterOutState == EnterOutLogType.ContinuedTime) { if (seatTimeEnterOutLog[0].EnterOutTime.AddMinutes(clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatUsedTimeLimit.DelayTimeLength) < ServiceDateTime.Now) { if (clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatUsedTimeLimit.ContinuedTimes == 0 || clientobject.EnterOutLogData.Student.ContinuedTimeCount < clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatUsedTimeLimit.ContinuedTimes) { clientobject.EnterOutLogData.EnterOutlog.EnterOutState = EnterOutLogType.ContinuedTime; clientobject.EnterOutLogData.EnterOutlog.TerminalNum = clientobject.ClientSetting.ClientNo; clientobject.EnterOutLogData.EnterOutlog.Remark = string.Format("在终端{0}刷卡暂离回来,暂离期间在座超时,系统自动延长{1} {2}号座位使用时间", clientobject.ClientSetting.ClientNo, clientobject.EnterOutLogData.Student.AtReadingRoom.Name, clientobject.EnterOutLogData.EnterOutlog.ShortSeatNo); result = EnterOutOperate.AddEnterOutLog(clientobject.EnterOutLogData.EnterOutlog, ref newLogId);//插入进出记录 if (result == HandleResult.Successed) { PopupWindow popWindow_Continue = new PopupWindow(TipType.AutoContinuedTime); popWindow_Continue.ShowDialog(); } else { PopupWindow popWindow_Continue = new PopupWindow(TipType.Exception); popWindow_Continue.ShowDialog(); } } else { clientobject.EnterOutLogData.EnterOutlog.EnterOutState = EnterOutLogType.Leave; clientobject.EnterOutLogData.EnterOutlog.TerminalNum = clientobject.ClientSetting.ClientNo; clientobject.EnterOutLogData.EnterOutlog.Remark = string.Format("在终端{0}刷卡暂离回来,暂离期间在座超时,续时次数已用完,系统自动释放{1} {2}号座位", clientobject.ClientSetting.ClientNo, clientobject.EnterOutLogData.Student.AtReadingRoom.Name, clientobject.EnterOutLogData.EnterOutlog.ShortSeatNo); result = EnterOutOperate.AddEnterOutLog(clientobject.EnterOutLogData.EnterOutlog, ref newLogId);//插入进出记录 if (result == HandleResult.Successed) { PopupWindow popWindow_Continue = new PopupWindow(TipType.AutoContinuedTimeNoCount); popWindow_Continue.ShowDialog(); } else { PopupWindow popWindow_Continue = new PopupWindow(TipType.Exception); popWindow_Continue.ShowDialog(); } } } } else { if (seatTimeEnterOutLog[0].EnterOutTime.AddMinutes(clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatUsedTimeLimit.UsedTimeLength) < ServiceDateTime.Now) { if (clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatUsedTimeLimit.IsCanContinuedTime) { if (clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatUsedTimeLimit.ContinuedTimes == 0 || clientobject.EnterOutLogData.Student.ContinuedTimeCount < clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatUsedTimeLimit.ContinuedTimes) { clientobject.EnterOutLogData.EnterOutlog.EnterOutState = EnterOutLogType.ContinuedTime; clientobject.EnterOutLogData.EnterOutlog.TerminalNum = clientobject.ClientSetting.ClientNo; clientobject.EnterOutLogData.EnterOutlog.Remark = string.Format("在终端{0}刷卡暂离回来,暂离期间在座超时,系统自动延长{1} {2}号座位使用时间", clientobject.ClientSetting.ClientNo, clientobject.EnterOutLogData.Student.AtReadingRoom.Name, clientobject.EnterOutLogData.EnterOutlog.ShortSeatNo); result = EnterOutOperate.AddEnterOutLog(clientobject.EnterOutLogData.EnterOutlog, ref newLogId);//插入进出记录 if (result == HandleResult.Successed) { PopupWindow popWindow_Continue = new PopupWindow(TipType.AutoContinuedTime); popWindow_Continue.ShowDialog(); } else { PopupWindow popWindow_Continue = new PopupWindow(TipType.Exception); popWindow_Continue.ShowDialog(); } } else { clientobject.EnterOutLogData.EnterOutlog.EnterOutState = EnterOutLogType.Leave; clientobject.EnterOutLogData.EnterOutlog.TerminalNum = clientobject.ClientSetting.ClientNo; clientobject.EnterOutLogData.EnterOutlog.Remark = string.Format("在终端{0}刷卡暂离回来,暂离期间在座超时,续时次数已用完,系统自动释放{1} {2}号座位", clientobject.ClientSetting.ClientNo, clientobject.EnterOutLogData.Student.AtReadingRoom.Name, clientobject.EnterOutLogData.EnterOutlog.ShortSeatNo); result = EnterOutOperate.AddEnterOutLog(clientobject.EnterOutLogData.EnterOutlog, ref newLogId);//插入进出记录 if (result == HandleResult.Successed) { PopupWindow popWindow_Continue = new PopupWindow(TipType.AutoContinuedTimeNoCount); popWindow_Continue.ShowDialog(); } else { PopupWindow popWindow_Continue = new PopupWindow(TipType.Exception); popWindow_Continue.ShowDialog(); } } } else { clientobject.EnterOutLogData.EnterOutlog.EnterOutState = EnterOutLogType.Leave; clientobject.EnterOutLogData.EnterOutlog.TerminalNum = clientobject.ClientSetting.ClientNo; clientobject.EnterOutLogData.EnterOutlog.Remark = string.Format("在终端{0}刷卡暂离回来,暂离期间在座超时,系统自动释放{1} {2}号座位", clientobject.ClientSetting.ClientNo, clientobject.EnterOutLogData.Student.AtReadingRoom.Name, clientobject.EnterOutLogData.EnterOutlog.ShortSeatNo); result = EnterOutOperate.AddEnterOutLog(clientobject.EnterOutLogData.EnterOutlog, ref newLogId);//插入进出记录 if (result == HandleResult.Successed) { PopupWindow popWindow_Continue = new PopupWindow(TipType.AutoContinuedTimeNoCount); popWindow_Continue.ShowDialog(); } else { PopupWindow popWindow_Continue = new PopupWindow(TipType.Exception); popWindow_Continue.ShowDialog(); } } } } } } } else { PopupWindow popWindow_Continue = new PopupWindow(TipType.Exception); popWindow_Continue.ShowDialog(); } }
/// <summary> ///暂离回来 /// </summary> public void CometoBack() { clientobject.ReaderInfo.EnterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.ComeBack;//设置读者状态为暂回来 clientobject.ReaderInfo.EnterOutLog.Flag = SeatManage.EnumType.Operation.Reader; List <WaitSeatLogInfo> waitSeatLogs = T_SM_SeatWaiting.GetWaitSeatList("", clientobject.ReaderInfo.EnterOutLog.EnterOutLogID, null, null, null); WaitSeatLogInfo waitSeatLog = null; string clientType = "终端"; switch (LeaveClientSetting.LeaveState) { case LeaveState.FreeSeat: clientType = "离开终端"; break; case LeaveState.ShortLeave: clientType = "暂离终端"; break; case LeaveState.ContinuedTime: clientType = "续时终端"; break; case LeaveState.Choose: clientType = "自助终端"; break; } int newLogId = -1; System.TimeSpan shortleavetimelong = ServiceDateTime.Now - clientobject.ReaderInfo.EnterOutLog.EnterOutTime; clientobject.ReaderInfo.EnterOutLog.Remark = string.Format("在{0}刷卡暂离回来,暂离时长{1}分钟,继续使用{2} {3}号座位", clientType, shortleavetimelong.Minutes, clientobject.ReaderInfo.EnterOutLog.ReadingRoomName, clientobject.ReaderInfo.EnterOutLog.ShortSeatNo); clientobject.ReaderInfo.EnterOutLog.TerminalNum = clientobject.ClientSetting.ClientNo; try { SeatManage.EnumType.HandleResult result = EnterOutOperate.AddEnterOutLog(clientobject.ReaderInfo.EnterOutLog, ref newLogId);//插入进出记录 if (result == SeatManage.EnumType.HandleResult.Successed) { if (waitSeatLogs.Count > 0) { waitSeatLog = waitSeatLogs[0]; waitSeatLog.NowState = SeatManage.EnumType.LogStatus.Fail; waitSeatLog.OperateType = SeatManage.EnumType.Operation.OtherReader; waitSeatLog.WaitingState = SeatManage.EnumType.EnterOutLogType.WaitingCancel; T_SM_SeatWaiting.UpdateWaitLog(waitSeatLog);//取消等待 } if (HandleResult != null) { HandleResult(string.Format(" 欢迎回来,您的座位在{0} {1}号。", clientobject.ReaderInfo.EnterOutLog.ReadingRoomName, clientobject.ReaderInfo.EnterOutLog.ShortSeatNo), SeatManage.EnumType.HandleResult.Successed); if (clientobject.ReaderInfo.AtReadingRoom.Setting.SeatUsedTimeLimit.Used) { List <SeatManage.EnumType.EnterOutLogType> typeList = new List <SeatManage.EnumType.EnterOutLogType>(); typeList.Add(SeatManage.EnumType.EnterOutLogType.BookingConfirmation); typeList.Add(SeatManage.EnumType.EnterOutLogType.SelectSeat); typeList.Add(SeatManage.EnumType.EnterOutLogType.ReselectSeat); typeList.Add(SeatManage.EnumType.EnterOutLogType.WaitingSuccess); typeList.Add(SeatManage.EnumType.EnterOutLogType.ContinuedTime); List <EnterOutLogInfo> seatTimeEnterOutLog = SeatManage.Bll.T_SM_EnterOutLog.GetEnterOutLogByNo(clientobject.ReaderInfo.EnterOutLog.EnterOutLogNo, typeList, 1); if (seatTimeEnterOutLog.Count > 0) { if (seatTimeEnterOutLog[0].EnterOutState == SeatManage.EnumType.EnterOutLogType.ContinuedTime) { if (seatTimeEnterOutLog[0].EnterOutTime.AddMinutes(clientobject.ReaderInfo.AtReadingRoom.Setting.SeatUsedTimeLimit.DelayTimeLength) < ServiceDateTime.Now) { if (clientobject.ReaderInfo.AtReadingRoom.Setting.SeatUsedTimeLimit.ContinuedTimes == 0 || clientobject.ReaderInfo.ContinuedTimeCount < clientobject.ReaderInfo.AtReadingRoom.Setting.SeatUsedTimeLimit.ContinuedTimes) { clientobject.ReaderInfo.EnterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.ContinuedTime; clientobject.ReaderInfo.EnterOutLog.TerminalNum = clientobject.ClientSetting.ClientNo; clientobject.ReaderInfo.EnterOutLog.Remark = string.Format("在{0}刷卡暂离回来,暂离期间在座超时,系统自动延长{1},{2}号座位使用时间", clientType, clientobject.ReaderInfo.AtReadingRoom.Name, clientobject.ReaderInfo.EnterOutLog.ShortSeatNo); result = EnterOutOperate.AddEnterOutLog(clientobject.ReaderInfo.EnterOutLog, ref newLogId);//插入进出记录 if (result == SeatManage.EnumType.HandleResult.Successed) { HandleResult(string.Format(" 暂离期间在座超时,系统自动延长{0},{1}号座位使用时间。", clientobject.ReaderInfo.EnterOutLog.ReadingRoomName, clientobject.ReaderInfo.EnterOutLog.ShortSeatNo), SeatManage.EnumType.HandleResult.Successed); } else { //TODO:错误提示 } } else { clientobject.ReaderInfo.EnterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.Leave; clientobject.ReaderInfo.EnterOutLog.TerminalNum = clientobject.ClientSetting.ClientNo; clientobject.ReaderInfo.EnterOutLog.Remark = string.Format("在{0}刷卡暂离回来,暂离期间在座超时,续时次数已用完,系统自动释放{1},{2}号座位", clientType, clientobject.ReaderInfo.AtReadingRoom.Name, clientobject.ReaderInfo.EnterOutLog.ShortSeatNo); result = EnterOutOperate.AddEnterOutLog(clientobject.ReaderInfo.EnterOutLog, ref newLogId);//插入进出记录 if (result == SeatManage.EnumType.HandleResult.Successed) { HandleResult(string.Format(" 暂离期间在座超时,续时次数已用完,系统自动释放{0},{1}号座位。", clientobject.ReaderInfo.EnterOutLog.ReadingRoomName, clientobject.ReaderInfo.EnterOutLog.ShortSeatNo), SeatManage.EnumType.HandleResult.Successed); } else { //TODO:错误提示 } } } } else { if (seatTimeEnterOutLog[0].EnterOutTime.AddMinutes(clientobject.ReaderInfo.AtReadingRoom.Setting.SeatUsedTimeLimit.UsedTimeLength) < ServiceDateTime.Now) { if (clientobject.ReaderInfo.AtReadingRoom.Setting.SeatUsedTimeLimit.IsCanContinuedTime) { if (clientobject.ReaderInfo.AtReadingRoom.Setting.SeatUsedTimeLimit.ContinuedTimes == 0 || clientobject.ReaderInfo.ContinuedTimeCount < clientobject.ReaderInfo.AtReadingRoom.Setting.SeatUsedTimeLimit.ContinuedTimes) { clientobject.ReaderInfo.EnterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.ContinuedTime; clientobject.ReaderInfo.EnterOutLog.TerminalNum = clientobject.ClientSetting.ClientNo; clientobject.ReaderInfo.EnterOutLog.Remark = string.Format("在{0}刷卡暂离回来,暂离期间在座超时,系统自动延长{1},{2}号座位使用时间", clientType, clientobject.ReaderInfo.AtReadingRoom.Name, clientobject.ReaderInfo.EnterOutLog.ShortSeatNo); result = EnterOutOperate.AddEnterOutLog(clientobject.ReaderInfo.EnterOutLog, ref newLogId);//插入进出记录 if (result == SeatManage.EnumType.HandleResult.Successed) { HandleResult(string.Format(" 暂离期间在座超时,系统自动延长{0},{1}号座位使用时间。", clientobject.ReaderInfo.EnterOutLog.ReadingRoomName, clientobject.ReaderInfo.EnterOutLog.ShortSeatNo), SeatManage.EnumType.HandleResult.Successed); } else { //TODO:错误提示 } } else { clientobject.ReaderInfo.EnterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.Leave; clientobject.ReaderInfo.EnterOutLog.TerminalNum = clientobject.ClientSetting.ClientNo; clientobject.ReaderInfo.EnterOutLog.Remark = string.Format("在{0}刷卡暂离回来,暂离期间在座超时,续时次数已用完,系统自动释放{1},{2}号座位", clientType, clientobject.ReaderInfo.AtReadingRoom.Name, clientobject.ReaderInfo.EnterOutLog.ShortSeatNo); result = EnterOutOperate.AddEnterOutLog(clientobject.ReaderInfo.EnterOutLog, ref newLogId);//插入进出记录 if (result == SeatManage.EnumType.HandleResult.Successed) { HandleResult(string.Format(" 暂离期间在座超时,续时次数已用完,系统自动释放{0},{1}号座位。", clientobject.ReaderInfo.EnterOutLog.ReadingRoomName, clientobject.ReaderInfo.EnterOutLog.ShortSeatNo), SeatManage.EnumType.HandleResult.Successed); } else { //TODO:错误提示 } } } else { clientobject.ReaderInfo.EnterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.Leave; clientobject.ReaderInfo.EnterOutLog.TerminalNum = clientobject.ClientSetting.ClientNo; clientobject.ReaderInfo.EnterOutLog.Remark = string.Format("在{0}刷卡暂离回来,暂离期间在座超时,系统自动释放{1},{2}号座位", clientType, clientobject.ReaderInfo.AtReadingRoom.Name, clientobject.ReaderInfo.EnterOutLog.ShortSeatNo); result = EnterOutOperate.AddEnterOutLog(clientobject.ReaderInfo.EnterOutLog, ref newLogId);//插入进出记录 if (result == SeatManage.EnumType.HandleResult.Successed) { HandleResult(string.Format(" 暂离期间在座超时,系统自动释放{0},{1}号座位。", clientobject.ReaderInfo.EnterOutLog.ReadingRoomName, clientobject.ReaderInfo.EnterOutLog.ShortSeatNo), SeatManage.EnumType.HandleResult.Successed); } else { //TODO:错误提示 } } } } } } } } else { if (HandleResult != null) { HandleResult("操作失败!", SeatManage.EnumType.HandleResult.Failed); } } } catch (Exception ex) { SeatManage.SeatManageComm.WriteLog.Write(string.Format("读者{0}暂离回来操作失败:{1}", clientobject.ReaderInfo.CardNo, ex.Message)); if (HandleResult != null) { HandleResult("操作失败!", SeatManage.EnumType.HandleResult.Failed); } } }
/// <summary> /// 处理暂离和在座超时 /// </summary> /// <param name="readingRooms"></param> public void EnterOutLogOperate() { try { DateTime nowDateTime = ServiceDateTime.Now; List <EnterOutLogInfo> eolList = T_SM_EnterOutLog.GetEnterOutLogByStatus(null, null, null, enterOutLogTypeList, LogStatus.Valid, nowDateTime.ToShortDateString(), null); //遍历所有阅览室 foreach (ReadingRoomInfo rri in roomList.Values.Where(rri => rri.Setting != null)) { DateTime seatOutTime = rri.Setting.RoomOpenSet.NowOpenTime(nowDateTime).AddMinutes(-rri.Setting.RoomOpenSet.OpenBeforeTimeLength); if (rri.Setting.SeatUsedTimeLimit.Used && rri.Setting.SeatUsedTimeLimit.Mode == "Fixed") { foreach (DateTime ft in rri.Setting.SeatUsedTimeLimit.FixedTimes) { if (nowDateTime > ft) { seatOutTime = rri.Setting.SeatUsedTimeLimit.IsCanContinuedTime ? ft.AddMinutes(-rri.Setting.SeatUsedTimeLimit.CanDelayTime) : ft; } else { break; } } } //获取本阅览室的进出记录 foreach (EnterOutLogInfo eol in eolList.FindAll(u => u.ReadingRoomNo == rri.No)) { switch (eol.EnterOutState) { case EnterOutLogType.SelectSeat: case EnterOutLogType.ReselectSeat: case EnterOutLogType.WaitingSuccess: case EnterOutLogType.BookingConfirmation: try { if (rri.Setting.SeatUsedTimeLimit.Used) { //判断是否在座超时 if (rri.Setting.SeatUsedTimeLimit.Mode == "Free") { if (eol.EnterOutTime.AddMinutes(rri.Setting.SeatUsedTimeLimit.UsedTimeLength) < nowDateTime) { SeatOverTimeOperator(rri.Setting, eol, nowDateTime); } //else if (eol.EnterOutTime.AddMinutes(rri.Setting.SeatUsedTimeLimit.UsedTimeLength - rri.Setting.SeatUsedTimeLimit.CanDelayTime) < nowDateTime) //{ // //推送续时提示 //} } else if (rri.Setting.SeatUsedTimeLimit.Mode == "Fixed") { if (eol.EnterOutTime < seatOutTime) { SeatOverTimeOperator(rri.Setting, eol, nowDateTime); } //else if (eol.EnterOutTime.AddMinutes(rri.Setting.SeatUsedTimeLimit.UsedTimeLength - rri.Setting.SeatUsedTimeLimit.CanDelayTime) < seatOutTime) //{ //} } } } catch (Exception ex) { WriteLog.Write(string.Format("监控服务:在座超时处理遇到异常{0}", ex.Message)); } break; case EnterOutLogType.ContinuedTime: try { //判断是否续时超时 if (rri.Setting.SeatUsedTimeLimit.Used) { if (rri.Setting.SeatUsedTimeLimit.Mode == "Free" && (eol.EnterOutTime.AddMinutes(rri.Setting.SeatUsedTimeLimit.DelayTimeLength) < nowDateTime)) { SeatOverTimeOperator(rri.Setting, eol, nowDateTime); } else if (rri.Setting.SeatUsedTimeLimit.Mode == "Fixed" && eol.EnterOutTime < seatOutTime) { SeatOverTimeOperator(rri.Setting, eol, nowDateTime); } } } catch (Exception ex) { WriteLog.Write(string.Format("监控服务:续时超时处理遇到异常{0}", ex.Message)); } break; case EnterOutLogType.ComeBack: { if (rri.Setting.SeatUsedTimeLimit.Used) { //操作最后一条选座或续时的记录 EnterOutLogInfo neweol = GetLastNoSeatTimeLog(eol); if (neweol != null) { eol.EnterOutTime = neweol.EnterOutTime; eol.EnterOutState = neweol.EnterOutState; if (eol.EnterOutState == EnterOutLogType.ContinuedTime) { goto case EnterOutLogType.ContinuedTime; } else { goto case EnterOutLogType.BookingConfirmation; } } } break; } case EnterOutLogType.ShortLeave: { if (eol.Flag == Operation.OtherReader && rri.Setting.NoManagement.Used && (eol.EnterOutTime.AddMinutes(rri.Setting.GetSeatHoldTime(eol.EnterOutTime)) < nowDateTime)) { //判断座位等待处理 List <WaitSeatLogInfo> wslilist = T_SM_SeatWaiting.GetWaitSeatList(null, eol.EnterOutLogID, null, null, new List <EnterOutLogType> { EnterOutLogType.Waiting }); if (wslilist.Count > 0) { WaitSeatOperate(rri, eol, wslilist, nowDateTime); } } else { if (eol.Flag == Operation.Admin) { if (rri.Setting.AdminShortLeave.IsUsed && (eol.EnterOutTime.AddMinutes(rri.Setting.AdminShortLeave.HoldTimeLength) < nowDateTime)) { ShortLeaveOverTimeOperator(eol, rri.Setting, nowDateTime); } else if (!rri.Setting.AdminShortLeave.IsUsed && (eol.EnterOutTime.AddMinutes(NowReadingRoomState.GetSeatHoldTime(rri.Setting.SeatHoldTime, eol.EnterOutTime)) < nowDateTime)) { ShortLeaveOverTimeOperator(eol, rri.Setting, nowDateTime); } } else if (eol.EnterOutTime.AddMinutes(NowReadingRoomState.GetSeatHoldTime(rri.Setting.SeatHoldTime, eol.EnterOutTime)) < nowDateTime) { ShortLeaveOverTimeOperator(eol, rri.Setting, nowDateTime); } } } break; } } } } catch (Exception ex) { WriteLog.Write(string.Format("监控服务:处理当前的进出记录失败{0}", ex.Message)); } }
/// <summary> /// 预约等待 /// </summary> public void BespeakCheck() { if (Clientobject.EnterOutLogData.Student.BespeakLog.Count <= 0) { return; } BespeakLogInfo bespeaklog = Clientobject.EnterOutLogData.Student.BespeakLog[0]; ReadingRoomSetting set = Clientobject.EnterOutLogData.Student.AtReadingRoom.Setting; DateTime dtBegin = bespeaklog.BsepeakTime.AddMinutes(-double.Parse(set.SeatBespeak.ConfirmTime.BeginTime)); DateTime dtEnd = bespeaklog.BsepeakTime.AddMinutes(double.Parse(set.SeatBespeak.ConfirmTime.EndTime)); DateTime nowDate = ServiceDateTime.Now; if (DateTimeOperate.DateAccord(dtBegin, dtEnd, nowDate) || (set.SeatBespeak.NowDayBespeak && bespeaklog.SubmitTime == bespeaklog.BsepeakTime)) { //TODO:预约时间在开始时间和结束时间之间,执行预约确认操作 //TODO:预约确认时,判断当前座位上是否有人。 EnterOutLogInfo seatUsedInfo = T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(bespeaklog.SeatNo); if (seatUsedInfo != null && seatUsedInfo.EnterOutState != EnterOutLogType.Leave) { //条件满足,说明座位正在使用。 seatUsedInfo.EnterOutState = EnterOutLogType.Leave; seatUsedInfo.EnterOutType = LogStatus.Valid; seatUsedInfo.TerminalNum = Clientobject.ClientSetting.ClientNo; seatUsedInfo.Remark = string.Format("预约该座位的读者在终端{0}刷卡确认入座,设置在座读者离开", Clientobject.ClientSetting.ClientNo); seatUsedInfo.Flag = Operation.OtherReader; int newId = -1; if (EnterOutOperate.AddEnterOutLog(seatUsedInfo, ref newId) == HandleResult.Successed) { List <WaitSeatLogInfo> waitInfoList = T_SM_SeatWaiting.GetWaitSeatList(null, seatUsedInfo.EnterOutLogID, null, null, null); if (waitInfoList.Count > 0) { Clientobject.EnterOutLogData.WaitSeatLogModel = waitInfoList[0]; Clientobject.EnterOutLogData.WaitSeatLogModel.OperateType = Operation.Reader; Clientobject.EnterOutLogData.WaitSeatLogModel.WaitingState = EnterOutLogType.WaitingCancel; Clientobject.EnterOutLogData.WaitSeatLogModel.NowState = LogStatus.Valid; if (!T_SM_SeatWaiting.UpdateWaitLog(Clientobject.EnterOutLogData.WaitSeatLogModel)) { PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.Exception); return; } } } else { PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.Exception); return; } } EnterOutLogInfo newEnterOutLog = new EnterOutLogInfo();//构造 newEnterOutLog.CardNo = bespeaklog.CardNo; newEnterOutLog.EnterOutLogNo = SeatComm.RndNum(); newEnterOutLog.EnterOutState = EnterOutLogType.BookingConfirmation; newEnterOutLog.EnterOutType = LogStatus.Valid; newEnterOutLog.Flag = Operation.Reader; newEnterOutLog.ReadingRoomNo = bespeaklog.ReadingRoomNo; newEnterOutLog.ReadingRoomName = bespeaklog.ReadingRoomName; newEnterOutLog.ShortSeatNo = bespeaklog.ShortSeatNum; newEnterOutLog.SeatNo = bespeaklog.SeatNo; newEnterOutLog.TerminalNum = Clientobject.ClientSetting.ClientNo; newEnterOutLog.Remark = string.Format("在终端{0}刷卡,入座预约的{1} {2}号座位", Clientobject.ClientSetting.ClientNo, bespeaklog.ReadingRoomName, bespeaklog.ShortSeatNum); Clientobject.EnterOutLogData.EnterOutlog = newEnterOutLog; int logid = -1; HandleResult result = EnterOutOperate.AddEnterOutLog(newEnterOutLog, ref logid); //添加入座记录 if (result == HandleResult.Successed) { bespeaklog.BsepeakState = BookingStatus.Confinmed; bespeaklog.CancelPerson = Operation.Reader; bespeaklog.CancelTime = nowDate; bespeaklog.Remark = string.Format("在终端{0}刷卡,入座预约的{1} {2}号座位", Clientobject.ClientSetting.ClientNo, bespeaklog.ReadingRoomName, bespeaklog.ShortSeatNum); T_SM_SeatBespeak.UpdateBespeakList(bespeaklog); PrintData data = new PrintData(); data.CardNo = bespeaklog.CardNo; ; data.EnterTime = nowDate; data.ReaderName = Clientobject.EnterOutLogData.Student.Name; data.ReadingRoomName = Clientobject.EnterOutLogData.Student.AtReadingRoom.Name; data.SeatNo = SeatComm.SeatNoToShortSeatNo(set.SeatNumAmount, bespeaklog.SeatNo); switch (Clientobject.ClientSetting.DeviceSetting.UsingPrintSlip) { case PrintSlipMode.AutoPrint: printer.ThreadPrint(PrintStatus.General, data, Clientobject.ClientSetting.ClientNo); break; case PrintSlipMode.UserChoose: PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.PrintConfIrm); if (PopupWindowsObject.GetInstance().Window.ViewModel.OperateResule == HandleResult.Successed) { printer.ThreadPrint(PrintStatus.General, data, Clientobject.ClientSetting.ClientNo); } break; case PrintSlipMode.NotPrint: break; } PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.BespeatSeatConfirmSuccess); } else { PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.Exception); } } else if (nowDate.CompareTo(dtBegin) < 0) { //TODO:预约时间过早,请在dtBegin 到dtEnd刷卡确认。 PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.BookConfirmWarn); if (PopupWindowsObject.GetInstance().Window.ViewModel.OperateResule != HandleResult.Successed) { return; } bespeaklog.BsepeakState = BookingStatus.Cencaled; bespeaklog.CancelPerson = Operation.Reader; bespeaklog.CancelTime = ServiceDateTime.Now; bespeaklog.Remark = string.Format("在终端{0}刷卡取消{1},{2}号座位的预约。", Clientobject.ClientSetting.ClientNo, bespeaklog.ReadingRoomName, bespeaklog.ShortSeatNum); int i = T_SM_SeatBespeak.UpdateBespeakList(bespeaklog); PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.BookCancelSuccess); } }