| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- using Prism.Mvvm;
- using System;
- using TeamAAS_VP.Core.PLCs;
- using TeamAAS_VP.Enums;
- namespace TeamAAS_VP.Models
- {
- public class PlcInfo : BindableBase
- {
- private Guid _Id;
- public Guid Id
- {
- get { return _Id; }
- set { SetProperty(ref _Id, value); }
- }
- private string _Name;
- public string Name
- {
- get { return _Name; }
- set { SetProperty(ref _Name, value); }
- }
- private CommunicationType _CommunicationType;
- public CommunicationType CommunicationType
- {
- get { return _CommunicationType; }
- set { SetProperty(ref _CommunicationType, value); }
- }
- private string _EndpointUrl;
- public string EndpointUrl
- {
- get { return _EndpointUrl; }
- set { SetProperty(ref _EndpointUrl, value); }
- }
- #region Mitsubishi MC
- public string PlcIp { get; set; } = "192.168.0.10";
- public int PlcPort { get; set; } = 5000;
- public bool PlcForwardEnabled { get; set; } = true;
- public string PlcPortDevice { get; set; } = "D101";
- public string PlcQualityDevice { get; set; } = "D102";
- public string PlcDataStartDevice { get; set; } = "D110";
- public string PlcReadyBitDevice { get; set; } = "M100";
- public string PlcOkBitDevice { get; set; } = "0";
- public string PlcNgBitDevice { get; set; } = "0";
- public string PlcReceiveBitDevice { get; set; } = "M103";
- public string PlcHeartbeatDevice { get; set; } = "M200";
- public int PlcHeartbeatIntervalMs { get; set; } = 1000;
- public string PlcBitTestDevice { get; set; } = "M3001";
- public int PlcMaxDataBytes { get; set; } = 32;
- public PlcRfidMapping ToPlcMapping()
- {
- return new PlcRfidMapping
- {
- PortDevice = PlcPortDevice,
- QualityDevice = PlcQualityDevice,
- DataStartDevice = PlcDataStartDevice,
- ReadyBitDevice = PlcReadyBitDevice,
- OkBitDevice = PlcOkBitDevice,
- NgBitDevice = PlcNgBitDevice,
- ReceiveBitDevice = PlcReceiveBitDevice,
- MaxDataBytes = PlcMaxDataBytes
- };
- }
- public void ApplyMcInfo(MCToPCInfo info)
- {
- if (info == null) return;
- PlcIp = info.PlcIp;
- PlcPort = info.PlcPort;
- PlcForwardEnabled = info.PlcForwardEnabled;
- PlcPortDevice = info.PlcPortDevice;
- PlcQualityDevice = info.PlcQualityDevice;
- PlcDataStartDevice = info.PlcDataStartDevice;
- PlcReadyBitDevice = info.PlcReadyBitDevice;
- PlcOkBitDevice = info.PlcOkBitDevice;
- PlcNgBitDevice = info.PlcNgBitDevice;
- PlcReceiveBitDevice = info.PlcReceiveBitDevice;
- PlcHeartbeatDevice = info.PlcHeartbeatDevice;
- PlcHeartbeatIntervalMs = info.PlcHeartbeatIntervalMs;
- PlcBitTestDevice = info.PlcBitTestDevice;
- PlcMaxDataBytes = info.PlcMaxDataBytes;
- }
- #endregion
- }
- }
|