private void FrmInputForChild_FormClosing(object sender, FormClosingEventArgs e)
 {
     ucTime1.timer1.Stop();
     try
     {
         Common_XH theCamera_XH = new Common_XH();
         theCamera_XH.DoorLightClose(LightTypeenum.出卡槽);
         theCamera_XH.DoorLightClose(LightTypeenum.发卡器);
         theCamera_XH.DoorLightClose(LightTypeenum.凭条);
     }
     catch (Exception exception)
     {
     }
 }
Esempio n. 2
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            Common_XH theCommon_XH = new Common_XH();

            if (simpleButton1.Text.Equals("打开钞箱"))
            {
                theCommon_XH.Doorlock(2, 1);

                simpleButton1.Text = "关闭钞箱";
            }
            else
            {
                theCommon_XH.Doorlock(2, 0);
                simpleButton1.Text = "打开钞箱";
            }
        }
 private void FrmCardSavingCash_FormClosing(object sender, FormClosingEventArgs e)
 {
     this.ucTime1.timer1.Stop();
     timer1.Stop();
     timer2.Stop();
     if (ucTime1.Sec == 0)
     {
         Savingsucceed = 0;
     }
     try
     {
         Common_XH theCamera_XH = new Common_XH();
         theCamera_XH.DoorLightClose(LightTypeenum.纸币器);
     }
     catch (Exception exception)
     {
     }
 }
        private void btnStart_Click(object sender, EventArgs e)
        {
            backgroundWorker1.RunWorkerAsync();
            try
            {
                Common_XH theCamera_XH = new Common_XH();
                theCamera_XH.DoorLightOpen(LightTypeenum.纸币器, LightOpenTypeenum.闪烁);
            }
            catch (Exception exception)
            {
            }

            if (MoneyServer.OpenPort(SkyComm.cardInfoStruct.CardNo) == true)
            {
                //拍照
                switch (AutoHostConfig.ReadCardType)
                {
                case "XUHUI":
                    AutoServiceSDK.SdkService.Common_XH camera = new AutoServiceSDK.SdkService.Common_XH();
                    camera.TakeCameraStart(SkyComm.cardInfoStruct.CardNo, SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["PATIENTNAME"].ToString(), AutoHostConfig.Machineno);

                    camera.DoorLightOpen(LightTypeenum.纸币器, LightOpenTypeenum.闪烁);
                    break;

                default:
                    break;
                }

                ucTime1.timer1.Stop();
                btnStart.Enabled           = false;
                lblTime.Visible            = true;
                lblNoPaymentCharge.Enabled = false;
                timer1.Start();
                timer2.Start();
                this.timer3.Start();
                this.btnClose.Enabled = false;
                this.btnExit.Enabled  = false;
            }
            else
            {
                SkynetMessage.MsgInfo("钞箱设置没有初始化失败,请在窗口充值或者银行卡充值!");
            }
        }
 public FrmReadCardXH()
 {
     InitializeComponent();
     theCamera_XH = new Common_XH();
     sec          = 30;
 }
        private void lblOK_Click(object sender, EventArgs e)
        {
            if (!checkInput())
            {
                return;
            }

            if (SendCard.CheckCard() == "1")
            {
                SkyComm.ShowMessageInfo("该自助机没有卡,请在其他自助机上继续发卡!");
                return;
            }
            this.lblOK.Enabled     = false;
            this.btnReturn.Enabled = false;
            this.btnExit.Enabled   = false;
            panel2.Enabled         = false;
            _telphone      = this.txtTel.Text.Trim();
            _childName     = this.txtName.Text.Trim();
            _childSex      = this.rbtnBoy.Checked ? "男" : "女";
            _childBirthDay = this.txtYear.Text.Trim() + "-" + this.txtMonth.Text.Trim() + "-" + this.txtDay.Text.Trim();
            string CardNo = string.Empty;

            string strDiagnoseid = string.Empty;
            CardAuthorizationFacade eCardAuthorizationFacade = new CardAuthorizationFacade();

            using (WaitDialogForm form = new WaitDialogForm("正在发卡中,请稍候...", "正在组织发卡数据,请稍候......", new Size(240, 60)))
            {
                #region 办理就诊卡
                if (eLCardAuthorizationData != null)
                {
                    eLCardAuthorizationData.Tables[0].Rows.Clear();
                }

                SetCardInfo(IdInfo, _telphone);
                eLCardAuthorizationData = (CardAuthorizationData)eCardAuthorizationFacade.insertEntity(eLCardAuthorizationData);
                strDiagnoseid           = eLCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_DIAGNOSEID].ToString();
                CardNo = eLCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_CARDID].ToString();
                //写卡,如果失败则重试
                bool isSuccess = false;
                form.Caption = "正在写卡中,请稍候...";
                try
                {
                    for (int i = 0; i < 3; i++)
                    {
                        //第一次写卡
                        if (SendCard.WriteCard(CardNo) == false)
                        {
                            //第一次写卡失败,再进行第二次写卡
                            if (SendCard.WriteCard(CardNo) == false)
                            {
                                //第二次写卡失败以后将卡回收
                                SendCard.ReturnCard();
                            }
                            else
                            {
                                isSuccess = true;
                                break;
                            }
                        }
                        else
                        {
                            isSuccess = true;
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Skynet.LoggingService.LogService.GlobalInfoMessage("发卡失败:" + ex.Message);
                    SkyComm.ShowMessageInfo("发卡失败:" + ex.Message);
                    isSuccess = false;
                    this.btnReturn.Enabled = true;
                    this.btnExit.Enabled   = true;
                    this.lblOK.Enabled     = true;
                    panel2.Enabled         = true;
                }

                //写卡失败
                if (isSuccess == false)
                {
                    //撤消已发卡的信息
                    eCardAuthorizationFacade.deleteEntityAndCardSaving(eLCardAuthorizationData);
                    eLCardAuthorizationData = new CardAuthorizationData();
                    strDiagnoseid           = string.Empty;
                    SkynetMessage.MsgInfo("写卡失败,请在其他自助机上重试!");
                    this.lblOK.Enabled     = true;
                    this.btnReturn.Enabled = true;
                    this.btnExit.Enabled   = true;
                    panel2.Enabled         = true;

                    //第二次写卡失败以后将卡回收
                    SendCard.ReturnCard();
                    return;
                }
                #endregion
                form.Close();
            }
            #region 充值
            try
            {
                SkyComm.eCardAuthorizationData = eLCardAuthorizationData;
                SkyComm.DiagnoseID             = SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["DIAGNOSEID"].ToString();
                SkyComm.cardInfoStruct.CardNo  = CardNo;
                SkyComm.cardBlance             = 0;
                CardSavingFacade cf = new CardSavingFacade();
                SkyComm.cardallmoney = 0;

                int     Savingsucceed = 0;
                decimal RechargeMoney = 0;
                string  strModeType   = "现金";
                try
                {
                    //充值,弹出界面选择是现金充值还是银行卡预存
                    if (!string.IsNullOrEmpty(AutoHostConfig.PosInterfaceType))
                    {
                        FrmCardSavingMain frm = new FrmCardSavingMain();
                        frm.CallType = 2;
                        frm.ShowDialog();
                        Savingsucceed = frm.Savingsucceed;
                        RechargeMoney = frm.RechargeMoney;
                        strModeType   = frm.MODETYPE;
                        frm.Dispose();
                    }
                    else
                    {
                        //拍照
                        switch (AutoHostConfig.ReadCardType)
                        {
                        case "XUHUI":
                            AutoServiceSDK.SdkService.Common_XH camera = new AutoServiceSDK.SdkService.Common_XH();
                            camera.TakeCamera(SkyComm.cardInfoStruct.CardNo, SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["PATIENTNAME"].ToString(), AutoHostConfig.Machineno);
                            break;

                        default:
                            break;
                        }

                        FrmCardSavingCash frm = new FrmCardSavingCash();
                        frm.CallType = 2;
                        frm.ShowDialog();
                        Savingsucceed = frm.Savingsucceed;
                        RechargeMoney = frm.RechargeMoney;
                        frm.Dispose();
                    }
                    if (Savingsucceed == 1)
                    {
                        eLCardAuthorizationData.Tables[0].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_MODETYPE] = strModeType;
                        if (!eLCardAuthorizationData.Tables[0].Columns.Contains("OPERATORNAME"))
                        {
                            eLCardAuthorizationData.Tables[0].Columns.Add("OPERATORNAME");

                            eLCardAuthorizationData.Tables[0].Rows[0]["OPERATORNAME"] = SysOperatorInfo.OperatorName;
                        }
                        eCardAuthorizationFacade.updateEntity(eLCardAuthorizationData);
                        eLCardAuthorizationData.Tables[0].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_ADDMONEY] = RechargeMoney;

                        //打印发卡凭证
                        PrintSendCardReport(eLCardAuthorizationData);
                    }
                }
                catch (Exception ex2)
                {
                    Skynet.LoggingService.LogService.GlobalInfoMessage("发卡充值失败:" + ex2.Message);
                }
                finally
                {
                }

                if (Savingsucceed == 1)
                {
                    SendCard.OutputCard();
                    try
                    {
                        Common_XH theCamera_XH = new Common_XH();
                        theCamera_XH.DoorLightOpen(LightTypeenum.出卡槽, LightOpenTypeenum.闪烁);
                        theCamera_XH.DoorLightOpen(LightTypeenum.发卡器, LightOpenTypeenum.闪烁);
                        theCamera_XH.DoorLightOpen(LightTypeenum.凭条, LightOpenTypeenum.闪烁);
                    }
                    catch (Exception exception)
                    {
                    }
                    SkyComm.ShowMessageInfo("发卡成功,请取走您的就诊卡!");
                }
                else
                {
                    //回收卡信息并且注册卡
                    //撤消已发卡的信息
                    Skynet.LoggingService.LogService.GlobalInfoMessage("充值失败,撤消发卡信息");
                    eCardAuthorizationFacade.deleteEntityAndCardSaving(eLCardAuthorizationData);
                    eLCardAuthorizationData = new CardAuthorizationData();
                    strDiagnoseid           = string.Empty;
                    this.lblOK.Enabled      = true;
                    this.btnReturn.Enabled  = true;
                    this.btnExit.Enabled    = true;
                    panel2.Enabled          = true;

                    //发卡失败以后将卡进行回收
                    SendCard.ReturnCard();
                    return;
                }
            }
            catch (Exception ex)
            {
                Skynet.LoggingService.LogService.GlobalInfoMessage("发卡失败:" + ex.Message + ",系统回收卡机中的卡");

                //发卡失败以后将卡进行回收
                SendCard.ReturnCard();

                SkynetMessage.MsgInfo("发卡失败:" + ex.Message);
                return;
            }
            finally
            {
                this.lblOK.Enabled     = true;
                this.btnReturn.Enabled = true;
                this.btnExit.Enabled   = true;
                panel2.Enabled         = true;

                SkyComm.cardInfoStruct = new CardInformationStruct();
                SkyComm.eCardAuthorizationData.Tables[0].Clear();
                SkyComm.DiagnoseID   = string.Empty;
                SkyComm.cardBlance   = 0;
                SkyComm.cardallmoney = 0;
            }
            #endregion

            SystemFramework.Voice.Voice voice = new SystemFramework.Voice.Voice();
            voice.PlayText("请在就诊卡出口取走您的就诊卡!");
            voice.EndJtts();


            DialogResult = System.Windows.Forms.DialogResult.OK;
        }