FrmMchPerson.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Core.Mes.Client.Comm.Control;
  11. using Core.Mes.Client.Comm.Tool;
  12. using Infragistics.Win.UltraWinGrid;
  13. using Core.StlMes.Client.Mcp.Mch.Entity;
  14. using com.steering.mes.mcp.entity;
  15. using Core.Mes.Client.Comm.Server;
  16. using Core.StlMes.Client.Mcp.Control;
  17. namespace Core.StlMes.Client.Mcp.Mch.MchResult
  18. {
  19. public partial class FrmMchPerson : FrmBase
  20. {
  21. public FrmMchPerson()
  22. {
  23. InitializeComponent();
  24. }
  25. public override void ToolBar_Click(object sender, string ToolbarKey)
  26. {
  27. switch (ToolbarKey)
  28. {
  29. case "doQuery":
  30. get_PurUoms();
  31. break;
  32. case "doAdd":
  33. add_PurUoms();
  34. break;
  35. case "doModify":
  36. upd_PurUoms();
  37. break;
  38. case "doDelete":
  39. del_PurUoms();
  40. break;
  41. case "Close":
  42. this.Close();
  43. break;
  44. }
  45. }
  46. /// <summary>
  47. /// 查询人员
  48. /// </summary>
  49. /// <param name="configureMEntity"></param>
  50. public void get_PurUoms()
  51. {
  52. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmMchPerson.doQuery", new object[] { banci.Text.Trim(), pline.Text.Trim() }, this.ob);
  53. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  54. }
  55. /// <summary>
  56. /// 增加人员
  57. ///// </summary>
  58. ///// <param name="configureMEntity"></param>
  59. public void add_PurUoms()
  60. {
  61. string name = "";
  62. string pline = "";
  63. string banci = "";
  64. if (txt_name.Text != "" && txt_name.Text != null)
  65. {
  66. name = txt_name.Text;
  67. }
  68. else
  69. {
  70. MessageUtil.ShowTips("请输入人员名称!");
  71. return;
  72. }
  73. if (txt_pline.Text != "" && txt_pline.Text != null)
  74. {
  75. pline = txt_pline.Text;
  76. }
  77. else
  78. {
  79. MessageUtil.ShowTips("请输入生产产线!");
  80. return;
  81. }
  82. if (txt_banci.Text != "" && txt_banci.Text != null)
  83. {
  84. banci = txt_banci.Text;
  85. }
  86. else
  87. {
  88. MessageUtil.ShowTips("请输入生产班组!");
  89. return;
  90. }
  91. if (!same()) return;
  92. CoreClientParam ccp = new CoreClientParam();
  93. ccp.ServerName = "com.steering.mes.mcp.Mch.FrmMchPerson";
  94. ccp.MethodName = "addPerson";
  95. ccp.ServerParams = new Object[] { name, pline, banci };
  96. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  97. if (ccp.ReturnCode != -1)
  98. {
  99. MessageUtil.ShowTips(ccp.ReturnInfo);
  100. if (ccp.ReturnInfo.Equals("新增成功!"))
  101. {
  102. get_PurUoms();
  103. }
  104. }
  105. //ConfigureClassCommon.doActiveSelRow(ultraGrid1, "UomCode", UomsEntity.UomCode);//激活当前行
  106. }
  107. ///// <summary>
  108. ///// 修改人员
  109. ///// </summary>
  110. ///// <param name="configureMEntity"></param>
  111. public void upd_PurUoms()
  112. {
  113. UltraGridRow urg = ultraGrid1.ActiveRow;
  114. FrmMchPersonentity result = new FrmMchPersonentity();
  115. result.ManName = urg.Cells["MAN_NAME"].Text.ToString();
  116. result.ManCode = urg.Cells["MAN_CODE"].Text.ToString();
  117. result.PlineCode = txt_pline.Text;
  118. result.ProBc = txt_banci.Text;
  119. if (txt_name.Text == "" || txt_name.Text == null)
  120. {
  121. MessageUtil.ShowTips("人员名称不能为空!");
  122. return;
  123. }
  124. if (!same()) return;
  125. CoreClientParam ccp = new CoreClientParam();
  126. ccp.ServerName = "com.steering.mes.mcp.Mch.FrmMchPerson";
  127. ccp.MethodName = "updatePerson";
  128. ccp.ServerParams = new Object[] { result, txt_name.Text };
  129. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  130. if (ccp.ReturnCode != -1)
  131. {
  132. MessageUtil.ShowTips(ccp.ReturnInfo);
  133. if (ccp.ReturnInfo.Equals("修改成功!"))
  134. {
  135. get_PurUoms();
  136. }
  137. }
  138. }
  139. private void FrmMchPerson_Load(object sender, EventArgs e)
  140. {
  141. //产线
  142. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmMchPerson.doQuerypline", null, this.ob);//如果是“”里面添加的是条件
  143. pline.DataSource = dt;
  144. pline.DisplayMember = "PLINE_NAME";
  145. pline.ValueMember = "PLINE_CODE";
  146. YdmBaseClass.SetComboItemHeight(pline);
  147. txt_pline.DataSource = dt;
  148. txt_pline.DisplayMember = "PLINE_NAME";
  149. txt_pline.ValueMember = "PLINE_CODE";
  150. YdmBaseClass.SetComboItemHeight(txt_pline);
  151. }
  152. ///// <summary>
  153. ///// 删除人员
  154. ///// </summary>
  155. ///// <param name="configureMEntity"></param>
  156. public void del_PurUoms()
  157. {
  158. if (ultraGrid1.ActiveRow != null)
  159. {
  160. UltraGridRow urg = ultraGrid1.ActiveRow;
  161. if (urg != null)
  162. {
  163. CoreClientParam ccp = new CoreClientParam();
  164. ccp.ServerName = "com.steering.mes.mcp.Mch.FrmMchPerson";
  165. ccp.MethodName = "deletePerson";
  166. ccp.ServerParams = new Object[] { urg.Cells["MAN_NAME"].Value.ToString(), urg.Cells["MAN_CODE"].Value.ToString() };
  167. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  168. if (ccp.ReturnCode != -1)
  169. {
  170. MessageUtil.ShowTips(ccp.ReturnInfo);
  171. if (ccp.ReturnInfo.Equals("删除成功!"))
  172. {
  173. get_PurUoms();
  174. }
  175. }
  176. }
  177. else
  178. {
  179. MessageUtil.ShowTips("请选择一条数据");
  180. return;
  181. }
  182. }
  183. }
  184. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  185. {
  186. UltraGridRow urg = ultraGrid1.ActiveRow;
  187. if(urg!=null)
  188. {
  189. txt_name.Text = urg.Cells["MAN_NAME"].Text.ToString();
  190. txt_banci.Text = urg.Cells["PRO_BZ"].Text.ToString();
  191. txt_pline.Text = urg.Cells["PLINE_CODE"].Text.ToString();
  192. }
  193. }
  194. private bool same()
  195. {
  196. UltraGridRow urg = ultraGrid1.ActiveRow;
  197. if (urg != null)
  198. {
  199. if (txt_name.Text == urg.Cells["MAN_NAME"].Text.ToString() && txt_banci.Text == urg.Cells["PRO_BZ"].Text.ToString() && txt_pline.Text == urg.Cells["PLINE_CODE"].Text.ToString())
  200. {
  201. MessageUtil.ShowTips("有相同的人员信息!");
  202. return false;
  203. }
  204. else
  205. {
  206. return true;
  207. }
  208. }
  209. return true;
  210. }
  211. }
  212. }