123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047 |
- using PaintDotNet;
- using PaintDotNet.Base.CommTool;
- using PaintDotNet.Base.Functionodel;
- using PaintDotNet.Base.SettingModel;
- using PaintDotNet.CustomControl;
- using PaintDotNet.DbOpreate.DbBll;
- using PaintDotNet.DbOpreate.DbModel;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using Newtonsoft.Json;
- using static PaintDotNet.Base.Functionodel.AnalyzeSettingModel;
- namespace Metis.AutoAnalysis
- {
- public partial class AutoAnalysisReportDialog : PdnBaseForm
- {
- #region 控件
- private GroupBox groupBox1;
- private Button button2;
- private Button button1;
- private GroupBox groupBox2;
- private ComboBox comboBox1;
- private Label label3;
- private Label label2;
- private Label label1;
- private GroupBox groupBox3;
- private GroupBox groupBox4;
- private Button button3;
- private TextBox textBox1;
- private Label label6;
- private Label label5;
- private Label label4;
- private TextBox txtCustomerName;
- private Label label8;
- private Label label7;
- private DateTimePicker dtpReceiveDate;
- private Button button5;
- #endregion
- /// <summary>
- /// 数据库对应字段
- /// </summary>
- private string _languageName;
- /// <summary>
- /// 数据库对应list
- /// </summary>
- private List<mic_template_infos> _infosList;
- /// <summary>
- /// 功能路径名称,因需递归作为全局对象
- /// </summary>
- private string functionPathMsg;
- /// <summary>
- /// 分类名称,主要供书签使用
- /// </summary>
- private string analyzeClassify;
- /// <summary>
- /// 调用当前窗口的对象
- /// </summary>
- private PdnBaseForm pdnBaseForm;
- /// <summary>
- /// 在打开窗体时辅助判断是否存在报告模板文件
- /// </summary>
- public bool hasModule = false;
- /// <summary>
- /// xml对应文件路径
- /// </summary>
- private string m_filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\" + "AutoAnalyzeSavedModel.xml";
- /// <summary>
- /// xml对象
- /// </summary>
- private AutoAnalyzeSavedModel analyzeSavedModel;
- public bool AutoExportFlag { get; set; }
- /// <summary>
- /// 当前分析分类的数据
- /// </summary>
- private AutoAnalyzeSavedModel.ModelItem analyzeModel;
- private TextBox txtSampleName;
- private Label label10;
- private TextBox txtTelephone;
- private Label label9;
- private TextBox txtSampleDescription;
- private Label label11;
- private TextBox txtCheckEnvironment;
- private Label label18;
- private TextBox txtCheckRegion;
- private Label label17;
- private TextBox txtReportNumber;
- private Label label16;
- private DateTimePicker dtpReportDate;
- private Label label15;
- private DateTimePicker dtpCheckDate;
- private Label label14;
- private TextBox txtMethodStandard;
- private Label label13;
- private TextBox txtCheckItem;
- private Label label12;
- private Timer tmrAutoExport;
- private IContainer components;
- private List<string> _resultList;
- public AutoAnalysisReportDialog()
- {
- InitializeComponent();
- }
- public AutoAnalysisReportDialog(PdnBaseForm form, string languageName, List<string> jsonResultList)
- {
- _resultList = jsonResultList;
- this._languageName = languageName;
- this.pdnBaseForm = form;
- _infosList = mic_template_infos_BLL.FindAll();//查询出所有模板分类对象
- InitializeComponent();
- InitializeLanguageText();
- InitOtherInfo();
- InitLastTimeInfo();
- }
- #region 初始化
- private void InitializeLanguageText()
- {
- this.button5.Text = PdnResources.GetString("Menu.Configurehebookmark.Text");
- this.label3.Text = PdnResources.GetString("Menu.Pleaseselectthetemplateyoucanuse.Text") + ":";
- this.label2.Text = PdnResources.GetString("Menu.nothing.Text");
- this.label1.Text = PdnResources.GetString("Menu.Thefunctionpath.Text") + ":";
- this.groupBox3.Text = PdnResources.GetString("Menu.Itemstoragepathselection.Text");
- this.label6.Text = PdnResources.GetString("Menu.nothing.Text");
- this.label5.Text = PdnResources.GetString("Menu.Thespecificpath.Text") + ":";
- this.label4.Text = PdnResources.GetString("Menu.Storagepath.Text") + ":";
- this.groupBox4.Text = PdnResources.GetString("Menu.thebasicinformationofproject.text");
- //this.label8.Text = PdnResources.GetString("Menu.projectnumber.text") + ":";
- //this.label7.Text = PdnResources.GetString("Menu.Ratingdate.text") + ":";
- //this.groupBox5.Text = PdnResources.GetString("Menu.Ratingdate.text");
- //this.label12.Text = PdnResources.GetString("Menu.Inspectiondate.text") + ":";
- //this.label11.Text = PdnResources.GetString("Menu.Contactperson.text") + ":";
- //this.label10.Text = PdnResources.GetString("Menu.inspectiondepartment.text") + ":";
- //this.label9.Text = PdnResources.GetString("Menu.Sender.text") + ":";
- //this.groupBox6.Text = PdnResources.GetString("Menu.other.text");
- //this.label14.Text = PdnResources.GetString("Menu.name.text") + ":";
- //this.label13.Text = PdnResources.GetString("Menu.content.text") + ":";
- //this.button4.Text = PdnResources.GetString("Menu.Addto.text");
- this.Text = PdnResources.GetString("Menu.Analysisofsetting.Text");
- this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
- this.button2.Text = PdnResources.GetString("Menu.File.Save.Text");
- this.button1.Text = PdnResources.GetString("Menu.File.Close.Text");
- this.groupBox2.Text = PdnResources.GetString("Menu.Reporttemplateselection.Text");
- }
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.button2 = new System.Windows.Forms.Button();
- this.button1 = new System.Windows.Forms.Button();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.button5 = new System.Windows.Forms.Button();
- this.comboBox1 = new System.Windows.Forms.ComboBox();
- this.label3 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
- this.label1 = new System.Windows.Forms.Label();
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.button3 = new System.Windows.Forms.Button();
- this.textBox1 = new System.Windows.Forms.TextBox();
- this.label6 = new System.Windows.Forms.Label();
- this.label5 = new System.Windows.Forms.Label();
- this.label4 = new System.Windows.Forms.Label();
- this.groupBox4 = new System.Windows.Forms.GroupBox();
- this.txtCheckEnvironment = new System.Windows.Forms.TextBox();
- this.label18 = new System.Windows.Forms.Label();
- this.txtCheckRegion = new System.Windows.Forms.TextBox();
- this.label17 = new System.Windows.Forms.Label();
- this.txtReportNumber = new System.Windows.Forms.TextBox();
- this.label16 = new System.Windows.Forms.Label();
- this.dtpReportDate = new System.Windows.Forms.DateTimePicker();
- this.label15 = new System.Windows.Forms.Label();
- this.dtpCheckDate = new System.Windows.Forms.DateTimePicker();
- this.label14 = new System.Windows.Forms.Label();
- this.txtMethodStandard = new System.Windows.Forms.TextBox();
- this.label13 = new System.Windows.Forms.Label();
- this.txtCheckItem = new System.Windows.Forms.TextBox();
- this.label12 = new System.Windows.Forms.Label();
- this.txtSampleDescription = new System.Windows.Forms.TextBox();
- this.label11 = new System.Windows.Forms.Label();
- this.txtSampleName = new System.Windows.Forms.TextBox();
- this.label10 = new System.Windows.Forms.Label();
- this.txtTelephone = new System.Windows.Forms.TextBox();
- this.label9 = new System.Windows.Forms.Label();
- this.dtpReceiveDate = new System.Windows.Forms.DateTimePicker();
- this.txtCustomerName = new System.Windows.Forms.TextBox();
- this.label8 = new System.Windows.Forms.Label();
- this.label7 = new System.Windows.Forms.Label();
- this.tmrAutoExport = new System.Windows.Forms.Timer(this.components);
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.groupBox3.SuspendLayout();
- this.groupBox4.SuspendLayout();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.button2);
- this.groupBox1.Controls.Add(this.button1);
- this.groupBox1.Location = new System.Drawing.Point(15, 5);
- this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.groupBox1.Size = new System.Drawing.Size(678, 61);
- this.groupBox1.TabIndex = 0;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "操作";
- //
- // button2
- //
- this.button2.BackColor = System.Drawing.SystemColors.Control;
- this.button2.Location = new System.Drawing.Point(564, 15);
- this.button2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(95, 38);
- this.button2.TabIndex = 0;
- this.button2.Text = "生成报告";
- this.button2.UseVisualStyleBackColor = false;
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // button1
- //
- this.button1.BackColor = System.Drawing.SystemColors.Control;
- this.button1.Location = new System.Drawing.Point(444, 15);
- this.button1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(95, 38);
- this.button1.TabIndex = 0;
- this.button1.Text = "关闭";
- this.button1.UseVisualStyleBackColor = false;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // groupBox2
- //
- this.groupBox2.Controls.Add(this.button5);
- this.groupBox2.Controls.Add(this.comboBox1);
- this.groupBox2.Controls.Add(this.label3);
- this.groupBox2.Controls.Add(this.label2);
- this.groupBox2.Controls.Add(this.label1);
- this.groupBox2.Location = new System.Drawing.Point(15, 70);
- this.groupBox2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.groupBox2.Size = new System.Drawing.Size(678, 112);
- this.groupBox2.TabIndex = 1;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "报告模板选择";
- //
- // button5
- //
- this.button5.Location = new System.Drawing.Point(579, 79);
- this.button5.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.button5.Name = "button5";
- this.button5.Size = new System.Drawing.Size(91, 25);
- this.button5.TabIndex = 0;
- this.button5.Text = "配置书签";
- this.button5.UseVisualStyleBackColor = true;
- this.button5.Click += new System.EventHandler(this.button5_Click);
- //
- // comboBox1
- //
- this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.comboBox1.FormattingEnabled = true;
- this.comboBox1.Location = new System.Drawing.Point(182, 79);
- this.comboBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.comboBox1.Name = "comboBox1";
- this.comboBox1.Size = new System.Drawing.Size(393, 23);
- this.comboBox1.TabIndex = 3;
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label3.Location = new System.Drawing.Point(19, 85);
- this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(157, 15);
- this.label3.TabIndex = 2;
- this.label3.Text = "请选择可使用的模板:";
- //
- // label2
- //
- this.label2.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label2.Location = new System.Drawing.Point(204, 32);
- this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(466, 42);
- this.label2.TabIndex = 1;
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label1.Location = new System.Drawing.Point(19, 32);
- this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(82, 15);
- this.label1.TabIndex = 0;
- this.label1.Text = "功能路径:";
- //
- // groupBox3
- //
- this.groupBox3.Controls.Add(this.button3);
- this.groupBox3.Controls.Add(this.textBox1);
- this.groupBox3.Controls.Add(this.label6);
- this.groupBox3.Controls.Add(this.label5);
- this.groupBox3.Controls.Add(this.label4);
- this.groupBox3.Location = new System.Drawing.Point(15, 202);
- this.groupBox3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.groupBox3.Size = new System.Drawing.Size(678, 112);
- this.groupBox3.TabIndex = 1;
- this.groupBox3.TabStop = false;
- this.groupBox3.Text = "项目储存路径选择";
- //
- // button3
- //
- this.button3.BackColor = System.Drawing.SystemColors.Window;
- this.button3.Font = new System.Drawing.Font("宋体", 6F);
- this.button3.Location = new System.Drawing.Point(626, 42);
- this.button3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(36, 26);
- this.button3.TabIndex = 0;
- this.button3.Text = "...";
- this.button3.UseVisualStyleBackColor = false;
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // textBox1
- //
- this.textBox1.Location = new System.Drawing.Point(129, 42);
- this.textBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.textBox1.Name = "textBox1";
- this.textBox1.ReadOnly = true;
- this.textBox1.Size = new System.Drawing.Size(499, 25);
- this.textBox1.TabIndex = 4;
- //
- // label6
- //
- this.label6.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label6.Location = new System.Drawing.Point(116, 25);
- this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(542, 12);
- this.label6.TabIndex = 3;
- this.label6.Visible = false;
- //
- // label5
- //
- this.label5.AutoSize = true;
- this.label5.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label5.Location = new System.Drawing.Point(19, 50);
- this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(82, 15);
- this.label5.TabIndex = 2;
- this.label5.Text = "具体路径:";
- //
- // label4
- //
- this.label4.AutoSize = true;
- this.label4.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label4.Location = new System.Drawing.Point(19, 25);
- this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(82, 15);
- this.label4.TabIndex = 1;
- this.label4.Text = "储存路径:";
- this.label4.Visible = false;
- //
- // groupBox4
- //
- this.groupBox4.Controls.Add(this.txtCheckEnvironment);
- this.groupBox4.Controls.Add(this.label18);
- this.groupBox4.Controls.Add(this.txtCheckRegion);
- this.groupBox4.Controls.Add(this.label17);
- this.groupBox4.Controls.Add(this.txtReportNumber);
- this.groupBox4.Controls.Add(this.label16);
- this.groupBox4.Controls.Add(this.dtpReportDate);
- this.groupBox4.Controls.Add(this.label15);
- this.groupBox4.Controls.Add(this.dtpCheckDate);
- this.groupBox4.Controls.Add(this.label14);
- this.groupBox4.Controls.Add(this.txtMethodStandard);
- this.groupBox4.Controls.Add(this.label13);
- this.groupBox4.Controls.Add(this.txtCheckItem);
- this.groupBox4.Controls.Add(this.label12);
- this.groupBox4.Controls.Add(this.txtSampleDescription);
- this.groupBox4.Controls.Add(this.label11);
- this.groupBox4.Controls.Add(this.txtSampleName);
- this.groupBox4.Controls.Add(this.label10);
- this.groupBox4.Controls.Add(this.txtTelephone);
- this.groupBox4.Controls.Add(this.label9);
- this.groupBox4.Controls.Add(this.dtpReceiveDate);
- this.groupBox4.Controls.Add(this.txtCustomerName);
- this.groupBox4.Controls.Add(this.label8);
- this.groupBox4.Controls.Add(this.label7);
- this.groupBox4.Location = new System.Drawing.Point(15, 322);
- this.groupBox4.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.groupBox4.Name = "groupBox4";
- this.groupBox4.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.groupBox4.Size = new System.Drawing.Size(678, 295);
- this.groupBox4.TabIndex = 1;
- this.groupBox4.TabStop = false;
- this.groupBox4.Text = "项目基本信息";
- //
- // txtCheckEnvironment
- //
- this.txtCheckEnvironment.Location = new System.Drawing.Point(444, 238);
- this.txtCheckEnvironment.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.txtCheckEnvironment.Name = "txtCheckEnvironment";
- this.txtCheckEnvironment.Size = new System.Drawing.Size(205, 25);
- this.txtCheckEnvironment.TabIndex = 0;
- //
- // label18
- //
- this.label18.AutoSize = true;
- this.label18.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label18.Location = new System.Drawing.Point(356, 242);
- this.label18.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.label18.Name = "label18";
- this.label18.Size = new System.Drawing.Size(82, 15);
- this.label18.TabIndex = 25;
- this.label18.Text = "检测环境:";
- //
- // txtCheckRegion
- //
- this.txtCheckRegion.Location = new System.Drawing.Point(106, 236);
- this.txtCheckRegion.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.txtCheckRegion.Name = "txtCheckRegion";
- this.txtCheckRegion.Size = new System.Drawing.Size(205, 25);
- this.txtCheckRegion.TabIndex = 0;
- //
- // label17
- //
- this.label17.AutoSize = true;
- this.label17.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label17.Location = new System.Drawing.Point(19, 241);
- this.label17.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.label17.Name = "label17";
- this.label17.Size = new System.Drawing.Size(82, 15);
- this.label17.TabIndex = 23;
- this.label17.Text = "检测区域:";
- //
- // txtReportNumber
- //
- this.txtReportNumber.Location = new System.Drawing.Point(444, 196);
- this.txtReportNumber.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.txtReportNumber.Name = "txtReportNumber";
- this.txtReportNumber.Size = new System.Drawing.Size(205, 25);
- this.txtReportNumber.TabIndex = 0;
- //
- // label16
- //
- this.label16.AutoSize = true;
- this.label16.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label16.Location = new System.Drawing.Point(356, 201);
- this.label16.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.label16.Name = "label16";
- this.label16.Size = new System.Drawing.Size(82, 15);
- this.label16.TabIndex = 21;
- this.label16.Text = "报告编号:";
- //
- // dtpReportDate
- //
- this.dtpReportDate.Location = new System.Drawing.Point(106, 195);
- this.dtpReportDate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.dtpReportDate.Name = "dtpReportDate";
- this.dtpReportDate.Size = new System.Drawing.Size(205, 25);
- this.dtpReportDate.TabIndex = 0;
- //
- // label15
- //
- this.label15.AutoSize = true;
- this.label15.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label15.Location = new System.Drawing.Point(18, 200);
- this.label15.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.label15.Name = "label15";
- this.label15.Size = new System.Drawing.Size(82, 15);
- this.label15.TabIndex = 19;
- this.label15.Text = "报告日期:";
- //
- // dtpCheckDate
- //
- this.dtpCheckDate.Location = new System.Drawing.Point(444, 155);
- this.dtpCheckDate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.dtpCheckDate.Name = "dtpCheckDate";
- this.dtpCheckDate.Size = new System.Drawing.Size(205, 25);
- this.dtpCheckDate.TabIndex = 0;
- //
- // label14
- //
- this.label14.AutoSize = true;
- this.label14.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label14.Location = new System.Drawing.Point(355, 160);
- this.label14.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.label14.Name = "label14";
- this.label14.Size = new System.Drawing.Size(82, 15);
- this.label14.TabIndex = 17;
- this.label14.Text = "检测日期:";
- //
- // txtMethodStandard
- //
- this.txtMethodStandard.Location = new System.Drawing.Point(444, 114);
- this.txtMethodStandard.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.txtMethodStandard.Name = "txtMethodStandard";
- this.txtMethodStandard.Size = new System.Drawing.Size(205, 25);
- this.txtMethodStandard.TabIndex = 0;
- //
- // label13
- //
- this.label13.AutoSize = true;
- this.label13.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label13.Location = new System.Drawing.Point(356, 119);
- this.label13.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.label13.Name = "label13";
- this.label13.Size = new System.Drawing.Size(82, 15);
- this.label13.TabIndex = 15;
- this.label13.Text = "方法标准:";
- //
- // txtCheckItem
- //
- this.txtCheckItem.Location = new System.Drawing.Point(106, 112);
- this.txtCheckItem.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.txtCheckItem.Name = "txtCheckItem";
- this.txtCheckItem.Size = new System.Drawing.Size(205, 25);
- this.txtCheckItem.TabIndex = 0;
- //
- // label12
- //
- this.label12.AutoSize = true;
- this.label12.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label12.Location = new System.Drawing.Point(19, 118);
- this.label12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.label12.Name = "label12";
- this.label12.Size = new System.Drawing.Size(82, 15);
- this.label12.TabIndex = 13;
- this.label12.Text = "检测项目:";
- //
- // txtSampleDescription
- //
- this.txtSampleDescription.Location = new System.Drawing.Point(444, 72);
- this.txtSampleDescription.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.txtSampleDescription.Name = "txtSampleDescription";
- this.txtSampleDescription.Size = new System.Drawing.Size(205, 25);
- this.txtSampleDescription.TabIndex = 0;
- //
- // label11
- //
- this.label11.AutoSize = true;
- this.label11.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label11.Location = new System.Drawing.Point(356, 78);
- this.label11.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(82, 15);
- this.label11.TabIndex = 11;
- this.label11.Text = "样品说明:";
- //
- // txtSampleName
- //
- this.txtSampleName.Location = new System.Drawing.Point(106, 71);
- this.txtSampleName.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.txtSampleName.Name = "txtSampleName";
- this.txtSampleName.Size = new System.Drawing.Size(205, 25);
- this.txtSampleName.TabIndex = 0;
- //
- // label10
- //
- this.label10.AutoSize = true;
- this.label10.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label10.Location = new System.Drawing.Point(19, 76);
- this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(82, 15);
- this.label10.TabIndex = 9;
- this.label10.Text = "样品名称:";
- //
- // txtTelephone
- //
- this.txtTelephone.Location = new System.Drawing.Point(444, 31);
- this.txtTelephone.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.txtTelephone.Name = "txtTelephone";
- this.txtTelephone.Size = new System.Drawing.Size(205, 25);
- this.txtTelephone.TabIndex = 0;
- //
- // label9
- //
- this.label9.AutoSize = true;
- this.label9.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label9.Location = new System.Drawing.Point(356, 36);
- this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(82, 15);
- this.label9.TabIndex = 7;
- this.label9.Text = "联系方式:";
- //
- // dtpReceiveDate
- //
- this.dtpReceiveDate.Location = new System.Drawing.Point(106, 154);
- this.dtpReceiveDate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.dtpReceiveDate.Name = "dtpReceiveDate";
- this.dtpReceiveDate.Size = new System.Drawing.Size(205, 25);
- this.dtpReceiveDate.TabIndex = 0;
- //
- // txtCustomerName
- //
- this.txtCustomerName.Location = new System.Drawing.Point(106, 30);
- this.txtCustomerName.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.txtCustomerName.Name = "txtCustomerName";
- this.txtCustomerName.Size = new System.Drawing.Size(205, 25);
- this.txtCustomerName.TabIndex = 0;
- //
- // label8
- //
- this.label8.AutoSize = true;
- this.label8.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label8.Location = new System.Drawing.Point(19, 35);
- this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(82, 15);
- this.label8.TabIndex = 4;
- this.label8.Text = "客户名称:";
- //
- // label7
- //
- this.label7.AutoSize = true;
- this.label7.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label7.Location = new System.Drawing.Point(18, 159);
- this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(82, 15);
- this.label7.TabIndex = 3;
- this.label7.Text = "接收日期:";
- //
- // tmrAutoExport
- //
- this.tmrAutoExport.Tick += new System.EventHandler(this.tmrAutoExport_Tick);
- //
- // AutoAnalysisReportDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(120F, 120F);
- this.BackColor = System.Drawing.SystemColors.Control;
- this.ClientSize = new System.Drawing.Size(708, 655);
- this.Controls.Add(this.groupBox4);
- this.Controls.Add(this.groupBox3);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "AutoAnalysisReportDialog";
- this.Load += new System.EventHandler(this.AutoAnalysisReportDialog_Load);
- this.Controls.SetChildIndex(this.groupBox1, 0);
- this.Controls.SetChildIndex(this.groupBox2, 0);
- this.Controls.SetChildIndex(this.groupBox3, 0);
- this.Controls.SetChildIndex(this.groupBox4, 0);
- this.groupBox1.ResumeLayout(false);
- this.groupBox2.ResumeLayout(false);
- this.groupBox2.PerformLayout();
- this.groupBox3.ResumeLayout(false);
- this.groupBox3.PerformLayout();
- this.groupBox4.ResumeLayout(false);
- this.groupBox4.PerformLayout();
- this.ResumeLayout(false);
- }
- /// <summary>
- /// 初始化其他信息
- /// </summary>
- private void InitOtherInfo()
- {
- //设置功能路径名称
- if (this._languageName.Contains("Template.Manager"))
- functionPathMsg = PdnResources.GetString(this._languageName);
- else
- functionPathMsg = this._languageName;
- this.analyzeClassify = functionPathMsg;
- this.Text = this.analyzeClassify + PdnResources.GetString("Menu.Thereportisset.Text");
- getFullLanguagePath(this._languageName);
- this.label2.Text = functionPathMsg;
- //设置模板下拉菜单
- mic_template_infos infoModel = _infosList.Find(a => a.language_name == this._languageName);
- string filePath = Application.StartupPath + "\\ModuleManage" + infoModel.template_path.Replace('/', '\\');//获取文档路径
- if (Directory.Exists(filePath))
- {
- string[] fileNames = Directory.GetFiles(filePath);
- Dictionary<string, string> moduleInfo = new Dictionary<string, string>();
- for (int i = 0; i < fileNames.Count(); i++)
- {
- //编辑时产生的临时文件,不统计
- if (Path.GetFileName(fileNames[i]).Contains("~$"))
- continue;
- //判断是word文件
- if (FileOperationHelper.IsFileWordOrExcel(fileNames[i]) == 1)
- moduleInfo.Add(Path.GetFileNameWithoutExtension(fileNames[i]), fileNames[i]);
- }
- //绑定下拉菜单
- if (moduleInfo.Count > 0)
- {
- BindingSource bs = new BindingSource();
- bs.DataSource = moduleInfo;
- this.comboBox1.DataSource = bs;
- this.comboBox1.ValueMember = "Value";
- this.comboBox1.DisplayMember = "Key";
- hasModule = true;
- }
- else
- MessageBox.Show(PdnResources.GetString("Menu.Therearenoatefirst.text"));
- }
- else
- MessageBox.Show(PdnResources.GetString("Menu.Therearenoatefirst.text"));
- //设置存储路径
- string[] savePathArr = infoModel.template_path.Split('/');//拆分以获取路径根目录的名称
- ConfigModel configModel = Startup.instance.configModel;
- if (savePathArr[1].Equals("Conventional"))
- this.label6.Text = configModel.NormalOperation;
- else if (savePathArr[1].Equals("Universal"))
- this.label6.Text = configModel.GeneralAnalysis;
- else if (savePathArr[1].Equals("Dedicated"))
- this.label6.Text = configModel.DedicatedAnalysis;
- else
- //this.label6.Text = PdnResources.GetString("Menu.Pathacquisitionerror.Text");
- this.label6.Text = ""; //mod by songxk
- if (string.IsNullOrEmpty(this.label6.Text))
- this.label6.Text = PdnResources.GetString("Menu.Thestoragepathisnotset.Text");
- }
- /// <summary>
- /// 加载之前保存的信息
- /// </summary>
- private void InitLastTimeInfo()
- {
- if (this.hasModule && System.IO.File.Exists(m_filePath))
- {
- analyzeSavedModel = XmlSerializeHelper.DESerializer<AutoAnalyzeSavedModel>(FileOperationHelper.ReadStringFromFile(m_filePath, FileMode.Open));
- if (analyzeSavedModel.modelItems != null && analyzeSavedModel.modelItems.Count > 0)
- {
- analyzeModel = analyzeSavedModel.modelItems.Find(a => a.languageName == this._languageName);
- if (analyzeModel != null && analyzeModel.analyzeSettingModel != null)
- {
- if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.modulePath))
- this.comboBox1.SelectedValue = analyzeModel.analyzeSettingModel.modulePath;
- if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.savePath))
- this.textBox1.Text = analyzeModel.analyzeSettingModel.savePath;
- if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.customerName))
- this.txtCustomerName.Text = analyzeModel.analyzeSettingModel.customerName;
- if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.telephone))
- this.txtTelephone.Text = analyzeModel.analyzeSettingModel.telephone;
- if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.sampleName))
- this.txtSampleName.Text = analyzeModel.analyzeSettingModel.sampleName;
- if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.sampleDescription))
- this.txtSampleDescription.Text = analyzeModel.analyzeSettingModel.sampleDescription;
- if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.checkItem))
- this.txtCheckItem.Text = analyzeModel.analyzeSettingModel.checkItem;
- if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.methodStandard))
- this.txtMethodStandard.Text = analyzeModel.analyzeSettingModel.methodStandard;
- //if (analyzeModel.analyzeSettingModel.receiveDate != DateTime.MinValue)
- this.dtpReceiveDate.Value = DateTime.Now;
- //if (analyzeModel.analyzeSettingModel.checkDate != DateTime.MinValue)
- this.dtpCheckDate.Value = DateTime.Now;
- //if (analyzeModel.analyzeSettingModel.reportDate != DateTime.MinValue)
- this.dtpReceiveDate.Value = DateTime.Now;
- if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.reportNumber))
- this.txtReportNumber.Text = analyzeModel.analyzeSettingModel.reportNumber;
- if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.checkRegion))
- this.txtCheckRegion.Text = analyzeModel.analyzeSettingModel.checkRegion;
- if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.checkEnvironment))
- this.txtCheckEnvironment.Text = analyzeModel.analyzeSettingModel.checkEnvironment;
- }
- }
- }
- }
- #endregion
- /// <summary>
- /// 递归拼接功能路径的全称
- /// </summary>
- /// <param name="name"></param>
- private void getFullLanguagePath(string name)
- {//Template.Manager.item3.GrainSizeCutOff6394Method
- mic_template_infos infoModel = _infosList.Find(a => a.language_name == name);
- //如果有上级,查询出上级的name对应的实际名称,拼接到前面,然后继续递归
- if (infoModel!=null && infoModel.parent_id != 0)
- {
- string parentLanguageName = _infosList.Find(a => a.id == infoModel.parent_id).language_name;
- if (parentLanguageName.Contains("Template.Manager"))
- functionPathMsg = PdnResources.GetString(parentLanguageName) + "-" + functionPathMsg;
- else
- functionPathMsg = parentLanguageName + "-" + functionPathMsg;
- getFullLanguagePath(parentLanguageName);
- }
- }
- /// <summary>
- /// 路径选择
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button3_Click(object sender, EventArgs e)
- {
- FolderBrowserDialog dialog = new FolderBrowserDialog();
- //if (!this.label6.Text.Equals("路径获取错误") && !this.label6.Text.Equals("存储路径未设置") && !this.label6.Text.Equals("无"))
- //{
- // dialog.SelectedPath = this.label6.Text + "\\" + this.analyzeClassify + "\\";
- //}
- //else
- //{
- //
- //}
- dialog.SelectedPath = this.label6.Text;
- if (dialog.ShowDialog() == DialogResult.OK)
- {
- this.textBox1.Text = dialog.SelectedPath;
- }
- /*APIDialogs.CommonOpenFileDialog dialog = new APIDialogs.CommonOpenFileDialog();
- dialog.IsFolderPicker = true;
- dialog.EnsurePathExists = true;
- if(this.label6.Text.Equals("路径获取错误") || this.label6.Text.Equals("存储路径未设置") || this.label6.Text.Equals("无"))
- dialog.InitialDirectory = "C:\\";
- else
- dialog.InitialDirectory = this.label6.Text;
- if (dialog.ShowDialog() == APIDialogs.CommonFileDialogResult.Ok)
- {
- this.textBox1.Text = dialog.FileName;
- }*/
- }
- /// <summary>
- /// 关闭按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button1_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 生成按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button2_Click(object sender, EventArgs e)
- {
- RunExportReport();
- }
- private void RunExportReport()
- {
- if (string.IsNullOrEmpty(this.textBox1.Text))
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectaspecificstoragepath.text"));
- return;
- }
- if (this.comboBox1.SelectedValue == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Therearenorecannotbesaved.text") + "!");
- return;
- }
- AutoAnalyzeSettingModel model = new AutoAnalyzeSettingModel();
- model.modulePath = this.comboBox1.SelectedValue.ToString();
- model.savePath = this.textBox1.Text;
- model.customerName = this.txtCustomerName.Text;
- model.telephone = this.txtTelephone.Text;
- model.sampleName = this.txtSampleName.Text;
- model.sampleDescription = this.txtSampleDescription.Text;
- model.checkItem = this.txtCheckItem.Text;
- model.methodStandard = this.txtMethodStandard.Text;
- model.receiveDate = this.dtpReceiveDate.Value;
- model.checkDate = this.dtpCheckDate.Value;
- model.reportDate = this.dtpReportDate.Value;
- model.reportNumber = this.txtReportNumber.Text;
- model.checkRegion = this.txtCheckRegion.Text;
- model.checkEnvironment = this.txtCheckEnvironment.Text;
- model.analyzeClassify = this.analyzeClassify;
- if (analyzeSavedModel != null)
- {
- if (analyzeModel != null)
- analyzeModel.analyzeSettingModel = model;
- else
- {
- analyzeModel = new AutoAnalyzeSavedModel.ModelItem();
- analyzeModel.languageName = this._languageName;
- analyzeModel.analyzeSettingModel = model;
- analyzeSavedModel.modelItems.Add(analyzeModel);
- }
- }
- else
- {
- analyzeSavedModel = new AutoAnalyzeSavedModel();
- analyzeSavedModel.modelItems = new List<AutoAnalyzeSavedModel.ModelItem>();
- analyzeModel = new AutoAnalyzeSavedModel.ModelItem();
- analyzeModel.languageName = this._languageName;
- analyzeModel.analyzeSettingModel = model;
- analyzeSavedModel.modelItems.Add(analyzeModel);
- }
- //保存xml文件
- string savedModelInfo = XmlSerializeHelper.XmlSerialize<AutoAnalyzeSavedModel>(analyzeSavedModel);
- if (FileOperationHelper.WriteStringToFile(savedModelInfo, m_filePath, FileMode.Create))
- {
- //将对象传递回调用页面
- AutoAnalysisDialog frm = (AutoAnalysisDialog)this.pdnBaseForm;
- frm.AutoAnalyzeSettingModel = model;
- ExportReport?.Invoke();
- this.Close();
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Savefailed.text"));
- }
- }
- public Action ExportReport;
- /// <summary>
- /// 添加按钮-其他
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button4_Click(object sender, EventArgs e)
- {
- //if (string.IsNullOrEmpty(this.textBox9.Text))
- //{
- // MessageBox.Show(PdnResources.GetString("Menu.Pleaseenteranameofthephase.text"));
- // return;
- //}
- //if (string.IsNullOrEmpty(this.textBox8.Text))
- //{
- // MessageBox.Show(PdnResources.GetString("Menu.Pleaseentercontent.text"));
- // return;
- //}
- //DataGridViewRow row = new DataGridViewRow();
- //row.Cells.Add(CreateTextBoxCell(this.textBox9.Text, "name"));
- //row.Cells.Add(CreateTextBoxCell(this.textBox8.Text, "content"));
- //row.Cells.Add(CreateButtonCell(PdnResources.GetString("Menu.Edit.Delete.Text"), "delete"));
- //this.dataGridView1.Rows.Add(row);
- ////选中最新添加的那一条
- //this.dataGridView1.ClearSelection();
- //this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Selected = true;
- ////清空输入框
- //this.textBox9.Text = "";
- //this.textBox8.Text = "";
- }
- /// <summary>
- /// 添加内容单元格
- /// </summary>
- /// <param name="text"></param>
- /// <param name="tag"></param>
- /// <returns></returns>
- private DataGridViewTextBoxCell CreateTextBoxCell(string text, object tag)
- {
- DataGridViewTextBoxCell textboxcell = new DataGridViewTextBoxCell();
- textboxcell.Value = text;
- textboxcell.Tag = tag;
- return textboxcell;
- }
- /// <summary>
- /// 添加按钮单元格
- /// </summary>
- /// <param name="text"></param>
- /// <param name="tag"></param>
- /// <returns></returns>
- public DataGridViewButtonCell CreateButtonCell(string text, object tag)
- {
- DataGridViewButtonCell buttonCell = new DataGridViewButtonCell();
- buttonCell.Value = text;
- buttonCell.Tag = tag;
- return buttonCell;
- }
- /// <summary>
- /// 点击datagridview的删除按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
- {
- var senderGrid = (DataGridView)sender;
- //if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
- // e.RowIndex >= 0)
- //this.dataGridView1.Rows.Remove(this.dataGridView1.Rows[e.RowIndex]);
- }
- /// <summary>
- /// 配置书签按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button5_Click(object sender, EventArgs e)
- {
- BookmarkConfigDialog bookmarkConfigDialog = new BookmarkConfigDialog(this.analyzeClassify, this._languageName);
- bookmarkConfigDialog.StartPosition = FormStartPosition.CenterParent;
- bookmarkConfigDialog.ShowDialog();
- }
- private void AutoAnalysisReportDialog_Load(object sender, EventArgs e)
- {
- if(AutoExportFlag)
- {
- tmrAutoExport.Enabled = true;
- tmrAutoExport.Interval = 1000;
- }
- }
- private void tmrAutoExport_Tick(object sender, EventArgs e)
- {
- tmrAutoExport.Enabled = false;
- this.Invoke(new Action(() =>
- {
- RunExportReport();
- }));
- }
- }
- }
|