Exemplo n.º 1
0
        /// <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.SetDefaulValue();//设置其它默认值

            // 发送和接收消息
            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);
        }
Exemplo n.º 2
0
        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
            });
        }