// /// <summary> /// 每一次交罚金完成后触发一次 /// </summary> /// <param name="sender">事件触发者</param> /// <param name="e">事件参数</param> public virtual void OnAmerced(object sender, AmercedEventArgs 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,表示内容已经变化,新版本(增补后的)内容尚未打印 this.PrintInfo.OverdueItems.AddRange(e.OverdueInfos); }
internal void Amerce( string strReaderBarcode, string strReaderSummary, List<OverdueItemInfo> overdue_infos, string strAmerceOperator, DateTime start_time, DateTime end_time) { string strOperName = "交费"; TimeSpan delta = end_time - start_time; string strText = ""; int nRet = 0; foreach (OverdueItemInfo info in overdue_infos) { string strOperClass = "even"; if ((this.m_nCount % 2) == 1) strOperClass = "odd"; string strSummary = ""; string strItemLink = ""; if (string.IsNullOrEmpty(info.ItemBarcode) == false) { strItemLink = "<a href='javascript:void(0);' onclick=\"window.external.OpenForm('ItemInfoForm', this.innerText, true);\">" + HttpUtility.HtmlEncode(info.ItemBarcode) + "</a>"; string strError = ""; nRet = this.GetBiblioSummary(info.ItemBarcode, info.RecPath, out strSummary, out strError); if (nRet == -1) strSummary = "获取书目摘要时出错: " + strError; strItemLink += " <div class='item_summary'>" + HttpUtility.HtmlEncode(strSummary) + "</div>"; } string strReaderLink = "<a href='javascript:void(0);' onclick=\"window.external.OpenForm('ReaderInfoForm', this.innerText, true);\">" + HttpUtility.HtmlEncode(strReaderBarcode) + "</a>"; string strTimePrefix = ""; if (overdue_infos.Count > 1) strTimePrefix = overdue_infos.Count.ToString() + "笔交费共"; strText = "<div class='item " + strOperClass + " amerce'>" + "<div class='time_line'>" + " <div class='time'>" + DateTime.Now.ToLongTimeString() + "</div>" + " <div class='time_span'>" + strTimePrefix + "耗时 " + 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'>" + info.ToHtmlString(strItemLink) + "</div>" + " <div class='clear'></div>" + "</div>"; AppendHtml(strText); m_nCount++; } // 运行Script代码 if (this.PrintAssembly != null) { AmercedEventArgs e = new AmercedEventArgs(); e.OperName = strOperName; e.ReaderBarcode = strReaderBarcode; e.ReaderSummary = strReaderSummary; e.TimeSpan = delta; e.OverdueInfos = overdue_infos; e.AmerceOperator = strAmerceOperator; this.PrintHostObj.MainForm = this.MainForm; this.PrintHostObj.Assembly = this.PrintAssembly; try { this.PrintHostObj.OnAmerced(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); }*/ } }
// /// <summary> /// 每一次交罚金完成后触发一次 /// </summary> /// <param name="sender">事件触发者</param> /// <param name="e">事件参数</param> public virtual void OnAmerced(object sender, AmercedEventArgs 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,表示内容已经变化,新版本(增补后的)内容尚未打印 this.PrintInfo.OverdueItems.AddRange(e.OverdueInfos); }