UIB100204.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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. namespace Core.LZMes.Client.UIB
  13. {
  14. public partial class UIB100204 : FrmBase
  15. {
  16. public UIB100204()
  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 "Save":
  28. this.DoSave();
  29. break;
  30. }
  31. }
  32. public void DoQuery()
  33. {
  34. try
  35. {
  36. //string strLine = null;
  37. string strProc = null;
  38. ArrayList al = new ArrayList();
  39. if (this.comboBox1.Text == "热轧")
  40. {
  41. //strLine = "R";
  42. if (this.checkBox2.Checked)
  43. {
  44. al.Add("UIB100204_02_02.SELECT");
  45. if (this.ultraDateTimeEditor1.Text == "" || this.ultraDateTimeEditor2.Text == "")
  46. {
  47. MessageBox.Show("请选择时间", "提示");
  48. return;
  49. }
  50. }
  51. else
  52. {
  53. al.Add("UIB100204_02_01.SELECT");
  54. }
  55. }
  56. else if (this.comboBox1.Text == "连退")
  57. {
  58. //strLine = "L";
  59. if (this.checkBox2.Checked)
  60. {
  61. al.Add("UIB100204_01_02.SELECT");
  62. if (this.ultraDateTimeEditor1.Text == "" || this.ultraDateTimeEditor2.Text == "")
  63. {
  64. MessageBox.Show("请选择时间", "提示");
  65. return;
  66. }
  67. }
  68. else
  69. {
  70. al.Add("UIB100204_01_01.SELECT");
  71. }
  72. }
  73. else if (this.comboBox1.Text == "酸洗")
  74. {
  75. //strLine = "L";
  76. if (this.checkBox2.Checked)
  77. {
  78. al.Add("UIB100204_03_02.SELECT");
  79. if (this.ultraDateTimeEditor1.Text == "" || this.ultraDateTimeEditor2.Text == "")
  80. {
  81. MessageBox.Show("请选择时间", "提示");
  82. return;
  83. }
  84. }
  85. else
  86. {
  87. al.Add("UIB100204_03_01.SELECT");
  88. }
  89. }
  90. else
  91. {
  92. MessageBox.Show("请选择产线", "提示");
  93. return;
  94. }
  95. if (this.comboBox2.Text == "")
  96. {
  97. MessageBox.Show("请选择试样进程状态", "提示");
  98. return;
  99. }
  100. OperateConditionRecode.WriteCondition("UIB100204_1", this.comboBox1.Text.ToString());
  101. OperateConditionRecode.WriteCondition("UIB100204_2", this.comboBox2.Text.ToString());
  102. strProc = this.comboBox2.Text == "全部(ALL)"?"": this.comboBox2.Text.Substring(7, 1);
  103. // al.Add(strLine);
  104. al.Add(strProc);
  105. //批号
  106. if (this.textBox1.Text == "")
  107. {
  108. al.Add("");
  109. al.Add("");
  110. }
  111. else
  112. {
  113. al.Add(this.textBox1.Text.Trim());
  114. if (this.textBox2.Text.Trim() == "")
  115. {
  116. al.Add(this.textBox1.Text.Trim());
  117. }
  118. else
  119. {
  120. al.Add(this.textBox2.Text.Trim());
  121. }
  122. }
  123. //时间
  124. if (this.checkBox2.Checked)
  125. {
  126. al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") + "000000");
  127. al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") + "999999");
  128. }
  129. this.dataSet1.Tables[0].Clear();
  130. CoreClientParam ccp = new CoreClientParam();
  131. ccp.ServerName = "UIB.COM.ComDBQuery";
  132. ccp.MethodName = "doSimpleQuery";
  133. ccp.ServerParams = new object[] { al };
  134. ccp.SourceDataTable = this.dataSet1.Tables[0];
  135. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  136. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  137. {
  138. if (ugr.Cells["SMP_PROG_CD"].Text == "试样入库待机")
  139. {
  140. ugr.RowSelectorAppearance.BackColor = Color.Red;
  141. }
  142. }
  143. }
  144. catch (Exception ex)
  145. {
  146. }
  147. }
  148. public void DoSave()
  149. {
  150. try
  151. {
  152. if (MessageBox.Show("确定入库?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  153. return;
  154. ArrayList al = new ArrayList();
  155. ArrayList list = null;
  156. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  157. {
  158. if (ugr.Cells["SMP_PROG_CD"].Text == "试样入库待机" && ugr.Cells["CHK"].Text == "True")
  159. {
  160. //更新进程状态
  161. list = new ArrayList();
  162. list.Add("UIB100204_01.UPDATE");
  163. list.Add(this.UserInfo.GetUserName());
  164. list.Add(ugr.Cells["SMP_NO"].Text);
  165. list.Add(ugr.Cells["SMP_CUT_LOC"].Text);
  166. al.Add(list);
  167. //更新接口状态MSG_FLAG从1到N
  168. list = new ArrayList();
  169. list.Add("UIB100204_02.UPDATE");
  170. list.Add(ugr.Cells["SMP_NO"].Text);
  171. list.Add(ugr.Cells["SMP_CUT_LOC"].Text);
  172. al.Add(list);
  173. }
  174. }
  175. if (al.Count == 0) return;
  176. CoreClientParam ccp = new CoreClientParam();
  177. ccp.ServerName = "UIB.COM.ComDBSave";
  178. ccp.MethodName = "doXmlSave";
  179. ccp.ServerParams = new object[] { al };
  180. this.ExecuteNonQuery(ccp , CoreInvokeType.Internal);
  181. this.DoQuery();
  182. }
  183. catch (Exception ex)
  184. {
  185. }
  186. }
  187. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  188. {
  189. try
  190. {
  191. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  192. {
  193. ugr.Cells["CHK"].Value = this.checkBox1.Checked;
  194. ugr.Update();
  195. }
  196. }
  197. catch (Exception ex)
  198. {
  199. System.Diagnostics.Debug.WriteLine(ex.ToString());
  200. }
  201. }
  202. private void UIB100204_Load(object sender, EventArgs e)
  203. {
  204. try
  205. {
  206. this.comboBox1.Text = OperateConditionRecode.ReadCondition("UIB100204_1");
  207. this.comboBox2.Text = OperateConditionRecode.ReadCondition("UIB100204_2");
  208. this.ultraDateTimeEditor1.Enabled = false;
  209. this.ultraDateTimeEditor2.Enabled = false;
  210. }
  211. catch (Exception EX)
  212. {
  213. }
  214. }
  215. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  216. {
  217. if (this.checkBox2.Checked)
  218. {
  219. this.ultraDateTimeEditor1.Enabled = true;
  220. this.ultraDateTimeEditor2.Enabled = true;
  221. }
  222. else
  223. {
  224. this.ultraDateTimeEditor1.Enabled = false;
  225. this.ultraDateTimeEditor2.Enabled = false;
  226. }
  227. }
  228. }
  229. }