Beispiel #1
0
        public string SeatUsedInfo(string ReadingRoomNo)
        {
            try
            {
                if (!Verifylicensing())
                {
                    return("非法操作,此接口未进行授权!");
                }
                if (!checkReadingRoomNo(ReadingRoomNo))
                {
                    return("阅览室编号错误");
                }

                ReadingRoomInfo          room     = GetSingleRoomInfo(ReadingRoomNo);
                ReadingRoomSeatUsedState roomSeat = NowReadingRoomState.GetRoomSeatUsedState(ReadingRoomNo);
                int    allSeat       = roomSeat.SeatAmountAll;  //总座位数
                int    NotSeatPeople = roomSeat.SeatAmountFree; //剩余座位数
                int    usedSeat      = roomSeat.SeatAmountUsed;
                string result        = string.Format("<SeatUsedInfo><RoomName No='{0}' SchoolName='{1}' LibraryName='{2}'>{3}</RoomName><Seat UsedSum='{4}' AllSum='{5}' freeSeat='{6}' /></SeatUsedInfo>", ReadingRoomNo, room.Libaray.School.Name, room.Libaray.Name, room.Name, usedSeat, allSeat, NotSeatPeople);
                return(result);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
        private void ReadingRoomChooseForm_Load(object sender, EventArgs e)
        {
            #region ÏÔʾ´¥ÃþÆÁËù¹ÜÀíµÄÔÄÀÀÊÒ
            int roomCationX = 120; //ÔÄÀÀÊÒºáÏò×ø±ê
            int roomCationY = 140; //ÔÄÀÀÊÒÊúÖ±·½Ïò×ø±ê
            if (clientObject.ClientSetting.DeviceSetting.SystemResoultion.WindowSize.Size.X != 1080)
            {
                roomCationX = 80;
                roomCationY = 130;
            }
            int           roomCount = 0;
            List <string> roomNums  = new List <string>();

            foreach (ReadingRoomInfo room in clientObject.ReadingRoomList.Values)
            {
                roomNums.Add(room.No);
            }
            //»ñÈ¡ÔÄÀÀÊÒ×ùλʹÓÃ״̬
            roomSeatUsingState = NowReadingRoomState.GetRoomSeatUsedState(roomNums);
            foreach (string roomNum in clientObject.ClientSetting.DeviceSetting.Rooms)
            {
                ReadingRoomInfo   room       = clientObject.ReadingRoomList[roomNum];
                ReadingRoomStatus roomStatus = NowReadingRoomState.ReadingRoomOpenState(room.Setting.RoomOpenSet, ServiceDateTime.Now);
                if (roomStatus == ReadingRoomStatus.Close && !clientObject.ClientSetting.DeviceSetting.IsShowClosedRoom)
                {
                    continue;
                }
                ReadingRoomButton btnRoom = InitDrawRoom(room, roomStatus);
                btnRoom.Location = new Point(roomCationX, roomCationY);
                roomCount++;
                if (roomCount % 4 != 0)
                {
                    roomCationX += 220;
                }
                else
                {
                    if (clientObject.ClientSetting.DeviceSetting.SystemResoultion.WindowSize.Size.X != 1080)
                    {
                        roomCationX = 80;
                    }
                    else
                    {
                        roomCationX = 120;
                    }
                    roomCationY += 150;
                }
                this.Controls.Add(btnRoom);
            }
            #endregion

            #region ¹Ø±ÕÔÄÀÀÊÒ

            formClose = new FormCloseCountdown(int.Parse(lblCountdown.Text));
            formClose.EventCountdown += new EventHandler(formClose_EventCountdown);
            #endregion
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (LoginUserInfo == null)
            {
                Response.Redirect(LoginUrl());
                return;
            }
            DataBind();
            int refreshNum = CookiesManager.RefreshNum;

            refreshNum += 1;
            CookiesManager.RefreshNum = refreshNum;
            if (!IsPostBack)
            {
                ShowReaderState();
            }
            spanWarmInfo.InnerText = "";
            spanWarmInfo.Visible   = false;
            if (!Page.IsPostBack && refreshNum < 2)
            {
            }
            else
            {
                cmd = Request.Form["subCmd"];
                //SeatManage.IPocketBookOnlineBll.IMainFunctionPageBll mainFunctionBll = new SeatManage.PocketBookOnLine.Bll.MainFunctionBll();
                ReadingRoomStatus roomState = new ReadingRoomStatus();
                if (LoginUserInfo.AtReadingRoom != null)
                {
                    roomState = NowReadingRoomState.ReadingRoomOpenState(LoginUserInfo.AtReadingRoom.Setting.RoomOpenSet, DateTime.Now);
                }

                switch (cmd)
                {
                case "LoginOut":
                    Session.Clear();
                    Response.Cookies["userInfo"].Expires = DateTime.Now.AddDays(-1);
                    CookiesManager.RefreshNum            = 0;
                    string LogOutUrl = LogoutUrl();
                    if (string.IsNullOrEmpty(LogOutUrl))
                    {
                        Response.Redirect("/seatwap/Login.aspx");
                    }
                    else
                    {
                        Response.Redirect(LogOutUrl);
                    }

                    break;
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// 选座方式验证
        /// </summary>
        /// <param name="clientset">终端选座方式</param>
        /// <param name="roomSelectSeatSet">阅览室设置的选座方式</param>
        /// <returns></returns>
        public static SelectSeatMode ProvenSelectSeatMethod(ClientConfig clientset, SeatChooseMethodSet roomSelectSeatSet)
        {
            SelectSeatMode method = SelectSeatMode.OptionalMode;

            if (clientset.SelectMethod == SelectSeatMode.Default)
            {
                method = NowReadingRoomState.RoomSelectSeatMode(roomSelectSeatSet, ServiceDateTime.Now);
            }
            else
            {
                method = clientset.SelectMethod;
            }
            return(method);
        }
        /// <summary>
        /// 获取使用状态
        /// </summary>
        public void GetUsage()
        {
            ReaderStatusInfo.ReaderInfo = ClientObject.EnterOutLogData.Student;
            DateTime nowDateTime = ServiceDateTime.Now;
            Dictionary <string, ReadingRoomSeatUsedState> roomStateList = EnterOutOperate.GetReadingRoomSeatUsingStateV2(ClientObject.ClientSetting.DeviceSetting.Rooms);

            foreach (KeyValuePair <string, ReadingRoomInfo> item in ClientObject.ReadingRoomList)
            {
                roomStateList[item.Key].SeatAmountAll = StateList[item.Key].AllSeatCount;
                StateList[item.Key].UsedSeatCount     = roomStateList[item.Key].SeatAmountUsed;
                StateList[item.Key].BookingSeatCount  = roomStateList[item.Key].SeatBookingCount;
                StateList[item.Key].Usage             = roomStateList[item.Key].RoomSeatUsingState;
                StateList[item.Key].Status            = NowReadingRoomState.ReadingRoomOpenState(item.Value.Setting.RoomOpenSet, nowDateTime);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 获取使用状态
        /// </summary>
        public void GetUsage()
        {
            DateTime nowDateTime = ServiceDateTime.Now;
            Dictionary <string, ReadingRoomSeatUsedState> roomStateList = EnterOutOperate.GetReadingRoomSeatUsingStateV2(_roomList.Select(item => item.No).ToList());

            foreach (ReadingRoomInfo item in _roomList)
            {
                roomStateList[item.No].SeatAmountAll = StateList[item.No].AllSeatCount;
                StateList[item.No].UsingCount        = roomStateList[item.No].SeatAmountUsed;
                StateList[item.No].BookingCount      = roomStateList[item.No].SeatBookingCount;
                StateList[item.No].UsingStatus       = roomStateList[item.No].RoomSeatUsingState;
                StateList[item.No].RoomStatus        = NowReadingRoomState.ReadingRoomOpenState(item.Setting.RoomOpenSet, nowDateTime);
            }
            LibStatus.AllSeatCount = StateList.Where(u => u.Value.RoomStatus != SeatManage.EnumType.ReadingRoomStatus.Close).Sum(u => u.Value.AllSeatCount);
            LibStatus.BookingCount = StateList.Sum(u => u.Value.BookingCount);
            LibStatus.UsingCount   = StateList.Sum(u => u.Value.UsingCount);
        }
Beispiel #7
0
        public string ReadingRoomState(string ReadingRoomNo)
        {
            try
            {
                if (!Verifylicensing())
                {
                    return("非法操作,此接口未进行授权!");
                }
                if (!checkReadingRoomNo(ReadingRoomNo))
                {
                    return("阅览室编号错误");
                }
                string          result = "";
                ReadingRoomInfo room   = GetSingleRoomInfo(ReadingRoomNo);
                SeatManage.EnumType.ReadingRoomStatus roomState = NowReadingRoomState.ReadingRoomOpenState(room.Setting.RoomOpenSet, DateTime.Now);
                string readingRoomState = "";
                switch (roomState)
                {
                case SeatManage.EnumType.ReadingRoomStatus.Open:
                    readingRoomState = "开放";
                    break;

                case SeatManage.EnumType.ReadingRoomStatus.BeforeOpen:
                    readingRoomState = "即将开馆";
                    break;

                case SeatManage.EnumType.ReadingRoomStatus.Close:
                    readingRoomState = "关闭";
                    break;

                case SeatManage.EnumType.ReadingRoomStatus.BeforeClose:
                    readingRoomState = "即将关闭";
                    break;
                }
                result = string.Format("<ReadingRoomState><RoomName No='{0}' SchoolName='{1}' LibraryName='{2}'>{3}</RoomName><Status>{4}</Status></ReadingRoomState>", ReadingRoomNo, room.Libaray.School.Name, room.Libaray.Name, room.Name, readingRoomState);
                return(result);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
        /// <summary>
        /// 暂离
        /// </summary>
        public void ShortLeave()
        {
            clientobject.EnterOutLogData.EnterOutlog.TerminalNum = clientobject.ClientSetting.ClientNo;
            int newLogId = -1;

            clientobject.EnterOutLogData.EnterOutlog.Remark = string.Format("在终端{0}刷卡暂时离开,保留{1} {2}号座位{3}分钟",
                                                                            clientobject.ClientSetting.ClientNo,
                                                                            clientobject.EnterOutLogData.Student.AtReadingRoom.Name,
                                                                            clientobject.EnterOutLogData.Student.EnterOutLog.ShortSeatNo,
                                                                            NowReadingRoomState.GetSeatHoldTime(clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatHoldTime, ServiceDateTime.Now));
            HandleResult result = EnterOutOperate.AddEnterOutLog(clientobject.EnterOutLogData.EnterOutlog, ref newLogId);//插入进出记录

            if (result == HandleResult.Successed)
            {
                Tip_Framework topform = new Tip_Framework(TipType.ShortLeave, 9);
                topform.ShowDialog();
            }
            else
            {
                //TODO:错误提示
            }
        }
Beispiel #9
0
        /// <summary>
        /// 暂时离开
        /// </summary>
        public void ShortLeave()
        {
            clientobject.ReaderInfo.EnterOutLog.TerminalNum   = clientobject.ClientSetting.ClientNo;
            clientobject.ReaderInfo.EnterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.ShortLeave;
            int newLogId = -1;

            clientobject.ReaderInfo.EnterOutLog.Remark = string.Format("在暂离终端刷卡暂离,保留{1} {2}号座位{3}分钟",
                                                                       clientobject.ClientSetting.ClientNo,
                                                                       clientobject.ReaderInfo.AtReadingRoom.Name,
                                                                       clientobject.ReaderInfo.EnterOutLog.ShortSeatNo,
                                                                       NowReadingRoomState.GetSeatHoldTime(clientobject.ReaderInfo.AtReadingRoom.Setting.SeatHoldTime, ServiceDateTime.Now));
            try
            {
                SeatManage.EnumType.HandleResult result = EnterOutOperate.AddEnterOutLog(clientobject.ReaderInfo.EnterOutLog, ref newLogId);//插入进出记录
                if (result == SeatManage.EnumType.HandleResult.Successed)
                {
                    if (HandleResult != null)
                    {
                        HandleResult(string.Format("   谢谢配合,请在{0}分钟内回来刷卡。", NowReadingRoomState.GetSeatHoldTime(clientobject.ReaderInfo.AtReadingRoom.Setting.SeatHoldTime, ServiceDateTime.Now)), SeatManage.EnumType.HandleResult.Successed);
                    }
                }
                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);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (LoginUserInfo == null)
            {
                Response.Redirect(LoginUrl());
                return;
            }
            DataBind();
            int refreshNum = CookiesManager.RefreshNum;

            refreshNum += 1;
            CookiesManager.RefreshNum = refreshNum;
            if (!IsPostBack)
            {
                LoginUserInfo = handler.GetReaderInfo(LoginUserInfo.CardNo);
                ShowReaderState();
            }
            ShowBookLogs();
            spanWarmInfo.InnerText = "";
            spanWarmInfo.Visible   = false;
            if (!Page.IsPostBack && refreshNum < 2)
            {
            }
            else
            {
                cmd    = Request.Form["subCmd"];
                bookNo = Request.Form["subBookNo"];
                //SeatManage.IPocketBookOnlineBll.IMainFunctionPageBll mainFunctionBll = new SeatManage.PocketBookOnLine.Bll.MainFunctionBll();
                ReadingRoomStatus roomState = new ReadingRoomStatus();
                if (LoginUserInfo.AtReadingRoom != null)
                {
                    roomState = NowReadingRoomState.ReadingRoomOpenState(LoginUserInfo.AtReadingRoom.Setting.RoomOpenSet, DateTime.Now);
                }

                switch (cmd)
                {
                case "shortLeave":
                    shortLeaveHandle();                                          //设置读者暂离
                    LoginUserInfo = handler.GetReaderInfo(LoginUserInfo.CardNo); //重新绑定读者状态
                    ShowReaderState();
                    break;

                case "leave":
                    //释放读者座位
                    freeSeat();
                    LoginUserInfo = handler.GetReaderInfo(LoginUserInfo.CardNo);
                    ShowReaderState();
                    break;

                case "LoginOut":
                    Session.Clear();
                    Response.Cookies["userInfo"].Expires = DateTime.Now.AddDays(-1);
                    CookiesManager.RefreshNum            = 0;
                    Response.Redirect(LogoutUrl());
                    break;

                case "ContinuedWhen":
                    LoginUserInfo = handler.GetReaderInfo(LoginUserInfo.CardNo);
                    if (LoginUserInfo.EnterOutLog != null && LoginUserInfo.EnterOutLog.EnterOutState != EnterOutLogType.Leave)
                    {
                        switch (LoginUserInfo.EnterOutLog.EnterOutState)
                        {
                        case EnterOutLogType.BookingConfirmation:
                        case EnterOutLogType.SelectSeat:
                        case EnterOutLogType.ContinuedTime:
                        case EnterOutLogType.ComeBack:
                        case EnterOutLogType.ReselectSeat:
                        case EnterOutLogType.WaitingSuccess:
                            LoginUserInfo.EnterOutLog.Remark        = "通过手机预约网站延长座位使用时间";
                            LoginUserInfo.EnterOutLog.EnterOutState = EnterOutLogType.ContinuedTime;
                            ContinuedWhen();
                            ShowReaderState();
                            break;

                        case EnterOutLogType.ShortLeave:
                            spanWarmInfo.Visible   = true;
                            spanWarmInfo.InnerText = "续时失败,你处于暂离状态";
                            break;
                        }
                    }
                    else
                    {
                        spanWarmInfo.Visible   = true;
                        spanWarmInfo.InnerText = "续时失败,您还没有选座";
                    }
                    break;

                case "ComeBack":
                    LoginUserInfo = handler.GetReaderInfo(LoginUserInfo.CardNo);
                    if (LoginUserInfo.EnterOutLog != null && LoginUserInfo.EnterOutLog.EnterOutState == EnterOutLogType.ShortLeave)
                    {
                        LoginUserInfo.EnterOutLog.Remark        = "通过手机预约网站恢复在座";
                        LoginUserInfo.EnterOutLog.EnterOutState = EnterOutLogType.ComeBack;
                        ComeBack();
                        ShowReaderState();
                    }
                    spanWarmInfo.Visible   = true;
                    spanWarmInfo.InnerText = "暂离回来失败,您还没有暂离";
                    break;

                case "cancel":
                    CancelBookLog(bookNo);
                    confrimSeat();
                    LoginUserInfo = handler.GetReaderInfo(LoginUserInfo.CardNo);    //重新绑定读者状态
                    ShowReaderState();
                    ShowBookLogs();
                    break;

                case "CancelWait":
                    if (LoginUserInfo.WaitSeatLog != null)
                    {
                        spanWarmInfo.Visible   = true;
                        spanWarmInfo.InnerText = handler.CancelWait(LoginUserInfo.WaitSeatLog);
                        ShowReaderState();
                    }
                    else
                    {
                        spanWarmInfo.Visible   = true;
                        spanWarmInfo.InnerText = "当前没有等待的座位";
                    }
                    break;

                case "CancelBook":
                    if (LoginUserInfo.BespeakLog != null && LoginUserInfo.BespeakLog.Count > 0)
                    {
                        spanWarmInfo.Visible = true;
                        if (handler.UpdateBookLogsState(int.Parse(LoginUserInfo.BespeakLog[0].BsepeaklogID)))
                        {
                            spanWarmInfo.InnerText = "取消预约成功";
                            confrimSeat();
                            LoginUserInfo = handler.GetReaderInfo(LoginUserInfo.CardNo);     //重新绑定读者状态
                            ShowReaderState();
                            ShowBookLogs();
                        }
                        else
                        {
                            spanWarmInfo.InnerText = "取消预约取消失败";
                        }
                    }
                    else
                    {
                        spanWarmInfo.Visible   = true;
                        spanWarmInfo.InnerText = "当前没有预约的座位";
                    }
                    break;

                case "BookConfirm":
                    if (LoginUserInfo.BespeakLog != null && LoginUserInfo.BespeakLog.Count > 0)
                    {
                        confrimSeat();
                        LoginUserInfo = handler.GetReaderInfo(LoginUserInfo.CardNo);     //重新绑定读者状态
                        ShowReaderState();
                        ShowBookLogs();
                    }
                    else
                    {
                        spanWarmInfo.Visible   = true;
                        spanWarmInfo.InnerText = "当前没有预约的座位";
                    }
                    break;
                }
                subCmd.Value = "";
            }
        }
        /// <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();
                }
            }
        }
        /// <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));
            }
        }
Beispiel #13
0
        void seatBtn_Click(object sender, EventArgs e)
        {
            try
            {
                OftenUsedSeatButton seatBtn = sender as OftenUsedSeatButton;
                if (string.IsNullOrEmpty(seatBtn.SeatNo))
                {
                    return;
                }
                ReadingRoomInfo roomInfo = clientobject.ReadingRoomList[seatBtn.ReadingRoomNo];
                if (seatBtn != null)
                {
                    #region 验证黑名单
                    if (SelectSeatProven.ProvenReaderState(clientobject.EnterOutLogData.Student, roomInfo, clientobject.RegulationRulesSet.BlacklistSet, clientobject.ClientSetting.DeviceSetting))
                    {
                        clientobject.EnterOutLogData.EnterOutlog.SeatNo = "";
                        return;
                    }
                    #endregion

                    #region 检查阅览室当前状态
                    ReadingRoomStatus roomState = NowReadingRoomState.ReadingRoomOpenState(roomInfo.Setting.RoomOpenSet, ServiceDateTime.Now);
                    if (roomState == ReadingRoomStatus.Close || roomState == ReadingRoomStatus.BeforeClose)
                    {
                        SeatManage.SeatClient.Tip.Tip_Framework tip = new SeatManage.SeatClient.Tip.Tip_Framework(SeatManage.EnumType.TipType.ReadingRoomClosing, 7);//显示提示窗体
                        tip.ShowDialog();
                        clientobject.EnterOutLogData.EnterOutlog.SeatNo = "";
                        return;
                    }
                    #endregion


                    #region 锁定座位。
                    SeatManage.EnumType.SeatLockState lockseat = T_SM_Seat.LockSeat(seatBtn.SeatNo);
                    if (lockseat == SeatManage.EnumType.SeatLockState.Locked)//座位成功加锁
                    {
                        string roomName = seatBtn.ReadingRoomName;
                        string seatNo   = seatBtn.ShortSeatNo;
                        clientobject.EnterOutLogData.Student.AtReadingRoom     = roomInfo;
                        clientobject.EnterOutLogData.EnterOutlog.SeatNo        = seatBtn.SeatNo;
                        clientobject.EnterOutLogData.EnterOutlog.TerminalNum   = clientobject.ClientSetting.ClientNo;
                        clientobject.EnterOutLogData.FlowControl               = SeatManage.EnumType.ClientOperation.SelectSeat; //操作为选择座位
                        clientobject.EnterOutLogData.EnterOutlog.ReadingRoomNo = seatBtn.ReadingRoomNo;
                        clientobject.EnterOutLogData.EnterOutlog.Remark        = string.Format("在终端{0}选择常坐座位,{1},{2}号座位", clientobject.ClientSetting.ClientNo, roomName, seatNo);
                        this.Close();
                        this.Dispose();
                    }
                    else if (lockseat == SeatManage.EnumType.SeatLockState.UnLock)                                                                             //没有成功加锁
                    {
                        SeatManage.SeatClient.Tip.Tip_Framework tip = new SeatManage.SeatClient.Tip.Tip_Framework(SeatManage.EnumType.TipType.SeatLocking, 7); //显示提示窗体
                        tip.ShowDialog();
                        clientobject.EnterOutLogData.EnterOutlog.SeatNo = "";
                    }
                    #endregion
                }
            }
            catch (Exception ex)
            {
                WriteLog.Write(string.Format("选择常坐座位遇到异常:{0}", ex.Message));
                SeatManage.SeatClient.Tip.Tip_Framework tip = new SeatManage.SeatClient.Tip.Tip_Framework(SeatManage.EnumType.TipType.Exception, 7);//显示提示窗体
                tip.ShowDialog();
                clientobject.EnterOutLogData.EnterOutlog.SeatNo = "";
            }
        }