| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419 |
- 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 SteelMakingPassApplyFrm : FrmBase
- {
- private QcmGpPassApplyCtrl _gpPassApplyCtrl;
- private QcmGpJudgeApplyDtlCtrl _gpJudgeApplyDtlCtrl;
- private QcmJhyElementsCtrl _jhyElementsCtrl;
- private QcmJhyPhyDbResultCtrl _jhyPhyDbResultCtrl;
- private FaceFileCtrl _faceFileCtrl;
- private DetectFileCtrl _detectFileCtrl;
- private Dal _d;
- public SteelMakingPassApplyFrm()
- {
- 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 "Audite2":
- Audite2();
- break;
- case "Export":
- GridHelper.ulGridToExcel(_gpPassApplyCtrl.UltraGrid1, "炼钢质量放行审核(二级)信息");
- break;
- }
- }
- private String cusInfo = "";
- private String suppunit = "";
- private void SteelMakingPassApplyFrm_Load(object sender, EventArgs e)
- {
- _d = new Dal(ob);
- _gpPassApplyCtrl = new QcmGpPassApplyCtrl(splitContainer1.Panel1, ob, this.ValidDataPurviewIds);
- _gpPassApplyCtrl.UltraGrid1.AfterRowActivate += gpPassApplyCtrl_AfterRowActivate;
- _gpJudgeApplyDtlCtrl = new QcmGpJudgeApplyDtlCtrl(splitContainer1.Panel2, ob);
- _jhyElementsCtrl = new QcmJhyElementsCtrl(ultraTabPageControl1, ob, false);
- _jhyPhyDbResultCtrl = new QcmJhyPhyDbResultCtrl(ultraTabPageControl2, ob);
- _faceFileCtrl = new FaceFileCtrl(ultraTabPageControl4, ob, false);
- _detectFileCtrl = new DetectFileCtrl(ultraTabPageControl3, ob, false);
- labelComboBox1.ComboBox.Value = "2";
- labelComboBox1.Checked = true;
- cusInfo = CustomInfo.Split('_')[0];
- if (CustomInfo.Split('_').Length > 1)
- suppunit = CustomInfo.Split('_')[1];
- if (cusInfo.StartsWith("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.Checked = true;
- labelDateTimePicker6.Value = DateTime.Now.Date.AddDays(-3);
- labelDateTimePicker5.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
- }
- private void Audite()
- {
- var chkRows = _gpPassApplyCtrl.UltraGrid1.Rows.Where(a => a.GetValue("chk") == "True");
- if (chkRows.Count() == 0)
- {
- MessageUtil.ShowWarning("没有需要审核的记录!");
- return;
- }
- string passApplyNo = "";
- string passApplySeq = "";
- 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"));
- if (drPassApply["validflag"].ToString() == "0")
- {
- MessageUtil.ShowWarning("该放行申请记录已被删除,无法操作!", _gpPassApplyCtrl.UltraGrid1, row);
- return;
- }
- else if (drPassApply["auditResult2"].ToString() != "")
- {
- MessageUtil.ShowWarning("已进行二级审核,不能操作一级审核!", _gpPassApplyCtrl.UltraGrid1, row);
- return;
- }
- passApplyNo = row.GetValue("passApplyNo");
- passApplySeq = row.GetValue("passApplySeq");
- passApplyNos.Add(row.GetValue("passApplyNo"));
- }
- PopupAudite popupAudit = new PopupAudite("审核", cusInfo, false);
- popupAudit.CmbAuditType.Caption = "处置方式";
- if (cusInfo.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.Audite", passApplyNos, UserInfo.GetUserName(), auditeResult, memo);
- if (ccp.ReturnInfo != "")
- {
- MessageUtil.ShowError(ccp.ReturnInfo);
- return;
- }
- else
- {
- MessageUtil.ShowTips("操作成功!");
- }
- Relocate(passApplyNo, passApplySeq);
- }
- private void Audite2()
- {
- var chkRows = _gpPassApplyCtrl.UltraGrid1.Rows.Where(a => a.GetValue("chk") == "True");
- if (chkRows.Count() == 0)
- {
- MessageUtil.ShowWarning("没有需要审核的记录!");
- return;
- }
- string passApplyNo = "";
- string passApplySeq = "";
- 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("该放行申请记录已被删除,无法操作!", _gpPassApplyCtrl.UltraGrid1, row);
- return;
- }
- else if (drPassApply["auditResult"].ToString() == "")
- {
- MessageUtil.ShowWarning("没有进行一级审核,不能操作二级审核!", _gpPassApplyCtrl.UltraGrid1, row);
- return;
- }
- else if (drPassApply["auditResult"].ToString() == "0")
- {
- MessageUtil.ShowWarning("一级审核不通过,不能操作二级审核!", _gpPassApplyCtrl.UltraGrid1, row);
- return;
- }
- else if (drPassApply["type"].ToString() == "0" && drPassApply["judgeResultCode"].ToString() != "40740704")
- {
- MessageUtil.ShowWarning("只能审核综合判定结果不合格的炉号!", _gpPassApplyCtrl.UltraGrid1, row);
- return;
- }
- else if (drjudgeApply == null || drjudgeApply["validflag"].ToString() != "20")
- {
- MessageUtil.ShowWarning("此炉号已撤销判定,不能审核!", _gpPassApplyCtrl.UltraGrid1, row);
- return;
- }
- else if (drPassApply["type"].ToString() == "1" && drPassApply["auditResult2"].ToString() != "")
- {
- MessageUtil.ShowWarning("已有二级审核结果,不能重复操作!", _gpPassApplyCtrl.UltraGrid1, row);
- return;
- }
- passApplyNo = row.GetValue("passApplyNo");
- passApplySeq = row.GetValue("passApplySeq");
- passApplyNos.Add(row.GetValue("passApplyNo"));
- }
- PopupAudite popupAudit = new PopupAudite("审核", cusInfo, false);
- popupAudit.CmbAuditType.Caption = "处置方式";
- if (cusInfo.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, passApplySeq);
- }
- private void labelDateTimePicker4_CheckBox_CheckedChanged(object sender, EventArgs e)
- {
- labelDateTimePicker5.DateTimeEnabled = labelDateTimePicker6.Checked;
- }
- private void Relocate(string passApplyNo, string passApplySeq)
- {
- Query();
- var row = _gpPassApplyCtrl.UltraGrid1.Rows.Where(a => a.GetValue("passApplyNo") == passApplyNo
- && a.GetValue("passApplyNo") == passApplySeq).FirstOrDefault();
- if (row != null)
- {
- row.Activate();
- }
- }
- public void Query()
- {
- _jhyElementsCtrl.ClearData();
- _jhyPhyDbResultCtrl.ClearData();
- _faceFileCtrl.ClearData();
- _detectFileCtrl.ClearData();
- _gpJudgeApplyDtlCtrl.Clear();
- string stoveNo = 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") : "";
- _gpPassApplyCtrl.AuditeQuery(stoveNo, judgeStoveNo, timeB, timeE, cusInfo, auditState, "1",suppunit);
- }
- void gpPassApplyCtrl_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- var row = _gpPassApplyCtrl.UltraGrid1.ActiveRow;
- _gpJudgeApplyDtlCtrl.Query(row.GetValue("jugdeApplyCode"), row.GetValue("jugdeApplySqe"), row.GetValue("judgeStoveNo"));
- DataRow craftDbCnt = _d.GetRowByXmlId("QcmJhyPhyDbResultDAL.queryJhyDbCnt", row.GetValue("judgeStoveNo"));
- if (craftDbCnt["COUNT"].ToString() == "0")
- {
- ultraTabControl1.Tabs[1].Visible = false;
- }
- else
- {
- ultraTabControl1.Tabs[1].Visible = true;
- }
- DataRow drGpApply = _d.GetRowByXmlId("QcmGpJugdeApplyDAL.queryGpApplyByJudgeStoveNo", row.GetValue("jugdeApplyCode"),
- row.GetValue("jugdeApplySqe"), row.GetValue("JudgeStoveNo"));
- if (drGpApply != null && drGpApply["DetectResultPath"].ToString() != "")
- {
- ultraTabControl1.Tabs[2].Visible = true;
- }
- else
- {
- ultraTabControl1.Tabs[2].Visible = false;
- }
- QueryGpJudgeApplyDown(drGpApply);
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private void QueryGpJudgeApplyDown(DataRow drGpApply)
- {
- if (_gpPassApplyCtrl == null) return;
- var row = _gpPassApplyCtrl.UltraGrid1.ActiveRow;
- if (row == null) return;
- switch (ultraTabControl1.SelectedTab.Text)
- {
- case "成分信息":
- _jhyElementsCtrl.ClearData();
- string[] zgProPlanIds = SteelMakingChemJudgeFrm.GetGpJudgeApplyZgPlanId(row.GetValue("jugdeApplyCode"),
- row.GetValue("jugdeApplySqe"), row.GetValue("judgeStoveNo"), row.GetValue("stoveNo"), _d.Ob);
- DataRow drPlnCic = _d.GetRowByXmlId("PlnSteelforOrdDAL.getCicByJudgeStoveNo", row.GetValue("judgeStoveNo"));
- string[] cics = new string[1];
- if (drPlnCic != null)
- {
- cics = drPlnCic["cic"].ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
- }
- else if (drGpApply != null)
- {
- cics[0] = drGpApply["cic"].ToString();
- }
- DataTable dtCraftCic = _d.GetTableByXmlId("JdgPlnOrderZgS.queryCraftCicByZgProPlanId", new object[] { zgProPlanIds, cics.Length, cics });
- //增加余材获取成分
- if (dtCraftCic.Rows.Count <= 0)
- {
- drPlnCic = _d.GetRowByXmlId("PlnSteelforOrdDAL.getCicByProPlanId", new object[] { zgProPlanIds });
- cics = new string[1];
- if (drPlnCic != null)
- {
- cics = drPlnCic["cic"].ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
- }
- else if (drGpApply != null)
- {
- cics[0] = drGpApply["cic"].ToString();
- }
- dtCraftCic = _d.GetTableByXmlId("JdgPlnOrderZgS.queryCraftCicByZgProPlanId", new object[] { zgProPlanIds, cics.Length, cics });
- if (dtCraftCic.Rows.Count <= 0)
- {
- dtCraftCic = _d.GetTableByXmlId("JdgPlnOrderZgS.queryCraftCicByZgProPlanIdNew", new object[] { zgProPlanIds });
- }
- }
- //FillLkCic(drGpApply, dtCraftCic);
- _jhyElementsCtrl.SteelMakingColligateQuery(row.GetValue("stoveNo"), row.GetValue("judgeStoveNo"), dtCraftCic, "A", zgProPlanIds);
- break;
- case "低倍信息":
- _jhyPhyDbResultCtrl.ClearData();
- //drCraft = _d.GetRowByXmlId("QcmGpJugdeApplyDAL.queryCraftDesignKey", zgProPlanId, zgGxPlanNo);
- //if (drCraft == null) return;
- //designKey = drCraft["desginKey"].ToString();
- //pic = drCraft["PIC"].ToString();
- //mscPline = drCraft["mscPline"].ToString();
- string lgJudgeStoveNo = row.GetValue("judgeStoveNo");
- if (drGpApply != null && drGpApply["judgeStoveNoLg"].ToString() != "")
- {
- lgJudgeStoveNo = drGpApply["judgeStoveNoLg"].ToString();
- }
- _jhyPhyDbResultCtrl.Query(lgJudgeStoveNo);
- break;
- case "探伤信息":
- _detectFileCtrl.Query(row.GetValue("judgeStoveNo"));
- break;
- case "表检尺寸":
- _faceFileCtrl.Query(row.GetValue("judgeStoveNo"));
- break;
- }
- }
- private void FillLkCic(DataRow drGpApply, DataTable dtCraftCic)
- {
- if (drGpApply != null && drGpApply["Cic"].ToString() != "" && drGpApply["lkFlag"].ToString() == "1")
- {
- bool sameCic = false;
- foreach (DataRow drCraftCic in dtCraftCic.Rows)
- {
- if (drCraftCic["cic"].ToString() == drGpApply["cic"].ToString())
- {
- sameCic = true;
- }
- }
- if (!sameCic)
- {
- foreach (DataRow drCraftCic in dtCraftCic.Rows)
- {
- drCraftCic["cic"] = drGpApply["cic"].ToString();
- }
- }
- }
- }
- private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- if (_gpPassApplyCtrl == null || _gpPassApplyCtrl.UltraGrid1.ActiveRow == null) return;
- var row = _gpPassApplyCtrl.UltraGrid1.ActiveRow;
- DataRow drGpApply = _d.GetRowByXmlId("QcmGpJugdeApplyDAL.queryGpApplyByJudgeStoveNo", row.GetValue("jugdeApplyCode"),
- row.GetValue("jugdeApplySqe"), row.GetValue("JudgeStoveNo"));
- QueryGpJudgeApplyDown(drGpApply);
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private void labelTextBox6_TextBox_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyData == Keys.Enter)
- {
- Query();
- }
- }
- }
- }
|