首次提交:添加src文件夹代码
This commit is contained in:
50
Cowain.Bake.Communication/Interface/IPLCDevice.cs
Normal file
50
Cowain.Bake.Communication/Interface/IPLCDevice.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Common.Models;
|
||||
using Cowain.Bake.Model.Entity;
|
||||
using Cowain.Bake.Model.Models;
|
||||
using HslCommunication;
|
||||
using Opc.Ua;
|
||||
using Prism.Commands;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Cowain.Bake.Communication.Interface
|
||||
{
|
||||
public interface IPLCDevice//接口Plc
|
||||
{
|
||||
bool IsConnect { get; set; }//是否连接
|
||||
int Id { get; set; }//id
|
||||
string Name { get; set; }//名称
|
||||
string DeviceName { get; set; }//设备名称
|
||||
int ReadUseTime { get; set; }//读取使用时间
|
||||
//字典
|
||||
Dictionary<int, Variable> VariableDic { get; set; } //key:plc地址,value:这个地址的相关信息,可以删除,基本不用
|
||||
List<TagEntity> TagList { get; set; } //数据库中查询出来的
|
||||
ObservableCollection<Variable> VariableList { get; set; } //一个PLC中的所有(界面显示) 与Storages的VariableList是同一块内存
|
||||
List<StorageArea> Storages { get; set; } //Storages里也有一个VariableList,一个PLC分成若干个VariableList组,分组读取数据
|
||||
|
||||
void Heartbeat();
|
||||
void Connect();//连接
|
||||
void Close();//关闭
|
||||
void StartRead();//开始读取
|
||||
void AnalysisAddress();
|
||||
void GetStorageArea();
|
||||
void GetJsonParam(string param);
|
||||
void ReadStorageArea();
|
||||
List<DataValue> Reads(NodeId[] nodeIds);
|
||||
OperateResult<T> Read<T>(string tag);
|
||||
OperateResult<T> GetValue<T>(string paramName);
|
||||
OperateResult<T> GetValue<T>(string paramName, int machineId, int number = 1);
|
||||
Variable GetVariable(string paramName, int machineId, int number = 1);
|
||||
//OperateResult Write<T>(string paramName, int machineId, int number, T data);
|
||||
|
||||
OperateResult Write<T>(string address, T data, int maxCount = Global.MAX_READS);
|
||||
OperateResult Writes(string[] tags, object[] values, int maxCount = Global.MAX_READS);
|
||||
}
|
||||
}
|
||||
23
Cowain.Bake.Communication/Interface/IPLCService.cs
Normal file
23
Cowain.Bake.Communication/Interface/IPLCService.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Cowain.Bake.Common.Models;
|
||||
using Cowain.Bake.Model;
|
||||
using Cowain.Bake.Model.Entity;
|
||||
using Cowain.Bake.Model.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Cowain.Bake.Communication.Interface
|
||||
{
|
||||
public interface IPLCService
|
||||
{
|
||||
List<TDeviceConfig> GetDeviceList();
|
||||
List<TDeviceConfig> GetPLCList();
|
||||
List<TDeviceConfig> GetScanList();
|
||||
List<TagEntity> GetTagList(int plcId);
|
||||
int DeleteTag(int tagId);
|
||||
int SelectScript(Variable variable);
|
||||
int DelectScript(Variable variable);
|
||||
}
|
||||
}
|
||||
39
Cowain.Bake.Communication/Interface/IScanCodeBase.cs
Normal file
39
Cowain.Bake.Communication/Interface/IScanCodeBase.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using HslCommunication;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Services.Dialogs;
|
||||
using Unity;
|
||||
using Cowain.Bake.BLL;
|
||||
|
||||
|
||||
namespace Cowain.Bake.Communication.Interface
|
||||
{
|
||||
public abstract class IScanCodeBase : BindableBase//, IScanCodeBase
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string DeviceName { get; set; }
|
||||
public string Ip { get; set; }
|
||||
public int Port { get; set; }
|
||||
public string Command { get; set; }
|
||||
public string CloseCommand { get; set; }
|
||||
public string FilterRegex { get; set; }
|
||||
public abstract bool IsConnect { get; set; }
|
||||
public abstract bool Connect();
|
||||
public abstract void Close();
|
||||
public abstract void GetJsonParam(string param);
|
||||
IUnityContainer _unityContainer;
|
||||
IDialogService _dialogService;
|
||||
public abstract OperateResult<string> ReadCode();
|
||||
public IScanCodeBase(IUnityContainer unityContainer, IDialogService dialogService)
|
||||
{
|
||||
_unityContainer = unityContainer;
|
||||
_dialogService = dialogService;
|
||||
}
|
||||
|
||||
|
||||
public void SetStatus(int Id, bool status)
|
||||
{
|
||||
_unityContainer.Resolve<DeviceConfigService>().UpdateStatus(Id, status);
|
||||
}
|
||||
}
|
||||
}
|
||||
27
Cowain.Bake.Communication/Interface/IScanCodeDevice.cs
Normal file
27
Cowain.Bake.Communication/Interface/IScanCodeDevice.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Cowain.Injecting.Model;
|
||||
using HslCommunication;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Cowain.Injecting.Communication.Interface
|
||||
{
|
||||
public interface IScanCodeDevice
|
||||
{
|
||||
int Id { get; set; }
|
||||
string IpAddress { get; set; }
|
||||
int Port { get; set; }
|
||||
string Name { get; set; }
|
||||
string Command { get; set; }
|
||||
string FilterCodes { get; set; }
|
||||
string DeviceName { get; set; }
|
||||
bool IsConnect { get; set; }
|
||||
|
||||
bool Connect();
|
||||
void Close();
|
||||
OperateResult<string> ReadCode();
|
||||
void GetJsonParam(string param);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user