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.

102 lines
3.2 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using Mesnac.Action.Base;
using Mesnac.Action.ChemicalWeighing.DBHelper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
/**
* 产前检测
* */
namespace Mesnac.Action.ChemicalWeighing.Product.XlPlan
{
public class XlCheckAction : ChemicalWeighingAction, IAction
{
#region 字段定义
private RuntimeParameter _runtime;
private DbMCControl _clientGridControl = null; //网格计划控件
#endregion
#region IAction接口实现
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须要调用的
this._runtime = runtime;
ICSharpCode.Core.LoggingService<RefreshAction>.Debug("产前检测—刷新业务...");
DbMCControl clientGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "xl_plan").FirstOrDefault(); //获取本机台计划控件
if (clientGridControl == null || !(clientGridControl.BaseControl is DataGridView))
{
ICSharpCode.Core.LoggingService<RefreshAction>.Error("{当班计划—刷新计划}缺少本机台计划网格控件...");
return;
}
this._clientGridControl = clientGridControl;
this.DoWork();
}
#endregion
#region 方法定义
/// <summary>
/// 刷新计划
/// </summary>
protected void DoWork()
{
#region 业务实现
string equipCode = base.CurrEquipCode; //当前机台
IFreeSql fsql = FreeHelper.Instance;
string sql = @"SELECT Plan_Serial,Recipe_ID,Recipe_Name,Equip_Code,Version,Plan_Id,Plan_Num,Real_Num,Plan_State,Plan_StateText,Start_Date,End_Date,Plan_Date,IsPrenatalTest FROM xl_plan
where IsPrenatalTest=1";
DataTable table = fsql.Select<object>().WithSql(sql).ToDataTable("*");
lock (String.Empty)
{
//本地计划
if (this._clientGridControl != null && this._clientGridControl.BaseControl != null)
{
this._clientGridControl.BaseControl.BindDataSource = null;
this._clientGridControl.BaseControl.BindDataSource = table;
#region 根据计划状态处理背景色
DataGridView clientGrid = this._clientGridControl.BaseControl as DataGridView;
PlanHelper.SetBackColor(clientGrid);
#endregion
}
else
{
ICSharpCode.Core.LoggingService<RefreshAction>.Warn("刷新产前检测计划失败本地控件为Null...");
}
}
#endregion
}
#endregion
#region 事件处理方法
private void Process_Event(object sender, EventArgs e)
{
if (sender is RuntimeParameter)
{
this.Run(sender as RuntimeParameter);
}
else
{
this.Run(this._runtime);
}
}
#endregion
}
}