FrmOfficeDirect.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  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 FrmOfficeDirect : FrmBase
  20. {
  21. UltraGridRow uge = null;
  22. string gx = "";
  23. public FrmOfficeDirect()
  24. {
  25. InitializeComponent();
  26. }
  27. public FrmOfficeDirect(OpeBase ob, UltraGridRow ugr,string GX)
  28. {
  29. InitializeComponent();
  30. this.ob = ob;
  31. uge = ugr;
  32. gx = GX;
  33. }
  34. //public override void ToolBar_Click(object sender, string ToolbarKey)
  35. //{
  36. // switch (ToolbarKey)
  37. // {
  38. // case "doQuery":
  39. // get_PurUoms();
  40. // break;
  41. // case "doAdd":
  42. // add_PurUoms();
  43. // break;
  44. // //case "doModify":
  45. // // upd_PurUoms();
  46. // // break;
  47. // case "doDelete":
  48. // del_PurUoms();
  49. // break;
  50. // case "Close":
  51. // this.Close();
  52. // break;
  53. // }
  54. //}
  55. /// <summary>
  56. /// 查询
  57. /// </summary>
  58. /// <param name="configureMEntity"></param>
  59. public void Query()
  60. {
  61. string startTim = "";
  62. string endTim = "";
  63. string heatid = "";
  64. string judgeno = "";
  65. if (chkTim.Checked)
  66. {
  67. if (DateTime.Parse(StartTime.Value.ToString()) > DateTime.Parse(EndTime.Value.ToString()))
  68. {
  69. MessageUtil.ShowTips("选择时间区间错误,请重新选择!");
  70. return;
  71. }
  72. else
  73. {
  74. startTim = this.StartTime.Value.ToString("yyyy-MM-dd 00:00:00");
  75. endTim = this.EndTime.Value.ToString("yyyy-MM-dd 23:59:59");
  76. }
  77. }
  78. if (!string.IsNullOrEmpty(planid.Text.Trim()))
  79. {
  80. heatid = planid.Text.ToString().Trim();
  81. }
  82. if(!string.IsNullOrEmpty(judgeNo.Text.Trim()))
  83. {
  84. judgeno = judgeNo.Text.ToString().Trim();
  85. }
  86. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmOfficeDirect.doQuery", new object[] { startTim,endTim,heatid,judgeno }, this.ob);
  87. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  88. if(dt.Rows.Count<=0)
  89. {
  90. dataTable2.Clear();
  91. }
  92. }
  93. /// <summary>
  94. /// 增加废品原因
  95. ///// </summary>
  96. ///// <param name="configureMEntity"></param>
  97. //public void Add()
  98. //{
  99. // string heatno = "";
  100. // string lotno = "";
  101. // string pline = "";
  102. // string process = "";
  103. // string officed = "";
  104. // if (txtheatno.Text != "" && txtheatno.Text != null)
  105. // {
  106. // heatno = txtheatno.Text;
  107. // }
  108. // else
  109. // {
  110. // MessageUtil.ShowTips("请输入炉号!");
  111. // return;
  112. // }
  113. // if (txtlotno.Text != "" && txtlotno.Text != null)
  114. // {
  115. // lotno = txtlotno.Text;
  116. // }
  117. // else
  118. // {
  119. // MessageUtil.ShowTips("请输入批号!");
  120. // return;
  121. // }
  122. // if (txtpline.Text != "" && txtpline.Text != null)
  123. // {
  124. // pline = txtpline.Text;
  125. // }
  126. // else
  127. // {
  128. // MessageUtil.ShowTips("请输入生产产线!");
  129. // return;
  130. // }
  131. // if (txtprocess.Text != "" && txtprocess.Text != null)
  132. // {
  133. // process = txtprocess.Text;
  134. // }
  135. // else
  136. // {
  137. // MessageUtil.ShowTips("请输入工序!");
  138. // return;
  139. // }
  140. // if (txtdirect.Text != "" && txtdirect.Text != null)
  141. // {
  142. // officed = txtdirect.Text;
  143. // }
  144. // else
  145. // {
  146. // MessageUtil.ShowTips("请输入离线去向!");
  147. // return;
  148. // }
  149. // CoreClientParam ccp = new CoreClientParam();
  150. // ccp.ServerName = "com.steering.mes.mcp.Mch.FrmReason";
  151. // ccp.MethodName = "addOfficeD";
  152. // ccp.ServerParams = new Object[] { heatno, lotno, pline, process, officed };
  153. // ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  154. // if (ccp.ReturnCode != -1)
  155. // {
  156. // MessageUtil.ShowTips(ccp.ReturnInfo);
  157. // if (ccp.ReturnInfo.Equals("新增成功!"))
  158. // {
  159. // Query();
  160. // }
  161. // }
  162. // //ConfigureClassCommon.doActiveSelRow(ultraGrid1, "UomCode", UomsEntity.UomCode);//激活当前行
  163. //}
  164. /////// <summary>
  165. /////// 修改离线去向
  166. /////// </summary>
  167. /////// <param name="configureMEntity"></param>
  168. //public void upd_PurUoms()
  169. //{
  170. // UltraGridRow urg = ultraGrid1.ActiveRow;
  171. // FrmMchPersonentity result = new FrmMchPersonentity();
  172. // result.Name = urg.Cells["NAME"].Value.ToString();
  173. // result.PlineCode = txt_pline.Text;
  174. // result.ProBc = txt_banci.Text;
  175. // CoreClientParam ccp = new CoreClientParam();
  176. // ccp.ServerName = "com.steering.mes.mcp.Mch.FrmMchPerson";
  177. // ccp.MethodName = "updatePerson";
  178. // ccp.ServerParams = new Object[] { result, txtheatno.Text };
  179. // ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  180. // if (ccp.ReturnCode != -1)
  181. // {
  182. // MessageUtil.ShowTips(ccp.ReturnInfo);
  183. // if (ccp.ReturnInfo.Equals("修改成功!"))
  184. // {
  185. // get_PurUoms();
  186. // }
  187. // }
  188. //}
  189. private void FrmReason_Load(object sender, EventArgs e)
  190. {
  191. if (uge == null)
  192. {
  193. return;
  194. }
  195. else
  196. {
  197. init();
  198. }
  199. //产线
  200. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmMchPerson.doQuerypline", null, this.ob);//如果是“”里面添加的是条件
  201. //pline.DataSource = dt;
  202. //pline.DisplayMember = "PLINE_NAME";
  203. //pline.ValueMember = "PLINE_CODE";
  204. //YdmBaseClass.SetComboItemHeight(pline);
  205. //txt_pline.DataSource = dt;
  206. //txt_pline.DisplayMember = "PLINE_NAME";
  207. //txt_pline.ValueMember = "PLINE_CODE";
  208. //YdmBaseClass.SetComboItemHeight(txt_pline);
  209. }
  210. //界面初始化
  211. private void init()
  212. {
  213. try
  214. {
  215. this.Cursor = Cursors.WaitCursor;
  216. String heatplanno = uge.Cells["HEAT_PLAN_NO"].Value.ToString();
  217. String lotno = uge.Cells["BATCH_NO"].Value.ToString();
  218. String plinename = uge.Cells["PLINE_NAME"].Value.ToString();
  219. }
  220. catch (Exception ex)
  221. {
  222. MessageUtil.ShowTips("加载数据失败:" + ex.Message);
  223. }
  224. finally
  225. {
  226. this.Cursor = Cursors.Default;
  227. }
  228. }
  229. ///// <summary>
  230. ///// 删除废品原因
  231. ///// </summary>
  232. ///// <param name="configureMEntity"></param>
  233. public void Delete()
  234. {
  235. if (ultraGrid1.ActiveRow != null)
  236. {
  237. UltraGridRow urg = ultraGrid1.ActiveRow;
  238. if (urg != null)
  239. {
  240. CoreClientParam ccp = new CoreClientParam();
  241. ccp.ServerName = "com.steering.mes.mcp.Mch.FrmReason";
  242. ccp.MethodName = "deletePerson";
  243. ccp.ServerParams = new Object[] { urg.Cells["FAIL_REASON"].Value.ToString() };
  244. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  245. if (ccp.ReturnCode != -1)
  246. {
  247. MessageUtil.ShowTips(ccp.ReturnInfo);
  248. if (ccp.ReturnInfo.Equals("删除成功!"))
  249. {
  250. Query();
  251. }
  252. }
  253. }
  254. else
  255. {
  256. MessageUtil.ShowTips("请选择一条数据");
  257. return;
  258. }
  259. }
  260. }
  261. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  262. {
  263. switch (e.Tool.Key.ToString())
  264. {
  265. case "Query":
  266. Query();
  267. break;
  268. //case "Add":
  269. // Add();
  270. // break;
  271. //case "Delete":
  272. // Delete();
  273. // break;
  274. case "Close":
  275. this.Close();
  276. break;
  277. }
  278. }
  279. private void ultraGrid4_AfterRowActivate(object sender, EventArgs e)
  280. {
  281. string heatno = "";
  282. string plinCode = "";
  283. UltraGridRow urg = ultraGrid4.ActiveRow;
  284. if(urg!=null)
  285. {
  286. heatno = urg.Cells["HEAT_PLAN_NO"].Value.ToString();
  287. plinCode = urg.Cells["PLINE_CODE"].Value.ToString();
  288. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmOfficeDirect.queryOfficeD", new object[] { heatno,plinCode}, this.ob);
  289. GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
  290. }
  291. }
  292. }
  293. }