SearchOnCYJPT.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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 SearchOnCYJPT : ConditionPanel
  15. {
  16. public SearchOnCYJPT() : base()
  17. {
  18. this.ConditionPanelName = "按照测压计定位";
  19. this.SetSize(800, 450);
  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["JSCYJPT"] 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. // if (str == "未知")
  61. // sql += string.Format(" OR XH is null ");
  62. // else
  63. // sql += string.Format(" OR XH='{0}'", str);
  64. // }
  65. // sql += " ) ";
  66. //}
  67. //if (clbCZ.CheckedItems.Count > 0)
  68. //{
  69. // sql += " AND (1=2 ";
  70. // foreach (string str in clbCZ.CheckedItems)
  71. // {
  72. // if (str == "未知")
  73. // sql += string.Format(" OR cz is null ");
  74. // else
  75. // sql += string.Format(" OR CZ='{0}'", str);
  76. // }
  77. // sql += " ) ";
  78. //}
  79. //if (clbGG.CheckedItems.Count > 0)
  80. //{
  81. // sql += " AND (1=2 ";
  82. // foreach (string str in clbGG.CheckedItems)
  83. // {
  84. // if (str == "未知")
  85. // sql += string.Format(" OR gg is null ");
  86. // else
  87. // sql += string.Format(" OR GG='{0}'", str);
  88. // }
  89. // sql += " ) ";
  90. //}
  91. //if (clbDZMS.CheckedItems.Count > 0)
  92. //{
  93. // sql += " AND (1=2 ";
  94. // foreach (string str in clbDZMS.CheckedItems)
  95. // {
  96. // if (str == "未知")
  97. // sql += string.Format(" OR dzms is null ");
  98. // else
  99. // sql += string.Format(" OR DZMS='{0}'", str);
  100. // }
  101. // sql += " ) ";
  102. //}
  103. //#endregion
  104. Dictionary<string, CheckedListBox> dic = new Dictionary<string, CheckedListBox>();
  105. dic.Add("xh", clbXH); dic.Add("gg", clbGG); dic.Add("cz", clbCZ); dic.Add("dzms", clbDZMS);
  106. return ComsStatic.QueryDataTable(_dv, ComsStatic.getSqlCheckListBox(dic), ComsStatic.resultFields);
  107. }
  108. #region 界面布局
  109. private void InitializeComponent()
  110. {
  111. this.groupBox1 = new System.Windows.Forms.GroupBox();
  112. this.clbDZMS = new System.Windows.Forms.CheckedListBox();
  113. this.groupBox2 = new System.Windows.Forms.GroupBox();
  114. this.clbCZ = new System.Windows.Forms.CheckedListBox();
  115. this.groupBox3 = new System.Windows.Forms.GroupBox();
  116. this.clbXH = new System.Windows.Forms.CheckedListBox();
  117. this.groupBox4 = new System.Windows.Forms.GroupBox();
  118. this.clbGG = new System.Windows.Forms.CheckedListBox();
  119. this.groupBox1.SuspendLayout();
  120. this.groupBox2.SuspendLayout();
  121. this.groupBox3.SuspendLayout();
  122. this.groupBox4.SuspendLayout();
  123. this.SuspendLayout();
  124. //
  125. // groupBox1
  126. //
  127. this.groupBox1.Controls.Add(this.clbDZMS);
  128. this.groupBox1.Location = new System.Drawing.Point(601, 5);
  129. this.groupBox1.Name = "groupBox1";
  130. this.groupBox1.Size = new System.Drawing.Size(194, 350);
  131. this.groupBox1.TabIndex = 14;
  132. this.groupBox1.TabStop = false;
  133. this.groupBox1.Text = "地址描述";
  134. //
  135. // clbDZMS
  136. //
  137. this.clbDZMS.CheckOnClick = true;
  138. this.clbDZMS.Dock = System.Windows.Forms.DockStyle.Fill;
  139. this.clbDZMS.Location = new System.Drawing.Point(3, 25);
  140. this.clbDZMS.Name = "clbDZMS";
  141. this.clbDZMS.Size = new System.Drawing.Size(188, 322);
  142. this.clbDZMS.TabIndex = 0;
  143. //
  144. // groupBox2
  145. //
  146. this.groupBox2.Controls.Add(this.clbCZ);
  147. this.groupBox2.Location = new System.Drawing.Point(205, 5);
  148. this.groupBox2.Name = "groupBox2";
  149. this.groupBox2.Size = new System.Drawing.Size(194, 350);
  150. this.groupBox2.TabIndex = 15;
  151. this.groupBox2.TabStop = false;
  152. this.groupBox2.Text = "材质";
  153. //
  154. // clbCZ
  155. //
  156. this.clbCZ.CheckOnClick = true;
  157. this.clbCZ.Dock = System.Windows.Forms.DockStyle.Fill;
  158. this.clbCZ.Location = new System.Drawing.Point(3, 25);
  159. this.clbCZ.Name = "clbCZ";
  160. this.clbCZ.Size = new System.Drawing.Size(188, 322);
  161. this.clbCZ.TabIndex = 0;
  162. //
  163. // groupBox3
  164. //
  165. this.groupBox3.Controls.Add(this.clbXH);
  166. this.groupBox3.Location = new System.Drawing.Point(7, 5);
  167. this.groupBox3.Name = "groupBox3";
  168. this.groupBox3.Size = new System.Drawing.Size(194, 350);
  169. this.groupBox3.TabIndex = 15;
  170. this.groupBox3.TabStop = false;
  171. this.groupBox3.Text = "型号";
  172. //
  173. // clbXH
  174. //
  175. this.clbXH.CheckOnClick = true;
  176. this.clbXH.Dock = System.Windows.Forms.DockStyle.Fill;
  177. this.clbXH.Location = new System.Drawing.Point(3, 25);
  178. this.clbXH.Name = "clbXH";
  179. this.clbXH.Size = new System.Drawing.Size(188, 322);
  180. this.clbXH.TabIndex = 0;
  181. //
  182. // groupBox4
  183. //
  184. this.groupBox4.Controls.Add(this.clbGG);
  185. this.groupBox4.Location = new System.Drawing.Point(403, 5);
  186. this.groupBox4.Name = "groupBox4";
  187. this.groupBox4.Size = new System.Drawing.Size(194, 350);
  188. this.groupBox4.TabIndex = 15;
  189. this.groupBox4.TabStop = false;
  190. this.groupBox4.Text = "规格";
  191. //
  192. // clbGG
  193. //
  194. this.clbGG.CheckOnClick = true;
  195. this.clbGG.Dock = System.Windows.Forms.DockStyle.Fill;
  196. this.clbGG.Location = new System.Drawing.Point(3, 25);
  197. this.clbGG.Name = "clbGG";
  198. this.clbGG.Size = new System.Drawing.Size(188, 322);
  199. this.clbGG.TabIndex = 0;
  200. //
  201. // SearchOnCYJPT
  202. //
  203. this.Controls.Add(this.groupBox4);
  204. this.Controls.Add(this.groupBox2);
  205. this.Controls.Add(this.groupBox3);
  206. this.Controls.Add(this.groupBox1);
  207. this.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(244)))));
  208. this.Name = "SearchOnCYJPT";
  209. this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
  210. this.Size = new System.Drawing.Size(800, 365);
  211. this.Style = Sunny.UI.UIStyle.Gray;
  212. this.groupBox1.ResumeLayout(false);
  213. this.groupBox2.ResumeLayout(false);
  214. this.groupBox3.ResumeLayout(false);
  215. this.groupBox4.ResumeLayout(false);
  216. this.ResumeLayout(false);
  217. }
  218. #endregion
  219. }
  220. }