| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390 |
- 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 Infragistics.Win.UltraWinGrid;
- using Infragistics.Win.UltraWinTabControl;
- 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 RolledTubePassApplyFrm : FrmBase
- {
- private QcmBcPassApplyCtrl _bcPassApplyCtrl;
- private Dal _d;
- private QcmZcAllChemPhyCtrl _zcAllChemPhyCtrl;
- public RolledTubePassApplyFrm()
- {
- 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(_bcPassApplyCtrl.UltraGrid1, "放行信息");
- break;
- }
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- _zcAllChemPhyCtrl.SetChemPhyResultError();
- //_zgChemPhyCtrl.JhyPhyResultCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
- //foreach (var tab in _zgChemPhyCtrl.UltraTabControl2.Tabs)
- //{
- // if (tab.Key == "002001007010")
- // {
- // QcmJhyElementsCtrl jhyElementsCtrl = (QcmJhyElementsCtrl)((SplitContainer)tab.TabPage.Controls[0]).Panel2.Controls[0];
- // jhyElementsCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
- // }
- // else if (tab.Key == "002001007020" || tab.Key == "002001007013" || tab.Key == "002001007015" || tab.Key == "002001007014"
- // || tab.Key == "002001007009")
- // {
- // QcmJhyPhyResultCtrl jhyPhyResultCtrl = (QcmJhyPhyResultCtrl)((SplitContainer)tab.TabPage.Controls[0]).Panel2.Controls[0];
- // jhyPhyResultCtrl.UltraGrid1.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells;
- // }
- //}
- }
- private string processCode = "";
- private string passType = "";
- private void SteelMakingPassApplyFrm_Load(object sender, EventArgs e)
- {
- processCode = CustomInfo.Substring(0, 1);
- passType = CustomInfo.Substring(2);
- _d = new Dal(ob);
- _bcPassApplyCtrl = new QcmBcPassApplyCtrl(splitContainer2.Panel1, ob, this.UserInfo.GetDeptid());
- _bcPassApplyCtrl.UltraGrid1.AfterRowActivate += zgPassApplyCtrl_AfterRowActivate;
- _zcAllChemPhyCtrl = new QcmZcAllChemPhyCtrl(ultraExpandableGroupBoxPanel2, ob, _bcPassApplyCtrl.UltraGrid1, processCode, "bcPass");
- 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 = _bcPassApplyCtrl.UltraGrid1.Rows.Where(a => a.GetValue("chk") == "True");
- if (chkRows.Count() == 0)
- {
- MessageUtil.ShowWarning("没有需要审核的记录!");
- return;
- }
- string passApplyNo = "";
- string passApplySeq = "";
- List<string[]> parms = new List<string[]>();
- foreach (var row in chkRows)
- {
- DataRow drPassApply = _d.GetRowByXmlId("JdgQcmBcPassApplyDAL.queryByPassApplyNo", row.GetValue("passApplyNo"));
- DataRow drCrtAuditStep = _d.GetRowByXmlId("JdgQcmBcPassFlow.getCrtAuditStep", row.GetValue("passApplyNo"));
- DataRow drMaxAuditStep = _d.GetRowByXmlId("JdgQcmBcPassFlow.getMaxAuditStep", row.GetValue("passApplyNo"));
- DataRow drJudgeApply = _d.GetRowByXmlId("QcmZgJugdeApplyDAL.QueryByBatchNo", row.GetValue("jugdeApplyCode"),
- row.GetValue("judgeStoveNo"), row.GetValue("batchNo"));
- if (drJudgeApply == null)
- {
- MessageUtil.ShowWarning("未找到该炉批对应的申请判定信息,无法操作!", _bcPassApplyCtrl.UltraGrid1, row);
- return;
- }
- if (drPassApply["validflag"].ToString() == "0")
- {
- MessageUtil.ShowWarning("该放行申请记录已被删除,无法操作!", _bcPassApplyCtrl.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") + "步骤审核结果!", _bcPassApplyCtrl.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") + "步骤审核结果!", _bcPassApplyCtrl.UltraGrid1, row);
- return;
- }
- else if (int.Parse(row.GetValue("auditStep")) > int.Parse(drCrtAuditStep["auditStep"].ToString()))
- {
- MessageUtil.ShowWarning("第" + drCrtAuditStep["auditStep"].ToString() + "步骤审核未完成,不能提前操作第"
- + row.GetValue("auditStep") + "步骤审核!", _bcPassApplyCtrl.UltraGrid1, row);
- return;
- }
- else if (drPassApply["type"].ToString() == "0" && drPassApply["judgeResultCode"].ToString() != "40740704"
- && drPassApply["judgeResultCode"].ToString() != "40740708")
- {
- MessageUtil.ShowWarning("只能审核综合判定结果不合格的炉号!", _bcPassApplyCtrl.UltraGrid1, row);
- return;
- }
- else if (drPassApply != null && drPassApply["type"].ToString() == "0" && drJudgeApply["validflag"].ToString() != "20")
- {
- MessageUtil.ShowWarning("此炉号已撤销判定,不能修改审核结果!", _bcPassApplyCtrl.UltraGrid1, row);
- return;
- }
- else if (drJudgeApply != null && (drJudgeApply["judgeResult"].ToString() == "40740701" || drJudgeApply["judgeResult"].ToString() == "40740707"))
- {
- MessageUtil.ShowWarning("此炉号已判定合格,不能修改审核结果!", _bcPassApplyCtrl.UltraGrid1, row);
- return;
- }
- else if (drPassApply["type"].ToString() == "1" && drPassApply["auditResult"].ToString() == "1")
- {
- MessageUtil.ShowWarning("此炉号已放行通过,不能修改审核结果!", _bcPassApplyCtrl.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, true);
- ((DataTable)popupAudit.CmbAuditType.ComboBox.DataSource).DefaultView.RowFilter = "BASECODE <> '407501' OR BASECODE IS NULL";
- }
- 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.BllRolledTubePassApply.Audite", parms, UserInfo.GetUserID(),
- UserInfo.GetUserName(), auditeResult, memo);
- if (ccp.ReturnInfo != "")
- {
- MessageUtil.ShowError(ccp.ReturnInfo);
- return;
- }
- else
- {
- MessageUtil.ShowTips("操作成功!");
- }
- Relocate(passApplyNo);
- }
- private void Audite2()
- {
- var chkRows = _bcPassApplyCtrl.UltraGrid1.Rows.Where(a => a.GetValue("chk") == "True");
- if (chkRows.Count() == 0)
- {
- MessageUtil.ShowWarning("没有需要审核的记录!");
- return;
- }
- string passApplyNo = "";
- List<string> passApplyNos = new List<string>();
- foreach (var row in chkRows)
- {
- if (passApplyNos.Contains(row.GetValue("passApplyNo"))) continue;
- DataRow drPassApply = _d.GetRowByXmlId("QcmGpPassApplyDAL.queryByPassApplyNo", row.GetValue("passApplyNo"));
- DataRow drjudgeApply = _d.GetRowByXmlId("QcmGpJugdeApplyDAL.queryGpApplyByJudgeStoveNo", row.GetValue("jugdeApplyCode"),
- row.GetValue("jugdeApplySqe"), row.GetValue("judgeStoveNo"));
- if (drPassApply["validflag"].ToString() == "0")
- {
- MessageUtil.ShowWarning("该放行申请记录已被删除,无法操作!", _bcPassApplyCtrl.UltraGrid1, row);
- return;
- }
- else if (drPassApply["auditResult"].ToString() == "")
- {
- MessageUtil.ShowWarning("没有进行一级审核,不能操作二级审核!", _bcPassApplyCtrl.UltraGrid1, row);
- return;
- }
- else if (drPassApply["auditResult"].ToString() == "0")
- {
- MessageUtil.ShowWarning("一级审核不通过,不能操作二级审核!", _bcPassApplyCtrl.UltraGrid1, row);
- return;
- }
- else if (drPassApply["type"].ToString() == "0" && drPassApply["judgeResultCode"].ToString() != "40740704")
- {
- MessageUtil.ShowWarning("只能审核综合判定结果不合格的炉号!", _bcPassApplyCtrl.UltraGrid1, row);
- return;
- }
- else if (drjudgeApply == null || drjudgeApply["validflag"].ToString() != "20")
- {
- MessageUtil.ShowWarning("此炉号已撤销判定,不能审核!", _bcPassApplyCtrl.UltraGrid1, row);
- return;
- }
- else if (drPassApply["type"].ToString() == "1" && drPassApply["auditResult2"].ToString() != "")
- {
- MessageUtil.ShowWarning("已有二级审核结果,不能重复操作!", _bcPassApplyCtrl.UltraGrid1, row);
- return;
- }
- passApplyNo = row.GetValue("passApplyNo");
- passApplyNos.Add(row.GetValue("passApplyNo"));
- }
- PopupAudite popupAudit = new PopupAudite("审核", passType, true);
- popupAudit.CmbAuditType.Caption = "处置方式";
- if (CustomInfo.StartsWith("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.BllSteelMakingPassApply.Audite2", passApplyNos, 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 = _bcPassApplyCtrl.UltraGrid1.Rows.Where(a => a.GetValue("passApplyNo") == passApplyNo).FirstOrDefault();
- if (row != null)
- {
- row.Activate();
- }
- }
- public void Query()
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- _zcAllChemPhyCtrl.ClearChemPhyParms();
- _zcAllChemPhyCtrl.ClearChemPhyData();
- //_zgJudgeApplyDtlCtrl.Clear();
- //_bcPassFlowCtrl.Clear();
- 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") : "";
- string orderNo = labelTextBox1.Checked ? labelTextBox1.Text.Trim().Split('/')[0] : "";
- string orderSeq = "";
- if (labelTextBox1.Text.Trim().Split('/').Length > 1)
- {
- orderSeq = labelTextBox1.Text.Trim().Split('/')[1];
- }
- _bcPassApplyCtrl.AuditeQuery(judgeStoveNo, batchNo, timeB, timeE, passType, auditState, "1", processCode, orderNo, orderSeq);
- }
- 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;
- }
- }
- private void labelTextBox6_TextBox_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyData == Keys.Enter)
- {
- Query();
- }
- }
- private void ultraExpandableGroupBox2_ExpandedStateChanged(object sender, EventArgs e)
- {
- if (!ultraExpandableGroupBox2.Expanded)
- {
- ultraExpandableGroupBox2.Dock = DockStyle.Bottom;
- splitContainer2.Panel1.Controls.Add(ultraExpandableGroupBox2);
- ultraExpandableGroupBox2.BringToFront();
- splitContainer2.Panel2Collapsed = true;
- }
- else
- {
- ultraExpandableGroupBox2.Dock = DockStyle.Fill;
- splitContainer2.Panel2.Controls.Add(ultraExpandableGroupBox2);
- splitContainer2.Panel2Collapsed = false;
- }
- }
- 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 = "折叠查询区域";
- //this.splitContainer2.SplitterDistance += 47;
- }
- else
- {
- this.toolMenu.Toolbars[0].Tools["FoldQuery"].SharedProps.Caption = "展开查询区域";
- //this.splitContainer2.SplitterDistance -= 47;
- }
- }
- private void RolledTubePassApplyFrm_Shown(object sender, EventArgs e)
- {
- FoldQuery();
- }
- }
- }
|