RolledTubePassApplyFrm.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.Judge.Commons;
  5. using Core.StlMes.Client.Judge.Controls;
  6. using CoreFS.CA06;
  7. using Infragistics.Win.UltraWinGrid;
  8. using Infragistics.Win.UltraWinTabControl;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Data;
  12. using System.Linq;
  13. using System.Windows.Forms;
  14. namespace Core.StlMes.Client.Judge.Forms
  15. {
  16. public partial class RolledTubePassApplyFrm : FrmBase
  17. {
  18. private QcmBcPassApplyCtrl _bcPassApplyCtrl;
  19. private Dal _d;
  20. private QcmZcAllChemPhyCtrl _zcAllChemPhyCtrl;
  21. public RolledTubePassApplyFrm()
  22. {
  23. InitializeComponent();
  24. IsLoadUserView = true;
  25. }
  26. public override void ToolBar_Click(object sender, string ToolbarKey)
  27. {
  28. base.ToolBar_Click(sender, ToolbarKey);
  29. switch (ToolbarKey)
  30. {
  31. case "Query":
  32. Query();
  33. break;
  34. case "Audite":
  35. Audite();
  36. break;
  37. case "FoldQuery":
  38. FoldQuery();
  39. break;
  40. case "Export":
  41. GridHelper.ulGridToExcel(_bcPassApplyCtrl.UltraGrid1, "放行信息");
  42. break;
  43. }
  44. }
  45. protected override void OnLoad(EventArgs e)
  46. {
  47. base.OnLoad(e);
  48. _zcAllChemPhyCtrl.SetChemPhyResultError();
  49. //_zgChemPhyCtrl.JhyPhyResultCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  50. //foreach (var tab in _zgChemPhyCtrl.UltraTabControl2.Tabs)
  51. //{
  52. // if (tab.Key == "002001007010")
  53. // {
  54. // QcmJhyElementsCtrl jhyElementsCtrl = (QcmJhyElementsCtrl)((SplitContainer)tab.TabPage.Controls[0]).Panel2.Controls[0];
  55. // jhyElementsCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  56. // }
  57. // else if (tab.Key == "002001007020" || tab.Key == "002001007013" || tab.Key == "002001007015" || tab.Key == "002001007014"
  58. // || tab.Key == "002001007009")
  59. // {
  60. // QcmJhyPhyResultCtrl jhyPhyResultCtrl = (QcmJhyPhyResultCtrl)((SplitContainer)tab.TabPage.Controls[0]).Panel2.Controls[0];
  61. // jhyPhyResultCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
  62. // }
  63. //}
  64. }
  65. private string processCode = "";
  66. private string passType = "";
  67. private void SteelMakingPassApplyFrm_Load(object sender, EventArgs e)
  68. {
  69. processCode = CustomInfo.Substring(0, 1);
  70. passType = CustomInfo.Substring(2);
  71. _d = new Dal(ob);
  72. _bcPassApplyCtrl = new QcmBcPassApplyCtrl(splitContainer2.Panel1, ob, this.UserInfo.GetDeptid());
  73. _bcPassApplyCtrl.UltraGrid1.AfterRowActivate += zgPassApplyCtrl_AfterRowActivate;
  74. _zcAllChemPhyCtrl = new QcmZcAllChemPhyCtrl(ultraExpandableGroupBoxPanel2, ob, _bcPassApplyCtrl.UltraGrid1, processCode, "bcPass");
  75. labelComboBox1.ComboBox.Value = "2";
  76. labelComboBox1.Checked = true;
  77. if (passType == "Quality")
  78. {
  79. ClsBaseInfo.FillComBaseInfo(labelComboBox1.ComboBox, "4075", ob, false);
  80. //判定结果只显示内控合格和不合格。 40740101内控合格 40740102内控不合格
  81. DataTable dt = (DataTable)labelComboBox1.ComboBox.DataSource;
  82. DataRow dr = dt.NewRow();
  83. dr["BASECODE"] = "2";
  84. dr["BASENAME"] = "未处置";
  85. dt.Rows.InsertAt(dr, 0);
  86. dt.AcceptChanges();
  87. dt.DefaultView.RowFilter = "BASECODE <> '407501'";
  88. ClsBaseInfo.SetComboItemHeight(labelComboBox1.ComboBox);
  89. }
  90. labelComboBox1.SelecteValue = "2";
  91. labelDateTimePicker6.Value = DateTime.Now.Date.AddDays(-3);
  92. labelDateTimePicker5.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  93. }
  94. private void Audite()
  95. {
  96. var chkRows = _bcPassApplyCtrl.UltraGrid1.Rows.Where(a => a.GetValue("chk") == "True");
  97. if (chkRows.Count() == 0)
  98. {
  99. MessageUtil.ShowWarning("没有需要审核的记录!");
  100. return;
  101. }
  102. string passApplyNo = "";
  103. string passApplySeq = "";
  104. List<string[]> parms = new List<string[]>();
  105. foreach (var row in chkRows)
  106. {
  107. DataRow drPassApply = _d.GetRowByXmlId("JdgQcmBcPassApplyDAL.queryByPassApplyNo", row.GetValue("passApplyNo"));
  108. DataRow drCrtAuditStep = _d.GetRowByXmlId("JdgQcmBcPassFlow.getCrtAuditStep", row.GetValue("passApplyNo"));
  109. DataRow drMaxAuditStep = _d.GetRowByXmlId("JdgQcmBcPassFlow.getMaxAuditStep", row.GetValue("passApplyNo"));
  110. DataRow drJudgeApply = _d.GetRowByXmlId("QcmZgJugdeApplyDAL.QueryByBatchNo", row.GetValue("jugdeApplyCode"),
  111. row.GetValue("judgeStoveNo"), row.GetValue("batchNo"));
  112. if (drJudgeApply == null)
  113. {
  114. MessageUtil.ShowWarning("未找到该炉批对应的申请判定信息,无法操作!", _bcPassApplyCtrl.UltraGrid1, row);
  115. return;
  116. }
  117. if (drPassApply["validflag"].ToString() == "0")
  118. {
  119. MessageUtil.ShowWarning("该放行申请记录已被删除,无法操作!", _bcPassApplyCtrl.UltraGrid1, row);
  120. return;
  121. }
  122. else if (int.Parse(row.GetValue("auditStep")) < int.Parse(drCrtAuditStep["auditStep"].ToString()) - 1)
  123. {
  124. MessageUtil.ShowWarning("第" + (int.Parse(drCrtAuditStep["auditStep"].ToString()) - 1) + "步骤审核完毕,不能修改第"
  125. + row.GetValue("auditStep") + "步骤审核结果!", _bcPassApplyCtrl.UltraGrid1, row);
  126. return;
  127. }
  128. else if (int.Parse(row.GetValue("auditStep")) == int.Parse(drCrtAuditStep["auditStep"].ToString()) - 1
  129. && drCrtAuditStep["auditResult"].ToString() != "")
  130. {
  131. MessageUtil.ShowWarning("第" + drCrtAuditStep["auditStep"].ToString() + "步骤审核完毕,不能修改第"
  132. + row.GetValue("auditStep") + "步骤审核结果!", _bcPassApplyCtrl.UltraGrid1, row);
  133. return;
  134. }
  135. else if (int.Parse(row.GetValue("auditStep")) > int.Parse(drCrtAuditStep["auditStep"].ToString()))
  136. {
  137. MessageUtil.ShowWarning("第" + drCrtAuditStep["auditStep"].ToString() + "步骤审核未完成,不能提前操作第"
  138. + row.GetValue("auditStep") + "步骤审核!", _bcPassApplyCtrl.UltraGrid1, row);
  139. return;
  140. }
  141. else if (drPassApply["type"].ToString() == "0" && drPassApply["judgeResultCode"].ToString() != "40740704"
  142. && drPassApply["judgeResultCode"].ToString() != "40740708")
  143. {
  144. MessageUtil.ShowWarning("只能审核综合判定结果不合格的炉号!", _bcPassApplyCtrl.UltraGrid1, row);
  145. return;
  146. }
  147. else if (drPassApply != null && drPassApply["type"].ToString() == "0" && drJudgeApply["validflag"].ToString() != "20")
  148. {
  149. MessageUtil.ShowWarning("此炉号已撤销判定,不能修改审核结果!", _bcPassApplyCtrl.UltraGrid1, row);
  150. return;
  151. }
  152. else if (drJudgeApply != null && (drJudgeApply["judgeResult"].ToString() == "40740701" || drJudgeApply["judgeResult"].ToString() == "40740707"))
  153. {
  154. MessageUtil.ShowWarning("此炉号已判定合格,不能修改审核结果!", _bcPassApplyCtrl.UltraGrid1, row);
  155. return;
  156. }
  157. else if (drPassApply["type"].ToString() == "1" && drPassApply["auditResult"].ToString() == "1")
  158. {
  159. MessageUtil.ShowWarning("此炉号已放行通过,不能修改审核结果!", _bcPassApplyCtrl.UltraGrid1, row);
  160. return;
  161. }
  162. passApplyNo = row.GetValue("passApplyNo");
  163. passApplySeq = row.GetValue("passApplySeq");
  164. string[] parm = new string[] { row.GetValue("passApplyNo"), row.GetValue("auditStep") };
  165. parms.Add(parm);
  166. }
  167. PopupAudite popupAudit = new PopupAudite("审核", passType, true);
  168. popupAudit.CmbAuditType.Caption = "处置方式";
  169. if (passType == "Quality")
  170. {
  171. ClsBaseInfo.FillComBaseInfo(popupAudit.CmbAuditType.ComboBox, "4075", ob, true);
  172. ((DataTable)popupAudit.CmbAuditType.ComboBox.DataSource).DefaultView.RowFilter = "BASECODE <> '407501' OR BASECODE IS NULL";
  173. }
  174. string auditeResult = "";
  175. string memo = "";
  176. if (popupAudit.ShowDialog() != System.Windows.Forms.DialogResult.OK)
  177. {
  178. return;
  179. }
  180. else
  181. {
  182. memo = popupAudit.TxtAudit.Text.Trim();
  183. auditeResult = popupAudit.CmbAuditType.ComboBox.Value.ToString2();
  184. }
  185. var ccp = _d.Set("com.steering.pss.judge.Bll.BllRolledTubePassApply.Audite", parms, UserInfo.GetUserID(),
  186. UserInfo.GetUserName(), auditeResult, memo);
  187. if (ccp.ReturnInfo != "")
  188. {
  189. MessageUtil.ShowError(ccp.ReturnInfo);
  190. return;
  191. }
  192. else
  193. {
  194. MessageUtil.ShowTips("操作成功!");
  195. }
  196. Relocate(passApplyNo);
  197. }
  198. private void Audite2()
  199. {
  200. var chkRows = _bcPassApplyCtrl.UltraGrid1.Rows.Where(a => a.GetValue("chk") == "True");
  201. if (chkRows.Count() == 0)
  202. {
  203. MessageUtil.ShowWarning("没有需要审核的记录!");
  204. return;
  205. }
  206. string passApplyNo = "";
  207. List<string> passApplyNos = new List<string>();
  208. foreach (var row in chkRows)
  209. {
  210. if (passApplyNos.Contains(row.GetValue("passApplyNo"))) continue;
  211. DataRow drPassApply = _d.GetRowByXmlId("QcmGpPassApplyDAL.queryByPassApplyNo", row.GetValue("passApplyNo"));
  212. DataRow drjudgeApply = _d.GetRowByXmlId("QcmGpJugdeApplyDAL.queryGpApplyByJudgeStoveNo", row.GetValue("jugdeApplyCode"),
  213. row.GetValue("jugdeApplySqe"), row.GetValue("judgeStoveNo"));
  214. if (drPassApply["validflag"].ToString() == "0")
  215. {
  216. MessageUtil.ShowWarning("该放行申请记录已被删除,无法操作!", _bcPassApplyCtrl.UltraGrid1, row);
  217. return;
  218. }
  219. else if (drPassApply["auditResult"].ToString() == "")
  220. {
  221. MessageUtil.ShowWarning("没有进行一级审核,不能操作二级审核!", _bcPassApplyCtrl.UltraGrid1, row);
  222. return;
  223. }
  224. else if (drPassApply["auditResult"].ToString() == "0")
  225. {
  226. MessageUtil.ShowWarning("一级审核不通过,不能操作二级审核!", _bcPassApplyCtrl.UltraGrid1, row);
  227. return;
  228. }
  229. else if (drPassApply["type"].ToString() == "0" && drPassApply["judgeResultCode"].ToString() != "40740704")
  230. {
  231. MessageUtil.ShowWarning("只能审核综合判定结果不合格的炉号!", _bcPassApplyCtrl.UltraGrid1, row);
  232. return;
  233. }
  234. else if (drjudgeApply == null || drjudgeApply["validflag"].ToString() != "20")
  235. {
  236. MessageUtil.ShowWarning("此炉号已撤销判定,不能审核!", _bcPassApplyCtrl.UltraGrid1, row);
  237. return;
  238. }
  239. else if (drPassApply["type"].ToString() == "1" && drPassApply["auditResult2"].ToString() != "")
  240. {
  241. MessageUtil.ShowWarning("已有二级审核结果,不能重复操作!", _bcPassApplyCtrl.UltraGrid1, row);
  242. return;
  243. }
  244. passApplyNo = row.GetValue("passApplyNo");
  245. passApplyNos.Add(row.GetValue("passApplyNo"));
  246. }
  247. PopupAudite popupAudit = new PopupAudite("审核", passType, true);
  248. popupAudit.CmbAuditType.Caption = "处置方式";
  249. if (CustomInfo.StartsWith("Quality"))
  250. {
  251. ClsBaseInfo.FillComBaseInfo(popupAudit.CmbAuditType.ComboBox, "4075", ob, false);
  252. ((DataTable)popupAudit.CmbAuditType.ComboBox.DataSource).DefaultView.RowFilter = "BASECODE <> '407501'";
  253. }
  254. string auditeResult = "";
  255. string memo = "";
  256. if (popupAudit.ShowDialog() != System.Windows.Forms.DialogResult.OK)
  257. {
  258. return;
  259. }
  260. else
  261. {
  262. memo = popupAudit.TxtAudit.Text.Trim();
  263. auditeResult = popupAudit.CmbAuditType.ComboBox.Value.ToString2();
  264. }
  265. var ccp = _d.Set("com.steering.pss.judge.Bll.BllSteelMakingPassApply.Audite2", passApplyNos, UserInfo.GetUserName(), auditeResult, memo);
  266. if (ccp.ReturnInfo != "")
  267. {
  268. MessageUtil.ShowError(ccp.ReturnInfo);
  269. return;
  270. }
  271. else
  272. {
  273. MessageUtil.ShowTips("操作成功!");
  274. }
  275. Relocate(passApplyNo);
  276. }
  277. private void labelDateTimePicker4_CheckBox_CheckedChanged(object sender, EventArgs e)
  278. {
  279. labelDateTimePicker5.DateTimeEnabled = labelDateTimePicker6.Checked;
  280. }
  281. private void Relocate(string passApplyNo)
  282. {
  283. Query();
  284. var row = _bcPassApplyCtrl.UltraGrid1.Rows.Where(a => a.GetValue("passApplyNo") == passApplyNo).FirstOrDefault();
  285. if (row != null)
  286. {
  287. row.Activate();
  288. }
  289. }
  290. public void Query()
  291. {
  292. try
  293. {
  294. this.Cursor = Cursors.WaitCursor;
  295. _zcAllChemPhyCtrl.ClearChemPhyParms();
  296. _zcAllChemPhyCtrl.ClearChemPhyData();
  297. //_zgJudgeApplyDtlCtrl.Clear();
  298. //_bcPassFlowCtrl.Clear();
  299. string batchNo = labelTextBox5.Checked ? labelTextBox5.Text.Trim() : "";
  300. string judgeStoveNo = labelTextBox6.Checked ? labelTextBox6.Text.Trim() : "";
  301. string auditState = labelComboBox1.Checked ? labelComboBox1.SelecteValue.ToString2() : "";
  302. string timeB = labelDateTimePicker6.Checked ? labelDateTimePicker6.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
  303. string timeE = labelDateTimePicker6.Checked ? labelDateTimePicker5.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
  304. string orderNo = labelTextBox1.Checked ? labelTextBox1.Text.Trim().Split('/')[0] : "";
  305. string orderSeq = "";
  306. if (labelTextBox1.Text.Trim().Split('/').Length > 1)
  307. {
  308. orderSeq = labelTextBox1.Text.Trim().Split('/')[1];
  309. }
  310. _bcPassApplyCtrl.AuditeQuery(judgeStoveNo, batchNo, timeB, timeE, passType, auditState, "1", processCode, orderNo, orderSeq);
  311. }
  312. finally
  313. {
  314. this.Cursor = Cursors.Default;
  315. }
  316. }
  317. void zgPassApplyCtrl_AfterRowActivate(object sender, EventArgs e)
  318. {
  319. try
  320. {
  321. this.Cursor = Cursors.WaitCursor;
  322. _zcAllChemPhyCtrl.UltraTabControl2_SelectedTabChanged(null, null);
  323. }
  324. finally
  325. {
  326. this.Cursor = Cursors.Default;
  327. }
  328. }
  329. private void labelTextBox6_TextBox_KeyDown(object sender, KeyEventArgs e)
  330. {
  331. if (e.KeyData == Keys.Enter)
  332. {
  333. Query();
  334. }
  335. }
  336. private void ultraExpandableGroupBox2_ExpandedStateChanged(object sender, EventArgs e)
  337. {
  338. if (!ultraExpandableGroupBox2.Expanded)
  339. {
  340. ultraExpandableGroupBox2.Dock = DockStyle.Bottom;
  341. splitContainer2.Panel1.Controls.Add(ultraExpandableGroupBox2);
  342. ultraExpandableGroupBox2.BringToFront();
  343. splitContainer2.Panel2Collapsed = true;
  344. }
  345. else
  346. {
  347. ultraExpandableGroupBox2.Dock = DockStyle.Fill;
  348. splitContainer2.Panel2.Controls.Add(ultraExpandableGroupBox2);
  349. splitContainer2.Panel2Collapsed = false;
  350. }
  351. }
  352. private void FoldQuery()
  353. {
  354. if (!this.toolMenu.Toolbars[0].Tools.Exists("FoldQuery")) return;
  355. panel5.Visible = !panel5.Visible;
  356. if (panel5.Visible)
  357. {
  358. this.toolMenu.Toolbars[0].Tools["FoldQuery"].SharedProps.Caption = "折叠查询区域";
  359. //this.splitContainer2.SplitterDistance += 47;
  360. }
  361. else
  362. {
  363. this.toolMenu.Toolbars[0].Tools["FoldQuery"].SharedProps.Caption = "展开查询区域";
  364. //this.splitContainer2.SplitterDistance -= 47;
  365. }
  366. }
  367. private void RolledTubePassApplyFrm_Shown(object sender, EventArgs e)
  368. {
  369. FoldQuery();
  370. }
  371. }
  372. }