1f34a34b7be4f6563ee06ce9924af956ebf5b53d.svn-base 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  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 UIK030050 : FrmBase
  14. {
  15. public UIK030050()
  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.ultraCheckAll.Checked)
  55. //{
  56. // this.ultraCheckAll.Checked = false;
  57. // ccp.ServerName = "UIK.UIK03.UIK030050";
  58. // ccp.MethodName = "DoQuery";
  59. // ccp.ServerParams = new object[] { mc_id, starttiem, endtime, flag };
  60. // ccp.SourceDataTable = dt;
  61. // this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  62. // this.ultraGrid1.DataSource = dt;
  63. // if (dt.Rows.Count <= 0)
  64. // {
  65. // MessageBox.Show("暂无记录!");
  66. // }
  67. // return;
  68. //}
  69. //else
  70. //{
  71. // flag = true;
  72. if (this.ultraTextMC_ID.Text != "" || this.ultraCheckEditor1.Checked == true)
  73. {
  74. if (this.ultraTextMC_ID.Text == "")
  75. {
  76. this.ultraTextMC_ID.Clear();
  77. this.ultraCheckEditor1.Checked = false;
  78. ccp.ServerName = "UIK.UIK03.UIK030050";
  79. ccp.MethodName = "DoQuery";
  80. ccp.ServerParams = new object[] { mc_id, starttiem, endtime};
  81. ccp.SourceDataTable = dt;
  82. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  83. this.ultraGrid1.DataSource = dt;
  84. if (dt.Rows.Count <= 0)
  85. {
  86. MessageBox.Show("该时间内没有维修信息!");
  87. }
  88. this.ultraCalendarENDTIME.Enabled = false;
  89. this.ultraCalendarSTRATTIME.Enabled = false;
  90. return;
  91. }
  92. if (this.ultraCheckEditor1.Checked == false)
  93. {
  94. this.ultraTextMC_ID.Clear();
  95. ccp.ServerName = "UIK.UIK03.UIK030050";
  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. if (this.ultraTextMC_ID.Text != "" && this.ultraCheckEditor1.Checked == true)
  110. {
  111. this.ultraTextMC_ID.Clear();
  112. this.ultraCheckEditor1.Checked = false;
  113. ccp.ServerName = "UIK.UIK03.UIK030050";
  114. ccp.MethodName = "DoQuery";
  115. ccp.ServerParams = new object[] { mc_id, starttiem, endtime };
  116. ccp.SourceDataTable = dt;
  117. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  118. this.ultraGrid1.DataSource = dt;
  119. if (dt.Rows.Count <= 0)
  120. {
  121. MessageBox.Show("记录不存在,请查证后查询!");
  122. }
  123. this.ultraCalendarENDTIME.Enabled = false;
  124. this.ultraCalendarSTRATTIME.Enabled = false;
  125. return;
  126. }
  127. }
  128. }
  129. }
  130. catch (Exception Ex)
  131. {
  132. MessageBox.Show(Ex.ToString());
  133. }
  134. }
  135. private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
  136. {
  137. if (this.ultraCheckEditor1.Checked)
  138. {
  139. this.ultraCalendarENDTIME.Enabled = true;
  140. this.ultraCalendarSTRATTIME.Enabled = true;
  141. }
  142. if (!this.ultraCheckEditor1.Checked)
  143. {
  144. this.ultraCalendarENDTIME.Enabled = false;
  145. this.ultraCalendarSTRATTIME.Enabled = false;
  146. this.ultraCalendarSTRATTIME.Text = "";
  147. this.ultraCalendarENDTIME.Text = "";
  148. }
  149. }
  150. private void UIK030050_Load(object sender, EventArgs e)
  151. {
  152. this.ultraCalendarENDTIME.Enabled = false;
  153. this.ultraCalendarSTRATTIME.Enabled = false;
  154. this.ultraCalendarSTARTSERVERICE_DTIME.Text = "";
  155. this.ultraCalendarENDSERVERICE_DTIME.Text = "";
  156. this.ultraCalendarMC_USE_TIME.Text = "";
  157. }
  158. private void DoUpdate()
  159. {
  160. if (this.ultraTextMCID2.Text == "")
  161. {
  162. MessageBox.Show("请选中需要修改的项");
  163. }
  164. else
  165. {
  166. if (MessageBox.Show("您确认要修改?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
  167. {
  168. try
  169. {
  170. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  171. if (ugr.Cells["SELECT_ITEM"].Text.ToString() == "True")
  172. {
  173. string mcid, IMC_NAME, IMC_STAT, IMC_MODEL, IMC_SPEC, IMC_SERVICEREASON, IMC_SERVICE_ID, IMC_STARSERVICE, IMC_ENDESERVICE, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, IMC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_INSTAL_LOCAL, IMAIN_MC_NAME, IREG_IN_DTIME;
  174. mcid = ugr.Cells["MC_ID"].Value.ToString();
  175. this.ultraTextMCID2.Enabled = false;
  176. IREG_IN_DTIME = ugr.Cells["REG_IN_DTIME"].Value.ToString();
  177. IMC_STAT = this.ultraComboMC_STAT.Text;
  178. IMC_NAME = this.ultraTextMC_NAME.Text;
  179. IMC_MODEL = this.ultraTextMC_MODEL.Text;
  180. IMC_SPEC = this.ultraTextMC_SPEC.Text;
  181. IMC_SERVICEREASON = this.ultraTextMC_SERVICEREASON.Text;
  182. IMC_STARSERVICE = this.ultraCalendarSTARTSERVERICE_DTIME.Text;
  183. IMC_ENDESERVICE = this.ultraCalendarENDSERVERICE_DTIME.Text;
  184. IMC_SERVICE_ID = this.ultraTextSERVERICE_ID.Text;
  185. IMC_USE_TIME = this.ultraCalendarMC_USE_TIME.Text;
  186. IMC_NOM_CAP = this.ultraTextMC_NOM_CAP.Text;
  187. IMC_UNIT = this.ultraTextMC_UNIT.Text;
  188. IMC_ACT = this.ultraTextMC_ACT.Text;
  189. IMC_TAI = this.ultraTextMC_TAI.Text;
  190. IMC_MFACTUR_UNITS = this.ultraTextMC_MFACTUR_UNITS.Text;
  191. IMC_USE_YEAR = this.ultraTextMC_USE_YEAR.Text;
  192. IMC_INSTAL_LOCAL = this.ultraTextMC_INSTAL_LOCAL.Text;
  193. IMC_CARE_SECTOR = this.ultraTextMC_CARE_SECTOR.Text;
  194. IMAIN_MC_NAME = this.ultraTextMAIN_MC_NAME.Text;
  195. CoreClientParam ccp2 = new CoreClientParam();
  196. ccp2.ServerName = "UIK.UIK03.UIK030050";
  197. ccp2.MethodName = "DoUpdate";
  198. ccp2.ServerParams = new object[] { IMC_NAME, IMC_STAT, IMC_MODEL, IMC_SPEC, IMC_SERVICEREASON, IMC_SERVICE_ID, IMC_STARSERVICE, IMC_ENDESERVICE, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, IMC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_INSTAL_LOCAL, IMAIN_MC_NAME, IREG_IN_DTIME };
  199. ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
  200. if (0 != ccp2.ReturnCode)
  201. {
  202. MessageBox.Show("修改失败!");
  203. }
  204. else
  205. {
  206. MessageBox.Show("修改成功!");
  207. this.ultraTextMCID2.Enabled = true;
  208. this.ultraTextMCID2.Clear();
  209. this.ultraComboMC_STAT.Clear();
  210. this.ultraTextMC_NAME.Clear();
  211. this.ultraTextMC_MODEL.Clear();
  212. this.ultraTextMC_SPEC.Clear();
  213. this.ultraTextMC_SERVICEREASON.Clear();
  214. this.ultraCalendarENDSERVERICE_DTIME.Text = "";
  215. this.ultraCalendarSTARTSERVERICE_DTIME.Text = "";
  216. this.ultraTextSERVERICE_ID.Clear();
  217. this.ultraCalendarMC_USE_TIME.Text = "";
  218. this.ultraTextMC_NOM_CAP.Clear();
  219. this.ultraTextMC_UNIT.Clear();
  220. this.ultraTextMC_ACT.Clear();
  221. this.ultraTextMC_TAI.Clear();
  222. this.ultraTextMC_MFACTUR_UNITS.Clear();
  223. this.ultraTextMC_USE_YEAR.Clear();
  224. this.ultraTextMC_INSTAL_LOCAL.Clear();
  225. this.ultraTextMC_CARE_SECTOR.Clear();
  226. this.ultraTextMAIN_MC_NAME.Clear();
  227. }
  228. }
  229. else
  230. {
  231. MessageBox.Show("请选择修改行!");
  232. }
  233. }
  234. catch (Exception Ex)
  235. {
  236. MessageBox.Show(Ex.ToString());
  237. }
  238. }
  239. }
  240. }
  241. private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  242. {
  243. if (e.Cell.Column.Key == "SELECT_ITEM")
  244. {
  245. if (e.Cell.Text == "True")
  246. {
  247. string mcid, IREG_IN_DTIME;
  248. ultraTextMCID2.Text = e.Cell.Row.Cells["MC_ID"].Text;
  249. this.ultraTextMCID2.Text = e.Cell.Row.Cells["MC_ID"].Text;
  250. mcid = e.Cell.Row.Cells["MC_ID"].Text;
  251. this.ultraTextMCID2.Enabled = false;
  252. IREG_IN_DTIME = e.Cell.Row.Cells["REG_IN_DTIME"].Text;
  253. DataTable dt = new DataTable();
  254. CoreClientParam ccp = new CoreClientParam();
  255. ccp.ServerName = "UIK.UIK03.UIK030050";
  256. ccp.MethodName = "DoSelect";
  257. ccp.ServerParams = new object[] { IREG_IN_DTIME };
  258. ccp.SourceDataTable = dt;
  259. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  260. foreach (DataRow dr in dt.Rows)
  261. {
  262. this.ultraTextMC_NAME.Text = dr["MC_NAME"].ToString();
  263. this.ultraTextMC_MODEL.Text = dr["MC_MODEL"].ToString();
  264. this.ultraTextMC_SPEC.Text = dr["MC_SPEC"].ToString();
  265. this.ultraTextMC_SERVICEREASON.Text = dr["MC_SERVICEREASON"].ToString();
  266. this.ultraTextSERVERICE_ID.Text = dr["MC_SERVICE_ID"].ToString();
  267. this.ultraCalendarSTARTSERVERICE_DTIME.Text = dr["MC_STARSERVICE"].ToString();
  268. this.ultraCalendarENDSERVERICE_DTIME.Text = dr["MC_ENDESERVICE"].ToString();
  269. this.ultraCalendarMC_USE_TIME.Text = dr["MC_USE_TIME"].ToString();
  270. this.ultraTextMC_CARE_SECTOR.Text = dr["MC_CARE_SECTOR"].ToString();
  271. this.ultraTextMC_NOM_CAP.Text = dr["MC_NOM_CAP"].ToString();
  272. this.ultraTextMC_UNIT.Text = dr["MC_UNIT"].ToString();
  273. this.ultraTextMC_ACT.Text = dr["MC_ACT"].ToString();
  274. this.ultraTextMC_TAI.Text = dr["MC_TAI"].ToString();
  275. this.ultraTextMC_MFACTUR_UNITS.Text = dr["MC_MFACTUR_UNITS"].ToString();
  276. this.ultraTextMC_USE_YEAR.Text = dr["MC_USE_YEAR"].ToString();
  277. this.ultraTextMC_INSTAL_LOCAL.Text = dr["MC_INSTAL_LOCAL"].ToString();
  278. this.ultraComboMC_STAT.Text = dr["MC_STAT"].ToString();
  279. this.ultraTextMAIN_MC_NAME.Text = dr["MAIN_MC_NAME"].ToString();
  280. }
  281. }
  282. else
  283. {
  284. this.ultraTextMCID2.Enabled = true;
  285. this.ultraTextMCID2.Clear();
  286. this.ultraComboMC_STAT.Clear();
  287. this.ultraTextMC_NAME.Clear();
  288. this.ultraTextMC_MODEL.Clear();
  289. this.ultraTextMC_SPEC.Clear();
  290. this.ultraTextMC_SERVICEREASON.Clear();
  291. this.ultraCalendarENDSERVERICE_DTIME.Text = "";
  292. this.ultraCalendarSTARTSERVERICE_DTIME.Text = "";
  293. this.ultraTextSERVERICE_ID.Clear();
  294. this.ultraCalendarMC_USE_TIME.Text = "";
  295. this.ultraTextMC_NOM_CAP.Clear();
  296. this.ultraTextMC_UNIT.Clear();
  297. this.ultraTextMC_ACT.Clear();
  298. this.ultraTextMC_TAI.Clear();
  299. this.ultraTextMC_MFACTUR_UNITS.Clear();
  300. this.ultraTextMC_USE_YEAR.Clear();
  301. this.ultraTextMC_INSTAL_LOCAL.Clear();
  302. this.ultraTextMC_CARE_SECTOR.Clear();
  303. this.ultraTextMAIN_MC_NAME.Clear();
  304. }
  305. }
  306. }
  307. private void DoInsert()
  308. {
  309. if (MessageBox.Show("您确认要修改?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
  310. {
  311. string mcid, IMC_NAME, IMC_STAT, IMC_MODEL, IMC_SPEC, IMC_SERVICEREASON, IMC_SERVICE_ID, IMC_STARSERVICE, IMC_ENDESERVICE, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, IMC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_INSTAL_LOCAL, IMAIN_MC_NAME,IREG_IN_DTIME;
  312. mcid = this.ultraTextMCID2.Text;
  313. IMC_STAT = this.ultraComboMC_STAT.Text;
  314. IMC_NAME = this.ultraTextMC_NAME.Text;
  315. IMC_MODEL = this.ultraTextMC_MODEL.Text;
  316. IMC_SPEC = this.ultraTextMC_SPEC.Text;
  317. IMC_SERVICEREASON = this.ultraTextMC_SERVICEREASON.Text;
  318. IMC_STARSERVICE = this.ultraCalendarSTARTSERVERICE_DTIME.Text;
  319. IMC_ENDESERVICE = this.ultraCalendarENDSERVERICE_DTIME.Text;
  320. IMC_SERVICE_ID = this.ultraTextSERVERICE_ID.Text;
  321. IMC_USE_TIME = this.ultraCalendarMC_USE_TIME.Text;
  322. IMC_NOM_CAP = this.ultraTextMC_NOM_CAP.Text;
  323. IMC_UNIT = this.ultraTextMC_UNIT.Text;
  324. IMC_ACT = this.ultraTextMC_ACT.Text;
  325. IMC_TAI = this.ultraTextMC_TAI.Text;
  326. IMC_MFACTUR_UNITS = this.ultraTextMC_MFACTUR_UNITS.Text;
  327. IMC_USE_YEAR = this.ultraTextMC_USE_YEAR.Text;
  328. IMC_INSTAL_LOCAL = this.ultraTextMC_INSTAL_LOCAL.Text;
  329. IMC_CARE_SECTOR = this.ultraTextMC_CARE_SECTOR.Text;
  330. IMAIN_MC_NAME = this.ultraTextMAIN_MC_NAME.Text;
  331. IREG_IN_DTIME = DateTime.Now.ToString();
  332. if (mcid == "")
  333. {
  334. MessageBox.Show("设备编号必须输入!");
  335. }
  336. else
  337. {
  338. DataTable dt = new DataTable();
  339. CoreClientParam ccp = new CoreClientParam();
  340. ccp.ServerName = "UIK.UIK03.UIK030050";
  341. ccp.MethodName = "DoSelect";
  342. ccp.ServerParams = new object[] { IREG_IN_DTIME };
  343. ccp.SourceDataTable = dt;
  344. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  345. if (dt.Rows.Count > 0)
  346. {
  347. MessageBox.Show("该编设备号已经存在,请重新输入");
  348. }
  349. else
  350. {
  351. CoreClientParam ccp2 = new CoreClientParam();
  352. ccp2.ServerName = "UIK.UIK03.UIK030050";
  353. ccp2.MethodName = "DoInsert";
  354. ccp2.ServerParams = new object[] { mcid, IMC_NAME, IMC_STAT, IMC_MODEL, IMC_SPEC, IMC_SERVICEREASON, IMC_SERVICE_ID, IMC_STARSERVICE, IMC_ENDESERVICE, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, IMC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_INSTAL_LOCAL, IMAIN_MC_NAME, IREG_IN_DTIME };
  355. ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
  356. if (0 != ccp2.ReturnCode)
  357. {
  358. MessageBox.Show("添加失败!");
  359. }
  360. else
  361. {
  362. MessageBox.Show("添加成功!");
  363. this.ultraTextMCID2.Enabled = true;
  364. this.ultraTextMCID2.Clear();
  365. this.ultraComboMC_STAT.Clear();
  366. this.ultraTextMC_NAME.Clear();
  367. this.ultraTextMC_MODEL.Clear();
  368. this.ultraTextMC_SPEC.Clear();
  369. this.ultraTextMC_SERVICEREASON.Clear();
  370. this.ultraCalendarENDSERVERICE_DTIME.Text = "";
  371. this.ultraCalendarSTARTSERVERICE_DTIME.Text = "";
  372. this.ultraTextSERVERICE_ID.Clear();
  373. this.ultraCalendarMC_USE_TIME.Text = "";
  374. this.ultraTextMC_NOM_CAP.Clear();
  375. this.ultraTextMC_UNIT.Clear();
  376. this.ultraTextMC_ACT.Clear();
  377. this.ultraTextMC_TAI.Clear();
  378. this.ultraTextMC_MFACTUR_UNITS.Clear();
  379. this.ultraTextMC_USE_YEAR.Clear();
  380. this.ultraTextMC_INSTAL_LOCAL.Clear();
  381. this.ultraTextMC_CARE_SECTOR.Clear();
  382. this.ultraTextMAIN_MC_NAME.Clear();
  383. }
  384. }
  385. }
  386. }
  387. }
  388. }
  389. }