/// <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.SetDefaulValue();//设置其它默认值 // 发送和接收消息 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); }
// 借书 // 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 }); }