| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
-
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Windows.Forms;
- using System.Windows.Forms.VisualStyles;
- using com.steering.mes.mcp.entity;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Mcp.Control.Entity;
- using Core.StlMes.Client.Mcp.Control.Machining;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinGrid;
- namespace Core.StlMes.Client.Mcp.Control
- {
- public partial class MeasureControl : MchControlBase
- {
- private List<RtdMeasurePosdataEntity> UnMatchData = new List<RtdMeasurePosdataEntity>();
- public MeasureControl()
- {
- InitializeComponent();
- EntityHelper.ShowGridCaption<MchMeasureResultEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- gx = "701310";
- Value = null;
- ValueList list = new ValueList();
- list.ValueListItems.Add(new ValueListItem("0", "否"));
- list.ValueListItems.Add(new ValueListItem("1", "是"));
- ultraGrid1.DisplayLayout.Bands[0].Columns["Flag"].ValueList = new ValueList();
- }
- protected override string ScrapCode { get { return "701510"; } }
- public void ResetM(bool ShowM)
- {
- if (ShowM)
- {
- ultraGrid1.DisplayLayout.Bands[0].Columns["ProNum"].EditorComponent = uteM;
- ultraGrid1.DisplayLayout.Bands[0].Columns["ProNum"].RowLayoutColumnInfo.PreferredCellSize =
- new System.Drawing.Size(150, 0);
- }
- else
- {
- ultraGrid1.DisplayLayout.Bands[0].Columns["ProNum"].EditorComponent = null;
- ultraGrid1.DisplayLayout.Bands[0].Columns["ProNum"].RowLayoutColumnInfo.PreferredCellSize =
- new System.Drawing.Size(50, 0);
- }
- }
- public MchMeasureResultEntity Value
- {
- get
- {
- var list =
- mchMeasureResultEntityBindingSource.DataSource as List<MchMeasureResultEntity>;
- return (list == null) || !list.Any() ? new MchMeasureResultEntity() : list.FirstOrDefault();
- }
- set
- {
- if (value == null)
- {
- mchMeasureResultEntityBindingSource.DataSource = new List<MchMeasureResultEntity>
- {
- new MchMeasureResultEntity()
- };
- ScrappedList = new List<MchBugDEntity>();
- }
- else
- {
- value.ProWt = comm.GetWeight(PortHttBatchSampleResultEntitys, gx, (int)(value.ProNum ?? 0),
- (int)(PlnZyJgxCEntity.ProCount ?? 0));
- UnMatchData = EntityHelper.GetData<RtdMeasurePosdataEntity>(
- "com.steering.mes.mcp.Mch.FrmMeasureResult.getUnmatchRtdMeasurePosdataEntity",
- new object[] { value.JudgeStoveNo, value.BatchNo, value.PlineCode }, Ob);
- if (UnMatchData.Any())
- {
- value.ProTime = UnMatchData[0].MsauerDate;
- int a = int.Parse(value.ProNum.ToString3());
- if (a > UnMatchData.Count) a = UnMatchData.Count;
- if (a == 0) a = 1;
- value.ProEndTime = UnMatchData[a-1].MsauerDate;
- }
- mchMeasureResultEntityBindingSource.DataSource = new List<MchMeasureResultEntity> { value.Clone() };
- if (_plineCode != Value.PlineCode)
- {
- Names = EntityHelper.GetData<HttSignatureEntity>(
- "com.steering.mes.mcp.heatTreatment.FrmHttCrackDetectResult.getHttSign",
- new object[] { Value.PlineCode, "9" }, Ob);
-
- name.DisplayMember = "UserName";
- name.ValueMember = "UserName";
- YdmBaseClass.SetComboItemHeight(name);
- _plineCode = Value.PlineCode;
- }
- name.DataSource = Names.Where(p => p.ColGroup == value.ProGroup).ToList();
- if (value.FailNum == 0)
- ScrappedList = new List<MchBugDEntity>();
- if (value.Flag == "0")
- {
- MeasureData= new List<MchLenWeightEntity>();
- }
-
- }
- }
- }
- public List<MchLenWeightEntity> MeasureData = new List<MchLenWeightEntity>();
- protected override void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
- base.ultraGrid1_CellChange(sender, e);
- if (e.Cell.Column.Key.Equals("ProNum"))
- {
- if (UnMatchData.Any())
- {
- e.Cell.Row.Cells["ProTime"].Value = UnMatchData[0].MsauerDate;
- int a = int.Parse( e.Cell.Row.Cells["ProNum"].Value.ToString3());
- if (a > UnMatchData.Count) a = UnMatchData.Count;
- e.Cell.Row.Cells["ProEndTime"].Value = UnMatchData[a-1].MsauerDate;
- }
- }
- }
- protected override void EditScrapped()
- {
- Value.FailNum = ScrappedList.Sum(p => p.FailNum);
- Value.FailWt = ScrappedList.Sum(p => p.FailWt);
- Value.ProNum = MeasureData.Any()
- ? (MeasureData.Sum(p => p.ActCount) - Value.FailNum)
- : (OkPort.Count(p => p.TrFlag != "1") - Value.FailNum);
- ultraGrid1.Refresh();
- }
- private void uteChangeLen_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- if (PlnZyJgxCEntity == null) return;
- if (PlnZyJgxCEntity.HeatPlanNo == null)
- return;
- if (PlnZyJgxCEntity.PlineCode == null)
- return;
- using (var matfrm = new MeasureData(MeasureData))
- {
- if (matfrm.ShowDialog() == DialogResult.OK)
- {
- MeasureData = matfrm.data;
- Value.Flag = MeasureData.Any()?"1":"0";
- Value.ProNum = MeasureData.Sum(p => p.ActCount);
- }
- ultraGrid1.PerformAction(UltraGridAction.ExitEditMode);
- ultraGrid1.UpdateData();
- }
-
- }
- private void UpdateData(MchMeasureResultEntity entity)
- {
- if (UnMatchData.Any())
- {
- entity.ProTime = UnMatchData[0].MsauerDate;
- int a = int.Parse(entity.ProNum.ToString3());
- if (a > UnMatchData.Count) a = UnMatchData.Count;
- entity.ProEndTime = UnMatchData[a].MsauerDate;
- }
- }
- }
- }
|