99 lines
3.5 KiB
C#
99 lines
3.5 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Windows.Forms;
|
|
//using bizFacade;
|
|
//using DataLinkMesWork;
|
|
//using SystemFramework;
|
|
|
|
namespace MesServerWork
|
|
{
|
|
public partial class MIS_BASE
|
|
{
|
|
/// <summary>
|
|
/// 设备保养计划
|
|
/// </summary>
|
|
/// <param name="OpName"></param>
|
|
/// <param name="MachineType"></param>
|
|
/// <param name="PlanID"></param>
|
|
public delegate void MachinePlan_Invoke(string OpName, string MachineType, string PlanID);
|
|
/// <summary>
|
|
/// 设备保养计划
|
|
/// </summary>
|
|
public MachinePlan_Invoke machinePlan_Invoke;
|
|
/// <summary>
|
|
/// 设备保养
|
|
/// </summary>
|
|
/// <param name="OpName"></param>
|
|
/// <param name="MachineType">设备保养类型</param>
|
|
/// <param name="PlanID">工作日历流水号</param>
|
|
public void MachinePlan(string OpName, string MachineType, string PlanID)
|
|
{
|
|
try
|
|
{
|
|
string SendMessage;
|
|
SendMessage = "MES|MachinePlan|" + OpName + "|" + MachineType + "&" + PlanID;
|
|
asyncSendMessage(SendMessage);
|
|
}
|
|
catch (Exception err)
|
|
{
|
|
////ApplicationLog.WriteLog(err, "MachinePlan");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设备保养计划Timer
|
|
/// </summary>
|
|
private Timer timer_Machine;
|
|
/// <summary>
|
|
/// 初始化设备保养计划
|
|
/// </summary>
|
|
public void InitMachinePlan(MachinePlan_Invoke machinePlan_Invoke)
|
|
{
|
|
this.machinePlan_Invoke = machinePlan_Invoke;
|
|
timer_Machine = new Timer();
|
|
timer_Machine.Interval = 60000;//每隔一分钟查询一次
|
|
timer_Machine.Tick += new EventHandler(timer_Machine_Tick);
|
|
timer_Machine.Start();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分钟调度
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void timer_Machine_Tick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
//if (ApplicationConfig.Is_MachinePlan == 1)
|
|
//{
|
|
// DataTable dt;
|
|
// string opName;
|
|
// string machineType;//保养类型代码
|
|
// string planID;//工作日历流水号
|
|
// BaseDataSystemMES.MachinePlan_Select(out dt);
|
|
// if (dt != null)
|
|
// {
|
|
// if (dt.Rows.Count > 0)
|
|
// {
|
|
// for (int i = 0; i < dt.Rows.Count; i++)
|
|
// {
|
|
// opName = dt.Rows[i]["工位号"].ToString();
|
|
// machineType = dt.Rows[i]["保养类型代码"].ToString();
|
|
// planID = dt.Rows[i]["工作日历流水号"].ToString();
|
|
// BaseDataSystemMES.Rolling_news_Add(opName, opName + "工位有设备保养计划,请相关人员进行保养!!!");
|
|
// BeginInvoke(machinePlan_Invoke, new object[] { opName, machineType, planID });
|
|
// }
|
|
// }
|
|
// }
|
|
//}
|
|
}
|
|
catch (Exception err)
|
|
{
|
|
////ApplicationLog.WriteLog(err, "timer_Machine_Tick");
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|