| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466 |
- 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 System;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Net;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Judge.Forms
- {
- public partial class SteelMakingColligateQueryFrm : FrmBase
- {
- private SteelMakingColligateQueryCtrl _colligateQueryCtrl;
- private StlIncisionDtlCtrl _stlDtlCtrl;
- private QcmJhyElementsCtrl _jhyElementsCtrl;
- private QcmJhyPhyDbResultCtrl _jhyPhyDbResultCtrl;
- private FaceFileCtrl _faceFileCtrl;
- private DetectFileCtrl _detectFileCtrl;
- private Dal _d;
- public SteelMakingColligateQueryFrm()
- {
- InitializeComponent();
- _colligateQueryCtrl = new SteelMakingColligateQueryCtrl(splitContainer1.Panel1, ob);
- _colligateQueryCtrl.SteelMakingColligateQueryGrid.AfterRowActivate += colligateQueryCtrl_AfterRowActivate;
- _colligateQueryCtrl.SteelMakingColligateQueryGrid.ClickCell += colligateQueryCtrl_ClickCell;
- this.IsLoadUserView = true;
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- base.ToolBar_Click(sender, ToolbarKey);
- switch (ToolbarKey)
- {
- case "Query":
- Query();
- break;
- case "ReviewGpCertificate":
- ReviewGpCertificate();
- break;
- case "Export":
- Export();
- break;
- case "BatchDownload":
- BatchDownload();
- break;
- }
- }
- private void SteelMakingColligateQueryFrm_Load(object sender, EventArgs e)
- {
- _d = new Dal(ob);
- _colligateQueryCtrl.D.Ob = ob;
- _stlDtlCtrl = new StlIncisionDtlCtrl(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);
- JudgeBaseInfo.LoadPlineName(labelComboBox1.ComboBox, ob, false, "A");
- JudgeBaseInfo.LoadPlineName(labelComboBox5.ComboBox, ob, false, "B", "C");
- ClsBaseInfo.FillComBaseInfo(labelComboBox2.ComboBox, "407407", ob, false);
- //判定结果只显示内控合格和不合格。 40740101内控合格 40740102内控不合格
- DataTable dt = (DataTable)labelComboBox2.ComboBox.DataSource;
- DataRow dr = dt.NewRow();
- dr["BASECODE"] = "1";
- dr["BASENAME"] = "已判";
- dt.Rows.InsertAt(dr, 0);
- dr = dt.NewRow();
- dr["BASECODE"] = "0";
- dr["BASENAME"] = "未判";
- dt.Rows.InsertAt(dr, 0);
- dt.AcceptChanges();
- dt.DefaultView.RowFilter = "BASECODE NOT IN ('40740703', '40740706')";
- ClsBaseInfo.SetComboItemHeight(labelComboBox2.ComboBox);
- labelDateTimePicker1.Checked = true;
- labelDateTimePicker1.DateTimePicker.Value = DateTime.Now.Date.AddDays(-3);
- labelDateTimePicker2.DateTimePicker.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
- labelDateTimePicker3.DateTimePicker.Value = DateTime.Now.Date.AddDays(-3);
- labelDateTimePicker4.DateTimePicker.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
- for (int i = DateTime.Now.Year - 10; i <= DateTime.Now.Year + 10; i++)
- {
- ultraComboEditor1.Items.Add(i);
- }
- ultraComboEditor1.Value = DateTime.Now.Year;
- ultraComboEditor2.Value = DateTime.Now.Month.ToString().PadLeft(2, '0');
- }
- private void Export()
- {
- GridHelper.ulGridToExcel(_colligateQueryCtrl.SteelMakingColligateQueryGrid, "炼钢综合判定查询");
- }
- void colligateQueryCtrl_ClickCell(object sender, ClickCellEventArgs e)
- {
- if(e.Cell.Column.Key.Equals("chk")){
- _colligateQueryCtrl.SteelMakingColligateQueryGrid.ActiveRow.Cells["chk"].Value = !Boolean.Parse(_colligateQueryCtrl.SteelMakingColligateQueryGrid.ActiveRow.Cells["chk"].Value.ToString());
- }
- }
- void colligateQueryCtrl_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- //查询倍尺、长度、重量等信息
- var row = _colligateQueryCtrl.SteelMakingColligateQueryGrid.ActiveRow;
- DataRow craftDbCnt = _d.GetRowByXmlId("QcmJhyPhyDbResultDAL.queryJhyDbCnt", row.GetValue("judgeStoveNo"));
- if (craftDbCnt["COUNT"].ToString() == "0" && !row.GetValue("steelStandrad").Contains("PIC"))
- {
- ultraTabControl1.Tabs[1].Visible = false;
- }
- else
- {
- ultraTabControl1.Tabs[1].Visible = true;
- }
- DataRow drGpApply;
- if (row.GetValue("jugdeApplyCode") == "")
- {
- drGpApply = _d.GetRowByXmlId("QcmGpJugdeApplyDAL.queryGpApplyByJudgeStoveNo2", row.GetValue("judgeStoveNo"));
- }
- else
- {
- 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;
- }
- //查询倍尺
- if (row.GetValue("jugdeApplyCode") == "")
- {
- _stlDtlCtrl.QueryStl(row.GetValue("judgeStoveNo"));
- }
- else
- {
- _stlDtlCtrl.QueryApply(row.GetValue("jugdeApplyCode"), row.GetValue("jugdeApplySqe"), row.GetValue("judgeStoveNo"));
- }
- QueryGpJudgeApplyDown(drGpApply);
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- //private string[] GetGpJudgeApplyZgPlanId()
- //{
- // if (_colligateQueryCtrl == null) return new string[] { "", "" };
- // var row = _colligateQueryCtrl.SteelMakingColligateQueryGrid.ActiveRow;
- // if (row == null) return new string[] { "", "" };
- // DataTable dtGpApply = _d.GetTableByXmlId("QcmGpJugdeApplyDAL.getApplyPlnIdByJudgeStoveNo", row.GetValue("JudgeStoveNo"));
- // List<string> zgProPlanIds = new List<string>();
- // foreach (DataRow gpJudgeApply in dtGpApply.Rows)
- // {
- // string proPlanIdNext = gpJudgeApply["proPlanIdNext"].ToString();
- // string proPlanId = gpJudgeApply["proPlanId"].ToString();
- // if (proPlanIdNext != "" && proPlanIdNext.StartsWith("ZG"))
- // {
- // zgProPlanIds.Add(proPlanIdNext);
- // }
- // else
- // {
- // string zzProPlanId = "";
- // if (proPlanIdNext != "")
- // {
- // zzProPlanId = proPlanIdNext;
- // }
- // else
- // {
- // zzProPlanId = proPlanId;
- // }
- // DataTable dtZgProPlanIds = _d.GetTableByXmlId("JdgPlnOrderZgS.queryByGpreqId", zzProPlanId);
- // foreach (DataRow drZgProPlanId in dtZgProPlanIds.Rows)
- // {
- // zgProPlanIds.Add(drZgProPlanId["proPlanId"].ToString());
- // }
- // }
- // }
- // return zgProPlanIds.ToArray();
- //}
- private void QueryGpJudgeApplyDown(DataRow drGpApply)
- {
- if (_colligateQueryCtrl == null) return;
- var row = _colligateQueryCtrl.SteelMakingColligateQueryGrid.ActiveRow;
- if (row == null) return;
- switch (ultraTabControl1.SelectedTab.Text)
- {
- case "成分信息":
- _jhyElementsCtrl.ClearData();
- string[] zgProPlanIds;
- if (row.GetValue("jugdeApplyCode") == "")
- {
- zgProPlanIds = SteelMakingChemJudgeFrm.GetStlInsitionZgPlanId(row.GetValue("judgeStoveNo"), row.GetValue("stoveNo"), _d.Ob);
- }
- else
- {
- 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();
- }
- if (cics.Length != 0 && cics[0] == null)
- {
- break;
- }
- 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.QueryCraftResultByStoveNo(row.GetValue("stoveNo"), row.GetValue("judgeStoveNo"), dtCraftCic, "A",zgProPlanIds);
- break;
- case "低倍信息":
- _jhyPhyDbResultCtrl.ClearData();
- 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 Query()
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- string judgeStoveNo = labelTextBox4.Checked ? labelTextBox4.Text.Trim() : "";
- string judgeState = labelComboBox2.Checked ? labelComboBox2.SelecteValue.ToString2() : "";
- string orderNo = labelTextBox9.Checked ? labelTextBox9.Text.Trim() : "";
- string[] plines;
- if (labelComboBox1.ComboBox.Value == null || !labelComboBox1.Checked)
- {
- plines = new string[0];
- }
- else
- {
- plines = ((List<object>)labelComboBox1.ComboBox.Value).Select(a => a.ToString()).ToArray();
- }
- string timeB = labelDateTimePicker1.Checked ? labelDateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
- string timeE = labelDateTimePicker1.Checked ? labelDateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
- string proTimeB = labelDateTimePicker3.Checked ? labelDateTimePicker3.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
- string proTimeE = labelDateTimePicker3.Checked ? labelDateTimePicker4.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
- string chemType = ultraOptionSet2.Value.ToString2();
- string gpSource = ultraOptionSet1.Value.ToString2();
- string[] plinesGp;
- if (labelComboBox5.ComboBox.Value == null || !labelComboBox5.Checked)
- {
- plinesGp = new string[0];
- }
- else
- {
- plinesGp = ((List<object>)labelComboBox5.ComboBox.Value).Select(a => a.ToString()).ToArray();
- }
- string balYearMonth = ultraCheckEditor1.Checked ? ultraComboEditor1.Value.ToString2() + ultraComboEditor2.Value.ToString() : "";
- _colligateQueryCtrl.Query(judgeStoveNo, judgeState, plines, timeB, timeE, chemType, gpSource, plinesGp, balYearMonth, proTimeB, proTimeE, orderNo);
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private void ReviewGpCertificate()
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- var row = _colligateQueryCtrl.SteelMakingColligateQueryGrid.ActiveRow;
- if (row == null)
- {
- MessageUtil.ShowWarning("请选择一行记录!");
- return;
- }
- string judgeApplyCode = row.Cells["jugdeApplyCode"].Value.ToString();
- string judgeApplySeq = row.Cells["jugdeApplySqe"].Value.ToString();
- string judgeStoveNo = row.Cells["judgeStoveNo"].Value.ToString();
- if (judgeApplyCode == "")
- {
- MessageUtil.ShowWarning("该记录还未进行综合判定,无法查看判定书!", _colligateQueryCtrl.SteelMakingColligateQueryGrid,
- _colligateQueryCtrl.SteelMakingColligateQueryGrid.ActiveRow);
- return;
- }
- string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepGpCertificate.cpt&_bypagesize__=false" + "&JUGDE_APPLY_CODE="
- + judgeApplyCode + judgeApplySeq + "&JUDGE_STOVE_NO=" + judgeStoveNo;
- FrmOrderRepExcel fBug = new FrmOrderRepExcel(ob, strurl);
- fBug.AutoSize = true;
- fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fBug.WindowState = FormWindowState.Maximized;
- fBug.Text = "管坯判定书";
- fBug.Show();
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private void BatchDownload()
- {
- //int count = _colligateQueryCtrl.SteelMakingColligateQueryGrid.Selected.Rows.Count;
- IQueryable<UltraGridRow> ugrs = _colligateQueryCtrl.SteelMakingColligateQueryGrid.Rows.AsQueryable().Where(" CHK = 'True'");
- if (ugrs.Count() <= 0)
- {
- MessageUtil.ShowWarning("请选择您要批量下载的报告!");
- return;
- }
- if (ugrs.Count() > 50)
- {
- MessageUtil.ShowWarning("导出数量不能大于50条!");
- return;
- }
- //if (count > 50 && MessageUtil.ShowYesNoAndQuestion("是否确定添加?") == DialogResult.No)
- //{
- // return;
- //}
- WaitingForm2 wf = new WaitingForm2("系统生成PDF中....");
- List<string> pathList = new List<string>();
- foreach (UltraGridRow row in ugrs)
- {
- string judgeApplyCode = row.Cells["jugdeApplyCode"].Value.ToString();
- string judgeApplySeq = row.Cells["jugdeApplySqe"].Value.ToString();
- string judgeStoveNo = row.Cells["judgeStoveNo"].Value.ToString();
- if (judgeApplyCode == "")
- {
- wf.Close();
- MessageUtil.ShowWarning(judgeStoveNo+"该记录还未进行综合判定,无法生成判定书!");
- return;
- }
- string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepGpCertificate.cpt&bypagesize=false&format=pdf&embed=true" + "&JUGDE_APPLY_CODE="
- + judgeApplyCode + judgeApplySeq + "&JUDGE_STOVE_NO=" + judgeStoveNo;
- string savePath = "judge/PipeMaterialJudgment/A/" + judgeApplyCode + judgeApplySeq + "/";
- if (!FlileUploadcomm.CreatePdfToFtp(strurl, savePath, judgeStoveNo))
- {
- wf.Close();
- MessageUtil.ShowError("系统生成PDF失败,请稍后再试!");
- return;
- }
- pathList.Add(savePath);
- }
- wf.Close();
- dlgOrderAskDown down = new dlgOrderAskDown(this.ob, pathList);
- down.DeleteButton.Visible = false;
- down.ShowDialog();
- //打开下载后的文件夹
- if (down.Pic != "")
- System.Diagnostics.Process.Start("Explorer.exe", down.Pic);
- }
- private void labelDateTimePicker1_CheckBox_CheckedChanged(object sender, EventArgs e)
- {
- labelDateTimePicker2.DateTimeEnabled = labelDateTimePicker1.Checked;
- }
- private void labelTextBox4_TextBox_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyData == Keys.Enter)
- {
- Query();
- }
- }
- private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- if (_colligateQueryCtrl.SteelMakingColligateQueryGrid.ActiveRow == null) return;
- var row = _colligateQueryCtrl.SteelMakingColligateQueryGrid.ActiveRow;
- DataRow drGpApply = _d.GetRowByXmlId("QcmGpJugdeApplyDAL.queryGpApplyByJudgeStoveNo2", row.GetValue("judgeStoveNo"));
- QueryGpJudgeApplyDown(drGpApply);
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
- {
- ultraComboEditor1.Enabled = ultraComboEditor2.Enabled = ultraCheckEditor1.Checked;
- }
- private void labelDateTimePicker3_CheckBox_CheckedChanged(object sender, EventArgs e)
- {
- labelDateTimePicker4.DateTimeEnabled = labelDateTimePicker3.DateTimeEnabled;
- }
- }
- }
|