Exemple #1
0
 // <summary>
 /// 检查打印机状态是否正常
 /// </summary>
 /// <returns>可状态返回空,不能使用返回原因</returns>
 public string CheckPrintStatus()
 {
     try
     {
         string        strinput  = "<invoke name=\"RECEIPTSTATUS\"><arguments></arguments></invoke>";
         StringBuilder sbinput   = new StringBuilder(strinput);
         string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
         LogService.GlobalInfoMessage("调用检测打印机方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
         System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
         doc.LoadXml(sbinput.ToString());
         System.Xml.XmlNode xnd = doc.SelectSingleNode("/return/arguments/string[@id='ERROR']");
         if (xnd != null)
         {
             string ErroerText = xnd.InnerText;
             if (ErroerText == "NOPAPER")
             {
                 return("打印机缺纸,请在其他自助机或窗口办理业务!");
             }
             else if (ErroerText == "DEVERROR")
             {
                 return("打印机硬件故障,请在其他自助机或窗口办理业务!");
             }
             return("");
         }
         return("");
     }
     catch (Exception ex)
     {
         Skynet.Framework.Common.SkynetMessage.MsgInfo(ex.Message);
     }
     return("");
 }
Exemple #2
0
        public bool WriteCard(string CardNo)
        {
            //开始写卡
            string        strinput = "<invoke name=\"CARDSENDERWRITECARD\"><arguments><string id=\"CARDNO\">" + CardNo + "</string></arguments></invoke>";
            StringBuilder sbinput  = new StringBuilder(strinput);

            LogService.GlobalInfoMessage("调用发卡机_写卡方输入参数:" + strinput);
            string strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);

            LogService.GlobalInfoMessage("调用发卡机_写卡方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
            if (sbinput.ToString().IndexOf("SUCCESS") < 0)
            {
                return(false);
            }

            strinput  = "<invoke name=\"CARDSENDERREADCARD\"><arguments></arguments></invoke>";
            sbinput   = new StringBuilder(strinput);
            strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
            LogService.GlobalInfoMessage("调用发卡机_读卡方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(sbinput.ToString());
            System.Xml.XmlNode xnd = doc.SelectSingleNode("/return/arguments/string[@id='CARDNO']");
            if (xnd != null)
            {
                LogService.GlobalInfoMessage("调用发卡机_读卡方法写入卡号:" + xnd.InnerText + ",实际卡号:" + CardNo);
                if (!string.IsNullOrEmpty(xnd.InnerText) && xnd.InnerText == CardNo)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #3
0
        public bool AllowCashin()
        {
            StringBuilder sbinput   = new StringBuilder("<invoke name=\"BILLACCEPTORALLOWCASHIN\"><arguments></arguments></invoke>");
            string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);

            Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp允许纸币入币方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
            return(true);
        }
Exemple #4
0
        public static bool writeCard(string id)
        {
            try
            {
                LogService.GlobalInfoMessage("CPU卡写卡前传入的卡号:" + id);

                //                // 卡片移到射频位
                //                StringBuilder sbinput = new StringBuilder("<invoke name=\"READCARDMOVECARDTORF\"><arguments></arguments></invoke>");
                //                string strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                //                LogService.GlobalInfoMessage("调用卡片移到射频位方法返回:" + strResult + ",输出参数:" + sbinput.ToString());


                string cardNo = StringToHexString(id, ASCIIEncoding.ASCII) + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";

                LogService.GlobalInfoMessage("CPU卡写卡前输入的16进制卡号:" + cardNo);

                StringBuilder mIn = new StringBuilder("<invoke name=\"CARDSENDERWRITEJZK\"><arguments><string id=\"SENDDATA\">" + cardNo + "</string></arguments></invoke>", 1024);
                //StringBuilder mIn = new StringBuilder("<invoke name=\"CARDSENDEWRITESXSRFCARD\"><arguments>");
                //mIn.Append("<string id=\"CARDNO\">"+ id + "</string>");
                //mIn.Append("<string id=\"CARDTYPE\"></string>");
                //mIn.Append("<string id=\"CARDFIRSTDATE\"></string>");
                //mIn.Append("<string id=\"CARDVALID\"></string>");
                //mIn.Append("<string id=\"IDNUMBER\"></string>");
                //mIn.Append("<string id=\"CREDTYPE\"></string>");
                //mIn.Append("<string id=\"CREDNO\"></string>");
                //mIn.Append("<string id=\"NAME\"></string>");
                //mIn.Append("<string id=\"BIRTHDATE\"></string>");
                //mIn.Append("<string id=\"NATION\"></string>");
                //mIn.Append("<string id=\"SEX\"></string>");
                //mIn.Append("<string id=\"PHONE\"></string>");
                //mIn.Append("<string id=\"ADDRESS\"></string>");
                //mIn.Append("</arguments>");
                //mIn.Append("</invoke>");

                LogService.GlobalInfoMessage("CPU卡写卡传入的参数" + mIn);
                string strResult1 = XuHuiInterface_DLL.XmlTcp(mIn, 0);

                LogService.GlobalInfoMessage("CPU卡写卡:" + strResult1 + ",输出参数:" + mIn);

                if (mIn.ToString().Contains("DEVERROR"))
                {
                    return(false);
                }



                string mCardNO = cardNo;

                mCardNO = HexStringToString(cardNo, ASCIIEncoding.ASCII);
                string a = mCardNO.Replace("\0", "").Trim();
                LogService.GlobalInfoMessage("CPU卡写卡后的卡号:" + a);
                return(true);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        //连续拍照结束
        public void TakeCameraEnd()
        {
            StringBuilder sbinput   = new StringBuilder("<invoke name=\"TAKEPHOTOEND\"><arguments><string id=\"USECAMERAINDEX\">0</string></arguments></invoke>");
            string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);

            Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp连续拍照结束方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
            if (sbinput.ToString().IndexOf("SUCCESS") < 0)
            {
                Skynet.LoggingService.LogService.GlobalInfoMessage("拍照设备故障!");
            }
        }
Exemple #6
0
        /// <summary>
        /// 停止接收纸币
        /// </summary>
        public bool ClosePort()
        {
            //StringBuilder sbinput = new StringBuilder("<invoke name=\"BILLACCEPTORNOTALLOWCASHIN\"><arguments></arguments></invoke>");
            //string strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
            //Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp禁止纸币入币方法返回:" + strResult + ",输出参数:" + sbinput.ToString());

            StringBuilder sbinput   = new StringBuilder("<invoke name=\"BILLACCEPTORCLOSEPORT\"><arguments></arguments></invoke>");
            string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);

            Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp关闭纸币器方法返回:" + strResult + ",输出参数:" + sbinput.ToString());

            return(true);
        }
        /// <summary>
        /// 门禁锁打开关闭方法
        /// </summary>
        /// <param name="intindex">1:报告单,2:钞箱,3:发卡机,凭条</param>
        /// <param name="OpenType">0:关闭,1:打开</param>
        public void Doorlock(int intindex, int OpenType)
        {
            string funName = "LOCKOPEN";

            if (OpenType == 0)
            {
                funName = "LOCKCLOSE";
            }
            string        strinput  = "<invoke name=\"" + funName + "\"><arguments><string id=\"INDEX\">" + intindex + "</string></arguments></invoke>";
            StringBuilder sbinput   = new StringBuilder(strinput);
            string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);

            Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp门禁开关" + funName + "方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
        }
 public void ReturnCard()
 {
     try
     {
         string        strinput  = "<invoke name=\"CARDSENDERRECYCLE\"><arguments></arguments></invoke>";
         StringBuilder sbinput   = new StringBuilder(strinput);
         string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
         LogService.GlobalInfoMessage("调用发卡机_回收卡方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
     }
     catch (Exception ex)
     {
         Skynet.Framework.Common.SkynetMessage.MsgInfo(ex.Message);
     }
 }
Exemple #9
0
        public int GetStatus()
        {
            StringBuilder sbinput   = new StringBuilder("<invoke name=\"BILLACCEPTORGETSTATUS\"><arguments></arguments></invoke>");
            string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);

            Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp获取纸币状态方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
            string output = sbinput.ToString();

            //output.ToUpper().IndexOf("ACCEPTING") >= 0 ||
            if (output.ToUpper().IndexOf("ESCROW") >= 0 || output.ToUpper().IndexOf("STACKING") >= 0)
            {
                return(1);
            }
            return(0);
        }
 /// <summary>
 /// POS推秆程序
 /// </summary>
 /// <param name="OpenType">0:打开,1关闭</param>
 public void PosDoor(int OpenType)
 {
     if (OpenType == 0)
     {
         StringBuilder sbinput   = new StringBuilder("<invoke name=\"DOORTGOPEN\"><arguments></arguments></invoke>");
         string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
         Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp打开推杆方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
     }
     else
     {
         StringBuilder sbinput   = new StringBuilder("<invoke name=\"DOORTGCLOSE\"><arguments></arguments></invoke>");
         string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
         Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp关闭推杆方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
     }
 }
        /// <summary>
        /// 新检测有卡
        /// </summary>
        /// <returns></returns>
        public bool hasCard()
        {
            string strinput = "<invoke name=\"CARDSENDERGETSTATUS\"><arguments></arguments></invoke>";
            //            string strinput = "<invoke name=\"CARDSENDERREADCARD\"><arguments></arguments></invoke>";
            StringBuilder sbinput   = new StringBuilder(strinput);
            string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);

            LogService.GlobalInfoMessage("调用发卡机_读卡方法,为了检验是否有卡返回:" + strResult + ",输出参数:" + sbinput.ToString());

            if (sbinput.ToString().IndexOf("SUCCESS") < 0)
            {
                return(false);
            }
            return(true);
        }
Exemple #12
0
        /// <summary>
        /// 发送接收纸币指令,需要连续不断发送此指令
        /// </summary>
        /// <returns>读取的纸币金额</returns>
        public int GetInMoney(string Machineno, string OperatorID)
        {
            int moneycount = 0;

            StringBuilder sbinput   = new StringBuilder("<invoke name=\"BILLACCEPTORSTACKMONEYDETAIL\"><arguments></arguments></invoke>");
            string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);

            Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp获取存钞明细方法返回:" + strResult + ",输出参数:" + sbinput.ToString());

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(sbinput.ToString());
            System.Xml.XmlNode xnd = doc.SelectSingleNode("/return/arguments/string[@id='STACKMONEY']");
            if (xnd != null)
            {
                if (!string.IsNullOrEmpty(xnd.InnerText))
                {
                    //防止快速存钞后,方法返回结果出现多张信息,以|分割后,再循环操作
                    string[] mSaveResults = xnd.InnerText.Split('|');

                    LogService.GlobalInfoMessage("存钞函数返回结果" + xnd.InnerText);

                    foreach (var variable in mSaveResults)
                    {
                        //string[] arrstr = xnd.InnerText.Split(',');
                        string[] arrstr = variable.Split(',');
                        moneycount = Convert.ToInt32(arrstr[0]);
                        if (arrstr.Length >= 2)
                        {
                            LogService.GlobalInfoMessage("卡号:" + arrstr[1] + "存入明细金额:" + moneycount + ",存入时间:" + arrstr[2]);

                            AutoInMoneyRecordData theAutoInMoneyRecordData = new AutoInMoneyRecordData();
                            theAutoInMoneyRecordData.Cardno         = arrstr[1];
                            theAutoInMoneyRecordData.Inmoney        = moneycount;
                            theAutoInMoneyRecordData.Machineno      = Machineno;
                            theAutoInMoneyRecordData.Operatorcodeno = OperatorID;
                            theAutoInMoneyRecordData.Operatortime   = Convert.ToDateTime(arrstr[2]);
                            AutoInMoneyRecordFacade theAutoInMoneyRecordFacade = new AutoInMoneyRecordFacade();
                            theAutoInMoneyRecordFacade.Insert(theAutoInMoneyRecordData);
                        }
                        else
                        {
                            LogService.GlobalInfoMessage("存入金额:" + moneycount);
                        }
                    }
                }
            }
            return(moneycount);
        }
        private bool MoveCard_Read()
        {
            //将卡移动到射频位
            string        strinput = "<invoke name=\"READCARDMOVECARDTORF\"><arguments></arguments></invoke>";
            StringBuilder sbinput  = new StringBuilder(strinput);

            LogService.GlobalInfoMessage("调用发卡机_移卡方法输入参数:" + strinput);
            string strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);

            LogService.GlobalInfoMessage("调用发卡机_移卡方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
            if (sbinput.ToString().IndexOf("SUCCESS") < 0)
            {
                return(false);
            }
            return(true);
        }
        private void FrmReadCardXH_Load(object sender, EventArgs e)
        {
            //Thread.Sleep(200);
            StringBuilder sbinput =
                new StringBuilder("<invoke name=\"READCARDALLOWCARDIN\"><arguments></arguments></invoke>");
            string strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);

            Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp允许进卡方法返回:" + strResult + ",输出参数:" +
                                                               sbinput.ToString());

            LogService.GlobalInfoMessage("FrmReadCardXH_Load_1");
            theCamera_XH.DoorLightOpen(LightTypeenum.读卡器, LightOpenTypeenum.闪烁);
            LogService.GlobalInfoMessage("FrmReadCardXH_Load_2");
            timer1.Start();
            timer2.Start();
            backgroundWorker2.RunWorkerAsync();
        }
Exemple #15
0
        public static bool writeCard(string id)
        {
            try
            {
                // 卡片移到射频位
                StringBuilder sbinput   = new StringBuilder("<invoke name=\"READCARDMOVECARDTORF\"><arguments></arguments></invoke>");
                string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                LogService.GlobalInfoMessage("调用卡片移到射频位方法返回:" + strResult + ",输出参数:" + sbinput.ToString());


                string cardNo = Encode(id);

                StringBuilder mIn = new StringBuilder("<invoke name=\"WRITEAJZKDATA\"><arguments><string id=\" SENDDATA\">" + cardNo + "</string></arguments></invoke>", 1024);
                Log.Info("CardCpu", "写cpu卡传入参数", mIn.ToString());

                string strResult1 = XuHuiInterface_DLL.XmlTcp(mIn, 0);

                if (mIn.ToString().Contains("DEVEEROR"))
                {
                    SkyComm.ShowMessageInfo("写卡失败:DEVEEROR!");
                    return(false);
                }

                Log.Info("CardCpu", "写cpu卡返回", "调用写卡方法返回:" + strResult1 + ",输出参数:" + mIn);

                XmlDocument mDoc = new XmlDocument();
                mDoc.LoadXml(mIn.ToString());
                XmlNode mXmlNode = mDoc.SelectSingleNode("/return/arguments/string[@id='RECEIVEDATA']");
                string  mCardNO  = mXmlNode.InnerText;
                Log.Info("CardCpu", "写入卡号", id);
                mCardNO = SkyComm.HexStringToString(mCardNO, ASCIIEncoding.ASCII);
                string a = mCardNO.Replace("\0", "").Trim();
                Log.Info("CardCpu", "写cpu卡转换后mCardNO", mCardNO);
                if (mCardNO.Equals(id))
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(SkyComm.cardInfoStruct.CardNo))
                {
                    CardRead cardUtility = new CardRead(this);

                    string strMsg = cardUtility.GetPatiantInfo();
                    if (!string.IsNullOrEmpty(strMsg))
                    {
                        SkyComm.ShowMessageInfo(strMsg);
                        e.Result = "失败";
                        closePort();

                        StringBuilder sbinput   = new StringBuilder("<invoke name=\"READCARDOUTCARD\"><arguments></arguments></invoke>");
                        string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                        LogService.GlobalInfoMessage("调用退卡卡方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
                    }
                    else
                    {
                        e.Result = "成功";
                    }
                }
                else
                {
                    SkyComm.ShowMessageInfo("请检查您的就诊卡位置然后重试或者在窗口办理业务!");
                    e.Result = "失败";
                    closePort();

                    StringBuilder sbinput   = new StringBuilder("<invoke name=\"READCARDOUTCARD\"><arguments></arguments></invoke>");
                    string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                    LogService.GlobalInfoMessage("调用退卡卡方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
                }
            }
            catch (Exception ex)
            {
                SkyComm.ShowMessageInfo(ex.Message);
                closePort();
                e.Result = "失败";
                return;
            }
        }
Exemple #17
0
        public string CheckCard()
        {
            string        strinput  = "<invoke name=\"CARDSENDERREADCARD\"><arguments></arguments></invoke>";
            StringBuilder sbinput   = new StringBuilder(strinput);
            string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);

            LogService.GlobalInfoMessage("调用发卡机_读卡方法,为了检验是否有卡返回:" + strResult + ",输出参数:" + sbinput.ToString());
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(sbinput.ToString());
            System.Xml.XmlNode xnd = doc.SelectSingleNode("/return/arguments/string[@id='CARDNO']");
            if (xnd != null)
            {
                if (!string.IsNullOrEmpty(xnd.InnerText) && (xnd.InnerText.IndexOf("4,98") >= 0 || xnd.InnerText.IndexOf("FEEDER EMPTY") >= 0))
                {
                    return("1");
                }
            }
            return("0");
        }
Exemple #18
0
        /// <summary>
        /// 设备初始化
        /// </summary>
        public bool OpenPort(string CardNo)
        {
            try
            {
                //打开纸币器
                StringBuilder sbinput   = new StringBuilder("<invoke name=\"BILLACCEPTOROPENPORT\"><arguments><string id=\"ID\">" + CardNo + "</string></arguments></invoke>");
                string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp打开纸币器方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
                if (sbinput.ToString().IndexOf("SUCCESS") <= 0)
                {
                    return(false);
                }

                //设置纸币器进币金额
                sbinput   = new StringBuilder("<invoke name=\"BILLACCEPTORSETCASHINMONEY\"><arguments><string id=\"AVAILABLE\">5,10,20,50,100</string></arguments></invoke>");
                strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp设置进币金额方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
                if (sbinput.ToString().IndexOf("SUCCESS") <= 0)
                {
                    //关闭纸币器
                    sbinput   = new StringBuilder("<invoke name=\"BILLACCEPTORCLOSEPORT\"><arguments></arguments></invoke>");
                    strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                    Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp关闭纸币器方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
                    return(false);
                }

                //允许进钞
                sbinput   = new StringBuilder("<invoke name=\"BILLACCEPTORALLOWCASHIN\"><arguments></arguments></invoke>");
                strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp允许纸币入币方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
                if (sbinput.ToString().IndexOf("SUCCESS") <= 0)
                {
                    ClosePort();
                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemple #19
0
        public static string getCardNo()
        {
            try
            {
                // 卡片移到射频位
                StringBuilder sbinput   = new StringBuilder("<invoke name=\"READCARDMOVECARDTORF\"><arguments></arguments></invoke>");
                string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                LogService.GlobalInfoMessage("调用卡片移到射频位方法返回:" + strResult + ",输出参数:" + sbinput.ToString());

//                StringBuilder mIn = new StringBuilder("<invoke name=\"READCARDREADSXSRFCARD\"><arguments></arguments></invoke>");//
                StringBuilder mIn = new StringBuilder("<invoke name=\"READCARDREADJZK\"><arguments></arguments></invoke>", 1024);
                Log.Info("CardCpu", "读cpu卡传入参数", mIn.ToString());
                LogService.GlobalInfoMessage("进入读陕西省就诊卡");
                LogService.GlobalInfoMessage("读cpu卡传入参数:" + mIn);
                string strResult1 = XuHuiInterface_DLL.XmlTcp(mIn, 0);
                LogService.GlobalInfoMessage("读cpu卡输出参数:" + mIn);
                if (mIn.ToString().Contains("DEVEEROR"))
                {
                    SkyComm.ShowMessageInfo("读卡失败:DEVEEROR!");

                    return("");
                }

                Log.Info("CardCpu", "读cpu卡返回", "调用读卡方法返回:" + strResult1 + ",输出参数:" + mIn);

                XmlDocument mDoc = new XmlDocument();
                mDoc.LoadXml(mIn.ToString());
                XmlNode mXmlNode = mDoc.SelectSingleNode("/return/arguments/string[@id='RECEIVEDATA']");
                string  mCardNO  = mXmlNode.InnerText;
                Log.Info("CardCpu", "原卡号", mCardNO);
                mCardNO = SkyComm.HexStringToString(mCardNO, ASCIIEncoding.ASCII);
                string a = mCardNO.Replace("\0", "").Trim();
                Log.Info("CardCpu", "读cpu卡转换后mCardNO", a);

                return(a);
            }
            catch (Exception e)
            {
                return("");
            }
        }
        //连续拍照开始进钞口
        public void TakeCameraStart(string CardID, string pName, string macineno)
        {
            AutoserviceLimtconfigFacade autolr = new AutoserviceLimtconfigFacade();
            DataSet ds = autolr.GetBylimitConfig(macineno);

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                if (ds.Tables[0].Rows[i]["LIMTCONFIGDETAIL"].ToString() == "自助机摄像头调用模式")
                {
                    string        status  = ds.Tables[0].Rows[i]["DEFAULTVALUE"].ToString();
                    StringBuilder sbinput = null;
                    Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp连续拍照方法TakeCameraStart开始!");
                    if (status == "正常")
                    {
                        sbinput = new StringBuilder("<invoke name=\"TAKEPHOTOSTART\"><arguments>" +
                                                    "<string id=\"CARDNO\">" + CardID + "</string>" +
                                                    "<string id=\"NAME\">" + pName + "</string>" +
                                                    "<string id=\"USECAMERAINDEX\">0</string></arguments></invoke>");
                    }
                    else
                    {
                        sbinput = new StringBuilder("<invoke name=\"TAKEPHOTOSTART\"><arguments>" +
                                                    "<string id=\"CARDNO\">" + CardID + "</string>" +
                                                    "<string id=\"NAME\">" + pName + "</string>" +
                                                    "<string id=\"USECAMERAINDEX\">1</string></arguments></invoke>");
                    }


                    Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp连续拍照开始输入参数:" + sbinput.ToString());

                    string strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                    Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp连续拍照开始方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
                    if (sbinput.ToString().IndexOf("SUCCESS") <= 0)
                    {
                        Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp连续拍照方法拍照设备故障!");
                    }
                }
            }
        }
Exemple #21
0
        public static string getCardNo()
        {
            try
            {
                // 卡片移到射频位
                StringBuilder sbinput   = new StringBuilder("<invoke name=\"READCARDMOVECARDTORF\"><arguments></arguments></invoke>");
                string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                LogService.GlobalInfoMessage("调用卡片移到射频位方法返回:" + strResult + ",输出参数:" + sbinput.ToString());

                //                StringBuilder mIn = new StringBuilder("<invoke name=\"READCARDREADSXSRFCARD\"><arguments></arguments></invoke>");//
                StringBuilder mIn = new StringBuilder("<invoke name=\"READJZKDATA\"><arguments></arguments></invoke>", 1024);


                string strResult1 = XuHuiInterface_DLL.XmlTcp(mIn, 0);

                if (mIn.ToString().Contains("DEVEEROR"))
                {
                    return("");
                }



                XmlDocument mDoc = new XmlDocument();
                mDoc.LoadXml(mIn.ToString());
                XmlNode mXmlNode = mDoc.SelectSingleNode("/return/arguments/string[@id='RECEIVEDATA']");
                string  mCardNO  = mXmlNode.InnerText;

                mCardNO = HexStringToString(mCardNO, ASCIIEncoding.ASCII);
                string a = mCardNO.Replace("\0", "").Trim();


                return(a);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public string ReadCard()
        {
            if (!MoveCard_Read())
            {
                return(string.Empty);
            }
            string        strinput  = "<invoke name=\"CARDSENDERREADRFCARD\"><arguments></arguments></invoke>";
            StringBuilder sbinput   = new StringBuilder(strinput);
            string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);

            LogService.GlobalInfoMessage("调用发卡机_读卡方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(sbinput.ToString());
            System.Xml.XmlNode xnd = doc.SelectSingleNode("/return/arguments/string[@id='CARDNO']");
            if (xnd != null)
            {
                if (!string.IsNullOrEmpty(xnd.InnerText) && xnd.InnerText.IndexOf('0') >= 0)
                {
                    return(xnd.InnerText);
                }
            }
            return(string.Empty);
        }
Exemple #23
0
        public static IDCardInfo readIdCard()
        {
            try
            {
                IDCardInfo    mCardInfo = new IDCardInfo();
                StringBuilder mIn       = new StringBuilder("<invoke name=\"SHENFENZHENG\"><arguments></arguments></invoke>", 1024);
                Log.Info("省医院读取身份证", "读取身份证传入参数", mIn.ToString());
                string strResult1 = XuHuiInterface_DLL.XmlTcp(mIn, 0);

                if (mIn.ToString().Contains("DEVEEROR"))
                {
                    SkyComm.ShowMessageInfo("写卡失败:DEVEEROR!");
                    return(null);
                }

                Log.Info("省医院读取身份证", "读取身份返回结果", strResult1);

                if (string.IsNullOrEmpty(mIn.ToString()))
                {
                    return(null);
                }
                if (!mIn.ToString().Contains("IDNAME"))
                {
                    return(null);
                }

                Log.Info("省医院读取身份证", "读取身份返回参数", mIn.ToString());

                XmlDocument mDoc = new XmlDocument();
                mDoc.LoadXml(mIn.ToString());
                XmlNode mXmlNode = mDoc.SelectSingleNode("/return/arguments/string[@id='IDNAME']");
                mCardInfo.Name = mXmlNode.InnerText;
                Log.Info("省医院读取身份证", "姓名", mCardInfo.Name);
                mXmlNode      = mDoc.SelectSingleNode("/return/arguments/string[@id='SEX']");
                mCardInfo.Sex = mXmlNode.InnerText;
                Log.Info("省医院读取身份证", "性别", mCardInfo.Name);
                mXmlNode = mDoc.SelectSingleNode("/return/arguments/string[@id='BORN']");
                try
                {
                    mCardInfo.Birthday = GetAge(mXmlNode.InnerText);
                }
                catch (Exception e)
                {
                    mCardInfo.Birthday = mXmlNode.InnerText;
                }
                Log.Info("省医院读取身份证", "出生", mCardInfo.Birthday);
                mXmlNode          = mDoc.SelectSingleNode("/return/arguments/string[@id='ADDRESS']");
                mCardInfo.Address = mXmlNode.InnerText;
                Log.Info("省医院读取身份证", "地址", mCardInfo.Address);
                mXmlNode         = mDoc.SelectSingleNode("/return/arguments/string[@id='IDCARDNO']");
                mCardInfo.Number = mXmlNode.InnerText;
                Log.Info("省医院读取身份证", "身份证号", mCardInfo.Number);

                if (mIn.ToString().Contains("NATION"))
                {
                    mXmlNode         = mDoc.SelectSingleNode("/return/arguments/string[@id='NATION']");
                    mCardInfo.People = mXmlNode.InnerText;
                }

                mCardInfo.ImagePath = Application.StartupPath + "\\_Temp.bmp";// SkyComm.getvalue("省医院身份证照片路径");

                return(mCardInfo);
            }
            catch (Exception ex)
            {
                Log.Info("省医院读取身份证错误", "读取身份证错误详情", ex.ToString());
                return(null);
            }
        }
        public void DoorLightOpen(LightTypeenum lightType, LightOpenTypeenum OpenType)
        {
            LogService.GlobalInfoMessage("调用DoorLightOpen_1");
            string FunName = "DOORLIGHTFLUSH";
            string Index   = "-1";

            if (string.IsNullOrEmpty(getvalue("省医院门禁灯")))
            {
                switch (lightType)
                {
                case LightTypeenum.读卡器:
                    Index = "3";
                    break;

                case LightTypeenum.纸币器:
                    Index = "5";
                    break;

                case LightTypeenum.发卡器:
                    Index = "4";
                    break;

                case LightTypeenum.银联卡:
                    Index = "7";
                    break;

                case LightTypeenum.条码扫描:
                    Index = "1";
                    break;

                case LightTypeenum.凭条:
                    Index = "2";
                    break;

                case LightTypeenum.报告打印机:
                    Index = "6";
                    break;

                case LightTypeenum.报警器:
                    Index = "8";
                    break;
                }
            }
            else
            {
                LogService.GlobalInfoMessage("调用省医院门禁灯××××××××××××××××××××××××××××××××××");
                LogService.GlobalInfoMessage("传入lightType:" + lightType);
                switch (lightType)
                {
                case LightTypeenum.凭条:
                    Index = "1";
                    break;

                case LightTypeenum.读卡器:
                    Index = "2";
                    break;

                case LightTypeenum.发卡器:
                    Index = "3";
                    break;

                case LightTypeenum.出卡槽:
                    Index = "4";
                    break;

                case LightTypeenum.纸币器:
                    Index = "5";
                    break;

                case LightTypeenum.银联卡:
                    Index = "6";
                    break;

                case LightTypeenum.病历本出口:
                    Index = "7";
                    break;

                case LightTypeenum.条码扫描:
                    Index = "8";
                    break;

                case LightTypeenum.身份证:
                    Index = "9";
                    break;

                case LightTypeenum.化验单:
                    Index = "10";
                    break;

                case LightTypeenum.报警器:
                    Index = "11";
                    break;
                }
            }


            LogService.GlobalInfoMessage("调用DoorLightOpen_2");
            if (OpenType == LightOpenTypeenum.打开)
            {
                FunName = "DOORLIGHTOPEN";
            }
            LogService.GlobalInfoMessage("调用DoorLightOpen_3");

            string strInput = "<invoke name=\"" + FunName + "\"><arguments><string id=\"INDEX\">" + Index + "</string></arguments></invoke>";

            LogService.GlobalInfoMessage("调用XmlTcp门禁灯打开方法输入参数" + strInput);

            StringBuilder sbinput   = new StringBuilder(strInput);
            string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);

            LogService.GlobalInfoMessage("调用XmlTcp门禁灯打开方法返回参数:" + sbinput.ToString());

            LogService.GlobalInfoMessage("调用DoorLightOpen_4");
        }
        /// <summary>
        /// 检查是否有卡,如果是有卡则进行读卡信息
        /// </summary>
        /// <returns>如果无卡返回0,有卡并且卡信息正常返回1,有卡时如果验证失败返回错误信息</returns>
        public string CheckCard()
        {
            Thread.Sleep(200);
            StringBuilder sbinput =
                new StringBuilder("<invoke name=\"READCARDTESTINSERTCARD\"><arguments></arguments></invoke>");
            string strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);

            LogService.GlobalInfoMessage("调用检测有卡方法输出返回:" + strResult + ",输出参数:" + sbinput.ToString());
            if (string.IsNullOrEmpty(sbinput.ToString()))
            {
                return("0");
            }

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(sbinput.ToString());
            System.Xml.XmlNode xnd = doc.SelectSingleNode("/return/arguments/string[@id='CARDSTACKSTATE']");
            if (xnd != null)
            {
                string CardStackState = xnd.InnerText;
                LogService.GlobalInfoMessage("读卡的类型:" + CardType + "****************" + CardStackState);

                if (CardStackState == "1")
                {
                    //如果有卡则读取磁条卡号
                    Thread.Sleep(200);

                    if (CardType == "1")
                    {
                        sbinput =
                            new StringBuilder("<invoke name=\"READCARDREADMAGCARDNO\"><arguments></arguments></invoke>");
                        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                        LogService.GlobalInfoMessage("调用读取磁条卡号卡方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
                        doc.LoadXml(sbinput.ToString());
                        xnd = doc.SelectSingleNode("/return/arguments/string[@id='CARDNO']");
                        if (xnd != null)
                        {
                            string strCardNO = xnd.InnerText;
                            SkyComm.cardInfoStruct.CardNo = strCardNO;
                            CardRead cardUtility = new CardRead(this);
                            string   strMsg      = cardUtility.GetPatiantInfo();
                            if (!string.IsNullOrEmpty(strMsg))
                            {
                                return(strMsg);
                            }
                            else
                            {
                                return("1");
                            }
                        }
                        else
                        {
                            return("0");
                        }
                    }
                    else if (CardType == "2")
                    {
                        #region 读M1卡方法

                        //卡片移到射频位
                        sbinput =
                            new StringBuilder("<invoke name=\"READCARDMOVECARDTORF\"><arguments></arguments></invoke>");
                        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                        LogService.GlobalInfoMessage("调用卡片移到射频位方法返回:" + strResult + ",输出参数:" + sbinput.ToString());

                        //读第8块的数据
                        string strInput = "<invoke name=\"READCARDREADRFCARD\"><arguments>" +
                                          "<string id=\"SECTORNO\">8</string>" +
                                          "<string id=\"BLOCKNO\">2</string>" +
                                          "<string id=\"PASSWORD\">FFFFFFFFFFFF</string>" +
                                          "</arguments></invoke>";
                        LogService.GlobalInfoMessage("调用读射频卡数据方法输入参数1:" + strInput);
                        sbinput   = new StringBuilder(strInput);
                        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                        LogService.GlobalInfoMessage("调用读射频卡数据方法返回:" + strResult + ",输出参数:" + sbinput.ToString());

                        doc.LoadXml(sbinput.ToString());
                        xnd = doc.SelectSingleNode("/return/arguments/string[@id='ERROR']");
                        string strCardNO = string.Empty;
                        if (xnd != null && xnd.InnerText == "SUCCESS")
                        {
                            strCardNO =
                                SkyComm.HexStringToString(
                                    doc.SelectSingleNode("/return/arguments/string[@id='CARDNO']").InnerText,
                                    ASCIIEncoding.ASCII);


                            LogService.GlobalInfoMessage("=============读8扇区的内容===========================" + strCardNO +
                                                         "======================================");

                            if (strCardNO.Length >= 16)
                            {
                                strCardNO = strCardNO.Substring(0, 16);
                            }
                        }

                        if (strCardNO.Length >= 16) //第八块内容小于16
                        {
                        }

                        LogService.GlobalInfoMessage("读取到的卡号信息:" + strCardNO + "===============================");

                        if (!string.IsNullOrEmpty(strCardNO) && strCardNO.Length >= 15)
                        {
                            SkyComm.cardInfoStruct.CardNo = strCardNO.Replace(" ", "").Replace("\0", "").Trim();
                            CardRead cardUtility = new CardRead(this);
                            string   strMsg      = cardUtility.GetPatiantInfo();
                            if (!string.IsNullOrEmpty(strMsg))
                            {
                                return(strMsg);
                            }
                            else
                            {
                                return("1");
                            }
                        }
                        else
                        {
                            return("0");
                        }

                        #endregion
                    }
                    else if (CardType == "3")
                    {
                        #region 读芯片卡方法,暂时屏蔽

                        string mCardNO = CardCpu.getCardNo();

                        SkyComm.cardInfoStruct.CardNo = mCardNO;
                        CardRead cardUtility = new CardRead(this);
                        string   strMsg      = cardUtility.GetPatiantInfo();
                        if (!string.IsNullOrEmpty(strMsg))
                        {
                            return(strMsg);
                        }
                        else
                        {
                            return("1");
                        }

                        #endregion
                    }
                }
                else
                {
                    return("0");
                }
            }
            else
            {
                return("0");
            }
            return("0");
        }
        private void timer1_Tick(object sender, EventArgs e)
        {
            Log.Info(GetType().ToString(), "执行time1", "开始执行timer1_Tick");

            //检测是否有卡
            Thread.Sleep(200);
            StringBuilder sbinput   = new StringBuilder("<invoke name=\"READCARDTESTINSERTCARD\"><arguments></arguments></invoke>");
            string        strResult = "";

            try
            {
                strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
            }
            catch (Exception exception)
            {
                Log.Info(GetType().ToString(), "检测有卡XuHuiInterface_DLL.XmlTcp", exception.Message);
            }
            LogService.GlobalInfoMessage("调用检测有卡方法输出返回:" + strResult + ",输出参数:" + sbinput.ToString());
            if (string.IsNullOrEmpty(sbinput.ToString()))
            {
                return;
            }

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(sbinput.ToString());
            System.Xml.XmlNode xnd = doc.SelectSingleNode("/return/arguments/string[@id='CARDSTACKSTATE']");
            if (xnd != null)
            {
                string CardStackState = xnd.InnerText;
                if (CardStackState == "1")
                {
                    timer1.Stop();
                    timer2.Stop();

                    //如果有卡则读取磁条卡号
                    Thread.Sleep(200);
                    if (CardType == "1")
                    {
                        sbinput   = new StringBuilder("<invoke name=\"READCARDREADMAGCARDNO\"><arguments></arguments></invoke>");
                        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                        LogService.GlobalInfoMessage("调用读取磁条卡号卡方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
                        doc.LoadXml(sbinput.ToString());
                        xnd = doc.SelectSingleNode("/return/arguments/string[@id='CARDNO']");
                        if (xnd != null)
                        {
                            string strCardNO = xnd.InnerText;
                            //如果读取到的磁条卡号长度不对,则读取居民健康卡
                            if (strCardNO.Length != 15)
                            {
                                try
                                {
                                    //LogService.GlobalInfoMessage("2");
                                    //移动到IC位读居民健康卡
                                    sbinput = new StringBuilder("<invoke name=\"READCARDMOVECARDTOREAR\"><arguments></arguments></invoke>");
                                    Thread.Sleep(200);
                                    LogService.GlobalInfoMessage("调用移动卡到卡后端方法输入参数:" + sbinput.ToString());
                                    strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                                    LogService.GlobalInfoMessage("调用移动卡到卡后端方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
                                    if (sbinput.ToString().IndexOf("SUCCESS") > 0)
                                    {
                                        //读居民健康卡
                                        //居民健康卡
                                        HealthCardBase       _cardBase = HealthCardBase.CreateInstance(this);
                                        HealthCardInfoStruct Entity    = _cardBase.HisRead();
                                        SkyComm.cardInfoStruct.CardNo = Entity.HealthCardNo;
                                        if (!backgroundWorker1.IsBusy)
                                        {
                                            backgroundWorker1.RunWorkerAsync();
                                        }
                                        if (string.IsNullOrEmpty(SkyComm.cardInfoStruct.CardNo))
                                        {
                                            SkyComm.ShowMessageInfo("读卡失败,请重新检查卡位方向!");
                                            closePort();
                                            this.DialogResult = DialogResult.Cancel;
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    LogService.GlobalInfoMessage("移动卡到卡后端,读居民健康卡失败:" + ex.Message);

                                    Thread.Sleep(200);
                                    sbinput   = new StringBuilder("<invoke name=\"READCARDOUTCARD\"><arguments></arguments></invoke>");
                                    strResult = AutoServiceSDK.SDK.XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                                    LogService.GlobalInfoMessage("调用退卡卡方法返回:" + strResult + ",输出参数:" + sbinput.ToString());;
                                    SkyComm.ShowMessageInfo("读卡失败,请重新检查卡位方向!");
                                    closePort();
                                    this.DialogResult = DialogResult.Cancel;
                                }
                            }
                            else
                            {
                                //读取就诊卡
                                SkyComm.cardInfoStruct.CardNo = strCardNO;
                                if (!backgroundWorker1.IsBusy)
                                {
                                    backgroundWorker1.RunWorkerAsync();
                                }
                            }
                        }
                        else
                        {
                            //移动到IC位读居民健康卡
                            sbinput = new StringBuilder("<invoke name=\"ReadCardMoveCardToIC\"><arguments></arguments></invoke>");
                            Thread.Sleep(200);
                            strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                            if (strResult.IndexOf("SUCCESS") > 0)
                            {
                                //读居民健康卡
                                //居民健康卡
                                HealthCardBase       _cardBase = HealthCardBase.CreateInstance(this);
                                HealthCardInfoStruct Entity    = _cardBase.HisRead();
                                SkyComm.cardInfoStruct.CardNo = Entity.HealthCardNo;
                                if (!backgroundWorker1.IsBusy)
                                {
                                    backgroundWorker1.RunWorkerAsync();
                                }
                            }
                        }
                    }
                    else if (CardType == "2")
                    {
                        #region 读取M1卡方法
                        //卡片移到射频位
                        sbinput   = new StringBuilder("<invoke name=\"READCARDMOVECARDTORF\"><arguments></arguments></invoke>");
                        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                        LogService.GlobalInfoMessage("调用卡片移到射频位方法返回:" + strResult + ",输出参数:" + sbinput.ToString());

                        //读第8块的数据
                        string strInput = "<invoke name=\"READCARDREADRFCARD\"><arguments>" +
                                          "<string id=\"SECTORNO\">8</string>" +
                                          "<string id=\"BLOCKNO\">2</string>" +
                                          "<string id=\"PASSWORD\">FFFFFFFFFFFF</string>" +
                                          "</arguments></invoke>";
                        LogService.GlobalInfoMessage("调用读射频卡数据方法输入参数1:" + strInput);
                        sbinput   = new StringBuilder(strInput);
                        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                        LogService.GlobalInfoMessage("调用读射频卡数据方法返回:" + strResult + ",输出参数:" + sbinput.ToString());

                        doc.LoadXml(sbinput.ToString());
                        xnd = doc.SelectSingleNode("/return/arguments/string[@id='ERROR']");
                        string strCardNO = string.Empty;
                        if (xnd != null && xnd.InnerText == "SUCCESS")
                        {
                            strCardNO = SkyComm.HexStringToString(doc.SelectSingleNode("/return/arguments/string[@id='CARDNO']").InnerText, ASCIIEncoding.ASCII);
                            LogService.GlobalInfoMessage("=============读8扇区的内容===========================" + strCardNO + "======================================");

                            if (strCardNO.Length >= 16)
                            {
                                strCardNO = strCardNO.Substring(0, 16);
                            }
                        }

                        if (strCardNO.Length >= 16)
                        {
                        }


                        LogService.GlobalInfoMessage("读取到的卡号信息:" + strCardNO + "===========================");

                        if (!string.IsNullOrEmpty(strCardNO) && strCardNO.Length >= 15)
                        {
                            //读取就诊卡
                            SkyComm.cardInfoStruct.CardNo = strCardNO.Replace(" ", "").Replace("\0", "").Trim();
                            if (!backgroundWorker1.IsBusy)
                            {
                                backgroundWorker1.RunWorkerAsync();
                            }
                        }
                        else
                        {
                            SkyComm.ShowMessageInfo("读卡失败,请重新检查卡位方向!");
                            closePort();
                            this.DialogResult = DialogResult.Cancel;
                        }
                        #endregion
                    }
                    else if (CardType == "3")
                    {
                        #region 读取芯片卡方法,暂时屏蔽
                        SkyComm.cardInfoStruct.CardNo = CardCpu.getCardNo();


                        if (string.IsNullOrEmpty(SkyComm.cardInfoStruct.CardNo))
                        {
                            try
                            {
                                //LogService.GlobalInfoMessage("2");
                                //移动到IC位读居民健康卡
                                sbinput = new StringBuilder("<invoke name=\"READCARDMOVECARDTOREAR\"><arguments></arguments></invoke>");
                                Thread.Sleep(200);
                                LogService.GlobalInfoMessage("调用移动卡到卡后端方法输入参数:" + sbinput.ToString());
                                strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                                LogService.GlobalInfoMessage("调用移动卡到卡后端方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
                                if (sbinput.ToString().IndexOf("SUCCESS") > 0)
                                {
                                    //读居民健康卡
                                    //居民健康卡
                                    HealthCardBase       _cardBase = HealthCardBase.CreateInstance(this);
                                    HealthCardInfoStruct Entity    = _cardBase.HisRead();
                                    SkyComm.cardInfoStruct.CardNo = Entity.HealthCardNo;
                                    if (!backgroundWorker1.IsBusy)
                                    {
                                        backgroundWorker1.RunWorkerAsync();
                                    }
                                    if (string.IsNullOrEmpty(SkyComm.cardInfoStruct.CardNo))
                                    {
                                        SkyComm.ShowMessageInfo("读卡失败,请重新检查卡位方向!");
                                        closePort();
                                        this.DialogResult = DialogResult.Cancel;
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                LogService.GlobalInfoMessage("移动卡到卡后端,读居民健康卡失败:" + ex.Message);

                                Thread.Sleep(200);
                                sbinput   = new StringBuilder("<invoke name=\"READCARDOUTCARD\"><arguments></arguments></invoke>");
                                strResult = AutoServiceSDK.SDK.XuHuiInterface_DLL.XmlTcp(sbinput, 0);
                                LogService.GlobalInfoMessage("调用退卡卡方法返回:" + strResult + ",输出参数:" + sbinput.ToString());;
                                SkyComm.ShowMessageInfo("读卡失败,请重新检查卡位方向!");
                                closePort();
                                this.DialogResult = DialogResult.Cancel;
                            }
                        }
                        else
                        {
                            CardRead cardUtility = new CardRead(this);

                            string strMsg = cardUtility.GetPatiantInfo();

                            if (!string.IsNullOrEmpty(strMsg))
                            {
                                SkyComm.ShowMessageInfo(strMsg);
                            }

                            if (!backgroundWorker1.IsBusy)
                            {
                                backgroundWorker1.RunWorkerAsync();
                            }
                        }



                        #endregion
                    }
                }
            }
        }
        public void DoorLightClose(LightTypeenum lightType)
        {
            string FunName = "DOORLIGHTCLOSE";
            string Index   = "-1";

            if (string.IsNullOrEmpty(getvalue("省医院门禁灯")))
            {
                switch (lightType)
                {
                case LightTypeenum.读卡器:
                    Index = "3";
                    break;

                case LightTypeenum.纸币器:
                    Index = "5";
                    break;

                case LightTypeenum.发卡器:
                    Index = "4";
                    break;

                case LightTypeenum.银联卡:
                    Index = "7";
                    break;

                case LightTypeenum.条码扫描:
                    Index = "1";
                    break;

                case LightTypeenum.凭条:
                    Index = "2";
                    break;

                case LightTypeenum.报告打印机:
                    Index = "6";
                    break;

                case LightTypeenum.报警器:
                    Index = "8";
                    break;
                }
            }
            else
            {
                switch (lightType)
                {
                case LightTypeenum.凭条:
                    Index = "1";
                    break;

                case LightTypeenum.读卡器:
                    Index = "2";
                    break;

                case LightTypeenum.发卡器:
                    Index = "3";
                    break;

                case LightTypeenum.出卡槽:
                    Index = "4";
                    break;

                case LightTypeenum.纸币器:
                    Index = "5";
                    break;

                case LightTypeenum.银联卡:
                    Index = "6";
                    break;

                case LightTypeenum.病历本出口:
                    Index = "7";
                    break;

                case LightTypeenum.条码扫描:
                    Index = "8";
                    break;

                case LightTypeenum.身份证:
                    Index = "9";
                    break;

                case LightTypeenum.化验单:
                    Index = "10";
                    break;

                case LightTypeenum.报警器:
                    Index = "11";
                    break;
                }
            }


            StringBuilder sbinput   = new StringBuilder("<invoke name=\"" + FunName + "\"><arguments><string id=\"INDEX\">" + Index + "</string></arguments></invoke>");
            string        strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);

            Skynet.LoggingService.LogService.GlobalInfoMessage("调用XmlTcp门禁灯关闭方法返回:" + strResult + ",输出参数:" + sbinput.ToString());
        }
        public bool WriteCard(string CardNo)
        {
            if (!MoveCard_Write())
            {
                return(false);
            }
            //开始写卡
            Thread.Sleep(1000);//移动卡后沉睡1秒
            string cardNo1 = string.Empty;
            string cardNo2 = string.Empty;

            //LogService.GlobalInfoMessage("传入卡号:" +CardNo);
            if (CardNo.Length > 16)
            {
                cardNo1 = StringToHexString(CardNo.Substring(0, 16), ASCIIEncoding.ASCII);
                cardNo2 = StringToHexString(CardNo.Substring(16), ASCIIEncoding.ASCII);
            }
            else
            {
                cardNo1 = StringToHexString(CardNo, ASCIIEncoding.ASCII);
            }
            //LogService.GlobalInfoMessage("cardno1:" + cardNo1);


            string        strinput = "<invoke name=\"CARDSENDERWRITERFCARD\"><arguments><string id=\"CARDNO\">" + cardNo1 + "</string><string id=\"BLOCKADR\">8</string><string id=\"NADR\">2</string><string id=\"PASSWORD\">FFFFFFFFFFFF</string></arguments></invoke>";
            StringBuilder sbinput  = new StringBuilder(strinput);

            LogService.GlobalInfoMessage("调用发卡机_写卡方输入参数(第一次):" + strinput);
            string strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);

            LogService.GlobalInfoMessage("调用发卡机_写卡方法返回(第一次):" + strResult + ",输出参数:" + sbinput.ToString());
            if (sbinput.ToString().IndexOf("SUCCESS") < 0)
            {
                return(false);
            }
            if (CardNo.Length > 16)
            {
                string        strinput2 = "<invoke name=\"CARDSENDERWRITERFCARD\"><arguments><string id=\"CARDNO\">" + cardNo2 + "</string><string id=\"BLOCKADR\">8</string><string id=\"NADR\">2</string><string id=\"PASSWORD\">FFFFFFFFFFFF</string></arguments></invoke>";
                StringBuilder sbinput2  = new StringBuilder(strinput2);
                LogService.GlobalInfoMessage("调用发卡机_写卡方输入参数(第二次):" + strinput2);
                string strResult2 = XuHuiInterface_DLL.XmlTcp(sbinput2, 0);
                LogService.GlobalInfoMessage("调用发卡机_写卡方法返回(第二次):" + strResult2 + ",输出参数:" + sbinput2.ToString());
                if (sbinput.ToString().IndexOf("SUCCESS") < 0)
                {
                    return(false);
                }
            }
            string ReturnCardNo = string.Empty;

            strinput  = "<invoke name=\"CARDSENDERREADRFCARD\"><arguments><string id=\"BLOCKADR\">8</string><string id=\"NADR\">2</string><string id=\"PASSWORD\">FFFFFFFFFFFF</string></arguments></invoke>";
            sbinput   = new StringBuilder(strinput);
            strResult = XuHuiInterface_DLL.XmlTcp(sbinput, 0);
            LogService.GlobalInfoMessage("调用发卡机_读卡方法返回(第一次):" + strResult + ",输出参数:" + sbinput.ToString());
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(sbinput.ToString());

            System.Xml.XmlNode xnd = doc.SelectSingleNode("/return/arguments/string[@id='CARDNO']");
            if (xnd == null)
            {
                return(false);
            }

            ReturnCardNo = HexStringToString(xnd.InnerText, ASCIIEncoding.ASCII).ToString().Trim().Substring(0, 15);
            if (CardNo.Length > 16)
            {
                string        strinput2  = "<invoke name=\"CARDSENDERREADRFCARD\"><arguments><string id=\"BLOCKADR\">8</string><string id=\"NADR\">2</string><string id=\"PASSWORD\">FFFFFFFFFFFF</string></arguments></invoke>";
                StringBuilder sbinput2   = new StringBuilder(strinput2);
                string        strResult2 = XuHuiInterface_DLL.XmlTcp(sbinput2, 0);
                LogService.GlobalInfoMessage("调用发卡机_读卡方法返回(第二次):" + strResult2 + ",输出参数:" + sbinput2.ToString());
                System.Xml.XmlDocument doc2 = new System.Xml.XmlDocument();
                doc2.LoadXml(sbinput2.ToString());
                System.Xml.XmlNode xnd2 = doc2.SelectSingleNode("/return/arguments/string[@id='CARDNO']");
                if (xnd2 == null)
                {
                    return(false);
                }
                ReturnCardNo = ReturnCardNo + HexStringToString(xnd2.InnerText, ASCIIEncoding.ASCII).ToString().Trim().Substring(0, CardNo.Length - 16);
                ReturnCardNo = ReturnCardNo.Replace(" ", "");
            }

            if (!string.IsNullOrEmpty(ReturnCardNo))
            {
                LogService.GlobalInfoMessage("调用发卡机_读卡方法写入卡号:" + ReturnCardNo + ",实际卡号:" + CardNo);
                if (ReturnCardNo == CardNo)
                {
                    return(true);
                }
            }
            return(false);
        }