using System; using SystemFramework; using OpcData; namespace MesServerWork { public partial class MIS_BASE { /// /// /// /// public delegate void DemoHandler(object sender, CustomeEvetnArgs e); /// /// /// public static event DemoHandler OPCTagDataDemo; /// /// 根据tagType,工位号写入PLC对应值 /// /// /// static private void Write_TagValueByTagTypeName(string cmd, string opName,object tagValue) { int tagTypeID = 0; string msg; try { tagTypeID = Convert.ToInt32(MesDataFunction.OpcOperation.hashtable_TagType[cmd]); MesDataFunction.OpcOperation.WriteTagValue(tagTypeID, opName, tagValue); } catch (Exception err) { ApplicationLog.WriteLog(err, "Write_TagValueByTagTypeName_FUNC"); } } /// /// 根据TagTypeID,工位号写入PLC对应值 /// /// /// static private void Write_TagValueByTagTypeID(int tagTypeID, string opName, object tagValue) { string msg; object tagValueOb; object newTagValue= tagValue; try { MesDataFunction.OpcOperation.WriteTagValue(tagTypeID, opName, tagValue); } catch (Exception err) { ApplicationLog.WriteLog(err, "Write_TagValueByTagTypeID_FUNC"); } } /// /// 通过TagID写入PLC数据 /// /// /// static private void Write_TagValueByTagID(string TagID, object tagValue) { string msg; //tagValue = "0"; try { MesDataFunction.OpcOperation.WritePLC(TagID, tagValue); } catch (Exception err) { ApplicationLog.WriteLog(err, "Write_TagValueByTagID_FUNC"); } } public static void Write_TagTypeID(int tagTypeID, string opName, object tagValue) { Write_TagValueByTagTypeID(tagTypeID, opName, tagValue); } public static void Write_TagID(string TagID, object tagValue) { Write_TagValueByTagID(TagID, tagValue); } /// /// 清空MES信号 MES传递机型(5) 允许工作(66) 合格放行(51) 不合格放行(8) 拧紧结束(67) 工作完成(7) 保存完成(20) 加工时间保存完成(54) 匹配完成(68) 默认false /// /// /// public static void Write_ClearMesMoby(string opName) { MIS_BASE.Write_EngineTypeGetOver_MES(opName, false); MIS_BASE.Write_FixAllow(opName, false); MIS_BASE.Write_ConfirmOkGo(opName, false); MIS_BASE.Write_FalseGO(opName, false); MIS_BASE.Write_FixOver(opName, false); MIS_BASE.Write_MaterialVerifyOver(opName, false); MIS_BASE.Write_MesReadOver(opName, false); MIS_BASE.Write_MachineTime_ReadOver(opName, false); MIS_BASE.Write_MatchingCompleted(opName, false); } /// /// 各个工位返修状态(4) /// /// /// public static void Write_RepairPathString(string opName, string tagValue) { string cmd = "RepairPathString"; Write_TagValueByTagTypeName(cmd, opName, tagValue); } /// /// MES保存完数据(必须MIS)(X102.2)(20) /// /// /// public static void Write_MesReadOver(string opName, bool tagValue) { string cmd = "MesReadOver"; Write_TagValueByTagTypeName(cmd, opName, tagValue); } /// /// 加工时间保存完数据 DBX102.1 (54) /// /// /// public static void Write_MachineTime_ReadOver(string opName, bool tagValue) { string cmd = "MachineTime_ReadOver"; Write_TagValueByTagTypeName(cmd, opName, tagValue); } /// /// 工位三种状态:在线、离线、屏蔽(0,1,2)(DBB116)(79) /// /// /// public static void Write_OnLineState(string opName, int tagValue) { string cmd = "OnLineState"; Write_TagValueByTagTypeName(cmd, opName,Convert .ToInt16 ( tagValue)); } /// /// 托盘编号(PLC)(80) /// /// /// public static void Write_PalletCode(string opName, int tagValue) { string cmd = "PartPalletCode"; Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue)); } /// /// MES向PLC传递机型(5) /// /// /// public static void Write_EngineTypeGetOver_MES(string opName, bool tagValue) { string cmd = "EngineTypeGetOverMES"; Write_TagValueByTagTypeName(cmd, opName, tagValue); } /// /// 工作完成(7) /// /// /// public static void Write_MaterialVerifyOver(string opName, bool tagValue) { string cmd = "MaterialVerifyOver"; Write_TagValueByTagTypeName(cmd, opName, tagValue); } /// /// 合格方式放行(51) /// /// /// public static void Write_ConfirmOkGo(string opName, bool tagValue) { string cmd = "ConfirmOkGo"; Write_TagValueByTagTypeName(cmd, opName, tagValue); } /// /// 允许拧紧(66) /// /// /// public static void Write_FixAllow(string opName, bool tagValue) { string cmd = "FixAllow"; Write_TagValueByTagTypeName(cmd, opName, tagValue); } /// /// 拧紧结束(67) /// /// /// public static void Write_FixOver(string opName, bool tagValue) { string cmd = "FixOver"; Write_TagValueByTagTypeName(cmd, opName, tagValue); } /// ///返修上线,在上线工位,MES依据工件情况,设定为返修件,PLC见到MES设定为1后,将返修标志写入到DBX0.2为1 ///MES设定完返修返修上线后,MES清空该信号 ///DBX3.7(72) /// /// /// public static void Write_RepairUpline_MES(string opName, bool tagValue) { string cmd = "RepairUplineMES"; Write_TagValueByTagTypeName(cmd, opName, tagValue); } /// /// 匹配完成(68) /// /// /// public static void Write_MatchingCompleted(string opName, bool tagValue) { string cmd = "MatchingCompleted"; Write_TagValueByTagTypeName(cmd, opName, tagValue); } /// /// 不合格放行(8) /// /// /// public static void Write_FalseGO(string opName, bool tagValue) { string cmd = "FalseGo"; Write_TagValueByTagTypeName(cmd, opName, tagValue); } /// /// 匹配结果(69) /// /// /// public static void Write_Match(string opName, bool tagValue) { string cmd = "Match"; Write_TagValueByTagTypeName(cmd, opName, tagValue); } /// /// 变量类型代码=73,机型代码。DBB404~405 机型标志 /// /// /// public static void Write_EngineTypeID_MES(string opName, int tagValue) { string cmd = "EngineTypeID_MES"; Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue)); } /// /// 变量类型代码=74,零件编号。DBB406~445 发动机编号 /// /// /// public static void Write_EngineID_MES(string opName, string tagValue) { string cmd = "EngineID_MES"; Write_TagValueByTagTypeName(cmd, opName, tagValue); } /// /// 变量类型代码=75,零件机型。DBB446~485 发动机机型 /// /// /// public static void Write_EngineType_MES(string opName, string tagValue) { string cmd = "EngineType_MES"; Write_TagValueByTagTypeName(cmd, opName, tagValue); } /// /// 拧紧序号(77) /// /// /// public static void Write_ProcessCode(string opName, int tagValue) { string cmd = "ProcessCode"; Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue)); } /// /// 套筒号(88) /// /// /// public static void Write_BoltCode(string opName, int tagValue) { string cmd = "BoltCode"; Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue)); } /// /// 空托盘放行(DBX2.2)(6) /// /// /// public static void Write_PartPalletGoOver(string opName, int tagValue) { string cmd = "PartPalletGoOver"; Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue)); } /// /// 自动手动申请工件编号,0是自动方式;1:手动方式。切换时,(DBX2.1)(71) /// /// /// public static void Write_IsAutoGetEngineID(string opName, int tagValue) { string cmd = "IsAutoGetEngineID"; Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue)); } /// /// 正常拧紧时选择(DBX100.3)(81) /// /// /// public static void Write_Normal(string opName, int tagValue) { string cmd = "Normal"; Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue)); } /// /// 备用拧紧时选择(DBX100.4)(82) /// /// /// public static void Write_UnNormal(string opName, int tagValue) { string cmd = "UnNormal"; Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue)); } /// /// 变量类型代码=52,复位设备(MES)DBX0.6 /// 通知PLC复位设备 /// /// /// public static void Write_ResetDevice(string opName, bool tagValue) { string cmd = "PartLoadFinish"; Write_TagValueByTagTypeName(cmd, opName, tagValue); } /// ///托盘状态(22) /// /// /// public static void Write_PalletInfo(string opName, int tagValue) { string cmd = "PalletInfo"; Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue)); } /// /// 返修标志(93) /// /// /// public static void Write_RepairStatusMES(string opName, int tagValue) { string cmd = "RepairStatusMES"; Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue)); } /// /// MES通知PLC修改托盘状态成功 /// /// /// public static void Write_UpdatePalletOK(string opName, bool tagValue) { string cmd = "UpdatePalletOK"; Write_TagValueByTagTypeName(cmd, opName, tagValue); } } }