UIF042050.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using CoreFS.CA06;
  11. using Infragistics.Win.UltraWinGrid;
  12. using System.Diagnostics;
  13. namespace Core.LZMes.Client.UIF
  14. {
  15. public partial class UIF042050 : FrmBase
  16. {
  17. public UIF042050()
  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 "Ref":
  32. this.DoRef();
  33. break;
  34. case "exp":
  35. this.DoExport();
  36. break;
  37. case "Close":
  38. this.Close();
  39. break;
  40. }
  41. }
  42. private void DoExport()
  43. {
  44. try
  45. {
  46. if (this.ultraGrid1.Rows.Count == 0)
  47. {
  48. MessageBox.Show("没有可以导出的数据", "提示");
  49. return;
  50. }
  51. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  52. {
  53. string fName = this.saveFileDialog1.FileName;
  54. this.ultraGridExcelExporter1.Export(this.ultraGrid1, fName);
  55. Process.Start(fName);
  56. }
  57. //if (this.saveFileDialog1.ShowDialog(this)==DialogResult.OK)
  58. // {
  59. // string fname=this.savefile
  60. }
  61. catch (Exception ex)
  62. {
  63. System.Diagnostics.Debug.WriteLine(ex.ToString());
  64. }
  65. }
  66. private void DoQuery()
  67. {
  68. try
  69. {
  70. CoreClientParam ccp = new CoreClientParam();
  71. //查询
  72. this.dataSet1.Tables[0].Clear();
  73. ArrayList al = new ArrayList();
  74. al.Add("UIF042050_01.SELECT");
  75. al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") + "000000");//日期
  76. al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") + "999999");//日期
  77. al.Add(this.textBoxRoll1.Text);//单元号
  78. if (this.textBoxRoll2.Text == "")
  79. {
  80. al.Add(this.textBoxRoll1.Text);//单元号
  81. }
  82. else
  83. {
  84. al.Add(this.textBoxRoll2.Text);//单元号
  85. }
  86. al.Add(this.ultraComboEditor1.Value.ToString());
  87. ccp = new CoreClientParam();
  88. ccp.ServerName = "UIB.COM.ComDBQuery";
  89. ccp.MethodName = "doSimpleQuery";
  90. ccp.ServerParams = new object[] { al };
  91. ccp.IfShowErrMsg = false;
  92. ccp.SourceDataTable = this.dataSet1.Tables[0];
  93. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  94. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  95. {
  96. if (ugr.Cells["STATUS_CD"].Value.ToString() == "A")
  97. {
  98. ugr.Appearance.BackColor = Color.YellowGreen;
  99. }
  100. else if (ugr.Cells["STATUS_CD"].Value.ToString() == "B")
  101. {
  102. ugr.Appearance.BackColor = Color.Gold;
  103. }
  104. else if (ugr.Cells["STATUS_CD"].Value.ToString() == "C")
  105. {
  106. ugr.Appearance.BackColor = Color.PaleGreen;
  107. }
  108. else if (ugr.Cells["STATUS_CD"].Value.ToString() == "D")
  109. {
  110. ugr.Appearance.BackColor = Color.Pink;
  111. }
  112. else if (ugr.Cells["STATUS_CD"].Value.ToString() == "E")
  113. {
  114. ugr.Appearance.BackColor = Color.LightGray;
  115. }
  116. }
  117. }
  118. catch (Exception ex)
  119. {
  120. System.Diagnostics.Debug.WriteLine(ex.ToString());
  121. }
  122. }
  123. private void DoSave()
  124. {
  125. try
  126. {
  127. if (this.UserInfo.GetUserName() != "黄涛" && this.UserInfo.GetRole() != "admin" && this.UserInfo.GetRole() != "lz_sys_admin")
  128. {
  129. MessageBox.Show("没有操作权限,禁止操作", "警告");
  130. return;
  131. }
  132. this.checkBox1.Visible = true;
  133. ArrayList al = new ArrayList();
  134. ArrayList list = null;
  135. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  136. {
  137. //if (ugr.Cells["MODIFY_FLAG"].Text == "Y")
  138. //{
  139. list = new ArrayList();
  140. list.Add("UIF042050_01.UPDATE");
  141. //string cutEdgeYN = Convert.ToString(Common.FixDBManager.CheckNullStr(ugr.Cells["CUT_EDGE_YN"]));
  142. //list.Add(ugr.Cells["CUT_EDGE_YN"].Text.Trim());
  143. string cutEdgeYN = ugr.Cells["CUT_EDGE_YN"].Value.ToString();
  144. list.Add(cutEdgeYN);
  145. list.Add(ugr.Cells["HARSHNESS"].Text.Trim());
  146. list.Add(ugr.Cells["EXTSHAPE_REQ"].Text.Trim());
  147. list.Add(ugr.Cells["DIVID_YN"].Text.Trim());
  148. list.Add(ugr.Cells["PACKAGE_LV"].Value.ToString().Trim());
  149. list.Add(ugr.Cells["DEMO"].Value.ToString().Trim());
  150. list.Add(ugr.Cells["COIL_EDT_SEQ"].Text.Trim());
  151. al.Add(list);
  152. // }
  153. }
  154. if (al.Count == 0)
  155. {
  156. MessageBox.Show("没有修改的数据,保存无效", "提示");
  157. return;
  158. }
  159. CoreClientParam ccp = new CoreClientParam();
  160. ccp.ServerName = "UIB.COM.ComDBSave";
  161. ccp.MethodName = "doXmlSave";
  162. ccp.ServerParams = new object[] { al };
  163. ccp.IfShowErrMsg = false;
  164. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  165. this.DoQuery();
  166. }
  167. catch (Exception ex)
  168. {
  169. System.Diagnostics.Debug.WriteLine(ex.ToString());
  170. MessageBox.Show("系统发生异常,请与管理员联系", "提示");
  171. }
  172. }
  173. private void DoRef()//刷新
  174. {
  175. try
  176. {
  177. if (this.UserInfo.GetUserName() != "黄涛" && this.UserInfo.GetRole() != "admin" && this.UserInfo.GetRole() != "lz_sys_admin")
  178. {
  179. MessageBox.Show("没有操作权限,禁止操作", "警告");
  180. return;
  181. }
  182. CoreClientParam ccp = new CoreClientParam();
  183. Hashtable ht = new Hashtable();
  184. ht.Add("i1", this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") + "000000");//日期
  185. ht.Add("i2", this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") + "999999");//日期
  186. ht.Add("o3", "");
  187. ccp.ServerName = "UIB.COM.ComDBProcedure";
  188. ccp.MethodName = "doXmlProcedure";
  189. ccp.ServerParams = new object[] { "UIF042050_01.CALL", ht };
  190. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  191. this.DoQuery();
  192. }
  193. catch (Exception ex)
  194. {
  195. System.Diagnostics.Debug.WriteLine(ex.ToString());
  196. }
  197. }
  198. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  199. {
  200. try
  201. {
  202. this.ultraGrid1.ActiveRow.Cells["MODIFY_FLAG"].Value = "Y";
  203. this.ultraGrid1.UpdateData();
  204. }
  205. catch (Exception ex)
  206. {
  207. System.Diagnostics.Debug.WriteLine(ex.ToString());
  208. }
  209. }
  210. private void UIF042050_Load(object sender, EventArgs e)
  211. {
  212. this.ultraComboEditor1.SelectedIndex = 0;
  213. if (this.UserInfo.GetUserName() == "黄涛" || this.UserInfo.GetRole() == "admin" || this.UserInfo.GetRole() == "lz_sys_admin")
  214. {
  215. this.checkBox1.Visible = true;
  216. }
  217. }
  218. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  219. {
  220. try
  221. {
  222. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  223. { //this.comboxCut.SelectedIndex=0;
  224. ugr.Cells["CUT_EDGE_YN"].Value = this.checkBox1.Checked;
  225. if (ugr.Cells["CUT_EDGE_YN"].Value.ToString() == "True")
  226. {
  227. this.comboxCut.SelectedIndex = 0;
  228. }
  229. else
  230. {
  231. this.comboxCut.SelectedIndex = 1;
  232. }
  233. ugr.Cells["CUT_EDGE_YN"].Value =this.comboxCut.SelectedItem.ToString() ;
  234. // MessageBox.Show(ugr.Cells["CUT_EDGE_YN"].Value.ToString());
  235. ugr.Update();
  236. }
  237. }
  238. catch (Exception ex)
  239. {
  240. System.Diagnostics.Debug.WriteLine(ex.ToString());
  241. }
  242. }
  243. }
  244. }