SearchOnJDPT.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. using SuperMap.Data;
  2. using SuperMap.Mapping;
  3. using SuperMap.UI;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.Drawing;
  8. using WeifenLuo.WinFormsUI.Docking;
  9. using WWPipeLine.MapBasic.Conditions;
  10. using WWPipeLine.MapBasic;
  11. using System.Windows.Forms;
  12. namespace WWPipeLine.MapTools.Conditions.Locations
  13. {
  14. public class SearchOnJDPT : ConditionPanel
  15. {
  16. public SearchOnJDPT() : base()
  17. {
  18. this.ConditionPanelName = "按照供水节点组合查询";
  19. this.SetSize(800, 400);
  20. InitializeComponent();
  21. }
  22. private DatasetVector _dv = ComsStatic.dvJSJDPT;
  23. private GroupBox groupBox1;
  24. private CheckedListBox clbDZMS;
  25. private GroupBox groupBox2;
  26. private CheckedListBox clbCZ;
  27. private GroupBox groupBox3;
  28. private CheckedListBox clbXH;
  29. private GroupBox groupBox4;
  30. private CheckedListBox clbGG;
  31. protected override void OnLoad(EventArgs e)
  32. {
  33. if (_dv == null)
  34. {
  35. Sunny.UI.UIMessageTip.ShowError("当前数据源中不包含相应的矢量数据集", 5000);
  36. this.ParentForm.Close();
  37. return;
  38. }
  39. if (!ComsStatic.HasField(_dv, "xh") || !ComsStatic.HasField(_dv, "cz") || !ComsStatic.HasField(_dv, "gg") || !ComsStatic.HasField(_dv, "dzms"))
  40. {
  41. Sunny.UI.UIMessageTip.ShowError("当前矢量数据集没有相应的信息", 5000);
  42. this.ParentForm.Close();
  43. return;
  44. }
  45. ComsStatic.BindDataTableOnCheckedListBox(_dv, clbXH, "xh");
  46. ComsStatic.BindDataTableOnCheckedListBox(_dv, clbCZ, "cz");
  47. ComsStatic.BindDataTableOnCheckedListBox(_dv, clbGG, "gg");
  48. ComsStatic.BindDataTableOnCheckedListBox(_dv, clbDZMS, "dzms");
  49. }
  50. public override object Do(DockPanel dockPanel = null)
  51. {
  52. string sql = " 1=1 ";
  53. #region 组合AND OR 多选项查询条件
  54. if (clbXH.CheckedItems.Count > 0)
  55. {
  56. sql += " AND (1=2 ";
  57. foreach (string str in clbXH.CheckedItems)
  58. {
  59. sql += string.Format(" OR XH='{0}'", str);
  60. }
  61. sql += " ) ";
  62. }
  63. if (clbCZ.CheckedItems.Count > 0)
  64. {
  65. sql += " AND (1=2 ";
  66. foreach (string str in clbCZ.CheckedItems)
  67. {
  68. sql += string.Format(" OR CZ='{0}'", str);
  69. }
  70. sql += " ) ";
  71. }
  72. if (clbGG.CheckedItems.Count > 0)
  73. {
  74. sql += " AND (1=2 ";
  75. foreach (string str in clbGG.CheckedItems)
  76. {
  77. sql += string.Format(" OR GG='{0}'", str);
  78. }
  79. sql += " ) ";
  80. }
  81. if (clbDZMS.CheckedItems.Count > 0)
  82. {
  83. sql += " AND (1=2 ";
  84. foreach (string str in clbDZMS.CheckedItems)
  85. {
  86. sql += string.Format(" OR DZMS='{0}'", str);
  87. }
  88. sql += " ) ";
  89. }
  90. #endregion
  91. return ComsStatic.QueryDataTable(_dv, sql, new string[] { "xh", "cz", "gg", "dzms", "fldm", "sblx", "yl", "ms" });
  92. }
  93. #region 界面布局
  94. private void InitializeComponent()
  95. {
  96. this.groupBox1 = new System.Windows.Forms.GroupBox();
  97. this.clbDZMS = new System.Windows.Forms.CheckedListBox();
  98. this.groupBox2 = new System.Windows.Forms.GroupBox();
  99. this.clbCZ = new System.Windows.Forms.CheckedListBox();
  100. this.groupBox3 = new System.Windows.Forms.GroupBox();
  101. this.clbXH = new System.Windows.Forms.CheckedListBox();
  102. this.groupBox4 = new System.Windows.Forms.GroupBox();
  103. this.clbGG = new System.Windows.Forms.CheckedListBox();
  104. this.groupBox1.SuspendLayout();
  105. this.groupBox2.SuspendLayout();
  106. this.groupBox3.SuspendLayout();
  107. this.groupBox4.SuspendLayout();
  108. this.SuspendLayout();
  109. //
  110. // groupBox1
  111. //
  112. this.groupBox1.Controls.Add(this.clbDZMS);
  113. this.groupBox1.Location = new System.Drawing.Point(601, 5);
  114. this.groupBox1.Name = "groupBox1";
  115. this.groupBox1.Size = new System.Drawing.Size(194, 350);
  116. this.groupBox1.TabIndex = 14;
  117. this.groupBox1.TabStop = false;
  118. this.groupBox1.Text = "地址描述";
  119. //
  120. // clbDZMS
  121. //
  122. this.clbDZMS.Dock = System.Windows.Forms.DockStyle.Fill;
  123. this.clbDZMS.Location = new System.Drawing.Point(3, 25);
  124. this.clbDZMS.Name = "clbDZMS";
  125. this.clbDZMS.Size = new System.Drawing.Size(188, 322);
  126. this.clbDZMS.TabIndex = 0;
  127. //
  128. // groupBox2
  129. //
  130. this.groupBox2.Controls.Add(this.clbCZ);
  131. this.groupBox2.Location = new System.Drawing.Point(205, 5);
  132. this.groupBox2.Name = "groupBox2";
  133. this.groupBox2.Size = new System.Drawing.Size(194, 350);
  134. this.groupBox2.TabIndex = 15;
  135. this.groupBox2.TabStop = false;
  136. this.groupBox2.Text = "材质";
  137. //
  138. // clbCZ
  139. //
  140. this.clbCZ.Dock = System.Windows.Forms.DockStyle.Fill;
  141. this.clbCZ.Location = new System.Drawing.Point(3, 25);
  142. this.clbCZ.Name = "clbCZ";
  143. this.clbCZ.Size = new System.Drawing.Size(188, 322);
  144. this.clbCZ.TabIndex = 0;
  145. //
  146. // groupBox3
  147. //
  148. this.groupBox3.Controls.Add(this.clbXH);
  149. this.groupBox3.Location = new System.Drawing.Point(7, 5);
  150. this.groupBox3.Name = "groupBox3";
  151. this.groupBox3.Size = new System.Drawing.Size(194, 350);
  152. this.groupBox3.TabIndex = 15;
  153. this.groupBox3.TabStop = false;
  154. this.groupBox3.Text = "型号";
  155. //
  156. // clbXH
  157. //
  158. this.clbXH.Dock = System.Windows.Forms.DockStyle.Fill;
  159. this.clbXH.Location = new System.Drawing.Point(3, 25);
  160. this.clbXH.Name = "clbXH";
  161. this.clbXH.Size = new System.Drawing.Size(188, 322);
  162. this.clbXH.TabIndex = 0;
  163. //
  164. // groupBox4
  165. //
  166. this.groupBox4.Controls.Add(this.clbGG);
  167. this.groupBox4.Location = new System.Drawing.Point(403, 5);
  168. this.groupBox4.Name = "groupBox4";
  169. this.groupBox4.Size = new System.Drawing.Size(194, 350);
  170. this.groupBox4.TabIndex = 15;
  171. this.groupBox4.TabStop = false;
  172. this.groupBox4.Text = "规格";
  173. //
  174. // clbGG
  175. //
  176. this.clbGG.Dock = System.Windows.Forms.DockStyle.Fill;
  177. this.clbGG.Location = new System.Drawing.Point(3, 25);
  178. this.clbGG.Name = "clbGG";
  179. this.clbGG.Size = new System.Drawing.Size(188, 322);
  180. this.clbGG.TabIndex = 0;
  181. //
  182. // SearchOnJDPT
  183. //
  184. this.Controls.Add(this.groupBox4);
  185. this.Controls.Add(this.groupBox2);
  186. this.Controls.Add(this.groupBox3);
  187. this.Controls.Add(this.groupBox1);
  188. this.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(244)))));
  189. this.Name = "SearchOnJDPT";
  190. this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
  191. this.Size = new System.Drawing.Size(800, 379);
  192. this.Style = Sunny.UI.UIStyle.Gray;
  193. this.groupBox1.ResumeLayout(false);
  194. this.groupBox2.ResumeLayout(false);
  195. this.groupBox3.ResumeLayout(false);
  196. this.groupBox4.ResumeLayout(false);
  197. this.ResumeLayout(false);
  198. }
  199. #endregion
  200. }
  201. }