// /// <summary> /// 每一次还完成后触发一次 /// </summary> /// <param name="sender">事件触发者</param> /// <param name="e">事件参数</param> public virtual void OnReturned(object sender, ReturnedEventArgs 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,表示内容已经变化,新版本(增补后的)内容尚未打印 // 对借阅事项进行查重 bool bFoundDup = false; for (int i = 0; i < this.PrintInfo.BorrowItems.Count; i++) { BorrowItemInfo borrow = this.PrintInfo.BorrowItems[i]; if (borrow.ItemBarcode == e.ItemBarcode) { this.PrintInfo.BorrowItems.RemoveAt(i); bFoundDup = true; break; } } if (bFoundDup == true) { return; } ReturnItemInfo info = new ReturnItemInfo(); info.OperName = e.OperName; info.ItemBarcode = e.ItemBarcode; info.BiblioSummary = e.BiblioSummary; info.BorrowDate = e.BorrowDate; info.LatestReturnDate = e.LatestReturnDate; info.Period = e.Period; info.BorrowCount = e.BorrowCount; info.TimeSpan = e.TimeSpan; info.BorrowOperator = e.BorrowOperator; info.ReturnOperator = e.ReturnOperator; string strError = ""; int nRet = info.BuildOverdueItems(e.OverdueString, out strError); if (nRet == -1) { throw new Exception("BuildOverdueItems error: " + strError); } this.PrintInfo.ReturnItems.Add(info); }
internal void Return( IChargingForm charging_form, // bool bLost, string strAction, string strReaderBarcode, string strItemBarcode, string strConfirmItemRecPath, string strReaderSummary, string strItemXml, // 2008/5/9 ReturnInfo return_info, DateTime start_time, DateTime end_time) { TimeSpan delta = end_time - start_time; // 未包括GetSummary()的时间 string strText = ""; int nRet = 0; string strOperName = "还"; #if NO if (bLost == true) strOperName = "丢失"; #endif if (strAction == "lost") strOperName = "丢失"; else if (strAction == "inventory") strOperName = "盘点"; else if (strAction == "read") 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 strLocation = ""; if (return_info != null) strLocation = return_info.Location; string strItemLink = "<a href='javascript:void(0);' onclick=\"window.external.OpenForm('ItemInfoForm', this.innerText, true);\">" + HttpUtility.HtmlEncode(strItemBarcode) + "</a>"; string strReaderLink = ""; if (string.IsNullOrEmpty(strReaderBarcode) == false) strReaderLink = "<a href='javascript:void(0);' onclick=\"window.external.OpenForm('ReaderInfoForm', this.innerText, true);\">" + HttpUtility.HtmlEncode(strReaderBarcode) + "</a>"; strText = "<div class='item " + strOperClass + " return'>" + "<div class='time_line'>" + " <div class='time'>" + DateTime.Now.ToLongTimeString() + "</div>" + " <div class='time_span'>耗时 " + DoubleToString(delta.TotalSeconds) + "秒</div>" + " <div class='clear'></div>" + "</div>" + ( string.IsNullOrEmpty(strReaderLink) == false ? ("<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>" + (string.IsNullOrEmpty(strLocation) == false ? " <div class='item_location'>" + HttpUtility.HtmlEncode(strLocation) + "</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) { ReturnedEventArgs e = new ReturnedEventArgs(); 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 (return_info != null) { if (String.IsNullOrEmpty(return_info.BorrowTime) == true) e.BorrowDate = new DateTime(0); else e.BorrowDate = DateTimeUtil.FromRfc1123DateTimeString(return_info.BorrowTime).ToLocalTime(); if (String.IsNullOrEmpty(return_info.LatestReturnTime) == true) e.LatestReturnDate = new DateTime(0); else e.LatestReturnDate = DateTimeUtil.FromRfc1123DateTimeString(return_info.LatestReturnTime).ToLocalTime(); e.Period = return_info.Period; e.BorrowCount = return_info.BorrowCount; e.OverdueString = return_info.OverdueString; e.BorrowOperator = return_info.BorrowOperator; e.ReturnOperator = return_info.ReturnOperator; // 2013/4/2 e.Location = return_info.Location; e.BookType = return_info.BookType; } this.PrintHostObj.MainForm = this.MainForm; this.PrintHostObj.Assembly = this.PrintAssembly; try { this.PrintHostObj.OnReturned(this, e); } catch (Exception ex) { string strErrorInfo = "<br/>单据打印脚本运行时出错: " + HttpUtility.HtmlEncode(ExceptionUtil.GetDebugText(ex)); AppendHtml(strErrorInfo); } } }
// /// <summary> /// 每一次还完成后触发一次 /// </summary> /// <param name="sender">事件触发者</param> /// <param name="e">事件参数</param> public virtual void OnReturned(object sender, ReturnedEventArgs 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,表示内容已经变化,新版本(增补后的)内容尚未打印 // 对借阅事项进行查重 bool bFoundDup = false; for (int i = 0; i < this.PrintInfo.BorrowItems.Count; i++) { BorrowItemInfo borrow = this.PrintInfo.BorrowItems[i]; if (borrow.ItemBarcode == e.ItemBarcode) { this.PrintInfo.BorrowItems.RemoveAt(i); bFoundDup = true; break; } } if (bFoundDup == true) return; ReturnItemInfo info = new ReturnItemInfo(); info.OperName = e.OperName; info.ItemBarcode = e.ItemBarcode; info.BiblioSummary = e.BiblioSummary; info.BorrowDate = e.BorrowDate; info.LatestReturnDate = e.LatestReturnDate; info.Period = e.Period; info.BorrowCount = e.BorrowCount; info.TimeSpan = e.TimeSpan; info.BorrowOperator = e.BorrowOperator; info.ReturnOperator = e.ReturnOperator; string strError = ""; int nRet = info.BuildOverdueItems(e.OverdueString, out strError); if (nRet == -1) throw new Exception("BuildOverdueItems error: " + strError); this.PrintInfo.ReturnItems.Add(info); }