| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
-
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Windows.Forms;
- using Core.Mes.Client.Comm.Server;
- using Core.StlMes.Client.Mcp.Control.Entity;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinEditors;
- using Infragistics.Win.UltraWinGrid;
- namespace Core.StlMes.Client.Mcp.Control.Machining
- {
- public partial class MchControlBase : UserControl
- {
- public MchControlBase()
- {
- InitializeComponent();
- ScrappedList = new List<MchBugDEntity>();
- SuspiciousList = new List<MchBugDEntity>();
- }
- protected string _plineCode = "";
- protected List<HttSignatureEntity> Names = new List<HttSignatureEntity>();
- protected OpeBase ob;
- public OpeBase Ob
- {
- get { return ob; }
- set { ob = value; }
- }
- public void DisableFiltering()
- {
- ultraGrid1.DisplayLayout.Override.AllowRowFiltering = DefaultableBoolean.False;
- ultraGrid1.DisplayLayout.Override.HeaderClickAction = HeaderClickAction.Default;
- }
-
- 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;
- }
- if (ultraGrid1.DisplayLayout.Bands[0].Groups != null && ultraGrid1.DisplayLayout.Bands[0].Groups.Count>0)
- foreach (var group in ultraGrid1.DisplayLayout.Bands[0].Groups)
- {
- group.Header.Appearance.FontData.Bold = f1.Bold ? DefaultableBoolean.True : DefaultableBoolean.False;
- group.Header.Appearance.FontData.Name = f1.Name;
- group.Header.Appearance.FontData.SizeInPoints = f1.SizeInPoints;
- }
- }
- public List<PortMchBatchSampleResultEntity> PortHttBatchSampleResultEntitys { get; set; }
-
- public string gx { get; set; }
- protected virtual string ScrapCode
- {
- get { return "701501"; }
- }
- protected virtual string SuspiciousCode
- {
- get { return "7016"; }
- }
- /// <summary>
- /// 废品
- /// </summary>
- public List<MchBugDEntity> ScrappedList { get; protected set; }
- /// <summary>
- /// 可疑
- /// </summary>
- public List<MchBugDEntity> SuspiciousList { get; protected set; }
- private PlnZyJgxCEntity _plnZyJgxCEntity = null;
- /// <summary>
- /// 炉计划
- /// </summary>
- public PlnZyJgxCEntity PlnZyJgxCEntity { get { return _plnZyJgxCEntity; }
- set
- {
- if (ob == null) return;
- if(_plnZyJgxCEntity==null || (value!=null && _plnZyJgxCEntity.PlineCode != value.PlineCode))
- {
- DataTable ds = ServerHelper.GetData("com.steering.mes.mcp.Mch.MchComm.GetGx", new object[] { value.PlineCode }, ob);
- if (ds.Rows.Count > 0)
- {
- ProductionOrder = ds.Rows[0]["STATION_CODES"].ToString2();
- }
- else
- {
- ProductionOrder = "701301;701311";
- }
- }
- _plnZyJgxCEntity = value;
- }}
- private string ProductionOrder = "";
- public List<PortMchBatchSampleResultEntity> OkPort
- {
- get
- {
- return PortHttBatchSampleResultEntitys==null? new List<PortMchBatchSampleResultEntity>() :
- PortHttBatchSampleResultEntitys.Where(
- p =>
- ((p.MatStatus == "00") || (p.MatStatus == "合格")) || CheckGx2(p.OpProcessCode, gx)).ToList();
- }
- }
- public List<PortMchBatchSampleResultEntity> OkPort2
- {
- get
- {
- return PortHttBatchSampleResultEntitys == null ? new List<PortMchBatchSampleResultEntity>() :
- PortHttBatchSampleResultEntitys.Where(
- p =>
- ((p.MatStatus == "00") || (p.MatStatus == "合格")) || CheckGx(p.OpProcessCode, gx)).ToList();
- }
- }
- public bool CheckGx(string code1, string code2)
- {
- return ProductionOrder.IndexOf(code1, StringComparison.Ordinal) >
- ProductionOrder.IndexOf(code2, StringComparison.Ordinal);
- }
- public bool CheckGx2(string code1, string code2)
- {
- return ProductionOrder.IndexOf(code1, StringComparison.Ordinal) >=
- ProductionOrder.IndexOf(code2, StringComparison.Ordinal);
- }
- protected virtual void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
- try
- {
- ultraGrid1.UpdateData();
- if (e.Cell.Column.Key.Equals("ProTime") || e.Cell.Column.Key.Equals("ProEndTime"))
- {
- if(e.Cell.Text.Contains("_")) return;
- }
- if (e.Cell.Column.Key.Equals("ProNum"))
- {
- if ("701312" == gx)
- {
- e.Cell.Row.Cells["ProWt"].Value = comm.GetWeight1(PortHttBatchSampleResultEntitys, gx,
- int.Parse(e.Cell.Value.ToString3()),
- int.Parse(PlnZyJgxCEntity.ProCount.ToString3()));
- }
- else
- {
- e.Cell.Row.Cells["ProWt"].Value = comm.GetWeight(PortHttBatchSampleResultEntitys, gx,
- int.Parse(e.Cell.Value.ToString3()),
- int.Parse(PlnZyJgxCEntity.ProCount.ToString3()));
- }
-
- if (ultraGrid1.DisplayLayout.Bands[0].Columns.Exists("QualifiedNum"))
- {
- e.Cell.Row.Cells["QualifiedNum"].Value = e.Cell.Value;
- e.Cell.Row.Cells["QualifiedWt"].Value = e.Cell.Row.Cells["ProWt"].Value;
- }
- if (ultraGrid1.DisplayLayout.Bands[0].Columns.Exists("FinalQualifiedNum"))
- {
- e.Cell.Row.Cells["FinalQualifiedNum"].Value = e.Cell.Value;
- e.Cell.Row.Cells["FinalQualifiedWt"].Value = e.Cell.Row.Cells["ProWt"].Value;
- }
- }
- if (e.Cell.Column.Key.Equals("FinalQualifiedNum"))
- {
- e.Cell.Row.Cells["FinalQualifiedWt"].Value = comm.GetWeight(PortHttBatchSampleResultEntitys, gx,
- int.Parse(e.Cell.Value.ToString3()),
- int.Parse(PlnZyJgxCEntity.ProCount.ToString3()));
- }
- if (e.Cell.Column.Key.Equals("QualifiedNum"))
- {
- e.Cell.Row.Cells["QualifiedWt"].Value = comm.GetWeight(PortHttBatchSampleResultEntitys, gx,
- int.Parse(e.Cell.Value.ToString3()),
- int.Parse(PlnZyJgxCEntity.ProCount.ToString3()));
- }
- if (e.Cell.Column.Key.Equals("ReProNum"))
- {
- e.Cell.Row.Cells["ReProWt"].Value = comm.GetWeight(PortHttBatchSampleResultEntitys, gx,
- int.Parse(e.Cell.Value.ToString3()),
- int.Parse(PlnZyJgxCEntity.ProCount.ToString3()));
- }
- if (e.Cell.Column.Key.Equals("ProGroup") && e.Cell.Value != null)
- {
- name.DataSource = Names.Where(p => p.ColGroup == e.Cell.Value.ToString2()).ToList();
- }
- if (e.Cell.Column.Key.Equals("ProUser") && e.Cell.Value != null && e.Cell.Row.Cells.Exists("Responsible"))
- {
- var list =
- Names.Where(
- p => p.ColGroup == e.Cell.Row.Cells["ProGroup"].Value.ToString2() && p.UserName == e.Cell.Value.ToString2())
- .ToList();
- if (list.Any()) e.Cell.Row.Cells["Responsible"].Value = list[0].Responsible;
- }
- if (e.Cell.Row.Cells.Exists("FinalQualifiedNum") && e.Cell.Row.Cells.Exists("QualifiedNum") && e.Cell.Row.Cells.Exists("ReProNum"))
- {
- e.Cell.Row.Cells["FinalQualifiedNum"].Value =
- decimal.Parse(e.Cell.Row.Cells["QualifiedNum"].Value.ToString3()) +
- decimal.Parse(e.Cell.Row.Cells["ReProNum"].Value.ToString3());
-
- }
- /* if (e.Cell.Row.Cells.Exists("QualifiedNum") && e.Cell.Row.Cells.Exists("ProNum"))
- {
- e.Cell.Row.Cells["QualifiedNum"].Value =
- decimal.Parse(e.Cell.Row.Cells["ProNum"].Value.ToString3()) -
- decimal.Parse(e.Cell.Row.Cells["FailNum"].Value.ToString3());
- }*/
- ultraGrid1.Refresh();
- }
- catch (Exception ex)
- {
- }
- }
- private void uteScrapped_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- if (PlnZyJgxCEntity==null) return;
- if (PlnZyJgxCEntity.HeatPlanNo == null)
- return;
- if (PlnZyJgxCEntity.PlineCode == null)
- return;
- var matfrm = new FrmScrapMchNew(Ob, ScrappedList, PlnZyJgxCEntity.HeatPlanNo, ScrapCode, PlnZyJgxCEntity.BatchNo, PlnZyJgxCEntity.BatchGroudNo, gx == "701303"){Text = "废品原因"};
- matfrm.ShowDialog();
- if (matfrm.DialogResult == DialogResult.OK)
- {
- ScrappedList = matfrm.dataList;
- EditScrapped();
- ultraGrid1_CellChange(ultraGrid1, new CellEventArgs(ultraGrid1.ActiveCell));
- }
- // Value.DubiousNum = Value.DubiousNum ?? 0;
- ultraGrid1.PerformAction(UltraGridAction.ExitEditMode);
- ultraGrid1.UpdateData();
- }
- /// <summary>
- /// 录入废品成功后
- /// </summary>
- protected virtual void EditScrapped()
- {
- }
- private void uteSuspicious_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- if (PlnZyJgxCEntity == null) return;
- if (PlnZyJgxCEntity.HeatPlanNo == null)
- return;
- if (PlnZyJgxCEntity.PlineCode == null)
- return;
- var matfrm = new FrmScrapMchNew(Ob, SuspiciousList, PlnZyJgxCEntity.HeatPlanNo, SuspiciousCode, PlnZyJgxCEntity.BatchNo, PlnZyJgxCEntity.BatchGroudNo,false,false) { Text = "可疑原因" }; ;
- matfrm.ShowDialog();
- // Value.DubiousNum = Value.DubiousNum ?? 0;
- ultraGrid1.PerformAction(UltraGridAction.ExitEditMode);
- ultraGrid1.UpdateData();
- if (matfrm.DialogResult == DialogResult.OK)
- {
- SuspiciousList = matfrm.dataList;
- EditSuspicious();
- }
-
- ultraGrid1.PerformAction(UltraGridAction.ExitEditMode);
- ultraGrid1.UpdateData();
- }
- /// <summary>
- /// 录入可疑成功后
- /// </summary>
- protected virtual void EditSuspicious()
- {
- }
- }
- }
|