Пример #1
0
        private void ShowLogInfo(OperatorSettleLog log)
        {
            this.lblOperator.Text       = log.OperatorID;
            this.lblSettleDateTime.Text = log.SettleDateTime.ToString("yyyy-MM-dd HH;mm:ss");

            this.txtCashOfPark.Text         = log.CashParkFact.ToString("F2");
            this.txtCashOfOperatorCard.Text = log.CashOperatorCard.ToString("F2");
            this.txtCashDiscount.Text       = log.CashParkDiscount.ToString("F2");
            this.txtCashOfCard.Text         = log.CashOfCard.ToString("F2");;
            this.txtCashOfDeposit.Text      = log.CashOfDeposit.ToString("F2");
            this.txtCashOfCardLost.Text     = log.CashOfCardLost.ToString("F2");
            this.txtCashOfCardRecycle.Text  = log.CashOfCardRecycle.ToString("F2");
            this.txtCashTotal.Text          = log.TotalCash.ToString("F2");
            this.txtHandInCash.Text         = log.HandInCash == null ? string.Empty : log.HandInCash.Value.ToString("F2");
            this.txtCashDiffrence.Text      = log.CashDiffrence == null ? string.Empty : log.CashDiffrence.Value.ToString("F2");

            this.txtNonCashOfPark.Text     = log.NonCashParkFact.ToString("F2");;
            this.txtNonCashDiscount.Text   = log.NonCashParkDiscount.ToString("F2");
            this.txtNonCashOfCard.Text     = log.NonCashOfCard.ToString("F2");;
            this.txtNonCashOfDeposit.Text  = log.NonCashOfDeposit.ToString("F2");;
            this.txtNonCashOfCardLost.Text = log.NonCashOfCardLost.ToString("F2");
            this.txtNonCashTotal.Text      = log.TotalNonCash.ToString("F2");;

            this.txtTempCardRecycle.Text = log.TempCardRecycle.ToString();
            this.txtOpenDoorCount.Text   = log.OpenDoorCount.ToString();
        }
Пример #2
0
 public void PrintOperatorSettleLog(OperatorSettleLog settleLog)
 {
     InitControls();
     ShowLogInfo(settleLog, 1);
     btnPrint_Click(this.btnPrint, EventArgs.Empty);
     this.DialogResult = DialogResult.Cancel;
 }
Пример #3
0
 private void mnu_PrintMonthCardPayment_Click(object sender, EventArgs e)
 {
     try
     {
         DataGridViewRow   row    = GridView.SelectedRows[0];
         OperatorSettleLog optLog = row.Tag as OperatorSettleLog;
         if (optLog != null)
         {
             string path  = string.Empty;
             string modal = System.IO.Path.Combine(Application.StartupPath, @"ReportModal\MonthCardPaymentReportModal.xls");
             ExcelExport.MonthCardReportToExcel ose = null;
             if (System.IO.File.Exists(modal))
             {
                 ose = new ExcelExport.MonthCardReportToExcel(modal);
                 ose.PrintByExcel(optLog);
             }
             else
             {
                 MessageBox.Show(Resources.Resource1.FrmOperatorLogReport_NotFind, Resources.Resource1.Form_Alert);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, Resources.Resource1.Form_Alert);
         Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
     }
 }
Пример #4
0
 private void mnu_ExportCardPayment_Click(object sender, EventArgs e)
 {
     try
     {
         DataGridViewRow   row    = GridView.SelectedRows[0];
         OperatorSettleLog optLog = row.Tag as OperatorSettleLog;
         if (optLog != null)
         {
             string path  = string.Empty;
             string modal = System.IO.Path.Combine(Application.StartupPath, @"ReportModal\CardPaymentReportModal.xls");
             path = System.IO.Path.Combine(TempFolderManager.GetCurrentFolder(), Guid.NewGuid().ToString() + ".xls");
             ExcelExport.CardPaymentReportToExcel ose = null;
             if (System.IO.File.Exists(modal))
             {
                 ose = new ExcelExport.CardPaymentReportToExcel(modal);
                 ose.Export(optLog, path);
                 System.Diagnostics.Process.Start(path);
             }
             else
             {
                 MessageBox.Show(Resources.Resource1.FrmOperatorLogReport_NotFind, Resources.Resource1.Form_Alert);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, Resources.Resource1.Form_Alert);
         Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
     }
 }
Пример #5
0
 private static void ShowOperatorSettleOnRow(OperatorSettleLog record, DataGridViewRow row)
 {
     row.Tag = record;
     row.Cells["colOperatorID"].Value = record.OperatorID;
     //row.Cells["colDept"].Value = dept;
     row.Cells["colDept"].Value              = record.Dept != null ? record.Dept.DeptName : string.Empty;
     row.Cells["colSettleDateTime"].Value    = record.SettleDateTime;
     row.Cells["colCashParkFact"].Value      = record.CashParkFact;
     row.Cells["colCashOperatorCard"].Value  = record.CashOperatorCard;
     row.Cells["colCashOfPOS"].Value         = (record.CashOfPOS == null ? 0 : record.CashOfPOS.Value).ToString("F2");
     row.Cells["colCashDiscount"].Value      = record.CashParkDiscount;
     row.Cells["colCashOfCard"].Value        = record.CashOfCard;
     row.Cells["colCashOfDeposit"].Value     = record.CashOfDeposit;
     row.Cells["colCashOfCardRecycle"].Value = record.CashOfCardRecycle;
     row.Cells["colCashOfCardLost"].Value    = record.CashOfCardLost;
     row.Cells["colCashOfRefund"].Value      = record.CashOfRefund == null ? "0.00" : record.CashOfRefund.Value.ToString("F2");
     row.Cells["colTotalCash"].Value         = record.TotalCash;
     row.Cells["colHandInCash"].Value        = record.HandInCash == null ? string.Empty : record.HandInCash.Value.ToString("F2");
     row.Cells["colCashDiffrence"].Value     = record.CashDiffrence == null ? string.Empty : record.CashDiffrence.Value.ToString("F2");
     row.Cells["colNonCashParkFact"].Value   = record.NonCashParkFact;
     row.Cells["colNonCashDiscount"].Value   = record.NonCashParkDiscount;
     row.Cells["colNonCashOfCard"].Value     = record.NonCashOfCard;
     row.Cells["colNonCashOfDeposit"].Value  = record.NonCashOfDeposit;
     row.Cells["colNonCashOfCardLost"].Value = record.NonCashOfCardLost;
     row.Cells["colTotalNonCash"].Value      = record.TotalNonCash;
     row.Cells["colHandInPOS"].Value         = record.HandInPOS == null ? string.Empty : record.HandInPOS.Value.ToString("F2");
     row.Cells["colOpenDoorCount"].Value     = record.OpenDoorCount;
     row.Cells["colTempCardRecycle"].Value   = record.TempCardRecycle;
 }
Пример #6
0
        /// <summary>
        /// 导出操作员当班信息到EXCEL中
        /// </summary>
        /// <param name="optLog"></param>
        public void Export(OperatorSettleLog optLog, string path)
        {
            RecordSearchCondition recordCon = new RecordSearchCondition();

            recordCon.SettleDateTime = optLog.SettleDateTime;

            Application app  = new Application();
            Workbook    book = null;

            book = app.Workbooks.Add(ReportModal);
            Worksheet sheet = book.ActiveSheet as Worksheet;

            FillOperatorLog(sheet, optLog, 3);

            List <CardPaymentInfo> cardPaymentRecords = (new CardPaymentRecordBll(AppSettings.CurrentSetting.ParkConnect)).GetItems(recordCon).QueryObjects;

            cardPaymentRecords = (from card in cardPaymentRecords
                                  where card.PaymentCode != PaymentCode.APM
                                  orderby card.PaymentCode, card.ChargeDateTime descending
                                  select card).ToList();
            FillDetail(sheet, cardPaymentRecords, 6);
            book.SaveAs(path, XlFileFormat.xlXMLSpreadsheet, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                        XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
            book.Close(false, Type.Missing, Type.Missing);
        }
Пример #7
0
        private void FrmOperatorShift_Load(object sender, EventArgs e)
        {
            InitControls();
            if (Operator != null)
            {
                string temp = AppSettings.CurrentSetting.GetConfigContent("AutoPrintSettleInfo");
                this.chkAutoPrint.Checked = temp == "True";

                _OperatorLog            = (new OperatorSettleBLL(AppSettings.CurrentSetting.ParkConnect)).CreateOperatorLog(Operator, Station);
                _OperatorLog.HandInCash = HandInCash;
                _OperatorLog.HandInPOS  = HandInPOS;
                if (OperatorCard != null)
                {
                    _OperatorLog.CashOperatorCard = OperatorCard.ParkFee;
                }
                ShowLogInfo(_OperatorLog, 0);

                //如果设置了结算时需输入上交金额,自动保存结算记录,成功后把结算按钮的文字改成“确定",
                //并在用户点击确认时只是打印结算单,而不用再保存结算记录
                if (UserSetting.Current.InputHandInCashWhenSettle)
                {
                    OperatorSettleBLL bllOperatorLog = new OperatorSettleBLL(AppSettings.CurrentSetting.ParkConnect);
                    CommandResult     ret            = bllOperatorLog.Settle(_OperatorLog);
                    if (ret.Result == ResultCode.Successful)
                    {
                        butOK.Text = Resources.Resource1.FrmOperatorSettle_OK;
                    }
                }
            }
        }
Пример #8
0
        private void FillOperatorLog(Worksheet sheet, OperatorSettleLog optLog, int row)
        {
            Range r = sheet.get_Range("A" + row, Type.Missing);

            r.Value2 = optLog.OperatorID;
            r        = sheet.get_Range("B" + row, Type.Missing);
            r.Value2 = optLog.SettleDateTime;
            r        = sheet.get_Range("C" + row, Type.Missing);
            r.Value2 = optLog.CashOfCard + optLog.CashOfCardLost + optLog.CashOfDeposit - optLog.CashOfCardRecycle;
            r        = sheet.get_Range("D" + row, Type.Missing);
            r.Value2 = optLog.HandInCash;
            r        = sheet.get_Range("E" + row, Type.Missing);
            r.Value2 = optLog.CashDiffrence;
            r        = sheet.get_Range("F" + row, Type.Missing);
            r.Value2 = optLog.CashParkDiscount;
        }
Пример #9
0
 private void mnu_PrintSettleLog_Click(object sender, EventArgs e)
 {
     try
     {
         DataGridViewRow   row    = GridView.SelectedRows[0];
         OperatorSettleLog optLog = row.Tag as OperatorSettleLog;
         if (optLog != null)
         {
             FrmOperatorSettle frm = new FrmOperatorSettle();
             frm.PrintOperatorSettleLog(optLog);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, Resources.Resource1.Form_Alert);
         Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
     }
 }
Пример #10
0
        private void FillOperatorLog(Worksheet sheet, OperatorSettleLog optLog, int row)
        {
            Range r = sheet.get_Range("A" + row, Type.Missing);

            r.Value2 = optLog.OperatorID;
            r        = sheet.get_Range("C" + row, Type.Missing);
            r.Value2 = optLog.SettleDateTime;
            r        = sheet.get_Range("E" + row, Type.Missing);
            r.Value2 = optLog.CashParkFact;
            r        = sheet.get_Range("F" + row, Type.Missing);
            r.Value2 = optLog.CashOperatorCard;
            r        = sheet.get_Range("G" + row, Type.Missing);
            r.Value2 = optLog.HandInCash;
            r        = sheet.get_Range("I" + row, Type.Missing);
            r.Value2 = optLog.CashDiffrence;
            r        = sheet.get_Range("K" + row, Type.Missing);
            r.Value2 = optLog.CashParkDiscount;
        }
Пример #11
0
        private void ShowLogInfo(OperatorSettleLog log, int fromWhichHandle)
        {
            this.lblOperator.Text = log.OperatorID;

            //最后一次结算时间
            DateTime?lastSettleDateTime = (new OperatorSettleBLL(AppSettings.CurrentSetting.ParkConnect)).GetLastSettleDateTime(log.OperatorID);
            //当前结算时间的前一笔结算时间
            DateTime?preSettleDateTime = (new OperatorSettleBLL(AppSettings.CurrentSetting.ParkConnect)).GetPreSettleDateTime(log.OperatorID, log.SettleDateTime);

            this.lblSettleDateTime.Text = log.SettleDateTime.ToString("yyyy-MM-dd HH;mm:ss");

            if (lastSettleDateTime != null && fromWhichHandle == 0)
            {
                this.lblSettleDateTime.Text = lastSettleDateTime.Value.ToString("yyyy-MM-dd HH;mm:ss") + "至" + log.SettleDateTime.ToString("yyyy-MM-dd HH;mm:ss");
            }
            if (preSettleDateTime != null && fromWhichHandle == 1)//打印时
            {
                this.lblSettleDateTime.Text = preSettleDateTime.Value.ToString("yyyy-MM-dd HH:mm:ss") + "至" + log.SettleDateTime.ToString("yyyy-MM-dd HH;mm:ss");
            }

            this.txtCashOfPark.Text         = log.CashParkFact.ToString("F2");
            this.txtCashOfOperatorCard.Text = log.CashOperatorCard.ToString("F2");
            this.txtCashDiscount.Text       = log.CashParkDiscount.ToString("F2");
            this.txtCashOfCard.Text         = log.CashOfCard.ToString("F2");;
            this.txtCashOfDeposit.Text      = log.CashOfDeposit.ToString("F2");
            this.txtCashOfCardLost.Text     = log.CashOfCardLost.ToString("F2");
            this.txtCashOfPOS.Text          = (log.CashOfPOS != null ? log.CashOfPOS.Value : 0).ToString("F2");
            this.txtCashOfCardRecycle.Text  = log.CashOfCardRecycle.ToString("F2");
            this.txtCashOfRefund.Text       = log.CashOfRefund == null ? "0.00" : log.CashOfRefund.Value.ToString("F2");
            this.txtCashTotal.Text          = log.TotalCash.ToString("F2");
            this.txtHandInCash.Text         = log.HandInCash == null ? string.Empty : log.HandInCash.Value.ToString("F2");
            this.txtCashDiffrence.Text      = log.CashDiffrence == null ? string.Empty : log.CashDiffrence.Value.ToString("F2");

            this.txtNonCashOfPark.Text     = log.NonCashParkFact.ToString("F2");;
            this.txtNonCashDiscount.Text   = log.NonCashParkDiscount.ToString("F2");
            this.txtNonCashOfCard.Text     = log.NonCashOfCard.ToString("F2");;
            this.txtNonCashOfDeposit.Text  = log.NonCashOfDeposit.ToString("F2");;
            this.txtNonCashOfCardLost.Text = log.NonCashOfCardLost.ToString("F2");
            this.txtNonCashTotal.Text      = log.TotalNonCash.ToString("F2");;
            this.txtHandInPOS.Text         = log.HandInPOS == null ? string.Empty : log.HandInPOS.Value.ToString("F2");

            this.txtTempCardRecycle.Text = log.TempCardRecycle.ToString();
            this.txtOpenDoorCount.Text   = log.OpenDoorCount.ToString();
        }
Пример #12
0
        /// <summary>
        /// 导出操作员当班信息到EXCEL中,并直接打印出来
        /// </summary>
        /// <param name="optLog"></param>
        public void PrintByExcel(OperatorSettleLog optLog)
        {
            RecordSearchCondition recordCon = new RecordSearchCondition();

            recordCon.SettleDateTime = optLog.SettleDateTime;

            Application app  = new Application();
            Workbook    book = null;

            book = app.Workbooks.Add(ReportModal);
            Worksheet sheet = book.ActiveSheet as Worksheet;

            FillOperatorLog(sheet, optLog, 3);
            List <MonthCardPaymentInfo> cardPaymentRecords = GetMonthCardPaymentInfoes(recordCon);

            FillDetail(sheet, cardPaymentRecords, 6);
            sheet.PrintOutEx(Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
            book.Close(false, Type.Missing, Type.Missing);
        }
Пример #13
0
        /// <summary>
        /// 导出操作员当班信息到EXCEL中
        /// </summary>
        /// <param name="optLog"></param>
        public void Export(OperatorSettleLog optLog, string path)
        {
            RecordSearchCondition recordCon = new RecordSearchCondition();

            recordCon.SettleDateTime = optLog.SettleDateTime;

            Application app  = new Application();
            Workbook    book = null;

            book = app.Workbooks.Add(ReportModal);
            Worksheet sheet = book.ActiveSheet as Worksheet;

            FillOperatorLog(sheet, optLog, 3);
            List <MonthCardPaymentInfo> cardPaymentRecords = GetMonthCardPaymentInfoes(recordCon);

            FillDetail(sheet, cardPaymentRecords, 6);
            book.SaveAs(path, XlFileFormat.xlXMLSpreadsheet, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                        XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
            book.Close(false, Type.Missing, Type.Missing);
        }
Пример #14
0
        private void FillOperatorLog(Worksheet sheet, OperatorSettleLog optLog, int row)
        {
            Range r = sheet.get_Range("A" + row, Type.Missing);//操作员

            r.Value2 = optLog.OperatorID;
            r        = sheet.get_Range("B" + row, Type.Missing); //结算时间
            r.Value2 = optLog.SettleDateTime;
            r        = sheet.get_Range("D" + row, Type.Missing); //功能卡收现
            r.Value2 = optLog.CashOperatorCard;
            r        = sheet.get_Range("E" + row, Type.Missing); //电脑收费现金
            r.Value2 = optLog.CashParkFact - (optLog.CashOfRefund != null ? optLog.CashOfRefund.Value : 0);
            r        = sheet.get_Range("F" + row, Type.Missing); //POS缴费
            r.Value2 = optLog.PaymentPOS;
            r        = sheet.get_Range("G" + row, Type.Missing); //上交现金
            r.Value2 = optLog.HandInCash;
            r        = sheet.get_Range("H" + row, Type.Missing); //上交POS缴费
            r.Value2 = optLog.HandInPOS;
            r        = sheet.get_Range("I" + row, Type.Missing); //现金差额
            r.Value2 = optLog.CashDiffrence;
            r        = sheet.get_Range("K" + row, Type.Missing); //POS差额
            r.Value2 = optLog.PaymentPOSDiffrence;
            r        = sheet.get_Range("L" + row, Type.Missing); //现金折扣
            r.Value2 = optLog.CashParkDiscount;
        }
Пример #15
0
        /// <summary>
        /// 导出操作员当班信息到EXCEL后直接打印
        /// </summary>
        /// <param name="optLog"></param>
        public void PrintByExcel(OperatorSettleLog optLog)
        {
            RecordSearchCondition recordCon = new RecordSearchCondition();

            recordCon.SettleDateTime = optLog.SettleDateTime;

            Application app  = new Application();
            Workbook    book = null;

            book = app.Workbooks.Add(ReportModal);
            Worksheet sheet = book.ActiveSheet as Worksheet;

            FillOperatorLog(sheet, optLog, 3);

            List <CardPaymentInfo> cardPaymentRecords = (new CardPaymentRecordBll(AppSettings.CurrentSetting.ParkConnect)).GetItems(recordCon).QueryObjects;

            cardPaymentRecords = (from card in cardPaymentRecords
                                  where card.PaymentCode != PaymentCode.APM
                                  orderby card.PaymentCode, card.ChargeDateTime descending
                                  select card).ToList();
            FillDetail(sheet, cardPaymentRecords, 6);
            sheet.PrintOutEx(Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
            book.Close(false, Type.Missing, Type.Missing);
        }
Пример #16
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);
            }
        }
Пример #17
0
        /// <summary>
        /// 操作员结算
        /// </summary>
        /// <param name="opt"></param>
        /// <returns></returns>
        public CommandResult Settle(OperatorSettleLog opt)
        {
            IUnitWork            unitWork = ProviderFactory.Create <IUnitWork>(_RepoUri);
            IOperatorLogProvider ip       = ProviderFactory.Create <IOperatorLogProvider>(_RepoUri);

            ip.Insert(opt, unitWork);

            if (opt.PaymentRecords != null && opt.PaymentRecords.Count > 0)
            {
                ICardPaymentRecordProvider provider = ProviderFactory.Create <ICardPaymentRecordProvider>(_RepoUri);
                foreach (CardPaymentInfo record in opt.PaymentRecords)
                {
                    CardPaymentInfo original = record.Clone();
                    record.SettleDateTime = opt.SettleDateTime;
                    provider.Update(record, original, unitWork);
                }
            }
            if (opt.ReleaseRecords != null && opt.ReleaseRecords.Count > 0)
            {
                ICardReleaseRecordProvider provider = ProviderFactory.Create <ICardReleaseRecordProvider>(_RepoUri);
                foreach (CardReleaseRecord record in opt.ReleaseRecords)
                {
                    CardReleaseRecord original = record.Clone();
                    record.SettleDateTime = opt.SettleDateTime;
                    provider.Update(record, original, unitWork);
                }
            }
            if (opt.ChargeRecords != null && opt.ChargeRecords.Count > 0)
            {
                ICardChargeRecordProvider provider = ProviderFactory.Create <ICardChargeRecordProvider>(_RepoUri);
                foreach (CardChargeRecord record in opt.ChargeRecords)
                {
                    CardChargeRecord original = record.Clone();
                    record.SettleDateTime = opt.SettleDateTime;
                    provider.Update(record, original, unitWork);
                }
            }
            if (opt.DeferRecords != null && opt.DeferRecords.Count > 0)
            {
                ICardDeferRecordProvider provider = ProviderFactory.Create <ICardDeferRecordProvider>(_RepoUri);
                foreach (CardDeferRecord record in opt.DeferRecords)
                {
                    CardDeferRecord original = record.Clone();
                    record.SettleDateTime = opt.SettleDateTime;
                    provider.Update(record, original, unitWork);
                }
            }
            if (opt.CardLostRecords != null && opt.CardLostRecords.Count > 0)
            {
                ICardLostRestoreRecordProvider provider = ProviderFactory.Create <ICardLostRestoreRecordProvider>(_RepoUri);
                foreach (CardLostRestoreRecord record in opt.CardLostRecords)
                {
                    CardLostRestoreRecord original = record.Clone();
                    record.SettleDateTime = opt.SettleDateTime;
                    provider.Update(record, original, unitWork);
                }
            }
            if (opt.RecycleRecords != null && opt.RecycleRecords.Count > 0)
            {
                ICardRecycleRecordProvider provider = ProviderFactory.Create <ICardRecycleRecordProvider>(_RepoUri);
                foreach (CardRecycleRecord record in opt.RecycleRecords)
                {
                    CardRecycleRecord original = record.Clone();
                    record.SettleDateTime = opt.SettleDateTime;
                    provider.Update(record, original, unitWork);
                }
            }
            if (opt.EventRecords != null && opt.EventRecords.Count > 0)
            {
                ICardEventProvider provider = ProviderFactory.Create <ICardEventProvider>(_RepoUri);
                foreach (CardEventRecord record in opt.EventRecords)
                {
                    CardEventRecord original = record.Clone();
                    record.SettleDateTime = opt.SettleDateTime;
                    provider.Update(record, original, unitWork);
                }
            }
            if (opt.AlarmRecords != null && opt.AlarmRecords.Count > 0)
            {
                IAlarmProvider provider = ProviderFactory.Create <IAlarmProvider>(_RepoUri);
                foreach (AlarmInfo record in opt.AlarmRecords)
                {
                    AlarmInfo original = record.Clone();
                    record.SettleDateTime = opt.SettleDateTime;
                    provider.Update(record, original, unitWork);
                }
            }
            return(unitWork.Commit());
        }