/// <summary> /// 获取册信息 /// </summary> /// <param name="itemBarcode"></param> /// <param name="error"></param> /// <returns> /// -1 出错 /// 0 成功 /// </returns> public int GetItemInformation(string itemBarcode, out ItemInformationResponse_18 response18, out string responseText, out string error) { error = ""; int nRet = 0; responseText = ""; response18 = null; ItemInformation_17 request = new ItemInformation_17() { TransactionDate_18 = SIPUtility.NowDateTime, AO_InstitutionId_r = SIPConst.AO_Value, AB_ItemIdentifier_r = itemBarcode, }; request.SetDefaultValue();//设置其它默认值 // 发送和接收消息 string requestText = request.ToText(); BaseMessage response = null; nRet = SendAndRecvMessage(requestText, out response, out responseText, out error); if (nRet == -1) { return(-1); } response18 = response as ItemInformationResponse_18; if (response18 == null) { error = "返回的不是18消息"; return(-1); } //if (this.IsLogin == false) //{ // error = "尚未登录ASC系统"; // return -2; //} return(0); }
private void button_getItemInfo_Click(object sender, EventArgs e) { ItemInformation_17 request = new ItemInformation_17() { TransactionDate_18 = this.TransactionDate, AO_InstitutionId_r = "dp2Library", AC_TerminalPassword_o = "", }; 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); this.button_getItemInfo.Text = "获取(" + (i + 1).ToString() + ")"; i++; } }
public async Task <GetItemInfoResult> GetItemInfoAsync( string oi, string itemBarcode) { ItemInformation_17 request = new ItemInformation_17() { TransactionDate_18 = SIPUtility.NowDateTime, AO_InstitutionId_r = oi, AB_ItemIdentifier_r = itemBarcode, }; request.SetDefaulValue();//设置其它默认值 // 发送和接收消息 string requestText = request.ToText(); var result = await SendAndRecvAsync(requestText); if (result.Value == -1) { return(new GetItemInfoResult { Value = -1, ErrorInfo = result.ErrorInfo, ErrorCode = result.ErrorCode }); } var response18 = result.Response as ItemInformationResponse_18; if (response18 == null) { return(new GetItemInfoResult { Value = -1, ErrorInfo = "返回的不是18消息" }); } return(new GetItemInfoResult { Value = 0, Result = response18 }); }
public async Task <NormalResult> GetItemInfo(string oi, string barcode) { ItemInformation_17 request = new ItemInformation_17() { TransactionDate_18 = this.TransactionDate, AO_InstitutionId_r = oi, AC_TerminalPassword_o = "", }; request.AB_ItemIdentifier_r = barcode; string cmdText = request.ToText(); // this.Print("send:" + cmdText); BaseMessage response = null; var result = await SendAndRecvAsync(cmdText); if (result.Value == -1) { return(result); } var response18 = response as ItemInformationResponse_18; if (response18 == null) { return(new NormalResult { Value = -1, ErrorInfo = "返回的不是18消息" }); } result.Response.; this.Print("recv:" + responseText); }
//发送消息 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; } }