FrmSetPlineOffice.cs 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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.Mch.MchResult
  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. 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.Mch.FrmSetPline";
  120. // ccp.MethodName = "addPlineOffice";
  121. // ccp.ServerParams = new Object[] { list, plineCode,Nation };
  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 MchOfflineResultDentity getRowData(UltraGridRow checkrow)
  152. {
  153. MchOfflineResultDentity resultD = new MchOfflineResultDentity();
  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[] { "7013" }, ob);
  161. // kreason.DataSource = dt;
  162. // kreason.DisplayMember = "BASENAME";
  163. // kreason.ValueMember = "BASECODE";
  164. //}
  165. private void FrmSetPlineGx_FormClosing(object sender, FormClosingEventArgs e)
  166. {
  167. UltraGridRow urg = ultraGrid1.ActiveRow;
  168. if (urg != null)
  169. {
  170. if (Convert.ToBoolean(urg.Cells["CHK"].Text) == true && urg.Cells["BASENAME"].Text != "")
  171. {
  172. if (save == "0")
  173. {
  174. MessageUtil.ShowTips("请点保存按钮!");
  175. e.Cancel = true;
  176. }
  177. }
  178. }
  179. }
  180. /// <summary>
  181. ///
  182. /// ulltragrid控件受勾影响(打钩可编辑,不打勾不能编辑)**
  183. /// </summary>
  184. /// <param name="row"></param>
  185. private void GridEdite(UltraGridRow row)
  186. {
  187. if (row.GetValue("CHK") == "True")
  188. {
  189. foreach (UltraGridCell cell in row.Cells)
  190. {
  191. if (cell.Column.CellActivation == Activation.AllowEdit)
  192. {
  193. cell.Activation = Activation.AllowEdit;
  194. }
  195. }
  196. }
  197. else
  198. {
  199. foreach (UltraGridCell cell in row.Cells)
  200. {
  201. if (cell.Column.Key.Contains("CHK")) continue;
  202. if (cell.Column.CellActivation == Activation.AllowEdit)
  203. {
  204. cell.Activation = Activation.ActivateOnly;
  205. }
  206. }
  207. }
  208. ultraGrid1.UpdateData();
  209. }
  210. private void ultraGridDetailDes1_AfterRowInsert(object sender, RowEventArgs e)
  211. {
  212. this.ultraGrid1.UpdateData();
  213. GridEdite(e.Row);
  214. }
  215. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  216. {
  217. this.ultraGrid1.UpdateData();
  218. GridEdite(e.Cell.Row);
  219. }
  220. }
  221. }