You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lj_plc/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/DownloadAction.cs

82 lines
2.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data;
using ICSharpCode.Core;
using Mesnac.Controls.Base;
using Mesnac.Action.Base;
using Mesnac.Codd.Session;
using Mesnac.Action.ChemicalWeighing.Entity;
namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
{
/// <summary>
/// 手动下传计划列表
/// </summary>
public class DownloadAction : ChemicalWeighingAction, IAction
{
#region 事件定义
/// <summary>
/// 添加计划事件定义
/// </summary>
public static event EventHandler DownloadPlan;
#endregion
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须要调用的
ICSharpCode.Core.LoggingService<DownloadAction>.Debug("手动下传计划列表业务...");
DbMCControl planDateControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "[RT_plan].[Plan_Date]").FirstOrDefault();
DbMCControl pptShiftControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Pmt_Shiftime").FirstOrDefault();
if (planDateControl == null)
{
ICSharpCode.Core.LoggingService<RefreshAction>.Error("{当班计划-手动下传计划列表} 缺少日期选择控件...");
return;
}
if (pptShiftControl == null)
{
ICSharpCode.Core.LoggingService<RefreshAction>.Error("{当班计划-手动下传计划列表} 缺少班次组合框控件...");
return;
}
string msg = String.Empty;
bool result = PlanHelper.DownloadPlanInfo(planDateControl.BaseControl.MCValue.ToString(), Convert.ToInt32(pptShiftControl.BaseControl.MCValue), out msg);
if (result)
{
msg = StringParser.Parse(ResourceService.GetString("Mesnac_Dialog_Msg_Success")); //执行成功!
#region 记录操作日志
//base.DBLog(msg);
#endregion
MessageBox.Show(msg, Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
#region 触发事件
if (DownloadPlan != null)
{
DownloadPlan(runtime.BaseControl.MCRoot, System.EventArgs.Empty);
}
#endregion
}
else
{
#region 记录操作日志
//base.DBLog(msg);
#endregion
MessageBox.Show(msg, Mesnac.Basic.LanguageHelper.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
}