/// <summary> /// 等待座位 /// </summary> public void WaitingSeat() { WaitSeatLogInfo waitLog = Clientobject.EnterOutLogData.Student.WaitSeatLog; //ReadingRoomInfo roomInfo = Clientobject.EnterOutLogData.Student.AtReadingRoom; //string shortSeatNo = SeatComm.SeatNoToShortSeatNo(roomInfo.Setting.SeatNumAmount, waitLog.SeatNo); PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.WaitSeatCancelWarn); if (PopupWindowsObject.GetInstance().Window.ViewModel.OperateResule != HandleResult.Successed) { return; } //处理等待记录的Id Clientobject.EnterOutLogData.WaitSeatLogModel = waitLog; 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; //恢复读者的在座状态 } Clientobject.EnterOutLogData.EnterOutlog = T_SM_EnterOutLog.GetEnterOutLogInfoById(Clientobject.EnterOutLogData.WaitSeatLogModel.EnterOutLogID); TimeSpan shortleavetimelong = ServiceDateTime.Now - Clientobject.EnterOutLogData.EnterOutlog.EnterOutTime; Clientobject.EnterOutLogData.EnterOutlog.EnterOutState = EnterOutLogType.ComeBack; Clientobject.EnterOutLogData.EnterOutlog.EnterOutType = LogStatus.Valid; Clientobject.EnterOutLogData.EnterOutlog.Flag = Operation.OtherReader; Clientobject.EnterOutLogData.EnterOutlog.TerminalNum = Clientobject.ClientSetting.ClientNo; Clientobject.EnterOutLogData.EnterOutlog.Remark = string.Format("读者{0}在{1}终端取消等待{2} {3}号座位,您暂离{4}分钟后恢复为在座状态", Clientobject.EnterOutLogData.WaitSeatLogModel.CardNo, Clientobject.ClientSetting.ClientNo, Clientobject.EnterOutLogData.EnterOutlog.ReadingRoomName, Clientobject.EnterOutLogData.EnterOutlog.ShortSeatNo, shortleavetimelong.Minutes); int newId = -1; PopupWindowsObject.GetInstance().Window.ShowMessage(EnterOutOperate.AddEnterOutLog(Clientobject.EnterOutLogData.EnterOutlog, ref newId) == HandleResult.Successed ? TipType.WaitSeatCancel : TipType.Exception); }
/// <summary> /// 等待座位 /// </summary> public void WaitingSeat() { WaitSeatLogInfo waitLog = clientobject.EnterOutLogData.Student.WaitSeatLog; ReadingRoomInfo roomInfo = clientobject.EnterOutLogData.Student.AtReadingRoom; string shortSeatNo = SeatComm.SeatNoToShortSeatNo(roomInfo.Setting.SeatNumAmount, waitLog.SeatNo); WaitSeatCancel askForm = new WaitSeatCancel(roomInfo.Name, shortSeatNo); askForm.ShowDialog(); if (askForm.IsTrue) { //处理等待记录的Id this.clientobject.EnterOutLogData.WaitSeatLogModel = waitLog; this.clientobject.EnterOutLogData.WaitSeatLogModel.OperateType = Operation.Reader; this.clientobject.EnterOutLogData.WaitSeatLogModel.WaitingState = EnterOutLogType.WaitingCancel; this.clientobject.EnterOutLogData.WaitSeatLogModel.NowState = LogStatus.Valid; if (T_SM_SeatWaiting.UpdateWaitLog(this.clientobject.EnterOutLogData.WaitSeatLogModel)) { //恢复读者的在座状态 this.clientobject.EnterOutLogData.EnterOutlog = T_SM_EnterOutLog.GetEnterOutLogInfoById(this.clientobject.EnterOutLogData.WaitSeatLogModel.EnterOutLogID); System.TimeSpan shortleavetimelong = ServiceDateTime.Now - clientobject.EnterOutLogData.EnterOutlog.EnterOutTime; this.clientobject.EnterOutLogData.EnterOutlog.EnterOutState = EnterOutLogType.ComeBack; this.clientobject.EnterOutLogData.EnterOutlog.EnterOutType = LogStatus.Valid; this.clientobject.EnterOutLogData.EnterOutlog.Flag = Operation.OtherReader; clientobject.EnterOutLogData.EnterOutlog.TerminalNum = clientobject.ClientSetting.ClientNo; this.clientobject.EnterOutLogData.EnterOutlog.Remark = string.Format("读者{0}在{1}终端取消等待{2} {3}号座位,您暂离{4}分钟后恢复为在座状态", this.clientobject.EnterOutLogData.WaitSeatLogModel.CardNo, this.clientobject.ClientSetting.ClientNo, this.clientobject.EnterOutLogData.EnterOutlog.ReadingRoomName, this.clientobject.EnterOutLogData.EnterOutlog.ShortSeatNo, shortleavetimelong.Minutes); int newId = -1; EnterOutOperate.AddEnterOutLog(this.clientobject.EnterOutLogData.EnterOutlog, ref newId); } } }
/// <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)); } }
/// <summary> /// 等待座位 /// </summary> public void WaitingSeat() { WaitSeatLogInfo waitLog = clientobject.EnterOutLogData.Student.WaitSeatLog; ReadingRoomInfo roomInfo = clientobject.EnterOutLogData.Student.AtReadingRoom; string shortSeatNo = SeatComm.SeatNoToShortSeatNo(roomInfo.Setting.SeatNumAmount, waitLog.SeatNo); MessageWindow popWindowCancel = new MessageWindow(MessageType.CancelWaitConfirm); popWindowCancel.ShowDialog(); if (popWindowCancel.viewModel.OperateResule == HandleResult.Successed) { //处理等待记录的Id this.clientobject.EnterOutLogData.WaitSeatLogModel = waitLog; this.clientobject.EnterOutLogData.WaitSeatLogModel.OperateType = Operation.Reader; this.clientobject.EnterOutLogData.WaitSeatLogModel.WaitingState = EnterOutLogType.WaitingCancel; this.clientobject.EnterOutLogData.WaitSeatLogModel.NowState = LogStatus.Valid; if (T_SM_SeatWaiting.UpdateWaitLog(this.clientobject.EnterOutLogData.WaitSeatLogModel)) { //恢复读者的在座状态 this.clientobject.EnterOutLogData.EnterOutlog = T_SM_EnterOutLog.GetEnterOutLogInfoById(this.clientobject.EnterOutLogData.WaitSeatLogModel.EnterOutLogID); System.TimeSpan shortleavetimelong = ServiceDateTime.Now - clientobject.EnterOutLogData.EnterOutlog.EnterOutTime; this.clientobject.EnterOutLogData.EnterOutlog.EnterOutState = EnterOutLogType.ComeBack; this.clientobject.EnterOutLogData.EnterOutlog.EnterOutType = LogStatus.Valid; this.clientobject.EnterOutLogData.EnterOutlog.Flag = Operation.OtherReader; clientobject.EnterOutLogData.EnterOutlog.TerminalNum = clientobject.ClientSetting.ClientNo; this.clientobject.EnterOutLogData.EnterOutlog.Remark = string.Format("读者{0}在{1}终端取消等待{2} {3}号座位,您暂离{4}分钟后恢复为在座状态", this.clientobject.EnterOutLogData.WaitSeatLogModel.CardNo, this.clientobject.ClientSetting.ClientNo, this.clientobject.EnterOutLogData.EnterOutlog.ReadingRoomName, this.clientobject.EnterOutLogData.EnterOutlog.ShortSeatNo, shortleavetimelong.Minutes); int newId = -1; if (EnterOutOperate.AddEnterOutLog(this.clientobject.EnterOutLogData.EnterOutlog, ref newId) == HandleResult.Successed) { MessageWindow popWindow = new MessageWindow(MessageType.CancleWaitSuccess); popWindow.ShowDialog(); } else { MessageWindow popWindow = new MessageWindow(MessageType.Exception); popWindow.ShowDialog(); } } } }
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 BespeakSeatWait() { DateTime nowDate = ServiceDateTime.Now; if (clientobject.EnterOutLogData.Student.BespeakLog.Count > 0) { BespeakLogInfo bespeaklog = clientobject.EnterOutLogData.Student.BespeakLog[0]; //if (!SelectSeatProven.CheckReadingRoomInThisClient(bespeaklog.ReadingRoomNo, clientobject.ClientSetting.DeviceSetting)) //{ //验证房间号是否属于本触摸屏所管理的阅览室 // Tip_Framework uc = new Tip_Framework(TipType.BeapeatRoomNotExists, 9); //} 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)); 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 = SeatManage.Bll.T_SM_SeatWaiting.GetWaitSeatList(null, seatUsedInfo.EnterOutLogID, null, null, null); if (waitInfoList.Count > 0) { this.clientobject.EnterOutLogData.WaitSeatLogModel = waitInfoList[0]; this.clientobject.EnterOutLogData.WaitSeatLogModel.OperateType = Operation.Reader; this.clientobject.EnterOutLogData.WaitSeatLogModel.WaitingState = EnterOutLogType.WaitingCancel; this.clientobject.EnterOutLogData.WaitSeatLogModel.NowState = LogStatus.Valid; if (!T_SM_SeatWaiting.UpdateWaitLog(this.clientobject.EnterOutLogData.WaitSeatLogModel)) { PopupWindow errorWindow = new PopupWindow(TipType.Exception); errorWindow.ShowDialog(); return; } } } else { PopupWindow errorWindow = new PopupWindow(TipType.Exception); errorWindow.ShowDialog(); 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); if (clientobject.ClientSetting.DeviceSetting.UsingPrintSlip == PrintSlipMode.AutoPrint) { printer.ThreadPrint(PrintStatus.General, data, clientobject.ClientSetting.ClientNo); } if (clientobject.ClientSetting.DeviceSetting.UsingPrintSlip == PrintSlipMode.UserChoose) { PopupWindow printWindow = new PopupWindow(TipType.PrintConfIrm); printWindow.ShowDialog(); if (printWindow.viewModel.OperateResule == HandleResult.Successed) { printer.ThreadPrint(PrintStatus.General, data, clientobject.ClientSetting.ClientNo); } } } PopupWindow popWindow = new PopupWindow(TipType.BespeatSeatConfirmSuccess); popWindow.ShowDialog(); } else if (nowDate.CompareTo(dtBegin) < 0) { //TODO:预约时间过早,请在dtBegin 到dtEnd刷卡确认。 PopupWindow popWindow = new PopupWindow(TipType.BookConfirmWarn); popWindow.ShowDialog(); if (popWindow.viewModel.OperateResule == HandleResult.Successed) { 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); PopupWindow popWindowCancel = new PopupWindow(TipType.BookCancelSuccess); popWindowCancel.ShowDialog(); } } else if (nowDate.CompareTo(dtEnd) < 0) { //TODO:最迟确认时间为:dtEnd。 } else { //TODO:未知原因,预约确认失败。 } } }
/// <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="readingRoom">阅览室</param> /// <param name="enterOutLog">进出记录</param> /// <param name="waitSeatLoglist">等待记录列表</param> private static void WaitSeatOperate(ReadingRoomInfo readingRoom, EnterOutLogInfo enterOutLog, List <WaitSeatLogInfo> waitSeatLoglist, DateTime nowDateTime) { try { waitSeatLoglist[0].WaitingState = EnterOutLogType.WaitingSuccess; waitSeatLoglist[0].StatsChangeTime = nowDateTime; T_SM_SeatWaiting.UpdateWaitLog(waitSeatLoglist[0]); ReaderNoticeInfo notice = new ReaderNoticeInfo(); //释放原读者座位 int logid = 0; enterOutLog.Flag = Operation.Service; enterOutLog.EnterOutState = EnterOutLogType.Leave; enterOutLog.EnterOutTime = nowDateTime; enterOutLog.Remark = string.Format("在{0},{1}号座位,被其他读者设置暂离,暂离超时,被监控服务释放座位", enterOutLog.ReadingRoomName, enterOutLog.SeatNo.Substring(enterOutLog.SeatNo.Length - readingRoom.Setting.SeatNumAmount)); EnterOutOperate.AddEnterOutLog(enterOutLog, ref logid); //notice.CardNo = enterOutLog.CardNo; //notice.Type = NoticeType.ShortLeaveTimeEndWarning; //notice.Note = "暂离超时,座位已被释放。"; //T_SM_ReaderNotice.AddReaderNotice(notice); //PushMsgInfo msg = new PushMsgInfo(); //msg.Title = "您好,您的座位已被释放"; //msg.MsgType = MsgPushType.TimeOut; //msg.StudentNum = enterOutLog.CardNo; //msg.Message = enterOutLog.Remark; //SeatManage.Bll.T_SM_ReaderNotice.SendPushMsg(msg); WriteLog.Write(string.Format("监控服务:读者{0},{1}", enterOutLog.CardNo, enterOutLog.Remark)); //等待读者入座 EnterOutLogInfo new_eol = new EnterOutLogInfo(); new_eol.CardNo = waitSeatLoglist[0].CardNo; new_eol.EnterOutLogNo = SeatComm.RndNum(); new_eol.EnterOutState = EnterOutLogType.WaitingSuccess; new_eol.EnterOutType = LogStatus.Valid; new_eol.ReadingRoomNo = waitSeatLoglist[0].ReadingRoomNo; new_eol.Flag = Operation.Service; new_eol.SeatNo = enterOutLog.SeatNo; new_eol.Remark = string.Format("在{0},{1}号座位,等待成功,自动入座", enterOutLog.ReadingRoomName, enterOutLog.SeatNo.Substring(enterOutLog.SeatNo.Length - readingRoom.Setting.SeatNumAmount)); EnterOutOperate.AddEnterOutLog(new_eol, ref logid); //notice.CardNo = enterOutLog.CardNo; //notice.Type = NoticeType.WaitSeatSuccess; //notice.Note = "您等待的座位已经分配给您。"; //T_SM_ReaderNotice.AddReaderNotice(notice); //msg = new PushMsgInfo(); //msg.Title = "您好,您已等待成功"; //msg.MsgType = MsgPushType.ToTime; //msg.StudentNum = enterOutLog.CardNo; //msg.Message = new_eol.Remark; //SeatManage.Bll.T_SM_ReaderNotice.SendPushMsg(msg); WriteLog.Write(string.Format("监控服务:读者{0},{1}", new_eol.CardNo, new_eol.Remark)); if (readingRoom.Setting.IsRecordViolate) { AddViolationRecordByEnterOutLog(enterOutLog, ViolationRecordsType.ShortLeaveByReaderOutTime, string.Format("读者在{0},{1}号座位,被其他读者设置暂离,暂离超时", enterOutLog.ReadingRoomName, enterOutLog.SeatNo.Substring(enterOutLog.SeatNo.Length - readingRoom.Setting.SeatNumAmount)), readingRoom.Setting, nowDateTime); } } catch (Exception ex) { WriteLog.Write(string.Format("监控服务:处理等待读者发生错误:" + 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); } }