| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Windows.Forms;
- using com.steering.mes.mcp.entity;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Mcp.Control.Entity;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinGrid;
- using Infragistics.Win.UltraWinTabControl;
- using Core.Mes.Client.Comm.Server;
- namespace Core.StlMes.Client.Mcp.Control.Common
- {
- public partial class CommonCrackDetection : UserControl
- {
- public CommonCrackDetection()
- {
- InitializeComponent();
- commonCrackHeadControl1.ultraGrid1.CellChange +=ultraGrid1_CellChange;
- }
- private void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
- if (e.Cell.Column.Key.Equals("ColTime") || e.Cell.Column.Key.Equals("ColEndTime"))
- {
- return;
- }
- commonCrackHeadControl1.ultraGrid1.UpdateData();
- if (e.Cell.Column.Key == "TestingNum")
- {
- var CommonCrackMainList = tbMainType.ActiveTab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- CommonCrackMainList.ForEach(
- p => p.ChangeValue(commonCrackHeadControl1.Value, HttReportDefaultEntity.Where(q => q.ReportNo == tbMainType.ActiveTab.Key).ToList()));
- }
- if (e.Cell.Column.Key == "BatchNo")
- {
- if (ChangeData != null)
- {
- ChangeData(commonCrackHeadControl1.Value);
- }
- }
- }
- private OpeBase Ob;
- private bool resetTab = false;
- private List<HttReportDefaultEntity> HttReportDefaultEntity = null;
- private string _plineCode = "";
- private DataTable _standInfo = null;
- public bool SettingMode { get; set; }
- private bool setWorkUnit;
- public Action< HttCrackDetectionEtEntity> ChangeData = null;
- public void Init(OpeBase _ob, Func<List<PortMchBatchSampleResultEntityWithCheck>> func)
- {
- Ob = _ob;
- commonCrackHeadControl1.DisableFiltering();
- var f1 = new Font("宋体", 11F, FontStyle.Bold);
- commonCrackHeadControl1.SetFont(f1);
- foreach (var ultraTab in tbMainType.Tabs)
- {
- var CommonCrackMainList = ultraTab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- CommonCrackMainList.ForEach(
- p =>
- {
- p.DisableFiltering();
- p.Ob = _ob;
- p.SetFont(f1);
- p.SetGetMatNoFunc(func);
- });
- }
- GetWorkUnit();
- }
- public string SuspiciousCode
- {
- get { return commonCrackMain1.SuspiciousCode; }
- set
- {
- /* commonCrackMain1.SuspiciousCode = value;
- commonCrackMain2.SuspiciousCode = value;
- commonCrackMain3.SuspiciousCode = value;
- commonCrackMain4.SuspiciousCode = value;
- commonCrackMain5.SuspiciousCode = value;
- commonCrackMain6.SuspiciousCode = value;
- commonCrackMain7.SuspiciousCode = value;
- commonCrackMain8.SuspiciousCode = value;
- commonCrackMain9.SuspiciousCode = value;*/
- foreach (var tab in tbMainType.Tabs)
- {
- var CommonCrackMainList = tab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- CommonCrackMainList.ForEach(
- p =>
- {
- p.SuspiciousCode = value;
- });
- }
- }
- }
- public string ScrappedCode
- {
- get { return commonCrackMain1.ScrappedCode; }
- set
- {
- /* commonCrackMain1.ScrappedCode = value;
- commonCrackMain2.ScrappedCode = value;
- commonCrackMain3.ScrappedCode = value;
- commonCrackMain4.ScrappedCode = value;
- commonCrackMain5.ScrappedCode = value;
- commonCrackMain6.ScrappedCode = value;
- commonCrackMain7.ScrappedCode = value;
- commonCrackMain8.ScrappedCode = value;
- commonCrackMain9.ScrappedCode = value;*/
- foreach (var tab in tbMainType.Tabs)
- {
- var CommonCrackMainList = tab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- CommonCrackMainList.ForEach(
- p =>
- {
- p.ScrappedCode = value;
- });
- }
-
- }
- }
- public string UnPassCode
- {
- get { return commonCrackMain1.UnPassCode; }
- set
- {
- /* commonCrackMain1.UnPassCode = value;
- commonCrackMain2.UnPassCode = value;
- commonCrackMain3.UnPassCode = value;
- commonCrackMain4.UnPassCode = value;
- commonCrackMain5.UnPassCode = value;
- commonCrackMain6.UnPassCode = value;
- commonCrackMain7.UnPassCode = value;
- commonCrackMain8.UnPassCode = value;
- commonCrackMain9.UnPassCode = value;*/
- foreach (var tab in tbMainType.Tabs)
- {
- var CommonCrackMainList = tab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- CommonCrackMainList.ForEach(
- p =>
- {
- p.UnPassCode = value;
- });
- }
- }
- }
- public string ReportType {get { return tbMainType.ActiveTab.Key; } }
- private void ChangeLine(HttCrackDetectionEtEntity data)
- {
- if (data.PlineCode== _plineCode) return;
- _plineCode = data.PlineCode;
- HttReportDefaultEntity = EntityHelper.GetData<HttReportDefaultEntity>(
- "com.steering.mes.mcp.heatTreatment.FrmReportDefault.Query",
- new object[] { _plineCode,"" }, Ob);
- List<string> keys = new List<string>(){"c"};
- if (HttReportDefaultEntity.Any())
- {
- keys = HttReportDefaultEntity.Select(p => p.ReportNo).Distinct().ToList();
- }
- resetTab = true;
- foreach (var tab in tbMainType.Tabs)
- {
- tab.Visible =keys.Contains(tab.Key);
- if (!tab.Visible) continue;
- if (data.PlineCode == "C084" || data.PlineCode == "C085") // 委外报告 管体和管端用一封报告 特殊处理
- {
-
- var CommonCrackMainList = tab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- CommonCrackMainList.ForEach(
- p =>
- {
- if(p.Type == "1") p.Type = "5";
- if (p.Type == "3") p.Type = "6";
- });
- commonCrackMain6.Type = "3";
- commonCrackMain4.Type = "3";
-
- }
- else if (data.PlineCode == "C092" && tab.Key == "12")
- {
- commonCrackMain6.Type = "7";
- }
- else if (data.PlineCode == "C092" && tab.Key == "10")
- {
- commonCrackMain4.Type = "8";
- }
- else if (data.PlineCode == "C092" && tab.Key == "0")
- {
- commonCrackMain1.Type = "8";
- }
- else
- {
- var CommonCrackMainList = tab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- CommonCrackMainList.ForEach(
- p =>
- {
- if (p.Type == "5") p.Type = "1";
- if (p.Type == "6") p.Type = "3";
- });
- commonCrackMain6.Type = "3";
- commonCrackMain4.Type = "3";
- commonCrackMain1.Type = "1";
- }
- }
- tbMainType.Tabs["c"].Visible = keys.All(p => p == "c");
- if (tbMainType.Tabs["0"].Visible || tbMainType.Tabs["1"].Visible || tbMainType.Tabs["10"].Visible || tbMainType.Tabs["15"].Visible)
- {
- commonCrackHeadControl1.ultraGrid1.DisplayLayout.Bands[0].Columns["NotchLength"].Hidden = false;
- commonCrackHeadControl1.ultraGrid1.DisplayLayout.Bands[0].Columns["NotchDepth"].Hidden = false;
- commonCrackHeadControl1.ultraGrid1.DisplayLayout.Bands[0].Columns["NotchWidth"].Hidden = false;
- }
- else
- {
- commonCrackHeadControl1.ultraGrid1.DisplayLayout.Bands[0].Columns["NotchLength"].Hidden = true;
- commonCrackHeadControl1.ultraGrid1.DisplayLayout.Bands[0].Columns["NotchDepth"].Hidden = true;
- commonCrackHeadControl1.ultraGrid1.DisplayLayout.Bands[0].Columns["NotchWidth"].Hidden = true;
- }
- resetTab = false;
-
- ResetActiveTab(data);
- }
- private void GetWorkUnit()
- {
- var dt = ServerHelper.GetData(
- "com.steering.mes.mcp.collarMaterial.ComBaseInfo.getBaseInfo",
- new object[] { "7039" }, Ob);
- List<string> vlist = new List<string>();
- foreach (DataRow row in dt.Rows)
- {
- vlist.Add(row["BASENAME"].ToString());
- }
- getWorkUnit(vlist);
- }
-
- private void ResetActiveTab(HttCrackDetectionEtEntity data)
- {
-
- var CommonCrackMainList = tbMainType.ActiveTab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- CommonCrackMainList.ForEach(
- p =>
- {
- data.ReportNo = tbMainType.ActiveTab.Key;
- p.ChangeValue(data,
- HttReportDefaultEntity.Where(q => q.ReportNo == tbMainType.ActiveTab.Key).ToList());
- // p.DefaultCraftInfo(_standInfo, ReportType);
- });
- commonCrackHeadControl1.Value = data;
- }
-
-
- public void ChangeValue(HttCrackDetectionEtEntity data)
- {
- if (data.PlineCode != _plineCode)
- {
- ChangeLine(data);
- }
- else
- {
- ResetActiveTab(data);
- }
- }
- public void SetBatchNo(List<string> BatchNo)
- {
- commonCrackHeadControl1.setBatchNo(BatchNo);
- }
- public void getWorkUnit(List<string> WorkUnit)
- {
- commonCrackHeadControl1.getWorkUnit(WorkUnit);
- }
- public void DefaultCraftInfo(DataTable Stand)
- {
- _standInfo = Stand;
- foreach (var tab in tbMainType.Tabs)
- {
- var CommonCrackMainList = tab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- CommonCrackMainList.ForEach(
- p =>
- {
- p.DefaultCraftInfo(_standInfo, "");
- });
- }
- }
- public void SetReportNumber(DataTable ReportDt)
- {
- HttReportDefaultEntity.Where(p => p.ReportColumn == "REPORT_NUMBER").ToList().ForEach(
- q =>
- {
- var data = ReportDt.AsEnumerable().Where(r => r["REPORT_NO"].ToString2() == q.ReportNo).ToList();
- string ReportNum = "001";
- if (data.Any())
- {
- ReportNum = data.First()["REPORT_NUMBER"].ToString2();
- }
- q.TextDefault = ReportNum;
- }
-
- );
- var CommonCrackMainList = tbMainType.ActiveTab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- CommonCrackMainList.ForEach(
- p =>
- {
- var data = ReportDt.AsEnumerable().Where(r => r["REPORT_NO"].ToString2() == tbMainType.ActiveTab.Key).ToList();
- string ReportNum = "001";
- if (data.Any())
- {
- ReportNum = data.First()["REPORT_NUMBER"].ToString2();
- }
- p.SetReportNumber(ReportNum);
- });
- }
- public void SettingModeValue(List<HttReportDefaultEntity> list,string PlineCode)
- {
- List<string> keys = new List<string>() { "c" };
- HttReportDefaultEntity = list;
- if ( HttReportDefaultEntity.Any())
- {
- keys = HttReportDefaultEntity.Select(p => p.ReportNo).Distinct().ToList();
- }
- resetTab = true;
- foreach (var tab in tbMainType.Tabs)
- {
- tab.Visible = keys.Contains(tab.Key);
- if (tab.Visible)
- {
- var CommonCrackMainList = tab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- CommonCrackMainList.ForEach(
- p => p.commonCrackPara1.SetValue(PlineCode, list.Where(q=> q.ReportNo == tab.Key).ToList()));
- }
- }
- tbMainType.Tabs["c"].Visible = keys.All(p => p == "c");
-
- if (tbMainType.Tabs["0"].Visible || tbMainType.Tabs["4"].Visible)
- {
- commonCrackHeadControl1.ultraGrid1.DisplayLayout.Bands[0].Columns["NotchLength"].Hidden = false;
- commonCrackHeadControl1.ultraGrid1.DisplayLayout.Bands[0].Columns["NotchDepth"].Hidden = false;
- commonCrackHeadControl1.ultraGrid1.DisplayLayout.Bands[0].Columns["NotchWidth"].Hidden = false;
- }
- else
- {
- commonCrackHeadControl1.ultraGrid1.DisplayLayout.Bands[0].Columns["NotchLength"].Hidden = true;
- commonCrackHeadControl1.ultraGrid1.DisplayLayout.Bands[0].Columns["NotchDepth"].Hidden = true;
- commonCrackHeadControl1.ultraGrid1.DisplayLayout.Bands[0].Columns["NotchWidth"].Hidden = true;
- }
- resetTab = false;
- }
- public void SetValue(string ReportNo, HttReportDefaultEntity dt, string key)
- {
-
- var CommonCrackMainList = tbMainType.Tabs[ReportNo].TabPage.Controls.OfType<CommonCrackMain>().ToList();
- CommonCrackMainList.ForEach(
- p => p.commonCrackPara1.SetValue(dt, key));
- }
-
- private void tbMainType_SelectedTabChanged(object sender, SelectedTabChangedEventArgs e)
- {
- if (resetTab) return;
- if (ChangeData != null)
- {
- ChangeData(commonCrackHeadControl1.Value);
- }
- }
- public string ActiveMchineNo()
- {
- var CommonCrackMainList = tbMainType.ActiveTab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- var data = CommonCrackMainList[0].commonCrackBodyNum1.Value;
- return data.MachineNo;
- }
- public string ActiveBatchNo()
- {
- return commonCrackHeadControl1.Value.BatchNo;
- }
- public HttCrackDetectionEtEntity GetValue()
- {
- var CommonCrackMainList = tbMainType.ActiveTab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- var data = CommonCrackMainList[0].commonCrackBodyNum1.Value;
- if (tbMainType.ActiveTab.Key != "c")
- {
- data.TestingType = tbMainType.ActiveTab.Tag.ToString2();
- data.TestingGrade = string.IsNullOrWhiteSpace(CommonCrackMainList[0].commonCrackPara1.list[0].AccpetanceLevel) || CommonCrackMainList[0].commonCrackPara1.list[0].AccpetanceLevel == "/" ? CommonCrackMainList[0].commonCrackPara1.list[0].LongitudinalExternal : CommonCrackMainList[0].commonCrackPara1.list[0].AccpetanceLevel;
- data.TestingStandard = GetStand().Any() ?
- GetStand().Select(p => p.StandardName).Aggregate((a, b) => a + (a == "" ? "" : ",") + b) : "";
- }
- data.ReportNo = tbMainType.ActiveTab.Key;
- return data;
- }
- public bool CheckNull(out string Message)
- {
- var CommonCrackMainList = tbMainType.ActiveTab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- return CommonCrackMainList[0].commonCrackPara1.CheckNull(out Message);
- }
- public HttCrackDetectionParaEntity GetPara()
- {
- var CommonCrackMainList = tbMainType.ActiveTab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- var data = CommonCrackMainList[0].commonCrackPara1.list[0];
- data.ReportNo = tbMainType.ActiveTab.Key;
- return data;
- }
- public List<HttWasteResultEntity> GetScrapListHtt()
- {
- var CommonCrackMainList = tbMainType.ActiveTab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- return CommonCrackMainList[0].commonCrackBodyNum1.ScrappedList.Select(p =>
- new HttWasteResultEntity()
- {
- BatchNo = p.BatchNo,
- DefFillCode = p.FailTypeCode,
- DefFillName = p.FailTypeName,
- DefFillNum = p.FailNum,
- DefFillWt = p.FailWt,
- MatNo = p.MatNo
- }
- ).ToList(); ;
- }
- public List<HttWasteResultEntity> GetSuspiciousListHtt()
- {
- var CommonCrackMainList = tbMainType.ActiveTab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- return CommonCrackMainList[0].commonCrackBodyNum1.SuspiciousList.Select(p =>
- new HttWasteResultEntity()
- {
- BatchNo = p.BatchNo,
- DefFillCode = p.FailTypeCode,
- DefFillName = p.FailTypeName,
- DefFillNum = p.FailNum,
- DefFillWt = p.FailWt,
- MatNo = p.MatNo
- }
- ).ToList();
- }
- public List<HttWasteResultEntity> GetUnPassListHtt()
- {
- var CommonCrackMainList = tbMainType.ActiveTab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- return CommonCrackMainList[0].commonCrackBodyNum1.UnPassList.Select(p=>
- new HttWasteResultEntity()
- {
- BatchNo = p.BatchNo,
- DefFillCode = p.FailTypeCode,
- DefFillName = p.FailTypeName,
- DefFillNum = p.FailNum,
- DefFillWt = p.FailWt,
- MatNo = p.MatNo
- }
-
- ).ToList();
- }
- public List<MchBugDEntity> GetScrapList()
- {
- var CommonCrackMainList = tbMainType.ActiveTab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- return CommonCrackMainList[0].commonCrackBodyNum1.ScrappedList;
- }
- public List<MchBugDEntity> GetSuspiciousList()
- {
- var CommonCrackMainList = tbMainType.ActiveTab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- return CommonCrackMainList[0].commonCrackBodyNum1.SuspiciousList;
- }
- public List<MchBugDEntity> GetUnPassList()
- {
- var CommonCrackMainList = tbMainType.ActiveTab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- return CommonCrackMainList[0].commonCrackBodyNum1.UnPassList;
- }
- public List<HttCrackDetectionProbeEntity> GetProbe()
- {
- var CommonCrackMainList = tbMainType.ActiveTab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- return CommonCrackMainList[0].commonCrackPara1.listProbe;
- }
- public List<HttCrackDetectionStandardEntity> GetStand()
- {
- var CommonCrackMainList = tbMainType.ActiveTab.TabPage.Controls.OfType<CommonCrackMain>().ToList();
- List<HttCrackDetectionStandardEntity> list = CommonCrackMainList[0].commonCrackPara1.listStand.ToList();
- if (!list.Any())
- {
- HttCrackDetectionParaEntity para = GetPara();
- if (para.StandardDefect != "" && para.StandardDefect != "/")
- {
- list.Add(new HttCrackDetectionStandardEntity() { StandardName = para.StandardDefect });
- }
- if (para.StandardLam != "" && para.StandardLam != "/")
- {
- list.Add(new HttCrackDetectionStandardEntity() { StandardName = para.StandardLam });
- }
- if (para.StandardOblique != "" && para.StandardOblique != "/")
- {
- list.Add(new HttCrackDetectionStandardEntity() { StandardName = para.StandardOblique });
- }
- if (para.StandardWall != "" && para.StandardWall != "/")
- {
- list.Add(new HttCrackDetectionStandardEntity() { StandardName = para.StandardWall });
- }
-
- }
- return list;
- }
- public int ContextHigh
- {
- get
- {
- return commonCrackHeadControl1.Height + 20 +
- commonCrackMain1.ContextHight;
- }
- }
- /// <summary>
- /// 设置作业单位是否可见
- /// </summary>
- public bool SetWorkUnit
- {
- get
- {
- return setWorkUnit;
- }
- set
- {
- if (value == false)
- {
- // GetWorkUnit();
- commonCrackHeadControl1.WorkUnitbool = false;
- setWorkUnit = value;
- }
- else {
- // GetWorkUnit();
- commonCrackHeadControl1.WorkUnitbool = true;
- setWorkUnit = value;
- }
- }
- }
- }
- }
|