HttSetPlineGx.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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 FrmSetPlineGx : FrmBase
  21. {
  22. public static ArrayList list = null;
  23. private string plinegx = "";
  24. private string plineCode = "";
  25. public string plinegxlist = "";
  26. public string offlineplace = "";
  27. public string save = "0";
  28. public FrmSetPlineGx()
  29. {
  30. InitializeComponent();
  31. }
  32. public FrmSetPlineGx(String pline_Code,string offlinep, OpeBase ob)
  33. {
  34. InitializeComponent();
  35. this.ob = ob;
  36. plineCode = pline_Code;
  37. offlineplace = offlinep;
  38. }
  39. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  40. {
  41. switch (e.Tool.Key)
  42. {
  43. case "Save":
  44. Save();
  45. break;
  46. case "Close":
  47. Clo();
  48. break;
  49. }
  50. }
  51. private void Clo()
  52. {
  53. UltraGridRow urg = ultraGrid1.ActiveRow;
  54. if (urg != null)
  55. {
  56. if (Convert.ToBoolean(urg.Cells["CHK"].Text) == true && urg.Cells["BASENAME"].Text != "")
  57. {
  58. if (save == "0")
  59. {
  60. MessageUtil.ShowTips("请点保存按钮!");
  61. return;
  62. }
  63. }
  64. }
  65. this.Close();
  66. }
  67. /// <summary>
  68. /// 新增
  69. /// </summary>
  70. private void Save()
  71. {
  72. string gxn = "";
  73. int addCount = 0;
  74. ArrayList list1 = new ArrayList();
  75. foreach (UltraGridRow urg in ultraGrid1.Rows)
  76. {
  77. if(urg.Cells["CHK"].Text=="")
  78. {
  79. continue;
  80. }else if(Convert.ToBoolean(urg.Cells["CHK"].Text) == true)
  81. {
  82. addCount += 1;
  83. if(gxn=="")
  84. {
  85. gxn = urg.Cells["BASENAME"].Text.ToString();
  86. }
  87. else
  88. {
  89. gxn = gxn + ";" + urg.Cells["BASENAME"].Text.ToString();
  90. }
  91. //ArrayList pram = new ArrayList();
  92. //pram.Add(urg.Cells["BASENAME"].Text.ToString());
  93. list1.Add(urg.Cells["BASENAME"].Text.ToString());
  94. }
  95. }
  96. if(addCount==0)
  97. {
  98. MessageUtil.ShowTips("请选择要排序的工序点!");
  99. return;
  100. }
  101. list = list1;
  102. if (list.Count != 0)
  103. {
  104. MessageUtil.ShowTips("添加成功!");
  105. save = "1";
  106. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  107. }
  108. //CoreClientParam ccp = new CoreClientParam();
  109. //try
  110. //{
  111. // this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  112. // if (Constant.WaitingForm == null)
  113. // {
  114. // Constant.WaitingForm = new WaitingForm();
  115. // }
  116. // Constant.WaitingForm.ShowToUser = true;
  117. // Constant.WaitingForm.Show();
  118. // Constant.WaitingForm.Update();
  119. // ccp.ServerName = "com.steering.mes.mcp.heatTreatment.HttSetPline";
  120. // ccp.MethodName = "addPlineGx";
  121. // ccp.ServerParams = new Object[] { list, plineCode,offlineplace };
  122. // ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  123. // this.Cursor = Cursors.Default;
  124. // Constant.WaitingForm.ShowToUser = false;
  125. // Constant.WaitingForm.Close();
  126. // Constant.WaitingForm = null;
  127. //}
  128. //catch (Exception ex)
  129. //{
  130. // this.Cursor = Cursors.Default;
  131. // Constant.WaitingForm.ShowToUser = false;
  132. // Constant.WaitingForm.Close();
  133. // Constant.WaitingForm = null;
  134. //}
  135. //if (ccp.ReturnCode != -1)
  136. //{
  137. // MessageUtil.ShowTips(ccp.ReturnInfo);
  138. // if (ccp.ReturnInfo.Equals("新增成功!"))
  139. // {
  140. // save = "1";
  141. // plinegxlist = gxn.ToString();
  142. // //scrapNum = scarpTotalNum.ToString();
  143. // this.DialogResult = System.Windows.Forms.DialogResult.OK;
  144. // }
  145. // else
  146. // {
  147. // MessageUtil.ShowTips(ccp.ReturnInfo);
  148. // }
  149. //}
  150. }
  151. public HttOfflineResultDentity getRowData(UltraGridRow checkrow)
  152. {
  153. HttOfflineResultDentity resultD = new HttOfflineResultDentity();
  154. resultD.GowhereName = checkrow.Cells["GOWHERE_NAME"].Value.ToString().Trim();
  155. resultD.OfflineNum = checkrow.Cells["OFFLINE_NUM"].Value.ToString().Trim();
  156. return resultD;
  157. }
  158. private void FrmSetPlineGx_Load(object sender, EventArgs e)
  159. {
  160. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Vrp.FrmVrpDownLineManage.doQuery", new object[] { "6002" }, ob);
  161. kreason.DataSource = dt;
  162. kreason.DisplayMember = "BASENAME";
  163. kreason.ValueMember = "BASECODE";
  164. foreach (UltraGridRow urg in ultraGrid1.Rows)
  165. {
  166. GridEdite(urg);
  167. }
  168. }
  169. private void FrmSetPlineGx_FormClosing(object sender, FormClosingEventArgs e)
  170. {
  171. UltraGridRow urg = ultraGrid1.ActiveRow;
  172. if (urg != null)
  173. {
  174. if (Convert.ToBoolean(urg.Cells["CHK"].Text) == true && urg.Cells["BASENAME"].Text != "")
  175. {
  176. if (save == "0")
  177. {
  178. MessageUtil.ShowTips("请点保存按钮!");
  179. e.Cancel = true;
  180. }
  181. }
  182. }
  183. }
  184. /// <summary>
  185. ///
  186. /// ulltragrid控件受勾影响(打钩可编辑,不打勾不能编辑)**
  187. /// </summary>
  188. /// <param name="row"></param>
  189. private void GridEdite(UltraGridRow row)
  190. {
  191. if (row.GetValue("CHK") == "True")
  192. {
  193. foreach (UltraGridCell cell in row.Cells)
  194. {
  195. if (cell.Column.CellActivation == Activation.AllowEdit)
  196. {
  197. cell.Activation = Activation.AllowEdit;
  198. }
  199. }
  200. }
  201. else
  202. {
  203. foreach (UltraGridCell cell in row.Cells)
  204. {
  205. if (cell.Column.Key.Contains("CHK")) continue;
  206. if (cell.Column.CellActivation == Activation.AllowEdit)
  207. {
  208. cell.Activation = Activation.ActivateOnly;
  209. }
  210. }
  211. }
  212. ultraGrid1.UpdateData();
  213. }
  214. private void ultraGrid1_AfterRowInsert(object sender, RowEventArgs e)
  215. {
  216. this.ultraGrid1.UpdateData();
  217. GridEdite(e.Row);
  218. }
  219. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  220. {
  221. this.ultraGrid1.UpdateData();
  222. GridEdite(e.Cell.Row);
  223. }
  224. }
  225. }