/// <summary> /// 进项管理登录 /// </summary> private void JxLogin() { string token = string.Empty, ErrorMsg = string.Empty, errCode = string.Empty; this.Dispatcher.Invoke(new Action(() => { WaitingBox.Show(() => { //新版本调用大象token.dll取token 20190309 int retryCount = 3; do { --retryCount; token = GetTokenHelper.GetToken_dll(GlobalInfo.NSRSBH, GlobalInfo.JxPwd, GlobalInfo.Dqdm); errCode = GetTokenHelper.retCode; ErrorMsg = GetTokenHelper.ErrorMsg; } while (errCode != "0000" && retryCount > 0); }, PRO_ReceiptsInvMgr.Resources.Message.loginWait); })); if (errCode != "0000") { if (ErrorMsg.Contains("0xA7")) { ErrorMsg = PRO_ReceiptsInvMgr.Resources.Message.NotFindTax; } MessageBoxEx.Show(this, ErrorMsg, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); } else { GlobalInfo.token = token; JXManager win = new JXManager(); win.Show(); } }
private void btnQuery_Click(object sender, RoutedEventArgs e) { if (!RzqdViewModelInstance.QueryModel.Skssq.HasValue) { MessageBoxEx.Show(JXManager.JXManagerInstance, PRO_ReceiptsInvMgr.Resources.Message.SelectSkssq, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); return; } dtSkssq = RzqdViewModelInstance.QueryModel.Skssq.Value; imgTip.Visibility = Visibility.Collapsed; pcPage.Visibility = Visibility.Collapsed; pcPage.CrrentPage = 1; //每次查询时返回第一页 gifLoading.Visibility = Visibility.Visible; RzqdViewModelInstance.InvoiceList = new ObservableCollection <JXInvoiceInfo>(); Task.Factory.StartNew(() => { string msg = string.Empty; int totalCount = 0; invoiceList = service.GetRzqdData(RzqdViewModelInstance.QueryModel, out totalCount, out msg); //20190409 取数据失败时,如果是token过期则重新获取并重试 if (msg.Contains("token过期")) { int retryCount = 3; do { --retryCount; GlobalInfo.token = GetTokenHelper.GetToken_dll(GlobalInfo.NSRSBH, GlobalInfo.JxPwd, GlobalInfo.Dqdm); } while (GlobalInfo.token.Length == 0 && retryCount > 0); invoiceList = service.GetRzqdData(RzqdViewModelInstance.QueryModel, out totalCount, out msg); } RzqdViewModelInstance.ListCount = totalCount; RzqdViewModelInstance.InvoiceList = new ObservableCollection <JXInvoiceInfo>(invoiceList); this.Dispatcher.BeginInvoke(new Action(() => { pcPage.TotalCount = totalCount; if (!string.IsNullOrEmpty(msg)) { MessageBoxEx.Show(JXManager.JXManagerInstance, msg, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); } gifLoading.Visibility = Visibility.Collapsed; if (invoiceList.Count > 0) { var totalAmount = RzqdViewModelInstance.InvoiceList.Sum(x => x.HJBHSJE).Value; var totalSe = RzqdViewModelInstance.InvoiceList.Sum(x => x.SE).Value; RzqdViewModelInstance.TotalAmount = totalAmount.ToString("f2"); RzqdViewModelInstance.TotalSE = totalSe.ToString("f2"); pcPage.Visibility = Visibility.Visible; pcPage_DataSourcePageSize(null, null); } else { RzqdViewModelInstance.TotalAmount = string.Empty; RzqdViewModelInstance.TotalSE = string.Empty; imgTip.Visibility = Visibility.Visible; } })); }); }
private void btnGXRZ_Click(object sender, RoutedEventArgs e) { int count = invoiceList.Count(x => x.IsChecked); if (count == 0) { MessageBoxEx.Show(JXManager.JXManagerInstance, PRO_ReceiptsInvMgr.Resources.Message.SelectGXInvoice, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Information); return; } else if (count > 20) { MessageBoxEx.Show(JXManager.JXManagerInstance, PRO_ReceiptsInvMgr.Resources.Message.OutOfFpCount, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); return; } var checkedList = invoiceList.Where(x => x.IsChecked).ToList(); var totalAmount = checkedList.Sum(x => x.HJBHSJE).Value; var totalSe = checkedList.Sum(x => x.SE).Value; YqyjViewModelInstance.TotalAmount = totalAmount.ToString("f2"); YqyjViewModelInstance.TotalSE = totalSe.ToString("f2"); string confirmTip = string.Format("勾选总张数:{0} 张 总金额:{1} 元 总税额:{2} 元", count, YqyjViewModelInstance.TotalAmount, YqyjViewModelInstance.TotalSE); GxrzConfirm confirmWin = new GxrzConfirm(); confirmWin.ConfirmTip = confirmTip; confirmWin.SelectedList = checkedList; confirmWin.DoRzAction = () => { Task.Factory.StartNew(() => { string msg = string.Empty; this.Dispatcher.Invoke(new Action(() => { WaitingBox.Show(() => { service.GXRZ(checkedList, out msg); //20190409 取数据失败时,如果是token过期则重新获取并重试 if (msg.Contains("token过期")) { int retryCount = 3; do { --retryCount; GlobalInfo.token = GetTokenHelper.GetToken_dll(GlobalInfo.NSRSBH, GlobalInfo.JxPwd, GlobalInfo.Dqdm); } while (GlobalInfo.token.Length == 0 && retryCount > 0); service.GXRZ(checkedList, out msg); } }, PRO_ReceiptsInvMgr.Resources.Message.GxrzWait); })); this.Dispatcher.BeginInvoke(new Action(() => { if (!string.IsNullOrEmpty(msg)) { MessageBoxEx.Show(JXManager.JXManagerInstance, msg, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); } btnQuery_Click(null, null); })); }); }; confirmWin.Owner = JXManager.JXManagerInstance; confirmWin.ShowDialog(); }
private void GXRZPage_Loaded(object sender, RoutedEventArgs e) { /* this.DateInvoiceStart.BlackoutDates.Add(new CalendarDateRange(DateTime.Now.AddDays(1), DateTime.MaxValue)); * this.DateInvoiceEnd.BlackoutDates.Add(new CalendarDateRange(DateTime.Now.AddDays(1), DateTime.MaxValue)); */ SmrzViewModelInstance = new GxrzViewModel(); SmrzViewModelInstance.QueryModel = new GxrzQueryModel(); this.DataContext = SmrzViewModelInstance; //发票状态初始化 /* string[] combValues = { "正常", "失控", "作废", "红冲", "异常", "全部" }; * cbxInvoiceState.ItemsSource = combValues; * cbxInvoiceState.SelectedIndex = 0;*/ Task.Factory.StartNew(() => { string errorMsg = string.Empty; GlobalInfo.skssq = service.GetJXSsq(out errorMsg); //20190409 取数据失败时,如果是token过期则重新获取并重试 if (errorMsg.Contains("token过期")) { int retryCount = 3; do { --retryCount; GlobalInfo.token = GetTokenHelper.GetToken_dll(GlobalInfo.NSRSBH, GlobalInfo.JxPwd, GlobalInfo.Dqdm); } while (GlobalInfo.token.Length == 0 && retryCount > 0); GlobalInfo.skssq = service.GetJXSsq(out errorMsg); } if (!string.IsNullOrEmpty(errorMsg)) { this.Dispatcher.Invoke(new Action(() => { MessageBoxEx.Show(JXManager.JXManagerInstance, errorMsg, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); })); return; } else { SmrzViewModelInstance.Skssq = GlobalInfo.skssq; } string[] strDateArray = service.GetJXKpStartEndDate(out errorMsg); if (!string.IsNullOrEmpty(errorMsg)) { this.Dispatcher.Invoke(new Action(() => { MessageBoxEx.Show(JXManager.JXManagerInstance, errorMsg, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); })); } else { SmrzViewModelInstance.SelectStartDate = strDateArray[0]; SmrzViewModelInstance.SelectEndDate = strDateArray[1]; } }); smrzcont.Focus(); //GetInvoiceStatusTask(); }
private void btnGXRZ_Click(object sender, RoutedEventArgs e) { var checkedList = m_invoiceList.Where(x => x.IsChecked).ToList(); int count = checkedList.Count; if (count == 0) { MessageBoxEx.Show(JXManager.JXManagerInstance, PRO_ReceiptsInvMgr.Resources.Message.SelectGXInvoice, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Information); return; } else if (count > 60) { MessageBoxEx.Show(JXManager.JXManagerInstance, PRO_ReceiptsInvMgr.Resources.Message.OutOfFpCount, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); return; } string confirmTip = string.Format("勾选总张数:{0} 张 总金额:{1} 元 总税额:{2} 元", count, SmrzViewModelInstance.TotalAmount, SmrzViewModelInstance.TotalSE); GxrzConfirm confirmWin = new GxrzConfirm(); confirmWin.ConfirmTip = confirmTip; confirmWin.SelectedList = checkedList; confirmWin.DoRzAction = () => { Task.Factory.StartNew(() => { string msg = string.Empty; this.Dispatcher.Invoke(new Action(() => { WaitingBox.Show(() => { service.GXRZ(checkedList, out msg); //20190409 取数据失败时,如果是token过期则重新获取并重试 if (msg.Contains("token过期")) { int retryCount = 3; do { --retryCount; GlobalInfo.token = GetTokenHelper.GetToken_dll(GlobalInfo.NSRSBH, GlobalInfo.JxPwd, GlobalInfo.Dqdm); } while (GlobalInfo.token.Length == 0 && retryCount > 0); service.GXRZ(checkedList, out msg); } }, PRO_ReceiptsInvMgr.Resources.Message.GxrzWait); })); this.Dispatcher.BeginInvoke(new Action(() => { if (!string.IsNullOrEmpty(msg)) { MessageBoxEx.Show(JXManager.JXManagerInstance, msg, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); } if (msg.IndexOf("成功") != -1) { m_invoiceList.RemoveAll(x => x.IsChecked); } //显示 SmrzViewModelInstance.InvoiceList = new ObservableCollection <JXInvoiceInfo>(m_invoiceList); // SmrzViewModelInstance.YqTipCounts = SmrzViewModelInstance.InvoiceList.Count(x => x.YQTXBZ); this.Dispatcher.BeginInvoke(new Action(() => { splYqRemain.Visibility = SmrzViewModelInstance.YqTipCounts > 0 ? Visibility.Visible : Visibility.Collapsed; pcPage.TotalCount = m_invoiceList.Count; gifLoading.Visibility = Visibility.Collapsed; if (m_invoiceList.Count > 0) { pcPage.Visibility = Visibility.Visible; pcPage_DataSourcePageSize(null, null); } else { imgTip.Visibility = Visibility.Visible; } CalcTotalChecked(); })); })); }); }; confirmWin.Owner = JXManager.JXManagerInstance; confirmWin.ShowDialog(); }
private void btnQuery_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(SmrzViewModelInstance.Skssq)) { MessageBoxEx.Show(JXManager.JXManagerInstance, PRO_ReceiptsInvMgr.Resources.Message.SkssqNotLoaded, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); return; } if (string.IsNullOrEmpty(SmrzViewModelInstance.SelectStartDate)) { MessageBoxEx.Show(JXManager.JXManagerInstance, PRO_ReceiptsInvMgr.Resources.Message.SelectStartDateNotLoaded, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); return; } if (string.IsNullOrEmpty(SmrzViewModelInstance.SelectEndDate)) { MessageBoxEx.Show(JXManager.JXManagerInstance, PRO_ReceiptsInvMgr.Resources.Message.SelectEndDateNotLoaded, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); return; } /* SmrzViewModelInstance.QueryModel.FPZT = cbxInvoiceState.SelectedIndex.ToString(); * if(5 == cbxInvoiceState.SelectedIndex) * { * SmrzViewModelInstance.QueryModel.FPZT = "9"; * } * * if (!string.IsNullOrEmpty(SmrzViewModelInstance.QueryModel.SE)) * { * Regex reg = new Regex(@"^\d+(\.\d+)?$"); * if (!reg.IsMatch(SmrzViewModelInstance.QueryModel.SE)) * { * MessageBoxEx.Show(JXManager.JXManagerInstance, PRO_ReceiptsInvMgr.Resources.Message.QuerySeError, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); * return; * } * } * * if (DateInvoiceStart.SelectedDate.HasValue && DateInvoiceEnd.SelectedDate.HasValue && * DateInvoiceStart.SelectedDate.Value.CompareTo(DateInvoiceEnd.SelectedDate.Value) > 0) * { * MessageBoxEx.Show(JXManager.JXManagerInstance, PRO_ReceiptsInvMgr.Resources.Message.QueryDateError, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); * return; * }*/ if (m_QueryType == 0) //扫码查询 { string strtmp = smrzcont.Text.ToString(); if (strtmp.Length < 40) { return; } string[] sArray; int index = strtmp.IndexOf(',', 0); if (index >= 0) { sArray = strtmp.Split(','); } else { sArray = strtmp.Split(','); } SmrzViewModelInstance.QueryModel.InvoiceCode = sArray[2]; SmrzViewModelInstance.QueryModel.InvoiceNo = sArray[3]; } else //后四位enter查询 { if (btnrzcont.Text.Length < 8) { return; } SmrzViewModelInstance.QueryModel.InvoiceNo = btnrzcont.Text.ToString(); } SmrzViewModelInstance.IsAllChecked = false; imgTip.Visibility = Visibility.Collapsed; pcPage.Visibility = Visibility.Collapsed; //pcPage.CrrentPage = 1; //每次查询时返回第一页 gifLoading.Visibility = Visibility.Visible; SmrzViewModelInstance.InvoiceList = new ObservableCollection <JXInvoiceInfo>(); Task.Factory.StartNew(() => { string msg = string.Empty; int totalCount = 0; invoiceList = service.GetJXData(SmrzViewModelInstance.QueryModel, out totalCount, out msg); //20190324 取数据失败时,如果是token过期则重新获取并重试 if (msg.Contains("token过期")) { int retryCount = 3; do { --retryCount; GlobalInfo.token = GetTokenHelper.GetToken_dll(GlobalInfo.NSRSBH, GlobalInfo.JxPwd, GlobalInfo.Dqdm); } while (GlobalInfo.token.Length == 0 && retryCount > 0); invoiceList = service.GetJXData(SmrzViewModelInstance.QueryModel, out totalCount, out msg); } if (!string.IsNullOrEmpty(msg)) { MessageBoxEx.Show(JXManager.JXManagerInstance, msg, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); } if (invoiceList.Count > 0) { if (m_invoiceList.Count > 0) { bool bflag = false; foreach (var item in m_invoiceList) { if (item.InvoiceCode == invoiceList.First().InvoiceCode&& item.InvoiceNo == invoiceList.First().InvoiceNo) { bflag = true; } } if (!bflag) { m_invoiceList.AddRange(invoiceList); } } else { m_invoiceList.AddRange(invoiceList); } } totalCount = m_invoiceList.Count; //显示 SmrzViewModelInstance.InvoiceList = new ObservableCollection <JXInvoiceInfo>(m_invoiceList); SmrzViewModelInstance.YqTipCounts = SmrzViewModelInstance.InvoiceList.Count(x => x.YQTXBZ); this.Dispatcher.BeginInvoke(new Action(() => { splYqRemain.Visibility = SmrzViewModelInstance.YqTipCounts > 0 ? Visibility.Visible : Visibility.Collapsed; pcPage.TotalCount = totalCount; gifLoading.Visibility = Visibility.Collapsed; if (m_invoiceList.Count > 0) { pcPage.Visibility = Visibility.Visible; pcPage_DataSourcePageSize(null, null); } else { imgTip.Visibility = Visibility.Visible; } CalcTotalChecked(); })); }); }