12345678910111213141516171819202122 |
- using HslCommunication.Core;
- using System;
- using WCS.Core.DataTrans;
- using WCS.Entity;
- namespace WCS.Service.PLCAccessors
- {
- public class PlcAccessorsCreater : IPlcAccessorCreater
- {
- public IReadWriteNet Create(WCS_PLC data)
- {
- return data.TYPE switch
- {
- PLCType.西门子 => new SiemensS7PLC((int)data.MODEL, data.IP),
- PLCType.三菱 => new MelsecPLC(data.IP, data.PORT),
- PLCType.AB => new AllenBradleyPLC(data.IP),
- PLCType.汇川 => new HuiChuangPLC(data.IP),
- _ => throw new Exception("不支持此PLC")
- };
- }
- }
- }
|