//Get Frame public mshtml.HTMLWindow2 GetFrameByName(ref SHDocVw.InternetExplorerMedium WebOrWindow, string name) { SleepAndWaitComplete(WebOrWindow); try { mshtml.HTMLDocument Doc = (mshtml.HTMLDocument)WebOrWindow.Document; int length = System.Convert.ToInt32(Doc.frames.length); mshtml.FramesCollection frames = Doc.frames; mshtml.HTMLWindow2 frm = default(mshtml.HTMLWindow2); //Object 必要、 frames.item(i) iはInertger時 エラー object i = null; for (i = 0; (int)i <= length - 1; i = (int)i + 1) { //frm = if (((mshtml.HTMLWindow2)(frames.item(i))).name == name) { return((mshtml.HTMLWindow2)(frames.item(i))); } } object wd = null; for (i = 0; (int)i <= length - 1; i = (int)i + 1) { frm = (mshtml.HTMLWindow2)(frames.item(i)); wd = GetFrameByName(frm, name); if (wd != null) { return((mshtml.HTMLWindow2)wd); } } } catch (Exception) { } return(null); }
//Step 1 新規見積もり public void DoStep1_SinkiMitumori() { SHDocVw.InternetExplorerMedium cIe = GetPopupWindow("OnSite", "mitSearch.asp"); while (ReferenceEquals(cIe, null)) { Com.Sleep5(1000); cIe = GetPopupWindow("OnSite", "mitSearch.asp"); } Pub_Com.GetElementBy(ref cIe, "", "input", "value", "新規見積").click(); Com.Sleep5(100); Pub_Com.SleepAndWaitComplete(Ie); }
//Get Frame Wait public mshtml.HTMLWindow2 GetFrameWait(ref SHDocVw.InternetExplorerMedium webApp, string name) { mshtml.HTMLWindow2 fra = default(mshtml.HTMLWindow2); for (int i = 1; i <= 10; i++) { fra = GetFrameByName(ref webApp, name); if (fra != null) { return(fra); } Sleep5(200); } return(null); }
//Get element and do soming public mshtml.IHTMLElement GetElementByDo(ref SHDocVw.InternetExplorerMedium webApp, string fraName, string tagName, string keyName, string keyTxt) { if (ReferenceEquals(webApp, null)) { return(null); } SleepAndWaitComplete(webApp); mshtml.HTMLDocument Doc = (mshtml.HTMLDocument)webApp.Document; mshtml.IHTMLElementCollection eles = default(mshtml.IHTMLElementCollection); if (fraName == "") { eles = Doc.getElementsByTagName(tagName); } else { mshtml.HTMLWindow2 fra = GetFrameWait(ref webApp, fraName); Doc = (mshtml.HTMLDocument)fra.document; eles = Doc.getElementsByTagName(tagName); } SleepAndWaitComplete(webApp); foreach (mshtml.IHTMLElement ele in eles) { try { if (keyName == "innertext") { if (ele.innerText == keyTxt) { return(ele); } } else { String myKey; myKey = Convert.ToString(ele.getAttribute(keyName)); if (myKey.ToString() == keyTxt) { return(ele); } } } catch (Exception) { } } return(null); }
//Get Element public mshtml.IHTMLElement GetElementBy(ref SHDocVw.InternetExplorerMedium webApp, string fraName, string tagName, string keyName, string keyTxt) { SleepAndWaitComplete(webApp); mshtml.IHTMLElement tmpHTMLELE; tmpHTMLELE = null; try { while (ReferenceEquals(tmpHTMLELE, null)) { tmpHTMLELE = GetElementByDo(ref webApp, fraName, tagName, keyName, keyTxt); System.Windows.Forms.Application.DoEvents(); Sleep5(1); } return(tmpHTMLELE); //return GetElementByDo(ref webApp, fraName, tagName, keyName, keyTxt); } catch (Exception) { return(GetElementByDo(ref webApp, fraName, tagName, keyName, keyTxt)); } }
/// <summary> /// Start 準備 /// 1.Close Ie /// 2.Init BackgroundWorker /// 3.Init Timer /// </summary> /// <remarks></remarks> private void StartAllJunbi() { CloseIE(); re: try { Ie = null; } catch (Exception) { System.Threading.Thread.Sleep(2000); goto re; } Ie = new SHDocVw.InternetExplorerMedium(); if (ReferenceEquals(BackgroundWorker, null)) { BackgroundWorker = new BackgroundWorker(); BackgroundWorker.DoWork += BackgroundWorker_DoWork; BackgroundWorker.RunWorkerAsync(); } else { if (!BackgroundWorker.IsBusy) { BackgroundWorker.RunWorkerAsync(); } else { BackgroundWorker.Dispose(); BackgroundWorker = new BackgroundWorker(); BackgroundWorker.DoWork += BackgroundWorker_DoWork; BackgroundWorker.RunWorkerAsync(); } } Timer1.Stop(); Timer1.Start(); pb1.Value = 0; pb2.Value = 0; }
//Sleep And Wait IE Complete public void SleepAndWaitComplete(SHDocVw.InternetExplorerMedium webApp, int tmOut = 100) { Sleep5(100); for (int i = 0; i <= 10; i++) { while (!(webApp.ReadyState == SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE && !webApp.Busy)) { System.Windows.Forms.Application.DoEvents(); Sleep5(System.Convert.ToInt32((double)tmOut / 10)); i = 0; } while (!(((mshtml.HTMLDocument)webApp.Document).readyState.ToLower() == "complete")) { System.Windows.Forms.Application.DoEvents(); Sleep5(System.Convert.ToInt32((double)tmOut / 10)); i = 0; } try { mshtml.HTMLDocument Doc = (mshtml.HTMLDocument)webApp.Document; int length = System.Convert.ToInt32(Doc.frames.length); mshtml.FramesCollection frames = Doc.frames; for (int j = 0; j <= length - 1; j++) { mshtml.HTMLWindow2 frm = (mshtml.HTMLWindow2)(frames.item(j)); while (!(frm.document.readyState.ToLower() == "complete")) { System.Windows.Forms.Application.DoEvents(); Sleep5(1); } } } catch (Exception) { } } }
//Step 2 (WHILE) public void DoStep2_Sinki(string 事業所, string 得意先, string 店, string 現場名, string 備考, string 日付連番, string fl) { //POPUP 画面内容入力 string folder_Hattyuu = Com.GetAppSetting("Folder_Hattyuu"); Com.Sleep5(500); Pub_Com.SleepAndWaitComplete(Ie); Pub_Com.AddMsg(" 事業所:" + 事業所); Pub_Com.AddMsg(" 得意先:" + 得意先); Pub_Com.AddMsg(" 下店:" + 店); Pub_Com.AddMsg(" 備考:" + 備考); Pub_Com.AddMsg(" 現場名:" + 現場名); Pub_Com.SleepAndWaitComplete(Ie); mshtml.HTMLWindow2 fra = Pub_Com.GetFrameWait(ref Ie, "fraMitBody"); Pub_Com.GetElement(fra, "input", "name", "strJgyCdText").innerText = 事業所; Pub_Com.GetElement(fra, "input", "name", "strTokMeiText").innerText = 得意先; Pub_Com.GetElement(fra, "input", "name", "strOtdMeiText").innerText = 店; Pub_Com.GetElement(fra, "input", "name", "strBikouMei").innerText = 備考; Pub_Com.GetElement(fra, "input", "name", "strGenbaMei").innerText = 現場名; Pub_Com.GetElement(fra, "select", "name", "aryKijyunSyouhinBunrui").setAttribute("value", "A0001,サッシ,L90000"); Pub_Com.AddMsg(" 納材店なしで内訳入力へ CLICK"); Pub_Com.GetElement(fra, "input", "name", "btnUtiwake").click(); AddProBar(lv2); Com.Sleep5(500); Pub_Com.SleepAndWaitComplete(Ie); //見積内訳入力 try { mshtml.IHTMLElement ele1 = Pub_Com.GetElementBy(ref Ie, "fraMitBody", "DIV", "classname", "ttl"); if (ele1.innerText != "見積内訳入力") { DoStep2_Sinki(事業所, 得意先, 店, 現場名, 備考, 日付連番, fl); return; } Pub_Com.AddMsg(" 見積内訳入力 CSV取込 CLICK"); Pub_Com.GetElementBy(ref Ie, "fraMitBody", "input", "value", "CSV取込").click(); } catch (Exception) { DoStep2_Sinki(事業所, 得意先, 店, 現場名, 備考, 日付連番, fl); return; } AddProBar(lv2); //2 Pub_Com.SleepAndWaitComplete(Ie); Com.Sleep5(500); Pub_Com.AddMsg(" 見積内訳入力 CSV取込 参 照 CLICK"); SHDocVw.InternetExplorerMedium fra1 = GetPopupWindow("OnSite", "fileYomikomiSiji.asp"); while (ReferenceEquals(fra1, null)) { fra1 = GetPopupWindow("OnSite", "fileYomikomiSiji.asp"); } Pub_Com.GetElementBy(ref fra1, "", "input", "value", "参 照").click(); Com.Sleep5(1500); try { while (Pub_Com.GetElementBy(ref fra1, "", "input", "name", "strFilename").getAttribute("value").ToString() == "") { Com.Sleep5(1); } } catch (Exception) { } Com.Sleep5(1500); AddProBar(lv2); //3 Pub_Com.AddMsg(" 見積内訳入力 CSV取込 取 込 CLICK"); SHDocVw.InternetExplorerMedium popupPage; popupPage = GetPopupWindow("OnSite", "fileYomikomiSiji.asp"); Pub_Com.GetElementBy(ref popupPage, "", "input", "value", "取 込").click(); Com.Sleep5(1000); AddProBar(lv2); //4 Pub_Com.SleepAndWaitComplete(Ie); Pub_Com.AddMsg(" 商品コード複数入力 次 へ CLICK"); Pub_Com.GetElementBy(ref Ie, "fraMitBody", "input", "value", "次 へ").click(); Pub_Com.SleepAndWaitComplete(Ie); Pub_Com.AddMsg(" 商品コード複数入力 次 へ CLICK"); Pub_Com.GetElementBy(ref Ie, "fraMitBody", "input", "value", "次 へ").click(); Pub_Com.SleepAndWaitComplete(Ie); Pub_Com.AddMsg(" 商品コード複数入力 次 へ CLICK"); Pub_Com.GetElementBy(ref Ie, "fraMitBody", "input", "value", "次 へ").click(); AddProBar(lv2); //5 Pub_Com.SleepAndWaitComplete(Ie); Pub_Com.SleepAndWaitComplete(Ie); Pub_Com.SleepAndWaitComplete(Ie); //寸法入力 if (ReferenceEquals(Pub_Com.GetElementByDo(ref Ie, "fraMitBody", "input", "value", "見積内訳入力へ"), null)) { Pub_Com.SleepAndWaitComplete(Ie); Pub_Com.AddMsg(" 寸法入力 次 へ CLICK"); Pub_Com.GetElementBy(ref Ie, "fraMitBody", "input", "value", "次 へ").click(); Pub_Com.SleepAndWaitComplete(Ie); Pub_Com.SleepAndWaitComplete(Ie); Pub_Com.AddMsg(" 寸法入力 次 へ CLICK"); Pub_Com.GetElementBy(ref Ie, "fraMitBody", "input", "value", "次 へ").click(); Pub_Com.SleepAndWaitComplete(Ie); Pub_Com.SleepAndWaitComplete(Ie); Pub_Com.AddMsg(" 寸法入力 次 へ CLICK"); Pub_Com.GetElementBy(ref Ie, "fraMitBody", "input", "value", "次 へ").click(); Pub_Com.SleepAndWaitComplete(Ie); Pub_Com.SleepAndWaitComplete(Ie); } AddProBar(lv2); //6 Pub_Com.AddMsg(" 単価入力 見積内訳入力へ CLICK"); Pub_Com.GetElementBy(ref Ie, "fraMitBody", "input", "value", "見積内訳入力へ").click(); Pub_Com.SleepAndWaitComplete(Ie); AddProBar(lv2); //7 mshtml.IHTMLElement ele = Pub_Com.GetElementBy(ref Ie, "fraMitBody", "DIV", "classname", "ttl"); string kekka = System.Convert.ToString(ele.innerText); AddProBar(lv2); //8 Pub_Com.AddMsg(" 新規見積 CLICK"); Pub_Com.GetElementBy(ref Ie, "fraMitMenu", "a", "innertext", "[新規見積]").click(); Pub_Com.SleepAndWaitComplete(Ie); Pub_Com.SleepAndWaitComplete(Ie); AddProBar(lv2); //9 }
//Step 1 新規見積もり public void DoStep1_PoupuSentaku(string 事業所, string 得意先, string 店, string 現場名, string 備考, string 日付連番, string fl) { try { Pub_Com.AddMsg("見積検索 POPUP"); SHDocVw.InternetExplorerMedium cIe = GetPopupWindow("OnSite", "mitSearch.asp"); while (ReferenceEquals(cIe, null)) { Com.Sleep5(100); cIe = GetPopupWindow("OnSite", "mitSearch.asp"); } Pub_Com.SleepAndWaitComplete(cIe); Pub_Com.GetElementBy(ref cIe, "", "input", "name", "strGenbaMei").innerText = 現場名; Pub_Com.GetElementBy(ref cIe, "", "input", "name", "strUriJgy").click(); Pub_Com.SleepAndWaitComplete(cIe); AddProBar(lv2); //12 Pub_Com.AddMsg("事業所検索 POPUP"); SHDocVw.InternetExplorerMedium cIe2 = GetPopupWindow("OnSite", "jgyKensaku.asp"); while (ReferenceEquals(cIe2, null)) { Com.Sleep5(100); cIe2 = GetPopupWindow("OnSite", "jgyKensaku.asp"); } Pub_Com.SleepAndWaitComplete(cIe2); Pub_Com.GetElementBy(ref cIe2, "", "input", "name", "strJgyCd").innerText = 事業所; Pub_Com.GetElementBy(ref cIe2, "", "input", "value", "検 索").click(); Com.Sleep5(1000); AddProBar(lv2); //13 Pub_Com.SleepAndWaitComplete(cIe); Pub_Com.GetElementBy(ref cIe, "", "input", "value", "検 索").click(); Pub_Com.SleepAndWaitComplete(Ie); Pub_Com.SleepAndWaitComplete(Ie); Pub_Com.SleepAndWaitComplete(Ie); Com.Sleep5(1000); AddProBar(lv2); //14 //50件以上の場合 try { Com.Sleep5(1000); mshtml.HTMLDocument Doc = default(mshtml.HTMLDocument); mshtml.IHTMLElementCollection eles = default(mshtml.IHTMLElementCollection); Doc = (mshtml.HTMLDocument)Ie.Document; mshtml.HTMLWindow2 fra = Pub_Com.GetFrameWait(ref Ie, "fraHyou"); Doc = (mshtml.HTMLDocument)fra.document; eles = Doc.getElementsByTagName("input"); foreach (mshtml.IHTMLElement ele in eles) { try { if (ele.getAttribute("value").ToString() == "継 続") { ele.click(); Pub_Com.SleepAndWaitComplete(Ie); goto endOfForLoop; } } catch (Exception) { } } endOfForLoop: 1.GetHashCode(); //VBConversions note: C# requires an executable line here, so a dummy line was added. } catch (Exception) { } AddProBar(lv2); //15 return; } catch (Exception) { //DoStep1_SinkiMitumori(事業所, 得意先, 下店, 現場名, 備考, 日付連番, fl) return; } }
//印刷情報を取得する public bool GetFcwInfo(SHDocVw.InternetExplorerMedium cIe, string flName) { try { string Action; string fcw_formfile = ""; string fcw_datafile = ""; string url1 = ""; string url2 = ""; url2 = ""; mshtml.HTMLFormElement form; mshtml.HTMLDocument doc; doc = (mshtml.HTMLDocument)cIe.Document; mshtml.HTMLDocument tmdoc; tmdoc = (mshtml.HTMLDocument)doc.body.document; form = (mshtml.HTMLFormElement)tmdoc.forms.item(0); mshtml.IHTMLElementCollection forms; forms = (mshtml.IHTMLElementCollection)tmdoc.forms; form = (mshtml.HTMLFormElement)forms.item(null, 0); Action = System.Convert.ToString(form.action); if (string.IsNullOrEmpty(Action)) { return(false); } mshtml.HTMLInputElement hid_fcw_formfile = default(mshtml.HTMLInputElement); hid_fcw_formfile = (mshtml.HTMLInputElement)(((mshtml.HTMLDocument)form.document).getElementsByName("fcw-formfile").item(0)); fcw_formfile = System.Convert.ToString(hid_fcw_formfile.value); mshtml.HTMLInputElement hid_fcw_datafile = default(mshtml.HTMLInputElement); hid_fcw_datafile = (mshtml.HTMLInputElement)(((mshtml.HTMLDocument)form.document).getElementsByName("fcw-datafile").item(0)); fcw_datafile = System.Convert.ToString(hid_fcw_datafile.value); url1 = form.action + "?fcw-driver=FCPC&fcw-formdownload=yes&fcw-newsession=yes&fcw-destination=client&fcw-overlay=3&fcw-endsession=yes&fcw-formfile=" + fcw_formfile + "&fcw-datafile=" + fcw_datafile; //Print 画面の情報取得 object bodyStr; string bodyTxt = ""; MSXML2.XMLHTTP Retrieval = new MSXML2.XMLHTTP(); Retrieval.open("Get", url1, false, "", ""); Retrieval.send(); bodyStr = Retrieval.responseBody; bodyTxt = System.Convert.ToString(Retrieval.responseText); Retrieval = null; //帳票のURL取得 System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex("src=\"(?<src>[^\"]*)\""); System.Text.RegularExpressions.MatchCollection mc = reg.Matches(bodyTxt); foreach (System.Text.RegularExpressions.Match m in mc) { url2 = System.Convert.ToString(m.Value); } url2 = System.Convert.ToString(url2.Replace("src", "").Replace("\"", "").Replace("=http", "http")); reg = null; if (System.IO.File.Exists(flName)) { FileSystem.Rename(flName.Replace(".csv", ".pdf"), flName.Replace(".csv", "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".bk.pdf")); } //帳票作成 GetRemoteFiels(url2, flName.Replace(".csv", ".pdf")); return(true); } catch (Exception) { return(false); } }
//実行 MAIN public void DoAll() { //SavePdf("aaaa.csv") Pub_Com = new Com("納期指定発注" + DateTime.Now.ToString("yyyyMMddHHmmss")); if (Pub_Com.file_list_Nouki.Count == 0) { ProBar = 100; return; } lv1 = System.Convert.ToDecimal(90 / Pub_Com.file_list_Nouki.Count); lv2 = lv1 / 15; //一回目 bool firsOpenKbn = true; object authHeader = "Authorization: Basic " + Convert.ToBase64String(System.Text.UnicodeEncoding.UTF8.GetBytes(string.Format("{0}:{1}", Pub_Com.user, Pub_Com.password))) + "\\r\\n"; //*** OnSiteパスワード入力画面 Ie.Navigate(Pub_Com.url, null, null, null, authHeader); Ie.Silent = true; Ie.Visible = IeVisible; ProBar = 5; //***ログイン DoStep1_Login(); //CSV ファイルs 取込 ProBar = 10; for (int fileIdx = 0; fileIdx <= Pub_Com.file_list_Nouki.Count - 1; fileIdx++) { string csvFileName = System.Convert.ToString(Pub_Com.file_list_Nouki[fileIdx].ToString().Trim()); string[] csvNameSplitor = csvFileName.Split('-'); string 事業所 = csvNameSplitor[0]; string 得意先 = csvNameSplitor[1]; string 店 = csvNameSplitor[2]; string 現場名 = csvNameSplitor[3]; string 備考 = csvNameSplitor[4]; string 日付連番 = csvNameSplitor[5]; //一回目ではなく 実行 if (firsOpenKbn == false) { Pub_Com.GetElementBy(ref Ie, "fraHead", "input", "value", "絞込検索").click(); Pub_Com.SleepAndWaitComplete(Ie); } firsOpenKbn = false; AddProBar(lv2); //1 Pub_Com.AddMsg("取込:" + Pub_Com.file_list_Nouki[fileIdx].ToString().Trim()); //見積検索 Pub_Com.AddMsg("見積検索"); DoStep1_PoupuSentaku(事業所, 得意先, 店, 現場名, 備考, 日付連番, csvFileName); Pub_Com.SleepAndWaitComplete(Ie); AddProBar(lv2); //2 //納期日設定 if (!DoStep2_Set()) { continue; } Pub_Com.SleepAndWaitComplete(Ie); Pub_Com.SleepAndWaitComplete(Ie); Pub_Com.SleepAndWaitComplete(Ie); //該当データがありません NEXT mshtml.HTMLWindow2 fraTmp = Pub_Com.GetFrameByName(ref Ie, "fraHyou"); if (fraTmp != null) { if (fraTmp.document.body.innerText.IndexOf("該当データがありません") >= 0) { continue; } } //CSVファイル内容取込 string[] csvDataLines = System.IO.File.ReadAllLines(Pub_Com.folder_Nouki + csvFileName); string code = ""; string nouki = ""; AddProBar(lv2); //3 mshtml.HTMLWindow2 fra = Pub_Com.GetFrameWait(ref Ie, "fraMitBody"); mshtml.HTMLDocument Doc = (mshtml.HTMLDocument)fra.document; mshtml.IHTMLElementCollection eles = Doc.getElementsByTagName("input"); //Radio 明細Key mshtml.IHTMLElementCollection cbEles = Doc.getElementsByName("strMeisaiKey"); //指定納期 mshtml.IHTMLElementCollection nouhinDateEles = Doc.getElementsByName("strSiteiNouhinDate"); int csvIdx = 0; int sameCdSuu = 0; int gamenSameCdSuu = 0; //CSV LINES for (int csvLinesIdx = 0; csvLinesIdx <= csvDataLines.Length - 1; csvLinesIdx++) { if (!string.IsNullOrEmpty(csvDataLines[csvLinesIdx].Trim())) { //コード 納期 code = System.Convert.ToString(csvDataLines[csvLinesIdx].Split(',')[1].Trim()); nouki = System.Convert.ToString((System.Convert.ToDateTime(csvDataLines[csvLinesIdx].Split(',')[2].Trim())).ToString("yyyy/MM/dd")); sameCdSuu = 0; gamenSameCdSuu = 0; for (csvIdx = 0; csvIdx <= csvLinesIdx; csvIdx++) { if (csvDataLines[csvIdx].Split(',')[1].Trim() == code) { sameCdSuu++; } } for (int i = 0; i <= cbEles.length - 1; i++) { mshtml.IHTMLElement cb = (mshtml.IHTMLElement)(cbEles.item(i)); mshtml.IHTMLTableRow tr = (mshtml.IHTMLTableRow)cb.parentElement.parentElement; mshtml.HTMLTableCell td = (mshtml.HTMLTableCell)(tr.cells.item(1)); mshtml.IHTMLTable table = (mshtml.IHTMLTable)cb.parentElement.parentElement.parentElement.parentElement; bool isHaveDate = false; if (td.innerText == code) { gamenSameCdSuu++; if (sameCdSuu == gamenSameCdSuu) { mshtml.IHTMLSelectElement sel = (mshtml.IHTMLSelectElement)(nouhinDateEles.item(i)); for (int j = 0; j <= sel.length - 1; j++) { mshtml.IHTMLOptionElement opEle = (mshtml.IHTMLOptionElement)(sel.item(j)); if (opEle.value.IndexOf(nouki) > 0) { opEle.selected = true; isHaveDate = true; break; } } } else { continue; } if (!isHaveDate) { MessageBox.Show("コード:[" + code + "] 納品希望日:[" + nouki + "]がありません"); return; } } } } } AddProBar(lv2); //4 Pub_Com.GetElementBy(ref Ie, "fraMitBody", "select", "name", "strBukkenKbn").setAttribute("value", "01"); Pub_Com.GetElementBy(ref Ie, "fraMitBody", "input", "value", "発 注").click(); Pub_Com.SleepAndWaitComplete(Ie); Pub_Com.SleepAndWaitComplete(Ie); Pub_Com.SleepAndWaitComplete(Ie); AddProBar(lv2); //5 Pub_Com.GetElementBy(ref Ie, "fraMitBody", "input", "value", "発注結果照会へ").click(); Pub_Com.SleepAndWaitComplete(Ie); AddProBar(lv2); //6 //PDF 印刷 if (insatu) { SHDocVw.InternetExplorerMedium childIe = default(SHDocVw.InternetExplorerMedium); int RebackKaisu = -1; Reback: RebackKaisu++; Com.Sleep5(1000); //前回印刷画面 Close ClosePrintPage(); Pub_Com.GetElementBy(ref Ie, "fraMitBody", "input", "value", "結果印刷").click(); int wait_print; wait_print = int.Parse(Com.GetAppSetting("wait_print")); AutoResetEvent myEvent = new AutoResetEvent(false); myEvent.WaitOne(wait_print * 1000); myEvent.Close(); try { //印刷画面取得する childIe = GetPrintPage(); } catch (Exception) { } Com.Sleep5(1000); //IE エラー判定する if (GetErrCon() == false) { Com.Sleep5(1000); if (RebackKaisu <= 1) { goto Reback; } else { if (MessageBox.Show("帳票Download エラーしました、終了ですか?", "Confirm Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { System.Environment.Exit(0); } } } string flName = Pub_Com.pdfPath + csvFileName; try { bool rtv = GetFcwInfo(childIe, flName); ClosePrintPage(); if (rtv == false) { if (RebackKaisu <= 1) { goto Reback; } else { if (MessageBox.Show("帳票Download エラーしました、終了ですか?", "Confirm Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { System.Environment.Exit(0); } } } } catch (Exception) { ClosePrintPage(); if (RebackKaisu <= 1) { goto Reback; } else { if (MessageBox.Show("帳票Download エラーしました、終了ですか?", "Confirm Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { System.Environment.Exit(0); } } } } AddProBar(lv2); //10 Pub_Com.AddMsg("移動CSV:" + csvFileName + "→" + Pub_Com.folder_Nouki_kanryou); Com.MoveFile(Pub_Com.folder_Nouki + csvFileName, Pub_Com.folder_Nouki_kanryou + csvFileName); AddProBar(lv2); //11 Pub_Com.GetElementBy(ref Ie, "fraMitMenu", "a", "innertext", "[見積一覧を再表示]").click(); Pub_Com.SleepAndWaitComplete(Ie); } ProBar = 100; }