SteelMakingPassApplyFrm.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  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 System;
  8. using System.Collections.Generic;
  9. using System.Data;
  10. using System.Linq;
  11. using System.Windows.Forms;
  12. namespace Core.StlMes.Client.Judge.Forms
  13. {
  14. public partial class SteelMakingPassApplyFrm : FrmBase
  15. {
  16. private QcmGpPassApplyCtrl _gpPassApplyCtrl;
  17. private QcmGpJudgeApplyDtlCtrl _gpJudgeApplyDtlCtrl;
  18. private QcmJhyElementsCtrl _jhyElementsCtrl;
  19. private QcmJhyPhyDbResultCtrl _jhyPhyDbResultCtrl;
  20. private FaceFileCtrl _faceFileCtrl;
  21. private DetectFileCtrl _detectFileCtrl;
  22. private Dal _d;
  23. public SteelMakingPassApplyFrm()
  24. {
  25. InitializeComponent();
  26. IsLoadUserView = true;
  27. }
  28. public override void ToolBar_Click(object sender, string ToolbarKey)
  29. {
  30. base.ToolBar_Click(sender, ToolbarKey);
  31. switch (ToolbarKey)
  32. {
  33. case "Query":
  34. Query();
  35. break;
  36. case "Audite":
  37. Audite();
  38. break;
  39. case "Audite2":
  40. Audite2();
  41. break;
  42. case "Export":
  43. GridHelper.ulGridToExcel(_gpPassApplyCtrl.UltraGrid1, "炼钢质量放行审核(二级)信息");
  44. break;
  45. }
  46. }
  47. private String cusInfo = "";
  48. private String suppunit = "";
  49. private void SteelMakingPassApplyFrm_Load(object sender, EventArgs e)
  50. {
  51. _d = new Dal(ob);
  52. _gpPassApplyCtrl = new QcmGpPassApplyCtrl(splitContainer1.Panel1, ob, this.ValidDataPurviewIds);
  53. _gpPassApplyCtrl.UltraGrid1.AfterRowActivate += gpPassApplyCtrl_AfterRowActivate;
  54. _gpJudgeApplyDtlCtrl = new QcmGpJudgeApplyDtlCtrl(splitContainer1.Panel2, ob);
  55. _jhyElementsCtrl = new QcmJhyElementsCtrl(ultraTabPageControl1, ob, false);
  56. _jhyPhyDbResultCtrl = new QcmJhyPhyDbResultCtrl(ultraTabPageControl2, ob);
  57. _faceFileCtrl = new FaceFileCtrl(ultraTabPageControl4, ob, false);
  58. _detectFileCtrl = new DetectFileCtrl(ultraTabPageControl3, ob, false);
  59. labelComboBox1.ComboBox.Value = "2";
  60. labelComboBox1.Checked = true;
  61. cusInfo = CustomInfo.Split('_')[0];
  62. if (CustomInfo.Split('_').Length > 1)
  63. suppunit = CustomInfo.Split('_')[1];
  64. if (cusInfo.StartsWith("Quality"))
  65. {
  66. ClsBaseInfo.FillComBaseInfo(labelComboBox1.ComboBox, "4075", ob, false);
  67. //判定结果只显示内控合格和不合格。 40740101内控合格 40740102内控不合格
  68. DataTable dt = (DataTable)labelComboBox1.ComboBox.DataSource;
  69. DataRow dr = dt.NewRow();
  70. dr["BASECODE"] = "2";
  71. dr["BASENAME"] = "未处置";
  72. dt.Rows.InsertAt(dr, 0);
  73. dt.AcceptChanges();
  74. dt.DefaultView.RowFilter = "BASECODE <> '407501'";
  75. ClsBaseInfo.SetComboItemHeight(labelComboBox1.ComboBox);
  76. }
  77. labelComboBox1.SelecteValue = "2";
  78. //labelDateTimePicker6.Checked = true;
  79. labelDateTimePicker6.Value = DateTime.Now.Date.AddDays(-3);
  80. labelDateTimePicker5.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  81. }
  82. private void Audite()
  83. {
  84. var chkRows = _gpPassApplyCtrl.UltraGrid1.Rows.Where(a => a.GetValue("chk") == "True");
  85. if (chkRows.Count() == 0)
  86. {
  87. MessageUtil.ShowWarning("没有需要审核的记录!");
  88. return;
  89. }
  90. string passApplyNo = "";
  91. string passApplySeq = "";
  92. List<string> passApplyNos = new List<string>();
  93. foreach (var row in chkRows)
  94. {
  95. if (passApplyNos.Contains(row.GetValue("passApplyNo"))) continue;
  96. DataRow drPassApply = _d.GetRowByXmlId("QcmGpPassApplyDAL.queryByPassApplyNo", row.GetValue("passApplyNo"));
  97. if (drPassApply["validflag"].ToString() == "0")
  98. {
  99. MessageUtil.ShowWarning("该放行申请记录已被删除,无法操作!", _gpPassApplyCtrl.UltraGrid1, row);
  100. return;
  101. }
  102. else if (drPassApply["auditResult2"].ToString() != "")
  103. {
  104. MessageUtil.ShowWarning("已进行二级审核,不能操作一级审核!", _gpPassApplyCtrl.UltraGrid1, row);
  105. return;
  106. }
  107. passApplyNo = row.GetValue("passApplyNo");
  108. passApplySeq = row.GetValue("passApplySeq");
  109. passApplyNos.Add(row.GetValue("passApplyNo"));
  110. }
  111. PopupAudite popupAudit = new PopupAudite("审核", cusInfo, false);
  112. popupAudit.CmbAuditType.Caption = "处置方式";
  113. if (cusInfo.StartsWith("Quality"))
  114. {
  115. ClsBaseInfo.FillComBaseInfo(popupAudit.CmbAuditType.ComboBox, "4075", ob, false);
  116. ((DataTable)popupAudit.CmbAuditType.ComboBox.DataSource).DefaultView.RowFilter = "BASECODE <> '407501'";
  117. }
  118. string auditeResult = "";
  119. string memo = "";
  120. if (popupAudit.ShowDialog() != System.Windows.Forms.DialogResult.OK)
  121. {
  122. return;
  123. }
  124. else
  125. {
  126. memo = popupAudit.TxtAudit.Text.Trim();
  127. auditeResult = popupAudit.CmbAuditType.ComboBox.Value.ToString2();
  128. }
  129. var ccp = _d.Set("com.steering.pss.judge.Bll.BllSteelMakingPassApply.Audite", passApplyNos, UserInfo.GetUserName(), auditeResult, memo);
  130. if (ccp.ReturnInfo != "")
  131. {
  132. MessageUtil.ShowError(ccp.ReturnInfo);
  133. return;
  134. }
  135. else
  136. {
  137. MessageUtil.ShowTips("操作成功!");
  138. }
  139. Relocate(passApplyNo, passApplySeq);
  140. }
  141. private void Audite2()
  142. {
  143. var chkRows = _gpPassApplyCtrl.UltraGrid1.Rows.Where(a => a.GetValue("chk") == "True");
  144. if (chkRows.Count() == 0)
  145. {
  146. MessageUtil.ShowWarning("没有需要审核的记录!");
  147. return;
  148. }
  149. string passApplyNo = "";
  150. string passApplySeq = "";
  151. List<string> passApplyNos = new List<string>();
  152. foreach (var row in chkRows)
  153. {
  154. if (passApplyNos.Contains(row.GetValue("passApplyNo"))) continue;
  155. DataRow drPassApply = _d.GetRowByXmlId("QcmGpPassApplyDAL.queryByPassApplyNo", row.GetValue("passApplyNo"));
  156. DataRow drjudgeApply = _d.GetRowByXmlId("QcmGpJugdeApplyDAL.queryGpApplyByJudgeStoveNo", row.GetValue("jugdeApplyCode"),
  157. row.GetValue("jugdeApplySqe"), row.GetValue("judgeStoveNo"));
  158. if (drPassApply["validflag"].ToString() == "0")
  159. {
  160. MessageUtil.ShowWarning("该放行申请记录已被删除,无法操作!", _gpPassApplyCtrl.UltraGrid1, row);
  161. return;
  162. }
  163. else if (drPassApply["auditResult"].ToString() == "")
  164. {
  165. MessageUtil.ShowWarning("没有进行一级审核,不能操作二级审核!", _gpPassApplyCtrl.UltraGrid1, row);
  166. return;
  167. }
  168. else if (drPassApply["auditResult"].ToString() == "0")
  169. {
  170. MessageUtil.ShowWarning("一级审核不通过,不能操作二级审核!", _gpPassApplyCtrl.UltraGrid1, row);
  171. return;
  172. }
  173. else if (drPassApply["type"].ToString() == "0" && drPassApply["judgeResultCode"].ToString() != "40740704")
  174. {
  175. MessageUtil.ShowWarning("只能审核综合判定结果不合格的炉号!", _gpPassApplyCtrl.UltraGrid1, row);
  176. return;
  177. }
  178. else if (drjudgeApply == null || drjudgeApply["validflag"].ToString() != "20")
  179. {
  180. MessageUtil.ShowWarning("此炉号已撤销判定,不能审核!", _gpPassApplyCtrl.UltraGrid1, row);
  181. return;
  182. }
  183. else if (drPassApply["type"].ToString() == "1" && drPassApply["auditResult2"].ToString() != "")
  184. {
  185. MessageUtil.ShowWarning("已有二级审核结果,不能重复操作!", _gpPassApplyCtrl.UltraGrid1, row);
  186. return;
  187. }
  188. passApplyNo = row.GetValue("passApplyNo");
  189. passApplySeq = row.GetValue("passApplySeq");
  190. passApplyNos.Add(row.GetValue("passApplyNo"));
  191. }
  192. PopupAudite popupAudit = new PopupAudite("审核", cusInfo, false);
  193. popupAudit.CmbAuditType.Caption = "处置方式";
  194. if (cusInfo.StartsWith("Quality"))
  195. {
  196. ClsBaseInfo.FillComBaseInfo(popupAudit.CmbAuditType.ComboBox, "4075", ob, false);
  197. ((DataTable)popupAudit.CmbAuditType.ComboBox.DataSource).DefaultView.RowFilter = "BASECODE <> '407501'";
  198. }
  199. string auditeResult = "";
  200. string memo = "";
  201. if (popupAudit.ShowDialog() != System.Windows.Forms.DialogResult.OK)
  202. {
  203. return;
  204. }
  205. else
  206. {
  207. memo = popupAudit.TxtAudit.Text.Trim();
  208. auditeResult = popupAudit.CmbAuditType.ComboBox.Value.ToString2();
  209. }
  210. var ccp = _d.Set("com.steering.pss.judge.Bll.BllSteelMakingPassApply.Audite2", passApplyNos, UserInfo.GetUserName(), auditeResult, memo);
  211. if (ccp.ReturnInfo != "")
  212. {
  213. MessageUtil.ShowError(ccp.ReturnInfo);
  214. return;
  215. }
  216. else
  217. {
  218. MessageUtil.ShowTips("操作成功!");
  219. }
  220. Relocate(passApplyNo, passApplySeq);
  221. }
  222. private void labelDateTimePicker4_CheckBox_CheckedChanged(object sender, EventArgs e)
  223. {
  224. labelDateTimePicker5.DateTimeEnabled = labelDateTimePicker6.Checked;
  225. }
  226. private void Relocate(string passApplyNo, string passApplySeq)
  227. {
  228. Query();
  229. var row = _gpPassApplyCtrl.UltraGrid1.Rows.Where(a => a.GetValue("passApplyNo") == passApplyNo
  230. && a.GetValue("passApplyNo") == passApplySeq).FirstOrDefault();
  231. if (row != null)
  232. {
  233. row.Activate();
  234. }
  235. }
  236. public void Query()
  237. {
  238. _jhyElementsCtrl.ClearData();
  239. _jhyPhyDbResultCtrl.ClearData();
  240. _faceFileCtrl.ClearData();
  241. _detectFileCtrl.ClearData();
  242. _gpJudgeApplyDtlCtrl.Clear();
  243. string stoveNo = labelTextBox5.Checked ? labelTextBox5.Text.Trim() : "";
  244. string judgeStoveNo = labelTextBox6.Checked ? labelTextBox6.Text.Trim() : "";
  245. string auditState = labelComboBox1.Checked ? labelComboBox1.SelecteValue.ToString2() : "";
  246. string timeB = labelDateTimePicker6.Checked ? labelDateTimePicker6.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
  247. string timeE = labelDateTimePicker6.Checked ? labelDateTimePicker5.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
  248. _gpPassApplyCtrl.AuditeQuery(stoveNo, judgeStoveNo, timeB, timeE, cusInfo, auditState, "1",suppunit);
  249. }
  250. void gpPassApplyCtrl_AfterRowActivate(object sender, EventArgs e)
  251. {
  252. try
  253. {
  254. this.Cursor = Cursors.WaitCursor;
  255. var row = _gpPassApplyCtrl.UltraGrid1.ActiveRow;
  256. _gpJudgeApplyDtlCtrl.Query(row.GetValue("jugdeApplyCode"), row.GetValue("jugdeApplySqe"), row.GetValue("judgeStoveNo"));
  257. DataRow craftDbCnt = _d.GetRowByXmlId("QcmJhyPhyDbResultDAL.queryJhyDbCnt", row.GetValue("judgeStoveNo"));
  258. if (craftDbCnt["COUNT"].ToString() == "0")
  259. {
  260. ultraTabControl1.Tabs[1].Visible = false;
  261. }
  262. else
  263. {
  264. ultraTabControl1.Tabs[1].Visible = true;
  265. }
  266. DataRow drGpApply = _d.GetRowByXmlId("QcmGpJugdeApplyDAL.queryGpApplyByJudgeStoveNo", row.GetValue("jugdeApplyCode"),
  267. row.GetValue("jugdeApplySqe"), row.GetValue("JudgeStoveNo"));
  268. if (drGpApply != null && drGpApply["DetectResultPath"].ToString() != "")
  269. {
  270. ultraTabControl1.Tabs[2].Visible = true;
  271. }
  272. else
  273. {
  274. ultraTabControl1.Tabs[2].Visible = false;
  275. }
  276. QueryGpJudgeApplyDown(drGpApply);
  277. }
  278. finally
  279. {
  280. this.Cursor = Cursors.Default;
  281. }
  282. }
  283. private void QueryGpJudgeApplyDown(DataRow drGpApply)
  284. {
  285. if (_gpPassApplyCtrl == null) return;
  286. var row = _gpPassApplyCtrl.UltraGrid1.ActiveRow;
  287. if (row == null) return;
  288. switch (ultraTabControl1.SelectedTab.Text)
  289. {
  290. case "成分信息":
  291. _jhyElementsCtrl.ClearData();
  292. string[] zgProPlanIds = SteelMakingChemJudgeFrm.GetGpJudgeApplyZgPlanId(row.GetValue("jugdeApplyCode"),
  293. row.GetValue("jugdeApplySqe"), row.GetValue("judgeStoveNo"), row.GetValue("stoveNo"), _d.Ob);
  294. DataRow drPlnCic = _d.GetRowByXmlId("PlnSteelforOrdDAL.getCicByJudgeStoveNo", row.GetValue("judgeStoveNo"));
  295. string[] cics = new string[1];
  296. if (drPlnCic != null)
  297. {
  298. cics = drPlnCic["cic"].ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
  299. }
  300. else if (drGpApply != null)
  301. {
  302. cics[0] = drGpApply["cic"].ToString();
  303. }
  304. DataTable dtCraftCic = _d.GetTableByXmlId("JdgPlnOrderZgS.queryCraftCicByZgProPlanId", new object[] { zgProPlanIds, cics.Length, cics });
  305. //增加余材获取成分
  306. if (dtCraftCic.Rows.Count <= 0)
  307. {
  308. drPlnCic = _d.GetRowByXmlId("PlnSteelforOrdDAL.getCicByProPlanId", new object[] { zgProPlanIds });
  309. cics = new string[1];
  310. if (drPlnCic != null)
  311. {
  312. cics = drPlnCic["cic"].ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
  313. }
  314. else if (drGpApply != null)
  315. {
  316. cics[0] = drGpApply["cic"].ToString();
  317. }
  318. dtCraftCic = _d.GetTableByXmlId("JdgPlnOrderZgS.queryCraftCicByZgProPlanId", new object[] { zgProPlanIds, cics.Length, cics });
  319. if (dtCraftCic.Rows.Count <= 0)
  320. {
  321. dtCraftCic = _d.GetTableByXmlId("JdgPlnOrderZgS.queryCraftCicByZgProPlanIdNew", new object[] { zgProPlanIds });
  322. }
  323. }
  324. //FillLkCic(drGpApply, dtCraftCic);
  325. _jhyElementsCtrl.SteelMakingColligateQuery(row.GetValue("stoveNo"), row.GetValue("judgeStoveNo"), dtCraftCic, "A", zgProPlanIds);
  326. break;
  327. case "低倍信息":
  328. _jhyPhyDbResultCtrl.ClearData();
  329. //drCraft = _d.GetRowByXmlId("QcmGpJugdeApplyDAL.queryCraftDesignKey", zgProPlanId, zgGxPlanNo);
  330. //if (drCraft == null) return;
  331. //designKey = drCraft["desginKey"].ToString();
  332. //pic = drCraft["PIC"].ToString();
  333. //mscPline = drCraft["mscPline"].ToString();
  334. string lgJudgeStoveNo = row.GetValue("judgeStoveNo");
  335. if (drGpApply != null && drGpApply["judgeStoveNoLg"].ToString() != "")
  336. {
  337. lgJudgeStoveNo = drGpApply["judgeStoveNoLg"].ToString();
  338. }
  339. _jhyPhyDbResultCtrl.Query(lgJudgeStoveNo);
  340. break;
  341. case "探伤信息":
  342. _detectFileCtrl.Query(row.GetValue("judgeStoveNo"));
  343. break;
  344. case "表检尺寸":
  345. _faceFileCtrl.Query(row.GetValue("judgeStoveNo"));
  346. break;
  347. }
  348. }
  349. private void FillLkCic(DataRow drGpApply, DataTable dtCraftCic)
  350. {
  351. if (drGpApply != null && drGpApply["Cic"].ToString() != "" && drGpApply["lkFlag"].ToString() == "1")
  352. {
  353. bool sameCic = false;
  354. foreach (DataRow drCraftCic in dtCraftCic.Rows)
  355. {
  356. if (drCraftCic["cic"].ToString() == drGpApply["cic"].ToString())
  357. {
  358. sameCic = true;
  359. }
  360. }
  361. if (!sameCic)
  362. {
  363. foreach (DataRow drCraftCic in dtCraftCic.Rows)
  364. {
  365. drCraftCic["cic"] = drGpApply["cic"].ToString();
  366. }
  367. }
  368. }
  369. }
  370. private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
  371. {
  372. try
  373. {
  374. this.Cursor = Cursors.WaitCursor;
  375. if (_gpPassApplyCtrl == null || _gpPassApplyCtrl.UltraGrid1.ActiveRow == null) return;
  376. var row = _gpPassApplyCtrl.UltraGrid1.ActiveRow;
  377. DataRow drGpApply = _d.GetRowByXmlId("QcmGpJugdeApplyDAL.queryGpApplyByJudgeStoveNo", row.GetValue("jugdeApplyCode"),
  378. row.GetValue("jugdeApplySqe"), row.GetValue("JudgeStoveNo"));
  379. QueryGpJudgeApplyDown(drGpApply);
  380. }
  381. finally
  382. {
  383. this.Cursor = Cursors.Default;
  384. }
  385. }
  386. private void labelTextBox6_TextBox_KeyDown(object sender, KeyEventArgs e)
  387. {
  388. if (e.KeyData == Keys.Enter)
  389. {
  390. Query();
  391. }
  392. }
  393. }
  394. }