/// <summary> /// 提示框点击取消按钮 /// </summary> public static void step6() { HxShengQing.SystemOpera("取消"); }
/// <summary> /// 红冲信息表下载demo,缺少成功验证逻辑 /// </summary> public static void downLoadInfo() { var infoBar = WinApi.FindWindow(null, "信息表选择"); var list = WinApi.EnumChildWindowsCallback(infoBar); var toolStrip = list.Find(bar => bar.szWindowName == "toolStrip1"); if (toolStrip.hWnd == IntPtr.Zero) { return; } ClickBtnByName(toolStrip.hWnd, "下载"); Thread.Sleep(500); var beginDateBar = IntPtr.Zero; var endDateBar = IntPtr.Zero; var purTaxNoBar = IntPtr.Zero; var saleTaxNoBar = IntPtr.Zero; var infoBhBar = IntPtr.Zero; var confirmBar = IntPtr.Zero; HxShengQing.TryRetry(str => { var downinfoBar = WinApi.FindWindow(null, str); var infoChilds = WinApi.FindChildInfo(downinfoBar); confirmBar = infoChilds.Find(b => b.szWindowName == "确定").hWnd; var infoTableInfoBar = infoChilds.Find(b => b.szWindowName == "信息表信息"); var infoTableChilds = WinApi.FindChildBar(infoTableInfoBar.hWnd); purTaxNoBar = infoTableChilds[5]; saleTaxNoBar = infoTableChilds[4]; infoBhBar = infoTableChilds[1]; var dateBar = infoChilds.Find(b => b.szWindowName == "填开日期"); var dateChilds = WinApi.FindChildBar(dateBar.hWnd); beginDateBar = dateChilds[1]; endDateBar = dateChilds[0]; if (beginDateBar == IntPtr.Zero || endDateBar == IntPtr.Zero || purTaxNoBar == IntPtr.Zero || saleTaxNoBar == IntPtr.Zero || infoBhBar == IntPtr.Zero || confirmBar == IntPtr.Zero) { return(false); } return(true); }, "红字发票信息表审核结果下载条件设置"); WinApi.LeftClick(beginDateBar); Thread.Sleep(500); //修改填开日期起为2018-1-1 Thread.Sleep(100); SendKeys.SendWait("2018"); Thread.Sleep(100); SendKeys.SendWait("{right}"); Thread.Sleep(100); SendKeys.SendWait("01"); Thread.Sleep(100); SendKeys.SendWait("{right}"); Thread.Sleep(100); SendKeys.SendWait("01"); Thread.Sleep(100); WinApi.SendMessage(purTaxNoBar, 0X0C, IntPtr.Zero, "1234567890"); Thread.Sleep(100); WinApi.SendMessage(saleTaxNoBar, 0X0C, IntPtr.Zero, "0987654321"); Thread.Sleep(100); WinApi.SendMessage(infoBhBar, 0X0C, IntPtr.Zero, "12345678901234567"); Thread.Sleep(500); WinApi.LeftClick(confirmBar); var infoDownLoadBar = HxShengQing.TryRetry(str => WinApi.FindWindow(null, str), "信息表下载中"); if (infoDownLoadBar != IntPtr.Zero) { for (var i = 0; i < 100; i++) { infoDownLoadBar = WinApi.FindWindow(null, "信息表下载中"); var SysMessageBox = WinApi.FindWindow(null, "SysMessageBox"); if (SysMessageBox != IntPtr.Zero) { HxShengQing.SystemOpera("确认"); break; } if (infoDownLoadBar == IntPtr.Zero) { break; } Thread.Sleep(1000); } } }
public static void WriteGoodsSetting(IntPtr goodNoSettingHw, RednotificationDetail detail) { if (goodNoSettingHw == IntPtr.Zero) { return; } if (detail == null) { detail = new RednotificationDetail() { GoodsTaxNo = "101010102", //TaxPer = "1", TaxPerCon = "不征税", TaxRate = "0.17" }; } var suilvBar = IntPtr.Zero; var yhBar = IntPtr.Zero; var yhlBar = IntPtr.Zero; var toolStrip = IntPtr.Zero; HxShengQing.TryRetry(str => { var childInfos = WinApi.FindChildInfo(goodNoSettingHw); if (childInfos == null || childInfos.Count < 11) { return(false); } //获取toolStrip toolStrip = childInfos.Find(b => b.szWindowName == "toolStrip1").hWnd; //税率句柄 suilvBar = childInfos[10].hWnd; //享受优惠政策 yhBar = childInfos[8].hWnd; //优惠政策类型 yhlBar = childInfos[5].hWnd; return(toolStrip != IntPtr.Zero && suilvBar != IntPtr.Zero && yhBar != IntPtr.Zero && yhlBar != IntPtr.Zero); }, "", 20, 500); if ("1".Equals(detail.TaxPer) && !string.IsNullOrEmpty(detail.TaxPerCon)) { UIHelper.SetCombox(yhBar, "是"); //等待优惠政策enable Thread.Sleep(1000); UIHelper.SetCombox(yhlBar, detail.TaxPerCon.Trim()); } else { UIHelper.SetCombox(suilvBar, GetByTaxRate(detail.TaxRate)); } ClickBtnByName(toolStrip, "保存"); Thread.Sleep(1000); HxShengQing.SystemOpera("确认", out var message); if (message != "修改成功!") { throw new Exception(message); } }
public static void WriteGoodsSetting(IntPtr goodNoSettingHw, string taxPer = "", string taxPerCon = "", string taxRate = "") { if (goodNoSettingHw == IntPtr.Zero) { return; } var suilvBar = IntPtr.Zero; var yhBar = IntPtr.Zero; var yhlBar = IntPtr.Zero; var toolStrip = IntPtr.Zero; TryRetry(str => { var childInfos = WinApi.FindChildInfo(goodNoSettingHw); if (childInfos == null || childInfos.Count < 11) { return(false); } //获取toolStrip toolStrip = childInfos.Find(b => b.szWindowName == "toolStrip1").hWnd; //税率句柄 suilvBar = childInfos[10].hWnd; //享受优惠政策 yhBar = childInfos[8].hWnd; //优惠政策类型 yhlBar = childInfos[5].hWnd; return(toolStrip != IntPtr.Zero && suilvBar != IntPtr.Zero && yhBar != IntPtr.Zero && yhlBar != IntPtr.Zero); }, "", 20, 500); if (toolStrip == IntPtr.Zero || suilvBar == IntPtr.Zero || yhBar == IntPtr.Zero || yhlBar == IntPtr.Zero) { //AmLogger.Error("WriteGoodsSetting", $"税收分类编码设置窗体,控件句柄获取失败"); //throw new AmExceptionCode("税收分类编码设置窗体,控件句柄获取失败"); } if ("1".Equals(taxPer) && !string.IsNullOrEmpty(taxPerCon)) { UIHelper.SetCombox(yhBar, "是"); //等待优惠政策enable Thread.Sleep(1000); UIHelper.SetCombox(yhlBar, taxPerCon.Trim()); } else { UIHelper.SetCombox(suilvBar, HxShengQing.GetByTaxRate(taxRate)); } HxShengQing.ClickBtnByName(toolStrip, "保存"); Thread.Sleep(1000); HxShengQing.SystemOpera("确认", out var message); if (message != "修改成功!") { throw new Exception(message); } //AmLogger.Info("WriteGoodsSetting", $"税收分类编码设置窗体,设置成功"); }