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/AutoDownloadAction.cs

76 lines
2.7 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 AutoDownloadAction : ChemicalWeighingAction, IAction
{
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须要调用的
ICSharpCode.Core.LoggingService<AutoDownloadAction>.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;
//}
#region 读取应答信号
if (!(BasePlcHelper.Instance.ChemicalWeighing_PLC_LoadingStatus.NowValue.ToInt() == 1 && BasePlcHelper.Instance.ChemicalWeighing_PC_LoadingStatus.NowValue.ToInt() == 0))
{
return;
}
#endregion
string msg = String.Empty;
string planDate = DateTime.Now.ToString();
bool result = PlanHelper.DownloadPlanInfo(planDate, Global.PublicVar.Instance.globalShiftID, 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);
}
else
{
#region 记录操作日志
//base.DBLog(msg);
#endregion
MessageBox.Show(msg, Mesnac.Basic.LanguageHelper.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
}