Sic.Framework-Nanjing-Baishi/MECF.Framework.Common/MECF/Framework/Common/MultiProcess/ProcessCenter/MultiProcessService.cs

50 lines
2.1 KiB
C#
Raw Normal View History

2024-02-01 18:32:23 +08:00
using System.Collections.Generic;
using System.ServiceModel;
2024-02-02 17:10:15 +08:00
using System.ServiceModel.Channels;
2024-02-01 18:32:23 +08:00
2024-02-01 19:05:50 +08:00
namespace MECF.Framework.Common.MultiProcess.ProcessCenter
2024-02-01 18:32:23 +08:00
{
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple, UseSynchronizationContext = false)]
public class MultiProcessService : IMultiProcessService
{
2024-02-18 10:09:35 +08:00
public bool CanEnterProcessIdleNow(string sicMachineName, string pmName, string state, out string result)
2024-02-01 18:32:23 +08:00
{
2024-02-18 10:09:35 +08:00
return MULTIPROCESS.CanEnterProcessIdleNow(GetClientInformation(sicMachineName, pmName),sicMachineName, pmName, state, out result);
2024-02-01 18:32:23 +08:00
}
2024-02-18 10:09:35 +08:00
public bool CanEnterProcessNow(string sicMachineName, string pmName, string state, out string result)
2024-02-01 18:32:23 +08:00
{
2024-02-18 08:33:49 +08:00
2024-02-18 10:09:35 +08:00
return MULTIPROCESS.CanEnterProcessNow(GetClientInformation(sicMachineName, pmName),sicMachineName, pmName, state, out result);
2024-02-01 18:32:23 +08:00
}
public List<string> QueryAllProcessInformation()
{
return MULTIPROCESS.QueryAllProcessInformation();
}
2024-02-02 16:17:07 +08:00
public string QueryMyProcessInformation(string sicMachineName, string pmName)
{
return MULTIPROCESS.QueryMyProcessInformation(sicMachineName, pmName);
}
2024-02-18 10:09:35 +08:00
public bool UpdateChamberState(string sicMachineName, string pmName, string state, string heatbase)
2024-02-01 18:32:23 +08:00
{
2024-02-18 10:09:35 +08:00
return MULTIPROCESS.UpdateChamberState(GetClientInformation(sicMachineName, pmName), sicMachineName, pmName, state, heatbase);
2024-02-02 17:10:15 +08:00
}
private string GetClientInformation(string sicMachineName, string pmName)
{
//提供方法执行的上下文环境
OperationContext context = OperationContext.Current;
//获取传进的消息属性
MessageProperties properties = context.IncomingMessageProperties;
//获取消息发送的远程终结点IP和端口
RemoteEndpointMessageProperty endpoint = properties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
return $"{sicMachineName} {pmName}; {endpoint.Address}";
2024-02-01 18:32:23 +08:00
}
}
}