| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Linq;
- using System.Windows.Forms;
- using com.steering.mes.mcp.entity;
- using Infragistics.Win.UltraWinGrid;
- using Core.Mes.Client.Comm.Tool;
- using Core.Mes.Client.Comm.Server;
- using Core.StlMes.Client.Mcp.Control.Entity;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinEditors;
- namespace Core.StlMes.Client.Mcp.Control
- {
-
- public partial class CommonCrackBodyNum : UserControl
- {
- public CommonCrackBodyNum()
- {
-
- InitializeComponent();
- EntityHelper.ShowGridCaption<HttCrackDetectionEtEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- ScrappedList = new DataSourceList<MchBugDEntity>();
- SuspiciousList = new DataSourceList<MchBugDEntity>();
- }
- public OpeBase Ob { get; set; }
- public Func<List<PortMchBatchSampleResultEntityWithCheck>> GetMatNo = null;
- public Action EditSuspicious = null;
- public Action EditScrap = null;
- public Action EditUnpass = null;
- public string SuspiciousCode { get; set; }
- public string ScrappedCode { get; set; }
- public string UnPassCode { get; set; }
- public void SetFont(Font f1)
- {
- ultraGrid1.Font = f1;
- foreach (UltraGridColumn UltraGridColumn in ultraGrid1.DisplayLayout.Bands[0].Columns)
- {
- UltraGridColumn.Header.Appearance.FontData.Bold = f1.Bold ? DefaultableBoolean.True : DefaultableBoolean.False;
- UltraGridColumn.Header.Appearance.FontData.Name = f1.Name;
- UltraGridColumn.Header.Appearance.FontData.SizeInPoints = f1.SizeInPoints;
- }
- }
- public string gx { get; set; }
- /// <summary>
- /// 废品
- /// </summary>
- public List<MchBugDEntity> ScrappedList { get; set; }
- /// <summary>
- /// 可疑
- /// </summary>
- public List<MchBugDEntity> SuspiciousList { get; set; }
- /// <summary>
- /// 不合
- /// </summary>
- public List<MchBugDEntity> UnPassList { get; set; }
-
- public HttCrackDetectionEtEntity Value
- {
- get
- {
- var list =
- httCrackDetectionEtEntityBindingSource.DataSource as List<HttCrackDetectionEtEntity>;
- return (list == null) || !list.Any() ? new HttCrackDetectionEtEntity() : list.FirstOrDefault();
- }
- set
- {
- if (value == null)
- {
- httCrackDetectionEtEntityBindingSource.DataSource = new List<HttCrackDetectionEtEntity>
- {
- new HttCrackDetectionEtEntity()
- };
- ScrappedList = new List<MchBugDEntity>();
- SuspiciousList = new List<MchBugDEntity>();
- UnPassList = new List<MchBugDEntity>();
- }
- else
- {
- httCrackDetectionEtEntityBindingSource.DataSource = new List<HttCrackDetectionEtEntity> { value};
- if ((Ob == null) || (Ob.MainUrl == "")) return;
- if ((value.EwasteNum ?? 0) + (value.RejectNum ?? 0) + (value.EwasteNumEt ?? 0) <=0)
- {
- ScrappedList = new List<MchBugDEntity>();
- value.EwasteReason = "/";
- }
- if (value.DubiousNum == null || value.DubiousNum == 0)
- {
- SuspiciousList = new List<MchBugDEntity>();
- value.FtestingReason = "/";
- }
- if (value.DisqualifiedNum == null || value.DisqualifiedNum == 0)
- {
- UnPassList = new List<MchBugDEntity>();
- value.DisqualifiedReason = "/";
-
- }
-
- }
- ultraGrid1.Refresh();
- }
- }
- public void SetMachine(List<string> MachineNos)
- {
- uceMachineNo.DataSource = MachineNos;
- if (MachineNos == null || MachineNos.Count <= 1)
- {
- ultraGrid1.DisplayLayout.Bands[0].Columns["MachineNo"].Hidden = true;
- }
- else
- {
- ultraGrid1.DisplayLayout.Bands[0].Columns["MachineNo"].Hidden = false;
- }
- ultraGrid1.Refresh();
- }
- public void DisableFiltering()
- {
- ultraGrid1.DisplayLayout.Override.AllowRowFiltering = DefaultableBoolean.False;
- foreach (var ugc in ultraGrid1.DisplayLayout.Bands[0].Columns)
- ugc.SortIndicator = SortIndicator.Disabled;
- }
- private void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
-
- }
-
- private void uteSuspicious_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- if(GetMatNo==null) return;
- var matfrm = new CommonScrap(Ob, SuspiciousList, GetMatNo, SuspiciousCode, Value.BatchNo, false,false) { Text = "可疑原因" }; ;
- matfrm.ShowDialog();
- ultraGrid1.PerformAction(UltraGridAction.ExitEditMode);
- ultraGrid1.UpdateData();
- if (matfrm.DialogResult == DialogResult.OK)
- {
- SuspiciousList = matfrm.dataList;
- if (EditSuspicious != null) EditSuspicious();
- }
- ultraGrid1.PerformAction(UltraGridAction.ExitEditMode);
- ultraGrid1.UpdateData();
- }
- private void uteUnPass_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- if (GetMatNo == null) return;
- var matfrm = new CommonScrap(Ob, UnPassList, GetMatNo, UnPassCode, Value.BatchNo, false, false) { Text = "不合原因" }; ;
- matfrm.ShowDialog();
- ultraGrid1.PerformAction(UltraGridAction.ExitEditMode);
- ultraGrid1.UpdateData();
- if (matfrm.DialogResult == DialogResult.OK)
- {
- UnPassList = matfrm.dataList;
- if (EditUnpass != null) EditUnpass();
- }
- ultraGrid1.PerformAction(UltraGridAction.ExitEditMode);
- ultraGrid1.UpdateData();
- }
- private void uteScrapped_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- if (GetMatNo == null) return;
- var matfrm = new CommonScrap(Ob, ScrappedList, GetMatNo, ScrappedCode, Value.BatchNo, false, true) { Text = "废品原因" }; ;
- matfrm.ShowDialog();
- ultraGrid1.PerformAction(UltraGridAction.ExitEditMode);
- ultraGrid1.UpdateData();
- if (matfrm.DialogResult == DialogResult.OK)
- {
- ScrappedList = matfrm.dataList;
- if (EditScrap != null) EditScrap();
- }
- ultraGrid1.PerformAction(UltraGridAction.ExitEditMode);
- ultraGrid1.UpdateData();
- }
-
- }
-
- }
|