UIF042051.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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 UIF042051 : FrmBase
  16. {
  17. public UIF042051()
  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_02.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 = this.lab_plan.BackColor;
  99. }
  100. else if (ugr.Cells["STATUS_CD"].Value.ToString() == "B")
  101. {
  102. ugr.Appearance.BackColor = this.lab_Standby.BackColor;
  103. }
  104. else if (ugr.Cells["STATUS_CD"].Value.ToString() == "C")
  105. {
  106. ugr.Appearance.BackColor = this.lab_P.BackColor;
  107. }
  108. else if (ugr.Cells["STATUS_CD"].Value.ToString() == "D")
  109. {
  110. ugr.Appearance.BackColor = this.lab_E.BackColor;
  111. }
  112. }
  113. }
  114. catch (Exception ex)
  115. {
  116. System.Diagnostics.Debug.WriteLine(ex.ToString());
  117. }
  118. }
  119. private void DoSave()
  120. {
  121. try
  122. {
  123. if (this.UserInfo.GetUserName() != "黄涛" && this.UserInfo.GetRole() != "admin" && this.UserInfo.GetRole() != "lz_sys_admin")
  124. {
  125. MessageBox.Show("没有操作权限,禁止操作", "警告");
  126. return;
  127. }
  128. this.checkBox1.Visible = true;
  129. this.DoRef();
  130. ArrayList al = new ArrayList();
  131. ArrayList list = null;
  132. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  133. {
  134. if (ugr.Cells["MODIFY_FLAG"].Text == "Y")
  135. {
  136. list = new ArrayList();
  137. list.Add("UIF042050_01.UPDATE");
  138. //string cutEdgeYN = Convert.ToString(Common.FixDBManager.CheckNullStr(ugr.Cells["CUT_EDGE_YN"]));
  139. //list.Add(ugr.Cells["CUT_EDGE_YN"].Text.Trim());
  140. string cutEdgeYN = ugr.Cells["CUT_EDGE_YN"].Value.ToString();
  141. list.Add(cutEdgeYN);
  142. list.Add(ugr.Cells["HARSHNESS"].Text.Trim());
  143. list.Add(ugr.Cells["EXTSHAPE_REQ"].Text.Trim());
  144. list.Add(ugr.Cells["DIVID_YN"].Text.Trim());
  145. list.Add(ugr.Cells["PACKAGE_LV"].Value.ToString().Trim());
  146. list.Add(ugr.Cells["DEMO"].Value.ToString().Trim());
  147. list.Add(ugr.Cells["H_COIL_NO"].Text.Trim());
  148. al.Add(list);
  149. }
  150. }
  151. if (al.Count == 0)
  152. {
  153. MessageBox.Show("没有修改的数据,保存无效", "提示");
  154. return;
  155. }
  156. CoreClientParam ccp = new CoreClientParam();
  157. ccp.ServerName = "UIB.COM.ComDBSave";
  158. ccp.MethodName = "doXmlSave";
  159. ccp.ServerParams = new object[] { al };
  160. ccp.IfShowErrMsg = false;
  161. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  162. this.DoQuery();
  163. }
  164. catch (Exception ex)
  165. {
  166. System.Diagnostics.Debug.WriteLine(ex.ToString());
  167. MessageBox.Show("系统发生异常,请与管理员联系", "提示");
  168. }
  169. }
  170. private void DoRef()//刷新
  171. {
  172. try
  173. {
  174. if (this.UserInfo.GetUserName() != "黄涛" && this.UserInfo.GetRole() != "admin" && this.UserInfo.GetRole() != "lz_sys_admin")
  175. {
  176. MessageBox.Show("没有操作权限,禁止操作", "警告");
  177. return;
  178. }
  179. CoreClientParam ccp = new CoreClientParam();
  180. Hashtable ht = new Hashtable();
  181. ht.Add("i1", this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") + "000000");//日期
  182. ht.Add("i2", this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") + "999999");//日期
  183. ht.Add("o3", "");
  184. ccp.ServerName = "UIB.COM.ComDBProcedure";
  185. ccp.MethodName = "doXmlProcedure";
  186. ccp.ServerParams = new object[] { "UIF042050_01.CALL", ht };
  187. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  188. //this.DoQuery();
  189. }
  190. catch (Exception ex)
  191. {
  192. System.Diagnostics.Debug.WriteLine(ex.ToString());
  193. }
  194. }
  195. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  196. {
  197. try
  198. {
  199. this.ultraGrid1.ActiveRow.Cells["MODIFY_FLAG"].Value = "Y";
  200. this.ultraGrid1.UpdateData();
  201. }
  202. catch (Exception ex)
  203. {
  204. System.Diagnostics.Debug.WriteLine(ex.ToString());
  205. }
  206. }
  207. private void UIF042051_Load(object sender, EventArgs e)
  208. {
  209. this.ultraComboEditor1.SelectedIndex = 0;
  210. if (this.UserInfo.GetUserName() == "黄涛" || this.UserInfo.GetRole() == "admin" || this.UserInfo.GetRole() == "lz_sys_admin")
  211. {
  212. this.checkBox1.Visible = true;
  213. }
  214. }
  215. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  216. {
  217. try
  218. {
  219. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  220. { //this.comboxCut.SelectedIndex=0;
  221. ugr.Cells["CUT_EDGE_YN"].Value = this.checkBox1.Checked;
  222. if (ugr.Cells["CUT_EDGE_YN"].Value.ToString() == "True")
  223. {
  224. this.comboxCut.SelectedIndex = 0;
  225. }
  226. else
  227. {
  228. this.comboxCut.SelectedIndex = 1;
  229. }
  230. ugr.Cells["CUT_EDGE_YN"].Value =this.comboxCut.SelectedItem.ToString() ;
  231. // MessageBox.Show(ugr.Cells["CUT_EDGE_YN"].Value.ToString());
  232. ugr.Update();
  233. }
  234. }
  235. catch (Exception ex)
  236. {
  237. System.Diagnostics.Debug.WriteLine(ex.ToString());
  238. }
  239. }
  240. }
  241. }