AutoAnalysisReportDialog.cs 44 KB

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