PLCAccessorsCreater.cs 577 B

123456789101112131415161718192021
  1. using HslCommunication.Core;
  2. using System;
  3. using WCS.Core.DataTrans;
  4. using WCS.Entity;
  5. namespace WCS.Service.PLCAccessors
  6. {
  7. public class PlcAccessorsCreater : IPlcAccessorCreater
  8. {
  9. public IReadWriteNet Create(WCS_PLC data)
  10. {
  11. return data.TYPE switch
  12. {
  13. PLCType.西门子 => new SiemensS7PLC((int)data.MODEL, data.IP),
  14. PLCType.三菱 => new MelsecPLC(data.IP, data.PORT),
  15. //PLCType.AB=>
  16. _ => throw new Exception("不支持此PLC")
  17. };
  18. }
  19. }
  20. }