SearchOnSBPT.cs 8.1 KB

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