FrmHttPerson.cs 7.5 KB

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