Example #1
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            backgroundWorker1.RunWorkerAsync();
            if (MoneyServer.OpenPort(SkyComm.cardInfoStruct.CardNo) == true)
            {
                //拍照
                switch (AutoHostConfig.ReadCardType)
                {
                case "XUHUI":
                case "XUHUIM1":
                    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;
                timer1.Start();
                timer2.Start();
                this.timer3.Start();
                this.btnClose.Enabled = false;
                this.btnExit.Enabled  = false;
            }
            else
            {
                SkynetMessage.MsgInfo("钞箱设置没有初始化失败,请在窗口充值或者银行卡充值!");
            }
        }
        private void lblBankStored_Click(object sender, EventArgs e)
        {
            lblBankStored.Enabled = false;
            ucTime1.timer1.Stop();

            FrmMoneyInput frm = new FrmMoneyInput();

            frm.CallType = CallType;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                RechargeMoney = DecimalRound.Round(frm.inputMoney, 2);
                frm.Dispose();
            }
            else
            {
                ucTime1.timer1.Start();
                lblBankStored.Enabled = true;
                return;
            }

            //调用POS机推秆程序打开
            AutoServiceSDK.SdkService.Common_XH theCommon_XH = null;
            if (AutoHostConfig.ReadCardType == "XUHUI")
            {
                theCommon_XH = new AutoServiceSDK.SdkService.Common_XH();
                theCommon_XH.PosDoor(0);
            }

            try
            {
                Saving(RechargeMoney);
            }
            catch (Exception ex)
            {
                Skynet.LoggingService.LogService.GlobalInfoMessage("调用银行卡充值失败:" + ex.Message);
            }
            finally
            {
                if (AutoHostConfig.ReadCardType == "XUHUI")
                {
                    theCommon_XH.PosDoor(1);
                }
                lblBankStored.Enabled = true;
            }
        }
        private void lblCashStored_Click(object sender, EventArgs e)
        {
            this.ucTime1.timer1.Stop();

            //现金预存前先刷卡
            if (string.IsNullOrEmpty(SkyComm.cardInfoStruct.CardNo))
            {
                FrmMain frmM      = new FrmMain();
                int     intResult = SkyComm.ReadCard("现金预存");
                if (intResult == 0)
                {
                    this.ucTime1.timer1.Start();
                    return;
                }
            }

            //拍照
            switch (AutoHostConfig.ReadCardType)
            {
            case "XUHUI":
            case "XUHUIM1":
                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;
            }

            FrmInHosSavingCash frm = new FrmInHosSavingCash();

            frm.inHosData = InHosData;
            if (frm.ShowDialog(this) == DialogResult.Cancel)
            {
                this.ucTime1.timer1.Start();
            }
            frm.Dispose();
        }
        private void btnExit_Click(object sender, EventArgs e)
        {
            MoneyServer.NotAllowCashin();
            timer2.Stop();
            timer1.Stop();

            //wangchao 点击返回或退出之后,将按钮置为不可用状态,防止反复点击。
            btnClose.Enabled = false;
            btnExit.Enabled  = false;

            //拍照,纸币器
            switch (AutoHostConfig.ReadCardType)
            {
            case "XUHUI":
                AutoServiceSDK.SdkService.Common_XH camera = new AutoServiceSDK.SdkService.Common_XH();
                camera.TakeCameraEnd();
                camera.DoorLightClose(LightTypeenum.纸币器);
                break;

            default:
                break;
            }

            if (btnStart.Enabled == false)
            {
                #region 休眠3秒以后重新获取纸币金额
                Thread.Sleep(3000);
                Skynet.LoggingService.LogService.GlobalInfoMessage("在结束预存之后休眠2秒重新获取存钞明细,开始获取状态");
                int intCheckStatus = MoneyServer.GetStatus();
                Skynet.LoggingService.LogService.GlobalInfoMessage("在结束预存之后休眠2秒重新获取存钞明细,状态:" + intCheckStatus);
                int InMoney = MoneyServer.GetInMoney(AutoHostConfig.Machineno, SysOperatorInfo.OperatorID);
                Skynet.LoggingService.LogService.GlobalInfoMessage("在结束预存之后重新获取存钞明细金额:" + InMoney);
                if (InMoney > 0)
                {
                    //投入数量
                    int intOld = Convert.ToInt32(lblAmount.Text) + 1;
                    lblAmount.Text = intOld.ToString();

                    //投入金额
                    RechargeMoney += Convert.ToDecimal(InMoney);
                    RechargeMoney  = DecimalRound.Round(RechargeMoney, 2);
                    lblMoney.Text  = RechargeMoney.ToString();
                    MoneyServer.AllowCashin();

                    btnClose.Enabled = false;
                    btnExit.Enabled  = false;
                    btnEnd.Enabled   = true;
                    timer1.Start();
                    timer2.Start();

                    return;
                }
                MoneyServer.ClosePort();
                #endregion
            }

            if (RechargeMoney == 0)
            {
                SkyComm.CloseWin(this);
            }
        }
        private void lblCashStored_Click(object sender, EventArgs e)
        {
            btnEnd.Enabled = false;
            WaitDialogForm form = new WaitDialogForm("正在存钞中,请稍候...", "正在组织数据,请稍候......", new Size(240, 60));

            try
            {
                MoneyServer.NotAllowCashin();

                //拍照,纸币器
                switch (AutoHostConfig.ReadCardType)
                {
                case "XUHUI":
                    AutoServiceSDK.SdkService.Common_XH camera = new AutoServiceSDK.SdkService.Common_XH();
                    camera.TakeCameraEnd();
                    camera.DoorLightClose(LightTypeenum.纸币器);
                    break;

                default:
                    break;
                }

                timer2.Stop();
                timer1.Stop();

                #region 休眠3秒以后重新获取纸币金额
                Thread.Sleep(5000);
                Skynet.LoggingService.LogService.GlobalInfoMessage("在结束预存之后休眠2秒重新获取存钞明细");
                int InMoney = MoneyServer.GetInMoney(AutoHostConfig.Machineno, SysOperatorInfo.OperatorID);
                Skynet.LoggingService.LogService.GlobalInfoMessage("在结束预存之后重新获取存钞明细金额:" + InMoney);
                if (InMoney > 0)
                {
                    //投入数量
                    int intOld = Convert.ToInt32(lblAmount.Text) + 1;
                    lblAmount.Text = intOld.ToString();

                    //投入金额
                    RechargeMoney += Convert.ToDecimal(InMoney);
                    RechargeMoney  = DecimalRound.Round(RechargeMoney, 2);
                    lblMoney.Text  = RechargeMoney.ToString();
                }
                #endregion

                if (RechargeMoney == 0)
                {
                    btnClose_Click(null, null);
                    return;
                }

                lblNoPaymentCharge.Enabled = true;
                ucTime1.timer1.Stop();
                if (eCardSavingFacade == null)
                {
                    eCardSavingFacade = new CardSavingFacade();
                }
                if (eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows.Count <= 0)
                {
                    MyAlert frm = new MyAlert(AlertTypeenum.信息, "此操作没有找到所要充值的卡信息!");
                    frm.ShowDialog();
                    return;
                }
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0].BeginEdit();
                //卡号
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_CARDID] = SkyComm.cardInfoStruct.CardNo;
                //充值时间
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_OPERATETIME] = new CommonFacade().GetServerDateTime();
                ////操作员
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_OPERATOR] = SysOperatorInfo.OperatorID;
                ////充值类型
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_SAVINGMODE] = 1;
                ////Add money

                Skynet.LoggingService.LogService.GlobalInfoMessage("现金发卡保存数据设置押金之前");
                if (CallType == 2)
                {
                    Decimal deposit = Convert.ToDecimal(SkyComm.getvalue("发卡工本费"));
                    eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_ADDMONEY] = RechargeMoney - Convert.ToDecimal(SkyComm.dsCardType.Tables[0].Rows[0]["FEES"]) - deposit;
                }
                else
                {
                    eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_ADDMONEY] = RechargeMoney;
                }
                Skynet.LoggingService.LogService.GlobalInfoMessage("现金发卡保存数据设置押金之后");
                //业务类型
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_BUSSNESSTYPE] = "充值";
                //支付方式
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_MODETYPE] = SkyComm.AddMoneyCashMode;
                //单位
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_UNIT] = "";
                //支票号
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_CHECKLOT] = "";

                //充值数据来源
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_ADDMONEYSOURCE] = AutoHostConfig.BankName;

                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0].EndEdit();

                ReckonAccountTimeFacade reckonAccountsTimeFacade = new ReckonAccountTimeFacade();
                DateTime accountTime = reckonAccountsTimeFacade.GetEndTime(SysOperatorInfo.OperatorID, "门诊");
                if (Convert.ToDateTime(eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_OPERATETIME]) < accountTime)
                {
                    SkyComm.ShowMessageInfo("该时间段已经结帐,不能办理预交金业务,请重试!");
                    return;
                }

                DataSet cardSavingData = eCardSavingFacade.insertEntity(eCardAuthorizationData);
                SkyComm.GetCardBalance();
                Skynet.LoggingService.LogService.GlobalInfoMessage("充值成功,调用类型:" + CallType);
                Savingsucceed = 1;
                if (CallType != 2)
                {
                    //打印充值凭证
                    PrintInfo("自助充值凭证", cardSavingData.Tables[0].Rows[0]["TRANSACTION_ID"].ToString(), RechargeMoney.ToString());
                }
            }
            catch (Exception ex)
            {
                SkyComm.ShowMessageInfo("存钞失败:" + ex.Message);
                Skynet.LoggingService.LogService.GlobalInfoMessage("存钞失败:" + ex.Message);
            }
            finally
            {
                MoneyServer.ClosePort();
                form.Close();
                form.Dispose();

                btnEnd.Enabled = true;
            }

            Skynet.LoggingService.LogService.GlobalInfoMessage("充值成功,调用类型:" + CallType);
            if (CallType == 0)
            {
                FrmRechargeSuccessful frmRecharge = new FrmRechargeSuccessful();
                frmRecharge.RechargeMoney = RechargeMoney;
                frmRecharge.ShowDialog(this);
                frmRecharge.Dispose();
                SkyComm.CloseWin(this);
            }
            else if (CallType == 2)
            {
                SkyComm.CloseWin(this);
            }
            else
            {
                SkyComm.ShowMessageInfo("您成功充值" + RechargeMoney + "元!卡中余额" + SkyComm.cardBlance.ToString() + "");
                SkyComm.CloseWin(this);
            }
            //GetMoeny();
        }
        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;
        }
Example #7
0
        private void lblCashStored_Click(object sender, EventArgs e)
        {
            btnEnd.Enabled = false;
            bool           errorFlag = false;//错误标识
            WaitDialogForm form      = new WaitDialogForm("正在存钞中,请稍候...", "正在组织数据,请稍候......", new Size(240, 60));

            try
            {
                MoneyServer.NotAllowCashin();

                //拍照,纸币器
                switch (AutoHostConfig.ReadCardType)
                {
                case "XUHUI":
                case "XUHUIM1":
                    AutoServiceSDK.SdkService.Common_XH camera = new AutoServiceSDK.SdkService.Common_XH();
                    camera.TakeCameraEnd();
                    camera.DoorLightClose(LightTypeenum.纸币器);
                    break;

                default:
                    break;
                }

                timer2.Stop();
                timer1.Stop();

                #region 休眠3秒以后重新获取纸币金额
                Thread.Sleep(5000);
                Skynet.LoggingService.LogService.GlobalInfoMessage("在结束预存之后休眠2秒重新获取存钞明细");
                int InMoney = MoneyServer.GetInMoney(AutoHostConfig.Machineno, SysOperatorInfo.OperatorID);
                Skynet.LoggingService.LogService.GlobalInfoMessage("在结束预存之后重新获取存钞明细金额:" + InMoney);
                if (InMoney > 0)
                {
                    //投入数量
                    int intOld = Convert.ToInt32(lblAmount.Text) + 1;
                    lblAmount.Text = intOld.ToString();

                    //投入金额
                    RechargeMoney += Convert.ToDecimal(InMoney);
                    RechargeMoney  = DecimalRound.Round(RechargeMoney, 2);
                    lblMoney.Text  = RechargeMoney.ToString();
                }
                #endregion

                if (RechargeMoney == 0)
                {
                    btnClose_Click(null, null);
                    return;
                }

                ucTime1.timer1.Stop();

                #region 预交金充值
                AdvanceRecordData AdvData = new AdvanceRecordData();
                string            strlsh  = DateTime.Now.ToString("yyMMddHHmmss") + SysOperatorInfo.OperatorID + GenValidateCode();
                DataRow           dr      = AdvData.Tables[0].NewRow();
                dr[AdvanceRecordData.H_ADVANCE_RECORD_ADVANCEID]        = "新增";
                dr[AdvanceRecordData.H_ADVANCE_RECORD_BUSINESSBANK]     = strlsh;
                dr[AdvanceRecordData.H_ADVANCE_RECORD_CANCELMARK]       = 0;
                dr[AdvanceRecordData.H_ADVANCE_RECORD_CHEQUEID]         = "";
                dr[AdvanceRecordData.H_ADVANCE_RECORD_CURRENTINHOSMARK] = inHosData.Tables[0].Rows[0]["CURRENTINHOSMARK"].ToString();;
                dr[AdvanceRecordData.H_ADVANCE_RECORD_INHOSID]          = inHosData.Tables[0].Rows[0]["INHOSID"].ToString();
                dr[AdvanceRecordData.H_ADVANCE_RECORD_OFFICEID]         = inHosData.Tables[0].Rows[0]["INHOSOFFICEID"].ToString();//this.txtZyks.Text;
                dr[AdvanceRecordData.H_ADVANCE_RECORD_OPERATEDATE]      = new CommonFacade().GetServerDateTime();
                dr[AdvanceRecordData.H_ADVANCE_RECORD_OPERATORID]       = SysOperatorInfo.OperatorID;
                dr[AdvanceRecordData.H_ADVANCE_RECORD_PAYMODEID]        = SkyComm.getvalue("住院预交金充值方式_现金").ToString();
                dr[AdvanceRecordData.H_ADVANCE_RECORD_PAYMONEY]         = RechargeMoney;
                dr[AdvanceRecordData.H_ADVANCE_RECORD_RECEIPTID]        = string.Empty;
                AdvData.Tables[0].Rows.Add(dr);
                AdvanceRecordFacade theAdvanceRecordFacade = new AdvanceRecordFacade();
                string advanceid = string.Empty;
                try
                {
                    advanceid = theAdvanceRecordFacade.insertEntity(AdvData, false);
                    if (advanceid == "")
                    {
                        SkyComm.ShowMessageInfo("住院预交金充值失败,请与医院相关人员联系!");
                        errorFlag = true;
                    }
                }
                catch (Exception ex)
                {
                    LogService.GlobalInfoMessage("收预交款失败:" + ex.Message);
                    if (ex.Message.IndexOf("您已经没有可用发票") >= 0)
                    {
                        SkyComm.ShowMessageInfo("住院预交金充值失败,请与医院相关人员联系!");
                        errorFlag = true;
                    }
                }
                #endregion
                Skynet.LoggingService.LogService.GlobalInfoMessage("充值成功");
                if (advanceid != "")
                {
                    string receiptID = theAdvanceRecordFacade.GetReceiptIDByAdvanceID(advanceid);

                    //打印充值凭证
                    PrintInfo("住院预交金充值凭证", receiptID, RechargeMoney.ToString(), advanceid);
                }
            }
            catch (Exception ex)
            {
                SkyComm.ShowMessageInfo("存钞失败:" + ex.Message);
                errorFlag = true;
                Skynet.LoggingService.LogService.GlobalInfoMessage("存钞失败:" + ex.Message);
            }
            finally
            {
                MoneyServer.ClosePort();
                form.Close();
                form.Dispose();

                btnEnd.Enabled = true;
            }
            if (!errorFlag)
            {
                decimal old_YE = Convert.ToDecimal(inHosData.Tables[0].Rows[0]["BALANCEMONEY"].ToString());
                SkyComm.ShowMessageInfo("您成功充值" + RechargeMoney + "元!住院预交金余额" + (RechargeMoney + old_YE).ToString("0.00##") + "元!");
            }
            else
            {
                Skynet.LoggingService.LogService.GlobalInfoMessage("住院预交金现金充值操作失败:患者诊疗号【" + SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["DIAGNOSEID"].ToString() + "】,患者姓名【" + SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["PATIENTNAME"].ToString() + "】,现金充值金额【" + RechargeMoney + "】元");
            }
            SkyComm.CloseWin(this);
        }
        private void lblOK_Click(object sender, EventArgs e)
        {
            ucTime1.Sec = 60;
            ucTime1.timer1.Stop();


            if (SendCard.CheckCard() == "1")
            {
                SkyComm.ShowMessageInfo("该自助机没有卡,请在其他自助机上进行补卡操作!");
                ucTime1.timer1.Start();
                return;
            }
            this.lblOK.Enabled = false;
            //this.btnReturn.Enabled = false;
            this.btnExit.Enabled = false;
            //DataSet dsNewInfo = new DataSet();
            int     checkCount = 0;
            DataRow drCard     = ((DataView)this.gdvMain.DataSource).ToTable().NewRow();

            for (int i = 0; i < this.gdvMain.RowCount; i++)
            {
                if (Convert.ToBoolean(gdvMain.GetDataRow(i)["PITCHON1"].ToString()))
                {
                    drCard = gdvMain.GetDataRow(i);
                    checkCount++;
                }
            }
            if (checkCount == 0)
            {
                SkyComm.ShowMessageInfo("请选择一条卡信息进行补卡操作!");
                ucTime1.timer1.Start();
                eLCardAuthorizationData = new CardAuthorizationData();
                this.lblOK.Enabled      = true;
                //this.btnReturn.Enabled = true;
                this.btnExit.Enabled = true;
                return;
            }
            else if (checkCount > 1)
            {
                SkyComm.ShowMessageInfo("只能选择一条卡信息进行补卡操作!");
                ucTime1.timer1.Start();
                eLCardAuthorizationData = new CardAuthorizationData();
                this.lblOK.Enabled      = true;
                //this.btnReturn.Enabled = true;
                this.btnExit.Enabled = true;
                return;
            }

            if (SkyComm.eCardAuthorizationData != null && SkyComm.eCardAuthorizationData.Tables.Count != 0 && SkyComm.eCardAuthorizationData.Tables[0].Rows.Count != 0)
            {
                if (drCard["CARDID"].ToString() == SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["CARDID"].ToString())
                {
                    SkyComm.ShowMessageInfo("不能对当前正在使用的就诊卡进行补卡操作!");
                    ucTime1.timer1.Start();
                    eLCardAuthorizationData = new CardAuthorizationData();
                    this.lblOK.Enabled      = true;
                    //this.btnReturn.Enabled = true;
                    this.btnExit.Enabled = true;
                    return;
                }
            }

            FrmYesNoAlert frmAlert = new FrmYesNoAlert();

            frmAlert.Title = "提示";
            frmAlert.Msg   = "是否确认对选择的卡信息进行补卡操作?         【卡号:" + drCard["CARDID"].ToString() + "】【姓名:" + drCard["PATIENTNAME"].ToString() + "】";
            if (frmAlert.ShowDialog() == DialogResult.Cancel)
            {
                this.ucTime1.timer1.Start();
                eLCardAuthorizationData = new CardAuthorizationData();
                this.lblOK.Enabled      = true;
                //this.btnReturn.Enabled = true;
                this.btnExit.Enabled = true;
                return;
            }
            CardAuthorizationFacade eCardAuthorizationFacade = new CardAuthorizationFacade();

            using (WaitDialogForm form = new WaitDialogForm("正在发卡中,请稍候...", "正在组织发卡数据,请稍候......", new Size(240, 60)))
            {
                #region 补卡

                eLCardAuthorizationData = (CardAuthorizationData)eCardAuthorizationFacade.CancleAndReissueCard(drCard["ACCOUNT_ID"].ToString(), drCard["CARDID"].ToString(), SysOperatorInfo.OperatorID, drCard["CIRCUIT_STATE"].ToString());
                //写卡,如果失败则重试
                bool isSuccess = false;
                form.Caption = "正在写卡中,请稍候...";
                try
                {
                    for (int i = 0; i < 3; i++)
                    {
                        //第一次写卡
                        if (SendCard.WriteCard(eLCardAuthorizationData.Tables[0].Rows[0]["CARDID"].ToString()) == false)
                        {
                            //第一次写卡失败,再进行第二次写卡
                            if (SendCard.WriteCard(eLCardAuthorizationData.Tables[0].Rows[0]["CARDID"].ToString()) == 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;
                }

                //写卡失败
                if (isSuccess == false)
                {
                    //撤消已注销挂失并补卡的信息
                    //eCardAuthorizationFacade.deleteEntityAndCardSaving(eLCardAuthorizationData);
                    eCardAuthorizationFacade.TranBackBussiness(drCard["ACCOUNT_ID"].ToString(), eLCardAuthorizationData.Tables[0].Rows[0]["CARDID"].ToString(), drCard["CARDID"].ToString(), drCard["CIRCUIT_STATE"].ToString(), eLCardAuthorizationData);
                    SkynetMessage.MsgInfo("写卡失败,请在其他自助机上重试!");
                    this.lblOK.Enabled = true;
                    //this.btnReturn.Enabled = true;
                    this.btnExit.Enabled = true;
                    this.ucTime1.timer1.Start();
                    //第二次写卡失败以后将卡回收
                    SendCard.ReturnCard();
                    return;
                }
                #endregion
                form.Close();
            }
            #region 充值
            try
            {
                SkyComm.eCardAuthorizationData = eLCardAuthorizationData;//暂注释
                SkyComm.DiagnoseID             = SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["DIAGNOSEID"].ToString();
                SkyComm.cardInfoStruct.CardNo  = eLCardAuthorizationData.Tables[0].Rows[0]["CARDID"].ToString();
                SkyComm.cardBlance             = 0;
                CardSavingFacade cf = new CardSavingFacade();
                SkyComm.cardallmoney = 0;

                int     Savingsucceed = 0;
                decimal RechargeMoney = 0;
                string  strModeType   = "现金";
                string  projectType   = SkyComm.getvalue("项目版本标识");
                if (!string.IsNullOrEmpty(projectType) && projectType == "锡林郭勒盟医院")
                {
                    //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;
                    Savingsucceed = 1;
                    //打印发卡凭证
                    PrintSendCardReport(eLCardAuthorizationData, drCard["PATIENTNAME"].ToString());
                }
                else
                {
                    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":
                            case "XUHUIM1":
                                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, drCard["PATIENTNAME"].ToString());
                        }
                    }
                    catch (Exception ex2)
                    {
                        Skynet.LoggingService.LogService.GlobalInfoMessage("补卡充值失败:" + ex2.Message);
                    }
                    finally
                    {
                        //SkyComm.cardInfoStruct = new CardInformationStruct();
                        //SkyComm.eCardAuthorizationData.Tables[0].Clear();
                        //SkyComm.DiagnoseID = string.Empty;
                        //SkyComm.cardBlance = 0;
                        //SkyComm.cardallmoney = 0;
                    }
                }
                if (Savingsucceed == 1)
                {
                    SendCard.OutputCard();

                    SkyComm.ShowMessageInfo("补卡成功,请取走您的就诊卡!");
                }
                else
                {
                    //撤消已注销挂失并补卡的信息
                    Skynet.LoggingService.LogService.GlobalInfoMessage("充值失败,撤消发卡信息");
                    //eCardAuthorizationFacade.deleteEntityAndCardSaving(eLCardAuthorizationData);
                    DataSet dsCardAuthorizationData = (DataSet)eLCardAuthorizationData;
                    eCardAuthorizationFacade.TranBackBussiness(drCard["ACCOUNT_ID"].ToString(), eLCardAuthorizationData.Tables[0].Rows[0]["CARDID"].ToString(), drCard["CARDID"].ToString(), drCard["CIRCUIT_STATE"].ToString(), eLCardAuthorizationData);
                    eLCardAuthorizationData = new CardAuthorizationData();
                    this.lblOK.Enabled      = true;
                    //this.btnReturn.Enabled = true;
                    this.btnExit.Enabled = true;

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

                    return;
                }
            }
            catch (Exception ex)
            {
                Skynet.LoggingService.LogService.GlobalInfoMessage("发卡失败:" + ex.Message + ",系统回收卡机中的卡");

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

                SkynetMessage.MsgInfo("发卡失败:" + ex.Message);
                ucTime1.timer1.Start();

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

                this.lblOK.Enabled = true;
                //this.btnReturn.Enabled = true;
                this.btnExit.Enabled = true;
            }
            #endregion

            SystemFramework.Voice.Voice voice = new SystemFramework.Voice.Voice();
            voice.PlayText("请在就诊卡出口取走您的就诊卡!");
            voice.EndJtts();
            ucTime1.timer1.Start();
            DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Example #9
0
        public void AddInHosMoney(IWin32Window owner)
        {
            if (!string.IsNullOrEmpty(AutoHostConfig.PosInterfaceType) && !string.IsNullOrEmpty(AutoHostConfig.CashBoxType))
            {
                //如果已经有卡号时,则表示已经读过卡,则不需要再重新读卡
                if (string.IsNullOrEmpty(SkyComm.cardInfoStruct.CardNo))
                {
                    int intResult = SkyComm.ReadCard("现金预存");
                    if (intResult == 0)
                    {
                        return;
                    }
                }

                FrmInhosAdvance frm = new FrmInhosAdvance();
                frm.ShowDialog(owner);
                frm.Dispose();
            }
            else if (!string.IsNullOrEmpty(AutoHostConfig.CashBoxType))
            {
                #region 直接现金预存
                //现金预存前先刷卡
                //如果已经有卡号时,则表示已经读过卡,则不需要再重新读卡
                if (string.IsNullOrEmpty(SkyComm.cardInfoStruct.CardNo))
                {
                    int intResult = SkyComm.ReadCard("现金预存");
                    if (intResult == 0)
                    {
                        return;
                    }
                }

                //拍照
                switch (AutoHostConfig.ReadCardType)
                {
                case "XUHUI":
                case "XUHUIM1":
                    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;
                }

                FrmInHosSavingCash frm = new FrmInHosSavingCash();
                if (frm.ShowDialog(owner) == DialogResult.Cancel)
                {
                    frm.Dispose();
                    return;
                }


                frm.Dispose();

                #endregion
            }
            else if (!string.IsNullOrEmpty(AutoHostConfig.PosInterfaceType))
            {
                #region 直接银行预存
                //现金预存前先刷卡
                //如果已经有卡号时,则表示已经读过卡,则不需要再重新读卡
                if (string.IsNullOrEmpty(SkyComm.cardInfoStruct.CardNo))
                {
                    int intResult = SkyComm.ReadCard("银行预存");
                    if (intResult == 0)
                    {
                        return;
                    }
                }

                FrmInHosSavingBank frm = new FrmInHosSavingBank();
                if (frm.ShowDialog(owner) == DialogResult.Cancel)
                {
                    frm.Dispose();
                    return;
                }
                frm.Dispose();

                #endregion
            }

            ExitScanCard();
        }