Ejemplo n.º 1
0
        /// <summary>
        /// 借书
        /// </summary>
        /// <param name="patronBarcode"></param>
        /// <param name="itemBarcode"></param>
        /// <param name="error"></param>
        /// <returns>
        /// 1 借书成功
        /// 0 借书失败
        /// -1 出错
        /// -2 尚未登录,需要自动测试中断
        /// </returns>
        public int Checkout(string patronBarcode,
                            string itemBarcode,
                            out CheckoutResponse_12 response12,
                            out string responseText,
                            out string error)
        {
            error = "";
            int nRet = 0;

            responseText = "";
            response12   = null;


            Checkout_11 request = new Checkout_11()
            {
                TransactionDate_18    = SIPUtility.NowDateTime,
                AA_PatronIdentifier_r = patronBarcode,
                AB_ItemIdentifier_r   = itemBarcode,
                AO_InstitutionId_r    = SIPConst.AO_Value,
            };

            request.SetDefaultValue();//设置其它默认值

            // 发送和接收消息
            string      requestText = request.ToText();
            BaseMessage response    = null;

            nRet = SendAndRecvMessage(requestText,
                                      out response,
                                      out responseText,
                                      out error);
            if (nRet == -1)
            {
                return(-1);
            }

            response12 = response as CheckoutResponse_12;
            if (response12 == null)
            {
                error = "返回的不是12消息";
                return(-1);
            }

            //if (this.IsLogin == false)
            //{
            //    error = "尚未登录ASC系统";
            //    return -2;
            //}

            if (response12.Ok_1 == "0")
            {
                return(0);
            }

            return(1);
        }
Ejemplo n.º 2
0
        private void button_checkOut_Click(object sender, EventArgs e)
        {
            Checkout_11 request = new Checkout_11()
            {
                SCRenewalPolicy_1      = "Y",
                NoBlock_1              = "N",
                TransactionDate_18     = this.TransactionDate,
                AO_InstitutionId_r     = "dp2Library",
                AA_PatronIdentifier_r  = this.textBox_checkout_readerBarcode.Text,
                AD_PatronPassword_o    = this.textBox_checkout_readerPassword.Text,
                BO_FeeAcknowledged_1_o = "N",
                BI_Cancel_1_o          = "N",
                NbDueDate_18           = "                  ",
                AC_TerminalPassword_r  = "",
            };

            Button button       = sender as Button;
            string responseText = "";
            string error        = "";

            string[] barcodes = this.textBox_barcodes.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            int      i        = 0;

            foreach (string barcode in barcodes)
            {
                this.Update();
                Application.DoEvents();
                Thread.Sleep(100);

                request.AB_ItemIdentifier_r = barcode;

                string cmdText = request.ToText();

                this.Print("send:" + cmdText);
                BaseMessage response = null;
                int         nRet     = SCHelper.Instance.SendAndRecvMessage(cmdText,
                                                                            out response,
                                                                            out responseText,
                                                                            out error);
                if (nRet == -1)
                {
                    MessageBox.Show(error);
                    this.Print("error:" + error);
                    return;
                }

                this.Print("recv:" + responseText);

                button.Text = "借书(" + (i + 1).ToString() + ")";
                i++;
            }
        }
Ejemplo n.º 3
0
        // 借书
        // return.Value
        //      -1  出错
        //      0   请求失败
        //      1   请求成功
        public async Task <CheckoutResult> CheckoutAsync(string patronBarcode,
                                                         string itemBarcode)
        {
            Checkout_11 request = new Checkout_11()
            {
                TransactionDate_18    = SIPUtility.NowDateTime,
                AA_PatronIdentifier_r = patronBarcode,
                AB_ItemIdentifier_r   = itemBarcode,
                AO_InstitutionId_r    = SIPConst.AO_Value,
            };

            request.SetDefaulValue();//设置其它默认值

            // 发送和接收消息
            string requestText = request.ToText();

            var result = await SendAndRecvAsync(requestText);

            if (result.Value == -1)
            {
                return(new CheckoutResult
                {
                    Value = -1,
                    ErrorInfo = result.ErrorInfo,
                    ErrorCode = result.ErrorCode
                });
            }

            var response12 = result.Response as CheckoutResponse_12;

            if (response12 == null)
            {
                return(new CheckoutResult
                {
                    Value = -1,
                    ErrorInfo = "返回的不是12消息"
                });
            }

            return(new CheckoutResult
            {
                Value = response12.Ok_1 == "0" ? 0 : 1,
                ErrorInfo = response12.AF_ScreenMessage_o,
                Result = response12
            });
        }
Ejemplo n.º 4
0
        //发送消息
        private void toolStripLabel_send_Click(object sender, EventArgs e)
        {
            string cmdText = "";

            try
            {
                if (this.tabControl_main.SelectedTab == this.tabPage_Login93)
                {
                    Login_93 request93 = new Login_93()
                    {
                        UIDAlgorithm_1 = this.textBox_Login93_UIDAlgorithm_1.Text,
                        PWDAlgorithm_1 = this.textBox_Login93_PWDAlgorithm_1.Text,

                        CN_LoginUserId_r   = getText(this.textBox_Login93_loginUserId_CN_r),   //.Text == "null" ? null : this.textBox_Login93_loginUserId_CN_r.Text
                        CO_LoginPassword_r = getText(this.textBox_Login93_loginPassword_CO_r), //.Text == "null" ? null : this.textBox_Login93_loginPassword_CO_r.Text,
                        CP_LocationCode_o  = getText(this.textBox_Login93_locationCode_CP_o),  //.Text == "null" ? null : this.textBox_Login93_locationCode_CP_o.Text
                    };
                    cmdText = request93.ToText();
                }
                else if (this.tabControl_main.SelectedTab == this.tabPage_SCStatus99)
                {
                    SCStatus_99 request = new SCStatus_99()
                    {
                        StatusCode_1      = this.textBox_SCStatus99_statusCode_1.Text,
                        MaxPrintWidth_3   = this.textBox_SCStatus99_maxPrintWidth_3.Text,
                        ProtocolVersion_4 = this.textBox_SCStatus99_protocolVersion_4.Text
                    };
                    cmdText = request.ToText();
                }
                else if (this.tabControl_main.SelectedTab == this.tabPage_Checkout11)
                {
                    Checkout_11 request = new Checkout_11()
                    {
                        SCRenewalPolicy_1  = this.textBox_Checkout11_SCRenewalPolicy_1.Text,
                        NoBlock_1          = this.textBox_Checkout11_noBlock_1.Text,
                        TransactionDate_18 = this.textBox_Checkout11_transactionDate_18.Text,
                        NbDueDate_18       = this.textBox_Checkout11_nbDueDate_18.Text,

                        AO_InstitutionId_r    = getText(this.textBox_Checkout11_institutionId_AO_r),     //.Text == "null" ? null : this.textBox_Checkout11_institutionId_AO_r.Text,
                        AA_PatronIdentifier_r = getText(this.textBox_Checkout11_patronIdentifier_AA_r),  //.Text == "null" ? null : this.textBox_Checkout11_patronIdentifier_AA_r.Text,
                        AB_ItemIdentifier_r   = getText(this.textBox_Checkout11_itemIdentifier_AB_r),    //.Text == "null" ? null : this.textBox_Checkout11_itemIdentifier_AB_r.Text,

                        AC_TerminalPassword_r  = getText(this.textBox_Checkout11_terminalPassword_AC_r), //.Text == "null" ? null : this.textBox_Checkout11_terminalPassword_AC_r.Text;
                        CH_ItemProperties_o    = getText(this.textBox_Checkout11_itemProperties_CH_o),
                        AD_PatronPassword_o    = getText(this.textBox_Checkout11_patronPassword_AD_o),
                        BO_FeeAcknowledged_1_o = getText(this.textBox_Checkout11_feeAcknowledged_BO_1_o),
                        BI_Cancel_1_o          = getText(this.textBox_Checkout11_cancel_BI_1_o),
                    };
                    cmdText = request.ToText();
                }
                else if (this.tabControl_main.SelectedTab == this.tabPage_Checkin09)
                {
                    Checkin_09 request = new Checkin_09()
                    {
                        NoBlock_1          = this.textBox_Checkin09_noBlock_1.Text,
                        TransactionDate_18 = this.textBox_Checkin09_transactionDate_18.Text,
                        ReturnDate_18      = this.textBox_Checkin09_returnDate_18.Text,

                        AP_CurrentLocation_r = getText(this.textBox_Checkin09_currentLocation_AP_r),
                        AO_InstitutionId_r   = getText(this.textBox_Checkin09_institutionId_AO_r),
                        AB_ItemIdentifier_r  = getText(this.textBox_Checkin09_itemIdentifier_AB_r),

                        AC_TerminalPassword_r = getText(this.textBox_Checkin09_terminalPassword_AC_r),
                        CH_ItemProperties_o   = getText(this.textBox_Checkin09_itemProperties_CH_o),
                        BI_Cancel_1_o         = getText(this.textBox_Checkin09_cancel_BI_1_o),
                    };
                    cmdText = request.ToText();
                }
                else if (this.tabControl_main.SelectedTab == this.tabPage_PatronInformation63)
                {
                    PatronInformation_63 request = new PatronInformation_63()
                    {
                        Language_3         = this.textBox_PatronInformation63_language_3.Text,
                        TransactionDate_18 = this.textBox_PatronInformation63_transactionDate_18.Text,
                        Summary_10         = this.textBox_PatronInformation63_summary_10.Text,

                        AO_InstitutionId_r    = getText(this.textBox_PatronInformation63_institutionId_AO_r),
                        AA_PatronIdentifier_r = getText(this.textBox_PatronInformation63_patronIdentifier_AA_r),
                        AC_TerminalPassword_o = getText(this.textBox_PatronInformation63_terminalPassword_AC_o),

                        AD_PatronPassword_o = getText(this.textBox_PatronInformation63_patronPassword_AD_o),
                        BP_StartItem_o      = getText(this.textBox_PatronInformation63_startItem_BP_o),
                        BQ_EndItem_o        = getText(this.textBox_PatronInformation63_endItem_BQ_o),
                    };
                    cmdText = request.ToText();
                }
                else if (this.tabControl_main.SelectedTab == this.tabPage_ItemInformation17)
                {
                    ItemInformation_17 request = new ItemInformation_17()
                    {
                        TransactionDate_18 = this.textBox_ItemInformation17_transactionDate_18.Text,

                        AO_InstitutionId_r    = getText(this.textBox_ItemInformation17_institutionId_AO_r),
                        AB_ItemIdentifier_r   = getText(this.textBox_ItemInformation17_itemIdentifier_AB_r),
                        AC_TerminalPassword_o = getText(this.textBox_ItemInformation17_terminalPassword_AC_o),
                    };
                    cmdText = request.ToText();
                }
                else if (this.tabControl_main.SelectedTab == this.tabPage_Renew29)
                {
                    Renew_29 request = new Renew_29()
                    {
                        ThirdPartyAllowed_1 = this.textBox_Renew29_thirdPartyAllowed_1.Text,
                        NoBlock_1           = this.textBox_Renew29_noBlock_1.Text,
                        TransactionDate_18  = this.textBox_Renew29_transactionDate_18.Text,
                        NbDueDate_18        = this.textBox_Renew29_nbDueDate_18.Text,

                        AO_InstitutionId_r    = getText(this.textBox_Renew29_institutionId_AO_r),
                        AA_PatronIdentifier_r = getText(this.textBox_Renew29_patronIdentifier_AA_r),

                        AD_PatronPassword_o  = getText(this.textBox_Renew29_patronPassword_AD_o),
                        AB_ItemIdentifier_o  = getText(this.textBox_Renew29_itemIdentifier_AB_o),
                        AJ_TitleIdentifier_o = getText(this.textBox_Renew29_titleIdentifier_AJ_o),

                        AC_TerminalPassword_o  = getText(this.textBox_Renew29_terminalPassword_AC_o),
                        CH_ItemProperties_o    = getText(this.textBox_Renew29_itemProperties_CH_o),
                        BO_FeeAcknowledged_1_o = getText(this.textBox_Renew29_feeAcknowledged_BO_1_o),
                    };

                    cmdText = request.ToText();
                }
                else if (this.tabControl_main.SelectedTab == this.tabPage_FeePaid37)
                {
                    FeePaid_37 request = new FeePaid_37()
                    {
                        TransactionDate_18 = getText(this.textBox_FeePaid37_transactionDate_18),
                        FeeType_2          = getText(this.textBox_FeePaid37_feeType),
                        PaymentType_2      = getText(this.textBox_FeePaid37_paymentType),
                        CurrencyType_3     = getText(this.textBox_FeePaid37_currencyType),

                        BV_FeeAmount_r        = getText(this.textBox_FeePaid37_feeAmount),
                        AO_InstitutionId_r    = getText(this.textBox_FeePaid37_institutionId_AO_r),
                        AA_PatronIdentifier_r = getText(this.textBox_FeePaid37_patronIdentifier_AA_r),
                        AC_TerminalPassword_o = getText(this.textBox_FeePaid37_terminalPassword_AC_o),

                        AD_PatronPassword_o = getText(this.textBox_FeePaid37_patronPassword_AD_o),
                        CG_FeeIdentifier_o  = getText(this.textBox_FeePaid37_feeIdentifier_CG_o),
                        BK_TransactionId_o  = getText(this.textBox_FeePaid37_transactionId_BK_o),
                    };
                    cmdText = request.ToText();
                }



                //发送命令
                this.txtMsg.Text = cmdText;
                this.sendCmd();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
        }