Esempio 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 Renew(string patronBarcode,
                         string itemBarcode,
                         out RenewResponse_30 response30,
                         out string responseText,
                         out string error)
        {
            error = "";
            int nRet = 0;

            responseText = "";
            response30   = null;

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

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

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

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

            response30 = response as RenewResponse_30;
            if (response30 == null)
            {
                error = "返回的不是30消息";
                return(-1);
            }

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

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

            return(1);
        }
Esempio n. 2
0
        // 续借
        // return.Value
        //      -1  出错
        //      0   请求失败
        //      1   请求成功
        public async Task <RenewResult> RenewAsync(string patronBarcode,
                                                   string itemBarcode)
        {
            Renew_29 request = new Renew_29()
            {
                TransactionDate_18    = SIPUtility.NowDateTime,
                AO_InstitutionId_r    = SIPConst.AO_Value,
                AA_PatronIdentifier_r = patronBarcode,
                AB_ItemIdentifier_o   = itemBarcode,
            };

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

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

            var result = await SendAndRecvAsync(requestText);

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

            var response30 = result.Response as RenewResponse_30;

            if (response30 == null)
            {
                return(new RenewResult
                {
                    Value = -1,
                    ErrorInfo = "返回的不是30消息"
                });
            }

            return(new RenewResult
            {
                Value = response30.Ok_1 == "0" ? 0 : 1,
                ErrorInfo = response30.AF_ScreenMessage_o,
                Result = response30
            });
        }
Esempio n. 3
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;
            }
        }