AnalyzeSettingDialog.cs 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975
  1. using PaintDotNet.Base.Functionodel;
  2. using PaintDotNet.Base.CommTool;
  3. using PaintDotNet.CustomControl;
  4. using PaintDotNet.DbOpreate.DbBll;
  5. using PaintDotNet.DbOpreate.DbModel;
  6. using PaintDotNet.Base.SettingModel;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.IO;
  10. using System.Linq;
  11. using System.Windows.Forms;
  12. using static PaintDotNet.Base.Functionodel.AnalyzeSettingModel;
  13. namespace PaintDotNet
  14. {
  15. /// <summary>
  16. /// 通用分析模板设置页
  17. /// </summary>
  18. internal class AnalyzeSettingDialog : PdnBaseForm
  19. {
  20. #region 控件
  21. private GroupBox groupBox1;
  22. private Button button2;
  23. private Button button1;
  24. private GroupBox groupBox2;
  25. private ComboBox comboBox1;
  26. private Label label3;
  27. private Label label2;
  28. private Label label1;
  29. private GroupBox groupBox3;
  30. private GroupBox groupBox4;
  31. private GroupBox groupBox5;
  32. private Button button3;
  33. private TextBox textBox1;
  34. private Label label6;
  35. private Label label5;
  36. private Label label4;
  37. private TextBox textBox2;
  38. private Label label8;
  39. private Label label7;
  40. private Label label12;
  41. private TextBox textBox6;
  42. private Label label11;
  43. private TextBox textBox5;
  44. private Label label10;
  45. private TextBox textBox4;
  46. private Label label9;
  47. private DataGridView dataGridView1;
  48. private TextBox textBox9;
  49. private Label label14;
  50. private TextBox textBox8;
  51. private Label label13;
  52. private Button button4;
  53. private DateTimePicker dateTimePicker1;
  54. private DateTimePicker dateTimePicker2;
  55. private GroupBox groupBox6;
  56. private Button button5;
  57. #endregion
  58. /// <summary>
  59. /// 数据库对应字段
  60. /// </summary>
  61. private string languageName;
  62. /// <summary>
  63. /// 数据库对应list
  64. /// </summary>
  65. private List<mic_template_infos> infosList;
  66. /// <summary>
  67. /// 功能路径名称,因需递归作为全局对象
  68. /// </summary>
  69. private string functionPathMsg;
  70. /// <summary>
  71. /// 分类名称,主要供书签使用
  72. /// </summary>
  73. private string analyzeClassify;
  74. /// <summary>
  75. /// 调用当前窗口的对象
  76. /// </summary>
  77. private PdnBaseForm pdnBaseForm;
  78. /// <summary>
  79. /// 在打开窗体时辅助判断是否存在报告模板文件
  80. /// </summary>
  81. public bool hasModule = false;
  82. /// <summary>
  83. /// xml对应文件路径
  84. /// </summary>
  85. private string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\" + "AnalyzeSavedModel.xml";
  86. /// <summary>
  87. /// xml对象
  88. /// </summary>
  89. private AnalyzeSavedModel analyzeSavedModel;
  90. /// <summary>
  91. /// 当前分析分类的数据
  92. /// </summary>
  93. private AnalyzeSavedModel.ModelItem analyzeModel;
  94. public AnalyzeSettingDialog(PdnBaseForm form, string languageName)
  95. {
  96. this.languageName = languageName;
  97. this.pdnBaseForm = form;
  98. infosList = mic_template_infos_BLL.FindAll();//查询出所有模板分类对象
  99. InitializeComponent();
  100. InitializeLanguageText();
  101. InitGridHeader();
  102. InitOtherInfo();
  103. InitLastTimeInfo();
  104. //if (this.languageName == "Template.Manager.item2.AtlasComparison")
  105. // this.button5.Enabled = false;
  106. }
  107. #region 初始化
  108. private void InitializeLanguageText()
  109. {
  110. this.button5.Text = PdnResources.GetString("Menu.Configurehebookmark.Text");
  111. this.label3.Text = PdnResources.GetString("Menu.Pleaseselectthetemplateyoucanuse.Text") + ":";
  112. this.label2.Text = PdnResources.GetString("Menu.nothing.Text");
  113. this.label1.Text = PdnResources.GetString("Menu.Thefunctionpath.Text") + ":";
  114. this.groupBox3.Text = PdnResources.GetString("Menu.Itemstoragepathselection.Text");
  115. this.label6.Text = PdnResources.GetString("Menu.nothing.Text");
  116. this.label5.Text = PdnResources.GetString("Menu.Thespecificpath.Text") + ":";
  117. this.label4.Text = PdnResources.GetString("Menu.Storagepath.Text") + ":";
  118. this.groupBox4.Text = PdnResources.GetString("Menu.thebasicinformationofproject.text");
  119. this.label8.Text = PdnResources.GetString("Menu.projectnumber.text") + ":";
  120. this.label7.Text = PdnResources.GetString("Menu.Ratingdate.text") + ":";
  121. this.groupBox5.Text = PdnResources.GetString("Menu.Ratingdate.text");
  122. this.label12.Text = PdnResources.GetString("Menu.Inspectiondate.text") + ":";
  123. this.label11.Text = PdnResources.GetString("Menu.Contactperson.text") + ":";
  124. this.label10.Text = PdnResources.GetString("Menu.inspectiondepartment.text") + ":";
  125. this.label9.Text = PdnResources.GetString("Menu.Sender.text") + ":";
  126. this.groupBox6.Text = PdnResources.GetString("Menu.other.text");
  127. this.label14.Text = PdnResources.GetString("Menu.name.text") + ":";
  128. this.label13.Text = PdnResources.GetString("Menu.content.text") + ":";
  129. this.button4.Text = PdnResources.GetString("Menu.Addto.text");
  130. this.Text = PdnResources.GetString("Menu.Analysisofsetting.Text");
  131. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  132. this.button2.Text = PdnResources.GetString("Menu.File.Save.Text");
  133. this.button1.Text = PdnResources.GetString("Menu.File.Close.Text");
  134. this.groupBox2.Text = PdnResources.GetString("Menu.Reporttemplateselection.Text");
  135. }
  136. private void InitializeComponent()
  137. {
  138. this.groupBox1 = new System.Windows.Forms.GroupBox();
  139. this.button2 = new System.Windows.Forms.Button();
  140. this.button1 = new System.Windows.Forms.Button();
  141. this.groupBox2 = new System.Windows.Forms.GroupBox();
  142. this.button5 = new System.Windows.Forms.Button();
  143. this.comboBox1 = new System.Windows.Forms.ComboBox();
  144. this.label3 = new System.Windows.Forms.Label();
  145. this.label2 = new System.Windows.Forms.Label();
  146. this.label1 = new System.Windows.Forms.Label();
  147. this.groupBox3 = new System.Windows.Forms.GroupBox();
  148. this.button3 = new System.Windows.Forms.Button();
  149. this.textBox1 = new System.Windows.Forms.TextBox();
  150. this.label6 = new System.Windows.Forms.Label();
  151. this.label5 = new System.Windows.Forms.Label();
  152. this.label4 = new System.Windows.Forms.Label();
  153. this.groupBox4 = new System.Windows.Forms.GroupBox();
  154. this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
  155. this.textBox2 = new System.Windows.Forms.TextBox();
  156. this.label8 = new System.Windows.Forms.Label();
  157. this.label7 = new System.Windows.Forms.Label();
  158. this.groupBox5 = new System.Windows.Forms.GroupBox();
  159. this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker();
  160. this.label12 = new System.Windows.Forms.Label();
  161. this.textBox6 = new System.Windows.Forms.TextBox();
  162. this.label11 = new System.Windows.Forms.Label();
  163. this.textBox5 = new System.Windows.Forms.TextBox();
  164. this.label10 = new System.Windows.Forms.Label();
  165. this.textBox4 = new System.Windows.Forms.TextBox();
  166. this.label9 = new System.Windows.Forms.Label();
  167. this.groupBox6 = new System.Windows.Forms.GroupBox();
  168. this.dataGridView1 = new System.Windows.Forms.DataGridView();
  169. this.textBox9 = new System.Windows.Forms.TextBox();
  170. this.label14 = new System.Windows.Forms.Label();
  171. this.textBox8 = new System.Windows.Forms.TextBox();
  172. this.label13 = new System.Windows.Forms.Label();
  173. this.button4 = new System.Windows.Forms.Button();
  174. this.groupBox1.SuspendLayout();
  175. this.groupBox2.SuspendLayout();
  176. this.groupBox3.SuspendLayout();
  177. this.groupBox4.SuspendLayout();
  178. this.groupBox5.SuspendLayout();
  179. this.groupBox6.SuspendLayout();
  180. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
  181. this.SuspendLayout();
  182. //
  183. // groupBox1
  184. //
  185. this.groupBox1.Controls.Add(this.button2);
  186. this.groupBox1.Controls.Add(this.button1);
  187. this.groupBox1.Location = new System.Drawing.Point(12, 4);
  188. this.groupBox1.Name = "groupBox1";
  189. this.groupBox1.Size = new System.Drawing.Size(542, 49);
  190. this.groupBox1.TabIndex = 0;
  191. this.groupBox1.TabStop = false;
  192. this.groupBox1.Text = "操作";
  193. //
  194. // button2
  195. //
  196. this.button2.BackColor = System.Drawing.SystemColors.Control;
  197. this.button2.Location = new System.Drawing.Point(451, 12);
  198. this.button2.Name = "button2";
  199. this.button2.Size = new System.Drawing.Size(76, 30);
  200. this.button2.TabIndex = 1;
  201. this.button2.Text = "保存";
  202. this.button2.UseVisualStyleBackColor = false;
  203. this.button2.Click += new System.EventHandler(this.button2_Click);
  204. //
  205. // button1
  206. //
  207. this.button1.BackColor = System.Drawing.SystemColors.Control;
  208. this.button1.Location = new System.Drawing.Point(355, 12);
  209. this.button1.Name = "button1";
  210. this.button1.Size = new System.Drawing.Size(76, 30);
  211. this.button1.TabIndex = 0;
  212. this.button1.Text = "关闭";
  213. this.button1.UseVisualStyleBackColor = false;
  214. this.button1.Click += new System.EventHandler(this.button1_Click);
  215. //
  216. // groupBox2
  217. //
  218. this.groupBox2.Controls.Add(this.button5);
  219. this.groupBox2.Controls.Add(this.comboBox1);
  220. this.groupBox2.Controls.Add(this.label3);
  221. this.groupBox2.Controls.Add(this.label2);
  222. this.groupBox2.Controls.Add(this.label1);
  223. this.groupBox2.Location = new System.Drawing.Point(12, 56);
  224. this.groupBox2.Name = "groupBox2";
  225. this.groupBox2.Size = new System.Drawing.Size(542, 90);
  226. this.groupBox2.TabIndex = 1;
  227. this.groupBox2.TabStop = false;
  228. this.groupBox2.Text = "报告模板选择";
  229. //
  230. // button5
  231. //
  232. this.button5.Location = new System.Drawing.Point(463, 63);
  233. this.button5.Name = "button5";
  234. this.button5.Size = new System.Drawing.Size(73, 20);
  235. this.button5.TabIndex = 4;
  236. this.button5.Text = "配置书签";
  237. this.button5.UseVisualStyleBackColor = true;
  238. this.button5.Click += new System.EventHandler(this.button5_Click);
  239. //
  240. // comboBox1
  241. //
  242. this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  243. this.comboBox1.FormattingEnabled = true;
  244. this.comboBox1.Location = new System.Drawing.Point(163, 63);
  245. this.comboBox1.Name = "comboBox1";
  246. this.comboBox1.Size = new System.Drawing.Size(298, 20);
  247. this.comboBox1.TabIndex = 3;
  248. //
  249. // label3
  250. //
  251. this.label3.AutoSize = true;
  252. this.label3.ForeColor = System.Drawing.SystemColors.ControlText;
  253. this.label3.Location = new System.Drawing.Point(15, 68);
  254. this.label3.Name = "label3";
  255. this.label3.Size = new System.Drawing.Size(125, 12);
  256. this.label3.TabIndex = 2;
  257. this.label3.Text = "请选择可使用的模板:";
  258. //
  259. // label2
  260. //
  261. this.label2.ForeColor = System.Drawing.SystemColors.ControlText;
  262. this.label2.Location = new System.Drawing.Point(163, 26);
  263. this.label2.Name = "label2";
  264. this.label2.Size = new System.Drawing.Size(373, 34);
  265. this.label2.TabIndex = 1;
  266. //
  267. // label1
  268. //
  269. this.label1.AutoSize = true;
  270. this.label1.ForeColor = System.Drawing.SystemColors.ControlText;
  271. this.label1.Location = new System.Drawing.Point(15, 26);
  272. this.label1.Name = "label1";
  273. this.label1.Size = new System.Drawing.Size(65, 12);
  274. this.label1.TabIndex = 0;
  275. this.label1.Text = "功能路径:";
  276. //
  277. // groupBox3
  278. //
  279. this.groupBox3.Controls.Add(this.button3);
  280. this.groupBox3.Controls.Add(this.textBox1);
  281. this.groupBox3.Controls.Add(this.label6);
  282. this.groupBox3.Controls.Add(this.label5);
  283. this.groupBox3.Controls.Add(this.label4);
  284. this.groupBox3.Location = new System.Drawing.Point(12, 162);
  285. this.groupBox3.Name = "groupBox3";
  286. this.groupBox3.Size = new System.Drawing.Size(542, 90);
  287. this.groupBox3.TabIndex = 1;
  288. this.groupBox3.TabStop = false;
  289. this.groupBox3.Text = "项目储存路径选择";
  290. //
  291. // button3
  292. //
  293. this.button3.BackColor = System.Drawing.SystemColors.Window;
  294. this.button3.Font = new System.Drawing.Font("宋体", 6F);
  295. this.button3.Location = new System.Drawing.Point(498, 63);
  296. this.button3.Name = "button3";
  297. this.button3.Size = new System.Drawing.Size(29, 21);
  298. this.button3.TabIndex = 5;
  299. this.button3.Text = "...";
  300. this.button3.UseVisualStyleBackColor = false;
  301. this.button3.Click += new System.EventHandler(this.button3_Click);
  302. //
  303. // textBox1
  304. //
  305. this.textBox1.Location = new System.Drawing.Point(103, 63);
  306. this.textBox1.Name = "textBox1";
  307. this.textBox1.ReadOnly = true;
  308. this.textBox1.Size = new System.Drawing.Size(400, 21);
  309. this.textBox1.TabIndex = 4;
  310. //
  311. // label6
  312. //
  313. this.label6.ForeColor = System.Drawing.SystemColors.ControlText;
  314. this.label6.Location = new System.Drawing.Point(93, 25);
  315. this.label6.Name = "label6";
  316. this.label6.Size = new System.Drawing.Size(434, 35);
  317. this.label6.TabIndex = 3;
  318. //
  319. // label5
  320. //
  321. this.label5.AutoSize = true;
  322. this.label5.ForeColor = System.Drawing.SystemColors.ControlText;
  323. this.label5.Location = new System.Drawing.Point(15, 69);
  324. this.label5.Name = "label5";
  325. this.label5.Size = new System.Drawing.Size(65, 12);
  326. this.label5.TabIndex = 2;
  327. this.label5.Text = "具体路径:";
  328. //
  329. // label4
  330. //
  331. this.label4.AutoSize = true;
  332. this.label4.ForeColor = System.Drawing.SystemColors.ControlText;
  333. this.label4.Location = new System.Drawing.Point(15, 25);
  334. this.label4.Name = "label4";
  335. this.label4.Size = new System.Drawing.Size(65, 12);
  336. this.label4.TabIndex = 1;
  337. this.label4.Text = "储存路径:";
  338. //
  339. // groupBox4
  340. //
  341. this.groupBox4.Controls.Add(this.dateTimePicker1);
  342. this.groupBox4.Controls.Add(this.textBox2);
  343. this.groupBox4.Controls.Add(this.label8);
  344. this.groupBox4.Controls.Add(this.label7);
  345. this.groupBox4.Location = new System.Drawing.Point(12, 258);
  346. this.groupBox4.Name = "groupBox4";
  347. this.groupBox4.Size = new System.Drawing.Size(542, 52);
  348. this.groupBox4.TabIndex = 1;
  349. this.groupBox4.TabStop = false;
  350. this.groupBox4.Text = "项目基本信息";
  351. //
  352. // dateTimePicker1
  353. //
  354. this.dateTimePicker1.Location = new System.Drawing.Point(363, 24);
  355. this.dateTimePicker1.Name = "dateTimePicker1";
  356. this.dateTimePicker1.Size = new System.Drawing.Size(165, 21);
  357. this.dateTimePicker1.TabIndex = 6;
  358. //
  359. // textBox2
  360. //
  361. this.textBox2.Location = new System.Drawing.Point(92, 24);
  362. this.textBox2.Name = "textBox2";
  363. this.textBox2.Size = new System.Drawing.Size(165, 21);
  364. this.textBox2.TabIndex = 5;
  365. //
  366. // label8
  367. //
  368. this.label8.AutoSize = true;
  369. this.label8.ForeColor = System.Drawing.SystemColors.ControlText;
  370. this.label8.Location = new System.Drawing.Point(15, 28);
  371. this.label8.Name = "label8";
  372. this.label8.Size = new System.Drawing.Size(65, 12);
  373. this.label8.TabIndex = 4;
  374. this.label8.Text = "项目编号:";
  375. //
  376. // label7
  377. //
  378. this.label7.AutoSize = true;
  379. this.label7.ForeColor = System.Drawing.SystemColors.ControlText;
  380. this.label7.Location = new System.Drawing.Point(277, 28);
  381. this.label7.Name = "label7";
  382. this.label7.Size = new System.Drawing.Size(65, 12);
  383. this.label7.TabIndex = 3;
  384. this.label7.Text = "评级日期:";
  385. //
  386. // groupBox5
  387. //
  388. this.groupBox5.Controls.Add(this.dateTimePicker2);
  389. this.groupBox5.Controls.Add(this.label12);
  390. this.groupBox5.Controls.Add(this.textBox6);
  391. this.groupBox5.Controls.Add(this.label11);
  392. this.groupBox5.Controls.Add(this.textBox5);
  393. this.groupBox5.Controls.Add(this.label10);
  394. this.groupBox5.Controls.Add(this.textBox4);
  395. this.groupBox5.Controls.Add(this.label9);
  396. this.groupBox5.Location = new System.Drawing.Point(12, 316);
  397. this.groupBox5.Name = "groupBox5";
  398. this.groupBox5.Size = new System.Drawing.Size(542, 89);
  399. this.groupBox5.TabIndex = 1;
  400. this.groupBox5.TabStop = false;
  401. this.groupBox5.Text = "评级日期";
  402. //
  403. // dateTimePicker2
  404. //
  405. this.dateTimePicker2.Location = new System.Drawing.Point(363, 58);
  406. this.dateTimePicker2.Name = "dateTimePicker2";
  407. this.dateTimePicker2.Size = new System.Drawing.Size(165, 21);
  408. this.dateTimePicker2.TabIndex = 14;
  409. //
  410. // label12
  411. //
  412. this.label12.AutoSize = true;
  413. this.label12.ForeColor = System.Drawing.SystemColors.ControlText;
  414. this.label12.Location = new System.Drawing.Point(277, 62);
  415. this.label12.Name = "label12";
  416. this.label12.Size = new System.Drawing.Size(59, 12);
  417. this.label12.TabIndex = 13;
  418. this.label12.Text = "送检日期:";
  419. //
  420. // textBox6
  421. //
  422. this.textBox6.Location = new System.Drawing.Point(363, 23);
  423. this.textBox6.Name = "textBox6";
  424. this.textBox6.Size = new System.Drawing.Size(165, 21);
  425. this.textBox6.TabIndex = 12;
  426. //
  427. // label11
  428. //
  429. this.label11.AutoSize = true;
  430. this.label11.ForeColor = System.Drawing.SystemColors.ControlText;
  431. this.label11.Location = new System.Drawing.Point(277, 28);
  432. this.label11.Name = "label11";
  433. this.label11.Size = new System.Drawing.Size(53, 12);
  434. this.label11.TabIndex = 11;
  435. this.label11.Text = "联系人:";
  436. //
  437. // textBox5
  438. //
  439. this.textBox5.Location = new System.Drawing.Point(92, 58);
  440. this.textBox5.Name = "textBox5";
  441. this.textBox5.Size = new System.Drawing.Size(165, 21);
  442. this.textBox5.TabIndex = 10;
  443. //
  444. // label10
  445. //
  446. this.label10.AutoSize = true;
  447. this.label10.ForeColor = System.Drawing.SystemColors.ControlText;
  448. this.label10.Location = new System.Drawing.Point(15, 62);
  449. this.label10.Name = "label10";
  450. this.label10.Size = new System.Drawing.Size(65, 12);
  451. this.label10.TabIndex = 9;
  452. this.label10.Text = "送检单位:";
  453. //
  454. // textBox4
  455. //
  456. this.textBox4.Location = new System.Drawing.Point(92, 23);
  457. this.textBox4.Name = "textBox4";
  458. this.textBox4.Size = new System.Drawing.Size(165, 21);
  459. this.textBox4.TabIndex = 8;
  460. //
  461. // label9
  462. //
  463. this.label9.AutoSize = true;
  464. this.label9.ForeColor = System.Drawing.SystemColors.ControlText;
  465. this.label9.Location = new System.Drawing.Point(15, 28);
  466. this.label9.Name = "label9";
  467. this.label9.Size = new System.Drawing.Size(53, 12);
  468. this.label9.TabIndex = 7;
  469. this.label9.Text = "送检人:";
  470. //
  471. // groupBox6
  472. //
  473. this.groupBox6.Controls.Add(this.dataGridView1);
  474. this.groupBox6.Controls.Add(this.textBox9);
  475. this.groupBox6.Controls.Add(this.label14);
  476. this.groupBox6.Controls.Add(this.textBox8);
  477. this.groupBox6.Controls.Add(this.label13);
  478. this.groupBox6.Controls.Add(this.button4);
  479. this.groupBox6.Location = new System.Drawing.Point(12, 411);
  480. this.groupBox6.Name = "groupBox6";
  481. this.groupBox6.Size = new System.Drawing.Size(542, 208);
  482. this.groupBox6.TabIndex = 1;
  483. this.groupBox6.TabStop = false;
  484. this.groupBox6.Text = "其他";
  485. //
  486. // dataGridView1
  487. //
  488. this.dataGridView1.AllowUserToAddRows = false;
  489. this.dataGridView1.AllowUserToDeleteRows = false;
  490. this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
  491. | System.Windows.Forms.AnchorStyles.Right)));
  492. this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  493. this.dataGridView1.BackgroundColor = System.Drawing.Color.White;
  494. this.dataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
  495. this.dataGridView1.Location = new System.Drawing.Point(16, 57);
  496. this.dataGridView1.MultiSelect = false;
  497. this.dataGridView1.Name = "dataGridView1";
  498. this.dataGridView1.RowHeadersVisible = false;
  499. this.dataGridView1.RowTemplate.Height = 23;
  500. this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
  501. this.dataGridView1.Size = new System.Drawing.Size(511, 141);
  502. this.dataGridView1.TabIndex = 19;
  503. this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick);
  504. //
  505. // textBox9
  506. //
  507. this.textBox9.Location = new System.Drawing.Point(55, 30);
  508. this.textBox9.Name = "textBox9";
  509. this.textBox9.Size = new System.Drawing.Size(165, 21);
  510. this.textBox9.TabIndex = 18;
  511. //
  512. // label14
  513. //
  514. this.label14.AutoSize = true;
  515. this.label14.ForeColor = System.Drawing.SystemColors.ControlText;
  516. this.label14.Location = new System.Drawing.Point(14, 34);
  517. this.label14.Name = "label14";
  518. this.label14.Size = new System.Drawing.Size(41, 12);
  519. this.label14.TabIndex = 17;
  520. this.label14.Text = "名称:";
  521. //
  522. // textBox8
  523. //
  524. this.textBox8.Location = new System.Drawing.Point(275, 30);
  525. this.textBox8.Name = "textBox8";
  526. this.textBox8.Size = new System.Drawing.Size(165, 21);
  527. this.textBox8.TabIndex = 16;
  528. //
  529. // label13
  530. //
  531. this.label13.AutoSize = true;
  532. this.label13.ForeColor = System.Drawing.SystemColors.ControlText;
  533. this.label13.Location = new System.Drawing.Point(228, 34);
  534. this.label13.Name = "label13";
  535. this.label13.Size = new System.Drawing.Size(41, 12);
  536. this.label13.TabIndex = 15;
  537. this.label13.Text = "内容:";
  538. //
  539. // button4
  540. //
  541. this.button4.BackColor = System.Drawing.SystemColors.Control;
  542. this.button4.Location = new System.Drawing.Point(451, 25);
  543. this.button4.Name = "button4";
  544. this.button4.Size = new System.Drawing.Size(76, 30);
  545. this.button4.TabIndex = 2;
  546. this.button4.Text = "添加";
  547. this.button4.UseVisualStyleBackColor = false;
  548. this.button4.Click += new System.EventHandler(this.button4_Click);
  549. //
  550. // AnalyzeSettingDialog
  551. //
  552. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  553. this.BackColor = System.Drawing.SystemColors.Control;
  554. this.ClientSize = new System.Drawing.Size(566, 651);
  555. this.Controls.Add(this.groupBox6);
  556. this.Controls.Add(this.groupBox5);
  557. this.Controls.Add(this.groupBox4);
  558. this.Controls.Add(this.groupBox3);
  559. this.Controls.Add(this.groupBox2);
  560. this.Controls.Add(this.groupBox1);
  561. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  562. this.MaximizeBox = false;
  563. this.MinimizeBox = false;
  564. this.Name = "AnalyzeSettingDialog";
  565. this.Controls.SetChildIndex(this.groupBox1, 0);
  566. this.Controls.SetChildIndex(this.groupBox2, 0);
  567. this.Controls.SetChildIndex(this.groupBox3, 0);
  568. this.Controls.SetChildIndex(this.groupBox4, 0);
  569. this.Controls.SetChildIndex(this.groupBox5, 0);
  570. this.Controls.SetChildIndex(this.groupBox6, 0);
  571. this.groupBox1.ResumeLayout(false);
  572. this.groupBox2.ResumeLayout(false);
  573. this.groupBox2.PerformLayout();
  574. this.groupBox3.ResumeLayout(false);
  575. this.groupBox3.PerformLayout();
  576. this.groupBox4.ResumeLayout(false);
  577. this.groupBox4.PerformLayout();
  578. this.groupBox5.ResumeLayout(false);
  579. this.groupBox5.PerformLayout();
  580. this.groupBox6.ResumeLayout(false);
  581. this.groupBox6.PerformLayout();
  582. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
  583. this.ResumeLayout(false);
  584. }
  585. /// <summary>
  586. /// 初始化表头
  587. /// </summary>
  588. private void InitGridHeader()
  589. {
  590. this.dataGridView1.ColumnHeadersHeight = 25;
  591. DataGridViewTextBoxColumn h1 = new DataGridViewTextBoxColumn();
  592. h1.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  593. h1.Width = 200;
  594. DataGridViewTextBoxColumn h2 = new DataGridViewTextBoxColumn();
  595. h2.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  596. h2.Width = 200;
  597. DataGridViewButtonColumn h3 = new DataGridViewButtonColumn();
  598. h3.Width = 90;
  599. this.dataGridView1.Columns.Add(h1);
  600. this.dataGridView1.Columns.Add(h2);
  601. this.dataGridView1.Columns.Add(h3);
  602. DataGridViewHelper helper = new DataGridViewHelper(this.dataGridView1);
  603. helper.Headers.Add(new DataGridViewHelper.TopHeader(0, 1, PdnResources.GetString("Menu.name.text")));
  604. helper.Headers.Add(new DataGridViewHelper.TopHeader(1, 1, PdnResources.GetString("Menu.content.text")));
  605. helper.Headers.Add(new DataGridViewHelper.TopHeader(2, 1, PdnResources.GetString("Menu.operation.text")));
  606. this.dataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
  607. this.dataGridView1.Columns[0].ReadOnly = true;
  608. this.dataGridView1.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
  609. this.dataGridView1.Columns[1].ReadOnly = true;
  610. this.dataGridView1.AllowUserToResizeRows = false;
  611. this.dataGridView1.AllowUserToResizeColumns = false;
  612. }
  613. /// <summary>
  614. /// 初始化其他信息
  615. /// </summary>
  616. private void InitOtherInfo()
  617. {
  618. //设置功能路径名称
  619. if (this.languageName.Contains("Template.Manager"))
  620. functionPathMsg = PdnResources.GetString(this.languageName);
  621. else
  622. functionPathMsg = this.languageName;
  623. this.analyzeClassify = functionPathMsg;
  624. this.Text = this.analyzeClassify + PdnResources.GetString("Menu.Thereportisset.Text");
  625. getFullLanguagePath(this.languageName);
  626. this.label2.Text = functionPathMsg;
  627. //设置模板下拉菜单
  628. mic_template_infos infoModel = infosList.Find(a => a.language_name == this.languageName);
  629. string filePath = Application.StartupPath + "\\ModuleManage" + infoModel.template_path.Replace('/', '\\');//获取文档路径
  630. if (Directory.Exists(filePath))
  631. {
  632. string[] fileNames = Directory.GetFiles(filePath);
  633. Dictionary<string, string> moduleInfo = new Dictionary<string, string>();
  634. for (int i = 0; i < fileNames.Count(); i++)
  635. {
  636. //编辑时产生的临时文件,不统计
  637. if (Path.GetFileName(fileNames[i]).Contains("~$"))
  638. continue;
  639. //判断是word文件
  640. if (FileOperationHelper.IsFileWordOrExcel(fileNames[i]) == 1)
  641. moduleInfo.Add(Path.GetFileNameWithoutExtension(fileNames[i]), fileNames[i]);
  642. }
  643. //绑定下拉菜单
  644. if (moduleInfo.Count > 0)
  645. {
  646. BindingSource bs = new BindingSource();
  647. bs.DataSource = moduleInfo;
  648. this.comboBox1.DataSource = bs;
  649. this.comboBox1.ValueMember = "Value";
  650. this.comboBox1.DisplayMember = "Key";
  651. hasModule = true;
  652. }
  653. else
  654. MessageBox.Show(PdnResources.GetString("Menu.Therearenoatefirst.text"));
  655. }
  656. else
  657. MessageBox.Show(PdnResources.GetString("Menu.Therearenoatefirst.text"));
  658. //设置存储路径
  659. string[] savePathArr = infoModel.template_path.Split('/');//拆分以获取路径根目录的名称
  660. ConfigModel configModel = Startup.instance.configModel;
  661. if (savePathArr[1].Equals("Conventional"))
  662. this.label6.Text = configModel.NormalOperation;
  663. else if (savePathArr[1].Equals("Universal"))
  664. this.label6.Text = configModel.GeneralAnalysis;
  665. else if (savePathArr[1].Equals("Dedicated"))
  666. this.label6.Text = configModel.DedicatedAnalysis;
  667. else
  668. this.label6.Text = PdnResources.GetString("Menu.Pathacquisitionerror.Text");
  669. if (string.IsNullOrEmpty(this.label6.Text))
  670. this.label6.Text = PdnResources.GetString("Menu.Thestoragepathisnotset.Text");
  671. }
  672. /// <summary>
  673. /// 加载之前保存的信息
  674. /// </summary>
  675. private void InitLastTimeInfo()
  676. {
  677. if (this.hasModule && System.IO.File.Exists(filePath))
  678. {
  679. analyzeSavedModel = XmlSerializeHelper.DESerializer<AnalyzeSavedModel>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
  680. if(analyzeSavedModel.modelItems != null && analyzeSavedModel.modelItems.Count > 0)
  681. {
  682. analyzeModel = analyzeSavedModel.modelItems.Find(a => a.languageName == this.languageName);
  683. if (analyzeModel != null && analyzeModel.analyzeSettingModel != null)
  684. {
  685. if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.modulePath))
  686. this.comboBox1.SelectedValue = analyzeModel.analyzeSettingModel.modulePath;
  687. if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.savePath))
  688. this.textBox1.Text = analyzeModel.analyzeSettingModel.savePath;
  689. if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.itemNumber))
  690. this.textBox2.Text = analyzeModel.analyzeSettingModel.itemNumber;
  691. if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.inspectionPerson))
  692. this.textBox4.Text = analyzeModel.analyzeSettingModel.inspectionPerson;
  693. if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.contact))
  694. this.textBox6.Text = analyzeModel.analyzeSettingModel.contact;
  695. if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.inspectionDepartment))
  696. this.textBox5.Text = analyzeModel.analyzeSettingModel.inspectionDepartment;
  697. if (analyzeModel.analyzeSettingModel.inspectionDate != DateTime.MinValue)
  698. this.dateTimePicker2.Value = analyzeModel.analyzeSettingModel.inspectionDate;
  699. if (analyzeModel.analyzeSettingModel.otherList != null && analyzeModel.analyzeSettingModel.otherList.Count > 0)
  700. {
  701. foreach (OthersInfo info in analyzeModel.analyzeSettingModel.otherList)
  702. {
  703. DataGridViewRow row = new DataGridViewRow();
  704. row.Cells.Add(CreateTextBoxCell(info.name, "name"));
  705. row.Cells.Add(CreateTextBoxCell(info.content, "content"));
  706. row.Cells.Add(CreateButtonCell(PdnResources.GetString("Menu.Edit.Delete.Text"), "delete"));
  707. this.dataGridView1.Rows.Add(row);
  708. }
  709. this.dataGridView1.ClearSelection();
  710. }
  711. }
  712. }
  713. }
  714. }
  715. #endregion
  716. /// <summary>
  717. /// 递归拼接功能路径的全称
  718. /// </summary>
  719. /// <param name="name"></param>
  720. private void getFullLanguagePath(string name)
  721. {//Template.Manager.item3.GrainSizeCutOff6394Method
  722. mic_template_infos infoModel = infosList.Find(a => a.language_name == name);
  723. //如果有上级,查询出上级的name对应的实际名称,拼接到前面,然后继续递归
  724. if (infoModel.parent_id != 0)
  725. {
  726. string parentLanguageName = infosList.Find(a => a.id == infoModel.parent_id).language_name;
  727. if(parentLanguageName.Contains("Template.Manager"))
  728. functionPathMsg = PdnResources.GetString(parentLanguageName) + "-" + functionPathMsg;
  729. else
  730. functionPathMsg = parentLanguageName + "-" + functionPathMsg;
  731. getFullLanguagePath(parentLanguageName);
  732. }
  733. }
  734. /// <summary>
  735. /// 路径选择
  736. /// </summary>
  737. /// <param name="sender"></param>
  738. /// <param name="e"></param>
  739. private void button3_Click(object sender, EventArgs e)
  740. {
  741. FolderBrowserDialog dialog = new FolderBrowserDialog();
  742. //if (!this.label6.Text.Equals("路径获取错误") && !this.label6.Text.Equals("存储路径未设置") && !this.label6.Text.Equals("无"))
  743. //{
  744. // dialog.SelectedPath = this.label6.Text + "\\" + this.analyzeClassify + "\\";
  745. //}
  746. //else
  747. //{
  748. //
  749. //}
  750. dialog.SelectedPath = this.label6.Text;
  751. if (dialog.ShowDialog() == DialogResult.OK)
  752. {
  753. this.textBox1.Text = dialog.SelectedPath;
  754. }
  755. /*APIDialogs.CommonOpenFileDialog dialog = new APIDialogs.CommonOpenFileDialog();
  756. dialog.IsFolderPicker = true;
  757. dialog.EnsurePathExists = true;
  758. if(this.label6.Text.Equals("路径获取错误") || this.label6.Text.Equals("存储路径未设置") || this.label6.Text.Equals("无"))
  759. dialog.InitialDirectory = "C:\\";
  760. else
  761. dialog.InitialDirectory = this.label6.Text;
  762. if (dialog.ShowDialog() == APIDialogs.CommonFileDialogResult.Ok)
  763. {
  764. this.textBox1.Text = dialog.FileName;
  765. }*/
  766. }
  767. /// <summary>
  768. /// 关闭按钮
  769. /// </summary>
  770. /// <param name="sender"></param>
  771. /// <param name="e"></param>
  772. private void button1_Click(object sender, EventArgs e)
  773. {
  774. this.Close();
  775. }
  776. /// <summary>
  777. /// 保存按钮
  778. /// </summary>
  779. /// <param name="sender"></param>
  780. /// <param name="e"></param>
  781. private void button2_Click(object sender, EventArgs e)
  782. {
  783. if (string.IsNullOrEmpty(this.textBox1.Text))
  784. {
  785. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectaspecificstoragepath.text"));
  786. return;
  787. }
  788. if(this.comboBox1.SelectedValue == null)
  789. {
  790. MessageBox.Show(PdnResources.GetString("Menu.Therearenorecannotbesaved.text")+"!");
  791. return;
  792. }
  793. AnalyzeSettingModel model = new AnalyzeSettingModel();
  794. model.modulePath = this.comboBox1.SelectedValue.ToString();
  795. model.savePath = this.textBox1.Text;
  796. model.itemNumber = this.textBox2.Text;
  797. model.ratingDate = this.dateTimePicker1.Value;
  798. model.inspectionPerson = this.textBox4.Text;
  799. model.contact = this.textBox6.Text;
  800. model.inspectionDepartment = this.textBox5.Text;
  801. model.inspectionDate = this.dateTimePicker2.Value;
  802. model.analyzeClassify = this.analyzeClassify;
  803. if (this.dataGridView1.Rows.Count > 0)
  804. {
  805. model.otherList = new List<AnalyzeSettingModel.OthersInfo>();
  806. foreach (DataGridViewRow rowData in this.dataGridView1.Rows)
  807. {
  808. OthersInfo othersInfo = new OthersInfo();
  809. othersInfo.name = rowData.Cells[0].Value.ToString();
  810. othersInfo.content = rowData.Cells[1].Value.ToString();
  811. model.otherList.Add(othersInfo);
  812. }
  813. }
  814. if(analyzeSavedModel != null)
  815. {
  816. if (analyzeModel != null)
  817. analyzeModel.analyzeSettingModel = model;
  818. else
  819. {
  820. analyzeModel = new AnalyzeSavedModel.ModelItem();
  821. analyzeModel.languageName = this.languageName;
  822. analyzeModel.analyzeSettingModel = model;
  823. analyzeSavedModel.modelItems.Add(analyzeModel);
  824. }
  825. }
  826. else
  827. {
  828. analyzeSavedModel = new AnalyzeSavedModel();
  829. analyzeSavedModel.modelItems = new List<AnalyzeSavedModel.ModelItem>();
  830. analyzeModel = new AnalyzeSavedModel.ModelItem();
  831. analyzeModel.languageName = this.languageName;
  832. analyzeModel.analyzeSettingModel = model;
  833. analyzeSavedModel.modelItems.Add(analyzeModel);
  834. }
  835. //保存xml文件
  836. string savedModelInfo = XmlSerializeHelper.XmlSerialize<AnalyzeSavedModel>(analyzeSavedModel);
  837. if(FileOperationHelper.WriteStringToFile(savedModelInfo, filePath, FileMode.Create))
  838. {
  839. //将对象传递回调用页面
  840. this.pdnBaseForm.AnalyzeSettingModel = model;
  841. this.Close();
  842. }
  843. else
  844. {
  845. MessageBox.Show(PdnResources.GetString("Menu.Savefailed.text"));
  846. }
  847. }
  848. /// <summary>
  849. /// 添加按钮-其他
  850. /// </summary>
  851. /// <param name="sender"></param>
  852. /// <param name="e"></param>
  853. private void button4_Click(object sender, EventArgs e)
  854. {
  855. if(string.IsNullOrEmpty(this.textBox9.Text))
  856. {
  857. MessageBox.Show(PdnResources.GetString("Menu.Pleaseenteranameofthephase.text"));
  858. return;
  859. }
  860. if (string.IsNullOrEmpty(this.textBox8.Text))
  861. {
  862. MessageBox.Show(PdnResources.GetString("Menu.Pleaseentercontent.text"));
  863. return;
  864. }
  865. DataGridViewRow row = new DataGridViewRow();
  866. row.Cells.Add(CreateTextBoxCell(this.textBox9.Text, "name"));
  867. row.Cells.Add(CreateTextBoxCell(this.textBox8.Text, "content"));
  868. row.Cells.Add(CreateButtonCell(PdnResources.GetString("Menu.Edit.Delete.Text"), "delete"));
  869. this.dataGridView1.Rows.Add(row);
  870. //选中最新添加的那一条
  871. this.dataGridView1.ClearSelection();
  872. this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Selected = true;
  873. //清空输入框
  874. this.textBox9.Text = "";
  875. this.textBox8.Text = "";
  876. }
  877. /// <summary>
  878. /// 添加内容单元格
  879. /// </summary>
  880. /// <param name="text"></param>
  881. /// <param name="tag"></param>
  882. /// <returns></returns>
  883. private DataGridViewTextBoxCell CreateTextBoxCell(string text, object tag)
  884. {
  885. DataGridViewTextBoxCell textboxcell = new DataGridViewTextBoxCell();
  886. textboxcell.Value = text;
  887. textboxcell.Tag = tag;
  888. return textboxcell;
  889. }
  890. /// <summary>
  891. /// 添加按钮单元格
  892. /// </summary>
  893. /// <param name="text"></param>
  894. /// <param name="tag"></param>
  895. /// <returns></returns>
  896. public DataGridViewButtonCell CreateButtonCell(string text, object tag)
  897. {
  898. DataGridViewButtonCell buttonCell = new DataGridViewButtonCell();
  899. buttonCell.Value = text;
  900. buttonCell.Tag = tag;
  901. return buttonCell;
  902. }
  903. /// <summary>
  904. /// 点击datagridview的删除按钮
  905. /// </summary>
  906. /// <param name="sender"></param>
  907. /// <param name="e"></param>
  908. private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
  909. {
  910. var senderGrid = (DataGridView)sender;
  911. if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
  912. e.RowIndex >= 0)
  913. this.dataGridView1.Rows.Remove(this.dataGridView1.Rows[e.RowIndex]);
  914. }
  915. /// <summary>
  916. /// 配置书签按钮
  917. /// </summary>
  918. /// <param name="sender"></param>
  919. /// <param name="e"></param>
  920. private void button5_Click(object sender, EventArgs e)
  921. {
  922. BookmarkConfigDialog bookmarkConfigDialog = new BookmarkConfigDialog(this.analyzeClassify,this.languageName);
  923. bookmarkConfigDialog.StartPosition = FormStartPosition.CenterParent;
  924. bookmarkConfigDialog.ShowDialog();
  925. }
  926. }
  927. }