FrmSupervisonInfo.cs 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. using Core.Mes.Client.Comm.Format;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.YdmBcPipeManage.Entity;
  5. using CoreFS.CA06;
  6. using Infragistics.Win.UltraWinGrid;
  7. using System;
  8. using System.Collections;
  9. using System.Collections.Generic;
  10. using System.ComponentModel;
  11. using System.Data;
  12. using System.Drawing;
  13. using System.Linq;
  14. using System.Text;
  15. using System.Windows.Forms;
  16. namespace Core.StlMes.Client.YdmBcPipeManage
  17. {
  18. public partial class FrmSupervisonInfo : FrmBase
  19. {
  20. public FrmSupervisonInfo()
  21. {
  22. InitializeComponent();
  23. }
  24. private void FrmSupervisonInfo_Load(object sender, EventArgs e)
  25. {
  26. EntityHelper.ShowGridCaption<YdmBcSupervisorEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  27. this.txtPline.Enabled = false;
  28. this.txtUser.Enabled = false;
  29. initPline();
  30. }
  31. /// <summary>
  32. /// 加载产线信息
  33. /// </summary>
  34. private void initPline()
  35. {
  36. DataTable dt = ServerHelper.GetData("com.steering.ydm.bc.FrmSupervisonInfo.doQueryPline", new object[] { }, this.ob);
  37. if (dt.Rows.Count > 0)
  38. {
  39. txtPline.DataSource = dt;
  40. txtPline.DisplayMember = "PLINE_NAME";
  41. txtPline.ValueMember = "PLINE_CODE";
  42. }
  43. }
  44. /// <summary>
  45. /// 重写基类方法
  46. /// </summary>
  47. /// <param name="sender"></param>
  48. /// <param name="ToolbarKey"></param>
  49. public override void ToolBar_Click(object sender, string ToolbarKey)
  50. {
  51. switch (ToolbarKey)
  52. {
  53. case "Query":
  54. doQuery();
  55. break;
  56. case "Add":
  57. doAdd();
  58. break;
  59. case"Delete":
  60. doDelete();
  61. break;
  62. case "Close":
  63. close();
  64. break;
  65. }
  66. }
  67. /// <summary>
  68. /// 查询
  69. /// </summary>
  70. private void doQuery()
  71. {
  72. string plineCode = "";
  73. string txtUser = "";
  74. if (utrPlineChk.Checked && this.txtPline.Text != "")
  75. {
  76. plineCode = this.txtPline.Value.ToString2();
  77. }
  78. if (userChk.Checked && this.txtUser.Text != "")
  79. {
  80. txtUser = this.txtUser.Text.Trim().ToString();
  81. }
  82. ArrayList ayyList = new ArrayList();
  83. ayyList.Add(plineCode);
  84. ayyList.Add(txtUser);
  85. List<YdmBcSupervisorEntity> listSource = EntityHelper.GetData<YdmBcSupervisorEntity>("com.steering.ydm.bc.FrmSupervisonInfo.doQuery", new object[] { ayyList }, ob);
  86. YdmBcSupervisorEntitybindingSource.DataSource = listSource;
  87. }
  88. /// <summary>
  89. /// 新增
  90. /// </summary>
  91. private void doAdd()
  92. {
  93. if(this.texPlineBom.Text == "")
  94. {
  95. MessageUtil.ShowTips("请选择产线信息!");
  96. return;
  97. }
  98. if (this.ultraTextEditor2.Text == "")
  99. {
  100. MessageUtil.ShowTips("请选择仓库信息!");
  101. return;
  102. }
  103. if(this.txtUserBom.Text == "")
  104. {
  105. MessageUtil.ShowTips("请填入监装人信息!");
  106. return;
  107. }
  108. if(this.txtGroupBom.Text == "")
  109. {
  110. MessageUtil.ShowTips("请选择班组信息!");
  111. return;
  112. }
  113. YdmBcSupervisorEntity ydmBcEntity = new YdmBcSupervisorEntity();
  114. ydmBcEntity.SupervisorName = this.txtUserBom.Text;
  115. ydmBcEntity.PlineCode = this.texPlineBom.Tag.ToString2();
  116. ydmBcEntity.PlineName = this.texPlineBom.Text;
  117. ydmBcEntity.SupervisorCall = this.txtCall.Text;
  118. ydmBcEntity.ColGroup = this.txtGroupBom.Value.ToString2();
  119. ydmBcEntity.Memo = this.memoBom.Text;
  120. ydmBcEntity.CreateName = this.UserInfo.GetUserName();
  121. ydmBcEntity.StorageNo = this.ultraTextEditor2.Tag.ToString2();
  122. ydmBcEntity.StorageName = this.ultraTextEditor2.Text.ToString2();
  123. string ydmBcSuerEntity = JSONFormat.Format(ydmBcEntity);
  124. CoreClientParam ccp = new CoreClientParam();
  125. ccp.ServerName = "com.steering.ydm.bc.FrmSupervisonInfo";
  126. ccp.MethodName = "doAdd";
  127. ccp.ServerParams = new object[] { ydmBcSuerEntity };
  128. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  129. if (ccp.ReturnCode != -1)
  130. {
  131. if (ccp.ReturnInfo.Equals("新增成功!"))
  132. {
  133. doQuery();
  134. MessageUtil.ShowTips(ccp.ReturnInfo);
  135. }
  136. else
  137. {
  138. MessageUtil.ShowTips(ccp.ReturnInfo);
  139. }
  140. }
  141. }
  142. /// <summary>
  143. /// 删除数据
  144. /// </summary>
  145. private void doDelete()
  146. {
  147. this.ultraGrid1.UpdateData();
  148. UltraGridRow row = this.ultraGrid1.ActiveRow;
  149. if (row == null) return;
  150. YdmBcSupervisorEntity ydmEntity = (YdmBcSupervisorEntity)row.ListObject;
  151. string ydmBcEntity = JSONFormat.Format(ydmEntity);
  152. CoreClientParam ccp = new CoreClientParam();
  153. ccp.ServerName = "com.steering.ydm.bc.FrmSupervisonInfo";
  154. ccp.MethodName = "doDelete";
  155. ccp.ServerParams = new object[] { ydmBcEntity };
  156. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  157. if (ccp.ReturnCode != -1)
  158. {
  159. if (ccp.ReturnInfo.Equals("删除成功!"))
  160. {
  161. doQuery();
  162. MessageUtil.ShowTips(ccp.ReturnInfo);
  163. }
  164. else
  165. {
  166. MessageUtil.ShowTips(ccp.ReturnInfo);
  167. }
  168. }
  169. }
  170. private void close()
  171. {
  172. this.Close();
  173. }
  174. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  175. {
  176. UltraGridRow row = this.ultraGrid1.ActiveRow;
  177. this.texPlineBom.Tag = row.Cells["PlineCode"].Text;
  178. this.texPlineBom.Text = row.Cells["PlineName"].Text;
  179. this.txtUserBom.Text = row.Cells["SupervisorName"].Text;
  180. this.txtCall.Text = row.Cells["SupervisorCall"].Text;
  181. this.txtGroupBom.Text = row.Cells["ColGroup"].Text;
  182. this.memoBom.Text = row.Cells["Memo"].Text;
  183. this.ultraTextEditor2.Tag = row.Cells["StorageNo"].Text;
  184. }
  185. private void utrPlineChk_CheckedChanged(object sender, EventArgs e)
  186. {
  187. this.txtPline.Enabled = this.utrPlineChk.Checked;
  188. }
  189. private void userChk_CheckedChanged(object sender, EventArgs e)
  190. {
  191. this.txtUser.Enabled = this.userChk.Checked;
  192. }
  193. private void texPlineBom_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  194. {
  195. DataTable dt = ServerHelper.GetData("com.steering.ydm.bc.FrmSupervisonInfo.doQueryPline",
  196. new object[] { }, ob);
  197. dt.Columns["PLINE_NAME"].Caption = "产线";
  198. BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "PLINE_NAME", "PLINE_CODE");
  199. baseInfo.Shown += new EventHandler((a, b) =>
  200. {
  201. var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where(
  202. c => c.GetValue("PLINE_CODE") == this.texPlineBom.Tag.ToString2()).FirstOrDefault();
  203. if (actRow != null) actRow.Activate();
  204. });
  205. if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  206. {
  207. texPlineBom.Tag = baseInfo.ChoicedRow.GetValue("PLINE_CODE");
  208. texPlineBom.Text = baseInfo.ChoicedRow.GetValue("PLINE_NAME");
  209. }
  210. }
  211. private void ultraTextEditor2_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  212. {
  213. DataTable dt = ServerHelper.GetData("com.steering.ydm.bc.FrmSupervisonInfo.doQueryStorageNo",
  214. new object[] { }, ob);
  215. dt.Columns["STORAGE_NAME"].Caption = "仓库";
  216. BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "STORAGE_NAME", "STORAGE_NO");
  217. baseInfo.Shown += new EventHandler((a, b) =>
  218. {
  219. var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where(
  220. c => c.GetValue("STORAGE_NO") == this.ultraTextEditor2.Tag.ToString2()).FirstOrDefault();
  221. if (actRow != null) actRow.Activate();
  222. });
  223. if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  224. {
  225. ultraTextEditor2.Tag = baseInfo.ChoicedRow.GetValue("STORAGE_NO");
  226. ultraTextEditor2.Text = baseInfo.ChoicedRow.GetValue("STORAGE_NAME");
  227. }
  228. }
  229. }
  230. }