/// <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();
                    }
                }
            }
        }
Example #2
0
        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 ChooseSeat()
        {
            //进出记录相关属性赋值。
            clientobject.EnterOutLogData.EnterOutlog.EnterOutLogNo = SeatManage.SeatManageComm.SeatComm.RndNum();
            clientobject.EnterOutLogData.EnterOutlog.EnterOutState = SeatManage.EnumType.EnterOutLogType.SelectSeat;
            clientobject.EnterOutLogData.EnterOutlog.Flag          = SeatManage.EnumType.Operation.Reader;
            clientobject.EnterOutLogData.EnterOutlog.EnterOutType  = SeatManage.EnumType.LogStatus.Valid;

            ReadingRoomWindow readingRoomWindow = new ReadingRoomWindow();

            readingRoomWindow.ShowDialog();
            if (clientobject.EnterOutLogData.FlowControl == SeatManage.EnumType.ClientOperation.Exit)//阅览室选座操作为退出,结束选座流程
            {
                return;
            }
            switch (readingRoomWindow.viewModel.RoomSelectSeatMethod)
            {
            case SelectSeatMode.AutomaticMode:
                string tempSeatNo = T_SM_Seat.RandomAllotSeat(clientobject.EnterOutLogData.EnterOutlog.ReadingRoomNo);
                SeatManage.EnumType.SeatLockState lockseat = T_SM_Seat.LockSeat(tempSeatNo);
                if (lockseat == SeatLockState.Locked)    //座位锁定失败,则提示
                {
                    clientobject.EnterOutLogData.EnterOutlog.Remark      = string.Format("在终端{0}刷卡,自动选择{1} {2}号座位", clientobject.ClientSetting.ClientNo, clientobject.EnterOutLogData.Student.AtReadingRoom.Name, tempSeatNo.Substring(tempSeatNo.Length - clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatNumAmount));
                    clientobject.EnterOutLogData.EnterOutlog.SeatNo      = tempSeatNo;
                    clientobject.EnterOutLogData.EnterOutlog.TerminalNum = clientobject.ClientSetting.ClientNo;
                    clientobject.EnterOutLogData.EnterOutlog.ShortSeatNo = SeatComm.SeatNoToShortSeatNo(clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatNumAmount, clientobject.EnterOutLogData.EnterOutlog.SeatNo);
                }
                else
                {
                    clientobject.EnterOutLogData.EnterOutlog.SeatNo = "";
                    PopupWindow popWindow = new PopupWindow(TipType.SeatLocking);
                    popWindow.ShowDialog();
                }
                break;

            case SelectSeatMode.ManualMode:
                //座位选择的操作为退出,结束选座流程;操作为选座,跳出循环;否则操作为back,继续执行循环操作
                break;
            }
            if (string.IsNullOrEmpty(clientobject.EnterOutLogData.EnterOutlog.ReadingRoomNo) || string.IsNullOrEmpty(clientobject.EnterOutLogData.EnterOutlog.SeatNo))
            {
                //如果阅览室编号或者座位号为空,则不执行插入操作。
                return;
            }
            int          newLogId = -1;
            HandleResult result   = EnterOutOperate.AddEnterOutLog(clientobject.EnterOutLogData.EnterOutlog, ref newLogId);//插入进出记录

            if (result == HandleResult.Successed)
            {
                T_SM_Seat.UnLockSeat(clientobject.EnterOutLogData.EnterOutlog.SeatNo);//记录插入成功,解锁座位
                if (clientobject.EnterOutLogData.WaitSeatLogModel != null)
                {
                    //等待记录的实体不为空,说明当前读者操作为等待座位。
                    //TODO:添加等待记录
                    clientobject.EnterOutLogData.WaitSeatLogModel.EnterOutLogID = newLogId;
                    T_SM_SeatWaiting.AddWaitSeatLog(clientobject.EnterOutLogData.WaitSeatLogModel);
                    PrintData data = new PrintData();
                    data.CardNo          = clientobject.EnterOutLogData.WaitSeatLogModel.CardNo;
                    data.EnterTime       = ServiceDateTime.Now;
                    data.ReaderName      = clientobject.EnterOutLogData.Student.Name;
                    data.ReadingRoomName = clientobject.EnterOutLogData.Student.AtReadingRoom.Name;
                    data.SeatNo          = SeatComm.SeatNoToShortSeatNo(clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatNumAmount, clientobject.EnterOutLogData.EnterOutlog.SeatNo);
                    data.SecCardNo       = clientobject.EnterOutLogData.EnterOutlog.CardNo;
                    double timelength = NowReadingRoomState.GetSeatHoldTime(clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatHoldTime, data.EnterTime);
                    data.WaitEndDateTime = data.EnterTime.AddMinutes(timelength);
                    printer.ThreadPrint(PrintStatus.Wait, data, clientobject.ClientSetting.ClientNo);

                    PopupWindow popWindow = new PopupWindow(TipType.WaitSeatSuccess);
                    popWindow.ShowDialog();
                }
                else
                {
                    PrintData data = new PrintData();
                    data.CardNo          = clientobject.EnterOutLogData.EnterOutlog.CardNo;
                    data.EnterTime       = ServiceDateTime.Now;
                    data.ReaderName      = clientobject.EnterOutLogData.Student.Name;
                    data.ReadingRoomName = clientobject.EnterOutLogData.Student.AtReadingRoom.Name;
                    data.SeatNo          = SeatComm.SeatNoToShortSeatNo(clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatNumAmount, clientobject.EnterOutLogData.EnterOutlog.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.SelectSeatResult);
                    popWindow.ShowDialog();
                }
            }
        }
        /// <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 ChooseSeat()
        {
            //进出记录相关属性赋值。
            clientobject.EnterOutLogData.EnterOutlog.EnterOutLogNo = SeatManage.SeatManageComm.SeatComm.RndNum();
            clientobject.EnterOutLogData.EnterOutlog.EnterOutState = SeatManage.EnumType.EnterOutLogType.SelectSeat;
            clientobject.EnterOutLogData.EnterOutlog.Flag          = SeatManage.EnumType.Operation.Reader;
            clientobject.EnterOutLogData.EnterOutlog.EnterOutType  = SeatManage.EnumType.LogStatus.Valid;

            ReadingRoom frmReadingRoom = new ReadingRoom();

            WPF_Seat.SeatForm seat = WPF_Seat.SeatForm.GetInstance();
            //while (true)
            //{
            frmReadingRoom.ShowDialog();

            if (clientobject.EnterOutLogData.FlowControl == SeatManage.EnumType.ClientOperation.Exit)//阅览室选座操作为退出,结束选座流程
            {
                frmReadingRoom.Close();
                return;
            }
            switch (frmReadingRoom.RoomSelectSeatMethod)
            {
            case SelectSeatMode.AutomaticMode:
                string tempSeatNo = T_SM_Seat.RandomAllotSeat(clientobject.EnterOutLogData.EnterOutlog.ReadingRoomNo);
                SeatManage.EnumType.SeatLockState lockseat = T_SM_Seat.LockSeat(tempSeatNo);
                if (lockseat == SeatLockState.Locked)    //座位锁定失败,则提示
                {
                    clientobject.EnterOutLogData.EnterOutlog.Remark      = string.Format("在终端{0}刷卡,自动选择{1} {2}号座位", clientobject.ClientSetting.ClientNo, clientobject.EnterOutLogData.Student.AtReadingRoom.Name, tempSeatNo.Substring(tempSeatNo.Length - clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatNumAmount));
                    clientobject.EnterOutLogData.EnterOutlog.SeatNo      = tempSeatNo;
                    clientobject.EnterOutLogData.EnterOutlog.TerminalNum = clientobject.ClientSetting.ClientNo;
                }
                else
                {
                    clientobject.EnterOutLogData.EnterOutlog.SeatNo = "";
                    SeatManage.SeatClient.Tip.Tip_Framework tip = new SeatManage.SeatClient.Tip.Tip_Framework(SeatManage.EnumType.TipType.SeatLocking, 8);    //显示提示窗体
                    tip.ShowDialog();
                }
                break;

            case SelectSeatMode.ManualMode:
                seat.DrowSeatUsedInfo();
                seat.ShowDialog();
                //座位选择的操作为退出,结束选座流程;操作为选座,跳出循环;否则操作为back,继续执行循环操作
                break;
                //}

                if (clientobject.EnterOutLogData.FlowControl == SeatManage.EnumType.ClientOperation.Exit)
                {
                    frmReadingRoom.Close();
                    return;
                }
                else if (clientobject.EnterOutLogData.FlowControl == SeatManage.EnumType.ClientOperation.SelectSeat)
                {
                    frmReadingRoom.Close();
                    break;
                }
            }
            if (string.IsNullOrEmpty(clientobject.EnterOutLogData.EnterOutlog.ReadingRoomNo) || string.IsNullOrEmpty(clientobject.EnterOutLogData.EnterOutlog.SeatNo))
            {
                //如果阅览室编号或者座位号为空,则不执行插入操作。
                frmReadingRoom.Close();
                return;
            }
            int          newLogId = -1;
            HandleResult result   = EnterOutOperate.AddEnterOutLog(clientobject.EnterOutLogData.EnterOutlog, ref newLogId);//插入进出记录

            frmReadingRoom.Dispose();
            if (result == HandleResult.Successed)
            {
                T_SM_Seat.UnLockSeat(clientobject.EnterOutLogData.EnterOutlog.SeatNo);//记录插入成功,解锁座位
                if (clientobject.EnterOutLogData.WaitSeatLogModel != null)
                {
                    //等待记录的实体不为空,说明当前读者操作为等待座位。
                    //TODO:添加等待记录
                    clientobject.EnterOutLogData.WaitSeatLogModel.EnterOutLogID = newLogId;
                    T_SM_SeatWaiting.AddWaitSeatLog(clientobject.EnterOutLogData.WaitSeatLogModel);
                    PrintData data = new PrintData();
                    data.CardNo          = clientobject.EnterOutLogData.WaitSeatLogModel.CardNo;
                    data.EnterTime       = ServiceDateTime.Now;
                    data.ReaderName      = clientobject.EnterOutLogData.Student.Name;
                    data.ReadingRoomName = clientobject.EnterOutLogData.Student.AtReadingRoom.Name;
                    data.SeatNo          = SeatComm.SeatNoToShortSeatNo(clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatNumAmount, clientobject.EnterOutLogData.EnterOutlog.SeatNo);
                    data.SecCardNo       = clientobject.EnterOutLogData.EnterOutlog.CardNo;
                    double timelength = NowReadingRoomState.GetSeatHoldTime(clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatHoldTime, data.EnterTime);
                    data.WaitEndDateTime = data.EnterTime.AddMinutes(timelength);
                    printer.Print(PrintStatus.Wait, data, clientobject.ClientSetting.ClientNo);

                    Tip_Framework topform = new Tip_Framework(TipType.WaitSeatSuccess, 9);
                    topform.OperateResule = result;
                    topform.ShowDialog();
                }
                else
                {
                    PrintData data = new PrintData();
                    data.CardNo          = clientobject.EnterOutLogData.EnterOutlog.CardNo;
                    data.EnterTime       = ServiceDateTime.Now;
                    data.ReaderName      = clientobject.EnterOutLogData.Student.Name;
                    data.ReadingRoomName = clientobject.EnterOutLogData.Student.AtReadingRoom.Name;
                    data.SeatNo          = SeatComm.SeatNoToShortSeatNo(clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatNumAmount, clientobject.EnterOutLogData.EnterOutlog.SeatNo);
                    if (clientobject.ClientSetting.DeviceSetting.UsingPrintSlip)
                    {
                        printer.Print(PrintStatus.General, data, clientobject.ClientSetting.ClientNo);
                    }
                    //提示选座成功
                    Tip_Framework topform = new Tip_Framework(TipType.SelectSeatResult, 9);
                    topform.OperateResule = result;
                    topform.ShowDialog();
                }
            }
        }
Example #7
0
        /// <summary>
        /// 等待座位
        /// </summary>
        /// <returns></returns>
        public bool WaitSeat(SeatButton seatBtn)
        {
            WaitSeatLogInfo lastWaitInfo = T_SM_SeatWaiting.GetListWaitLogByCardNo(clientObject.EnterOutLogData.EnterOutlog.CardNo, clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo);
            ReadingRoomInfo roomInfo     = clientObject.EnterOutLogData.Student.AtReadingRoom;


            if (!string.IsNullOrEmpty(clientObject.EnterOutLogData.EnterOutlog.SeatNo))
            {
                MessageWindow popWindow = new MessageWindow(SeatManage.EnumType.MessageType.WaitSeatWithSeat);
                CountDown.Pause();
                popWindow.ShowDialog();
                CountDown.Start();
                return(false);
            }

            if (lastWaitInfo != null && lastWaitInfo.SeatWaitTime.AddMinutes(roomInfo.Setting.NoManagement.OperatingInterval).CompareTo(ServiceDateTime.Now) >= 0)
            {
                clientObject.EnterOutLogData.Student.WaitSeatLog = lastWaitInfo;
                MessageWindow popWindow = new MessageWindow(SeatManage.EnumType.MessageType.WaitSeatFrequent);
                CountDown.Pause();
                popWindow.ShowDialog();
                CountDown.Start();
                return(false);
            }
            SeatManage.EnumType.SeatLockState lockseat = T_SM_Seat.LockSeat(seatBtn.SeatNo);
            if (lockseat == SeatManage.EnumType.SeatLockState.Locked)//座位成功加锁
            {
                clientObject.EnterOutLogData.WaitSeatLogModel = new WaitSeatLogInfo()
                {
                    SeatNo = seatBtn.ShortSeatNo
                };
                MessageWindow popWindow = new MessageWindow(SeatManage.EnumType.MessageType.WaitSeatConfirm);
                CountDown.Pause();
                popWindow.ShowDialog();
                CountDown.Start();
                if (popWindow.viewModel.OperateResule == SeatManage.EnumType.HandleResult.Successed)
                {
                    //初始化等待记录 记录ID需要待执行之后添加。
                    WaitSeatLogInfo waitInfo = new WaitSeatLogInfo();
                    waitInfo.CardNo       = clientObject.EnterOutLogData.EnterOutlog.CardNo;
                    waitInfo.NowState     = SeatManage.EnumType.LogStatus.Valid;
                    waitInfo.OperateType  = SeatManage.EnumType.Operation.Reader;
                    waitInfo.WaitingState = SeatManage.EnumType.EnterOutLogType.Waiting;

                    EnterOutLogInfo seatUsingEnterOutInfo = SeatManage.Bll.T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatBtn.SeatNo);
                    seatUsingEnterOutInfo.EnterOutState = SeatManage.EnumType.EnterOutLogType.ShortLeave;
                    seatUsingEnterOutInfo.EnterOutType  = SeatManage.EnumType.LogStatus.Valid;
                    seatUsingEnterOutInfo.Flag          = SeatManage.EnumType.Operation.OtherReader;
                    seatUsingEnterOutInfo.TerminalNum   = clientObject.ClientSetting.ClientNo;
                    seatUsingEnterOutInfo.Remark        = string.Format("在{0} {1}号座位,被读者{2}在终端{3}设置为暂离并等待该座位", seatUsingEnterOutInfo.ReadingRoomName, seatUsingEnterOutInfo.ShortSeatNo, waitInfo.CardNo, clientObject.ClientSetting.ClientNo);

                    clientObject.EnterOutLogData.EnterOutlog      = seatUsingEnterOutInfo; //要等待读者的暂离记录
                    clientObject.EnterOutLogData.WaitSeatLogModel = waitInfo;              //等待记录

                    return(true);
                }
                else
                {
                    T_SM_Seat.UnLockSeat(seatBtn.SeatNo);//确认窗口点击取消或者自动关闭,则解锁。
                }
            }
            else if (lockseat == SeatManage.EnumType.SeatLockState.UnLock)//没有成功加锁
            {
                MessageWindow popWindow = new MessageWindow(SeatManage.EnumType.MessageType.SeatIsLocked);
                CountDown.Pause();
                popWindow.ShowDialog();
                CountDown.Start();
            }
            return(false);
        }
Example #8
0
        /// <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>
        /// <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));
            }
        }
Example #11
0
        /// <summary>
        /// 读者等待座位
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void seatBtn_WaitSeat(object sender, MouseButtonEventArgs e)
        {
            WaitSeatLogInfo lastWaitInfo = T_SM_SeatWaiting.GetListWaitLogByCardNo(clientobject.EnterOutLogData.EnterOutlog.CardNo, clientobject.EnterOutLogData.EnterOutlog.ReadingRoomNo);
            ReadingRoomInfo roomInfo     = clientobject.EnterOutLogData.Student.AtReadingRoom;


            if (!string.IsNullOrEmpty(clientobject.EnterOutLogData.EnterOutlog.SeatNo))
            {
                SeatManage.SeatClient.Tip.Tip_Framework tipForm = new SeatManage.SeatClient.Tip.Tip_Framework(SeatManage.EnumType.TipType.WaitSeatWithSeat, 7);
                countDownSeconds.Pause();
                tipForm.ShowDialog();
                countDownSeconds.Start();
                return;
            }

            if (lastWaitInfo != null && lastWaitInfo.SeatWaitTime.AddMinutes(roomInfo.Setting.NoManagement.OperatingInterval).CompareTo(ServiceDateTime.Now) >= 0)
            {
                SeatManage.SeatClient.Tip.Tip_Framework tipForm = new SeatManage.SeatClient.Tip.Tip_Framework(SeatManage.EnumType.TipType.WaitSeatFrequent, 7);
                countDownSeconds.Pause();
                tipForm.ShowDialog();
                countDownSeconds.Start();
                return;
            }
            SeatButton seatBtn = sender as SeatButton;

            SeatManage.EnumType.SeatLockState lockseat = T_SM_Seat.LockSeat(seatBtn.SeatNo);
            if (lockseat == SeatManage.EnumType.SeatLockState.Locked)//座位成功加锁
            {
                SetShortWarning warnForm = new SetShortWarning(seatBtn.ShortSeatNo);
                countDownSeconds.Pause();
                warnForm.ShowDialog();
                countDownSeconds.Start();
                if (warnForm.IsTrue)
                {
                    //初始化等待记录 记录ID需要待执行之后添加。
                    WaitSeatLogInfo waitInfo = new WaitSeatLogInfo();
                    waitInfo.CardNo       = clientobject.EnterOutLogData.EnterOutlog.CardNo;
                    waitInfo.NowState     = SeatManage.EnumType.LogStatus.Valid;
                    waitInfo.OperateType  = SeatManage.EnumType.Operation.Reader;
                    waitInfo.WaitingState = SeatManage.EnumType.EnterOutLogType.Waiting;

                    EnterOutLogInfo seatUsingEnterOutInfo = SeatManage.Bll.T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatBtn.SeatNo);
                    seatUsingEnterOutInfo.EnterOutState = SeatManage.EnumType.EnterOutLogType.ShortLeave;
                    seatUsingEnterOutInfo.EnterOutType  = SeatManage.EnumType.LogStatus.Valid;
                    seatUsingEnterOutInfo.Flag          = SeatManage.EnumType.Operation.OtherReader;
                    seatUsingEnterOutInfo.TerminalNum   = clientobject.ClientSetting.ClientNo;
                    seatUsingEnterOutInfo.Remark        = string.Format("在{0} {1}号座位,被读者{2}在终端{3}设置为暂离并等待该座位", seatUsingEnterOutInfo.ReadingRoomName, seatUsingEnterOutInfo.ShortSeatNo, waitInfo.CardNo, clientobject.ClientSetting.ClientNo);

                    clientobject.EnterOutLogData.EnterOutlog      = seatUsingEnterOutInfo; //要等待读者的暂离记录
                    clientobject.EnterOutLogData.WaitSeatLogModel = waitInfo;              //等待记录
                    this.Hide();
                }
                else
                {
                    T_SM_Seat.UnLockSeat(seatBtn.SeatNo);//确认窗口点击取消或者自动关闭,则解锁。
                }
            }
            else if (lockseat == SeatManage.EnumType.SeatLockState.UnLock)                                                                                                                    //没有成功加锁
            {
                SeatManage.SeatClient.Tip.Tip_Framework tip = new SeatManage.SeatClient.Tip.Tip_Framework(SeatManage.EnumType.TipType.SeatLocking, frmResolution.ViewModel.CountDownSeconds); //显示提示窗体
                tip.ShowDialog();

                drowSeatLayout();
            }
        }
        /// <summary>
        /// 选座操作
        /// </summary>
        public void ChooseSeat()
        {
            //进出记录相关属性赋值。
            Clientobject.EnterOutLogData.EnterOutlog.EnterOutLogNo = SeatComm.RndNum();
            Clientobject.EnterOutLogData.EnterOutlog.EnterOutState = EnterOutLogType.SelectSeat;
            Clientobject.EnterOutLogData.EnterOutlog.Flag          = Operation.Reader;
            Clientobject.EnterOutLogData.EnterOutlog.EnterOutType  = LogStatus.Valid;
            ReadingRoomWindowObject.GetInstance().Window.ShowMessage();
            //阅览室选座操作为退出,结束选座流程
            if (Clientobject.EnterOutLogData.FlowControl == ClientOperation.Exit)
            {
                return;
            }
            //返回为自动选座
            if (string.IsNullOrEmpty(Clientobject.EnterOutLogData.EnterOutlog.ReadingRoomNo) || string.IsNullOrEmpty(Clientobject.EnterOutLogData.EnterOutlog.SeatNo))
            {
                //如果阅览室编号或者座位号为空,则不执行插入操作。
                if (!string.IsNullOrEmpty(Clientobject.EnterOutLogData.EnterOutlog.SeatNo))
                {
                    T_SM_Seat.UnLockSeat(Clientobject.EnterOutLogData.EnterOutlog.SeatNo);
                }
                PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.Exception);
                return;
            }
            int newLogId = -1;

            if (EnterOutOperate.AddEnterOutLog(Clientobject.EnterOutLogData.EnterOutlog, ref newLogId) == HandleResult.Failed)
            {
                PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.Exception);
                return;
            }
            T_SM_Seat.UnLockSeat(Clientobject.EnterOutLogData.EnterOutlog.SeatNo);//记录插入成功,解锁座位

            if (Clientobject.EnterOutLogData.FlowControl == ClientOperation.WaitSeat)
            {
                //SeatManage.ClassModel.ReaderNoticeInfo rni = new SeatManage.ClassModel.ReaderNoticeInfo();
                //rni.CardNo = Clientobject.EnterOutLogData.EnterOutlog.CardNo;
                //rni.Type = NoticeType.OtherSetShortLeaveWarning;
                //rni.Note = Clientobject.EnterOutLogData.EnterOutlog.Remark;
                //SeatManage.Bll.T_SM_ReaderNotice.AddReaderNotice(rni);

                //PushMsgInfo msg = new PushMsgInfo();
                //msg.Title = "您好,您已被设置为暂离";
                //msg.MsgType = MsgPushType.OtherUser;
                //msg.StudentNum = Clientobject.EnterOutLogData.EnterOutlog.CardNo;
                //msg.Message = Clientobject.EnterOutLogData.EnterOutlog.Remark;
                //SeatManage.Bll.T_SM_ReaderNotice.SendPushMsg(msg);

                //TODO:添加等待记录
                Clientobject.EnterOutLogData.WaitSeatLogModel.EnterOutLogID = newLogId;
                if (T_SM_SeatWaiting.AddWaitSeatLog(Clientobject.EnterOutLogData.WaitSeatLogModel) > 0)
                {
                    PrintData data;
                    switch (Clientobject.ClientSetting.DeviceSetting.UsingPrintSlip)
                    {
                    case PrintSlipMode.AutoPrint:
                        data                 = new PrintData();
                        data.CardNo          = Clientobject.EnterOutLogData.WaitSeatLogModel.CardNo;
                        data.EnterTime       = ServiceDateTime.Now;
                        data.ReaderName      = Clientobject.EnterOutLogData.Student.Name;
                        data.ReadingRoomName = Clientobject.EnterOutLogData.Student.AtReadingRoom.Name;
                        data.SeatNo          = SeatComm.SeatNoToShortSeatNo(Clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatNumAmount, Clientobject.EnterOutLogData.EnterOutlog.SeatNo);
                        data.SecCardNo       = Clientobject.EnterOutLogData.EnterOutlog.CardNo;
                        data.WaitEndDateTime = data.EnterTime.AddMinutes(Clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.GetSeatHoldTime(data.EnterTime));

                        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)
                        {
                            data                 = new PrintData();
                            data.CardNo          = Clientobject.EnterOutLogData.WaitSeatLogModel.CardNo;
                            data.EnterTime       = ServiceDateTime.Now;
                            data.ReaderName      = Clientobject.EnterOutLogData.Student.Name;
                            data.ReadingRoomName = Clientobject.EnterOutLogData.Student.AtReadingRoom.Name;
                            data.SeatNo          = SeatComm.SeatNoToShortSeatNo(Clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatNumAmount, Clientobject.EnterOutLogData.EnterOutlog.SeatNo);
                            data.SecCardNo       = Clientobject.EnterOutLogData.EnterOutlog.CardNo;
                            data.WaitEndDateTime = data.EnterTime.AddMinutes(Clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.GetSeatHoldTime(data.EnterTime));

                            printer.ThreadPrint(PrintStatus.General, data, Clientobject.ClientSetting.ClientNo);
                        }
                        break;

                    case PrintSlipMode.NotPrint:
                        break;
                    }
                    PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.WaitSeatSuccess);
                }
                else
                {
                    PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.Exception);
                }
            }
            else
            {
                PrintData data;
                switch (Clientobject.ClientSetting.DeviceSetting.UsingPrintSlip)
                {
                case PrintSlipMode.AutoPrint:
                    data                 = new PrintData();
                    data.CardNo          = Clientobject.EnterOutLogData.EnterOutlog.CardNo;
                    data.EnterTime       = ServiceDateTime.Now;
                    data.ReaderName      = Clientobject.EnterOutLogData.Student.Name;
                    data.ReadingRoomName = Clientobject.EnterOutLogData.Student.AtReadingRoom.Name;
                    data.SeatNo          = SeatComm.SeatNoToShortSeatNo(Clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatNumAmount, Clientobject.EnterOutLogData.EnterOutlog.SeatNo);

                    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)
                    {
                        data                 = new PrintData();
                        data.CardNo          = Clientobject.EnterOutLogData.EnterOutlog.CardNo;
                        data.EnterTime       = ServiceDateTime.Now;
                        data.ReaderName      = Clientobject.EnterOutLogData.Student.Name;
                        data.ReadingRoomName = Clientobject.EnterOutLogData.Student.AtReadingRoom.Name;
                        data.SeatNo          = SeatComm.SeatNoToShortSeatNo(Clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatNumAmount, Clientobject.EnterOutLogData.EnterOutlog.SeatNo);

                        printer.ThreadPrint(PrintStatus.General, data, Clientobject.ClientSetting.ClientNo);
                    }
                    break;

                case PrintSlipMode.NotPrint:
                    break;
                }
                //提示选座成功
                PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.SelectSeatResult);
            }
        }
        /// <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);
            }
        }