FrmSetPlineOffice.cs 8.1 KB

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