Files
2026-05-29 10:07:05 +08:00

124 lines
4.3 KiB
C#

using DoWhatPlc;
using DtWebApi;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DtWebApi
{
public class OpcDemo
{
public static HashtableList GetHashtableList()
{
try
{
string api = "";
string type = "GET";
string controlStr = "PLC1";
string actionStr = "GetHashtableList";
Dictionary<string, string> dic = new Dictionary<string, string>();
var rc = new CallWebApi().InvokeWebapiHashtableList(controlStr, actionStr, api, type, dic);
return rc;
}
catch (Exception err)
{
return new HashtableList();
}
}
public static List<TagIDTagFormat> ReadPLC_GroupMonitor(string opName)
{
string api = "";
string type = "GET";
string controlStr = "PLC1";
string actionStr = "ReadPLC_GroupMonitor";
Dictionary<string, string> dic = new Dictionary<string, string>();
dic.Add("opName", opName);
var rc = new CallWebApi().InvokeWebapiListTagFormat(controlStr, actionStr, api, type, dic);
return rc;
}
public static List<TagIDTagFormat> ReadPLC_GroupData_Qd(string opName)
{
string api = "";
string type = "GET";
string controlStr = "PLC1";
string actionStr = "ReadPLC_GroupData_Qd";
Dictionary<string, string> dic = new Dictionary<string, string>();
dic.Add("opName", opName);
var rc = new CallWebApi().InvokeWebapiListTagFormat(controlStr, actionStr, api, type, dic);
return rc;
}
public static List<TagIDTagFormat> ReadPLC_GroupData(string opName)
{
string api = "";
string type = "GET";
string controlStr = "PLC1";
string actionStr = "ReadPLC_GroupData";
Dictionary<string, string> dic = new Dictionary<string, string>();
dic.Add("opName", opName);
var rc = new CallWebApi().InvokeWebapiListTagFormat(controlStr, actionStr, api, type, dic);
return rc;
}
public static List<string> Get_opNameList()
{
string api = "";
string type = "GET";
string controlStr = "PLC1";
string actionStr = "Get_opNameList";
Dictionary<string, string> dic = new Dictionary<string, string>();
var rc = new CallWebApi().InvokeWebapiListString(controlStr, actionStr, api, type, dic);
return rc;
}
public static List<string> Get_ipList()
{
string api = "";
string type = "GET";
string controlStr = "PLC1";
string actionStr = "Get_ipList";
Dictionary<string, string> dic = new Dictionary<string, string>();
var rc = new CallWebApi().InvokeWebapiListString(controlStr, actionStr, api, type, dic);
return rc;
}
public static ConcurrentDictionary<string, TagFormat> Get_TagAdrListTagFormat(string ip, string group)
{
string api = "";
string type = "GET";
string controlStr = "PLC1";
string actionStr = "Get_TagAdrListTagFormat";
Dictionary<string, string> dic = new Dictionary<string, string>();
dic.Add("ip", ip);
dic.Add("group", group);
var rc = new CallWebApi().InvokeWebapiConcurrentDictionaryTagFormat(controlStr, actionStr, api, type, dic);
return rc;
}
public static ConcurrentDictionary<string, TagFormat> ReadTagValue_tagAdrListTagFormat(string readWhat, string opOrIp)
{
string api = "";
string type = "GET";
string controlStr = "PLC1";
string actionStr = "ReadTagValue_tagAdrListTagFormat";
Dictionary<string, string> dic = new Dictionary<string, string>();
dic.Add("readWhat", readWhat);
dic.Add("opOrIp", opOrIp);
var rc = new CallWebApi().InvokeWebapiConcurrentDictionaryTagFormat(controlStr, actionStr, api, type, dic);
return rc;
}
}
}