| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Linq;
- using System.Windows.Forms;
- using Core.Mes.Client.Comm.Server;
- using Core.StlMes.Client.LgClassModel;
- using Core.StlMes.Client.LgCommon;
- using CoreFS.CA06;
- using CoreFS.SA06;
- namespace Core.StlMes.Client.LgResMgt
- {
- public partial class NewResultsBase : FrmBase
- {
- private DataTable _materialData = null;
- protected List<string> Plines;
- protected string CurrentPline;
- public string uceStatusText
- {
- get { return ucStoveQuery1.uceStatusText; }
- set { ucStoveQuery1.uceStatusText = value; }
- }
- protected DataTable DtMaterial {
- get
- {
- if (_materialData == null || _materialData.Rows.Count <= 0)
- {
- GetMaterialData();
- }
- return _materialData;
- }
- set { _materialData = value; }
- }
- protected PlnSteelforfurnaceEntity CurrentEntity = null;
- protected string Station
- {
- get { return Process + (CurrentPline=="C001"?"01": (CurrentPline=="C003"?"02":(CurrentPline=="C006"?"03":"00"))); }
- }
- private int Width1 = 300;
- public int Width2 = 340;
- public int Width3 = 168;
- public NewResultsBase()
- {
- InitializeComponent();
- }
-
- public bool OrderByPline
- {
- get { return ucStoveQuery1.OrderByPline; }
- set
- {
- ucStoveQuery1.OrderByPline = value;
- }
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- try
- {
- if (ob==null) return;
- Plines = ClsBusinessPack.InitDropPlinePower(OrderByPline?"A":"B", null, this.ValidDataPurviewIds, this.ob);
- if (Plines == null || Plines.Count <= 0)
- {
- MessageBox.Show(@"无产线数据权限");
- this.Close();
- }
- else
- {
- CurrentPline = Plines[0];
- }
- ucStoveQuery1.GetStoveResultDelegate += GetHeatResult;
- ucStoveQuery1.Init(ob, Plines, Process);
- ucStoveQuery1.GiveUp = GiveupResult;
- ClsControlPack.SetUltraGridAppearance(this);
- }
- catch
- {
- }
- }
- /// <summary>
- /// 工序
- /// </summary>
- protected LG_PROCESS Process { get; set; }
- protected string DeviceName { get; set; } //岗位中文名:如转炉
-
- // 获取物料基础数据
- /// <summary>
- /// 获取物料基础数据
- /// </summary>
- protected void GetMaterialData()
- {
- bool bSuccess;
- string strMsg;
- var ds = ClsDataAccessPack.GetMaterialData(out bSuccess, out strMsg, ob);
- if (bSuccess) _materialData = ds.Tables[0];
- }
- protected void RefreStoveQuery()
- {
- ucStoveQuery1.QueryStovePlan();
- }
- protected virtual void Queryother()
- {
- }
- // 获取指定炉次岗位实绩信息
- /// <summary>
- /// 获取指定炉次岗位实绩信息
- /// </summary>
- /// <param name="strHeatProcessNo"></param>
- /// <param name="strHeatNo"></param>
- /// <param name="strStationCode"></param>
- /// <param name="strDisposalTime"></param>
- /// <param name="strCastNo"></param>
- protected void GetHeatResult(PlnSteelforfurnaceEntity PlnSteelforfurnaceEntity,bool refresh)
- {
- CurrentEntity = PlnSteelforfurnaceEntity;
- if (refresh)
- {
- QueryPlan();
- ucNewChemelEment.RefreshData(CurrentEntity.StoveNo, CurrentEntity.EfPlineCode, Process, CurrentEntity.CraftNo, ob);
- }
- else
- {
- Query();
- }
- }
- // 忽略实绩修改
- /// <summary>
- /// 忽略实绩修改
- /// </summary>
- /// <returns></returns>
- protected bool GiveupResult()
- {
- if (ValueChanged && CurrentEntity!=null)
- if (
- MessageBox.Show(@"炉次:" + CurrentEntity.StoveNo + @"\n" + DeviceName + @"实绩已修改,还未保存!\n放弃修改点击【是】,返回请按【否】", @"提示",
- MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- return false;
- return true;
- }
- #region 属性
- /// <summary>
- /// 实绩数据发生修改
- /// </summary>
- protected virtual bool ValueChanged
- {
- get { return false; }
- }
- protected virtual bool DataOver
- {
- get { return false; }
- }
- protected virtual bool CanSave
- {
- get { return true; }
- }
- /// <summary>
- /// 用户名
- /// </summary>
- protected string UserName
- {
- get { return CoreUserInfo.UserInfo.GetUserName(); }
- }
- /// <summary>
- /// 用户名
- /// </summary>
- protected string ShifCode
- {
- get { return UserInfo.GetUserGroup() + UserInfo.GetUserOrder(); }
- }
- #endregion
- #region 工具栏事件
- // 刷新实绩
- /// <summary>
- /// 刷新实绩
- /// </summary>
- /// <param name="ignoreChanges"></param>
- protected void RefreshData(bool ignoreChanges)
- {
- try
- {
- if (!ignoreChanges)
- {
- if (!GiveupResult()) return;
- }
- Query();
- }
- catch
- {
- }
- }
- // 保存实绩修改
- /// <summary>
- /// 保存实绩修改
- /// </summary>
- protected void SaveData()
- {
- // if (string.IsNullOrEmpty(HeatProcessNo)) return;
- if (CurrentEntity == null) return;
- if (!ValueChanged)
- {
- MessageBox.Show("炉次:" + CurrentEntity.StoveNo + "\n" + DeviceName + "实绩未发生变化,无需保存!", "提示");
- return;
- }
- if (!CanSave)
- {
- MessageBox.Show("数据有错误,请修正后再保存!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- if (
- MessageBox.Show("确定要修改炉次[" + CurrentEntity.StoveNo + "]信息吗?", "提示", MessageBoxButtons.YesNo,
- MessageBoxIcon.Question) == DialogResult.No)
- return;
- string Msg = "";
- Msg = SaveAllData(Msg);
- RefreStoveQuery();
- if (Msg == "")
- {
- if (DataOver)
- {
- if (MessageBox.Show("炉次:" + CurrentEntity.StoveNo + "信息保存成功,是否跳入下个未维护信息的炉号!", "提示", MessageBoxButtons.YesNo,
- MessageBoxIcon.Question) == DialogResult.Yes)
- {
- ucStoveQuery1.GoNext();
- }
- }
- else
- //RefreshData(true);
- MessageBox.Show("炉次:" + CurrentEntity.StoveNo + "信息保存成功!", "提示", MessageBoxButtons.OK,
- MessageBoxIcon.Asterisk);
-
- }
- else
- {
- MessageBox.Show("炉次:" + CurrentEntity.StoveNo + Msg + "!", "提示", MessageBoxButtons.OK,
- MessageBoxIcon.Asterisk);
- }
- }
- protected virtual string SaveAllData(string Msg)
- {
- if (!SavePerformance()) Msg = Msg + "操作界面数据保存失败";
- return Msg;
- }
- protected virtual bool SavePerformance()
- {
- return false;
- }
- protected virtual void Query()
- {
- QueryPlan();
- QueryChemeEment();
-
- if (CurrentEntity.EfPlineCode != CurrentPline)
- {
- RestPline();
- }
- QueryOperation();
- QueryTemperature();
- Queryother();
- }
- protected virtual void QueryTemperature()
- {
-
- }
- /// <summary>
- /// 查询炒作界面
- /// </summary>
- protected virtual void QueryOperation()
- {
- }
- protected virtual void QueryPlan()
- {
-
- }
- protected virtual void RestPline()
- {
- CurrentPline = CurrentEntity.EfPlineCode;
- }
- private void QueryChemeEment()
- {
- ucNewChemelEment.SetData(CurrentEntity.StoveNo, CurrentEntity.EfPlineCode, Process, CurrentEntity.CraftNo, ob);
- }
- protected override void OnClosing(CancelEventArgs e)
- {
- base.OnClosing(e);
- try
- {
- if (!GiveupResult())
- e.Cancel = true;
- }
- catch
- {
- // ignored
- }
- }
- /// <summary>
- /// 功能按钮
- /// </summary>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Refresh":
- RefreshData(!ValueChanged);
- break;
- case "Save":
- SaveData();
- break;
- case "Exit":
- Close();
- break;
- }
- }
- #endregion
- private void NewResultsBase_Shown(object sender, EventArgs e)
- {
- splitContainer1.SplitterDistance = Width1;
- spMain.SplitterDistance = spMain.Size.Height - Width3;
- if(splitContainer2.Panel2Collapsed) return;
- MainContainer.ExpandedStateChanging+=MainContainer_ExpandedStateChanged;
- MicContainer.ExpandedStateChanging += MicContainer_ExpandedStateChanged;
- egpChem.ExpandedStateChanging += egpChem_ExpandedStateChanged;
- if (Size.Width > 1300)
- {
- MicContainer.Expanded = true;
- splitContainer1.SplitterDistance = Size.Width - 700 - Width2 > Width1
- ? Width1
- : Size.Width - 700 - Width2;
- }
- else
- {
- MicContainer.Expanded = false;
- splitContainer2.SplitterDistance = splitContainer2.Size.Width - 25;
- }
- }
- private void MainContainer_ExpandedStateChanged(object sender, EventArgs e)
- {
- if (!MainContainer.Expanded)
- {
- splitContainer1.SplitterDistance = Width1;
- if (MicContainer.Expanded && !splitContainer2.Panel2Collapsed)
- {
- splitContainer2.SplitterDistance = splitContainer2.Size.Width - Width2;
- }
- }
- else
- {
- Width1 = splitContainer1.SplitterDistance;
- splitContainer1.SplitterDistance = 25;
- if (MicContainer.Expanded && !splitContainer2.Panel2Collapsed)
- {
- splitContainer2.SplitterDistance = splitContainer2.Size.Width - Width2;
- }
- }
- }
- private void MicContainer_ExpandedStateChanged(object sender, EventArgs e)
- {
- if (splitContainer2.Panel2Collapsed) return;
- if (!MicContainer.Expanded)
- {
- splitContainer2.SplitterDistance = splitContainer2.Size.Width - Width2;
- /* if (MainContainer.Expanded)
- {
- splitContainer1.SplitterDistance = Width1;
- }*/
- }
- else
- {
- Width2 = splitContainer2.Panel2.Size.Width;
- splitContainer2.SplitterDistance = splitContainer2.Size.Width - 25;
- }
- }
- private void egpChem_ExpandedStateChanged(object sender, EventArgs e)
- {
- if (spMain.Panel2Collapsed) return;
- if (!egpChem.Expanded)
- {
- spMain.SplitterDistance = spMain.Size.Height - Width3;
- }
- else
- {
- Width3 = spMain.Panel2.Size.Height;
- spMain.SplitterDistance = spMain.Size.Height - 25;
- }
- }
- }
- }
|