TODO 能耗定时上传
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using JY.MES;
|
||||
using JY.Inspection.Common;
|
||||
using JY.MES;
|
||||
using JY.MES.Entity;
|
||||
using JY.MES.Enum;
|
||||
using JY.MES.Exceptions;
|
||||
@@ -8,6 +9,7 @@ using JY.Utility;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using NPOI.OpenXmlFormats.Spreadsheet;
|
||||
using Org.BouncyCastle.Ocsp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -55,6 +57,7 @@ namespace JY.Inspection.Mes
|
||||
// TODO 上传设备报警信息
|
||||
|
||||
// TODO 能耗
|
||||
void UpEnergyDataMqtt(List<double> dataList);
|
||||
|
||||
// TODO 设备打标
|
||||
}
|
||||
@@ -380,5 +383,46 @@ namespace JY.Inspection.Mes
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
// TODO 能耗定时上传
|
||||
public void UpEnergyDataMqtt(List<double> dataList)
|
||||
{
|
||||
if (dataList == null || dataList.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string topic = $"EVE/{Global.systemConfig.siteCode}/EQP/{Global.systemConfig.equipCode}";
|
||||
|
||||
CmdEnergyData cmd = new CmdEnergyData() {
|
||||
// TODO BU编码
|
||||
Bu_id = string.Empty,
|
||||
// TODO 区域简称
|
||||
District_id = string.Empty,
|
||||
Factory_id = Global.systemConfig.siteCode,
|
||||
Production_line_id = Global.systemConfig.lineCode,
|
||||
Production_processes_id = string.Empty,
|
||||
Work_center_id = string.Empty,
|
||||
Station_id = string.Empty,
|
||||
Device_name = Global.systemConfig.equipCode,
|
||||
};
|
||||
|
||||
string[] dataNameArr = new string[] {
|
||||
"相电压UA", "相电压UB","相电压UC","线电压UAB","线电压UBC","线电压UAC","电流IA","电流IB",
|
||||
"电流IC","A相有功功率","B相有功功率","C相有功功率","总有功功率"
|
||||
};
|
||||
for (int i = 0; i < dataList.Count; i++)
|
||||
{
|
||||
cmd.Taglist.Add(new CollectionItem() {
|
||||
Equipment_Code = Global.systemConfig.equipCode,
|
||||
EMeter_Name = dataNameArr[i],
|
||||
EMeter_Value = dataList[i].ToString()
|
||||
});
|
||||
}
|
||||
|
||||
string payload = JsonHelper.Serialize(cmd);
|
||||
|
||||
MqttSingleton.Instance.SendAsync(topic, payload).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
<Compile Include="FMS\Model\FMS_Out.cs" />
|
||||
<Compile Include="MESApiHelper.cs" />
|
||||
<Compile Include="MesResponse.cs" />
|
||||
<Compile Include="MES\CmdEnergyData.cs" />
|
||||
<Compile Include="MES\GradingParam.cs" />
|
||||
<Compile Include="MES\ProductResultParameters.cs" />
|
||||
<Compile Include="MES\ReqArrivalStation.cs" />
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JY.MES.MES
|
||||
{
|
||||
/// <summary>
|
||||
/// 能耗数据
|
||||
/// </summary>
|
||||
public class CmdEnergyData
|
||||
{
|
||||
/// <summary>
|
||||
/// BU编码, 如: EVE6BU
|
||||
/// </summary>
|
||||
public string Bu_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 区域简称, 如: JM
|
||||
/// </summary>
|
||||
public string District_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工厂编码
|
||||
/// </summary>
|
||||
public string Factory_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 产线编码
|
||||
/// </summary>
|
||||
public string Production_line_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工序编码
|
||||
/// </summary>
|
||||
public string Production_processes_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工作中心编码
|
||||
/// </summary>
|
||||
public string Work_center_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工站
|
||||
/// </summary>
|
||||
public string Station_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备编码
|
||||
/// </summary>
|
||||
public string Device_name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 采集数组
|
||||
/// </summary>
|
||||
public List<CollectionItem> Taglist { get; set; }
|
||||
}
|
||||
|
||||
public class CollectionItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备编码
|
||||
/// </summary>
|
||||
public string Equipment_Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 电表名称
|
||||
/// </summary>
|
||||
public string EMeter_Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 显示值
|
||||
/// </summary>
|
||||
public string EMeter_Value { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user