using System; using System.Collections.Generic; using System.Linq; using System.Text; using Mesnac.Action.Base; using Mesnac.Action.Feeding.Socket; namespace Mesnac.Action.Feeding.ProducingPlan { /// /// 初始化当班计划界面上的主机手信息 /// public class InitWorkerInfo : FeedingAction, IAction { private static bool _isFirstRun = true; //是否首次执行 /// /// 初始化当班计划界面上的主机手信息的业务入口 /// /// public void Run(RuntimeParameter runtime) { base.RunIni(runtime); if (_isFirstRun) { //首次执行时订阅,客户端刷新主机手信息的事件 StartReciveProcess.OnRefreshWorkerInfo += delegate(object sender, System.EventArgs e) { this.Run(runtime); }; _isFirstRun = false; } base.LogDebug("初始化当班计划界面上的主机手信息..."); try { List controls = this.GetTControls(); foreach (Mesnac.Controls.Base.IBaseControl baseControl in controls) { if (baseControl.MCKey == null) continue; if (baseControl.MCKey.IndexOf("UserID") > 0) { baseControl.MCValue = base.GetConfigValue("LastUserID", "0"); } if (baseControl.MCKey.IndexOf("LastUserName") > 0) { baseControl.MCValue = base.GetConfigValue("LastUserName", String.Empty); } } DbMCControl pptShiftControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "PptShift").FirstOrDefault(); DbMCControl pptClassControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "PptClass").FirstOrDefault(); DbMCControl planDateControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "[ppt_plan].[down_date]").FirstOrDefault(); if (pptShiftControl != null) { pptShiftControl.BaseControl.MCValue = PlanCommon.PlanLog.LastSelectShiftID; } if (planDateControl != null) { planDateControl.BaseControl.MCValue = PlanCommon.PlanLog.LastSelectDate; } if (pptClassControl != null) { pptClassControl.BaseControl.MCValue = PlanCommon.PlanLog.LastClassID; } } catch (Exception ex) { ICSharpCode.Core.LoggingService.Error("初始化主机手错误:" + ex.Message, ex); } } } }