| | |
| | | public readonly long PlcId; |
| | | private SiemensClient _client; |
| | | private WcsPlc _modPlc; |
| | | |
| | | private readonly object OLock = new object(); |
| | | public PLCUtil(WcsPlc modPlc) |
| | | { |
| | | PlcId = modPlc.Id; |
| | |
| | | /// <param name="Pos">偏移量/地址</param> |
| | | /// <returns></returns> |
| | | public (IoTClient.Result, dynamic value) GetPlcDBValue(PLCDataTypeEnum PosType, string DbNumber, string Pos) |
| | | { |
| | | lock (OLock) |
| | | { |
| | | string address; |
| | | if (DbNumber.StartsWith("DB")) |
| | |
| | | } |
| | | return (result, result.Value); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 批量读取PLC值 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public Result<Dictionary<string, object>> GetPlcBatchDBValue(Dictionary<string, PLCDataTypeEnum> listaddress) |
| | | { |
| | | lock (OLock) |
| | | { |
| | | Dictionary<string, DataTypeEnum> addresses = new Dictionary<string, DataTypeEnum>(); |
| | | foreach (var address in listaddress) |
| | |
| | | } |
| | | return _client.BatchRead(addresses); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 写入PLC值 |
| | | /// </summary> |