using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Judge.Commons; using Core.StlMes.Client.Judge.Controls; using CoreFS.CA06; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Windows.Forms; namespace Core.StlMes.Client.Judge.Forms { public partial class ZcPassApplyFrm : FrmBase { private QcmZcPassApplyCtrl _zcPassApplyCtrl; private QcmZcAllChemPhyCtrl _zcAllChemPhyCtrl; private Dal _d; public ZcPassApplyFrm() { InitializeComponent(); IsLoadUserView = true; } public override void ToolBar_Click(object sender, string ToolbarKey) { base.ToolBar_Click(sender, ToolbarKey); switch (ToolbarKey) { case "Query": Query(); break; case "Audite": Audite(); break; case "FoldQuery": FoldQuery(); break; case "Export": GridHelper.ulGridToExcel(_zcPassApplyCtrl.UltraGrid1, "放行信息"); break; } } protected override void OnLoad(EventArgs e) { base.OnLoad(e); _zcAllChemPhyCtrl.SetChemPhyResultError(); } private string passType = ""; private void SteelMakingPassApplyFrm_Load(object sender, EventArgs e) { passType = CustomInfo; _d = new Dal(ob); _zcPassApplyCtrl = new QcmZcPassApplyCtrl(splitContainer2.Panel1, ob, this.UserInfo.GetDeptid()); _zcPassApplyCtrl.UltraGrid1.AfterRowActivate += zgPassApplyCtrl_AfterRowActivate; _zcAllChemPhyCtrl = new QcmZcAllChemPhyCtrl(ultraExpandableGroupBoxPanel2, ob, _zcPassApplyCtrl.UltraGrid1, "", "zcPass"); labelComboBox1.ComboBox.Value = "2"; labelComboBox1.Checked = true; if (passType == "Quality") { ClsBaseInfo.FillComBaseInfo(labelComboBox1.ComboBox, "4075", ob, false); //判定结果只显示内控合格和不合格。 40740101内控合格 40740102内控不合格 DataTable dt = (DataTable)labelComboBox1.ComboBox.DataSource; DataRow dr = dt.NewRow(); dr["BASECODE"] = "2"; dr["BASENAME"] = "未处置"; dt.Rows.InsertAt(dr, 0); dt.AcceptChanges(); dt.DefaultView.RowFilter = "BASECODE <> '407501'"; ClsBaseInfo.SetComboItemHeight(labelComboBox1.ComboBox); } labelComboBox1.SelecteValue = "2"; ; labelDateTimePicker6.Value = DateTime.Now.Date.AddDays(-3); labelDateTimePicker5.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1); } private void Audite() { var chkRows = _zcPassApplyCtrl.UltraGrid1.Rows.Where(a => a.GetValue("chk") == "True"); if (chkRows.Count() == 0) { MessageUtil.ShowWarning("没有需要审核的记录!"); return; } string passApplyNo = ""; string passApplySeq = ""; List parms = new List(); foreach (var row in chkRows) { DataRow drPassApply = _d.GetRowByXmlId("JdgQcmZcPassApplyDAL.queryByPassApplyNo", row.GetValue("passApplyNo")); DataRow drCrtAuditStep = _d.GetRowByXmlId("JdgQcmZcPassFlow.getCrtAuditStep", row.GetValue("passApplyNo")); DataRow drMaxAuditStep = _d.GetRowByXmlId("JdgQcmZcPassFlow.getMaxAuditStep", row.GetValue("passApplyNo")); DataRow drJudgeApply = _d.GetRowByXmlId("QcmZgJugdeApplyDAL.QueryByBatchNo", row.GetValue("jugdeApplyCode"), row.GetValue("judgeStoveNo"), row.GetValue("batchNo")); if (drPassApply["validflag"].ToString() == "0") { MessageUtil.ShowWarning("该放行申请记录已被删除,无法操作!", _zcPassApplyCtrl.UltraGrid1, row); return; } else if (int.Parse(row.GetValue("auditStep")) < int.Parse(drCrtAuditStep["auditStep"].ToString()) - 1) { MessageUtil.ShowWarning("第" + (int.Parse(drCrtAuditStep["auditStep"].ToString()) - 1) + "步骤审核完毕,不能修改第" + row.GetValue("auditStep") + "步骤审核结果!", _zcPassApplyCtrl.UltraGrid1, row); return; } else if (int.Parse(row.GetValue("auditStep")) == int.Parse(drCrtAuditStep["auditStep"].ToString()) - 1 && drCrtAuditStep["auditResult"].ToString() != "") { MessageUtil.ShowWarning("第" + drCrtAuditStep["auditStep"].ToString() + "步骤审核完毕,不能修改第" + row.GetValue("auditStep") + "步骤审核结果!", _zcPassApplyCtrl.UltraGrid1, row); return; } else if (int.Parse(row.GetValue("auditStep")) > int.Parse(drCrtAuditStep["auditStep"].ToString())) { MessageUtil.ShowWarning("第" + drCrtAuditStep["auditStep"].ToString() + "步骤审核未完成,不能提前操作第" + row.GetValue("auditStep") + "步骤审核!", _zcPassApplyCtrl.UltraGrid1, row); return; } else if (drPassApply["type"].ToString() == "0" && drPassApply["judgeResultCode"].ToString() != "40740704" && drPassApply["judgeResultCode"].ToString() != "40740708") { MessageUtil.ShowWarning("只能审核综合判定结果不合格的炉号!", _zcPassApplyCtrl.UltraGrid1, row); return; } else if (drJudgeApply == null || drJudgeApply["validflag"].ToString() != "20") { MessageUtil.ShowWarning("此炉号已撤销判定,不能修改审核结果!", _zcPassApplyCtrl.UltraGrid1, row); return; } else if (drJudgeApply != null && (drJudgeApply["judgeResult"].ToString() == "40740701" || drJudgeApply["judgeResult"].ToString() == "40740707")) { MessageUtil.ShowWarning("此炉号已判定合格,不能修改审核结果!", _zcPassApplyCtrl.UltraGrid1, row); return; } else if (drPassApply["type"].ToString() == "1" && drPassApply["auditResult"].ToString() == "1") { MessageUtil.ShowWarning("此炉号已放行通过,不能修改审核结果!", _zcPassApplyCtrl.UltraGrid1, row); return; } passApplyNo = row.GetValue("passApplyNo"); passApplySeq = row.GetValue("passApplySeq"); string[] parm = new string[] { row.GetValue("passApplyNo"), row.GetValue("auditStep") }; parms.Add(parm); } PopupAudite popupAudit = new PopupAudite("审核", passType, true); popupAudit.CmbAuditType.Caption = "处置方式"; if (passType == "Quality") { ClsBaseInfo.FillComBaseInfo(popupAudit.CmbAuditType.ComboBox, "4075", ob, false); ((DataTable)popupAudit.CmbAuditType.ComboBox.DataSource).DefaultView.RowFilter = "BASECODE <> '407501'"; } string auditeResult = ""; string memo = ""; if (popupAudit.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } else { memo = popupAudit.TxtAudit.Text.Trim(); auditeResult = popupAudit.CmbAuditType.ComboBox.Value.ToString2(); } var ccp = _d.Set("com.steering.pss.judge.Bll.BllZcColligatePassApply.Audite", parms, UserInfo.GetUserID(), UserInfo.GetUserName(), auditeResult, memo); if (ccp.ReturnInfo != "") { MessageUtil.ShowError(ccp.ReturnInfo); return; } else { MessageUtil.ShowTips("操作成功!"); } Relocate(passApplyNo); } private void labelDateTimePicker4_CheckBox_CheckedChanged(object sender, EventArgs e) { labelDateTimePicker5.DateTimeEnabled = labelDateTimePicker6.Checked; } private void Relocate(string passApplyNo) { Query(); var row = _zcPassApplyCtrl.UltraGrid1.Rows.Where(a => a.GetValue("passApplyNo") == passApplyNo).FirstOrDefault(); if (row != null) { row.Activate(); } } public void Query() { try { this.Cursor = Cursors.WaitCursor; _zcAllChemPhyCtrl.ClearChemPhyData(); string batchNo = labelTextBox5.Checked ? labelTextBox5.Text.Trim() : ""; string judgeStoveNo = labelTextBox6.Checked ? labelTextBox6.Text.Trim() : ""; string auditState = labelComboBox1.Checked ? labelComboBox1.SelecteValue.ToString2() : ""; string timeB = labelDateTimePicker6.Checked ? labelDateTimePicker6.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""; string timeE = labelDateTimePicker6.Checked ? labelDateTimePicker5.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""; _zcPassApplyCtrl.AuditeQuery(judgeStoveNo, batchNo, timeB, timeE, passType, auditState, "1"); } finally { this.Cursor = Cursors.Default; } } void zgPassApplyCtrl_AfterRowActivate(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; _zcAllChemPhyCtrl.UltraTabControl2_SelectedTabChanged(null, null); } finally { this.Cursor = Cursors.Default; } } public string[] GetChemJudgeStoveNos(string matNo, string curProcess) { if (curProcess.ToCharArray()[0] < 'D') { DataRow drTrack = _d.GetRowByXmlId("JdgMatBcQcmTrack.getByMatNoFirstRow", matNo, "D"); return new string[] { drTrack["judgeStoveNo"].ToString(), "A" }; } else { DataRow drTrack = _d.GetRowByXmlId("JdgMatBcQcmTrack.getByMatNoFirstRow", matNo, curProcess); if (drTrack != null) { DataRow drJudge = _d.GetRowByXmlId("JdgQcmBcJudge.getByJudgeId", drTrack["jugdeConvicted"].ToString()); if (drJudge["chemResult"].ToString() != "") { return new string[] { drTrack["judgeStoveNo"].ToString(), curProcess }; } else { curProcess = ((char)(curProcess.ToCharArray()[0] - 1)).ToString(); return GetChemJudgeStoveNos(matNo, curProcess); } } else { curProcess = ((char)(curProcess.ToCharArray()[0] - 1)).ToString(); return GetChemJudgeStoveNos(matNo, curProcess); } } } private void labelTextBox6_TextBox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { Query(); } } private void FoldQuery() { if (!this.toolMenu.Toolbars[0].Tools.Exists("FoldQuery")) return; panel5.Visible = !panel5.Visible; if (panel5.Visible) { this.toolMenu.Toolbars[0].Tools["FoldQuery"].SharedProps.Caption = "折叠查询区域"; } else { this.toolMenu.Toolbars[0].Tools["FoldQuery"].SharedProps.Caption = "展开查询区域"; } } private void ZcPassApplyFrm_Shown(object sender, EventArgs e) { FoldQuery(); } } }