UIK030060.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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 UIK030060 : FrmBase
  14. {
  15. public UIK030060()
  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. try
  37. {
  38. string mc_id = this.ultraTextMC_ID.Text.ToString();
  39. CoreClientParam ccp = new CoreClientParam();
  40. DataTable dt = new DataTable();
  41. if (mc_id == "")
  42. {
  43. MessageBox.Show("请输入主体设备名称");
  44. }
  45. else
  46. {
  47. this.ultraTextMC_ID.Clear();
  48. ccp.ServerName = "UIK.UIK03.UIK030060";
  49. ccp.MethodName = "DoQuery";
  50. ccp.ServerParams = new object[] { mc_id };
  51. ccp.SourceDataTable = dt;
  52. //CoreClientParam obj = this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  53. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  54. this.ultraGrid1.DataSource = dt;
  55. if (dt.Rows.Count <= 0)
  56. {
  57. MessageBox.Show("该主体设备名称不存在!");
  58. }
  59. return;
  60. }
  61. }
  62. catch (Exception Ex)
  63. {
  64. MessageBox.Show(Ex.ToString());
  65. }
  66. }
  67. private void DoUpdate()
  68. {
  69. if (this.ultraTextMCID2.Text == "")
  70. {
  71. MessageBox.Show("请选中需要修改的项");
  72. }
  73. else
  74. {
  75. if (MessageBox.Show("您确认要修改?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
  76. {
  77. try
  78. {
  79. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  80. if (ugr.Cells["SELECT_ITEM"].Value.ToString() == "True")
  81. {
  82. string mcid, IMC_NAME, IMC_SPEC, IMC_FACTORY, IMC_IN_DTIME, IMC_PRICE, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, IMC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_STARTTIME, IMC_OPER_ID, IMC_INSTAL_LOCAL, IMC_MODEL, IMC_STAT, IMAIN_MC_NAME, IREG_IN_DTIME;
  83. mcid = ugr.Cells["MC_ID"].Value.ToString();
  84. this.ultraTextMCID2.Enabled = false;
  85. IREG_IN_DTIME = ugr.Cells["REG_IN_DTIME"].Value.ToString();
  86. IMC_NAME = this.ultraTextMC_NAME.Text;
  87. IMC_STAT = this.ultraComboMC_STAT.Text;
  88. IMC_MODEL = this.ultraTextMC_MODEL.Text;
  89. IMC_SPEC = this.ultraTextMC_SPEC.Text;
  90. IMC_PRICE = this.ultraTextPRICE.Text;
  91. IMC_IN_DTIME = this.ultraCalendarMC_IN_DTIME.Text;
  92. IMC_CARE_SECTOR = this.ultraTextMC_CARE_SECTOR.Text;
  93. IMC_NOM_CAP = this.ultraTextMC_NOM_CAP.Text;
  94. IMC_UNIT = this.ultraTextMC_UNIT.Text;
  95. IMC_TAI = this.ultraTextMC_TAI.Text;
  96. IMC_ACT = this.ultraTextMC_ACT.Text;
  97. IMC_MFACTUR_UNITS = this.ultraTextMC_MFACTUR_UNITS.Text;
  98. IMC_USE_YEAR = this.ultraTextMC_USE_YEAR.Text;
  99. IMC_USE_TIME = this.ultraCalendarMC_USE_TIME.Text;
  100. IMC_INSTAL_LOCAL = this.ultraTextMC_INSTAL_LOCAL.Text;
  101. IMC_FACTORY = this.ultraTextMC_FACTORY.Text;
  102. IMC_STARTTIME = this.ultraCalendarMC_STARTTIME.Text;
  103. IMC_OPER_ID = this.ultraTextMC_OPER_ID.Text;
  104. IMAIN_MC_NAME = this.ultraTextMAIN_MC_NAME.Text;
  105. CoreClientParam ccp2 = new CoreClientParam();
  106. ccp2.ServerName = "UIK.UIK03.UIK030060";
  107. ccp2.MethodName = "DoUpdate";
  108. ccp2.ServerParams = new object[] { IMC_NAME, IMC_SPEC, IMC_FACTORY, IMC_IN_DTIME, IMC_PRICE, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, IMC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_STARTTIME, IMC_OPER_ID, IMC_INSTAL_LOCAL, IMC_MODEL, IMC_STAT, IMAIN_MC_NAME, IREG_IN_DTIME };
  109. ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
  110. if (0 != ccp2.ReturnCode)
  111. {
  112. MessageBox.Show("修改失败!");
  113. }
  114. else
  115. {
  116. MessageBox.Show("修改成功!");
  117. this.ultraTextMCID2.Enabled = true;
  118. this.ultraTextMCID2.Clear();
  119. this.ultraTextMC_NAME.Clear();
  120. this.ultraComboMC_STAT.Clear();
  121. this.ultraTextMC_MODEL.Clear();
  122. this.ultraTextMC_SPEC.Clear();
  123. this.ultraTextMC_CARE_SECTOR.Clear();
  124. this.ultraTextMC_NOM_CAP.Clear();
  125. this.ultraTextMC_UNIT.Clear();
  126. this.ultraTextMC_TAI.Clear();
  127. this.ultraTextMC_ACT.Clear();
  128. this.ultraTextMC_MFACTUR_UNITS.Clear();
  129. this.ultraTextMC_USE_YEAR.Clear();
  130. this.ultraCalendarMC_USE_TIME.Text = "";
  131. this.ultraTextMC_INSTAL_LOCAL.Clear();
  132. this.ultraTextMC_FACTORY.Clear();
  133. this.ultraCalendarMC_IN_DTIME.Text = "";
  134. this.ultraTextPRICE.Clear();
  135. this.ultraCalendarMC_STARTTIME.Text = "";
  136. this.ultraTextMC_OPER_ID.Clear();
  137. }
  138. }
  139. else
  140. {
  141. MessageBox.Show("请选择修改行!");
  142. }
  143. }
  144. catch (Exception Ex)
  145. {
  146. MessageBox.Show(Ex.ToString());
  147. }
  148. }
  149. }
  150. }
  151. private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  152. {
  153. if (e.Cell.Column.Key == "SELECT_ITEM")
  154. {
  155. if (e.Cell.Text == "True")
  156. {
  157. string mcid, IREG_IN_DTIME;
  158. ultraTextMCID2.Text = e.Cell.Row.Cells["MC_ID"].Text;
  159. this.ultraTextMCID2.Text = e.Cell.Row.Cells["MC_ID"].Text;
  160. mcid = e.Cell.Row.Cells["MC_ID"].Text;
  161. this.ultraTextMCID2.Enabled = false;
  162. IREG_IN_DTIME = e.Cell.Row.Cells["REG_IN_DTIME"].Text;
  163. DataTable dt = new DataTable();
  164. CoreClientParam ccp = new CoreClientParam();
  165. ccp.ServerName = "UIK.UIK03.UIK030060";
  166. ccp.MethodName = "DoSelect";
  167. ccp.ServerParams = new object[] { IREG_IN_DTIME };
  168. ccp.SourceDataTable = dt;
  169. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  170. foreach (DataRow dr in dt.Rows)
  171. {
  172. this.ultraTextMC_NAME.Text = dr["MC_NAME"].ToString();
  173. this.ultraComboMC_STAT.Text = dr["MC_STAT"].ToString();
  174. this.ultraTextMC_MODEL.Text = dr["MC_MODEL"].ToString();
  175. this.ultraTextMC_SPEC.Text = dr["MC_SPEC"].ToString();
  176. this.ultraTextMC_CARE_SECTOR.Text = dr["MC_CARE_SECTOR"].ToString();
  177. this.ultraTextMC_NOM_CAP.Text = dr["MC_NOM_CAP"].ToString();
  178. this.ultraTextMC_UNIT.Text = dr["MC_UNIT"].ToString();
  179. this.ultraTextMC_TAI.Text = dr["MC_TAI"].ToString();
  180. this.ultraTextMC_ACT.Text = dr["MC_ACT"].ToString();
  181. this.ultraTextMC_MFACTUR_UNITS.Text = dr["MC_MFACTUR_UNITS"].ToString();
  182. this.ultraTextMC_USE_YEAR.Text = dr["MC_USE_YEAR"].ToString();
  183. this.ultraCalendarMC_USE_TIME.Text = dr["MC_USE_TIME"].ToString();
  184. this.ultraTextMC_INSTAL_LOCAL.Text = dr["MC_INSTAL_LOCAL"].ToString();
  185. this.ultraTextMC_FACTORY.Text = dr["MC_FACTORY"].ToString();
  186. this.ultraCalendarMC_IN_DTIME.Text = dr["MC_IN_DTIME"].ToString();
  187. this.ultraTextPRICE.Text = dr["MC_PRICE"].ToString();
  188. this.ultraCalendarMC_STARTTIME.Text = dr["MC_STARTTIME"].ToString();
  189. this.ultraTextMC_OPER_ID.Text = dr["MC_OPER_ID"].ToString();
  190. this.ultraTextMAIN_MC_NAME.Text = dr["MAIN_MC_NAME"].ToString();
  191. }
  192. }
  193. else
  194. {
  195. this.ultraTextMCID2.Enabled = true;
  196. this.ultraTextMCID2.Clear();
  197. this.ultraTextMC_NAME.Clear();
  198. this.ultraComboMC_STAT.Clear();
  199. this.ultraTextMC_MODEL.Clear();
  200. this.ultraTextMC_SPEC.Clear();
  201. this.ultraTextMC_CARE_SECTOR.Clear();
  202. this.ultraTextMC_NOM_CAP.Clear();
  203. this.ultraTextMC_UNIT.Clear();
  204. this.ultraTextMC_TAI.Clear();
  205. this.ultraTextMC_ACT.Clear();
  206. this.ultraTextMC_MFACTUR_UNITS.Clear();
  207. this.ultraTextMC_USE_YEAR.Clear();
  208. this.ultraCalendarMC_USE_TIME.Text = "";
  209. this.ultraTextMC_INSTAL_LOCAL.Clear();
  210. this.ultraTextMC_FACTORY.Clear();
  211. this.ultraCalendarMC_IN_DTIME.Text = "";
  212. this.ultraTextPRICE.Clear();
  213. this.ultraCalendarMC_STARTTIME.Text ="";
  214. this.ultraTextMC_OPER_ID.Clear();
  215. this.ultraTextMAIN_MC_NAME.Clear();
  216. }
  217. }
  218. }
  219. private void DoInsert()
  220. {
  221. if (MessageBox.Show("您确认要添加?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
  222. {
  223. string mcid, IMC_NAME, IMC_SPEC, IMC_FACTORY, IMC_IN_DTIME, IMC_PRICE, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, IMC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_STARTTIME, IMC_OPER_ID, IMC_INSTAL_LOCAL, IMC_MODEL, IMC_STAT, IREG_IN_DTIME, IMAIN_MC_NAME;
  224. mcid = this.ultraTextMCID2.Text;
  225. IMC_NAME = this.ultraTextMC_NAME.Text;
  226. IMC_STAT = this.ultraComboMC_STAT.Text;
  227. IMC_MODEL = this.ultraTextMC_MODEL.Text;
  228. IMC_SPEC = this.ultraTextMC_SPEC.Text;
  229. IMC_PRICE = this.ultraTextPRICE.Text;
  230. IMC_IN_DTIME = this.ultraCalendarMC_IN_DTIME.Text;
  231. IMC_CARE_SECTOR = this.ultraTextMC_CARE_SECTOR.Text;
  232. IMC_NOM_CAP = this.ultraTextMC_NOM_CAP.Text;
  233. IMC_UNIT = this.ultraTextMC_UNIT.Text;
  234. IMC_TAI = this.ultraTextMC_TAI.Text;
  235. IMC_ACT = this.ultraTextMC_ACT.Text;
  236. IMC_MFACTUR_UNITS = this.ultraTextMC_MFACTUR_UNITS.Text;
  237. IMC_USE_YEAR = this.ultraTextMC_USE_YEAR.Text;
  238. IMC_USE_TIME = this.ultraCalendarMC_USE_TIME.Text;
  239. IMC_INSTAL_LOCAL = this.ultraTextMC_INSTAL_LOCAL.Text;
  240. IMC_FACTORY = this.ultraTextMC_FACTORY.Text;
  241. IMC_STARTTIME = this.ultraCalendarMC_STARTTIME.Text;
  242. IMC_OPER_ID = this.ultraTextMC_OPER_ID.Text;
  243. IMAIN_MC_NAME = this.ultraTextMAIN_MC_NAME.Text;
  244. IREG_IN_DTIME = DateTime.Now.ToString();
  245. if (mcid == "")
  246. {
  247. MessageBox.Show("主体设备名称不能为空!");
  248. }
  249. else
  250. {
  251. DataTable dt = new DataTable();
  252. CoreClientParam ccp = new CoreClientParam();
  253. ccp.ServerName = "UIK.UIK03.UIK030060";
  254. ccp.MethodName = "DoSelect";
  255. ccp.ServerParams = new object[] { IREG_IN_DTIME };
  256. ccp.SourceDataTable = dt;
  257. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  258. if (dt.Rows.Count > 0)
  259. {
  260. MessageBox.Show("该编设备号已经存在,请重新输入");
  261. }
  262. else
  263. {
  264. CoreClientParam ccp2 = new CoreClientParam();
  265. ccp2.ServerName = "UIK.UIK03.UIK030060";
  266. ccp2.MethodName = "DoInsert";
  267. ccp2.ServerParams = new object[] { mcid, IMC_NAME, IMC_SPEC, IMC_FACTORY, IMC_IN_DTIME, IMC_PRICE, IMC_CARE_SECTOR, IMC_NOM_CAP, IMC_UNIT, IMC_TAI, IMC_ACT, IMC_MFACTUR_UNITS, IMC_USE_YEAR, IMC_USE_TIME, IMC_STARTTIME, IMC_OPER_ID, IMC_INSTAL_LOCAL, IMC_MODEL, IMC_STAT, IMAIN_MC_NAME, IREG_IN_DTIME };
  268. ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
  269. if (0 != ccp2.ReturnCode)
  270. {
  271. MessageBox.Show("添加失败!");
  272. }
  273. else
  274. {
  275. MessageBox.Show("添加成功!");
  276. this.ultraTextMCID2.Enabled = true;
  277. this.ultraTextMCID2.Clear();
  278. this.ultraTextMC_NAME.Clear();
  279. this.ultraComboMC_STAT.Clear();
  280. this.ultraTextMC_MODEL.Clear();
  281. this.ultraTextMC_SPEC.Clear();
  282. this.ultraTextMC_CARE_SECTOR.Clear();
  283. this.ultraTextMC_NOM_CAP.Clear();
  284. this.ultraTextMC_UNIT.Clear();
  285. this.ultraTextMC_TAI.Clear();
  286. this.ultraTextMC_ACT.Clear();
  287. this.ultraTextMC_MFACTUR_UNITS.Clear();
  288. this.ultraTextMC_USE_YEAR.Clear();
  289. this.ultraCalendarMC_USE_TIME.Text = "";
  290. this.ultraTextMC_INSTAL_LOCAL.Clear();
  291. this.ultraTextMC_FACTORY.Clear();
  292. this.ultraCalendarMC_IN_DTIME.Text = "";
  293. this.ultraTextPRICE.Clear();
  294. this.ultraCalendarMC_STARTTIME.Text = "";
  295. this.ultraTextMC_OPER_ID.Clear();
  296. this.ultraTextMAIN_MC_NAME.Clear();
  297. }
  298. }
  299. }
  300. }
  301. }
  302. private void UIK030060_Load(object sender, EventArgs e)
  303. {
  304. this.ultraCalendarMC_IN_DTIME.Text = "";
  305. this.ultraCalendarMC_STARTTIME.Text = "";
  306. this.ultraCalendarMC_USE_TIME.Text = "";
  307. }
  308. }
  309. }