490c323cc812d1fd563a6d96a0ab003436bf3851.svn-base 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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 Infragistics.Win.UltraWinGrid;
  12. using System.Text.RegularExpressions;
  13. namespace Core.LZMes.Client.UIC
  14. {
  15. public partial class UIC020111 : FrmBase
  16. {
  17. public UIC020111()
  18. {
  19. InitializeComponent();
  20. }
  21. public override void ToolBar_Click(object sender, string ToolbarKey)
  22. {
  23. switch (ToolbarKey)
  24. {
  25. case "Query":
  26. this.DoQuery();
  27. break;
  28. case "Save":
  29. this.DoSave();
  30. break;
  31. case "Export":
  32. this.DoExport();
  33. break;
  34. case "Close":
  35. this.Close();
  36. break;
  37. }
  38. }
  39. private void DoQuery()
  40. {
  41. try
  42. {
  43. CoreClientParam ccp = new CoreClientParam();
  44. //查询
  45. this.dataSet1.Tables[0].Clear();
  46. ArrayList al = new ArrayList();
  47. al.Add("UIC020111_01.SELECT");
  48. al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") );
  49. ccp = new CoreClientParam();
  50. ccp.ServerName = "UIB.COM.ComDBQuery";
  51. ccp.MethodName = "doSimpleQuery";
  52. ccp.ServerParams = new object[] { al };
  53. ccp.IfShowErrMsg = false;
  54. ccp.SourceDataTable = this.dataSet1.Tables[0];
  55. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  56. }
  57. catch (Exception ex)
  58. {
  59. System.Diagnostics.Debug.WriteLine(ex.ToString());
  60. }
  61. }
  62. private void DoExport()
  63. {
  64. try
  65. {
  66. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  67. {
  68. string fileName = this.saveFileDialog1.FileName;
  69. ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  70. System.Diagnostics.Process.Start(fileName);
  71. }
  72. }
  73. catch (Exception EX)
  74. {
  75. MessageBox.Show(EX.ToString());
  76. }
  77. }
  78. private class TT
  79. {
  80. public bool b(string s)
  81. {
  82. string pattern = "^([0-9]{1,}[.][0-9]*)$";
  83. Regex rx = new Regex(pattern);
  84. return rx.IsMatch(s);
  85. }
  86. public bool b2(string s)
  87. {
  88. string pattern = "^([0-9]{1,})$";
  89. Regex rx = new Regex(pattern);
  90. return rx.IsMatch(s);
  91. }
  92. }
  93. private void DoSave()
  94. {
  95. try
  96. {
  97. if (MessageBox.Show("确认保存?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  98. return;
  99. ArrayList al = new ArrayList();
  100. ArrayList list = null;
  101. int num2 ;//停轧时间
  102. string strTime = "";
  103. string strProdLine = "";
  104. TT t =new TT();
  105. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  106. {
  107. if (ugr.Cells["MODIFY_FLAG"].Text == "Y")
  108. {
  109. strTime = ugr.Cells["TJ_DTIME"].Text.Trim();
  110. strProdLine = ugr.Cells["PROD_LINE"].Text.Trim();
  111. list = new ArrayList();
  112. list.Add("UIC020111_01.UPDATE");
  113. list.Add(ugr.Cells["TJ_RESULT"].Text.Trim());
  114. list.Add(ugr.Cells["TJ_DEMO"].Text.Trim());
  115. list.Add(this.UserInfo.GetUserName());
  116. list.Add(ugr.Cells["TJ_DTIME"].Text.Trim());
  117. list.Add(ugr.Cells["TJ_NAME"].Text.Trim());
  118. if (!t.b(ugr.Cells["TJ_RESULT"].Text.Trim()) && !t.b2(ugr.Cells["TJ_RESULT"].Text.Trim()))//如果转换失败(为false)时输出括号内容
  119. {
  120. MessageBox.Show("请正确输入数字");
  121. return;
  122. }
  123. al.Add(list);
  124. }
  125. }
  126. if (al.Count == 0)
  127. {
  128. MessageBox.Show("没有修改的数据,保存无效", "提示");
  129. return;
  130. }
  131. CoreClientParam ccp = new CoreClientParam();
  132. ccp.ServerName = "UIB.COM.ComDBSave";
  133. ccp.MethodName = "doXmlSave";
  134. ccp.ServerParams = new object[] { al };
  135. ccp.IfShowErrMsg = false;
  136. ccp =this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  137. this.DoQuery();
  138. }
  139. catch (Exception ex)
  140. {
  141. System.Diagnostics.Debug.WriteLine(ex.ToString());
  142. MessageBox.Show("系统发生异常,请与管理员联系", "提示");
  143. }
  144. }
  145. //private string checkSJZYSJ(string date)
  146. // private void checkSJZYSJ()
  147. // {
  148. // CoreClientParam ccp = new CoreClientParam();
  149. // Hashtable ht = new Hashtable();
  150. // ht.Add("i1", this.ComboProdLine.Text);//产线
  151. // ht.Add("i2", this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd"));//录入时间
  152. // ht.Add("i3",this.ultraComboEditor2.Value.ToString());//班组
  153. // ht.Add("o4", "");
  154. // ccp.ServerName = "UIB.COM.ComDBProcedure";
  155. // ccp.MethodName = "doXmlProcedure";
  156. // ccp.ServerParams = new object[] { "UIC020111_02.CALL", ht };
  157. // CoreClientParam ccpResult = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  158. // }
  159. private void DoInsertRow()
  160. {
  161. try
  162. {
  163. if (this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") == "" )
  164. {
  165. MessageBox.Show("请在编辑区域选择正确的日期");
  166. return;
  167. }
  168. if (MessageBox.Show("确认增加【" + this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") + "】的日志数据?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  169. return;
  170. CoreClientParam ccp = new CoreClientParam();
  171. Hashtable ht = new Hashtable();
  172. ht.Add("i1", "");//产线
  173. ht.Add("i2", this.UserInfo.GetUserName());//用户名
  174. ht.Add("i3", this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") );
  175. ht.Add("o4", "");
  176. ccp.ServerName = "UIB.COM.ComDBProcedure";
  177. ccp.MethodName = "doXmlProcedure";
  178. ccp.ServerParams = new object[] { "UIC020111_01.CALL", ht };
  179. CoreClientParam ccpResult = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  180. ArrayList al = ccpResult.ReturnObject as ArrayList;
  181. if (al[0].ToString() != "YY")
  182. {
  183. //ugr.Cells["CHEM_CD"].Appearance.BackColor = Color.Blue;
  184. MessageBox.Show(al[0].ToString(), "提示");
  185. return;
  186. }
  187. this.ultraDateTimeEditor1.Value = this.ultraDateTimeEditor3.Value.ToString();
  188. this.DoQuery();
  189. }
  190. catch (Exception ex)
  191. {
  192. System.Diagnostics.Debug.WriteLine(ex.ToString());
  193. }
  194. }
  195. string strBC = "";//班组
  196. private void UIC020111_Load(object sender, EventArgs e)
  197. {
  198. try
  199. {
  200. if (this.UserInfo.GetUserGroup() == 0 + "")
  201. strBC = "常白班";
  202. else if (this.UserInfo.GetUserGroup() == 1 + "")
  203. strBC = "甲班";
  204. else if (this.UserInfo.GetUserGroup() == 2 + "")
  205. strBC = "乙班";
  206. else if (this.UserInfo.GetUserGroup() == 3 + "")
  207. strBC = "丙班";
  208. else if (this.UserInfo.GetUserGroup() == 4 + "")
  209. strBC = "丁班";
  210. //this.labelBC.Text = "提醒:当前登录班组为" + strBC + ",非" + strBC + "人员禁止增加该班的数据。";
  211. }
  212. catch (Exception ex)
  213. {
  214. System.Diagnostics.Debug.WriteLine(ex.ToString());
  215. }
  216. }
  217. private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  218. {
  219. try
  220. {
  221. this.ultraGrid1.ActiveRow.Appearance.ForeColor = Color.Red;//红色
  222. this.ultraGrid1.ActiveRow.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;//设置为粗体
  223. this.ultraGrid1.ActiveRow.Cells["MODIFY_FLAG"].Value = "Y";
  224. this.ultraGrid1.Update();
  225. }
  226. catch (Exception ex)
  227. {
  228. System.Diagnostics.Debug.WriteLine(ex.ToString());
  229. }
  230. }
  231. private void ultraGrid1_KeyUp(object sender, KeyEventArgs e)
  232. {
  233. try
  234. {
  235. if(e.KeyCode != Keys.Enter)
  236. return;
  237. if (this.ultraGrid1.ActiveCell == null)
  238. return;
  239. string keyName = this.ultraGrid1.ActiveCell.Column.Key;
  240. this.ultraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.NextRow);
  241. this.ultraGrid1.ActiveRow.Cells[keyName].Activated = true;
  242. this.ultraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);
  243. }
  244. catch (Exception ex)
  245. {
  246. System.Diagnostics.Debug.WriteLine(ex.ToString());
  247. }
  248. }
  249. private void button1_Click(object sender, EventArgs e)
  250. {
  251. this.DoInsertRow();
  252. }
  253. }
  254. }