HttSetPline.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. using com.steering.mes.mcp.entity;
  2. using Core.Mes.Client.Comm.Control;
  3. using Core.Mes.Client.Comm.Server;
  4. using Core.Mes.Client.Comm.Tool;
  5. using Core.StlMes.Client.Mcp.Control;
  6. using CoreFS.CA06;
  7. using Infragistics.Win;
  8. using Infragistics.Win.UltraWinGrid;
  9. using System;
  10. using System.Collections;
  11. using System.Collections.Generic;
  12. using System.ComponentModel;
  13. using System.Data;
  14. using System.Drawing;
  15. using System.Linq;
  16. using System.Text;
  17. using System.Windows.Forms;
  18. namespace Core.StlMes.Client.Mcp.Treatment
  19. {
  20. public partial class HttSetPline : FrmBase
  21. {
  22. public HttSetPline()
  23. {
  24. InitializeComponent();
  25. }
  26. public override void ToolBar_Click(object sender, string ToolbarKey)
  27. {
  28. switch (ToolbarKey)
  29. {
  30. case "Query":
  31. query();
  32. break;
  33. case "DoSave":
  34. DoSave();
  35. break;
  36. case "DoReturn":
  37. DoReturn();
  38. break;
  39. case "Close":
  40. CloseFrm();
  41. break;
  42. }
  43. }
  44. private void query()
  45. {
  46. string pco = "";
  47. if (kreason.Text.ToString() != "" && kreason.Text.ToString() != null)
  48. {
  49. pco = kreason.Value.ToString();
  50. }
  51. DataTable ds = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.HttSetPline.query", new object[] { pco }, ob);
  52. GridHelper.CopyDataToDatatable(ref ds, ref dataTable1, true);
  53. GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  54. }
  55. private void DoSave()
  56. {
  57. string plineCode = "";
  58. int inCount = 0;
  59. ArrayList list = new ArrayList();
  60. foreach(UltraGridRow urg in ultraGrid1.Rows)
  61. {
  62. if (urg.Cells["PLINE_NAME"].Text.ToString() == "" || urg.Cells["PLINE_NAME"].Text.ToString() == null)
  63. {
  64. MessageUtil.ShowTips("产线不能为空!");
  65. return;
  66. }
  67. else
  68. {
  69. plineCode = urg.Cells["PLINE_CODE"].Text.ToString();
  70. }
  71. if(Convert.ToBoolean(urg.Cells["CHK"].Text)==true)
  72. {
  73. inCount += 1;
  74. ArrayList list1 = new ArrayList();
  75. list1.Add(urg.Cells["PLINE_NAME"].Value.ToString());
  76. list1.Add(urg.Cells["STATION_NAMES"].Text.ToString());
  77. list1.Add(urg.Cells["OFFLINE_PLACE"].Text.ToString());
  78. list1.Add(urg.Cells["PLINE_NAME"].Text.ToString());
  79. list.Add(list1);
  80. }
  81. }
  82. if (inCount == 0) { MessageUtil.ShowTips("请选择要新增的信息行!"); return; }
  83. CoreClientParam ccp = new CoreClientParam();
  84. try
  85. {
  86. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  87. if (Constant.WaitingForm == null)
  88. {
  89. Constant.WaitingForm = new WaitingForm();
  90. }
  91. Constant.WaitingForm.ShowToUser = true;
  92. Constant.WaitingForm.Show();
  93. Constant.WaitingForm.Update();
  94. ccp.ServerName = "com.steering.mes.mcp.heatTreatment.HttSetPline";
  95. ccp.MethodName = "addPlineGx";
  96. ccp.ServerParams = new Object[] { list };
  97. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  98. this.Cursor = Cursors.Default;
  99. Constant.WaitingForm.ShowToUser = false;
  100. Constant.WaitingForm.Close();
  101. Constant.WaitingForm = null;
  102. }
  103. catch (Exception ex)
  104. {
  105. this.Cursor = Cursors.Default;
  106. Constant.WaitingForm.ShowToUser = false;
  107. Constant.WaitingForm.Close();
  108. Constant.WaitingForm = null;
  109. }
  110. if (ccp.ReturnCode != -1)
  111. {
  112. MessageUtil.ShowTips(ccp.ReturnInfo);
  113. ccp.ReturnInfo.Equals("新增成功!");
  114. }
  115. }
  116. private void DoReturn()
  117. {
  118. string plineCode = "";
  119. int addCount = 0;
  120. ArrayList list = new ArrayList();
  121. foreach (UltraGridRow urg in ultraGrid1.Rows)
  122. {
  123. if (Convert.ToBoolean(urg.Cells["CHK"].Text) == true)
  124. {
  125. addCount += 1;
  126. ArrayList list1 = new ArrayList();
  127. list1.Add(urg.Cells["PLINE_CODE"].Value.ToString());
  128. list.Add(list1);
  129. }
  130. }
  131. if (addCount == 0) { MessageUtil.ShowTips("请选择要删除的信息行!"); return; }
  132. CoreClientParam ccp = new CoreClientParam();
  133. try
  134. {
  135. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  136. if (Constant.WaitingForm == null)
  137. {
  138. Constant.WaitingForm = new WaitingForm();
  139. }
  140. Constant.WaitingForm.ShowToUser = true;
  141. Constant.WaitingForm.Show();
  142. Constant.WaitingForm.Update();
  143. ccp.ServerName = "com.steering.mes.mcp.heatTreatment.HttSetPline";
  144. ccp.MethodName = "detPlineGx";
  145. ccp.ServerParams = new Object[] { list };
  146. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  147. this.Cursor = Cursors.Default;
  148. Constant.WaitingForm.ShowToUser = false;
  149. Constant.WaitingForm.Close();
  150. Constant.WaitingForm = null;
  151. }
  152. catch (Exception ex)
  153. {
  154. this.Cursor = Cursors.Default;
  155. Constant.WaitingForm.ShowToUser = false;
  156. Constant.WaitingForm.Close();
  157. Constant.WaitingForm = null;
  158. }
  159. if (ccp.ReturnCode != -1)
  160. {
  161. MessageUtil.ShowTips(ccp.ReturnInfo);
  162. if (ccp.ReturnInfo.Equals("删除成功!"))
  163. {
  164. query();
  165. }
  166. }
  167. }
  168. private void CloseFrm()
  169. {
  170. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  171. this.Close();
  172. }
  173. private void FrmSetPline_Load(object sender, EventArgs e)
  174. {
  175. //DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.HttSetPline.getQuerydirect", new object[] { "F", "002001006" }, this.ob);
  176. ////comm.FilComboboxAdd(standard, dt2, "BASECODE", "BASENAME", "validflag NOT in ('0')", false, "全部", "");
  177. //kreason.DataSource = dt2;
  178. //kreason.DisplayMember = "PLINE_NAME";
  179. //kreason.ValueMember = "PLINE_CODE";
  180. //YdmBaseClass.SetComboItemHeight(kreason);
  181. ArrayList list = new ArrayList();
  182. list.Add("F");
  183. //list.Add("002001006");
  184. YdmBaseClass.InitComboEditorWithParmName(kreason, "com.steering.mes.mcp.heatTreatment.HttSetPline.getQuerydirect", "PLINE_NAME", this.ob, true, new object[] { list });
  185. }
  186. private void judgeNo_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  187. {
  188. string plinCode = "";
  189. UltraGridRow urg = ultraGrid1.ActiveRow;
  190. if (urg == null) { return; }
  191. if (urg.Cells["OFFLINE_PLACE"].Text.ToString() == "" || urg.Cells["OFFLINE_PLACE"].Text.ToString()==null)
  192. {
  193. MessageUtil.ShowTips("离线去向不能为空!");
  194. return;
  195. }
  196. if (urg.Cells["PLINE_NAME"].Text.ToString() == "" || urg.Cells["PLINE_NAME"].Text.ToString() == null)
  197. {
  198. if (kreason.Text.ToString() == "" || kreason.Text.ToString() == null)
  199. {
  200. MessageUtil.ShowTips("产线不能为空!");
  201. return;
  202. }
  203. else
  204. {
  205. plinCode = kreason.Text.ToString();
  206. }
  207. }
  208. else
  209. {
  210. plinCode = urg.Cells["PLINE_CODE"].Text.ToString();
  211. }
  212. FrmSetPlineGx pCode = new FrmSetPlineGx(plinCode,urg.Cells["OFFLINE_PLACE"].Text.ToString(), this.ob);
  213. pCode.ShowDialog();
  214. string off = "";
  215. ArrayList ppt = new ArrayList();
  216. if (Core.StlMes.Client.Mcp.Treatment.FrmSetPlineGx.list != null)
  217. {
  218. for (int i = 0; i < Core.StlMes.Client.Mcp.Treatment.FrmSetPlineGx.list.Count; i++)
  219. {
  220. if (off == "")
  221. {
  222. off = Core.StlMes.Client.Mcp.Treatment.FrmSetPlineGx.list[i].ToString();
  223. }
  224. else
  225. {
  226. off = off + ";" + Core.StlMes.Client.Mcp.Treatment.FrmSetPlineGx.list[i].ToString();
  227. }
  228. }
  229. }
  230. urg.Cells["STATION_NAMES"].Value = off;
  231. judgeNo.Text = pCode.plinegxlist;
  232. GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  233. }
  234. private void kreason_TextChanged(object sender, EventArgs e)
  235. {
  236. string pco = "";
  237. if (kreason.Text.ToString() != "" && kreason.Text.ToString() != null)
  238. {
  239. DataTable dt = new DataTable();
  240. //dt.columns.add("Column 1"); //添加列1
  241. pco = kreason.Value.ToString();
  242. //dt.Rows.Add();
  243. //dt.Rows[0][1] = pco;
  244. }
  245. DataTable ds = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.HttSetPline.query", new object[] { pco }, ob);
  246. if(ds.Rows.Count<=0)
  247. {
  248. ds.Rows.Add();
  249. ds.Rows[0][0] = pco;
  250. }
  251. GridHelper.CopyDataToDatatable(ref ds, ref dataTable1, true);
  252. GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  253. }
  254. private void txtOffice_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  255. {
  256. string plinCode = "";
  257. string nation = "";
  258. UltraGridRow urg = ultraGrid1.ActiveRow;
  259. if (urg == null) { return; }
  260. nation = urg.Cells["STATION_NAMES"].Text.ToString();
  261. //if (urg.Cells["OFFLINE_PLACE"].Text.ToString() == "" || urg.Cells["OFFLINE_PLACE"].Text.ToString() == null)
  262. //{
  263. // MessageUtil.ShowTips("离线去向不能为空!");
  264. // return;
  265. //}
  266. if (urg.Cells["PLINE_NAME"].Text.ToString() == "" || urg.Cells["PLINE_NAME"].Text.ToString() == null)
  267. {
  268. if (kreason.Text.ToString() == "" || kreason.Text.ToString() == null)
  269. {
  270. MessageUtil.ShowTips("产线不能为空!");
  271. return;
  272. }
  273. else
  274. {
  275. plinCode = kreason.Text.ToString();
  276. }
  277. }
  278. else
  279. {
  280. plinCode = urg.Cells["PLINE_CODE"].Text.ToString();
  281. }
  282. FrmSetPlineOffice pCode = new FrmSetPlineOffice(plinCode,nation, this.ob);
  283. pCode.ShowDialog();
  284. string off = "";
  285. ArrayList ppt = new ArrayList();
  286. if (Core.StlMes.Client.Mcp.Treatment.FrmSetPlineOffice.list != null)
  287. {
  288. for (int i = 0; i < Core.StlMes.Client.Mcp.Treatment.FrmSetPlineOffice.list.Count; i++)
  289. {
  290. if (off == "")
  291. {
  292. off = Core.StlMes.Client.Mcp.Treatment.FrmSetPlineOffice.list[i].ToString();
  293. }
  294. else
  295. {
  296. off = off + ";" + Core.StlMes.Client.Mcp.Treatment.FrmSetPlineOffice.list[i].ToString();
  297. }
  298. }
  299. }
  300. urg.Cells["OFFLINE_PLACE"].Value = off;
  301. judgeNo.Text = pCode.plinegxlist;
  302. GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  303. }
  304. }
  305. }