using System; using System.Data; using System.Windows.Forms; using bizFacade; using DataLinkMesWork; using SystemFramework; namespace MesServerWork { public partial class MIS_BASE { /// /// 设备保养计划 /// /// /// /// public delegate void MachinePlan_Invoke(string OpName, string MachineType, string PlanID); /// /// 设备保养计划 /// public MachinePlan_Invoke machinePlan_Invoke; /// /// 设备保养 /// /// /// 设备保养类型 /// 工作日历流水号 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"); } } /// /// 设备保养计划Timer /// private Timer timer_Machine; /// /// 初始化设备保养计划 /// 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(); } /// /// 分钟调度 /// /// /// 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"); } } } }