FrmSetPline.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Tool;
  3. using Core.StlMes.Client.Mcp.Control;
  4. using CoreFS.CA06;
  5. using Infragistics.Win.UltraWinGrid;
  6. using System;
  7. using System.Collections;
  8. using System.Collections.Generic;
  9. using System.Data;
  10. using System.Linq;
  11. using System.Windows.Forms;
  12. using Core.Mes.Client.Comm.Format;
  13. using Core.StlMes.Client.Mcp.Mch.Entity;
  14. namespace Core.StlMes.Client.Mcp.Mch.MchResult
  15. {
  16. public partial class FrmSetPline : FrmBase
  17. {
  18. public FrmSetPline()
  19. {
  20. InitializeComponent();
  21. }
  22. public override void ToolBar_Click(object sender, string ToolbarKey)
  23. {
  24. switch (ToolbarKey)
  25. {
  26. case "Query":
  27. query();
  28. break;
  29. case "DoSave":
  30. DoSave();
  31. break;
  32. case "DoReturn":
  33. DoReturn();
  34. break;
  35. case "Close":
  36. CloseFrm();
  37. break;
  38. }
  39. }
  40. private void query()
  41. {
  42. string pco = "";
  43. if (kreason.Text.ToString() != "" && kreason.Text.ToString() != null)
  44. {
  45. pco = kreason.Value.ToString();
  46. }
  47. mchComSetplineEntityBindingSource.DataSource = EntityHelper.GetData<MchComSetplineEntity>(
  48. "com.steering.mes.mcp.Mch.FrmSetPline.query",
  49. new object[] { pco },
  50. ob);
  51. GridHelper.RefreshAndAutoSize(ultraGrid1);
  52. }
  53. private void DoSave()
  54. {
  55. List<MchComSetplineEntity> list = mchComSetplineEntityBindingSource.DataSource as List<MchComSetplineEntity>;
  56. if(list==null) return;
  57. list = list.Where(p => p.Chk).ToList();
  58. if (!list.Any() ) { MessageUtil.ShowTips("请勾选要保存的数据!"); return; }
  59. CoreClientParam ccp = new CoreClientParam();
  60. try
  61. {
  62. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  63. if (Constant.WaitingForm == null)
  64. {
  65. Constant.WaitingForm = new WaitingForm();
  66. }
  67. Constant.WaitingForm.ShowToUser = true;
  68. Constant.WaitingForm.Show();
  69. Constant.WaitingForm.Update();
  70. ccp.ServerName = "com.steering.mes.mcp.Mch.FrmSetPline";
  71. ccp.MethodName = "addPlineGx";
  72. ccp.ServerParams = new Object[] {list.Select(JSONFormat.Format).ToList()};
  73. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  74. this.Cursor = Cursors.Default;
  75. Constant.WaitingForm.ShowToUser = false;
  76. Constant.WaitingForm.Close();
  77. Constant.WaitingForm = null;
  78. }
  79. catch (Exception ex)
  80. {
  81. this.Cursor = Cursors.Default;
  82. Constant.WaitingForm.ShowToUser = false;
  83. Constant.WaitingForm.Close();
  84. Constant.WaitingForm = null;
  85. }
  86. if (ccp.ReturnCode != -1)
  87. {
  88. MessageUtil.ShowTips(ccp.ReturnInfo);
  89. ccp.ReturnInfo.Equals("保存成功!");
  90. query();
  91. }
  92. }
  93. private void DoReturn()
  94. {
  95. List<MchComSetplineEntity> list = mchComSetplineEntityBindingSource.DataSource as List<MchComSetplineEntity>;
  96. if (list == null) return;
  97. list = list.Where(p => p.Chk).ToList();
  98. if (!list.Any()) { MessageUtil.ShowTips("请选择要删除的信息行!"); return; }
  99. CoreClientParam ccp = new CoreClientParam();
  100. try
  101. {
  102. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  103. if (Constant.WaitingForm == null)
  104. {
  105. Constant.WaitingForm = new WaitingForm();
  106. }
  107. Constant.WaitingForm.ShowToUser = true;
  108. Constant.WaitingForm.Show();
  109. Constant.WaitingForm.Update();
  110. ccp.ServerName = "com.steering.mes.mcp.Mch.FrmSetPline";
  111. ccp.MethodName = "detPlineGx";
  112. ccp.ServerParams = new Object[] { list.Select(JSONFormat.Format).ToList() };
  113. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  114. this.Cursor = Cursors.Default;
  115. Constant.WaitingForm.ShowToUser = false;
  116. Constant.WaitingForm.Close();
  117. Constant.WaitingForm = null;
  118. }
  119. catch (Exception ex)
  120. {
  121. this.Cursor = Cursors.Default;
  122. Constant.WaitingForm.ShowToUser = false;
  123. Constant.WaitingForm.Close();
  124. Constant.WaitingForm = null;
  125. }
  126. if (ccp.ReturnCode != -1)
  127. {
  128. MessageUtil.ShowTips(ccp.ReturnInfo);
  129. if (ccp.ReturnInfo.Equals("删除成功!"))
  130. {
  131. query();
  132. }
  133. }
  134. }
  135. private void CloseFrm()
  136. {
  137. this.Close();
  138. }
  139. private void FrmSetPline_Load(object sender, EventArgs e)
  140. {
  141. ArrayList list = new ArrayList();
  142. list.Add("G");
  143. YdmBaseClass.InitComboEditorWithParmName(kreason, "com.steering.mes.mcp.Mch.FrmCrackDetectResult.getQuerydirect","PLINE_NAME", this.ob, true, new object[] { list });
  144. }
  145. private void judgeNo_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  146. {
  147. MchComSetplineEntity urg = ultraGrid1.ActiveRow.ListObject as MchComSetplineEntity;
  148. if (urg == null) { return; }
  149. using (FrmSetPlineGx pCode = new FrmSetPlineGx(urg.StationCodes, this.ob))
  150. {
  151. pCode.ShowDialog();
  152. if (pCode.DialogResult == DialogResult.OK)
  153. {
  154. urg.StationCodes = pCode.Gxs;
  155. urg.StationNames = pCode.GxNames;
  156. urg.Chk = true;
  157. ultraGrid1.UpdateData();
  158. GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  159. }
  160. }
  161. }
  162. private void kreason_TextChanged(object sender, EventArgs e)
  163. {
  164. query();
  165. }
  166. private void txtOffice_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  167. {
  168. /* string plinCode = "";
  169. string nation = "";
  170. UltraGridRow urg = ultraGrid1.ActiveRow;
  171. if (urg == null) { return; }
  172. nation = urg.Cells["STATION_NAMES"].Text.ToString();
  173. //if (urg.Cells["OFFLINE_PLACE"].Text.ToString() == "" || urg.Cells["OFFLINE_PLACE"].Text.ToString() == null)
  174. //{
  175. // MessageUtil.ShowTips("离线去向不能为空!");
  176. // return;
  177. //}
  178. if (urg.Cells["PLINE_NAME"].Text.ToString() == "" || urg.Cells["PLINE_NAME"].Text.ToString() == null)
  179. {
  180. if (kreason.Text.ToString() == "" || kreason.Text.ToString() == null)
  181. {
  182. MessageUtil.ShowTips("产线不能为空!");
  183. return;
  184. }
  185. else
  186. {
  187. plinCode = kreason.Text.ToString();
  188. }
  189. }
  190. else
  191. {
  192. plinCode = urg.Cells["PLINE_CODE"].Text.ToString();
  193. }
  194. FrmSetPlineOffice pCode = new FrmSetPlineOffice(plinCode,nation, this.ob);
  195. pCode.ShowDialog();
  196. //{
  197. // query();
  198. //}
  199. string off = "";
  200. ArrayList ppt = new ArrayList();
  201. if (Core.StlMes.Client.Mcp.Mch.MchResult.FrmSetPlineOffice.list!=null)
  202. {
  203. for(int i = 0;i<Core.StlMes.Client.Mcp.Mch.MchResult.FrmSetPlineOffice.list.Count;i++)
  204. {
  205. if (off == "")
  206. {
  207. off = Core.StlMes.Client.Mcp.Mch.MchResult.FrmSetPlineOffice.list[i].ToString();
  208. }
  209. else
  210. {
  211. off = off + ";" + Core.StlMes.Client.Mcp.Mch.MchResult.FrmSetPlineOffice.list[i].ToString();
  212. }
  213. }
  214. }
  215. urg.Cells["OFFLINE_PLACE"].Value = off;
  216. judgeNo.Text = pCode.plinegxlist;
  217. GridHelper.RefreshAndAutoSize(this.ultraGrid1);*/
  218. }
  219. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  220. {
  221. if (e.Cell.Column.Key == "Chk") return;
  222. e.Cell.Row.Cells["Chk"].Value = true;
  223. }
  224. }
  225. }