UIK010090.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  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. using System.Diagnostics;
  12. namespace Core.LZMes.Client.UIK
  13. {
  14. public partial class UIK010090 : FrmBase
  15. {
  16. public UIK010090()
  17. {
  18. InitializeComponent();
  19. }
  20. public override void ToolBar_Click(object sender, string ToolbarKey)
  21. {
  22. switch (ToolbarKey)
  23. {
  24. case "Query"://查询
  25. this.DoQuery();
  26. break;
  27. case "Insert"://添加反射率检验记录
  28. this.DoInsert();
  29. break;
  30. case "Update"://修改反射率检验记录
  31. this.DoUpdate();
  32. break;
  33. case "Export":
  34. this.DoExport();
  35. break;
  36. case "Delete"://删除反射率检验记录
  37. this.DoDelete();
  38. break;
  39. }
  40. }
  41. private void UIK010090_Load(object sender, EventArgs e)
  42. {
  43. this.ultraDateTimeEditor1.Enabled = this.checkBox1.Checked;
  44. this.ultraDateTimeEditor2.Enabled = this.checkBox1.Checked;
  45. }
  46. private void DoQuery()
  47. {
  48. try
  49. {
  50. ArrayList al = new ArrayList();
  51. al.Add("UIK010090_01.SELECT");
  52. al.Add(this.textBox9_coilNo.Text.Trim());//钢卷号
  53. al.Add(this.textBox3_stl_grd.Text.Trim());//牌号
  54. if (this.checkBox1.Checked)
  55. {
  56. al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyy-MM-dd") + " 00:00:00.000");//日期
  57. al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyy-MM-dd") + " 99:99:99.999");//日期
  58. }
  59. else
  60. {
  61. al.Add("");
  62. al.Add("");
  63. }
  64. this.dataSet1.Tables[0].Clear();
  65. CoreClientParam ccp = new CoreClientParam();
  66. ccp.ServerName = "UIB.COM.ComDBQuery";
  67. ccp.MethodName = "doSimpleQuery";
  68. ccp.ServerParams = new object[] { al };
  69. ccp.SourceDataTable = this.dataSet1.Tables[0];
  70. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  71. DataRowCollection drc1 = this.dataSet1.Tables[0].Rows;
  72. if (drc1.Count <= 0)
  73. {
  74. MessageBox.Show("暂无反射率检验记录!");
  75. }
  76. this.clearTextBoxData();
  77. }
  78. catch (Exception ex)
  79. {
  80. MessageBox.Show(ex.ToString());
  81. }
  82. }
  83. private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  84. {
  85. if (e.Cell.Column.Key == "SELECT_ITEM")
  86. {
  87. if (e.Cell.Text == "True")
  88. {
  89. string edit_coilno = e.Cell.Row.Cells["COIL_NO"].Text;
  90. string edit_REG_DTIME = e.Cell.Row.Cells["REG_DTIME"].Text;
  91. /*for循环控制单选*/
  92. int i = this.ultraGrid1.Rows.Count;
  93. for (int j = 0; j < i; j++)
  94. {
  95. if (this.ultraGrid1.Rows[j].Cells["COIL_NO"].Value.ToString() != edit_coilno &&
  96. this.ultraGrid1.Rows[j].Cells["REG_DTIME"].Value.ToString() != edit_REG_DTIME)
  97. {
  98. this.ultraGrid1.Rows[j].Cells["SELECT_ITEM"].Value = false;
  99. }
  100. }
  101. this.ultraTextcoil_no.Text = edit_coilno;
  102. this.ultraTextEditor_regTime.Text = edit_REG_DTIME;
  103. this.ultraComboSPEC_STL_GRD.Text = e.Cell.Row.Cells["SPEC_STL_GRD"].Text;
  104. this.ultraTextcoil_thk.Text = e.Cell.Row.Cells["COIL_THK"].Text;
  105. this.ultraTextcoil_wth.Text = e.Cell.Row.Cells["COIL_WTH"].Text;
  106. this.ultraTextbef_wash.Text = e.Cell.Row.Cells["BEF_WASH_FSL"].Text;
  107. this.ultraTextlater_wash.Text = e.Cell.Row.Cells["LATER_WASH_FSL"].Text;
  108. this.textBoxremark_info.Text = e.Cell.Row.Cells["REMARK_INFO"].Text;
  109. }
  110. else
  111. {
  112. this.clearTextBoxData();
  113. }
  114. }
  115. }
  116. private void DoUpdate()
  117. {
  118. if (MessageBox.Show("您确认要修改?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
  119. {
  120. try
  121. {
  122. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  123. if (ugr.Cells["SELECT_ITEM"].Text.ToString() == "True")
  124. {
  125. if (this.ultraTextcoil_no.Text == "")
  126. {
  127. MessageBox.Show("钢卷号不允许为空!", "提示");
  128. return;
  129. }
  130. if (this.ultraTextEditor_regTime.Text == "")
  131. {
  132. MessageBox.Show("该记录不存在,不能修改!", "提示");
  133. return;
  134. }
  135. ArrayList list = new ArrayList();
  136. list.Add("UIK010090_01.UPDATE");
  137. list.Add(this.ultraTextcoil_no.Text.ToString());
  138. list.Add(this.ultraComboSPEC_STL_GRD.Text.ToString());
  139. list.Add(this.ultraTextcoil_thk.Text.ToString());
  140. list.Add(this.ultraTextcoil_wth.Text.ToString());
  141. list.Add(this.ultraTextbef_wash.Text.ToString());
  142. list.Add(this.ultraTextlater_wash.Text.ToString());
  143. list.Add(this.textBoxremark_info.Text.ToString());
  144. list.Add(this.UserInfo.GetUserOrderText());
  145. list.Add(this.UserInfo.GetUserGroupText());
  146. list.Add(this.UserInfo.GetUserName());
  147. list.Add(ugr.Cells["COIL_NO"].Text);
  148. list.Add(ugr.Cells["REG_DTIME"].Text);
  149. CoreClientParam ccp = new CoreClientParam();
  150. ccp.ServerName = "UIB.COM.ComDBSave";
  151. ccp.MethodName = "doXmlSave";
  152. ccp.ServerParams = new object[] { list };
  153. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  154. this.DoQuery();
  155. this.clearTextBoxData();
  156. }
  157. else
  158. {
  159. MessageBox.Show("请选择修改行!");
  160. }
  161. }
  162. catch (Exception Ex)
  163. {
  164. MessageBox.Show(Ex.ToString());
  165. }
  166. }
  167. }
  168. private void DoInsert()
  169. {
  170. if (MessageBox.Show("您确认要添加数据吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
  171. {
  172. try
  173. {
  174. if (this.ultraTextcoil_no.Text.ToString() == "")
  175. {
  176. MessageBox.Show("钢卷号不允许为空!", "提示");
  177. return;
  178. }
  179. if (this.ultraTextEditor_regTime.Text.ToString() != "")
  180. {
  181. MessageBox.Show("请不要勾选行记录!", "提示");
  182. return;
  183. }
  184. ArrayList list = new ArrayList();
  185. list.Add("UIK010090_01.INSERT");
  186. list.Add(this.ultraTextcoil_no.Text.ToString());
  187. list.Add(this.ultraComboSPEC_STL_GRD.Text.ToString());
  188. list.Add(this.ultraTextcoil_thk.Text.ToString());
  189. list.Add(this.ultraTextcoil_wth.Text.ToString());
  190. list.Add(this.ultraTextbef_wash.Text.ToString());
  191. list.Add(this.ultraTextlater_wash.Text.ToString());
  192. list.Add(this.textBoxremark_info.Text.ToString());
  193. list.Add(this.UserInfo.GetUserOrderText());
  194. list.Add(this.UserInfo.GetUserGroupText());
  195. list.Add("UIK010090");
  196. list.Add(this.UserInfo.GetUserName());
  197. CoreClientParam ccp = new CoreClientParam();
  198. ccp.ServerName = "UIB.COM.ComDBSave";
  199. ccp.MethodName = "doXmlSave";
  200. ccp.ServerParams = new object[] { list };
  201. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  202. this.DoQuery();
  203. this.clearTextBoxData();
  204. }
  205. catch (Exception Ex)
  206. {
  207. MessageBox.Show(Ex.ToString());
  208. }
  209. }
  210. }
  211. public void DoDelete()
  212. {
  213. try
  214. {
  215. if (MessageBox.Show("确定删除选中的反射率检验记录?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  216. return;
  217. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  218. if (ugr.Cells["SELECT_ITEM"].Text.ToString() == "True")
  219. {
  220. if (ugr.Cells["REG_DTIME"].Text.ToString() == "")
  221. {
  222. MessageBox.Show("该记录不存在!", "提示");
  223. return;
  224. }
  225. ArrayList list = new ArrayList();
  226. list.Add("UIK010090_01.delete");
  227. list.Add(ugr.Cells["COIL_NO"].Text.ToString());
  228. list.Add(ugr.Cells["REG_DTIME"].Text.ToString());
  229. CoreClientParam ccp = new CoreClientParam();
  230. ccp.ServerName = "UIB.COM.ComDBSave";
  231. ccp.MethodName = "doXmlSave";
  232. ccp.ServerParams = new object[] { list };
  233. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  234. this.DoQuery();
  235. this.clearTextBoxData();
  236. }
  237. else
  238. {
  239. MessageBox.Show("请选择需要删除的记录!");
  240. }
  241. }
  242. catch (Exception ex)
  243. {
  244. MessageBox.Show(ex.ToString());
  245. }
  246. }
  247. public void DoExport()
  248. {
  249. try
  250. {
  251. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  252. {
  253. string fName = this.saveFileDialog1.FileName;
  254. this.ultraGridExcelExporter1.Export(this.ultraGrid1, fName);
  255. Process.Start(fName);
  256. }
  257. }
  258. catch (Exception ex)
  259. {
  260. System.Diagnostics.Debug.WriteLine(ex.ToString());
  261. }
  262. }
  263. //清空编辑区域的数据
  264. private void clearTextBoxData()
  265. {
  266. this.ultraTextcoil_no.Clear();
  267. this.ultraTextEditor_regTime.Clear();
  268. this.ultraComboSPEC_STL_GRD.Clear();
  269. this.ultraTextcoil_thk.Clear();
  270. this.ultraTextcoil_wth.Clear();
  271. this.ultraTextbef_wash.Clear();
  272. this.ultraTextlater_wash.Clear();
  273. this.textBoxremark_info.Clear();
  274. }
  275. //时间查询参数选择事件
  276. private void checkBox1_Click(object sender, EventArgs e)
  277. {
  278. this.ultraDateTimeEditor1.Enabled = this.checkBox1.Checked;
  279. this.ultraDateTimeEditor2.Enabled = this.checkBox1.Checked;
  280. }
  281. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  282. {
  283. }
  284. }
  285. }