首次提交:添加src文件夹代码
This commit is contained in:
73
Cowain.Bake.Main/Station/MesCollectStation.cs
Normal file
73
Cowain.Bake.Main/Station/MesCollectStation.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common.Enums;
|
||||
using Cowain.Bake.Communication.MOM;
|
||||
using Cowain.Bake.Main.ViewModels;
|
||||
using Cowain.Bake.Model;
|
||||
using Cowain.Bake.Model.Models;
|
||||
using Opc.Ua;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Unity;
|
||||
using JSON = Newtonsoft.Json.JsonConvert;
|
||||
|
||||
namespace Cowain.Bake.Main.Station
|
||||
{
|
||||
public class MesCollectStation
|
||||
{
|
||||
readonly CancellationTokenSource cts = new CancellationTokenSource();
|
||||
readonly List<TDeviceConfig> stoveConfs = null;
|
||||
IUnityContainer _unityContainer { get; set; }
|
||||
public MesCollectStation(IUnityContainer unityContainer)
|
||||
{
|
||||
|
||||
_unityContainer = unityContainer;
|
||||
stoveConfs = _unityContainer.Resolve<DeviceConfigService>().GetConfig(EDeviceType.PLC, EDeviceName.StovePlc1);
|
||||
}
|
||||
/*
|
||||
1 运行状态
|
||||
2 待机状态
|
||||
3 报警状态
|
||||
4 停机状态
|
||||
*/
|
||||
//mes-mom 2.设备状态 只有联机才调用MES接口,MOM返回成功,失败
|
||||
public void EqptStatus(DataValue data, Variable node)
|
||||
{
|
||||
Int16 value = (Int16)data.WrappedValue.Value;
|
||||
List<TAlarm> models = null;
|
||||
if (int.Parse(_unityContainer.Resolve<SysSetupService>().GetValueByParaID(ESysSetup.MOMEnable.ToString())) == (int)EMOMEnable.Enable)
|
||||
{
|
||||
if ((int)EStatusCode.Warn == value)
|
||||
{
|
||||
var alarms = _unityContainer.Resolve<MainWindowViewModel>().Alarms.Where(x=>x.StationId == node.StationId).ToList();
|
||||
models = JSON.DeserializeObject<List<TAlarm>>(JSON.SerializeObject(alarms));
|
||||
}
|
||||
//_unityContainer.Resolve<MESProcess>().MESEqptStatus((UInt16)value, models); //经常超时 2026-2-9
|
||||
}
|
||||
_unityContainer.Resolve<BasicInfoViewModel>().DeviceStatusName = ((EStatusCode)value).GetDescription();
|
||||
}
|
||||
|
||||
//public string MakeJsonTemperature(string headName, float[] value)
|
||||
//{
|
||||
// headName = Regex.Replace(headName, @"\d", "");
|
||||
// List<PallletTemp> listTemp = new List<PallletTemp>();
|
||||
// for (int i = 1; i <= value.Length; i++)
|
||||
// {
|
||||
// listTemp.Add(new PallletTemp()
|
||||
// {
|
||||
// HeadName = $"{headName}{i}",
|
||||
// Value = value[i - 1]
|
||||
// });
|
||||
// }
|
||||
|
||||
// return JsonConvert.SerializeObject(listTemp);
|
||||
//}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
// 在需要取消任务的时候,调用以下代码:
|
||||
cts.Cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user