| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372 |
- using System;
- using System.Collections;
- using System.Data;
- using System.Windows.Forms;
- using Core.Mes.Client.Comm.Server;
- using Core.StlMes.Client.LgClassModel;
- using CoreFS.CA06;
- namespace Core.StlMes.Client.LgCommon
- {
- public partial class ucResAdditive : UserControl
- {
- private OpeBase _ob;
- private LG_PROCESS _process;
- private string _stove;
- private string _station;
- private string _disposalTime;
- private string _userName;
- private string _shifCode;
- public ucResAdditive()
- {
- InitializeComponent();
- }
- #region 属性
- /// <summary>
- /// 有值发生变化
- /// </summary>
- public bool HasChanged
- {
- get { return toltalAdditiveChange || ucResAdditiveProcess1.Changed; }
- }
- public bool toltalAdditiveChange
- {
- get { return ucFL.HasChanged || ucHJ.HasChanged || ucWS.HasChanged || ucSTL.HasChanged; }
- }
- public bool CanSave
- {
- get { return ucResAdditiveProcess1.CanSave; }
- }
- /// <summary>
- /// 辅料TAB页可见
- /// </summary>
- public bool FL_VISIBLE
- {
- get { return ultraTabControl1.Tabs["FL"].Visible; }
- set
- {
- if (value != ultraTabControl1.Tabs["FL"].Visible)
- ultraTabControl1.Tabs["FL"].Visible = value;
- }
- }
- /// <summary>
- /// 合金TAB页可见
- /// </summary>
- public bool HJ_VISIBLE
- {
- get { return ultraTabControl1.Tabs["HJ"].Visible; }
- set
- {
- if (value != ultraTabControl1.Tabs["HJ"].Visible)
- ultraTabControl1.Tabs["HJ"].Visible = value;
- }
- }
- /// <summary>
- /// 喂丝TAB页可见
- /// </summary>
- public bool WS_VISIBLE
- {
- get { return ultraTabControl1.Tabs["WS"].Visible; }
- set
- {
- if (value != ultraTabControl1.Tabs["WS"].Visible)
- ultraTabControl1.Tabs["WS"].Visible = value;
- }
- }
- /// <summary>
- /// 手投料TAB页可见
- /// </summary>
- public bool STL_VISIBLE
- {
- get { return ultraTabControl1.Tabs["STL"].Visible; }
- set
- {
- if (value != ultraTabControl1.Tabs["STL"].Visible)
- ultraTabControl1.Tabs["STL"].Visible = value;
- }
- }
- #endregion
- #region 调用
- public void SetBase(OpeBase ob, string station,string UserName,string ShifCode, Action ac)
- {
- _ob = ob;
- ucFL.SetOpeBase(ob);
- ucHJ.SetOpeBase(ob);
- ucWS.SetOpeBase(ob);
- ucSTL.SetOpeBase(ob);
- ucResAdditiveProcess1.SetOb(ob);
- ucFL.SetHopper += () => ac();
- ucHJ.SetHopper += () => ac();
- ucWS.SetHopper += () => ac();
- ucSTL.SetHopper += () => ac();
- _userName = UserName;
- _shifCode = ShifCode;
- SetDevice_Position(station);
- }
- /// <summary>
- /// 设置工序
- /// </summary>
- /// <param name="DEVICE_POSITION"></param>
- private void SetDevice_Position(string DEVICE_POSITION)
- {
- try
- {
- ucFL.DEVICE_POSITION = DEVICE_POSITION;
- ucHJ.DEVICE_POSITION = DEVICE_POSITION;
- ucWS.DEVICE_POSITION = DEVICE_POSITION;
- ucSTL.DEVICE_POSITION = DEVICE_POSITION;
- }
- catch
- {
- }
- }
- // 设计物料名显示
- /// <summary>
- /// 设计物料名显示
- /// </summary>
- /// <param name="PROCESS"></param>
- /// <param name="DEVICE_POS"></param>
- /// <param name="tblMaterial"></param>
- /// <param name="ob"></param>
- public void SetHopperInfo(string StationCode, DataTable dtMaterial, OpeBase ob)
- {
- try
- {
- var strMsg = "";
- var bSuccess = false;
- try
- {
- SetDevice_Position(StationCode);
- var ds = ClsBusinessPack.GetHopperConfig(StationCode, out bSuccess, out strMsg, ob);
- if ((ds != null) && (ds.Tables.Count > 0))
- {
- ucFL.SetHopperInfo(ds.Tables[0], dtMaterial);
- ucHJ.SetHopperInfo(ds.Tables[0], dtMaterial);
- ucWS.SetHopperInfo(ds.Tables[0], dtMaterial);
- }
- }
- catch
- {
- }
- try
- {
- var ds = ClsBusinessPack.GetManualAdditiveConfig(StationCode, out bSuccess, out strMsg, ob);
- if ((ds != null) && (ds.Tables.Count > 0))
- ucSTL.SetHopperInfo(ds.Tables[0], dtMaterial);
- }
- catch
- {
- }
- ucResAdditiveProcess1.SetAdditiveProcess(StationCode, "01");
- }
- catch
- {
- }
- }
- public bool SaveAdditives()
- {
- if (toltalAdditiveChange)
- {
- var alMaterialCode = new ArrayList();
- var alMaterialName = new ArrayList();
- var alMaterialType = new ArrayList();
- var alAddtType = new ArrayList();
- var alAddtAmount = new ArrayList();
- var alAddtOrigin = new ArrayList();
- GetDataChanged(ref alMaterialCode, ref alMaterialName, ref alMaterialType, ref alAddtType,
- ref alAddtAmount, ref alAddtOrigin);
- var Args = new object[]
- {
- _stove, _station, "01", alMaterialCode, alMaterialName, alMaterialType, alAddtType,
- alAddtAmount,
- alAddtOrigin, _userName
- };
- var iRet = 0;
- var strMsg = "";
- try
- {
- ServerHelper.SetData("Core.LgMes.Server.LgDeviceManager.StlAdditive.SaveAdditives", Args, _ob);
- SetResAdditiveData();
- return true;
- }
- catch (Exception ex)
- {
- return false;
- }
- }
- if (ucResAdditiveProcess1.Changed)
- {
- var result = ucResAdditiveProcess1.SaveDate();
- if (result) SetResAdditiveData();
- return result;
- }
- return true;
- }
- public void SetResAdditiveData()
- {
- SetResAdditiveData(_process, _stove, _station, _disposalTime);
- }
- /// <summary>
- /// 获取并设置岗位加料汇总数据
- /// </summary>
- /// <param name="PROCESS"></param>
- /// <param name="strHeatNo"></param>
- /// <param name="strStationCode">岗位编号</param>
- /// <param name="strDisposalTime">处理次数</param>
- /// <param name="ob"></param>
- public void SetResAdditiveData(LG_PROCESS PROCESS, string strHeatNo, string strStationCode,
- string strDisposalTime)
- {
- _process = PROCESS;
- _stove = strHeatNo;
- _station = strStationCode;
- _disposalTime = strDisposalTime;
- try
- {
- var ds = ClsResAdditiveBLL.GetResAdditiveData(PROCESS, strHeatNo, strStationCode, strDisposalTime, _ob);
- var additiveBuffer = new CommonAdditive();
- ClsResAdditiveBLL.DataSetToAdditive(ref ds, ref additiveBuffer);
- ucFL.SetAdditiveData(additiveBuffer);
- ucHJ.SetAdditiveData(additiveBuffer);
- ucWS.SetAdditiveData(additiveBuffer);
- ucSTL.SetAdditiveData(additiveBuffer);
- ucResAdditiveProcess1.SetData(PROCESS, strHeatNo, strStationCode, strDisposalTime);
- }
- catch
- {
- }
- }
- /// <summary>
- /// 获取加料数据修改信息
- /// </summary>
- /// <param name="alMaterialCode">加料物料编码</param>
- /// <param name="alMaterialName">加料物料名</param>
- /// <param name="alMaterialType">加料物料类型(FL\HJ\WS)</param>
- /// <param name="alAddtType">加料类型(1:自动加料2:手投料)</param>
- /// <param name="alAddtAmount">加料量</param>
- /// <param name="alAddtOrigin">原始量</param>
- public void GetDataChanged(ref ArrayList alMaterialCode, ref ArrayList alMaterialName,
- ref ArrayList alMaterialType, ref ArrayList alAddtType, ref ArrayList alAddtAmount,
- ref ArrayList alAddtOrigin)
- {
- alMaterialCode = new ArrayList();
- alMaterialName = new ArrayList();
- alMaterialType = new ArrayList();
- alAddtType = new ArrayList();
- alAddtAmount = new ArrayList();
- alAddtOrigin = new ArrayList();
- try
- {
- if (!toltalAdditiveChange) return;
- GetDataChangedDetail(ucFL, ref alMaterialCode, ref alMaterialName, ref alMaterialType, ref alAddtType,
- ref alAddtAmount, ref alAddtOrigin);
- GetDataChangedDetail(ucHJ, ref alMaterialCode, ref alMaterialName, ref alMaterialType, ref alAddtType,
- ref alAddtAmount, ref alAddtOrigin);
- GetDataChangedDetail(ucWS, ref alMaterialCode, ref alMaterialName, ref alMaterialType, ref alAddtType,
- ref alAddtAmount, ref alAddtOrigin);
- GetDataChangedDetail(ucSTL, ref alMaterialCode, ref alMaterialName, ref alMaterialType, ref alAddtType,
- ref alAddtAmount, ref alAddtOrigin);
- }
- catch
- {
- }
- }
- /// <summary>
- /// 获取各选项卡加料数据修改信息
- /// </summary>
- /// <param name="ucHopper"></param>
- /// <param name="alMaterialCode"></param>
- /// <param name="alMaterialName"></param>
- /// <param name="alMaterialType"></param>
- /// <param name="alAddtType"></param>
- /// <param name="alAddtAmount"></param>
- /// <param name="alAddtOrigin"></param>
- private void GetDataChangedDetail(ucResAdditiveBase ucHopper, ref ArrayList alMaterialCode,
- ref ArrayList alMaterialName, ref ArrayList alMaterialType, ref ArrayList alAddtType,
- ref ArrayList alAddtAmount, ref ArrayList alAddtOrigin)
- {
- try
- {
- if (ucHopper == null) return;
- if ((alMaterialCode == null) || (alMaterialName == null) || (alMaterialType == null)) return;
- if ((alAddtType == null) || (alAddtAmount == null) || (alAddtOrigin == null)) return;
- var Keys = new ArrayList();
- if ((ucHopper.htValueChanged != null) && (ucHopper.htValueChanged.Count > 0))
- Keys = new ArrayList(ucHopper.htValueChanged.Keys);
- object ValuePre = null;
- object ValueCur = null;
- string strCode = "", strName = "", strType = "", strValueCur = "", strValuePre = "";
- var strSort = ((int) ucHopper.HpprCategory).ToString();
- for (var i = 0; i < Keys.Count; i++)
- {
- strCode = Convert.ToString(Keys[i]);
- strName = Convert.ToString(ucHopper.htCaptionChanged[strCode]);
- strType = Convert.ToString(ucHopper.htMaterialtypeChanged[strCode]);
- ValueCur = ucHopper.htValueChanged[strCode];
- ValuePre = ucHopper.htValueInitial[strCode];
- if (ValueCur == DBNull.Value) strValueCur = "";
- else strValueCur = Convert.ToString(ValueCur);
- if (ValuePre == DBNull.Value) strValuePre = "";
- else strValuePre = Convert.ToString(ValuePre);
- alMaterialCode.Add(strCode);
- alMaterialName.Add(strName);
- alMaterialType.Add(strType);
- alAddtType.Add(strSort);
- alAddtAmount.Add(strValueCur);
- alAddtOrigin.Add(strValuePre);
- }
- }
- catch
- {
- }
- }
- #endregion
- }
- }
|