4662a2455baaebbcf9d6a0e43db6e245e1c6fc1a.svn-base 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using System.Collections;
  11. namespace Core.LZMes.Client.UIK
  12. {
  13. public partial class UIK030040 : FrmBase
  14. {
  15. public UIK030040()
  16. {
  17. InitializeComponent();
  18. }
  19. public override void ToolBar_Click(object sender, string ToolbarKey)
  20. {
  21. switch (ToolbarKey)
  22. {
  23. case "Query":
  24. this.DoQuery();
  25. break;
  26. case "Insert":
  27. this.DoInsert();
  28. break;
  29. case "Update":
  30. this.DoUpdate();
  31. break;
  32. }
  33. }
  34. private void DoQuery()
  35. {
  36. if (this.ultraCalendarENDTIME.Enabled == false && this.ultraCalendarSTRATTIME.Enabled == false)
  37. {
  38. this.ultraCalendarENDTIME.Text = "";
  39. this.ultraCalendarSTRATTIME.Text = "";
  40. }
  41. try
  42. {
  43. string mc_id = this.ultraTextMC_ID.Text.ToString();
  44. string starttiem = this.ultraCalendarSTRATTIME.Text.ToString();
  45. string endtime = this.ultraCalendarENDTIME.Text.ToString();
  46. CoreClientParam ccp = new CoreClientParam();
  47. DataTable dt = new DataTable();
  48. if (mc_id == "" && starttiem == "" && endtime == "")
  49. {
  50. MessageBox.Show("请选择查询条件!");
  51. }
  52. else
  53. {
  54. if (this.ultraTextMC_ID.Text != "" || this.ultraCheckEditor1.Checked == true)
  55. {
  56. if (this.ultraTextMC_ID.Text == "")
  57. {
  58. this.ultraTextMC_ID.Clear();
  59. this.ultraCheckEditor1.Checked = false;
  60. ccp.ServerName = "UIK.UIK03.UIK030040";
  61. ccp.MethodName = "DoQuery";
  62. ccp.ServerParams = new object[] { mc_id, starttiem, endtime };
  63. ccp.SourceDataTable = dt;
  64. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  65. this.ultraGrid1.DataSource = dt;
  66. if (dt.Rows.Count <= 0)
  67. {
  68. MessageBox.Show("该时间内没有维修信息!");
  69. }
  70. this.ultraCalendarENDTIME.Enabled = false;
  71. this.ultraCalendarSTRATTIME.Enabled = false;
  72. return;
  73. }
  74. if (this.ultraCheckEditor1.Checked == false)
  75. {
  76. this.ultraTextMC_ID.Clear();
  77. ccp.ServerName = "UIK.UIK03.UIK030040";
  78. ccp.MethodName = "DoQuery";
  79. ccp.ServerParams = new object[] { mc_id, starttiem, endtime };
  80. ccp.SourceDataTable = dt;
  81. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  82. this.ultraGrid1.DataSource = dt;
  83. if (dt.Rows.Count <= 0)
  84. {
  85. MessageBox.Show("该设备编号不存在!");
  86. }
  87. this.ultraCalendarENDTIME.Enabled = false;
  88. this.ultraCalendarSTRATTIME.Enabled = false;
  89. return;
  90. }
  91. if (this.ultraTextMC_ID.Text != "" && this.ultraCheckEditor1.Checked == true)
  92. {
  93. this.ultraTextMC_ID.Clear();
  94. this.ultraCheckEditor1.Checked = false;
  95. ccp.ServerName = "UIK.UIK03.UIK030040";
  96. ccp.MethodName = "DoQuery";
  97. ccp.ServerParams = new object[] { mc_id, starttiem, endtime };
  98. ccp.SourceDataTable = dt;
  99. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  100. this.ultraGrid1.DataSource = dt;
  101. if (dt.Rows.Count <= 0)
  102. {
  103. MessageBox.Show("记录不存在,请查证后查询!");
  104. }
  105. this.ultraCalendarENDTIME.Enabled = false;
  106. this.ultraCalendarSTRATTIME.Enabled = false;
  107. return;
  108. }
  109. }
  110. }
  111. }
  112. catch (Exception Ex)
  113. {
  114. MessageBox.Show(Ex.ToString());
  115. }
  116. }
  117. private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
  118. {
  119. if (this.ultraCheckEditor1.Checked)
  120. {
  121. this.ultraCalendarENDTIME.Enabled = true;
  122. this.ultraCalendarSTRATTIME.Enabled = true;
  123. }
  124. if (!this.ultraCheckEditor1.Checked)
  125. {
  126. this.ultraCalendarENDTIME.Enabled = false;
  127. this.ultraCalendarSTRATTIME.Enabled = false;
  128. this.ultraCalendarSTRATTIME.Text = "";
  129. this.ultraCalendarENDTIME.Text = "";
  130. this.ultraCalendarMC_EGIS_DTIME.Text = "";
  131. this.ultraCalendarMC_USE_TIME.Text = "";
  132. }
  133. }
  134. private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  135. {
  136. if (e.Cell.Column.Key == "SELECT_ITEM")
  137. {
  138. if (e.Cell.Text == "True")
  139. {
  140. string mcid, IREG_IN_DTIME;
  141. ultraTextMCID2.Text = e.Cell.Row.Cells["MC_ID"].Text;
  142. this.ultraTextMCID2.Text = e.Cell.Row.Cells["MC_ID"].Text;
  143. mcid = e.Cell.Row.Cells["MC_ID"].Text;
  144. this.ultraTextMCID2.Enabled = false;
  145. IREG_IN_DTIME = e.Cell.Row.Cells["REG_IN_DTIME"].Text;
  146. DataTable dt = new DataTable();
  147. CoreClientParam ccp = new CoreClientParam();
  148. ccp.ServerName = "UIK.UIK03.UIK030040";
  149. ccp.MethodName = "DoSelect";
  150. ccp.ServerParams = new object[] { IREG_IN_DTIME };
  151. ccp.SourceDataTable = dt;
  152. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  153. foreach (DataRow dr in dt.Rows)
  154. {
  155. this.ultraTextMC_NAME.Text = dr["MC_NAME"].ToString();
  156. this.ultraComboMC_STAT.Text = dr["MC_STAT"].ToString();
  157. this.ultraTextMC_MODEL.Text = dr["MC_MODEL"].ToString();
  158. this.ultraTextMC_SPEC.Text = dr["MC_SPEC"].ToString();
  159. this.ultraTextMC_EGIS_REASON.Text = dr["MC_EGIS_REASON"].ToString();
  160. this.ultraTextMC_EGIS_ID.Text = dr["MC_EGIS_ID"].ToString();
  161. this.ultraCalendarMC_EGIS_DTIME.Text = dr["MC_EGIS_DTIME"].ToString();
  162. this.ultraTextMC_CARE_SECTOR.Text = dr["MC_CARE_SECTOR"].ToString();
  163. this.ultraTextMC_NOM_CAP.Text = dr["MC_NOM_CAP"].ToString();
  164. this.ultraTextMC_UNIT.Text = dr["MC_UNIT"].ToString();
  165. this.ultraTextMC_TAI.Text = dr["MC_TAI"].ToString();
  166. this.ultraTextMC_ACT.Text = dr["MC_ACT"].ToString();
  167. this.ultraTextMC_MFACTUR_UNITS.Text = dr["MC_MFACTUR_UNITS"].ToString();
  168. this.ultraTextMC_USE_YEAR.Text = dr["MC_USE_YEAR"].ToString();
  169. this.ultraCalendarMC_USE_TIME.Text = dr["MC_USE_TIME"].ToString();
  170. this.ultraTextMC_INSTAL_LOCAL.Text = dr["MC_INSTAL_LOCAL"].ToString();
  171. this.ultraTextMAIN_MC_NAME.Text = dr["MAIN_MC_NAME"].ToString();
  172. }
  173. }
  174. else
  175. {
  176. this.ultraTextMCID2.Enabled = true;
  177. this.ultraTextMCID2.Clear();
  178. this.ultraTextMC_NAME.Clear();
  179. this.ultraComboMC_STAT.Clear();
  180. this.ultraTextMC_MODEL.Clear();
  181. this.ultraTextMC_SPEC.Clear();
  182. this.ultraTextMC_EGIS_REASON.Clear();
  183. this.ultraTextMC_EGIS_ID.Clear();
  184. this.ultraCalendarMC_EGIS_DTIME.Text = "";
  185. this.ultraTextMC_CARE_SECTOR.Clear();
  186. this.ultraTextMC_NOM_CAP.Clear();
  187. this.ultraTextMC_UNIT.Clear();
  188. this.ultraTextMC_TAI.Clear();
  189. this.ultraTextMC_ACT.Clear();
  190. this.ultraTextMC_MFACTUR_UNITS.Clear();
  191. this.ultraTextMC_USE_YEAR.Clear();
  192. this.ultraCalendarMC_USE_TIME.Text = "";
  193. this.ultraTextMC_INSTAL_LOCAL.Clear();
  194. this.ultraTextMAIN_MC_NAME.Clear();
  195. }
  196. }
  197. }
  198. private void DoUpdate()
  199. {
  200. if (this.ultraTextMCID2.Text == "")
  201. {
  202. MessageBox.Show("请选中需要修改的项");
  203. }
  204. else
  205. {
  206. if (MessageBox.Show("您确认要修改?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
  207. {
  208. try
  209. {
  210. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  211. if (ugr.Cells["SELECT_ITEM"].Text.ToString() == "True")
  212. {
  213. string mcid, IMAIN_MC_NAME, IREG_IN_DTIME, IMC_NAME, IMC_STAT, IMC_MODEL, IMC_SPEC, IMC_EGIS_REASON, IMC_EGIS_ID, IMC_EGIS_DTIME, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, MC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_INSTAL_LOCAL;
  214. mcid = ugr.Cells["MC_ID"].Value.ToString();
  215. this.ultraTextMCID2.Enabled = false;
  216. IREG_IN_DTIME = ugr.Cells["REG_IN_DTIME"].Value.ToString();
  217. IMC_NAME = this.ultraTextMC_NAME.Text;
  218. IMC_STAT = this.ultraComboMC_STAT.Text;
  219. IMC_MODEL = this.ultraTextMC_MODEL.Text;
  220. IMC_SPEC = this.ultraTextMC_SPEC.Text;
  221. IMC_EGIS_REASON = this.ultraTextMC_EGIS_REASON.Text;
  222. IMC_EGIS_ID = this.ultraTextMC_EGIS_ID.Text;
  223. IMC_EGIS_DTIME = this.ultraCalendarMC_EGIS_DTIME.Text;
  224. IMC_CARE_SECTOR = this.ultraTextMC_CARE_SECTOR.Text;
  225. IMC_NOM_CAP = this.ultraTextMC_NOM_CAP.Text;
  226. IMC_UNIT = this.ultraTextMC_UNIT.Text;
  227. MC_TAI = this.ultraTextMC_TAI.Text;
  228. IMC_ACT = this.ultraTextMC_ACT.Text;
  229. IMC_MFACTUR_UNITS = this.ultraTextMC_MFACTUR_UNITS.Text;
  230. IMC_USE_YEAR = this.ultraTextMC_USE_YEAR.Text;
  231. IMC_USE_TIME = this.ultraCalendarMC_USE_TIME.Text;
  232. IMC_INSTAL_LOCAL = this.ultraTextMC_INSTAL_LOCAL.Text;
  233. IMAIN_MC_NAME = this.ultraTextMAIN_MC_NAME.Text;
  234. CoreClientParam ccp2 = new CoreClientParam();
  235. ccp2.ServerName = "UIK.UIK03.UIK030040";
  236. ccp2.MethodName = "DoUpdate";
  237. ccp2.ServerParams = new object[] { IMC_NAME, IMC_STAT, IMC_MODEL, IMC_SPEC, IMC_EGIS_REASON, IMC_EGIS_ID, IMC_EGIS_DTIME, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, MC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_INSTAL_LOCAL, IMAIN_MC_NAME, IREG_IN_DTIME };
  238. ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
  239. if (0 != ccp2.ReturnCode)
  240. {
  241. MessageBox.Show("修改失败!");
  242. }
  243. else
  244. {
  245. MessageBox.Show("修改成功!");
  246. this.ultraTextMCID2.Enabled = true;
  247. this.ultraTextMCID2.Clear();
  248. this.ultraTextMC_NAME.Clear();
  249. this.ultraComboMC_STAT.Clear();
  250. this.ultraTextMC_MODEL.Clear();
  251. this.ultraTextMC_SPEC.Clear();
  252. this.ultraTextMC_EGIS_REASON.Clear();
  253. this.ultraTextMC_EGIS_ID.Clear();
  254. this.ultraCalendarMC_EGIS_DTIME.Text = "";
  255. this.ultraTextMC_CARE_SECTOR.Clear();
  256. this.ultraTextMC_NOM_CAP.Clear();
  257. this.ultraTextMC_UNIT.Clear();
  258. this.ultraTextMC_TAI.Clear();
  259. this.ultraTextMC_ACT.Clear();
  260. this.ultraTextMC_MFACTUR_UNITS.Clear() ;
  261. this.ultraTextMC_USE_YEAR.Clear();
  262. this.ultraCalendarMC_USE_TIME.Text = "";
  263. this.ultraTextMC_INSTAL_LOCAL.Clear();
  264. this.ultraTextMAIN_MC_NAME.Clear();
  265. }
  266. }
  267. else
  268. {
  269. MessageBox.Show("请选择修改行!");
  270. }
  271. }
  272. catch (Exception Ex)
  273. {
  274. MessageBox.Show(Ex.ToString());
  275. }
  276. }
  277. }
  278. }
  279. private void UIK030040_Load(object sender, EventArgs e)
  280. {
  281. this.ultraCalendarENDTIME.Enabled = false;
  282. this.ultraCalendarSTRATTIME.Enabled = false;
  283. }
  284. private void DoInsert()
  285. {
  286. if (MessageBox.Show("您确认要修改?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
  287. {
  288. string mcid, IMC_NAME, IMC_STAT, IMC_MODEL, IMC_SPEC, IMC_EGIS_REASON, IMC_EGIS_ID, IMC_EGIS_DTIME, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, MC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_INSTAL_LOCAL,IMAIN_MC_NAME, IREG_IN_DTIME;
  289. mcid = this.ultraTextMCID2.Text;
  290. IMC_NAME = this.ultraTextMC_NAME.Text;
  291. IMC_STAT = this.ultraComboMC_STAT.Text;
  292. IMC_MODEL = this.ultraTextMC_MODEL.Text;
  293. IMC_SPEC = this.ultraTextMC_SPEC.Text;
  294. IMC_EGIS_REASON = this.ultraTextMC_EGIS_REASON.Text;
  295. IMC_EGIS_ID = this.ultraTextMC_EGIS_ID.Text;
  296. IMC_EGIS_DTIME = this.ultraCalendarMC_EGIS_DTIME.Text;
  297. IMC_CARE_SECTOR = this.ultraTextMC_CARE_SECTOR.Text;
  298. IMC_NOM_CAP = this.ultraTextMC_NOM_CAP.Text;
  299. IMC_UNIT = this.ultraTextMC_UNIT.Text;
  300. MC_TAI = this.ultraTextMC_TAI.Text;
  301. IMC_ACT = this.ultraTextMC_ACT.Text;
  302. IMC_MFACTUR_UNITS = this.ultraTextMC_MFACTUR_UNITS.Text;
  303. IMC_USE_YEAR = this.ultraTextMC_USE_YEAR.Text;
  304. IMC_USE_TIME = this.ultraCalendarMC_USE_TIME.Text;
  305. IMC_INSTAL_LOCAL = this.ultraTextMC_INSTAL_LOCAL.Text;
  306. IREG_IN_DTIME = DateTime.Now.ToString();
  307. IMAIN_MC_NAME = this.ultraTextMAIN_MC_NAME.Text;
  308. DataTable dt = new DataTable();
  309. CoreClientParam ccp = new CoreClientParam();
  310. ccp.ServerName = "UIK.UIK03.UIK030040";
  311. ccp.MethodName = "DoSelect";
  312. ccp.ServerParams = new object[] { IREG_IN_DTIME };
  313. ccp.SourceDataTable = dt;
  314. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  315. if (dt.Rows.Count > 0)
  316. {
  317. MessageBox.Show("该编设备号已经存在,请重新输入");
  318. }
  319. else
  320. {
  321. CoreClientParam ccp2 = new CoreClientParam();
  322. ccp2.ServerName = "UIK.UIK03.UIK030040";
  323. ccp2.MethodName = "DoInsert";
  324. ccp2.ServerParams = new object[] { mcid, IMC_NAME, IMC_STAT, IMC_MODEL, IMC_SPEC, IMC_EGIS_REASON, IMC_EGIS_ID, IMC_EGIS_DTIME, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, MC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_INSTAL_LOCAL, IMAIN_MC_NAME, IREG_IN_DTIME };
  325. ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
  326. if (0 != ccp2.ReturnCode)
  327. {
  328. MessageBox.Show("添加失败!");
  329. }
  330. else
  331. {
  332. MessageBox.Show("添加成功!");
  333. this.ultraTextMCID2.Enabled = true;
  334. this.ultraTextMCID2.Clear();
  335. this.ultraTextMC_NAME.Clear();
  336. this.ultraComboMC_STAT.Clear();
  337. this.ultraTextMC_MODEL.Clear();
  338. this.ultraTextMC_SPEC.Clear();
  339. this.ultraTextMC_EGIS_REASON.Clear();
  340. this.ultraTextMC_EGIS_ID.Clear();
  341. this.ultraCalendarMC_EGIS_DTIME.Text = "";
  342. this.ultraTextMC_CARE_SECTOR.Clear();
  343. this.ultraTextMC_NOM_CAP.Clear();
  344. this.ultraTextMC_UNIT.Clear();
  345. this.ultraTextMC_TAI.Clear();
  346. this.ultraTextMC_ACT.Clear();
  347. this.ultraTextMC_MFACTUR_UNITS.Clear();
  348. this.ultraTextMC_USE_YEAR.Clear();
  349. this.ultraCalendarMC_USE_TIME.Text = "";
  350. this.ultraTextMC_INSTAL_LOCAL.Clear();
  351. this.ultraTextMAIN_MC_NAME.Clear();
  352. }
  353. }
  354. }
  355. }
  356. }
  357. }