UIF042050.cs 11 KB

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