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 /// /// 数据库对应字段 /// private string _languageName; /// /// 数据库对应list /// private List _infosList; /// /// 功能路径名称,因需递归作为全局对象 /// private string functionPathMsg; /// /// 分类名称,主要供书签使用 /// private string analyzeClassify; /// /// 调用当前窗口的对象 /// private PdnBaseForm pdnBaseForm; /// /// 在打开窗体时辅助判断是否存在报告模板文件 /// public bool hasModule = false; /// /// xml对应文件路径 /// private string m_filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\" + "AutoAnalyzeSavedModel.xml"; /// /// xml对象 /// private AutoAnalyzeSavedModel analyzeSavedModel; public bool AutoExportFlag { get; set; } /// /// 当前分析分类的数据 /// 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 _resultList; public AutoAnalysisReportDialog() { InitializeComponent(); } public AutoAnalysisReportDialog(PdnBaseForm form, string languageName, List 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); } /// /// 初始化其他信息 /// 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 moduleInfo = new Dictionary(); 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"); } /// /// 加载之前保存的信息 /// private void InitLastTimeInfo() { if (this.hasModule && System.IO.File.Exists(m_filePath)) { analyzeSavedModel = XmlSerializeHelper.DESerializer(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 /// /// 递归拼接功能路径的全称 /// /// 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); } } /// /// 路径选择 /// /// /// 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; }*/ } /// /// 关闭按钮 /// /// /// private void button1_Click(object sender, EventArgs e) { this.Close(); } /// /// 生成按钮 /// /// /// 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(); analyzeModel = new AutoAnalyzeSavedModel.ModelItem(); analyzeModel.languageName = this._languageName; analyzeModel.analyzeSettingModel = model; analyzeSavedModel.modelItems.Add(analyzeModel); } //保存xml文件 string savedModelInfo = XmlSerializeHelper.XmlSerialize(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; /// /// 添加按钮-其他 /// /// /// 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 = ""; } /// /// 添加内容单元格 /// /// /// /// private DataGridViewTextBoxCell CreateTextBoxCell(string text, object tag) { DataGridViewTextBoxCell textboxcell = new DataGridViewTextBoxCell(); textboxcell.Value = text; textboxcell.Tag = tag; return textboxcell; } /// /// 添加按钮单元格 /// /// /// /// public DataGridViewButtonCell CreateButtonCell(string text, object tag) { DataGridViewButtonCell buttonCell = new DataGridViewButtonCell(); buttonCell.Value = text; buttonCell.Tag = tag; return buttonCell; } /// /// 点击datagridview的删除按钮 /// /// /// 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]); } /// /// 配置书签按钮 /// /// /// 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(); })); } } }