FrmCouplingInspectReport.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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 FrmCouplingInspectReport : 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 FrmCouplingInspectReport()
  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 "DoClose":
  48. this.Close();
  49. break;
  50. }
  51. }
  52. ///
  53. /// 取消确认
  54. ///
  55. private void cancelConfirm()
  56. {
  57. ultraGrid4.UpdateData();
  58. UltraGridRow uRow = this.ultraGrid4.ActiveRow;
  59. if (uRow == null) { MessageUtil.ShowTips("无数据!"); return; }
  60. ArrayList list1 = new ArrayList();
  61. int UpdaCount = 0;
  62. foreach (UltraGridRow ugr in ultraGrid4.Rows)
  63. {
  64. if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
  65. {
  66. if (ugr.Cells["CONFIRM"].Value.ToString().Equals("未确认"))
  67. {
  68. MessageUtil.ShowTips("选中有没确认实绩,不允许取消确认!");
  69. return;
  70. }
  71. UpdaCount += 1;
  72. ArrayList list = new ArrayList();
  73. list.Add(ugr.Cells["RESULT_NO"].Text.ToString());
  74. list.Add(UserInfo.GetUserName());
  75. list.Add(DateTime.Now.ToString());
  76. list1.Add(list);
  77. }
  78. }
  79. if (UpdaCount == 0) { MessageUtil.ShowTips("请选择探伤实绩数据!"); return; }
  80. if (MessageUtil.ShowYesNoAndQuestion("是否取消确认探伤实绩?") == DialogResult.No)
  81. {
  82. return;
  83. }
  84. CoreClientParam ccp = new CoreClientParam();
  85. try
  86. {
  87. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  88. if (Constant.WaitingForm == null)
  89. {
  90. Constant.WaitingForm = new WaitingForm();
  91. }
  92. Constant.WaitingForm.ShowToUser = true;
  93. Constant.WaitingForm.Show();
  94. Constant.WaitingForm.Update();
  95. ccp.ServerName = "com.steering.mes.mcp.coup.FrmInspection";
  96. ccp.MethodName = "getCancelConfirm";
  97. ccp.ServerParams = new object[] { list1 };
  98. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  99. this.Cursor = Cursors.Default;
  100. Constant.WaitingForm.ShowToUser = false;
  101. Constant.WaitingForm.Close();
  102. Constant.WaitingForm = null;
  103. }
  104. catch (Exception ex)
  105. {
  106. this.Cursor = Cursors.Default;
  107. Constant.WaitingForm.ShowToUser = false;
  108. Constant.WaitingForm.Close();
  109. Constant.WaitingForm = null;
  110. }
  111. if (ccp.ReturnCode != -1)
  112. {
  113. MessageUtil.ShowTips(ccp.ReturnInfo);
  114. if (ccp.ReturnInfo.Equals("取消确认成功!"))
  115. {
  116. QuerySinglePlan();
  117. }
  118. }
  119. }
  120. ///
  121. /// 确认
  122. ///
  123. private void confirm()
  124. {
  125. ultraGrid4.UpdateData();
  126. UltraGridRow uRow = this.ultraGrid4.ActiveRow;
  127. if (uRow == null) { MessageUtil.ShowTips("无数据!"); return; }
  128. ArrayList list1 = new ArrayList();
  129. int UpdaCount = 0;
  130. foreach (UltraGridRow ugr in ultraGrid4.Rows)
  131. {
  132. if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
  133. {
  134. if (ugr.Cells["CONFIRM"].Value.ToString().Equals("已确认"))
  135. {
  136. MessageUtil.ShowTips("选中有已确认实绩,不允许再次确认!");
  137. return;
  138. }
  139. UpdaCount += 1;
  140. ArrayList list = new ArrayList();
  141. list.Add(ugr.Cells["RESULT_NO"].Text.ToString());
  142. list.Add(UserInfo.GetUserName());
  143. list.Add(DateTime.Now.ToString());
  144. list1.Add(list);
  145. }
  146. }
  147. if (UpdaCount == 0) { MessageUtil.ShowTips("请选择探伤实绩数据!"); return; }
  148. if (MessageUtil.ShowYesNoAndQuestion("是否确认探伤实绩?") == DialogResult.No)
  149. {
  150. return;
  151. }
  152. CoreClientParam ccp = new CoreClientParam();
  153. try
  154. {
  155. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  156. if (Constant.WaitingForm == null)
  157. {
  158. Constant.WaitingForm = new WaitingForm();
  159. }
  160. Constant.WaitingForm.ShowToUser = true;
  161. Constant.WaitingForm.Show();
  162. Constant.WaitingForm.Update();
  163. ccp.ServerName = "com.steering.mes.mcp.coup.FrmInspection";
  164. ccp.MethodName = "getConfirm";
  165. ccp.ServerParams = new object[] { list1 };
  166. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  167. this.Cursor = Cursors.Default;
  168. Constant.WaitingForm.ShowToUser = false;
  169. Constant.WaitingForm.Close();
  170. Constant.WaitingForm = null;
  171. }
  172. catch (Exception ex)
  173. {
  174. this.Cursor = Cursors.Default;
  175. Constant.WaitingForm.ShowToUser = false;
  176. Constant.WaitingForm.Close();
  177. Constant.WaitingForm = null;
  178. }
  179. if (ccp.ReturnCode != -1)
  180. {
  181. MessageUtil.ShowTips(ccp.ReturnInfo);
  182. if (ccp.ReturnInfo.Equals("确认成功!"))
  183. {
  184. QuerySinglePlan();
  185. }
  186. }
  187. }
  188. /// <summary>
  189. /// 台账查询
  190. /// </summary>
  191. private void QuerySinglePlan()
  192. {
  193. string startTim = "";
  194. string endTim = "";
  195. string shift = ""; //班次
  196. string group = ""; //班组
  197. string judgeNo = "";//炉号
  198. string batchNo = "";//批号
  199. string specNo = "";//规格
  200. string steelNo = "";//钢级
  201. string modelNo = "";//扣型
  202. #region
  203. if (this.chkOrder.Checked && this.cmbOrder.Text.Trim() != "")
  204. {
  205. shift = this.cmbOrder.Value.ToString();
  206. }
  207. if (this.checkjudge.Checked && this.txtjudge.Text.Trim() != "")
  208. {
  209. judgeNo = this.txtjudge.Text.Trim().ToString();
  210. }
  211. if (this.checkbatch.Checked && this.txtbatch.Text.Trim() != "")
  212. {
  213. batchNo = this.txtbatch.Text.Trim().ToString();
  214. }
  215. if (this.checkspec.Checked && this.txtspec.Text.Trim() != "")
  216. {
  217. specNo = this.txtspec.Text.Trim().ToString();
  218. }
  219. if (this.checksteel.Checked && this.txtsteel.Text.Trim() != "")
  220. {
  221. steelNo = this.txtsteel.Text.Trim().ToString();
  222. }
  223. if (this.checkmodel.Checked && this.txtmodel.Text.Trim() != "")
  224. {
  225. modelNo = this.txtmodel.Text.Trim().ToString();
  226. }
  227. if (chkTim.Checked)
  228. {
  229. if (DateTime.Parse(RegStartTime.Value.ToString()) > DateTime.Parse(RegEndTime.Value.ToString()))
  230. {
  231. MessageUtil.ShowTips("选择时间区间错误,请重新选择!");
  232. return;
  233. }
  234. else
  235. {
  236. startTim = this.RegStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  237. endTim = this.RegEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  238. }
  239. }
  240. if (this.chkGroup.Checked && this.cmbGroup.Text.Trim() != "")
  241. {
  242. group = this.cmbGroup.Value.ToString();
  243. }
  244. #endregion
  245. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmJGMatNoReport.doQueryInspectResult", new object[] { judgeNo, batchNo, specNo, steelNo, modelNo, shift, group, plineCode == "" ? plineCodes : new string[] { plineCode }, startTim, endTim }, this.ob);
  246. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  247. foreach (UltraGridRow item in ultraGrid4.Rows)
  248. {
  249. if (item.Cells["CONFIRM"].Text == "已确认")
  250. {
  251. item.Appearance.BackColor = Color.Yellow;
  252. }
  253. }
  254. }
  255. private void FrmCouplingInspectReport_Load(object sender, EventArgs e)
  256. {
  257. RegStartTime.Value = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 00:00"));
  258. RegEndTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59"));
  259. departm = UserInfo.GetDepartment();
  260. //plineCode = YdmBaseClass.GetPCode(departm, this.ob);//获取 用户 对应的产线
  261. plineCodes= comm.InitDropPlineCodePower("H", txt_PlinCode, this.ValidDataPurviewIds, this.ob);
  262. txt_PlinCode.SelectedIndex = 0;
  263. YdmBaseClass.SetComboItemHeight(cmbOrder);
  264. YdmBaseClass.SetComboItemHeight(cmbGroup);
  265. //获取工序
  266. DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { "700307" }, this.ob);
  267. if (dt2.Rows.Count > 0)
  268. {
  269. SlGx = dt2.Rows[0]["BASECODE"].ToString();
  270. SlGxname = dt2.Rows[0]["BASENAME"].ToString();
  271. }
  272. QuerySinglePlan();
  273. }
  274. private void chkStarts_CheckedChanged(object sender, EventArgs e)
  275. {
  276. if (chkTim.Checked) { RegStartTime.Enabled = true; RegEndTime.Enabled = true; } else { RegStartTime.Enabled = false; RegEndTime.Enabled = false; }
  277. if (chkOrder.Checked) { cmbOrder.Enabled = true; } else { cmbOrder.Enabled = false; }
  278. if (chkGroup.Checked) { cmbGroup.Enabled = true; } else { cmbGroup.Enabled = false; }
  279. if (checkjudge.Checked) { txtjudge.Enabled = true; } else { txtjudge.Enabled = false; }
  280. if (checkbatch.Checked) { txtbatch.Enabled = true; } else { txtbatch.Enabled = false; }
  281. if (checkspec.Checked) { txtspec.Enabled = true; } else { txtspec.Enabled = false; }
  282. if (checksteel.Checked) { txtsteel.Enabled = true; } else { txtsteel.Enabled = false; }
  283. if (checkmodel.Checked) { txtmodel.Enabled = true; } else { txtmodel.Enabled = false; }
  284. }
  285. private void txt_PlinCode_TextChanged(object sender, EventArgs e)
  286. {
  287. plineCode = txt_PlinCode.SelectedItem.DataValue.ToString();
  288. }
  289. }
  290. }