Esempio n. 1
0
        /// <summary>
        /// 退房逻辑
        /// </summary>
        /// <param name="listCustomerStayInfo"></param>
        /// <returns></returns>
        public bool CheckOutRoom(List <CustomerStayModel> listCustomerStayInfo)
        {
            try
            {
                ObjectControls oCtrl = new ObjectControls();
                foreach (CustomerStayModel mCustomerStay in listCustomerStayInfo)
                {
                    #region 修改房间状态
                    mCustomerStay.RoomInfo.Status = 'C';
                    UpdateRoomStatusByRoomId(mCustomerStay.RoomInfo, new SysUserInfoModel(mCustomerStay.CommonInfo.UpdateUserId));

                    #endregion

                    #region 更新入住信息

                    oCtrl.Reset();
                    oCtrl.Add(MCtrl.SetCustomerStayStatus);
                    oCtrl.Add(MCtrl.SetDeposit);
                    oCtrl.Add(MCtrl.SetEndDate);
                    oCtrl.Add(MCtrl.SetHours);
                    oCtrl.Add(MCtrl.SetNotice);
                    oCtrl.Add(MCtrl.SetPayType);
                    oCtrl.Add(MCtrl.SetPaidMoney);
                    oCtrl.Add(MCtrl.SetStayNo);
                    oCtrl.Add(MCtrl.SetTotal);
                    bCustomerStay.UpdateCustomerStay(mCustomerStay, oCtrl);
                    //退房时将stayhis的入住状态改为离店模式,以区分每个宾客的状态。有时候宾馆房间某一宾客会提前离开,所以需要设置每个宾客的状态。
                    //如提前离开需修改宾客登记,右击宾客详细列表,在菜单中进行离店操作。
                    //如要遇到宾客信息登记错误,需要删除,则启用DELETE键删除即可。
                    if (Cmn.CheckEOF(mCustomerStay.CustomerList))
                    {
                        foreach (CustomerModel mcustomer in mCustomerStay.CustomerList)
                        {
                            CustomerStayHisModel mcshis = mcustomer.CustomerStayHisInfo;

                            //整个房间退房时,将HIS状态不为O的人改为O:OFF 离店.离店时间为现在.如果该宾客以及事先离店,则不更新.
                            if (mcshis.HisStatus != 'O')
                            {
                                oCtrl.Reset();
                                mcshis.HisStatus               = 'O';
                                mcshis.CommonInfo.EndDate      = Cmn.DateBaseDate;
                                mcshis.CommonInfo.UpdateUserId = mCustomerStay.CommonInfo.UpdateUserId;//更新人员为操作员ID
                                oCtrl.Add(MCtrl.SetEndDate);
                                oCtrl.Add(MCtrl.SetHisStatus);
                                bCustomerStay.UpdateStayHis(mcshis, oCtrl);
                            }
                        }
                    }
                    #endregion
                }
                return(true);
            }
            catch (Exception err)
            {
                throw err;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 获取在宾客信息清单
        /// </summary>
        /// <param name="listRoomInfo"></param>
        /// <param name="cStayStatus">该入住单是否在住</param>
        /// <param name="sStayType">宾客类型,主客Or从客</param>
        /// <param name="HisStayStatus">宾客是否退房</param>
        /// <param name="IsCountConsume">是否统计消费</param>
        /// <returns></returns>
        public List <CustomerStayModel> GetStayInRoomInfo(List <BasRoomModel> listRoomInfo, char cStayStatus, string sStayType, bool IsCountConsume)
        {
            List <CustomerStayModel> listCustomerStayInfo = new List <CustomerStayModel>();

            CustomerStayModel mStayInfo = new CustomerStayModel();
            ObjectControls    oCtrl     = new ObjectControls();

            foreach (BasRoomModel mRoom in listRoomInfo)
            {
                mStayInfo.RoomInfo.RoomIdGroup += Cmn.MakeGroup(mRoom.RoomId.ToString());
            }
            mStayInfo.RoomInfo.RoomIdGroup = Cmn.RemoveLastDou(mStayInfo.RoomInfo.RoomIdGroup);

            mStayInfo.Status       = cStayStatus;
            mStayInfo.CustomerList = new List <CustomerModel>();
            CustomerModel mc = new CustomerModel();

            mc.CustomerStayHisInfo = new CustomerStayHisModel();
            if (!string.IsNullOrEmpty(sStayType))
            {
                mc.CustomerStayHisInfo.StayType = Cmn.ToChar(sStayType);
                oCtrl.Add(MCtrl.ByStayType);
            }
            mc.CustomerStayHisInfo.HisStatus = cStayStatus == 'I' ? 'E' : 'O';
            mStayInfo.CustomerList.Add(mc);
            if (Cmn.CheckEOF(listRoomInfo))
            {
                oCtrl.Add(MCtrl.ByRoomIdGroup);
            }
            oCtrl.Add(MCtrl.ByStayStatus);
            oCtrl.Add(MCtrl.ByHisStatus);
            listCustomerStayInfo = bCustomerStay.GetCustomerStayList(mStayInfo, oCtrl);
            if (Cmn.CheckEOF(listCustomerStayInfo) && IsCountConsume)
            {
                foreach (CustomerStayModel mCustomerStay in listCustomerStayInfo)
                {
                    List <ConsumeDetailModel> listGetConsumeDetail = new List <ConsumeDetailModel>();
                    ConsumeDetailModel        mConsume             = new ConsumeDetailModel();
                    mConsume.StayId = mCustomerStay.StayId;
                    oCtrl.Reset();
                    oCtrl.Add(MCtrl.ByStayId);
                    listGetConsumeDetail = bConsume.GetConsumeList(mConsume, oCtrl);
                    if (Cmn.CheckEOF(listGetConsumeDetail))
                    {
                        mCustomerStay.ConSumeDetailList = listGetConsumeDetail;
                    }
                }
            }

            return(listCustomerStayInfo);
        }
Esempio n. 3
0
        /// <summary>
        /// 获取房间有效的预定
        /// </summary>
        /// <param name="mRoom"></param>
        /// <returns></returns>
        public List <OrderInfoModel> GetRoomOrder(BasRoomModel mRoom)
        {
            OrderInfoModel mOrder = new OrderInfoModel();

            mOrder.RoomInfo = mRoom;
            mOrder.KeepDate = Cmn.DateBaseDate;
            mOrder.Status   = 'E';
            ObjectControls oCtrl = new ObjectControls();

            oCtrl.Reset();
            oCtrl.Add(MCtrl.ByRoomId);
            oCtrl.Add(MCtrl.ByKeepDateEnable);
            oCtrl.Add(MCtrl.ByOrderStatus);
            return(bOrder.GetOrderInfo(mOrder, oCtrl));
        }
Esempio n. 4
0
        /// <summary>
        /// 获取宾客入住信息,消费明细
        /// </summary>
        /// <param name="mRoom">房间信息</param>
        /// <param name="cStayStatus">入住状态 I In / O off</param>
        /// <param name="sStayType">入住类型,主客M从客S,如包含主从则为""</param>
        /// <returns></returns>
        public CustomerStayModel GetStayInRoomInfo(BasRoomModel mRoom, char cStayStatus, string sStayType)
        {
            CustomerStayModel mStayInfo = new CustomerStayModel();
            ObjectControls    oCtrl     = new ObjectControls();

            mStayInfo.RoomId       = mRoom.RoomId;
            mStayInfo.Status       = cStayStatus;
            mStayInfo.CustomerList = new List <CustomerModel>();
            CustomerModel mc = new CustomerModel();

            mc.CustomerStayHisInfo = new CustomerStayHisModel();
            if (!string.IsNullOrEmpty(sStayType))
            {
                mc.CustomerStayHisInfo.StayType = Cmn.ToChar(sStayType);
                oCtrl.Add(MCtrl.ByStayType);
            }
            mc.CustomerStayHisInfo.HisStatus = cStayStatus == 'I' ? 'E' : 'O';
            mStayInfo.CustomerList.Add(mc);
            oCtrl.Add(MCtrl.ByRoomId);
            oCtrl.Add(MCtrl.ByStayStatus);
            oCtrl.Add(MCtrl.ByHisStatus);
            CustomerStayModel mCustomerStay = bCustomerStay.GetCustomerStayInfo(mStayInfo, oCtrl);

            if (mCustomerStay != null)
            {
                List <ConsumeDetailModel> listGetConsumeDetail = new List <ConsumeDetailModel>();
                ConsumeDetailModel        mConsume             = new ConsumeDetailModel();
                mConsume.StayId = mCustomerStay.StayId;
                oCtrl.Reset();
                oCtrl.Add(MCtrl.ByStayId);
                listGetConsumeDetail = bConsume.GetConsumeList(mConsume, oCtrl);
                if (Cmn.CheckEOF(listGetConsumeDetail))
                {
                    mCustomerStay.ConSumeDetailList = listGetConsumeDetail;
                }
            }
            return(mCustomerStay);
        }
Esempio n. 5
0
        /// <summary>
        /// 根据一个RoomId获取团队所有房间
        /// </summary>
        /// <param name="mRoom"></param>
        /// <returns></returns>
        public List <BasRoomModel> GetTeamRoomListByRoomId(BasRoomModel mRoom, char cStayStatus)
        {
            CustomerStayModel mCustomerStay = new CustomerStayModel();

            mCustomerStay.RoomId = mRoom.RoomId;
            mCustomerStay.Status = cStayStatus;
            ObjectControls oCtrl = new ObjectControls();

            oCtrl.Add(MCtrl.ByStayStatus);
            oCtrl.Add(MCtrl.ByRoomId);
            CustomerStayModel mC = bCustomerStay.GetCustomerStayInfo(mCustomerStay, oCtrl);

            if (mC.MainRoomId > 0)
            {
                oCtrl.Reset();
                oCtrl.Add(MCtrl.ByStayStatus);
                oCtrl.Add(MCtrl.ByMainRoomId);
                return(bRoom.GetTeamRoomList(mC, oCtrl));
            }
            else
            {
                return(new List <BasRoomModel>());
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 开房以及修改房间信息逻辑.支持房间多人以及团体开房.支持房间人数变更以及宾客信息变更.
        /// </summary>
        /// <param name="listCustomerStayInfo"></param>
        /// <param name="listCustomerInfo"></param>
        /// <param name="eRmType"></param>
        /// <returns></returns>
        public bool OpendOrUpdateRoom(List <CustomerStayModel> listCustomerStayInfo, List <CustomerModel> listCustomerInfo, RoomLogicType eRmType)
        {
            try
            {
                if (listCustomerStayInfo[0].RoomStayType == 'D' && listCustomerStayInfo[0].Hours == 0)
                {
                    throw new Exception("非钟点房,预住天数不能为零.");
                }
                if (eRmType == RoomLogicType.OpenRoom)
                {
                    #region 开单

                    //如团体开房,则每个房间新增一个StayId
                    foreach (CustomerStayModel mCustomerStay in listCustomerStayInfo)
                    {
                        int          nStayId = bCustomerStay.InsertCustomerStay(mCustomerStay);
                        BasRoomModel mRoom   = new BasRoomModel();
                        mRoom.RoomId     = mCustomerStay.RoomId;
                        mRoom.Status     = mCustomerStay.RoomInfo.Status;
                        mRoom.CommonInfo = mCustomerStay.CommonInfo;
                        UpdateRoomStatusByRoomId(mRoom, new SysUserInfoModel(mCustomerStay.CommonInfo.UpdateUserId));
                        //每个房间可能多个入住人员
                        foreach (CustomerModel mCustomer in listCustomerInfo)
                        {
                            //检查宾客信息是否存在,存在则更新较新的信息.姓名和证件号不更新
                            List <CustomerModel> listCustomerOld = GetExistCustomerInfo(mCustomer);
                            int nCustomerId = 0;
                            if (Cmn.CheckEOF(listCustomerOld))
                            {
                                UpdateExsitCustomerInfo(mCustomer, listCustomerOld[0]);
                                nCustomerId = listCustomerOld[0].CustomerId;
                            }
                            else
                            {
                                nCustomerId = bCustomer.InsertCustomer(mCustomer);
                            }
                            CustomerStayHisModel mHis = new CustomerStayHisModel();
                            mHis.StayId               = nStayId;
                            mHis.CustomerId           = nCustomerId;
                            mHis.StayType             = mCustomer.CustomerStayHisInfo.StayType;
                            mHis.HisStatus            = 'E';
                            mHis.CommonInfo           = new CommonModel();
                            mHis.CommonInfo.StartDate = mCustomerStay.CommonInfo.StartDate;
                            mHis.CommonInfo.EndDate   = mCustomerStay.CommonInfo.EndDate;

                            mHis.CommonInfo.CreateDate   = mCustomerStay.CommonInfo.CreateDate;
                            mHis.CommonInfo.CreateUserId = mCustomerStay.CommonInfo.CreateUserId;

                            bCustomerStay.InsertCustomerStayHis(mHis);
                        }
                    }
                    #endregion
                }
                else
                {
                    #region 修改房间信息

                    foreach (CustomerStayModel mCustomerStay in listCustomerStayInfo)
                    {
                        ObjectControls oCtrl = new ObjectControls();
                        oCtrl.Add(MCtrl.SetDeposit);
                        oCtrl.Add(MCtrl.SetMainRoomId);
                        oCtrl.Add(MCtrl.SetNotice);
                        oCtrl.Add(MCtrl.SetPayType);
                        oCtrl.Add(MCtrl.SetRoomId);
                        oCtrl.Add(MCtrl.SetRoomRate);
                        oCtrl.Add(MCtrl.SetCustomerStayStatus);
                        oCtrl.Add(MCtrl.SetRoomStayType);
                        oCtrl.Add(MCtrl.SetEndDate);
                        oCtrl.Add(MCtrl.SetHours);
                        //修改入住信息
                        bCustomerStay.UpdateCustomerStay(mCustomerStay, oCtrl);
                        foreach (CustomerModel mCustomer in listCustomerInfo)
                        {
                            //检查宾客信息是否存在,存在则更新较新的信息.姓名和证件号不更新
                            List <CustomerModel> listCustomerOld = GetExistCustomerInfo(mCustomer);
                            int nCustomerId = 0;
                            if (Cmn.CheckEOF(listCustomerOld))
                            {
                                mCustomer.CommonInfo.UpdateUserId = mCustomerStay.CommonInfo.UpdateUserId;
                                UpdateExsitCustomerInfo(mCustomer, listCustomerOld[0]);
                                nCustomerId = listCustomerOld[0].CustomerId;
                            }
                            else
                            {
                                nCustomerId = bCustomer.InsertCustomer(mCustomer);
                            }
                            CustomerStayHisModel mHis = new CustomerStayHisModel();
                            mHis.StayId     = mCustomerStay.StayId;
                            mHis.CustomerId = nCustomerId;
                            oCtrl.Reset();
                            oCtrl.Add(MCtrl.ByStayId);
                            oCtrl.Add(MCtrl.ByCustomerId);
                            List <CustomerStayHisModel> listStayHis = bCustomerStay.GetStayHis(mHis, oCtrl);
                            if (Cmn.CheckEOF(listStayHis))
                            {
                                mHis.HisId      = listStayHis[0].HisId;
                                mHis.HisStatus  = mCustomer.CustomerStayHisInfo.HisStatus;
                                mHis.StayType   = mCustomer.CustomerStayHisInfo.StayType;
                                mHis.CommonInfo = new CommonModel();
                                mHis.CommonInfo.UpdateUserId = mCustomerStay.CommonInfo.UpdateUserId;
                                oCtrl.Reset();
                                oCtrl.Add(MCtrl.SetHisStatus);
                                oCtrl.Add(MCtrl.SetHisType);
                                //如果用户选择将房间内某一宾客离店,则该宾客的离店时间为现在.开始时间不变
                                if (mHis.HisStatus == 'O')
                                {
                                    mHis.CommonInfo.EndDate = Cmn.DateBaseDate;
                                    oCtrl.Add(MCtrl.SetEndDate);
                                }

                                bCustomerStay.UpdateStayHis(mHis, oCtrl);
                            }
                            else
                            {
                                mHis.StayType   = mCustomer.CustomerStayHisInfo.StayType;
                                mHis.HisStatus  = mCustomer.CustomerStayHisInfo.HisStatus;
                                mHis.CommonInfo = new CommonModel();
                                mHis.CommonInfo.CreateUserId = mCustomerStay.CommonInfo.UpdateUserId;
                                mHis.CommonInfo.UpdateUserId = mCustomerStay.CommonInfo.UpdateUserId;

                                //如宾客为新增加到该房间内的.则他的入住时间从现在开始,到该房间的预住结束时间为止.
                                mHis.CommonInfo.StartDate = Cmn.DateBaseDate;
                                mHis.CommonInfo.EndDate   = mCustomerStay.CommonInfo.EndDate;

                                bCustomerStay.InsertCustomerStayHis(mHis);
                            }
                        }
                    }
                    #endregion
                }
                return(true);
            }
            catch (Exception err)
            {
                throw err;
            }
        }