292 lines
10 KiB
C#
292 lines
10 KiB
C#
//using BasicData;
|
|
//using MesWork;
|
|
//using OpcBasic;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Specialized;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MesDataFunction
|
|
{
|
|
|
|
/*
|
|
HeartBeatMIS 15
|
|
EngineTypeGetOverMES 5
|
|
PartPalletGoOver 6
|
|
MaterialVerifyOver 7
|
|
FalseGo 8
|
|
ConfirmOkGo 51
|
|
PartLoadFinish 52
|
|
UnloadCompleted 53
|
|
MachineTime_ReadOver 54
|
|
FixAllow 66
|
|
FixOver 67
|
|
MatchingCompleted 68
|
|
Match 69
|
|
Reserved_1 70
|
|
IsAutoGetEngineID 71
|
|
RepairUplineMES 72
|
|
ProcessCode 77
|
|
BoltCode 88
|
|
RepairStatus 93
|
|
Reserved_3 24
|
|
Reserved_4 25
|
|
Reserved_5 26
|
|
Reserved_6 27
|
|
Reserved_7 28
|
|
Reserved_8 29
|
|
Reserved_9 30
|
|
Reserved_10 31
|
|
Reserved_11 32
|
|
Reserved_12 33
|
|
Reserved_13 34
|
|
Reserved_14 35
|
|
MesReadOver 20
|
|
Reserved_15 110
|
|
Reserved_16 111
|
|
Reserved_17 112
|
|
OnLineState 79
|
|
EngineTypeID_MES 73
|
|
EngineID_MES 74
|
|
EngineType_MES 75
|
|
MarkID 42
|
|
RepairPathString 4
|
|
SPareint1 113
|
|
SPareint2 114
|
|
SPareint3 115
|
|
Sparestring1 116
|
|
Sparestring2 117
|
|
HeartBeatPLC 14
|
|
WorkStart 2
|
|
RepairPartStatusPLC 3
|
|
PartLoad 43
|
|
EngineTypeGetOverPLC 44
|
|
PartLoadOK 48
|
|
Reserved_18 49
|
|
PalletDown 50
|
|
Reserved_19 58
|
|
FixOK 59
|
|
Reserved_20 76
|
|
Reserved_21 61
|
|
Reserved_22 62
|
|
Reserved_23 63
|
|
Reserved_24 64
|
|
Reserved_25 65
|
|
EngineTypeID 9
|
|
EngineID 10
|
|
EngineType 11
|
|
PartPalletCode 80
|
|
PalletInfo 22
|
|
MesRead 19
|
|
PutOn 1000
|
|
WorkOn 1001
|
|
Alarm 1002
|
|
NoPart 1003
|
|
Block 1004
|
|
PartPalletStatus 13
|
|
TargetTimeRead 16
|
|
QualityMask 21
|
|
RepairStatusPLC 23
|
|
MachineTargetTime 17
|
|
MachineActualTime 18
|
|
PLCSPareint1 36
|
|
PLCSPareint2 37
|
|
PLCSPareint3 38
|
|
PLCSarestring1 39
|
|
PLCSarestring2 40
|
|
*/
|
|
|
|
|
|
|
|
public class OpcOperation
|
|
{
|
|
|
|
|
|
///// <summary>
|
|
/////引用程序集Hashtable
|
|
///// </summary>
|
|
//public static Hashtable Hashtable_assembly = new Hashtable();
|
|
///// <summary>
|
|
/////
|
|
///// </summary>
|
|
//static public NameValueCollection hashtable_TagType = null;
|
|
///// <summary>
|
|
/////
|
|
///// </summary>
|
|
//static public NameValueCollection hashtable_TagTypeTagName = null;
|
|
|
|
///// <summary>
|
|
/////
|
|
///// </summary>
|
|
//static public NameValueCollection hashtable_TagTypeChange = null;
|
|
///// <summary>
|
|
/////
|
|
///// </summary>
|
|
//static public NameValueCollection hashtable_WebTagTypeChange = null;
|
|
///// <summary>
|
|
/////
|
|
///// </summary>
|
|
//static public NameValueCollection hashtable_MesTagTypeChange = null;
|
|
///// <summary>
|
|
/////
|
|
///// </summary>
|
|
//static public NameValueCollection hashtable_TagTypeDataType = null;
|
|
///// <summary>
|
|
/////
|
|
///// </summary>
|
|
//static readonly object l = new object();
|
|
///// <summary>
|
|
/////
|
|
///// </summary>
|
|
///// <param name="tagTypeCodeID"></param>
|
|
///// <param name="opName"></param>
|
|
///// <returns></returns>
|
|
//public static object ReadPLC(int tagTypeCodeID, string opName)
|
|
//{
|
|
// return PlcLinkForm.ReadPLC(tagTypeCodeID, opName);
|
|
//}
|
|
///// <summary>
|
|
/////
|
|
///// </summary>
|
|
///// <param name="tagID"></param>
|
|
///// <param name="tagValue"></param>
|
|
//public static void ReadPLC(string tagID, out object tagValue)
|
|
//{
|
|
// tagValue = PlcLinkForm.ReadPLC(tagID);
|
|
//}
|
|
///// <summary>
|
|
/////
|
|
///// </summary>
|
|
///// <param name="opName"></param>
|
|
///// <returns></returns>
|
|
//public static object ReadPLC_Sync_DataList_MesRead(string opName)
|
|
//{
|
|
// lock (l)
|
|
// {
|
|
// Hashtable ht = new Hashtable();
|
|
|
|
// var cd = PlcLinkForm.ReadPLC_GroupData(opName);
|
|
|
|
// foreach (KeyValuePair<string,object> _cd in cd)
|
|
// {
|
|
// var tagID = Convert.ToInt32(_cd.Key);
|
|
// var TF = (TagFormat)_cd.Value;
|
|
|
|
// QualityDataType qualityDataType;
|
|
// qualityDataType = new QualityDataType();
|
|
|
|
// qualityDataType.tagID = TF.TagID;
|
|
// qualityDataType.tagTypeID = TF.TagTypeID ;//变量类型
|
|
// qualityDataType.opName = opName;
|
|
// qualityDataType.isGoodBad = 192;
|
|
// int.TryParse(TF.TagQuality, out int TagQuality);
|
|
// qualityDataType.tagQuality = TagQuality;
|
|
// qualityDataType.tagValueType = TF.TagTypeCodeID;
|
|
// int.TryParse(TF.TagOrderBy, out int TagOrderBy);
|
|
// qualityDataType.tagOrderBy = TagOrderBy;
|
|
// int.TryParse(TF.TagItemOrderBy, out int TagItemOrderBy);
|
|
// qualityDataType.tagItemOrderBy = TagItemOrderBy;
|
|
// qualityDataType.tagProperty = TF.TagProperty;//变量特点
|
|
// qualityDataType.tagValue = TF.TagValue;//变量值
|
|
|
|
// ht.Add(tagID , qualityDataType);
|
|
// }
|
|
// return ht;
|
|
// }
|
|
|
|
//}
|
|
///// <summary>
|
|
/////
|
|
///// </summary>
|
|
///// <param name="tagTypeCodeID"></param>
|
|
///// <param name="opName"></param>
|
|
///// <param name="tagValue"></param>
|
|
//public static void ReadTagValue(string tagID, out string tagValue)
|
|
//{
|
|
// tagValue = "0";
|
|
// var tagValueObj = PlcLinkForm.ReadPLC(tagID);
|
|
// var type = tagValueObj.GetType().Name.ToLower();
|
|
// if (type == "bool" | type == "boolean")
|
|
// {
|
|
// var val = tagValueObj.ToString().ToLower();
|
|
|
|
// if (val == "true")
|
|
// {
|
|
// tagValue = "1";
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// tagValue = tagValueObj.ToString();
|
|
// }
|
|
//}
|
|
///// <summary>
|
|
/////
|
|
///// </summary>
|
|
///// <param name="tagTypeCodeID"></param>
|
|
///// <param name="opName"></param>
|
|
///// <param name="tagValue"></param>
|
|
//public static void ReadTagValue(int tagTypeCodeID, string opName, out string tagValue)
|
|
//{
|
|
// tagValue = "0";
|
|
// var tagValueObj = PlcLinkForm.ReadPLC(tagTypeCodeID, opName);
|
|
// var type = tagValueObj.GetType().Name.ToLower();
|
|
// if (type == "bool" | type == "boolean")
|
|
// {
|
|
// var val = tagValueObj.ToString().ToLower();
|
|
|
|
// if (val == "true")
|
|
// {
|
|
// tagValue = "1";
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// tagValue = tagValueObj.ToString();
|
|
// }
|
|
//}
|
|
///// <summary>
|
|
/////
|
|
///// </summary>
|
|
///// <param name="tagID"></param>
|
|
///// <param name="tagValue"></param>
|
|
///// <returns></returns>
|
|
//public static bool WritePLC(string tagID, object tagValue)
|
|
//{
|
|
// return PlcLinkForm.WritePLC(tagID, tagValue);
|
|
//}
|
|
///// <summary>
|
|
/////
|
|
///// </summary>
|
|
///// <param name="tagTypeCodeID"></param>
|
|
///// <param name="opName"></param>
|
|
///// <param name="tagValue"></param>
|
|
///// <returns></returns>
|
|
//public static bool WritePLC(int tagTypeCodeID, string opName, object tagValue)
|
|
//{
|
|
// return PlcLinkForm.WritePLC(tagTypeCodeID, opName, tagValue);
|
|
//}
|
|
///// <summary>
|
|
/////
|
|
///// </summary>
|
|
///// <param name="tagTypeCodeID"></param>
|
|
///// <param name="opName"></param>
|
|
///// <param name="tagValue"></param>
|
|
///// <returns></returns>
|
|
//public static bool WriteTagValue(int tagTypeCodeID, string opName, object tagValue)
|
|
//{
|
|
// return PlcLinkForm.WritePLC(tagTypeCodeID, opName, tagValue);
|
|
//}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|