// 借阅动作异步事件 internal void BorrowAsync(IChargingForm charging_form, bool bRenew, string strReaderBarcode, string strItemBarcode, string strConfirmItemRecPath, string strReaderSummary, string strItemXml, BorrowInfo borrow_info, DateTime start_time, DateTime end_time) { #if !USE_THREAD Delegate_Borrow d = new Delegate_Borrow(Borrow); this.MainForm.BeginInvoke(d, new object[] { charging_form, bRenew, strReaderBarcode, strItemBarcode, strConfirmItemRecPath, strReaderSummary, strItemXml, borrow_info, start_time, end_time}); #else OneCall call = new OneCall(); call.name = "borrow"; call.func = new Delegate_Borrow(Borrow); call.parameters = new object[] { charging_form, bRenew, strReaderBarcode, strItemBarcode, strConfirmItemRecPath, strReaderSummary, strItemXml, borrow_info, start_time, end_time}; AddCall(call); #endif }
internal void ReturnAsync(IChargingForm charging_form, // bool bLost, string strAction, string strReaderBarcode, string strItemBarcode, string strConfirmItemRecPath, string strReaderSummary, string strItemXml, ReturnInfo return_info, DateTime start_time, DateTime end_time) { #if !USE_THREAD Delegate_Return d = new Delegate_Return(Return); this.MainForm.BeginInvoke(d, new object[] {charging_form, bLost, strReaderBarcode, strItemBarcode, strConfirmItemRecPath, strReaderSummary, strItemXml, return_info, start_time, end_time}); #else OneCall call = new OneCall(); call.name = "return"; call.func = new Delegate_Return(Return); call.parameters = new object[] { charging_form, // bLost, strAction, strReaderBarcode, strItemBarcode, strConfirmItemRecPath, strReaderSummary, strItemXml, return_info, start_time, end_time}; AddCall(call); #endif }
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); } } }
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发生,要么做在服务器,用固定规则发生。 }