using SmartCoalApplication.Core; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using SmartCoalApplication.Base.AutoMeasure; using System.Xml; using System.Xml.Linq; using System.IO; using NPOI.XSSF.UserModel; using NPOI.HSSF.UserModel; using SmartCoalApplication.Base.MeasureModel; using SmartCoalApplication.Base.CommTool; using SmartCoalApplication.Core.DbOpreate.DbModel; using SmartCoalApplication.Resources; using Resources; using SmartCoalApplication.Core.CustomControl; using SmartCoalApplication.Setup; using SmartCoalApplication.Base.FunctionModel; using System.Text.RegularExpressions; using System.Dynamic; //using NPOI.SS.UserModel; //using NPOI.HSSF.Util; namespace SmartCoalApplication.MeasureProcedure { internal partial class MeasureSettingDialog : PdnBaseForm { private List rules = new List();//規程列表 private AppWorkspace appWorkspace; private int index = new int(); private MeasureMaintenanceTypeList measureMaintenanceTypeList; private List everyFourmulaList = new List(); private int copyNum = 1; private string copyName = string.Empty; #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Button buttonDetermine; private System.Windows.Forms.Button buttonClose; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox groupBox3; private NewTextBox textBeizhu; private NewTextBox textMingcheng; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.GroupBox groupBox4; private NewTextBox textLiaohao; private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label11; private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label3; private System.Windows.Forms.GroupBox groupBox5; private System.Windows.Forms.GroupBox groupBox6; private System.Windows.Forms.Label label13; private System.Windows.Forms.Label label14; private NewTextBox textPihao; private System.Windows.Forms.ComboBox comboZhichengbie; private System.Windows.Forms.ComboBox comboShiyongchangqu; private System.Windows.Forms.ComboBox comboShiyanshi; private System.Windows.Forms.ComboBox comboBanci; private NewTextBox textDanhao; private System.Windows.Forms.TextBox textDanweiPosition; private System.Windows.Forms.TextBox textDianduxianbiePosition; private System.Windows.Forms.TextBox textCengbiePosition; private System.Windows.Forms.TextBox textPihaoPosition; private System.Windows.Forms.TextBox textDanhaoPosition; private System.Windows.Forms.TextBox textZhichengbiePosition; private System.Windows.Forms.TextBox textShiyongchangquPosition; private System.Windows.Forms.TextBox textShiyanshiPosition; private System.Windows.Forms.TextBox textBanciPosition; private System.Windows.Forms.TextBox textLiaohaoPosition; private System.Windows.Forms.Label label24; private System.Windows.Forms.Label label23; private System.Windows.Forms.Label label22; private System.Windows.Forms.Label label21; private System.Windows.Forms.Label label20; private System.Windows.Forms.Label label19; private System.Windows.Forms.Label label18; private System.Windows.Forms.Label label17; private System.Windows.Forms.Label label16; private System.Windows.Forms.Label label15; private System.Windows.Forms.TextBox textDanwei; private System.Windows.Forms.Button buttonChooseModel; private System.Windows.Forms.TextBox textModel; private System.Windows.Forms.TextBox textOutNumber; private System.Windows.Forms.ListBox listRules; private System.Windows.Forms.GroupBox groupOutInfo; private System.Windows.Forms.ComboBox comboCengbie; private System.Windows.Forms.Panel panelOutInfo; private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); this.button2 = new System.Windows.Forms.Button(); this.groupBox5 = new System.Windows.Forms.GroupBox(); this.buttonDetermine = new System.Windows.Forms.Button(); this.buttonClose = new System.Windows.Forms.Button(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.buttonDelete = new System.Windows.Forms.Button(); this.buttonCopy = new System.Windows.Forms.Button(); this.buttonAdd = new System.Windows.Forms.Button(); this.buttonSetUp = new System.Windows.Forms.Button(); this.listRules = new System.Windows.Forms.ListBox(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.comboBox2 = new System.Windows.Forms.ComboBox(); this.label26 = new System.Windows.Forms.Label(); this.comboBox1 = new System.Windows.Forms.ComboBox(); this.label25 = new System.Windows.Forms.Label(); this.textBeizhu = new SmartCoalApplication.Core.CustomControl.NewTextBox(); this.textMingcheng = new SmartCoalApplication.Core.CustomControl.NewTextBox(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.labelNowDate = new System.Windows.Forms.Label(); this.textBoxDatePos = new System.Windows.Forms.TextBox(); this.labelDatePos = new System.Windows.Forms.Label(); this.labelDate = new System.Windows.Forms.Label(); this.comboDianduxianbie = new SmartCoalApplication.Core.CustomControl.NewTextBox(); this.comboCengbie = new System.Windows.Forms.ComboBox(); this.textDanweiPosition = new System.Windows.Forms.TextBox(); this.textDianduxianbiePosition = new System.Windows.Forms.TextBox(); this.textCengbiePosition = new System.Windows.Forms.TextBox(); this.textPihaoPosition = new System.Windows.Forms.TextBox(); this.textDanhaoPosition = new System.Windows.Forms.TextBox(); this.textZhichengbiePosition = new System.Windows.Forms.TextBox(); this.textShiyongchangquPosition = new System.Windows.Forms.TextBox(); this.textShiyanshiPosition = new System.Windows.Forms.TextBox(); this.textBanciPosition = new System.Windows.Forms.TextBox(); this.textLiaohaoPosition = new System.Windows.Forms.TextBox(); this.label24 = new System.Windows.Forms.Label(); this.label23 = new System.Windows.Forms.Label(); this.label22 = new System.Windows.Forms.Label(); this.label21 = new System.Windows.Forms.Label(); this.label20 = new System.Windows.Forms.Label(); this.label19 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); this.label17 = new System.Windows.Forms.Label(); this.label16 = new System.Windows.Forms.Label(); this.label15 = new System.Windows.Forms.Label(); this.textDanwei = new System.Windows.Forms.TextBox(); this.textPihao = new SmartCoalApplication.Core.CustomControl.NewTextBox(); this.comboZhichengbie = new System.Windows.Forms.ComboBox(); this.comboShiyongchangqu = new System.Windows.Forms.ComboBox(); this.comboShiyanshi = new System.Windows.Forms.ComboBox(); this.comboBanci = new System.Windows.Forms.ComboBox(); this.textDanhao = new SmartCoalApplication.Core.CustomControl.NewTextBox(); this.textLiaohao = new SmartCoalApplication.Core.CustomControl.NewTextBox(); this.label12 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.groupBox6 = new System.Windows.Forms.GroupBox(); this.button1 = new System.Windows.Forms.Button(); this.buttonChooseModel = new System.Windows.Forms.Button(); this.textModel = new System.Windows.Forms.TextBox(); this.textOutNumber = new System.Windows.Forms.TextBox(); this.label13 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label(); this.groupOutInfo = new System.Windows.Forms.GroupBox(); this.panel1 = new System.Windows.Forms.Panel(); this.panelOutInfo = new System.Windows.Forms.Panel(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); this.groupBox4.SuspendLayout(); this.groupBox6.SuspendLayout(); this.groupOutInfo.SuspendLayout(); this.panel1.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox1.Controls.Add(this.button2); this.groupBox1.Controls.Add(this.groupBox5); this.groupBox1.Controls.Add(this.buttonDetermine); this.groupBox1.Controls.Add(this.buttonClose); this.groupBox1.Location = new System.Drawing.Point(12, 12); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(1192, 57); this.groupBox1.TabIndex = 2; this.groupBox1.TabStop = false; this.groupBox1.Text = "操作"; // // button2 // this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.button2.Location = new System.Drawing.Point(937, 20); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(87, 23); this.button2.TabIndex = 13; this.button2.Text = "基礎信息設置"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // // groupBox5 // this.groupBox5.AutoSize = true; this.groupBox5.Location = new System.Drawing.Point(632, 63); this.groupBox5.Name = "groupBox5"; this.groupBox5.Size = new System.Drawing.Size(521, 383); this.groupBox5.TabIndex = 12; this.groupBox5.TabStop = false; this.groupBox5.Text = "輸出信息"; // // buttonDetermine // this.buttonDetermine.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.buttonDetermine.Location = new System.Drawing.Point(1030, 20); this.buttonDetermine.Name = "buttonDetermine"; this.buttonDetermine.Size = new System.Drawing.Size(75, 23); this.buttonDetermine.TabIndex = 2; this.buttonDetermine.Text = "確定"; this.buttonDetermine.UseVisualStyleBackColor = true; this.buttonDetermine.Click += new System.EventHandler(this.buttonDetermine_Click); // // buttonClose // this.buttonClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.buttonClose.Location = new System.Drawing.Point(1111, 20); this.buttonClose.Name = "buttonClose"; this.buttonClose.Size = new System.Drawing.Size(75, 23); this.buttonClose.TabIndex = 0; this.buttonClose.Text = "關閉"; this.buttonClose.UseVisualStyleBackColor = true; this.buttonClose.Click += new System.EventHandler(this.buttonClose_Click); // // groupBox2 // this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.groupBox2.Controls.Add(this.buttonDelete); this.groupBox2.Controls.Add(this.buttonCopy); this.groupBox2.Controls.Add(this.buttonAdd); this.groupBox2.Controls.Add(this.buttonSetUp); this.groupBox2.Controls.Add(this.listRules); this.groupBox2.Location = new System.Drawing.Point(12, 75); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(200, 694); this.groupBox2.TabIndex = 9; this.groupBox2.TabStop = false; this.groupBox2.Text = "測量規程列表"; // // buttonDelete // this.buttonDelete.Location = new System.Drawing.Point(150, 30); this.buttonDelete.Name = "buttonDelete"; this.buttonDelete.Size = new System.Drawing.Size(44, 23); this.buttonDelete.TabIndex = 9; this.buttonDelete.Text = "刪除"; this.buttonDelete.UseVisualStyleBackColor = true; this.buttonDelete.Click += new System.EventHandler(this.buttonDelete_Click); // // buttonCopy // this.buttonCopy.Location = new System.Drawing.Point(101, 30); this.buttonCopy.Name = "buttonCopy"; this.buttonCopy.Size = new System.Drawing.Size(44, 23); this.buttonCopy.TabIndex = 8; this.buttonCopy.Text = "複製"; this.buttonCopy.UseVisualStyleBackColor = true; this.buttonCopy.Click += new System.EventHandler(this.buttonCopy_Click); // // buttonAdd // this.buttonAdd.Location = new System.Drawing.Point(54, 30); this.buttonAdd.Name = "buttonAdd"; this.buttonAdd.Size = new System.Drawing.Size(44, 23); this.buttonAdd.TabIndex = 7; this.buttonAdd.Text = "新增"; this.buttonAdd.UseVisualStyleBackColor = true; this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click); // // buttonSetUp // this.buttonSetUp.Location = new System.Drawing.Point(6, 30); this.buttonSetUp.Name = "buttonSetUp"; this.buttonSetUp.Size = new System.Drawing.Size(44, 23); this.buttonSetUp.TabIndex = 6; this.buttonSetUp.Text = "設置"; this.buttonSetUp.UseVisualStyleBackColor = true; this.buttonSetUp.Click += new System.EventHandler(this.buttonSetUp_Click); // // listRules // this.listRules.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.listRules.FormattingEnabled = true; this.listRules.ItemHeight = 12; this.listRules.Location = new System.Drawing.Point(6, 60); this.listRules.Name = "listRules"; this.listRules.Size = new System.Drawing.Size(188, 604); this.listRules.TabIndex = 0; this.listRules.SelectedIndexChanged += new System.EventHandler(this.listRules_SelectedChange); // // groupBox3 // this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox3.AutoSize = true; this.groupBox3.Controls.Add(this.comboBox2); this.groupBox3.Controls.Add(this.label26); this.groupBox3.Controls.Add(this.comboBox1); this.groupBox3.Controls.Add(this.label25); this.groupBox3.Controls.Add(this.textBeizhu); this.groupBox3.Controls.Add(this.textMingcheng); this.groupBox3.Controls.Add(this.label2); this.groupBox3.Controls.Add(this.label1); this.groupBox3.Location = new System.Drawing.Point(218, 75); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(437, 204); this.groupBox3.TabIndex = 10; this.groupBox3.TabStop = false; this.groupBox3.Text = "基本信息"; // // comboBox2 // this.comboBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox2.FormattingEnabled = true; this.comboBox2.Location = new System.Drawing.Point(64, 106); this.comboBox2.Name = "comboBox2"; this.comboBox2.Size = new System.Drawing.Size(355, 20); this.comboBox2.TabIndex = 7; // // label26 // this.label26.AutoSize = true; this.label26.Location = new System.Drawing.Point(6, 110); this.label26.Name = "label26"; this.label26.Size = new System.Drawing.Size(65, 12); this.label26.TabIndex = 6; this.label26.Text = "命名規則:"; // // comboBox1 // this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox1.FormattingEnabled = true; this.comboBox1.Location = new System.Drawing.Point(64, 67); this.comboBox1.Name = "comboBox1"; this.comboBox1.Size = new System.Drawing.Size(355, 20); this.comboBox1.TabIndex = 5; this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); // // label25 // this.label25.AutoSize = true; this.label25.Location = new System.Drawing.Point(6, 71); this.label25.Name = "label25"; this.label25.Size = new System.Drawing.Size(41, 12); this.label25.TabIndex = 4; this.label25.Text = "标尺:"; // // textBeizhu // this.textBeizhu.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textBeizhu.Location = new System.Drawing.Point(64, 145); this.textBeizhu.Multiline = true; this.textBeizhu.Name = "textBeizhu"; this.textBeizhu.Size = new System.Drawing.Size(355, 35); this.textBeizhu.TabIndex = 3; // // textMingcheng // this.textMingcheng.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textMingcheng.Location = new System.Drawing.Point(64, 27); this.textMingcheng.Name = "textMingcheng"; this.textMingcheng.Size = new System.Drawing.Size(355, 21); this.textMingcheng.TabIndex = 2; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(6, 156); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(41, 12); this.label2.TabIndex = 1; this.label2.Text = "備注:"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(6, 31); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(41, 12); this.label1.TabIndex = 0; this.label1.Text = "名稱:"; // // groupBox4 // this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox4.AutoSize = true; this.groupBox4.Controls.Add(this.labelNowDate); this.groupBox4.Controls.Add(this.textBoxDatePos); this.groupBox4.Controls.Add(this.labelDatePos); this.groupBox4.Controls.Add(this.labelDate); this.groupBox4.Controls.Add(this.comboDianduxianbie); this.groupBox4.Controls.Add(this.comboCengbie); this.groupBox4.Controls.Add(this.textDanweiPosition); this.groupBox4.Controls.Add(this.textDianduxianbiePosition); this.groupBox4.Controls.Add(this.textCengbiePosition); this.groupBox4.Controls.Add(this.textPihaoPosition); this.groupBox4.Controls.Add(this.textDanhaoPosition); this.groupBox4.Controls.Add(this.textZhichengbiePosition); this.groupBox4.Controls.Add(this.textShiyongchangquPosition); this.groupBox4.Controls.Add(this.textShiyanshiPosition); this.groupBox4.Controls.Add(this.textBanciPosition); this.groupBox4.Controls.Add(this.textLiaohaoPosition); this.groupBox4.Controls.Add(this.label24); this.groupBox4.Controls.Add(this.label23); this.groupBox4.Controls.Add(this.label22); this.groupBox4.Controls.Add(this.label21); this.groupBox4.Controls.Add(this.label20); this.groupBox4.Controls.Add(this.label19); this.groupBox4.Controls.Add(this.label18); this.groupBox4.Controls.Add(this.label17); this.groupBox4.Controls.Add(this.label16); this.groupBox4.Controls.Add(this.label15); this.groupBox4.Controls.Add(this.textDanwei); this.groupBox4.Controls.Add(this.textPihao); this.groupBox4.Controls.Add(this.comboZhichengbie); this.groupBox4.Controls.Add(this.comboShiyongchangqu); this.groupBox4.Controls.Add(this.comboShiyanshi); this.groupBox4.Controls.Add(this.comboBanci); this.groupBox4.Controls.Add(this.textDanhao); this.groupBox4.Controls.Add(this.textLiaohao); this.groupBox4.Controls.Add(this.label12); this.groupBox4.Controls.Add(this.label11); this.groupBox4.Controls.Add(this.label10); this.groupBox4.Controls.Add(this.label9); this.groupBox4.Controls.Add(this.label8); this.groupBox4.Controls.Add(this.label7); this.groupBox4.Controls.Add(this.label6); this.groupBox4.Controls.Add(this.label5); this.groupBox4.Controls.Add(this.label4); this.groupBox4.Controls.Add(this.label3); this.groupBox4.Location = new System.Drawing.Point(218, 282); this.groupBox4.Name = "groupBox4"; this.groupBox4.Size = new System.Drawing.Size(437, 487); this.groupBox4.TabIndex = 11; this.groupBox4.TabStop = false; this.groupBox4.Text = "基本信息"; // // labelNowDate // this.labelNowDate.AutoSize = true; this.labelNowDate.Location = new System.Drawing.Point(83, 347); this.labelNowDate.Name = "labelNowDate"; this.labelNowDate.Size = new System.Drawing.Size(53, 12); this.labelNowDate.TabIndex = 49; this.labelNowDate.Text = "当前日期"; // // textBoxDatePos // this.textBoxDatePos.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textBoxDatePos.Location = new System.Drawing.Point(298, 342); this.textBoxDatePos.Name = "textBoxDatePos"; this.textBoxDatePos.Size = new System.Drawing.Size(121, 21); this.textBoxDatePos.TabIndex = 47; this.textBoxDatePos.Text = "NowDateTime"; // // labelDatePos // this.labelDatePos.AutoSize = true; this.labelDatePos.Location = new System.Drawing.Point(255, 345); this.labelDatePos.Name = "labelDatePos"; this.labelDatePos.Size = new System.Drawing.Size(41, 12); this.labelDatePos.TabIndex = 48; this.labelDatePos.Text = "位置:"; // // labelDate // this.labelDate.AutoSize = true; this.labelDate.Location = new System.Drawing.Point(3, 347); this.labelDate.Name = "labelDate"; this.labelDate.Size = new System.Drawing.Size(65, 12); this.labelDate.TabIndex = 45; this.labelDate.Text = "报告日期:"; // // comboDianduxianbie // this.comboDianduxianbie.Location = new System.Drawing.Point(85, 275); this.comboDianduxianbie.Name = "comboDianduxianbie"; this.comboDianduxianbie.Size = new System.Drawing.Size(164, 21); this.comboDianduxianbie.TabIndex = 44; // // comboCengbie // this.comboCengbie.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboCengbie.FormattingEnabled = true; this.comboCengbie.Location = new System.Drawing.Point(85, 244); this.comboCengbie.Name = "comboCengbie"; this.comboCengbie.Size = new System.Drawing.Size(164, 20); this.comboCengbie.TabIndex = 43; // // textDanweiPosition // this.textDanweiPosition.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textDanweiPosition.Location = new System.Drawing.Point(298, 306); this.textDanweiPosition.Name = "textDanweiPosition"; this.textDanweiPosition.Size = new System.Drawing.Size(121, 21); this.textDanweiPosition.TabIndex = 42; // // textDianduxianbiePosition // this.textDianduxianbiePosition.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textDianduxianbiePosition.Location = new System.Drawing.Point(298, 275); this.textDianduxianbiePosition.Name = "textDianduxianbiePosition"; this.textDianduxianbiePosition.Size = new System.Drawing.Size(121, 21); this.textDianduxianbiePosition.TabIndex = 41; // // textCengbiePosition // this.textCengbiePosition.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textCengbiePosition.Location = new System.Drawing.Point(298, 244); this.textCengbiePosition.Name = "textCengbiePosition"; this.textCengbiePosition.Size = new System.Drawing.Size(121, 21); this.textCengbiePosition.TabIndex = 40; // // textPihaoPosition // this.textPihaoPosition.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textPihaoPosition.Location = new System.Drawing.Point(298, 213); this.textPihaoPosition.Name = "textPihaoPosition"; this.textPihaoPosition.Size = new System.Drawing.Size(121, 21); this.textPihaoPosition.TabIndex = 39; // // textDanhaoPosition // this.textDanhaoPosition.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textDanhaoPosition.Location = new System.Drawing.Point(298, 182); this.textDanhaoPosition.Name = "textDanhaoPosition"; this.textDanhaoPosition.Size = new System.Drawing.Size(121, 21); this.textDanhaoPosition.TabIndex = 38; // // textZhichengbiePosition // this.textZhichengbiePosition.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textZhichengbiePosition.Location = new System.Drawing.Point(298, 153); this.textZhichengbiePosition.Name = "textZhichengbiePosition"; this.textZhichengbiePosition.Size = new System.Drawing.Size(121, 21); this.textZhichengbiePosition.TabIndex = 37; // // textShiyongchangquPosition // this.textShiyongchangquPosition.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textShiyongchangquPosition.Location = new System.Drawing.Point(298, 124); this.textShiyongchangquPosition.Name = "textShiyongchangquPosition"; this.textShiyongchangquPosition.Size = new System.Drawing.Size(121, 21); this.textShiyongchangquPosition.TabIndex = 36; // // textShiyanshiPosition // this.textShiyanshiPosition.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textShiyanshiPosition.Location = new System.Drawing.Point(298, 95); this.textShiyanshiPosition.Name = "textShiyanshiPosition"; this.textShiyanshiPosition.Size = new System.Drawing.Size(121, 21); this.textShiyanshiPosition.TabIndex = 35; // // textBanciPosition // this.textBanciPosition.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textBanciPosition.Location = new System.Drawing.Point(298, 64); this.textBanciPosition.Name = "textBanciPosition"; this.textBanciPosition.Size = new System.Drawing.Size(121, 21); this.textBanciPosition.TabIndex = 34; // // textLiaohaoPosition // this.textLiaohaoPosition.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textLiaohaoPosition.Location = new System.Drawing.Point(298, 33); this.textLiaohaoPosition.Name = "textLiaohaoPosition"; this.textLiaohaoPosition.Size = new System.Drawing.Size(121, 21); this.textLiaohaoPosition.TabIndex = 33; // // label24 // this.label24.AutoSize = true; this.label24.Location = new System.Drawing.Point(255, 314); this.label24.Name = "label24"; this.label24.Size = new System.Drawing.Size(41, 12); this.label24.TabIndex = 32; this.label24.Text = "位置:"; // // label23 // this.label23.AutoSize = true; this.label23.Location = new System.Drawing.Point(255, 278); this.label23.Name = "label23"; this.label23.Size = new System.Drawing.Size(41, 12); this.label23.TabIndex = 31; this.label23.Text = "位置:"; // // label22 // this.label22.AutoSize = true; this.label22.Location = new System.Drawing.Point(255, 247); this.label22.Name = "label22"; this.label22.Size = new System.Drawing.Size(41, 12); this.label22.TabIndex = 30; this.label22.Text = "位置:"; // // label21 // this.label21.AutoSize = true; this.label21.Location = new System.Drawing.Point(255, 216); this.label21.Name = "label21"; this.label21.Size = new System.Drawing.Size(41, 12); this.label21.TabIndex = 29; this.label21.Text = "位置:"; // // label20 // this.label20.AutoSize = true; this.label20.Location = new System.Drawing.Point(255, 185); this.label20.Name = "label20"; this.label20.Size = new System.Drawing.Size(41, 12); this.label20.TabIndex = 28; this.label20.Text = "位置:"; // // label19 // this.label19.AutoSize = true; this.label19.Location = new System.Drawing.Point(255, 156); this.label19.Name = "label19"; this.label19.Size = new System.Drawing.Size(41, 12); this.label19.TabIndex = 27; this.label19.Text = "位置:"; // // label18 // this.label18.AutoSize = true; this.label18.Location = new System.Drawing.Point(255, 127); this.label18.Name = "label18"; this.label18.Size = new System.Drawing.Size(41, 12); this.label18.TabIndex = 26; this.label18.Text = "位置:"; // // label17 // this.label17.AutoSize = true; this.label17.Location = new System.Drawing.Point(255, 98); this.label17.Name = "label17"; this.label17.Size = new System.Drawing.Size(41, 12); this.label17.TabIndex = 25; this.label17.Text = "位置:"; // // label16 // this.label16.AutoSize = true; this.label16.Location = new System.Drawing.Point(255, 67); this.label16.Name = "label16"; this.label16.Size = new System.Drawing.Size(41, 12); this.label16.TabIndex = 24; this.label16.Text = "位置:"; // // label15 // this.label15.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label15.AutoSize = true; this.label15.Location = new System.Drawing.Point(255, 36); this.label15.Name = "label15"; this.label15.Size = new System.Drawing.Size(41, 12); this.label15.TabIndex = 23; this.label15.Text = "位置:"; // // textDanwei // this.textDanwei.Location = new System.Drawing.Point(85, 309); this.textDanwei.Multiline = true; this.textDanwei.Name = "textDanwei"; this.textDanwei.ReadOnly = true; this.textDanwei.Size = new System.Drawing.Size(164, 20); this.textDanwei.TabIndex = 22; // // textPihao // this.textPihao.Location = new System.Drawing.Point(85, 213); this.textPihao.Name = "textPihao"; this.textPihao.Size = new System.Drawing.Size(164, 21); this.textPihao.TabIndex = 19; // // comboZhichengbie // this.comboZhichengbie.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboZhichengbie.FormattingEnabled = true; this.comboZhichengbie.Location = new System.Drawing.Point(85, 153); this.comboZhichengbie.Name = "comboZhichengbie"; this.comboZhichengbie.Size = new System.Drawing.Size(164, 20); this.comboZhichengbie.TabIndex = 18; // // comboShiyongchangqu // this.comboShiyongchangqu.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboShiyongchangqu.FormattingEnabled = true; this.comboShiyongchangqu.Location = new System.Drawing.Point(85, 124); this.comboShiyongchangqu.Name = "comboShiyongchangqu"; this.comboShiyongchangqu.Size = new System.Drawing.Size(164, 20); this.comboShiyongchangqu.TabIndex = 17; // // comboShiyanshi // this.comboShiyanshi.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboShiyanshi.FormattingEnabled = true; this.comboShiyanshi.Location = new System.Drawing.Point(85, 95); this.comboShiyanshi.Name = "comboShiyanshi"; this.comboShiyanshi.Size = new System.Drawing.Size(164, 20); this.comboShiyanshi.TabIndex = 16; // // comboBanci // this.comboBanci.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBanci.FormattingEnabled = true; this.comboBanci.Location = new System.Drawing.Point(85, 64); this.comboBanci.Name = "comboBanci"; this.comboBanci.Size = new System.Drawing.Size(164, 20); this.comboBanci.TabIndex = 0; // // textDanhao // this.textDanhao.Location = new System.Drawing.Point(85, 182); this.textDanhao.Name = "textDanhao"; this.textDanhao.Size = new System.Drawing.Size(164, 21); this.textDanhao.TabIndex = 15; // // textLiaohao // this.textLiaohao.Location = new System.Drawing.Point(85, 33); this.textLiaohao.Name = "textLiaohao"; this.textLiaohao.Size = new System.Drawing.Size(164, 21); this.textLiaohao.TabIndex = 11; // // label12 // this.label12.AutoSize = true; this.label12.Location = new System.Drawing.Point(27, 314); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(41, 12); this.label12.TabIndex = 10; this.label12.Text = "單位:"; // // label11 // this.label11.AutoSize = true; this.label11.Location = new System.Drawing.Point(3, 278); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(65, 12); this.label11.TabIndex = 9; this.label11.Text = "電鍍綫別:"; // // label10 // this.label10.AutoSize = true; this.label10.Location = new System.Drawing.Point(27, 247); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(41, 12); this.label10.TabIndex = 8; this.label10.Text = "層別:"; // // label9 // this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point(27, 216); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(41, 12); this.label9.TabIndex = 7; this.label9.Text = "批號:"; // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(27, 185); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(41, 12); this.label8.TabIndex = 6; this.label8.Text = "單號:"; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(12, 156); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(53, 12); this.label7.TabIndex = 5; this.label7.Text = "製成別:"; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(0, 127); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(65, 12); this.label6.TabIndex = 4; this.label6.Text = "使用廠區:"; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(12, 98); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(53, 12); this.label5.TabIndex = 3; this.label5.Text = "實驗室:"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(27, 67); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(41, 12); this.label4.TabIndex = 2; this.label4.Text = "班次:"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(27, 36); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(41, 12); this.label3.TabIndex = 1; this.label3.Text = "料號:"; // // groupBox6 // this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.groupBox6.AutoSize = true; this.groupBox6.Controls.Add(this.button1); this.groupBox6.Controls.Add(this.buttonChooseModel); this.groupBox6.Controls.Add(this.textModel); this.groupBox6.Controls.Add(this.textOutNumber); this.groupBox6.Controls.Add(this.label13); this.groupBox6.Controls.Add(this.label14); this.groupBox6.Location = new System.Drawing.Point(662, 652); this.groupBox6.Name = "groupBox6"; this.groupBox6.Size = new System.Drawing.Size(542, 117); this.groupBox6.TabIndex = 13; this.groupBox6.TabStop = false; this.groupBox6.Text = "其他信息"; // // button1 // this.button1.Location = new System.Drawing.Point(485, 59); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(44, 23); this.button1.TabIndex = 15; this.button1.Text = "打开"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // buttonChooseModel // this.buttonChooseModel.Location = new System.Drawing.Point(435, 59); this.buttonChooseModel.Name = "buttonChooseModel"; this.buttonChooseModel.Size = new System.Drawing.Size(44, 23); this.buttonChooseModel.TabIndex = 14; this.buttonChooseModel.Text = "選擇"; this.buttonChooseModel.UseVisualStyleBackColor = true; this.buttonChooseModel.Click += new System.EventHandler(this.buttonChooseModel_Click); // // textModel // this.textModel.Location = new System.Drawing.Point(114, 61); this.textModel.Multiline = true; this.textModel.Name = "textModel"; this.textModel.ReadOnly = true; this.textModel.Size = new System.Drawing.Size(305, 32); this.textModel.TabIndex = 13; // // textOutNumber // this.textOutNumber.Location = new System.Drawing.Point(114, 24); this.textOutNumber.Name = "textOutNumber"; this.textOutNumber.Size = new System.Drawing.Size(149, 21); this.textOutNumber.TabIndex = 12; this.textOutNumber.Text = "5"; // // label13 // this.label13.AutoSize = true; this.label13.Location = new System.Drawing.Point(6, 71); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(65, 12); this.label13.TabIndex = 1; this.label13.Text = "選擇模板:"; // // label14 // this.label14.AutoSize = true; this.label14.Location = new System.Drawing.Point(6, 30); this.label14.Name = "label14"; this.label14.Size = new System.Drawing.Size(89, 12); this.label14.TabIndex = 0; this.label14.Text = "輸出圖片個數:"; // // groupOutInfo // this.groupOutInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.groupOutInfo.Controls.Add(this.panel1); this.groupOutInfo.Location = new System.Drawing.Point(662, 75); this.groupOutInfo.Name = "groupOutInfo"; this.groupOutInfo.Size = new System.Drawing.Size(542, 579); this.groupOutInfo.TabIndex = 14; this.groupOutInfo.TabStop = false; this.groupOutInfo.Text = "輸出信息"; // // panel1 // this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.panel1.AutoScroll = true; this.panel1.Controls.Add(this.panelOutInfo); this.panel1.Location = new System.Drawing.Point(6, 13); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(530, 560); this.panel1.TabIndex = 1; // // panelOutInfo // this.panelOutInfo.AutoSize = true; this.panelOutInfo.Location = new System.Drawing.Point(1, 0); this.panelOutInfo.Name = "panelOutInfo"; this.panelOutInfo.Size = new System.Drawing.Size(527, 392); this.panelOutInfo.TabIndex = 0; // // MeasureSettingDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1211, 774); this.Controls.Add(this.groupBox6); this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupOutInfo); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "MeasureSettingDialog"; this.Text = "设置测试规程"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.Load += new System.EventHandler(this.MeasureSettingDialog_Load); this.Resize += new System.EventHandler(this.MeasureSettingDialog_Resize); this.Controls.SetChildIndex(this.groupBox1, 0); this.Controls.SetChildIndex(this.groupBox2, 0); this.Controls.SetChildIndex(this.groupBox3, 0); this.Controls.SetChildIndex(this.groupOutInfo, 0); this.Controls.SetChildIndex(this.groupBox4, 0); this.Controls.SetChildIndex(this.groupBox6, 0); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.groupBox2.ResumeLayout(false); this.groupBox3.ResumeLayout(false); this.groupBox3.PerformLayout(); this.groupBox4.ResumeLayout(false); this.groupBox4.PerformLayout(); this.groupBox6.ResumeLayout(false); this.groupBox6.PerformLayout(); this.groupOutInfo.ResumeLayout(false); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); } #endregion public const int WM_NCLBUTTONDBLCLK = 0xA3; const int WM_NCLBUTTONDOWN = 0x00A1; const int HTCAPTION = 2; protected override void WndProc(ref Message m) { if (m.Msg == WM_NCLBUTTONDOWN && m.WParam.ToInt32() == HTCAPTION) return; if (m.Msg == WM_NCLBUTTONDBLCLK) return; base.WndProc(ref m); } /// /// 生成随机纯字母随机数 /// /// 生成长度 /// 是否要在生成前将当前线程阻止以避免重复 /// public static string Str_char(int Length, bool Sleep) { if (Sleep) System.Threading.Thread.Sleep(3); char[] Pattern = new char[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }; string result = ""; int n = Pattern.Length; System.Random random = new Random(~unchecked((int)DateTime.Now.Ticks)); for (int i = 0; i < Length; i++) { int rnd = random.Next(0, n); result += Pattern[rnd]; } return result; } public MeasureSettingDialog(AppWorkspace appWorkspace) { //var sssfilePath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\basicTreeData.xml"; //var measureMaintenanceTreeData = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(sssfilePath, FileMode.Open)); //foreach (var abc in measureMaintenanceTreeData.MeasureMaintenanceTreeDataList) //{ // foreach (var bcd in abc.MeasureMaintenanceTreeSpecificSonDataList) // { // for (int i = 0; i < bcd.MeasureMaintenanceTreeSpecificFormulaDataList.Count; i++) // { // bcd.MeasureMaintenanceTreeSpecificFormulaDataList[i].FormulaParameterShowName = $"{bcd.MeasureMaintenanceTreeSpecificFormulaDataList[i].FormulaParameterName}({bcd.MeasureMaintenanceTreeSpecificFormulaDataList[i].FormulaParameterAliasName})"; // } // } //} //string stageModelXml = XmlSerializeHelper.XmlSerialize(measureMaintenanceTreeData); //FileOperationHelper.WriteStringToFile(stageModelXml, sssfilePath, FileMode.Create); this.appWorkspace = appWorkspace; InitializeComponent(); InitializeComponent2(); this.Icon = PdnInfo.AppIcon; #region [命名规则] comboBox2.DataSource = Program.instance.fileNameRule.NameRuleList; comboBox2.DisplayMember = "Name"; comboBox2.SelectedIndex = -1; #endregion #region [标尺相关信息] List list = Program.instance.mic_rulersAll; comboBox1.DataSource = list; comboBox1.DisplayMember = "ruler_name"; comboBox1.SelectedIndex = -1; #endregion #region [读取xml中的数据] string filePath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\MeasureMaintenanceTypeList.xml"; if (!System.IO.File.Exists(filePath)) { measureMaintenanceTypeList = new MeasureMaintenanceTypeList(); measureMaintenanceTypeList.measureMaintenanceTypeList = new List(); } else { measureMaintenanceTypeList = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open)); } #endregion ReadXml2(); comboShiyongchangqu.SelectedIndex = -1; comboShiyanshi.SelectedIndex = -1; comboCengbie.SelectedIndex = -1; comboZhichengbie.SelectedIndex = -1; comboBanci.SelectedIndex = -1; this.FormClosed += new FormClosedEventHandler(formClosing); this.MaximizedBounds = Screen.PrimaryScreen.WorkingArea;//在窗体初始化后添加一句代码 } private void InitializeComponent2() { this.Text = PdnResources.GetString("NewSetTestProcedure"); this.groupBox1.Text = PdnResources.GetString("NewOperation"); this.groupBox5.Text = PdnResources.GetString("NewOutputInformation"); this.buttonDetermine.Text = PdnResources.GetString("NewConfirm"); this.buttonClose.Text = PdnResources.GetString("NewClosing"); this.groupBox2.Text = PdnResources.GetString("NewListSurveyProcedures"); this.buttonDelete.Text = PdnResources.GetString("NewDelete"); this.buttonCopy.Text = PdnResources.GetString("NewCopy"); this.buttonAdd.Text = PdnResources.GetString("NewAdd"); this.buttonSetUp.Text = PdnResources.GetString("NewSetting"); this.groupBox3.Text = PdnResources.GetString("NewEssentialInformation"); this.label25.Text = PdnResources.GetString("NewRuler"); this.label2.Text = PdnResources.GetString("NewRemark") + ":"; this.label1.Text = PdnResources.GetString("NewName") + ":"; this.groupBox4.Text = PdnResources.GetString("NewEssentialInformation"); this.label24.Text = PdnResources.GetString("NewPosition") + ":"; this.label23.Text = PdnResources.GetString("NewPosition") + ":"; this.label22.Text = PdnResources.GetString("NewPosition") + ":"; this.label21.Text = PdnResources.GetString("NewPosition") + ":"; this.label20.Text = PdnResources.GetString("NewPosition") + ":"; this.label19.Text = PdnResources.GetString("NewPosition") + ":"; this.label18.Text = PdnResources.GetString("NewPosition") + ":"; this.label17.Text = PdnResources.GetString("NewPosition") + ":"; this.label16.Text = PdnResources.GetString("NewPosition") + ":"; this.label15.Text = PdnResources.GetString("NewPosition") + ":"; this.label12.Text = PdnResources.GetString("NewUnit") + ":"; this.label11.Text = PdnResources.GetString("NewElectroplatingLine") + ":"; this.label10.Text = PdnResources.GetString("NewLayers") + ":"; this.label9.Text = PdnResources.GetString("NewBatchNumber") + ":"; this.label8.Text = PdnResources.GetString("NewOrderNo") + ":"; this.label7.Text = PdnResources.GetString("NewMadeOf") + ":"; this.label6.Text = PdnResources.GetString("NewUseFactory") + ":"; this.label5.Text = PdnResources.GetString("NewLaboratory") + ":"; this.label4.Text = PdnResources.GetString("NewFrequency") + ":"; this.label3.Text = PdnResources.GetString("NewItemNo") + ":"; this.groupBox6.Text = PdnResources.GetString("NewOtherInformation"); this.button1.Text = PdnResources.GetString("NewOpen"); this.buttonChooseModel.Text = PdnResources.GetString("NewChoice"); this.label13.Text = PdnResources.GetString("NewSelectTemplate") + ":"; this.label14.Text = PdnResources.GetString("NewNumberOutputPictures") + ":"; this.groupOutInfo.Text = PdnResources.GetString("NewOutputInformation"); this.button2.Text = PdnResources.GetString("NewBasicInfoSetting"); this.label26.Text = PdnResources.GetString("MeasureSettingDialog.label26"); this.labelDate.Text = PdnResources.GetString("MeasureSettingDialog.labelDate") + ":"; this.labelDatePos.Text = PdnResources.GetString("MeasureSettingDialog.labelDatePos"); this.labelNowDate.Text = PdnResources.GetString("MeasureSettingDialog.textBoxDate"); } private void formClosing(object sender, FormClosedEventArgs e) { //清空未命名XMl string path = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\MeasureMaintenanceType\\.xml"; if (System.IO.File.Exists(path)) { try { System.IO.File.Delete(path); } catch (Exception) { } } } /// /// 關閉 /// private void buttonClose_Click(object sender, EventArgs e) { this.Close(); } /// /// 設置 /// private void buttonSetUp_Click(object sender, EventArgs e) { string name; List list; if (listRules.SelectedItem == null) { if (!string.IsNullOrEmpty(this.copyName)) { name = this.copyName; } else { name = string.Empty; } list = new List(); list.AddRange(everyFourmulaList); } else { name = ((MeasureMaintenanceType)listRules.SelectedItem).measureMaintenanceName; list = ((MeasureMaintenanceType)listRules.SelectedItem).MeasureMaintenanceTreeFourthDataList; } MeasureSetUp form = new MeasureSetUp(name, list,this.appWorkspace); form.TransferEvent += frm_TransEvent; form.ShowDialog(); } private void frm_TransEvent(List list) { everyFourmulaList.Clear(); everyFourmulaList.AddRange(list); if (this.listRules.SelectedItem != null) { var selectItem = (MeasureMaintenanceType)this.listRules.SelectedItem; var data = measureMaintenanceTypeList.measureMaintenanceTypeList.Where(m => m.measureMaintenanceTypeId.Equals(selectItem.measureMaintenanceTypeId)).FirstOrDefault(); if (data != null) { data.MeasureMaintenanceTreeFourthDataList.Clear(); data.MeasureMaintenanceTreeFourthDataList.AddRange(list); selectItem.MeasureMaintenanceTreeFourthDataList.Clear(); selectItem.MeasureMaintenanceTreeFourthDataList.AddRange(list); } } OutInfoShow(); } /// /// 新增規程 /// private void buttonAdd_Click(object sender, EventArgs e) { listRules.SelectedIndex = - 1; this.copyName = string.Empty; textMingcheng.Text = string.Empty;//名稱 textBeizhu.Text = string.Empty;//備注 textLiaohao.Text = string.Empty;//料號 textLiaohaoPosition.Text = "ItemNumber"; comboBanci.SelectedItem = string.Empty;//班次 textBanciPosition.Text = "DNShift"; comboShiyanshi.Text = string.Empty;//實驗室 textShiyanshiPosition.Text = "Lab"; comboShiyongchangqu.SelectedItem = string.Empty;//使用廠區 textShiyongchangquPosition.Text = "factory"; comboZhichengbie.SelectedItem = string.Empty;//製成別 textZhichengbiePosition.Text = "ProcType"; textDanhao.Text = string.Empty;//單號 textDanhaoPosition.Text = "WorkOrder"; textPihao.Text = string.Empty;//批號 textPihaoPosition.Text = "LotNumber"; comboCengbie.SelectedItem = string.Empty;//層別 textCengbiePosition.Text = "LayerType"; comboDianduxianbie.Text = string.Empty;//電鍍綫別 textDianduxianbiePosition.Text = "EplatType"; textDanwei.Text = this.appWorkspace.GetPxPerUnit()[1];//單位 textDanweiPosition.Text = "Unit"; textOutNumber.Text = "5"; textModel.Text = string.Empty; textBoxDatePos.Text = "NowDateTime"; comboBox1.SelectedIndex = -1; comboBox2.SelectedIndex = -1; panelOutInfo.Controls.Clear(); everyFourmulaList.Clear(); //清空未命名XMl string path = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\MeasureMaintenanceType\\.xml"; if (System.IO.File.Exists(path)) { try { System.IO.File.Delete(path); } catch (Exception) { } } if (!buttonSetUp.Enabled || !buttonCopy.Enabled || !buttonDetermine.Enabled || !buttonDelete.Enabled) { buttonSetUp.Enabled = true; buttonCopy.Enabled = true; buttonDetermine.Enabled = true; buttonDelete.Enabled = true; } } /// /// 確認規程 /// private void buttonDetermine_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textMingcheng.Text)) { MessageBox.Show(PdnResources.GetString("NullName")); return; } var repeatData = measureMaintenanceTypeList.measureMaintenanceTypeList.Where(m => m.measureMaintenanceName.Equals(textMingcheng.Text)).FirstOrDefault(); if (repeatData != null) { if (listRules.SelectedItem == null) { MessageBox.Show(PdnResources.GetString("RepeatName")); return; } else { var data = (MeasureMaintenanceType)listRules.SelectedItem; if (!data.measureMaintenanceTypeId.Equals(repeatData.measureMaintenanceTypeId)) { MessageBox.Show(PdnResources.GetString("RepeatName")); return; } } } MeasureMaintenanceType copyData; int index = listRules.SelectedIndex; if (listRules.SelectedItem == null) { if (string.IsNullOrEmpty(textModel.Text)) { MessageBox.Show(PdnResources.GetString("SelectModel")); } copyData = new MeasureMaintenanceType(); copyData.measureMaintenanceTypeId = Guid.NewGuid().ToString(); copyData.measureMaintenanceBasicDataList = new List(); MeasureMaintenanceBasicData data = new MeasureMaintenanceBasicData(); MeasureMaintenanceBasicData data1 = new MeasureMaintenanceBasicData(); MeasureMaintenanceBasicData data2 = new MeasureMaintenanceBasicData(); MeasureMaintenanceBasicData data3 = new MeasureMaintenanceBasicData(); MeasureMaintenanceBasicData data4 = new MeasureMaintenanceBasicData(); MeasureMaintenanceBasicData data5 = new MeasureMaintenanceBasicData(); MeasureMaintenanceBasicData data6 = new MeasureMaintenanceBasicData(); MeasureMaintenanceBasicData data7 = new MeasureMaintenanceBasicData(); MeasureMaintenanceBasicData data8 = new MeasureMaintenanceBasicData(); MeasureMaintenanceBasicData data9 = new MeasureMaintenanceBasicData(); MeasureMaintenanceBasicData data10 = new MeasureMaintenanceBasicData(); MeasureMaintenanceBasicData data11 = new MeasureMaintenanceBasicData(); data.measureMaintenanceBasicDataIndex = 0; copyData.measureMaintenanceBasicDataList.Add(data); data1.measureMaintenanceBasicDataIndex = 1; copyData.measureMaintenanceBasicDataList.Add(data1); data2.measureMaintenanceBasicDataIndex = 2; copyData.measureMaintenanceBasicDataList.Add(data2); data3.measureMaintenanceBasicDataIndex = 3; copyData.measureMaintenanceBasicDataList.Add(data3); data4.measureMaintenanceBasicDataIndex = 4; copyData.measureMaintenanceBasicDataList.Add(data4); data5.measureMaintenanceBasicDataIndex = 5; copyData.measureMaintenanceBasicDataList.Add(data5); data6.measureMaintenanceBasicDataIndex = 6; copyData.measureMaintenanceBasicDataList.Add(data6); data7.measureMaintenanceBasicDataIndex = 7; copyData.measureMaintenanceBasicDataList.Add(data7); data8.measureMaintenanceBasicDataIndex = 8; copyData.measureMaintenanceBasicDataList.Add(data8); data9.measureMaintenanceBasicDataIndex = 9; copyData.measureMaintenanceBasicDataList.Add(data9); data10.measureMaintenanceBasicDataIndex = 10; copyData.measureMaintenanceBasicDataList.Add(data10); copyData.measureMaintenanceContent = string.Empty;//備注 copyData.measureMaintenanceBasicDataList[0].measureMaintenanceBasicDataValue = string.Empty;//料號 copyData.measureMaintenanceBasicDataList[0].measureMaintenanceBasicDataPosition = "ItemNumber"; copyData.measureMaintenanceBasicDataList[1].measureMaintenanceBasicDataValue = string.Empty;//班次 copyData.measureMaintenanceBasicDataList[1].measureMaintenanceBasicDataPosition = "DNShift"; copyData.measureMaintenanceBasicDataList[2].measureMaintenanceBasicDataValue = string.Empty;//實驗室 copyData.measureMaintenanceBasicDataList[2].measureMaintenanceBasicDataPosition = "Lab"; copyData.measureMaintenanceBasicDataList[3].measureMaintenanceBasicDataValue = string.Empty;//使用廠區 copyData.measureMaintenanceBasicDataList[3].measureMaintenanceBasicDataPosition = "factory"; copyData.measureMaintenanceBasicDataList[4].measureMaintenanceBasicDataValue = string.Empty;//製成別 copyData.measureMaintenanceBasicDataList[4].measureMaintenanceBasicDataPosition = "ProcType"; copyData.measureMaintenanceBasicDataList[5].measureMaintenanceBasicDataValue = string.Empty;//單號 copyData.measureMaintenanceBasicDataList[5].measureMaintenanceBasicDataPosition = "WorkOrder"; copyData.measureMaintenanceBasicDataList[6].measureMaintenanceBasicDataValue = string.Empty;//批號 copyData.measureMaintenanceBasicDataList[6].measureMaintenanceBasicDataPosition = "LotNumber"; copyData.measureMaintenanceBasicDataList[7].measureMaintenanceBasicDataValue = string.Empty;//層別 copyData.measureMaintenanceBasicDataList[7].measureMaintenanceBasicDataPosition = "LayerType"; copyData.measureMaintenanceBasicDataList[8].measureMaintenanceBasicDataValue = string.Empty;//電鍍綫別 copyData.measureMaintenanceBasicDataList[8].measureMaintenanceBasicDataPosition = "EplatType"; copyData.measureMaintenanceBasicDataList[9].measureMaintenanceBasicDataValue = string.Empty;//單位 copyData.measureMaintenanceBasicDataList[9].measureMaintenanceBasicDataPosition = "Unit"; copyData.measureMaintenanceBasicDataList[10].measureMaintenanceBasicDataValue = string.Empty;//报告时间 copyData.measureMaintenanceBasicDataList[10].measureMaintenanceBasicDataPosition = "NowDateTime"; copyData.MeasureMaintenanceTreeFourthDataList = new List(); copyData.MeasureMaintenanceTreeFourthDataList.AddRange(everyFourmulaList); } else { copyData = (MeasureMaintenanceType)listRules.SelectedItem; if (string.IsNullOrEmpty(copyData.templateFilePath)) { MessageBox.Show(PdnResources.GetString("SelectModel")); } } copyData.measureMaintenanceName = textMingcheng.Text;//名稱 copyData.measureMaintenanceContent = textBeizhu.Text;//備注 copyData.measureMaintenanceBasicDataList[0].measureMaintenanceBasicDataValue = textLiaohao.Text;//料號 copyData.measureMaintenanceBasicDataList[0].measureMaintenanceBasicDataPosition = textLiaohaoPosition.Text; copyData.measureMaintenanceBasicDataList[1].measureMaintenanceBasicDataValue = comboBanci.SelectedItem == null ? "": comboBanci.SelectedItem.ToString();//班次 copyData.measureMaintenanceBasicDataList[1].measureMaintenanceBasicDataPosition = textBanciPosition.Text; copyData.measureMaintenanceBasicDataList[2].measureMaintenanceBasicDataValue = comboShiyanshi.SelectedItem == null ? "" : comboShiyanshi.SelectedItem.ToString();//實驗室 copyData.measureMaintenanceBasicDataList[2].measureMaintenanceBasicDataPosition = textShiyanshiPosition.Text; copyData.measureMaintenanceBasicDataList[3].measureMaintenanceBasicDataValue = comboShiyongchangqu.SelectedItem == null ? "" : comboShiyongchangqu.SelectedItem.ToString();//使用廠區 copyData.measureMaintenanceBasicDataList[3].measureMaintenanceBasicDataPosition = textShiyongchangquPosition.Text; copyData.measureMaintenanceBasicDataList[4].measureMaintenanceBasicDataValue = comboZhichengbie.SelectedItem == null ? "" : comboZhichengbie.SelectedItem.ToString();//製成別 copyData.measureMaintenanceBasicDataList[4].measureMaintenanceBasicDataPosition = textZhichengbiePosition.Text; copyData.measureMaintenanceBasicDataList[5].measureMaintenanceBasicDataValue = textDanhao.Text;//單號 copyData.measureMaintenanceBasicDataList[5].measureMaintenanceBasicDataPosition = textDanhaoPosition.Text; copyData.measureMaintenanceBasicDataList[6].measureMaintenanceBasicDataValue = textPihao.Text;//批號 copyData.measureMaintenanceBasicDataList[6].measureMaintenanceBasicDataPosition = textPihaoPosition.Text; copyData.measureMaintenanceBasicDataList[7].measureMaintenanceBasicDataValue = comboCengbie.SelectedItem == null ? "" : comboCengbie.SelectedItem.ToString();//層別 copyData.measureMaintenanceBasicDataList[7].measureMaintenanceBasicDataPosition = textCengbiePosition.Text; copyData.measureMaintenanceBasicDataList[8].measureMaintenanceBasicDataValue = comboDianduxianbie.Text;//電鍍綫別 copyData.measureMaintenanceBasicDataList[8].measureMaintenanceBasicDataPosition = textDianduxianbiePosition.Text; copyData.measureMaintenanceBasicDataList[9].measureMaintenanceBasicDataValue = textDanwei.Text;//單位 copyData.measureMaintenanceBasicDataList[9].measureMaintenanceBasicDataPosition = textDanweiPosition.Text; copyData.measureMaintenanceBasicDataList[10].measureMaintenanceBasicDataPosition = textBoxDatePos.Text; //报告日期 //UNDONE:由于数据问题,暂时为try-catch //try //{ //} //catch //{ // var mData = new MeasureMaintenanceBasicData(); // mData.measureMaintenanceBasicDataIndex = 10; // mData.measureMaintenanceBasicDataPosition = "NowDateTime"; // copyData.measureMaintenanceBasicDataList.Add(mData); //} #region [根据语言包改写名称] string basicFilePath; if (Program.instance.configModel.Language == 1) { basicFilePath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\basicTreeDataSimple.xml"; } else { basicFilePath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\basicTreeDataTraditional.xml"; } MeasureMaintenanceTreeData basicMeasureMaintenanceTreeData = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(basicFilePath, FileMode.Open)); foreach (var item in copyData.MeasureMaintenanceTreeFourthDataList) { MeasureMaintenanceTreeSpecificData basicData; this.appWorkspace.RecursionGetData(item.HoleTypeId, basicMeasureMaintenanceTreeData.MeasureMaintenanceTreeDataList, out basicData); if (basicData != null) { item.HoleType = basicData.MeasureMaintenanceTreeSpecificName; } } foreach (var item in this.everyFourmulaList) { MeasureMaintenanceTreeSpecificData basicData; this.appWorkspace.RecursionGetData(item.HoleTypeId, basicMeasureMaintenanceTreeData.MeasureMaintenanceTreeDataList, out basicData); if (basicData != null) { item.HoleType = basicData.MeasureMaintenanceTreeSpecificName; } } #endregion try { int num = Convert.ToInt32(textOutNumber.Text); copyData.outputPicturesNum = num; } catch (Exception) { copyData.outputPicturesNum = 0; } //赋值文件到临时文件夹 并且一直用 string tempPath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\Temp\\"; if (!System.IO.Directory.Exists(tempPath)) { Directory.CreateDirectory(tempPath); } //有变化了才复写文件 if (!textModel.Text.Equals(copyData.templateFilePath)) { if (System.IO.File.Exists(copyData.templateFilePath)) { //删除之前的旧文件 try { System.IO.File.Delete(copyData.templateFilePath); } catch (Exception) { } } var dateTimeStr = DateTime.Now.ToString("yyyyMMddHHmmss"); if (FileOperationHelper.CopyFile(textModel.Text, tempPath, dateTimeStr, true)) { string[] fileName = textModel.Text.Split('\\'); tempPath += dateTimeStr + "_" + fileName[fileName.Length - 1]; copyData.templateFilePath = tempPath; } } if (comboBox1.SelectedIndex != -1) { if (copyData.ruleMessage == null) { copyData.ruleMessage = new RuleMessage(); } copyData.ruleMessage.ruleId = Program.instance.mic_rulersAll[comboBox1.SelectedIndex].id.ToString(); copyData.ruleMessage.ruleName = Program.instance.mic_rulersAll[comboBox1.SelectedIndex].ruler_name; copyData.ruleMessage.pixelLength = Program.instance.mic_rulersAll[comboBox1.SelectedIndex].pixel_length; copyData.ruleMessage.physicalLength = Program.instance.mic_rulersAll[comboBox1.SelectedIndex].physical_length; copyData.ruleMessage.rulerUnits = Program.instance.mic_rulersAll[comboBox1.SelectedIndex].ruler_units; copyData.ruleMessage.ruleGain = Program.instance.mic_rulersAll[comboBox1.SelectedIndex].gain_multiple; } if (comboBox2.SelectedIndex != -1) { var nameRuleListDetailsA = (NameRuleListDetails)this.comboBox2.SelectedItem; copyData.NameRuleID = nameRuleListDetailsA.ID; } if (index == -1) { measureMaintenanceTypeList.measureMaintenanceTypeList.Add(copyData); index = measureMaintenanceTypeList.measureMaintenanceTypeList.Count - 1; } else { measureMaintenanceTypeList.measureMaintenanceTypeList[index] = copyData; } if (!string.IsNullOrEmpty(this.copyName)) { string oldFilePath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\MeasureMaintenanceType\\" + this.copyName + ".xml"; string newFilePath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\MeasureMaintenanceType\\" + this.textMingcheng.Text + ".xml"; if (System.IO.File.Exists(oldFilePath)) { System.IO.FileInfo file = new System.IO.FileInfo(oldFilePath); file.MoveTo(newFilePath); } } this.copyName = string.Empty; this.listRules.SelectedIndexChanged -= new System.EventHandler(this.listRules_SelectedChange); listRules.DataSource = null; listRules.DataSource = measureMaintenanceTypeList.measureMaintenanceTypeList; listRules.DisplayMember = "measureMaintenanceName"; this.listRules.SelectedIndexChanged += new System.EventHandler(this.listRules_SelectedChange); listRules.SelectedIndex = index; OutInfoShow(); WriteXml(); } /// /// 刪除規程 /// private void buttonDelete_Click(object sender, EventArgs e) { if (this.listRules.SelectedIndex == -1) { MessageBox.Show(PdnResources.GetString("DeleteError")); if (this.listRules.Items.Count == 0) { buttonAdd_Click(null, null); } return; } DialogResult result = MessageBox.Show(PdnResources.GetString("Delete") + "?", PdnResources.GetString("DelStndard"), MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { var deleteItem = (MeasureMaintenanceType)this.listRules.SelectedItem; measureMaintenanceTypeList.measureMaintenanceTypeList.Remove(deleteItem); listRules.DataSource = null; listRules.DataSource = measureMaintenanceTypeList.measureMaintenanceTypeList; listRules.DisplayMember = "measureMaintenanceName"; if (measureMaintenanceTypeList.measureMaintenanceTypeList.Count > 0) { listRules.SelectedIndex = 0; } else { buttonAdd_Click(null, null); buttonSetUp.Enabled = false; buttonCopy.Enabled = false; buttonDetermine.Enabled = false; buttonDelete.Enabled = false; } string filePath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\MeasureMaintenanceTypeList.xml"; string stageModelXml = XmlSerializeHelper.XmlSerialize(measureMaintenanceTypeList); FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create); //清空未命名XMl string path = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\MeasureMaintenanceType\\" + deleteItem.measureMaintenanceName + ".xml"; try { if (System.IO.File.Exists(path)) { System.IO.File.Delete(path); } if (System.IO.File.Exists(deleteItem.templateFilePath)) { System.IO.File.Delete(deleteItem.templateFilePath); } } catch (Exception) { } } } /// /// 複製 /// private void buttonCopy_Click(object sender, EventArgs e) { if (this.listRules.SelectedItem == null) { return; } var selectedItem = (MeasureMaintenanceType)this.listRules.SelectedItem; var copyData = new MeasureMaintenanceType(); List measureMaintenanceBasicDatas = new List(); for (int i = 0; i < selectedItem.measureMaintenanceBasicDataList.Count; i++) { MeasureMaintenanceBasicData measureMaintenanceFormula = new MeasureMaintenanceBasicData(); measureMaintenanceFormula.measureMaintenanceBasicDataIndex = selectedItem.measureMaintenanceBasicDataList[i].measureMaintenanceBasicDataIndex; measureMaintenanceFormula.measureMaintenanceBasicDataPosition = selectedItem.measureMaintenanceBasicDataList[i].measureMaintenanceBasicDataPosition; measureMaintenanceFormula.measureMaintenanceBasicDataValue = selectedItem.measureMaintenanceBasicDataList[i].measureMaintenanceBasicDataValue; measureMaintenanceBasicDatas.Add(measureMaintenanceFormula); } List measureMaintenanceFormulas = new List(); for (int i = 0; i < selectedItem.MeasureMaintenanceTreeFourthDataList.Count; i++) { MeasureMaintenanceFormula measureMaintenanceFormula = new MeasureMaintenanceFormula(); measureMaintenanceFormula.FatherHoleTypeId = selectedItem.MeasureMaintenanceTreeFourthDataList[i].FatherHoleTypeId; measureMaintenanceFormula.FormulaExpression = selectedItem.MeasureMaintenanceTreeFourthDataList[i].FormulaExpression; measureMaintenanceFormula.FormulaExpressionLineID = selectedItem.MeasureMaintenanceTreeFourthDataList[i].FormulaExpressionLineID; measureMaintenanceFormula.FormulaId = selectedItem.MeasureMaintenanceTreeFourthDataList[i].FormulaId; measureMaintenanceFormula.FormulaName = selectedItem.MeasureMaintenanceTreeFourthDataList[i].FormulaName; measureMaintenanceFormula.FormulaParentId = selectedItem.MeasureMaintenanceTreeFourthDataList[i].FormulaParentId; measureMaintenanceFormula.HoleType = selectedItem.MeasureMaintenanceTreeFourthDataList[i].HoleType; measureMaintenanceFormula.HoleTypeId = selectedItem.MeasureMaintenanceTreeFourthDataList[i].HoleTypeId; measureMaintenanceFormula.isConductiveCloth = selectedItem.MeasureMaintenanceTreeFourthDataList[i].isConductiveCloth; measureMaintenanceFormula.isFanweibuchang = selectedItem.MeasureMaintenanceTreeFourthDataList[i].isFanweibuchang; measureMaintenanceFormula.isErzhichuli = selectedItem.MeasureMaintenanceTreeFourthDataList[i].isErzhichuli; measureMaintenanceFormula.Specification = selectedItem.MeasureMaintenanceTreeFourthDataList[i].Specification; measureMaintenanceFormula.TestItems = selectedItem.MeasureMaintenanceTreeFourthDataList[i].TestItems; measureMaintenanceFormulas.Add(measureMaintenanceFormula); } copyData.measureMaintenanceBasicDataList.AddRange(measureMaintenanceBasicDatas); copyData.MeasureMaintenanceTreeFourthDataList.AddRange(measureMaintenanceFormulas); copyData.measureMaintenanceContent = selectedItem.measureMaintenanceContent; copyData.measureMaintenanceName = selectedItem.measureMaintenanceName; copyData.measureMaintenanceTypeId = selectedItem.measureMaintenanceTypeId; copyData.outputPicturesNum = selectedItem.outputPicturesNum; copyData.ruleMessage = selectedItem.ruleMessage; copyData.templateFilePath = selectedItem.templateFilePath; //更改顯示 textMingcheng.Text = copyData.measureMaintenanceName + "-" + copyNum;//名稱 this.copyName = textMingcheng.Text; #region [复制检验项目] string SourcePath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\MeasureMaintenanceType\\" + copyData.measureMaintenanceName + ".xml"; string DestinationPath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\MeasureMaintenanceType\\" + textMingcheng.Text + ".xml"; if (System.IO.File.Exists(SourcePath)) { FileInfo flinfo = new FileInfo(SourcePath); flinfo.CopyTo(DestinationPath); } #endregion textBeizhu.Text = copyData.measureMaintenanceContent;//備注 List list = Program.instance.mic_rulersAll.Select(m => m.id).ToList(); if (copyData.ruleMessage != null) { comboBox1.SelectedIndex = list.IndexOf(Convert.ToInt32(copyData.ruleMessage.ruleId)); } if (!string.IsNullOrEmpty(copyData.NameRuleID)) { List dlist = Program.instance.fileNameRule.NameRuleList.Select(m => m.ID).ToList(); if (dlist.Count > 0) { comboBox2.SelectedIndex = dlist.IndexOf(copyData.NameRuleID); } else { comboBox2.SelectedIndex = -1; } } textLiaohao.Text = copyData.measureMaintenanceBasicDataList[0].measureMaintenanceBasicDataValue;//料號 textLiaohaoPosition.Text = copyData.measureMaintenanceBasicDataList[0].measureMaintenanceBasicDataPosition; comboBanci.SelectedItem = copyData.measureMaintenanceBasicDataList[1]. measureMaintenanceBasicDataValue;//班次 textBanciPosition.Text = copyData.measureMaintenanceBasicDataList[1].measureMaintenanceBasicDataPosition; comboShiyanshi.SelectedItem = copyData.measureMaintenanceBasicDataList[2].measureMaintenanceBasicDataValue;//實驗室 textShiyanshiPosition.Text = copyData.measureMaintenanceBasicDataList[2].measureMaintenanceBasicDataPosition; comboShiyongchangqu.SelectedItem = copyData.measureMaintenanceBasicDataList[3].measureMaintenanceBasicDataValue;//使用廠區 textShiyongchangquPosition.Text = copyData.measureMaintenanceBasicDataList[3].measureMaintenanceBasicDataPosition; comboZhichengbie.SelectedItem = copyData.measureMaintenanceBasicDataList[4].measureMaintenanceBasicDataValue;//製成別 textZhichengbiePosition.Text = copyData.measureMaintenanceBasicDataList[4].measureMaintenanceBasicDataPosition; textDanhao.Text = copyData.measureMaintenanceBasicDataList[5].measureMaintenanceBasicDataValue;//單號 textDanhaoPosition.Text = copyData.measureMaintenanceBasicDataList[5].measureMaintenanceBasicDataPosition; textPihao.Text = copyData.measureMaintenanceBasicDataList[6].measureMaintenanceBasicDataValue;//批號 textPihaoPosition.Text = copyData.measureMaintenanceBasicDataList[6].measureMaintenanceBasicDataPosition; comboCengbie.SelectedItem = copyData.measureMaintenanceBasicDataList[7].measureMaintenanceBasicDataValue;//層別 textCengbiePosition.Text = copyData.measureMaintenanceBasicDataList[7].measureMaintenanceBasicDataPosition; comboDianduxianbie.Text = copyData.measureMaintenanceBasicDataList[8].measureMaintenanceBasicDataValue;//電鍍綫別 textDianduxianbiePosition.Text = copyData.measureMaintenanceBasicDataList[8].measureMaintenanceBasicDataPosition; textDanwei.Text = copyData.measureMaintenanceBasicDataList[9].measureMaintenanceBasicDataValue;//單位 textDanweiPosition.Text = copyData.measureMaintenanceBasicDataList[9].measureMaintenanceBasicDataPosition; textBoxDatePos.Text = copyData.measureMaintenanceBasicDataList[10].measureMaintenanceBasicDataPosition;//报告日期 textOutNumber.Text = copyData.outputPicturesNum.ToString();//輸出圖片數量 textModel.Text = copyData.templateFilePath; listRules.SelectedIndex = -1; this.formClosing(null, null); } /// /// 加载初始化 /// 2 private void MeasureSettingDialog_Load(object sender, EventArgs e) { listRules.DataSource = null; listRules.DataSource = measureMaintenanceTypeList.measureMaintenanceTypeList; listRules.DisplayMember = "measureMaintenanceName"; if (measureMaintenanceTypeList.measureMaintenanceTypeList == null || measureMaintenanceTypeList.measureMaintenanceTypeList.Count == 0) { buttonSetUp.Enabled = false; buttonCopy.Enabled = false; buttonDetermine.Enabled = false; buttonDelete.Enabled = false; } } /// /// 点击时显示选中的内容 /// private void listRules_SelectedChange(object sender, EventArgs e) { if (this.listRules.SelectedItem == null) { return; } var copyData = (MeasureMaintenanceType)this.listRules.SelectedItem; this.copyName = string.Empty; if (copyData.ruleMessage == null) { comboBox1.SelectedIndex = -1; } else { List list = Program.instance.mic_rulersAll; var ruler = list.Where(m => m.ruler_name == copyData.ruleMessage.ruleName).FirstOrDefault(); if (ruler != null) { comboBox1.SelectedIndex = list.IndexOf(ruler); } else { comboBox1.SelectedIndex = -1; } } if (!string.IsNullOrEmpty(copyData.NameRuleID)) { List dlist = Program.instance.fileNameRule.NameRuleList.Select(m => m.ID).ToList(); if (dlist.Count > 0) { comboBox2.SelectedIndex = dlist.IndexOf(copyData.NameRuleID); } else { comboBox2.SelectedIndex = -1; } } else { comboBox2.SelectedIndex = -1; } //更改顯示 textMingcheng.Text = copyData.measureMaintenanceName;//名稱 textBeizhu.Text = copyData.measureMaintenanceContent;//備注 List measureMaintenanceBasicDatas = new List(); for (int i = 0; i < copyData.measureMaintenanceBasicDataList.Count; i++) { MeasureMaintenanceBasicData measureMaintenanceFormula = new MeasureMaintenanceBasicData(); measureMaintenanceFormula.measureMaintenanceBasicDataIndex = copyData.measureMaintenanceBasicDataList[i].measureMaintenanceBasicDataIndex; measureMaintenanceFormula.measureMaintenanceBasicDataPosition = copyData.measureMaintenanceBasicDataList[i].measureMaintenanceBasicDataPosition; measureMaintenanceFormula.measureMaintenanceBasicDataValue = copyData.measureMaintenanceBasicDataList[i].measureMaintenanceBasicDataValue; measureMaintenanceBasicDatas.Add(measureMaintenanceFormula); } textLiaohao.Text = measureMaintenanceBasicDatas[0].measureMaintenanceBasicDataValue;//料號 textLiaohaoPosition.Text = measureMaintenanceBasicDatas[0].measureMaintenanceBasicDataPosition; if (string.IsNullOrEmpty(measureMaintenanceBasicDatas[1].measureMaintenanceBasicDataValue)) { comboBanci.SelectedIndex = -1;//班次 } else { comboBanci.SelectedItem = measureMaintenanceBasicDatas[1].measureMaintenanceBasicDataValue;//班次 } textBanciPosition.Text = measureMaintenanceBasicDatas[1].measureMaintenanceBasicDataPosition; if (string.IsNullOrEmpty(measureMaintenanceBasicDatas[2].measureMaintenanceBasicDataValue)) { comboShiyanshi.SelectedIndex = -1;//班次 } else { comboShiyanshi.SelectedItem = measureMaintenanceBasicDatas[2].measureMaintenanceBasicDataValue;//班次 } textShiyanshiPosition.Text = measureMaintenanceBasicDatas[2].measureMaintenanceBasicDataPosition; if (string.IsNullOrEmpty(measureMaintenanceBasicDatas[3].measureMaintenanceBasicDataValue)) { comboShiyongchangqu.SelectedIndex = -1;//班次 } else { comboShiyongchangqu.SelectedItem = measureMaintenanceBasicDatas[3].measureMaintenanceBasicDataValue;//班次 } textShiyongchangquPosition.Text = measureMaintenanceBasicDatas[3].measureMaintenanceBasicDataPosition; comboZhichengbie.SelectedItem = measureMaintenanceBasicDatas[4].measureMaintenanceBasicDataValue;//製成別 if (string.IsNullOrEmpty(measureMaintenanceBasicDatas[4].measureMaintenanceBasicDataValue)) { comboZhichengbie.SelectedIndex = -1;//班次 } else { comboZhichengbie.SelectedItem = measureMaintenanceBasicDatas[4].measureMaintenanceBasicDataValue;//班次 } textZhichengbiePosition.Text = measureMaintenanceBasicDatas[4].measureMaintenanceBasicDataPosition; textDanhao.Text = measureMaintenanceBasicDatas[5].measureMaintenanceBasicDataValue;//單號 textDanhaoPosition.Text = measureMaintenanceBasicDatas[5].measureMaintenanceBasicDataPosition; textPihao.Text = measureMaintenanceBasicDatas[6].measureMaintenanceBasicDataValue;//批號 textPihaoPosition.Text = measureMaintenanceBasicDatas[6].measureMaintenanceBasicDataPosition; if (string.IsNullOrEmpty(measureMaintenanceBasicDatas[7].measureMaintenanceBasicDataValue)) { comboCengbie.SelectedIndex = -1;//班次 } else { comboCengbie.SelectedItem = measureMaintenanceBasicDatas[7].measureMaintenanceBasicDataValue;//班次 } textCengbiePosition.Text = measureMaintenanceBasicDatas[7].measureMaintenanceBasicDataPosition; comboDianduxianbie.Text = measureMaintenanceBasicDatas[8].measureMaintenanceBasicDataValue;//電鍍綫別 textDianduxianbiePosition.Text = measureMaintenanceBasicDatas[8].measureMaintenanceBasicDataPosition; textDanwei.Text = measureMaintenanceBasicDatas[9].measureMaintenanceBasicDataValue;//單位 textDanweiPosition.Text = measureMaintenanceBasicDatas[9].measureMaintenanceBasicDataPosition; //UNDONE:由于数据问题,暂时为try-catch try { textBoxDatePos.Text = copyData.measureMaintenanceBasicDataList[10].measureMaintenanceBasicDataPosition;//报告日期 } catch { var mData = new MeasureMaintenanceBasicData(); mData.measureMaintenanceBasicDataIndex = 10; mData.measureMaintenanceBasicDataPosition = "NowDateTime"; copyData.measureMaintenanceBasicDataList.Add(mData); } textOutNumber.Text = copyData.outputPicturesNum.ToString();//輸出圖片數量 textModel.Text = copyData.templateFilePath; this.everyFourmulaList.Clear(); List measureMaintenanceFormulas = new List(); for (int i = 0; i < copyData.MeasureMaintenanceTreeFourthDataList.Count; i++) { MeasureMaintenanceFormula measureMaintenanceFormula = new MeasureMaintenanceFormula(); measureMaintenanceFormula.FatherHoleTypeId = copyData.MeasureMaintenanceTreeFourthDataList[i].FatherHoleTypeId; measureMaintenanceFormula.FormulaExpression = copyData.MeasureMaintenanceTreeFourthDataList[i].FormulaExpression; measureMaintenanceFormula.FormulaExpressionLineID = copyData.MeasureMaintenanceTreeFourthDataList[i].FormulaExpressionLineID; measureMaintenanceFormula.FormulaId = copyData.MeasureMaintenanceTreeFourthDataList[i].FormulaId; measureMaintenanceFormula.FormulaName = copyData.MeasureMaintenanceTreeFourthDataList[i].FormulaName; measureMaintenanceFormula.FormulaParentId = copyData.MeasureMaintenanceTreeFourthDataList[i].FormulaParentId; measureMaintenanceFormula.HoleType = copyData.MeasureMaintenanceTreeFourthDataList[i].HoleType; measureMaintenanceFormula.HoleTypeId = copyData.MeasureMaintenanceTreeFourthDataList[i].HoleTypeId; measureMaintenanceFormula.isConductiveCloth = copyData.MeasureMaintenanceTreeFourthDataList[i].isConductiveCloth; measureMaintenanceFormula.isFanweibuchang = copyData.MeasureMaintenanceTreeFourthDataList[i].isFanweibuchang; measureMaintenanceFormula.isErzhichuli = copyData.MeasureMaintenanceTreeFourthDataList[i].isErzhichuli; measureMaintenanceFormula.Specification = copyData.MeasureMaintenanceTreeFourthDataList[i].Specification; measureMaintenanceFormula.TestItems = copyData.MeasureMaintenanceTreeFourthDataList[i].TestItems; measureMaintenanceFormulas.Add(measureMaintenanceFormula); } this.everyFourmulaList.AddRange(measureMaintenanceFormulas); OutInfoShow(); } /// /// 写入XML /// public void WriteXml() { string filePath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\MeasureMaintenanceTypeList.xml"; string stageModelXml = XmlSerializeHelper.XmlSerialize(measureMaintenanceTypeList); FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create); //清空未命名XMl string path = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\MeasureMaintenanceType\\.xml"; if (System.IO.File.Exists(path)) { try { string newpath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\MeasureMaintenanceType\\"+ this.textMingcheng.Text +".xml"; System.IO.File.Move(path, newpath); } catch (Exception) { } } } /// /// 讀取基本信息 /// private void ReadXml2() { XmlDocument xDoc = new XmlDocument(); string filePath = Application.StartupPath + "\\Config\\" + Program.instance.SettingPrefix + "\\basicInformation.xml"; if (System.IO.File.Exists(filePath)) { xDoc.Load(filePath); } else { XmlDeclaration declaration = xDoc.CreateXmlDeclaration("1.0", "UTF-8", "yes"); xDoc.AppendChild(declaration); //根结点 XmlElement genjiedian = xDoc.CreateElement("leixings"); xDoc.AppendChild(genjiedian); //规程结点 for (int i = 0; i < 6; i++) { XmlElement leixing = xDoc.CreateElement("類型"); genjiedian.AppendChild(leixing); } xDoc.Save(filePath); } XmlNode rootNode = xDoc.SelectSingleNode("leixings"); XmlNodeList leixingList = rootNode.ChildNodes; for (int i = 0; i < leixingList.Count; i++) { XmlNodeList leixingChild = leixingList[i].ChildNodes; List strList = new List(); for (int j = 0; j < leixingChild.Count; j++) { string mingcheng = leixingChild[j].InnerText; strList.Add(mingcheng); } switch (i) { case 0: comboShiyongchangqu.DataSource = strList; break; case 1: comboShiyanshi.DataSource = strList; break; case 2: comboCengbie.DataSource = strList; break; case 3: comboZhichengbie.DataSource = strList; break; case 4: comboBanci.DataSource = strList; break; //case 5: // comboDianduxianbie.DataSource = strList; // break; } } } /// /// 輸出信息顯示 /// private void OutInfoShow() { panelOutInfo.Controls.Clear(); int height = 38; int width = (groupOutInfo.Size.Width - 14) / 4; string[] titles = { PdnResources.GetString("Pass"), PdnResources.GetString("InspectionItem"), PdnResources.GetString("Size"), PdnResources.GetString("MeasuringPos") }; // 孔型 檢驗項目 規格 測量位置 string[] titleNames = { "kongxing", "jianyanxiangmu", "guige", "celiangweizhi" }; List