| 1234567891011121314151617181920212223242526272829303132333435 |
- 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")
- // };
- //}
- public IPLCAccessor Create(WCS_PLC data)
- {
- if (data.TYPE == PLCType.西门子)
- return new SiemensS7PLC(data.IP, data.PORT, data.RACK, data.SLOT);
- else
- throw new Exception("不支持此PLC");
- }
- //IPLCAccessor IPLCAccessorCreater.Create(WCS_PLC data)
- //{
- // throw new NotImplementedException();
- //}
- }
- }
|