|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 初始化当班计划界面上的主机手信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class InitWorkerInfo : FeedingAction, IAction
|
|
|
|
|
{
|
|
|
|
|
private static bool _isFirstRun = true; //是否首次执行
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 初始化当班计划界面上的主机手信息的业务入口
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="runtime"></param>
|
|
|
|
|
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<Mesnac.Controls.Base.IBaseControl> controls = this.GetTControls<Mesnac.Controls.Base.IBaseControl>();
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|