| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;
- using System.IO;
- using System.Globalization;
- namespace Core.StlMes.Client.PlnSaleOrd
- {
- public partial class FrmReqRollMonth : FrmBase
- {
- public FrmReqRollMonth()
- {
- InitializeComponent();
- }
- private void FrmReqRollMonth_Load(object sender, EventArgs e)
- {
- ReadLog();
- string rollMonth = this.ultraDateTimeRollMonth.DateTime.ToString("yyyy-MM");
- string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPlnproduceSort.cpt&op=view&dateRollMonth=" + rollMonth;
- //string url = "http://localhost:8075/webroot/decision/view/report?viewlet=RepPlnproduceSort.cpt&op=view&dateRollMonth=" + rollMonth;
- this.webBrowser1.Url = new Uri(url);
- this.webBrowser1.ScriptErrorsSuppressed = true;//屏蔽脚本错误
- url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=ReqPlnPrdcls.cpt&op=view&dateRollMonth=" + rollMonth;
- //url = "http://localhost:8075/webroot/decision/view/report?viewlet=ReqPlnPrdcls.cpt&op=view&dateRollMonth=" + rollMonth;
- this.webBrowser2.Url = new Uri(url);
- this.webBrowser2.ScriptErrorsSuppressed = true;//屏蔽脚本错误
- url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=ReqPlnOutbilletfl.cpt&op=view&dateRollMonth=" + rollMonth;
- //url = "http://localhost:8075/webroot/decision/view/report?viewlet=ReqPlnOutbilletfl.cpt&op=view&dateRollMonth=" + rollMonth;
- this.webBrowser3.Url = new Uri(url);
- this.webBrowser3.ScriptErrorsSuppressed = true;//屏蔽脚本错误
- }
- /// <summary>
- /// 重写基类toolBar方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Close":
- this.Close();
- break;
- }
- }
- private void ultraButtonQuery_Click(object sender, EventArgs e)
- {
- string rollMonth = this.ultraDateTimeRollMonth.DateTime.ToString("yyyy-MM");
- string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPlnproduceSort.cpt&op=view&dateRollMonth=" + rollMonth;
- //string url = "http://localhost:8075/webroot/decision/view/report?viewlet=RepPlnproduceSort.cpt&op=view&dateRollMonth=" + rollMonth;
- this.webBrowser1.Url = new Uri(url);
- url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=ReqPlnPrdcls.cpt&op=view&dateRollMonth=" + rollMonth;
- //url = "http://localhost:8075/webroot/decision/view/report?viewlet=ReqPlnPrdcls.cpt&op=view&dateRollMonth=" + rollMonth;
- this.webBrowser2.Url = new Uri(url);
- url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=ReqPlnOutbilletfl.cpt&op=view&dateRollMonth=" + rollMonth;
- //url = "http://localhost:8075/webroot/decision/view/report?viewlet=ReqPlnOutbilletfl.cpt&op=view&dateRollMonth=" + rollMonth;
- this.webBrowser3.Url = new Uri(url);
- WriteLog(rollMonth);
- }
- /// <summary>
- /// 写入查询月份
- /// </summary>
- /// <param name="rollMonth">月份</param>
- private void WriteLog(string rollMonth)
- {
- string path = System.Windows.Forms.Application.StartupPath + "\\Tmp";
- string tempText = path + "\\RollMonth.txt";
- string w = rollMonth;
- if (!Directory.Exists(path))//检查目录是否存在
- {
- Directory.CreateDirectory(path);
- }
- if (!File.Exists(tempText))//检察文件是否存在
- {
- FileStream fs = new FileStream(tempText, FileMode.Create, FileAccess.Write);//创建写入文件s
- StreamWriter sw = new StreamWriter(fs);
- sw.Write(w);
- sw.Close();
- fs.Close();
- }
- else
- {
- FileStream fs = new FileStream(tempText, FileMode.Open, FileAccess.Write);
- StreamWriter sw = new StreamWriter(fs);
- fs.Seek(0, SeekOrigin.Begin);
- fs.SetLength(0); //清空txt文件
- sw.Write(w);
- sw.Close();
- fs.Close();
- }
- }
- /// <summary>
- /// 读取
- /// </summary>
- /// <returns></returns>
- private void ReadLog()
- {
- DateTime date = new DateTime();
- string path = System.Windows.Forms.Application.StartupPath + "\\Tmp";
- string tempText = path + "\\RollMonth.txt";
- if (!File.Exists(tempText))//检察文件是否存在
- {
- this.ultraDateTimeRollMonth.DateTime = DateTime.Now;
- return;
- }
- string rollMonth = System.IO.File.ReadAllText(tempText);
- if (!DateTime.TryParseExact(rollMonth, "yyyy-MM", null, DateTimeStyles.None, out date))
- {
- this.ultraDateTimeRollMonth.DateTime = DateTime.Now;
- }
- else
- {
- this.ultraDateTimeRollMonth.DateTime = date;
- }
- }
- }
- }
|