HttReason.cs 10 KB

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