Ejemplo n.º 1
0
 public StandbyToMasterSyncService(string masterUri, string standbyUri)
 {
     _MasterUri         = masterUri;
     _StandbyUri        = standbyUri;
     _MasterCardBll     = new CardBll(masterUri);
     _MasterPaymentBll  = new CardPaymentRecordBll(masterUri);
     _StandbyCardBll    = new CardBll(standbyUri);
     _StandbyPaymentBll = new CardPaymentRecordBll(standbyUri);
     _SyncInterval      = 5;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 生成操作员结算汇总,如果不指定工作站,则表示汇总结果中包括操作员在所有工作站上的收费情况
        /// </summary>
        /// <param name="opt"></param>
        /// <param name="station"></param>
        /// <returns></returns>
        public OperatorSettleLog CreateOperatorLog(OperatorInfo opt, WorkStationInfo station)
        {
            if (opt != null)
            {
                OperatorSettleLog log = new OperatorSettleLog();
                log.OperatorID     = opt.OperatorName;
                log.SettleDateTime = DateTime.Now;
                if (station != null)
                {
                    log.StationID = station.StationName;
                }
                //查询条件
                RecordSearchCondition recordCon = new RecordSearchCondition();
                recordCon.RecordDateTimeRange = new DateTimeRange(log.SettleFrom == null ? new DateTime(1753, 1, 1, 12, 0, 0) : log.SettleFrom.Value, log.SettleDateTime);
                recordCon.Operator            = opt;
                recordCon.IsUnSettled         = true;
                if (station != null)
                {
                    recordCon.StationID = station.StationName;
                }
                //查询收费记录
                CardPaymentRecordBll   paymentBll     = new CardPaymentRecordBll(_RepoUri);
                List <CardPaymentInfo> paymentRecords = paymentBll.GetItems(recordCon).QueryObjects;
                log.PaymentRecords      = paymentRecords;
                log.CashParkFact        = CashParkFactSum(paymentRecords);
                log.CashOperatorCard    = CashOperatorCardSum(paymentRecords);
                log.CashParkDiscount    = CashParkDiscountSum(paymentRecords);
                log.NonCashParkFact     = NoCashParkFactSum(paymentRecords);
                log.NonCashParkDiscount = NoCashParkDiscountSum(paymentRecords);
                //查询卡片发行记录
                CardBll cbll = new CardBll(_RepoUri);
                List <CardReleaseRecord> cardReleaseRecords = cbll.GetCardReleaseRecords(recordCon).QueryObjects;
                log.ReleaseRecords    = cardReleaseRecords;
                log.CashOfCard       += CashCardReleaseSum(cardReleaseRecords);
                log.CashOfDeposit    += CashDepositSum(cardReleaseRecords);
                log.NonCashOfDeposit += NonCashDepositSum(cardReleaseRecords);
                log.NonCashOfCard    += NonCashCardReleaseSum(cardReleaseRecords);
                //查询卡片延期记录
                List <CardDeferRecord> cardDeferRecords = cbll.GetCardDeferRecords(recordCon).QueryObjects;
                log.DeferRecords   = cardDeferRecords;
                log.CashOfCard    += CashCardDeferSum(cardDeferRecords);
                log.NonCashOfCard += NonCashCardDeferSum(cardDeferRecords);
                //查询卡片充值记录
                List <CardChargeRecord> cardChargeRecords = cbll.GetCardChargeRecords(recordCon).QueryObjects;
                log.ChargeRecords  = cardChargeRecords;
                log.CashOfCard    += CashCardChargeSum(cardChargeRecords);
                log.NonCashOfCard += NonCashCardChargeSum(cardChargeRecords);
                //卡片挂失记录
                List <CardLostRestoreRecord> cardLostRecords = cbll.GetCardLostRestoreRecords(recordCon).QueryObjects;
                log.CardLostRecords   = cardLostRecords;
                log.CashOfCardLost    = CashCardLostSum(cardLostRecords);
                log.NonCashOfCardLost = NonCashCardLostSum(cardLostRecords);
                //查询卡片回收记录
                List <CardRecycleRecord> cardRecycleRecords = cbll.GetCardRecycleRecords(recordCon).QueryObjects;
                log.RecycleRecords     = cardRecycleRecords;
                log.CashOfCardRecycle += CashCardRecycleSum(cardRecycleRecords);
                //查询报警记录
                AlarmSearchCondition alarmCon = new AlarmSearchCondition();
                alarmCon.RecordDateTimeRange = new DateTimeRange(log.SettleFrom == null ? new DateTime(1753, 1, 1, 12, 0, 0) : log.SettleFrom.Value, log.SettleDateTime);
                alarmCon.Operator            = opt;
                alarmCon.IsUnSettled         = true;
                alarmCon.AlarmType           = AlarmType.Opendoor;
                if (station != null)
                {
                    alarmCon.StationID = station.StationName;
                }

                List <AlarmInfo> alarmReocrds = (new AlarmBll(_RepoUri)).GetAlarms(alarmCon).QueryObjects;
                log.OpenDoorCount = alarmReocrds.Count;
                log.AlarmRecords  = alarmReocrds;
                //查询事件
                CardEventSearchCondition eventCon = new CardEventSearchCondition();
                eventCon.RecordDateTimeRange = new DateTimeRange(log.SettleFrom == null ? new DateTime(1753, 1, 1, 12, 0, 0) : log.SettleFrom.Value, log.SettleDateTime);
                eventCon.Operator            = opt;
                eventCon.IsUnSettled         = true;
                eventCon.OnlyExitEvent       = true;
                eventCon.CardType            = CardType.TempCard; //只获取临时卡事件
                if (station != null)
                {
                    eventCon.StationID = station.StationName;
                }

                List <CardEventRecord> handledEvents = (new CardEventBll(_RepoUri)).GetCardEvents(eventCon).QueryObjects;
                log.EventRecords    = handledEvents;
                log.TempCardRecycle = TempCardRecycleSum(handledEvents);
                return(log);
            }
            else
            {
                throw new InvalidOperationException(Resource1.OperatorSettleBLL_noOperator);
            }
        }