// /// <summary> /// 每一次借完成后触发一次 /// </summary> /// <param name="sender">事件触发者</param> /// <param name="e">事件参数</param> public virtual void OnBorrowed(object sender, BorrowedEventArgs e) { if (e.ReaderBarcode != this.PrintInfo.CurrentReaderBarcode) { // 前面积累的打印信息,推送到相应的队列中,便于随时挑选出来进行重新打印 if (String.IsNullOrEmpty(this.PrintInfo.CurrentReaderBarcode) == false && this.PrintInfo.HasContent() == true ) { if (this.PrintInfo.PrintedCount == 0) { while (this.UnprintInfos.Count >= this.MaxUnprintInfos) { this.UnprintInfos.RemoveAt(0); } this.UnprintInfos.Add(this.PrintInfo); } else { while (this.PrintedInfos.Count >= this.MaxPrintedInfos) { this.PrintedInfos.RemoveAt(0); } this.PrintedInfos.Add(this.PrintInfo); } } this.PrintInfo = new PrintInfo(); } this.PrintInfo.CurrentReaderBarcode = e.ReaderBarcode; if (String.IsNullOrEmpty(this.PrintInfo.CurrentReaderSummary) == true) { this.PrintInfo.CurrentReaderSummary = e.ReaderSummary; } this.PrintInfo.PrintedCount = 0; // 把打印次数清为0,表示内容已经变化,新版本(增补后的)内容尚未打印 BorrowItemInfo info = new BorrowItemInfo(); info.OperName = e.OperName; info.ItemBarcode = e.ItemBarcode; info.BiblioSummary = e.BiblioSummary; info.LatestReturnDate = e.LatestReturnDate; info.Period = e.Period; info.BorrowCount = e.BorrowCount; info.TimeSpan = e.TimeSpan; info.BorrowOperator = e.BorrowOperator; this.PrintInfo.BorrowItems.Add(info); }
internal void Borrow( IChargingForm charging_form, bool bRenew, string strReaderBarcode, string strItemBarcode, string strConfirmItemRecPath, string strReaderSummary, string strItemXml, // 2008/5/9 BorrowInfo borrow_info, DateTime start_time, DateTime end_time) { TimeSpan delta = end_time - start_time; // 未包括GetSummary()的时间 string strText = ""; int nRet = 0; string strOperName = "借"; if (bRenew == true) strOperName = "续借"; string strError = ""; string strSummary = ""; nRet = this.GetBiblioSummary(strItemBarcode, strConfirmItemRecPath, out strSummary, out strError); if (nRet == -1) strSummary = "获取书目摘要时出错: " + strError; string strOperClass = "even"; if ((this.m_nCount % 2) == 1) strOperClass = "odd"; string strItemLink = "<a href='javascript:void(0);' onclick=\"window.external.OpenForm('ItemInfoForm', this.innerText, true);\">" + HttpUtility.HtmlEncode(strItemBarcode) + "</a>"; string strReaderLink = "<a href='javascript:void(0);' onclick=\"window.external.OpenForm('ReaderInfoForm', this.innerText, true);\">" + HttpUtility.HtmlEncode(strReaderBarcode) + "</a>"; strText = "<div class='item " + strOperClass + " borrow'>" + "<div class='time_line'>" + " <div class='time'>" + DateTime.Now.ToLongTimeString() + "</div>" + " <div class='time_span'>耗时 " + DoubleToString(delta.TotalSeconds) + "秒</div>" + " <div class='clear'></div>" + "</div>" + "<div class='reader_line'>" + " <div class='reader_prefix_text'>读者</div>" + " <div class='reader_barcode'>" + strReaderLink + "</div>" + " <div class='reader_summary'>" + HttpUtility.HtmlEncode(strReaderSummary) + "</div>" + " <div class='clear'></div>" + "</div>" + "<div class='opername_line'>" + " <div class='opername'>" + HttpUtility.HtmlEncode(strOperName) + "</div>" + " <div class='clear'></div>" + "</div>" + "<div class='item_line'>" + " <div class='item_prefix_text'>册</div>" + " <div class='item_barcode'>" + strItemLink + "</div> " + " <div class='item_summary'>" + HttpUtility.HtmlEncode(strSummary) + "</div>" + " <div class='clear'></div>" + "</div>" + " <div class='clear'></div>" + "</div>"; /* strText = "<div class='" + strOperClass + "'>" + "<div class='time_line'><span class='time'>" + DateTime.Now.ToLongTimeString() + "</span> <span class='time_span'>耗时 " + delta.TotalSeconds.ToString() + "秒</span></div>" + "<div class='reader_line'><span class='reader_prefix_text'>读者</span> <span class='reader_barcode'>[" + strReaderBarcode + "]</span>" + " <span class='reader_summary'>" + strReaderSummary + "<span></div>" + "<div class='opername_line'><span class='opername'>" + strOperName + "<span></div>" + "<div class='item_line'><span class='item_prefix_text'>册</span> <span class='item_barcode'>[" + strItemBarcode + "]</span> " + "<span class='item_summary' id='" + m_nCount.ToString() + "' onreadystatechange='GetOneSummary(\"" + m_nCount.ToString() + "\");'>" + strItemBarcode + "</span></div>" + "</div>"; * */ AppendHtml(strText); m_nCount++; // 运行Script代码 if (this.PrintAssembly != null) { BorrowedEventArgs e = new BorrowedEventArgs(); e.OperName = strOperName; e.BiblioSummary = strSummary; e.ItemBarcode = strItemBarcode; e.ReaderBarcode = strReaderBarcode; e.TimeSpan = delta; e.ReaderSummary = strReaderSummary; e.ItemXml = strItemXml; e.ChargingForm = charging_form; if (borrow_info != null) { if (String.IsNullOrEmpty(borrow_info.LatestReturnTime) == true) e.LatestReturnDate = new DateTime(0); else e.LatestReturnDate = DateTimeUtil.FromRfc1123DateTimeString(borrow_info.LatestReturnTime).ToLocalTime(); e.Period = borrow_info.Period; e.BorrowCount = borrow_info.BorrowCount; e.BorrowOperator = borrow_info.BorrowOperator; } this.PrintHostObj.MainForm = this.MainForm; this.PrintHostObj.Assembly = this.PrintAssembly; try { this.PrintHostObj.OnBorrowed(this, e); } catch (Exception ex) { string strErrorInfo = "<br/>单据打印脚本运行时出错: " + HttpUtility.HtmlEncode(ExceptionUtil.GetDebugText(ex)); AppendHtml(strErrorInfo); } /* if (nRet == -1) { strText = "<br/>单据打印脚本运行时出错: " + HttpUtility.HtmlEncode(strError); AppendHtml(strText); }*/ } // 用tips飞出显示读者和册的摘要信息?或者明确显示在条码后面? // 读者证和册条码号本身就是锚点? // 读者摘要要么做在前端,通过XML发生,要么做在服务器,用固定规则发生。 }
// /// <summary> /// 每一次借完成后触发一次 /// </summary> /// <param name="sender">事件触发者</param> /// <param name="e">事件参数</param> public virtual void OnBorrowed(object sender, BorrowedEventArgs e) { if (e.ReaderBarcode != this.PrintInfo.CurrentReaderBarcode) { // 前面积累的打印信息,推送到相应的队列中,便于随时挑选出来进行重新打印 if (String.IsNullOrEmpty(this.PrintInfo.CurrentReaderBarcode) == false && this.PrintInfo.HasContent() == true ) { if (this.PrintInfo.PrintedCount == 0) { while (this.UnprintInfos.Count >= this.MaxUnprintInfos) this.UnprintInfos.RemoveAt(0); this.UnprintInfos.Add(this.PrintInfo); } else { while (this.PrintedInfos.Count >= this.MaxPrintedInfos) this.PrintedInfos.RemoveAt(0); this.PrintedInfos.Add(this.PrintInfo); } } this.PrintInfo = new PrintInfo(); } this.PrintInfo.CurrentReaderBarcode = e.ReaderBarcode; if (String.IsNullOrEmpty(this.PrintInfo.CurrentReaderSummary) == true) this.PrintInfo.CurrentReaderSummary = e.ReaderSummary; this.PrintInfo.PrintedCount = 0; // 把打印次数清为0,表示内容已经变化,新版本(增补后的)内容尚未打印 BorrowItemInfo info = new BorrowItemInfo(); info.OperName = e.OperName; info.ItemBarcode = e.ItemBarcode; info.BiblioSummary = e.BiblioSummary; info.LatestReturnDate = e.LatestReturnDate; info.Period = e.Period; info.BorrowCount = e.BorrowCount; info.TimeSpan = e.TimeSpan; info.BorrowOperator = e.BorrowOperator; this.PrintInfo.BorrowItems.Add(info); }