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 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); }