FrmCouplingThreadInReport.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. using com.steering.mes.mcp.entity;
  2. using Core.Mes.Client.Comm.Control;
  3. using Core.Mes.Client.Comm.Server;
  4. using Core.Mes.Client.Comm.Tool;
  5. using Core.StlMes.Client.Mcp.Control;
  6. using CoreFS.CA06;
  7. using Infragistics.Win.UltraWinGrid;
  8. using System;
  9. using System.Collections;
  10. using System.Collections.Generic;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Drawing;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Windows.Forms;
  17. namespace Core.StlMes.Client.Mcp.Report
  18. {
  19. public partial class FrmCouplingThreadInReport : FrmBase
  20. {
  21. private string SlGx = "";//工序代码
  22. private string SlGxname = "";//工序名称
  23. private string departm = "";
  24. private string plineCode = "";
  25. private string[] plineCodes = new string[] { };
  26. public FrmCouplingThreadInReport()
  27. {
  28. InitializeComponent();
  29. this.IsLoadUserView = true;
  30. }
  31. public override void ToolBar_Click(object sender, string ToolbarKey)
  32. {
  33. switch (ToolbarKey)
  34. {
  35. case "DoQuery":
  36. QuerySinglePlan();//外观检验
  37. break;
  38. case "Confirm":
  39. confirm();//确认
  40. break;
  41. case "CancelConfirm":
  42. cancelConfirm();
  43. break;
  44. case "Export":
  45. GridHelper.ulGridToExcel(ultraGrid4, "接箍螺纹台账");
  46. break;
  47. case "DoAudite":
  48. DoAudite();//核对
  49. break;
  50. case "DoClose":
  51. this.Close();
  52. break;
  53. }
  54. }
  55. ///
  56. /// 取消确认
  57. ///
  58. private void cancelConfirm()
  59. {
  60. ultraGrid4.UpdateData();
  61. UltraGridRow uRow = this.ultraGrid4.ActiveRow;
  62. if (uRow == null) { MessageUtil.ShowTips("无数据!"); return; }
  63. ArrayList list1 = new ArrayList();
  64. int UpdaCount = 0;
  65. foreach (UltraGridRow ugr in ultraGrid4.Rows)
  66. {
  67. if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
  68. {
  69. if (ugr.Cells["CONFIRM"].Value.ToString().Equals("未确认"))
  70. {
  71. MessageUtil.ShowTips("选中有没确认实绩,不允许取消确认!");
  72. return;
  73. }
  74. UpdaCount += 1;
  75. ArrayList list = new ArrayList();
  76. list.Add(ugr.Cells["RESULT_NO"].Text.ToString());
  77. list.Add(UserInfo.GetUserName());
  78. list.Add(DateTime.Now.ToString());
  79. list1.Add(list);
  80. }
  81. }
  82. if (UpdaCount == 0) { MessageUtil.ShowTips("请选择螺纹实绩数据!"); return; }
  83. if (MessageUtil.ShowYesNoAndQuestion("是否取消确认螺纹实绩?") == DialogResult.No)
  84. {
  85. return;
  86. }
  87. CoreClientParam ccp = new CoreClientParam();
  88. try
  89. {
  90. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  91. if (Constant.WaitingForm == null)
  92. {
  93. Constant.WaitingForm = new WaitingForm();
  94. }
  95. Constant.WaitingForm.ShowToUser = true;
  96. Constant.WaitingForm.Show();
  97. Constant.WaitingForm.Update();
  98. ccp.ServerName = "com.steering.mes.mcp.coup.ThreadInspectResultService";
  99. ccp.MethodName = "getCancelConfirm";
  100. ccp.ServerParams = new object[] { list1 };
  101. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  102. this.Cursor = Cursors.Default;
  103. Constant.WaitingForm.ShowToUser = false;
  104. Constant.WaitingForm.Close();
  105. Constant.WaitingForm = null;
  106. }
  107. catch (Exception ex)
  108. {
  109. this.Cursor = Cursors.Default;
  110. Constant.WaitingForm.ShowToUser = false;
  111. Constant.WaitingForm.Close();
  112. Constant.WaitingForm = null;
  113. }
  114. if (ccp.ReturnCode != -1)
  115. {
  116. MessageUtil.ShowTips(ccp.ReturnInfo);
  117. if (ccp.ReturnInfo.Equals("取消确认成功!"))
  118. {
  119. QuerySinglePlan();
  120. }
  121. }
  122. }
  123. ///
  124. /// 确认
  125. ///
  126. private void confirm()
  127. {
  128. ultraGrid4.UpdateData();
  129. UltraGridRow uRow = this.ultraGrid4.ActiveRow;
  130. if (uRow == null) { MessageUtil.ShowTips("无数据!"); return; }
  131. ArrayList list1 = new ArrayList();
  132. int UpdaCount = 0;
  133. foreach (UltraGridRow ugr in ultraGrid4.Rows)
  134. {
  135. if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
  136. {
  137. if (ugr.Cells["CONFIRM"].Value.ToString().Equals("已确认"))
  138. {
  139. MessageUtil.ShowTips("选中有已确认实绩,不允许再次确认!");
  140. return;
  141. }
  142. UpdaCount += 1;
  143. ArrayList list = new ArrayList();
  144. list.Add(ugr.Cells["RESULT_NO"].Text.ToString());
  145. list.Add(UserInfo.GetUserName());
  146. list.Add(DateTime.Now.ToString());
  147. list1.Add(list);
  148. }
  149. }
  150. if (UpdaCount == 0) { MessageUtil.ShowTips("请选择螺纹实绩数据!"); return; }
  151. if (MessageUtil.ShowYesNoAndQuestion("是否确认螺纹实绩?") == DialogResult.No)
  152. {
  153. return;
  154. }
  155. CoreClientParam ccp = new CoreClientParam();
  156. try
  157. {
  158. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  159. if (Constant.WaitingForm == null)
  160. {
  161. Constant.WaitingForm = new WaitingForm();
  162. }
  163. Constant.WaitingForm.ShowToUser = true;
  164. Constant.WaitingForm.Show();
  165. Constant.WaitingForm.Update();
  166. ccp.ServerName = "com.steering.mes.mcp.coup.ThreadInspectResultService";
  167. ccp.MethodName = "getConfirm";
  168. ccp.ServerParams = new object[] { list1 };
  169. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  170. this.Cursor = Cursors.Default;
  171. Constant.WaitingForm.ShowToUser = false;
  172. Constant.WaitingForm.Close();
  173. Constant.WaitingForm = null;
  174. }
  175. catch (Exception ex)
  176. {
  177. this.Cursor = Cursors.Default;
  178. Constant.WaitingForm.ShowToUser = false;
  179. Constant.WaitingForm.Close();
  180. Constant.WaitingForm = null;
  181. }
  182. if (ccp.ReturnCode != -1)
  183. {
  184. MessageUtil.ShowTips(ccp.ReturnInfo);
  185. if (ccp.ReturnInfo.Equals("确认成功!"))
  186. {
  187. QuerySinglePlan();
  188. }
  189. }
  190. }
  191. private void DoAudite()
  192. {
  193. ultraGrid4.UpdateData();
  194. UltraGridRow row = ultraGrid4.ActiveRow;
  195. if (row == null) { MessageUtil.ShowTips("无上料信息!"); return; }
  196. ArrayList list1 = new ArrayList();
  197. foreach (UltraGridRow item in ultraGrid4.Rows)
  198. {
  199. if (Convert.ToBoolean(item.Cells["CHK"].Text) == true)
  200. {
  201. ArrayList list = new ArrayList();
  202. list.Add(item.Cells["RESULT_NO"].Text.ToString());
  203. list.Add(item.Cells["WO_ID"].Text.ToString());
  204. list.Add(item.Cells["JUDGE_STOVE_NO"].Text.ToString());
  205. list.Add(item.Cells["WO_ID"].Text.ToString());
  206. list1.Add(list);
  207. }
  208. }
  209. if (MessageUtil.ShowYesNoAndQuestion("是否已经核对?") == DialogResult.No)
  210. {
  211. return;
  212. }
  213. CoreClientParam ccp = new CoreClientParam();
  214. try
  215. {
  216. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  217. if (Constant.WaitingForm == null)
  218. {
  219. Constant.WaitingForm = new WaitingForm();
  220. }
  221. Constant.WaitingForm.ShowToUser = true;
  222. Constant.WaitingForm.Show();
  223. Constant.WaitingForm.Update();
  224. ccp.ServerName = "com.steering.mes.mcp.Report.FrmJGMatNoReport";
  225. ccp.MethodName = "doAudite";
  226. ccp.ServerParams = new object[] { list1, SlGx };
  227. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  228. this.Cursor = Cursors.Default;
  229. Constant.WaitingForm.ShowToUser = false;
  230. Constant.WaitingForm.Close();
  231. Constant.WaitingForm = null;
  232. }
  233. catch (Exception ex)
  234. {
  235. this.Cursor = Cursors.Default;
  236. Constant.WaitingForm.ShowToUser = false;
  237. Constant.WaitingForm.Close();
  238. Constant.WaitingForm = null;
  239. }
  240. if (ccp.ReturnCode == -1) return;
  241. MessageUtil.ShowTips(ccp.ReturnInfo);
  242. if (ccp.ReturnInfo.Equals("核对成功!"))
  243. {
  244. QuerySinglePlan();
  245. }
  246. }
  247. /// <summary>
  248. /// 台账查询
  249. /// </summary>
  250. private void QuerySinglePlan()
  251. {
  252. string startTim = "";
  253. string endTim = "";
  254. string shift = ""; //班次
  255. string group = ""; //班组
  256. string judgeNo = "";//炉号
  257. string batchNo = "";//批号
  258. string specNo = "";//规格
  259. string steelNo = "";//钢级
  260. string modelNo = "";//扣型
  261. #region
  262. if (this.chkOrder.Checked && this.cmbOrder.Text.Trim() != "")
  263. {
  264. shift = this.cmbOrder.Value.ToString();
  265. }
  266. if (this.checkjudge.Checked && this.txtjudge.Text.Trim() != "")
  267. {
  268. judgeNo = this.txtjudge.Text.Trim().ToString();
  269. }
  270. if (this.checkbatch.Checked && this.txtbatch.Text.Trim() != "")
  271. {
  272. batchNo = this.txtbatch.Text.Trim().ToString();
  273. }
  274. if (this.checkspec.Checked && this.txtspec.Text.Trim() != "")
  275. {
  276. specNo = this.txtspec.Text.Trim().ToString();
  277. }
  278. if (this.checksteel.Checked && this.txtsteel.Text.Trim() != "")
  279. {
  280. steelNo = this.txtsteel.Text.Trim().ToString();
  281. }
  282. if (this.checkmodel.Checked && this.txtmodel.Text.Trim() != "")
  283. {
  284. modelNo = this.txtmodel.Text.Trim().ToString();
  285. }
  286. if (chkTim.Checked)
  287. {
  288. if (DateTime.Parse(RegStartTime.Value.ToString()) > DateTime.Parse(RegEndTime.Value.ToString()))
  289. {
  290. MessageUtil.ShowTips("选择时间区间错误,请重新选择!");
  291. return;
  292. }
  293. else
  294. {
  295. startTim = this.RegStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  296. endTim = this.RegEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  297. }
  298. }
  299. if (this.chkGroup.Checked && this.cmbGroup.Text.Trim() != "")
  300. {
  301. group = this.cmbGroup.Value.ToString();
  302. }
  303. #endregion
  304. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmJGMatNoReport.doQueryThreadInResult", new object[] { judgeNo, batchNo, specNo, steelNo, modelNo, shift, group, plineCode == "" ? plineCodes : new string[] { plineCode }, startTim, endTim }, this.ob);
  305. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  306. foreach (UltraGridRow item in ultraGrid4.Rows)
  307. {
  308. if (item.Cells["CONFIRM"].Text == "已确认")
  309. {
  310. item.Appearance.BackColor = Color.Yellow;
  311. }
  312. }
  313. }
  314. private void FrmCouplingThreadInReport_Load(object sender, EventArgs e)
  315. {
  316. RegStartTime.Value = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 00:00"));
  317. RegEndTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59"));
  318. departm = UserInfo.GetDepartment();
  319. //plineCode = YdmBaseClass.GetPCode(departm, this.ob);//获取 用户 对应的产线
  320. plineCodes= comm.InitDropPlineCodePower("H", txt_PlinCode, this.ValidDataPurviewIds, this.ob);
  321. txt_PlinCode.SelectedIndex = 0;
  322. YdmBaseClass.SetComboItemHeight(cmbOrder);
  323. YdmBaseClass.SetComboItemHeight(cmbGroup);
  324. //获取工序
  325. DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { "700306" }, this.ob);
  326. if (dt2.Rows.Count > 0)
  327. {
  328. SlGx = dt2.Rows[0]["BASECODE"].ToString();
  329. SlGxname = dt2.Rows[0]["BASENAME"].ToString();
  330. }
  331. QuerySinglePlan();
  332. }
  333. private void chkStarts_CheckedChanged(object sender, EventArgs e)
  334. {
  335. if (chkTim.Checked) { RegStartTime.Enabled = true; RegEndTime.Enabled = true; } else { RegStartTime.Enabled = false; RegEndTime.Enabled = false; }
  336. if (chkOrder.Checked) { cmbOrder.Enabled = true; } else { cmbOrder.Enabled = false; }
  337. if (chkGroup.Checked) { cmbGroup.Enabled = true; } else { cmbGroup.Enabled = false; }
  338. if (checkjudge.Checked) { txtjudge.Enabled = true; } else { txtjudge.Enabled = false; }
  339. if (checkbatch.Checked) { txtbatch.Enabled = true; } else { txtbatch.Enabled = false; }
  340. if (checkspec.Checked) { txtspec.Enabled = true; } else { txtspec.Enabled = false; }
  341. if (checksteel.Checked) { txtsteel.Enabled = true; } else { txtsteel.Enabled = false; }
  342. if (checkmodel.Checked) { txtmodel.Enabled = true; } else { txtmodel.Enabled = false; }
  343. }
  344. private void txt_PlinCode_TextChanged(object sender, EventArgs e)
  345. {
  346. plineCode = txt_PlinCode.SelectedItem.DataValue.ToString();
  347. }
  348. }
  349. }