FrmCouplingThreaReport.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  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 FrmCouplingThreaReport : 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 FrmCouplingThreaReport()
  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 "Export":
  39. GridHelper.ulGridToExcel(ultraGrid4, "接箍车丝台账");
  40. break;
  41. case "DoAudite":
  42. DoAudite();//核对
  43. break;
  44. case "Confirm":
  45. confirm();//确认
  46. break;
  47. case "CancelConfirm":
  48. cancelConfirm();
  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.CoupThreadingService";
  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.CoupThreadingService";
  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 machon = "";//机床编号
  257. string judgeNo = "";//炉号
  258. string batchNo = "";//批号
  259. string specNo = "";//规格
  260. string steelNo = "";//钢级
  261. string modelNo = "";//扣型
  262. #region
  263. if (this.chkOrder.Checked && this.cmbOrder.Text.Trim() != "")
  264. {
  265. shift = this.cmbOrder.Value.ToString();
  266. }
  267. if (this.checkjudge.Checked && this.txtjudge.Text.Trim() != "")
  268. {
  269. judgeNo = this.txtjudge.Text.Trim().ToString();
  270. }
  271. if (this.checkbatch.Checked && this.txtbatch.Text.Trim() != "")
  272. {
  273. batchNo = this.txtbatch.Text.Trim().ToString();
  274. }
  275. if (this.checkspec.Checked && this.txtspec.Text.Trim() != "")
  276. {
  277. specNo = this.txtspec.Text.Trim().ToString();
  278. }
  279. if (this.checksteel.Checked && this.txtsteel.Text.Trim() != "")
  280. {
  281. steelNo = this.txtsteel.Text.Trim().ToString();
  282. }
  283. if (this.checkmodel.Checked && this.txtmodel.Text.Trim() != "")
  284. {
  285. modelNo = this.txtmodel.Text.Trim().ToString();
  286. }
  287. if (MachNo.Text.Trim() !="")
  288. {
  289. machon = MachNo.Text.ToString();
  290. }
  291. if (chkTim.Checked)
  292. {
  293. if (DateTime.Parse(RegStartTime.Value.ToString()) > DateTime.Parse(RegEndTime.Value.ToString()))
  294. {
  295. MessageUtil.ShowTips("选择时间区间错误,请重新选择!");
  296. return;
  297. }
  298. else
  299. {
  300. startTim = this.RegStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  301. endTim = this.RegEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  302. }
  303. }
  304. if (this.chkGroup.Checked && this.cmbGroup.Text.Trim() != "")
  305. {
  306. group = this.cmbGroup.Value.ToString();
  307. }
  308. #endregion
  309. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmJGMatNoReport.doQueryThreaResult", new object[] { judgeNo, batchNo, specNo, steelNo, modelNo, machon, shift, group, plineCode == "" ? plineCodes : new string[] { plineCode }, startTim, endTim }, this.ob);
  310. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  311. foreach (UltraGridRow item in ultraGrid4.Rows)
  312. {
  313. if (item.Cells["CONFIRM"].Text == "已确认")
  314. {
  315. item.Appearance.BackColor = Color.Yellow;
  316. }
  317. }
  318. }
  319. private void FrmCouplingThreaReport_Load(object sender, EventArgs e)
  320. {
  321. RegStartTime.Value = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 00:00"));
  322. RegEndTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59"));
  323. departm = UserInfo.GetDepartment();
  324. //plineCode = YdmBaseClass.GetPCode(departm, this.ob);//获取 用户 对应的产线
  325. plineCodes= comm.InitDropPlineCodePower("H", txt_PlinCode, this.ValidDataPurviewIds, this.ob);
  326. txt_PlinCode.SelectedIndex = 0;
  327. YdmBaseClass.SetComboItemHeight(cmbOrder);
  328. YdmBaseClass.SetComboItemHeight(cmbGroup);
  329. //获取车丝机床
  330. DataTable dt3 = ServerHelper.GetData("com.steering.mes.mcp.coup.FrmMachine.getQuerySoue", new object[] { "7018" }, this.ob);
  331. MachNo.DataSource = dt3;
  332. MachNo.DisplayMember = "BASENAME";
  333. MachNo.ValueMember = "BASECODE";
  334. //获取工序
  335. DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { "700305" }, this.ob);
  336. if (dt2.Rows.Count > 0)
  337. {
  338. SlGx = dt2.Rows[0]["BASECODE"].ToString();
  339. SlGxname = dt2.Rows[0]["BASENAME"].ToString();
  340. }
  341. QuerySinglePlan();
  342. }
  343. private void chkStarts_CheckedChanged(object sender, EventArgs e)
  344. {
  345. if (chkTim.Checked) { RegStartTime.Enabled = true; RegEndTime.Enabled = true; } else { RegStartTime.Enabled = false; RegEndTime.Enabled = false; }
  346. if (chkOrder.Checked) { cmbOrder.Enabled = true; } else { cmbOrder.Enabled = false; }
  347. if (chkGroup.Checked) { cmbGroup.Enabled = true; } else { cmbGroup.Enabled = false; }
  348. if (checkjudge.Checked) { txtjudge.Enabled = true; } else { txtjudge.Enabled = false; }
  349. if (checkbatch.Checked) { txtbatch.Enabled = true; } else { txtbatch.Enabled = false; }
  350. if (checkspec.Checked) { txtspec.Enabled = true; } else { txtspec.Enabled = false; }
  351. if (checksteel.Checked) { txtsteel.Enabled = true; } else { txtsteel.Enabled = false; }
  352. if (checkmodel.Checked) { txtmodel.Enabled = true; } else { txtmodel.Enabled = false; }
  353. }
  354. private void txt_PlinCode_TextChanged(object sender, EventArgs e)
  355. {
  356. plineCode = txt_PlinCode.SelectedItem.DataValue.ToString();
  357. }
  358. }
  359. }