Exemplo n.º 1
0
        int RepairError(
            string strAction,
            string strReaderBarcode,
            string strItemBarcode,
            out string strError)
        {
            strError = "";
            int nProcessedBorrowItems = 0;
            int nTotalBorrowItems = 0;

            Debug.Assert(strAction == "repairreaderside" || strAction == "repairitemside", "");

            stop.OnStop += new StopEventHandler(this.DoStop);
            stop.Initial("正在进行修复 ...");
            stop.BeginLoop();

            EnableControls(false);

            try
            {
                string strConfirmItemRecPath = "";
            REDO:
                string[] aDupPath = null;

                string strOutputReaderBarcode = "";

                long lRet = Channel.RepairBorrowInfo(
                    stop,
                    strAction,  // "repairreaderside",
                    strReaderBarcode,
                    strItemBarcode,
                    strConfirmItemRecPath,
                    0,
                    -1,
                    out nProcessedBorrowItems,   // 2008/10/27 
                    out nTotalBorrowItems,   // 2008/10/27 
                    out strOutputReaderBarcode,
                    out aDupPath,
                    out strError);
                if (lRet == -1)
                {
                    if (Channel.ErrorCode == ErrorCode.ItemBarcodeDup)
                    {
                        // this.MainForm.PrepareSearch();
                        LibraryChannel channel = this.MainForm.GetChannel();
                        try
                        {
                            ItemBarcodeDupDlg dupdlg = new ItemBarcodeDupDlg();
                            MainForm.SetControlFont(dupdlg, this.Font, false);
                            string strErrorNew = "";
                            int nRet = dupdlg.Initial(
                                this.MainForm,
                                aDupPath,
                                "因册条码号发生重复,修复操作被拒绝。\r\n\r\n可根据下面列出的详细信息,选择适当的册记录,重试操作。\r\n\r\n原始出错信息:\r\n" + strError,
                                channel,    // this.MainForm.Channel,
                                this.MainForm.Stop,
                                out strErrorNew);
                            if (nRet == -1)
                            {
                                // 初始化对话框失败
                                MessageBox.Show(this, strErrorNew);
                                goto ERROR1;
                            }

                            this.MainForm.AppInfo.LinkFormState(dupdlg, "CheckBorrowInfoForm_dupdlg_state");
                            dupdlg.ShowDialog(this);
                            this.MainForm.AppInfo.UnlinkFormState(dupdlg);

                            if (dupdlg.DialogResult == DialogResult.Cancel)
                                goto ERROR1;

                            strConfirmItemRecPath = dupdlg.SelectedRecPath;

                            goto REDO;
                        }
                        finally
                        {
                            this.MainForm.ReturnChannel(channel);
                            // this.MainForm.EndSearch();
                        }
                    }

                    goto ERROR1;
                } // end of return -1

            }
            finally
            {
                EnableControls(true);

                stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
                stop.Initial("");
            }

            return 0;
        ERROR1:
            return -1;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 执行动作按钮代表的动作
        /// </summary>
        /// <returns>-1: 出错; 0: 功能没有执行; 1: 功能已经执行</returns>
        public int DoItemAction()
        {
            string strError = "";
            int nRet = 0;

            DateTime start_time = DateTime.Now;

#if NO
            // 如果册条码号为空,在这里回车可以被当作切换到读者证条码号输入域?
            if (this.textBox_itemBarcode.Text == "")
            {
                MessageBox.Show(this, "尚未输入册条码号");
                this.SwitchFocus(ITEM_BARCODE, null);
                return -1;
            }
#endif

            if (this.AutoToUpper == true)
                this.textBox_itemBarcode.Text = this.textBox_itemBarcode.Text.ToUpper();

            this.ActiveReaderBarcode = this.textBox_readerBarcode.Text;

            BarcodeAndTime barcodetime = null;

            if (this.DoubleItemInputAsEnd == true)
            {
                // 取出上次输入的最后一个条码,和目前输入的条码比较,看是否一样。
                if (this.m_itemBarcodes.Count > 0)
                {
                    string strLastItemBarcode = this.m_itemBarcodes[m_itemBarcodes.Count - 1].Barcode;
                    TimeSpan delta = DateTime.Now - this.m_itemBarcodes[m_itemBarcodes.Count - 1].Time;
                    // MessageBox.Show(this, delta.TotalMilliseconds.ToString());
                    if (strLastItemBarcode == this.textBox_itemBarcode.Text
                        && delta.TotalMilliseconds < 5000) // 5秒以内
                    {
                        // 清除册条码号输入域
                        this.textBox_itemBarcode.Text = "";

                        // 如果当前在“还”状态,需要修改为“验证还”,避免读者证条码号输入域为diable而无法切换焦点过去
                        if (this.FuncState == FuncState.Return)
                            this.FuncState = FuncState.VerifyReturn;


                        // 清除读者证条码号输入域
                        this.textBox_readerBarcode.Text = "请输入下一个读者的证条码号...";
                        this.SwitchFocus(READER_BARCODE, null);
                        return 0;
                    }
                }
                barcodetime = new BarcodeAndTime();
                barcodetime.Barcode = this.textBox_itemBarcode.Text;
                barcodetime.Time = DateTime.Now;

                this.m_itemBarcodes.Add(barcodetime);
                // 仅仅保持一个条码就可以了
                while (this.m_itemBarcodes.Count > 1)
                    this.m_itemBarcodes.RemoveAt(0);
            }

            string strFastInputText = "";

            string strTemp = this.textBox_itemBarcode.Text;
            if ((this.UseIsbnBorrow == true && QuickChargingForm.IsISBN(ref strTemp) == true)
                || strTemp.ToLower() == "?b"
                || string.IsNullOrEmpty(strTemp) == true)
            {
                string strItemBarcode = "";
                // return:
                //      -1  error
                //      0   放弃
                //      1   成功
                nRet = SelectOneItem(this.FuncState,
                    strTemp.ToLower() == "?b" ? "" : strTemp,
                    out strItemBarcode,
                    out strError);
                if (nRet == -1)
                {
                    strError = "选择册记录的过程中出错: " + strError;
                    goto ERROR1;
                }
                if (nRet == 0)
                {
                    strFastInputText = ChargingInfoDlg.Show(
                        this.CharingInfoHost,
                        "已取消选择册记录。注意操作并未执行",
                        InfoColor.Red,
                        "扫入册条码",
                        this.InfoDlgOpacity,
                        this.MainForm.DefaultFont);
                    this.SwitchFocus(ITEM_BARCODE, strFastInputText);
                    return -1;
                }

                this.textBox_itemBarcode.Text = strItemBarcode;
            }

            this.ActiveItemBarcode = this.textBox_itemBarcode.Text;

            if (this.NeedVerifyBarcode == true)
            {
                // 形式校验条码号
                // return:
                //      -2  服务器没有配置校验方法,无法校验
                //      -1  error
                //      0   不是合法的条码号
                //      1   是合法的读者证条码号
                //      2   是合法的册条码号
                nRet = VerifyBarcode(
                    this.MainForm.FocusLibraryCode, // this.Channel.LibraryCodeList,
                    this.textBox_itemBarcode.Text,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;

                // 输入的条码格式不合法
                if (nRet == 0)
                {
                    strFastInputText = ChargingInfoDlg.Show(
                        this.CharingInfoHost,
                        "您输入的条码 " + this.textBox_itemBarcode.Text + " 格式不正确(" + strError + ")。请重新输入。",
                        InfoColor.Red,
                        "扫入册条码",
                        this.InfoDlgOpacity,
                        this.MainForm.DefaultFont);
                    this.SwitchFocus(ITEM_BARCODE, strFastInputText);
                    return -1;
                }

                // 发现实际输入的是读者证条码号
                if (nRet == 1)
                {
                    // 2008/1/2 
                    if (this.AutoSwitchReaderBarcode == true)
                    {
                        string strItemBarcode = this.textBox_itemBarcode.Text;
                        this.textBox_itemBarcode.Text = "";

                        // 如果当前在“还”或者“验证还”状态,需要修改为“借”?
                        if (this.FuncState == FuncState.Return
                            || this.FuncState == FuncState.VerifyReturn)
                            this.FuncState = FuncState.Borrow;
                        else
                            this.FuncState = FuncState.VerifyReturn;

                        // 直接跨越而去执行借阅功能
                        this.textBox_readerBarcode.Text = strItemBarcode;
                        this.button_loadReader_Click(null, null);

                        // this.SwitchFocus(READER_BARCODE, strItemBarcode);
                        return 0;
                    }

                    // 刻板式,要求必须类型匹配
                    strFastInputText = ChargingInfoDlg.Show(
                        this.CharingInfoHost,
                        "您输入的条码号 " + this.textBox_itemBarcode.Text + " 是读者证条码号。请输入册条码号。",
                        InfoColor.Red,
                        "扫入册条码",
                        this.InfoDlgOpacity,
                        this.MainForm.DefaultFont);
                    this.SwitchFocus(ITEM_BARCODE, strFastInputText);
                    return -1;
                }

                // 对于服务器没有配置校验功能,但是前端发出了校验要求的情况,警告一下
                if (nRet == -2)
                    MessageBox.Show(this, "警告:前端开启了校验条码功能,但是服务器端缺乏相应的脚本函数,无法校验条码。\r\n\r\n若要避免出现此警告对话框,请关闭前端校验功能");
            }

            EnableControls(false);

            try
            {
                if (this.NoBiblioAndItemInfo == false)
                {
                    // 借阅操作前装入册记录
                    nRet = LoadItemAndBiblioRecord(this.textBox_itemBarcode.Text,
                        out strError);
                    if (nRet == 0)
                    {
                        strError = "册条码号 '" + this.textBox_itemBarcode.Text + "' 没有找到";
                        goto ERROR1;
                    }

                    if (nRet == -1)
                        goto ERROR1;
                }

                long lRet = 0;

                // 借/续借
                if (this.FuncState == FuncState.Borrow
                    || this.FuncState == FuncState.Renew
                    || this.FuncState == FuncState.VerifyRenew)
                {
                    string strOperName = "";

                    if (this.FuncState == FuncState.Borrow)
                    {
                        strOperName = "借阅";
                    }
                    else if (this.FuncState == FuncState.VerifyRenew)
                    {
                        strOperName = "续借";
                    }

                    stop.OnStop += new StopEventHandler(this.DoStop);
                    stop.Initial("正在进行" + strOperName + "操作: " + this.textBox_readerBarcode.Text
                    + " " + strOperName + " " + this.textBox_itemBarcode.Text + " ...");
                    stop.BeginLoop();

                    if (this.NoBiblioAndItemInfo == false)
                    {
                        // 清除书目和实体信息
                        SetBiblioRenderString("(空)");
                        SetItemRenderString("(空)");
                    }

                    try
                    {
                        string strReaderRecord = "";
                        string strConfirmItemRecPath = null;

                        bool bRenew = false;
                        if (this.FuncState == FuncState.VerifyRenew
                            || this.FuncState == dp2Circulation.FuncState.Renew)
                            bRenew = true;

                    REDO:
                        string[] aDupPath = null;
                        string[] item_records = null;
                        string[] reader_records = null;
                        string[] biblio_records = null;
                        string strOutputReaderBarcode = "";

                        BorrowInfo borrow_info = null;

                        // item返回的格式
                        string strItemReturnFormats = "";
                        // 2008/5/9 有必要才返回item信息
                        if (this.NoBiblioAndItemInfo == false)
                            strItemReturnFormats = this.RenderFormat;
                        if (this.MainForm.ChargingNeedReturnItemXml == true)
                        {
                            if (String.IsNullOrEmpty(strItemReturnFormats) == false)
                                strItemReturnFormats += ",";
                            strItemReturnFormats += "xml";
                        }

                        // biblio返回的格式
                        string strBiblioReturnFormats = "";
                        if (this.NoBiblioAndItemInfo == false)
                            strBiblioReturnFormats = this.RenderFormat;

                        string strStyle = "reader";
                        if (this.NoBiblioAndItemInfo == false)
                            strStyle += ",item,biblio";
                        else if (this.MainForm.ChargingNeedReturnItemXml)
                            strStyle += ",item";

                        //if (this.MainForm.TestMode == true)
                        //    strStyle += ",testmode";

                        lRet = Channel.Borrow(
                            stop,
                            bRenew,
                            this.FuncState == dp2Circulation.FuncState.Renew ? "" : this.textBox_readerBarcode.Text,
                            this.textBox_itemBarcode.Text,
                            strConfirmItemRecPath,
                            this.Force,
                            this.OneReaderItemBarcodes,
                            strStyle,   //this.NoBiblioAndItemInfo == false ? "reader,item,biblio" : "reader",
                            strItemReturnFormats, // this.RenderFormat, // "html",
                            out item_records,   // strItemRecord,
                            this.PatronRenderFormat + ",xml", // "html",
                            out reader_records, // strReaderRecord,
                            strBiblioReturnFormats,
                            out biblio_records,
                            out aDupPath,
                            out strOutputReaderBarcode,
                            out borrow_info,
                            out strError);

                        if (reader_records != null && reader_records.Length > 0)
                            strReaderRecord = reader_records[0];

                        // 刷新读者信息
                        if (String.IsNullOrEmpty(strReaderRecord) == false)
                            SetReaderRenderString(ReplaceMacro(strReaderRecord));

                        // 显示书目和实体信息
                        if (this.NoBiblioAndItemInfo == false)
                        {
                            string strItemRecord = "";
                            if (item_records != null && item_records.Length > 0)
                                strItemRecord = item_records[0];
                            if (String.IsNullOrEmpty(strItemRecord) == false)
                                this.SetItemRenderString(ReplaceMacro(strItemRecord));

                            string strBiblioRecord = "";
                            if (biblio_records != null && biblio_records.Length > 0)
                                strBiblioRecord = biblio_records[0];
                            if (String.IsNullOrEmpty(strBiblioRecord) == false)
                                this.SetBiblioRenderString(ReplaceMacro(strBiblioRecord));
                        }

                        string strItemXml = "";
                        if (this.MainForm.ChargingNeedReturnItemXml == true
                            && item_records != null)
                        {
                            Debug.Assert(item_records != null, "");

                            if (item_records.Length > 0)
                            {
                                // xml总是在最后一个
                                strItemXml = item_records[item_records.Length - 1];
                            }
                        }

                        if (lRet == -1)
                        {
                            // 清除记忆的册条码号
                            this.m_itemBarcodes.Clear();

                            if (Channel.ErrorCode == DigitalPlatform.LibraryClient.localhost.ErrorCode.ItemBarcodeDup)
                            {
                                // this.MainForm.PrepareSearch();
                                LibraryChannel channel = this.MainForm.GetChannel();
                                try
                                {
                                    ItemBarcodeDupDlg dupdlg = new ItemBarcodeDupDlg();
                                    MainForm.SetControlFont(dupdlg, this.Font, false);
                                    string strErrorNew = "";
                                    nRet = dupdlg.Initial(
                                        this.MainForm,
                                        aDupPath,
                                        "因册条码号发生重复," + strOperName + "操作被拒绝。\r\n\r\n可根据下面列出的详细信息,选择适当的册记录,重试操作。\r\n\r\n原始出错信息:\r\n" + strError,
                                        channel,    // this.MainForm.Channel,
                                        this.MainForm.Stop,
                                        out strErrorNew);
                                    if (nRet == -1)
                                    {
                                        // 初始化对话框失败
                                        MessageBox.Show(this, strErrorNew);
                                        goto ERROR1;
                                    }

                                    this.MainForm.AppInfo.LinkFormState(dupdlg, "ChargingForm_dupdlg_state");
                                    dupdlg.ShowDialog(this);
                                    this.MainForm.AppInfo.UnlinkFormState(dupdlg);

                                    if (dupdlg.DialogResult == DialogResult.Cancel)
                                        goto ERROR1;

                                    strConfirmItemRecPath = dupdlg.SelectedRecPath;

                                    goto REDO;
                                }
                                finally
                                {
                                    this.MainForm.ReturnChannel(channel);
                                    // this.MainForm.EndSearch();
                                }
                            }

                            goto ERROR1;
                        }

                        /*
                         * 属于多余的操作? 2008/5/9 去除
                        if (String.IsNullOrEmpty(strConfirmItemRecPath) == false
                            && this.NoBiblioAndItemInfo == false)
                        {
                            // 借阅操作后装入准确的册记录
                            string strError_1 = "";
                            int nRet_1 = LoadItemAndBiblioRecord("@path:" + strConfirmItemRecPath,
                                out strError_1);
                            if (nRet == -1)
                            {
                                strError_1 = "册记录 '" + strConfirmItemRecPath + "' 没有找到";
                                MessageBox.Show(this, strError);
                            }
                        }
                        */

                        DateTime end_time = DateTime.Now;

                        string strReaderSummary = "";
                        if (reader_records != null && reader_records.Length > 1)
                        {
                            /*
                            // 2012/1/5
                            // 加入缓存
                            this.MainForm.SetReaderXmlCache(strOutputReaderBarcode,
                                "",
                                reader_records[1]);
                             * */
                            strReaderSummary = Global.GetReaderSummary(reader_records[1]);
                        }

                        this.MainForm.OperHistory.BorrowAsync(
                            this,
                            bRenew,
                            strOutputReaderBarcode,
                            this.textBox_itemBarcode.Text,
                            strConfirmItemRecPath,
                            strReaderSummary,
                            strItemXml,
                            borrow_info,
                            start_time,
                            end_time);

                    }
                    finally
                    {
                        stop.EndLoop();
                        stop.OnStop -= new StopEventHandler(this.DoStop);
                        stop.Initial("");
                    }

                    // 累积同一读者借阅成功的册条码号
                    this.oneReaderItemBarcodes.Add(this.textBox_itemBarcode.Text);

                    if (lRet == 1)
                    {
                        // 有重复册条码号
                        strFastInputText = ChargingInfoDlg.Show(
                        this.CharingInfoHost,
                            strError.Replace("\r\n", "\r\n\r\n"),
                            InfoColor.Yellow,
                            strOperName,    // "caption",
                        this.InfoDlgOpacity,
                        this.MainForm.DefaultFont);
                    }
                    else
                    {
                        if (this.GreenDisable == false)
                        {
                            strFastInputText = ChargingInfoDlg.Show(
                        this.CharingInfoHost,
                                strOperName + "成功",
                                InfoColor.Green,
                                strOperName,    // "caption",
                            this.InfoDlgOpacity,
                        this.MainForm.DefaultFont);
                        }
                    }
                }
                else if (this.FuncState == FuncState.Return
                    || this.FuncState == FuncState.VerifyReturn
                    || this.FuncState == FuncState.Lost)
                {
                    string strAction = "";
                    string strLocation = "";    // 还回的册的馆藏地点

                    if (this.FuncState == FuncState.Return)
                        strAction = "return";
                    if (this.FuncState == FuncState.VerifyReturn)
                        strAction = "return";
                    if (this.FuncState == FuncState.Lost)
                        strAction = "lost";

                    Debug.Assert(strAction != "", "");

                    string strOperName = "";

                    if (this.FuncState == FuncState.Return)
                    {
                        strOperName = "还书";
                    }
                    else if (this.FuncState == FuncState.VerifyReturn)
                    {
                        strOperName = "验证还书";
                    }
                    else
                    {
                        strOperName = "丢失";
                    }

                    // 还书
                    stop.OnStop += new StopEventHandler(this.DoStop);
                    stop.Initial("正在进行 " + strOperName + " 操作: " + this.textBox_readerBarcode.Text
                    + " 还 " + this.textBox_itemBarcode.Text + " ...");
                    stop.BeginLoop();

                    if (this.NoBiblioAndItemInfo == false)
                    {
                        // 清除书目和实体信息
                        SetBiblioRenderString("(空)");
                        SetItemRenderString("(空)");
                    }

                    try
                    {
                        string strReaderRecord = "";
                        string strConfirmItemRecPath = null;
                        string strOutputReaderBarcode = "";

                    REDO:
                        string[] aDupPath = null;
                        string[] item_records = null;
                        string[] reader_records = null;
                        string[] biblio_records = null;

                        ReturnInfo return_info = null;

                        // item返回的格式 2008/5/9
                        string strItemReturnFormats = "";
                        if (this.NoBiblioAndItemInfo == false)
                            strItemReturnFormats = this.RenderFormat;
                        if (this.MainForm.ChargingNeedReturnItemXml == true)
                        {
                            if (String.IsNullOrEmpty(strItemReturnFormats) == false)
                                strItemReturnFormats += ",";
                            strItemReturnFormats += "xml";
                        }

                        // biblio返回的格式
                        string strBiblioReturnFormats = "";
                        if (this.NoBiblioAndItemInfo == false)
                            strBiblioReturnFormats = this.RenderFormat;

                        string strStyle = "reader";
                        if (this.NoBiblioAndItemInfo == false)
                            strStyle += ",item,biblio";
                        else if (this.MainForm.ChargingNeedReturnItemXml)
                            strStyle += ",item";

                        //if (this.MainForm.TestMode == true)
                        //    strStyle += ",testmode";

                        lRet = Channel.Return(
                            stop,
                            strAction,
                            this.textBox_readerBarcode.Text,
                            this.textBox_itemBarcode.Text,
                            strConfirmItemRecPath,
                            this.Force,
                            strStyle,   // this.NoBiblioAndItemInfo == false ? "reader,item,biblio" : "reader",
                            strItemReturnFormats,
                            out item_records,
                            this.PatronRenderFormat + ",xml", // "html",
                            out reader_records,
                            strBiblioReturnFormats,
                            out biblio_records,
                            out aDupPath,
                            out strOutputReaderBarcode,
                            out return_info,
                            out strError);
                        if (lRet == -1)
                        {
                            // 清除记忆的册条码号
                            this.m_itemBarcodes.Clear();

                            if (Channel.ErrorCode == DigitalPlatform.LibraryClient.localhost.ErrorCode.ItemBarcodeDup)
                            {
                                // this.MainForm.PrepareSearch();
                                LibraryChannel channel = this.MainForm.GetChannel();
                                try
                                {
                                    ItemBarcodeDupDlg dupdlg = new ItemBarcodeDupDlg();
                                    MainForm.SetControlFont(dupdlg, this.Font, false);
                                    string strErrorNew = "";
                                    nRet = dupdlg.Initial(
                                        this.MainForm,
                                        aDupPath,
                                        "因册条码号发生重复,还回操作被拒绝。\r\n\r\n可根据下面列出的详细信息,选择适当的册记录,重试操作。\r\n\r\n原始出错信息:\r\n" + strError,
                                        channel,    // this.MainForm.Channel,
                                        this.MainForm.Stop,
                                        out strErrorNew);
                                    if (nRet == -1)
                                    {
                                        // 初始化对话框失败
                                        MessageBox.Show(this, strErrorNew);
                                        goto ERROR1;
                                    }

                                    this.MainForm.AppInfo.LinkFormState(dupdlg, "ChargingForm_dupdlg_state");
                                    dupdlg.ShowDialog(this);
                                    this.MainForm.AppInfo.UnlinkFormState(dupdlg);

                                    if (dupdlg.DialogResult == DialogResult.Cancel)
                                        goto ERROR1;

                                    strConfirmItemRecPath = dupdlg.SelectedRecPath;

                                    goto REDO;
                                }
                                finally
                                {
                                    this.MainForm.ReturnChannel(channel);
                                    // this.MainForm.EndSearch();
                                }
                            }

                            goto ERROR1;
                        }

                        if (return_info != null)
                        {
                            strLocation = StringUtil.GetPureLocation(return_info.Location);
                        }

                        // 确定还书的读者证条码号
                        this.ActiveReaderBarcode = strOutputReaderBarcode;

                        if (reader_records != null && reader_records.Length > 0)
                            strReaderRecord = reader_records[0];

                        string strReaderSummary = "";
                        if (reader_records != null && reader_records.Length > 1)
                        {
                            /*
                            // 2012/1/5
                            // 加入缓存
                            this.MainForm.SetReaderXmlCache(strOutputReaderBarcode,
                                "",
                                reader_records[1]);
                             * */
                            strReaderSummary = Global.GetReaderSummary(reader_records[1]);
                        }

                        // 刷新读者信息
                        SetReaderRenderString(ReplaceMacro(strReaderRecord));

                        // 显示书目和实体信息
                        if (this.NoBiblioAndItemInfo == false)
                        {
                            string strItemRecord = "";
                            if (item_records != null && item_records.Length > 0)
                                strItemRecord = item_records[0];
                            if (String.IsNullOrEmpty(strItemRecord) == false)
                                SetItemRenderString(ReplaceMacro(strItemRecord));

                            string strBiblioRecord = "";
                            if (biblio_records != null && biblio_records.Length > 0)
                                strBiblioRecord = biblio_records[0];
                            if (String.IsNullOrEmpty(strBiblioRecord) == false)
                                this.SetBiblioRenderString(ReplaceMacro(strBiblioRecord));

                            /*
                            {
                                // 以前的方法,要多用一次API

                                string strError_1 = "";
                                int nRet_1 = 0;

                                if (String.IsNullOrEmpty(strConfirmItemRecPath) == false)
                                {
                                    nRet_1 = LoadItemAndBiblioRecord("@path:" + strConfirmItemRecPath,
                                         out strError_1);
                                }
                                else if (aDupPath != null && aDupPath.Length == 1)
                                {
                                    nRet_1 = LoadItemAndBiblioRecord("@path:" + aDupPath[0],
                                         out strError_1);
                                }
                                else
                                {
                                    nRet_1 = LoadItemAndBiblioRecord(this.textBox_itemBarcode.Text,
                                         out strError_1);
                                }

                                if (nRet_1 == -1)
                                    MessageBox.Show(this, strError_1);
                            }
                             * */
                        }

                        string strItemXml = "";
                        if (this.MainForm.ChargingNeedReturnItemXml == true
                            && item_records != null)
                        {
                            if (item_records.Length > 0)
                            {
                                // xml总是在最后一个
                                strItemXml = item_records[item_records.Length - 1];
                            }
                        }

                        DateTime end_time = DateTime.Now;

                        this.MainForm.OperHistory.ReturnAsync(
                            this,
                            strAction,  // this.FuncState == FuncState.Lost,
                            strOutputReaderBarcode, // this.textBox_readerBarcode.Text,
                            this.textBox_itemBarcode.Text,
                            strConfirmItemRecPath,
                            strReaderSummary,
                            strItemXml,
                            return_info,
                            start_time,
                            end_time);

                    }
                    finally
                    {
                        stop.EndLoop();
                        stop.OnStop -= new StopEventHandler(this.DoStop);
                        stop.Initial("");
                    }

                    if (lRet == 1)
                    {
                        // 超期情况/放入预约架/有重复册条码号
                        strFastInputText = ChargingInfoDlg.Show(
                        this.CharingInfoHost,
                            strError.Replace("\r\n", "\r\n\r\n"),
                            InfoColor.Yellow,
                            strOperName,    // "caption",
                        this.InfoDlgOpacity,
                        this.MainForm.DefaultFont);
                    }
                    else
                    {
                        if (this.GreenDisable == false)
                        {
                            string strText = "还书成功";
                            if (string.IsNullOrEmpty(strLocation) == false)
                                strText += "\r\n\r\n馆藏地: " + strLocation;
                            strFastInputText = ChargingInfoDlg.Show(
                                this.CharingInfoHost,
                                strText,
                                InfoColor.Green,
                                strOperName,    // "caption",
                            this.InfoDlgOpacity,
                        this.MainForm.DefaultFont);
                        }
                    }
                } // endif if 还书
                else
                {
                    strFastInputText = ChargingInfoDlg.Show(
                        this.CharingInfoHost,
                        "暂不支持",
                        InfoColor.Red,
                        "caption",  // 
                        this.InfoDlgOpacity,
                        this.MainForm.DefaultFont);
                }

            }
            finally
            {
                EnableControls(true);
            }

            // 焦点回到册条码号输入域
            this.SwitchFocus(ITEM_BARCODE, strFastInputText);
            return 1;
        ERROR1:
            strFastInputText = ChargingInfoDlg.Show(
                this.CharingInfoHost,
                strError,
                InfoColor.Red,
                "caption",
                this.InfoDlgOpacity,
                this.MainForm.DefaultFont);
            EnableControls(true);

            // 焦点回到册条码号textbox
            /*
            this.textBox_itemBarcode.SelectAll();
            this.textBox_itemBarcode.Focus();
             * */
            this.SwitchFocus(ITEM_BARCODE, strFastInputText);
            return -1;
        }