diff --git a/Sln.Iot.Business/ErrorAnalyseBusiness.cs b/Sln.Iot.Business/ErrorAnalyseBusiness.cs
index f524c08..084b4a8 100644
--- a/Sln.Iot.Business/ErrorAnalyseBusiness.cs
+++ b/Sln.Iot.Business/ErrorAnalyseBusiness.cs
@@ -16,6 +16,7 @@ using CFX;
using CFX.Structures;
using Sln.Iot.Serilog;
using Amqp;
+using TouchSocket.Core;
namespace Sln.Iot.Business
{
@@ -47,47 +48,54 @@ namespace Sln.Iot.Business
///
public void TimerCallback(object? state)
{
- byte[] errorBytes1 = new byte[1];
-
- //隧道烤箱报警
- var result20 = _plc.ReadBytes(_plc.DeltaInstance0, "D100", 1);
- //真空箱1报警
- var result21 = _plc.ReadBytes(_plc.DeltaInstance1, "D80", 10);
- //真空箱2报警
- var result22 = _plc.ReadBytes(_plc.DeltaInstance2, "D80", 10);
- //提升机报警
- var result23 = _plc.ReadBytes(_plc.DeltaInstance3, "D100", 1);
-
- if (result20.IsSuccess)
+ try
{
- BitArray bits20 = new BitArray(result20.Content);
- bool[] bools20 = new bool[bits20.Count];
- bits20.CopyTo(bools20, 0);
- OvenAlarmAnalyse(bools20);
+ byte[] errorBytes1 = new byte[1];
+
+ //隧道烤箱报警
+ var result20 = _plc.ReadBytes(_plc.DeltaInstance0, "D100", 1);
+ //真空箱1报警
+ var result21 = _plc.ReadBytes(_plc.DeltaInstance1, "D80", 11);
+ //真空箱2报警
+ var result22 = _plc.ReadBytes(_plc.DeltaInstance2, "D80", 11);
+ //提升机报警
+ var result23 = _plc.ReadBytes(_plc.DeltaInstance3, "D100", 1);
+
+ if (result20.IsSuccess && result20.Content != null)
+ {
+ BitArray bits20 = new BitArray(ToolBusiness.SwapAdjacentBytes(result20.Content));
+ bool[] bools20 = new bool[bits20.Count];
+ bits20.CopyTo(bools20, 0);
+ OvenAlarmAnalyse(bools20);
+ }
+
+ if (result21.IsSuccess && result21.Content != null)
+ {
+ BitArray bits21 = new BitArray(ToolBusiness.SwapAdjacentBytes(result21.Content));
+ bool[] bools21 = new bool[bits21.Count];
+ bits21.CopyTo(bools21, 0);
+ VacuumAlarm1Analyse(bools21);
+ }
+
+ if (result22.IsSuccess && result22.Content != null)
+ {
+ BitArray bits22 = new BitArray(ToolBusiness.SwapAdjacentBytes(result22.Content));
+ bool[] bools22 = new bool[bits22.Count];
+ bits22.CopyTo(bools22, 0);
+ VacuumAlarm2Analyse(bools22);
+ }
+
+ if (result23.IsSuccess && result23.Content != null)
+ {
+ BitArray bits23 = new BitArray(ToolBusiness.SwapAdjacentBytes(result23.Content));
+ bool[] bools23 = new bool[bits23.Count];
+ bits23.CopyTo(bools23, 0);
+ LiftAlarmAnalyse(bools23);
+ }
}
-
- if (result20.IsSuccess)
+ catch (Exception ex)
{
- BitArray bits21 = new BitArray(result21.Content);
- bool[] bools21 = new bool[bits21.Count];
- bits21.CopyTo(bools21, 0);
- VacuumAlarm1Analyse(bools21);
- }
-
- if (result20.IsSuccess)
- {
- BitArray bits22 = new BitArray(result22.Content);
- bool[] bools22 = new bool[bits22.Count];
- bits22.CopyTo(bools22, 0);
- VacuumAlarm2Analyse(bools22);
- }
-
- if (result20.IsSuccess)
- {
- BitArray bits23 = new BitArray(result23.Content);
- bool[] bools23 = new bool[bits23.Count];
- bits23.CopyTo(bools23, 0);
- LiftAlarmAnalyse(bools23);
+ _log.Error("报警信息处理发生错误", ex);
}
}
@@ -108,11 +116,11 @@ namespace Sln.Iot.Business
//如果原来没有 现在有 添加错误
if (errorList.Where(x => x.ErrorName == errorMessage.ENAlarmMessage).Count() == 0)
{
- Guid transID = Guid.Parse(trayBindingService.TidGet());
+ Guid.TryParse(trayBindingService.TidGet(), out Guid transID);
Guid logGuid = Guid.NewGuid();
errorService.InsertVacuum1Error(logGuid.ToString(), errorMessage.ENAlarmMessage, errorMessage.CNAlarmMessage, errorMessage.ErrorCode);
connect1.PublishEvent(new CFXEnvelope(faultOccurredEvent.Handle(errorMessage.ErrorCode, LevelTrans(errorMessage.AlarmDegarde), logGuid, errorMessage.ENAlarmMessage + "-Vacuum1", transID)));
- _log.Info($"报警发生 内容:{errorMessage.CNAlarmMessage}");
+ _log.Info($"真空箱1报警发生 内容:{errorMessage.CNAlarmMessage} 级别:{errorMessage.AlarmDegarde.GetDescription()}");
}
}
else
@@ -122,8 +130,9 @@ namespace Sln.Iot.Business
{
//删除错误
string delGuid = errorService.DeleteVacuum2Error(errorMessage.ENAlarmMessage);
- connect1.PublishEvent(new CFXEnvelope(faultClearedEvent.Handle(Guid.Parse(delGuid))));
- _log.Info($"报警消除 内容:{errorMessage.CNAlarmMessage}");
+ Guid.TryParse(delGuid, out Guid guidRes);
+ connect1.PublishEvent(new CFXEnvelope(faultClearedEvent.Handle(guidRes)));
+ _log.Info($"真空箱1报警消除 内容:{errorMessage.CNAlarmMessage} 级别:{errorMessage.AlarmDegarde.GetDescription()}");
}
}
}
@@ -145,11 +154,11 @@ namespace Sln.Iot.Business
//如果原来没有 现在有 添加错误
if (errorList.Where(x => x.ErrorName == errorMessage.ENAlarmMessage).Count() == 0)
{
- Guid transID = Guid.Parse(trayBindingService.TidGet());
+ Guid.TryParse(trayBindingService.TidGet(), out Guid transID);
Guid logGuid = Guid.NewGuid();
errorService.InsertVacuum2Error(logGuid.ToString(), errorMessage.ENAlarmMessage, errorMessage.CNAlarmMessage, errorMessage.ErrorCode);
connect1.PublishEvent(new CFXEnvelope(faultOccurredEvent.Handle(errorMessage.ErrorCode, LevelTrans(errorMessage.AlarmDegarde), logGuid, errorMessage.ENAlarmMessage + "-Vacuum2", transID)));
- _log.Info($"报警发生 内容:{errorMessage.CNAlarmMessage}");
+ _log.Info($"真空箱2报警发生 内容:{errorMessage.CNAlarmMessage} 级别:{errorMessage.AlarmDegarde.GetDescription()}");
}
}
else
@@ -159,8 +168,9 @@ namespace Sln.Iot.Business
{
//删除错误
string delGuid = errorService.DeleteVacuum2Error(errorMessage.ENAlarmMessage);
- connect1.PublishEvent(new CFXEnvelope(faultClearedEvent.Handle(Guid.Parse(delGuid))));
- _log.Info($"报警消除 内容:{errorMessage.CNAlarmMessage}");
+ Guid.TryParse(delGuid, out Guid guidRes);
+ connect1.PublishEvent(new CFXEnvelope(faultClearedEvent.Handle(guidRes)));
+ _log.Info($"真空箱2报警消除 内容:{errorMessage.CNAlarmMessage} 级别:{errorMessage.AlarmDegarde.GetDescription()}");
}
}
}
@@ -182,11 +192,11 @@ namespace Sln.Iot.Business
//如果原来没有 现在有 添加错误
if (errorList.Where(x => x.ErrorName == errorMessage.ENAlarmMessage).Count() == 0)
{
- Guid transID = Guid.Parse(trayBindingService.TidGet());
+ Guid.TryParse(trayBindingService.TidGet(), out Guid transID);
Guid logGuid = Guid.NewGuid();
errorService.InsertLiftError(logGuid.ToString(), errorMessage.ENAlarmMessage, errorMessage.CNAlarmMessage, errorMessage.ErrorCode);
connect2.PublishEvent(new CFXEnvelope(faultOccurredEvent.Handle(errorMessage.ErrorCode, LevelTrans(errorMessage.AlarmDegarde), logGuid, errorMessage.ENAlarmMessage, transID)));
- _log.Info($"报警发生 内容:{errorMessage.CNAlarmMessage}");
+ _log.Info($"提升机报警发生 内容:{errorMessage.CNAlarmMessage} 级别:{errorMessage.AlarmDegarde.GetDescription()}");
}
}
else
@@ -196,8 +206,9 @@ namespace Sln.Iot.Business
{
//删除错误
string delGuid = errorService.DeleteliftError(errorMessage.ENAlarmMessage);
- connect2.PublishEvent(new CFXEnvelope(faultClearedEvent.Handle(Guid.Parse(delGuid))));
- _log.Info($"报警消除 内容:{errorMessage.CNAlarmMessage}");
+ Guid.TryParse(delGuid, out Guid guidRes);
+ connect2.PublishEvent(new CFXEnvelope(faultClearedEvent.Handle(guidRes)));
+ _log.Info($"提升机报警消除 内容:{errorMessage.CNAlarmMessage} 级别:{errorMessage.AlarmDegarde.GetDescription()}");
}
}
}
@@ -219,11 +230,11 @@ namespace Sln.Iot.Business
//如果原来没有 现在有 添加错误
if (errorList.Where(x => x.ErrorName == errorMessage.ENAlarmMessage).Count() == 0)
{
- Guid transID = Guid.Parse(trayBindingService.TidGet());
+ Guid.TryParse(trayBindingService.TidGet(), out Guid transID);
Guid logGuid = Guid.NewGuid();
errorService.InsertOvenError(logGuid.ToString(), errorMessage.ENAlarmMessage, errorMessage.CNAlarmMessage, errorMessage.ErrorCode);
connect3.PublishEvent(new CFXEnvelope(faultOccurredEvent.Handle(errorMessage.ErrorCode, LevelTrans(errorMessage.AlarmDegarde), logGuid, errorMessage.ENAlarmMessage, transID)));
- _log.Info($"报警发生 内容:{errorMessage.CNAlarmMessage}");
+ _log.Info($"烤箱报警发生 内容:{errorMessage.CNAlarmMessage} 级别:{errorMessage.AlarmDegarde.GetDescription()}");
}
}
else
@@ -233,8 +244,9 @@ namespace Sln.Iot.Business
{
//删除错误
string delGuid = errorService.DeleteOvenError(errorMessage.ENAlarmMessage);
- connect3.PublishEvent(new CFXEnvelope(faultClearedEvent.Handle(Guid.Parse(delGuid))));
- _log.Info($"报警消除 内容:{errorMessage.CNAlarmMessage}");
+ Guid.TryParse(delGuid, out Guid guidRes);
+ connect3.PublishEvent(new CFXEnvelope(faultClearedEvent.Handle(guidRes)));
+ _log.Info($"烤箱报警消除 内容:{errorMessage.CNAlarmMessage} 级别:{errorMessage.AlarmDegarde.GetDescription()}");
}
}
}
diff --git a/Sln.Iot.Business/RFID01Business.cs b/Sln.Iot.Business/RFID01Business.cs
index 3709b85..f2e8afd 100644
--- a/Sln.Iot.Business/RFID01Business.cs
+++ b/Sln.Iot.Business/RFID01Business.cs
@@ -46,71 +46,78 @@ namespace Sln.Iot.Business
///
public void TimerCallback(object? state)
{
- // 定时任务逻辑
- //读取信号
- OperateResult signalRes = _plc.ReadInt16(_plc.DeltaInstance3, "D500");
- //成功验证
- if (signalRes.IsSuccess)
+ try
{
- short signalValue = signalRes.Content;
- //如果有读取信号
- if (signalValue == 1001)
+ // 定时任务逻辑
+ //读取信号
+ OperateResult signalRes = _plc.ReadInt16(_plc.DeltaInstance3, "D500");
+ //成功验证
+ if (signalRes.IsSuccess)
{
- //读取托盘码和产品码
- OperateResult trayBytesResult = _plc.ReadBytes(_plc.DeltaInstance3, "D5000", 10);
- OperateResult pordBytesResult = _plc.ReadBytes(_plc.DeltaInstance3, "D8000", 60);
- //成功验证
- if (trayBytesResult.IsSuccess && pordBytesResult.IsSuccess)
+ short signalValue = signalRes.Content;
+ //如果有读取信号
+ if (signalValue == 1001)
{
- //转换托盘码
- string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
- _log.Info(traycode);
- byte[] prodBytes = pordBytesResult.Content;
- string[] prodcode = new string[6];
- //分割转换产品码
- for (int i = 0; i < 6; i++)
+ //读取托盘码和产品码
+ OperateResult trayBytesResult = _plc.ReadBytes(_plc.DeltaInstance3, "D5000", 10);
+ OperateResult pordBytesResult = _plc.ReadBytes(_plc.DeltaInstance3, "D8000", 60);
+ //成功验证
+ if (trayBytesResult.IsSuccess && pordBytesResult.IsSuccess)
{
- prodcode[i] = Encoding.ASCII.GetString(prodBytes[(i * 20)..(i * 20 + 20)]);
+ //转换托盘码
+ string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
+ _log.Info("RFID01" + traycode);
+ byte[] prodBytes = pordBytesResult.Content;
+ string[] prodcode = new string[6];
+ //分割转换产品码
+ for (int i = 0; i < 6; i++)
+ {
+ prodcode[i] = Encoding.ASCII.GetString(prodBytes[(i * 20)..(i * 20 + 20)]);
+ }
+
+ connect1.SendValidateUnitsRequest("", traycode, prodcode);
+
+ //生成work唯一guid(tid)
+ Guid tid = new Guid();
+ //sql更新
+ bool res = trayBindingService.TrayBindingRefresh(tid, traycode, prodcode);
+ if (!res)
+ {
+ _log.Error("上料提升机数据库写入异常");
+ }
+
+ //写入完成信号
+ res = _plc.PlcWrite(_plc.DeltaInstance3, "D500", 1002, DataTypeEnum.UInt16).IsSuccess;
+ if (!res)
+ {
+ _log.Error("上料提升机PLC写入完成信号异常");
+ }
+
+ //CFX
+ Task.Run(() =>
+ {
+ //单元抵达事件
+ connect2.PublishEvent(new CFXEnvelope(unitsArrivedEvent.Handle(traycode, prodcode)));
+ _log.Info($"{traycode} 抵达设备");
+ //工作开始事件
+ connect2.PublishEvent(new CFXEnvelope(workStartedEvent.Handle(tid, traycode, prodcode)));
+ _log.Info($"工作开始,ID:{tid}");
+ //预热炉工段开启
+ connect3.PublishEvent(new CFXEnvelope(workStageStartedEvent.Handle(tid, "PreHeatOven", 1)));
+ _log.Info($"预热炉工段开始 ID:{tid}");
+ });
}
-
- connect1.SendValidateUnitsRequest("", traycode, prodcode);
-
- //生成work唯一guid(tid)
- Guid tid = new Guid();
- //sql更新
- bool res = trayBindingService.TrayBindingRefresh(tid, traycode, prodcode);
- if (!res)
- {
- _log.Error("上料提升机数据库写入异常");
- }
-
- //写入完成信号
- res = _plc.PlcWrite(_plc.DeltaInstance3, "D500", 1002, DataTypeEnum.UInt16).IsSuccess;
- if (!res)
- {
- _log.Error("上料提升机PLC写入完成信号异常");
- }
-
- //CFX
- Task.Run(() =>
- {
- //单元抵达事件
- connect2.PublishEvent(new CFXEnvelope(unitsArrivedEvent.Handle(traycode, prodcode)));
- _log.Info($"{traycode} 抵达设备");
- //工作开始事件
- connect2.PublishEvent(new CFXEnvelope(workStartedEvent.Handle(tid, traycode, prodcode)));
- _log.Info($"工作开始,ID:{tid}");
- //预热炉工段开启
- connect3.PublishEvent(new CFXEnvelope(workStageStartedEvent.Handle(tid, "PreHeatOven", 1)));
- _log.Info($"预热炉工段开始 ID:{tid}");
- });
+ //流程完成
}
- //流程完成
+ }
+ else
+ {
+ _log.Error("上料提升机PLC读取信号异常");
}
}
- else
+ catch (Exception ex)
{
- _log.Error("上料提升机PLC读取信号异常");
+ _log.Error("RFID01业务出现异常", ex);
}
}
}
diff --git a/Sln.Iot.Business/RFID02Business.cs b/Sln.Iot.Business/RFID02Business.cs
index 9d73d72..340cc15 100644
--- a/Sln.Iot.Business/RFID02Business.cs
+++ b/Sln.Iot.Business/RFID02Business.cs
@@ -46,84 +46,93 @@ namespace Sln.Iot.Business
///
public void TimerCallback(object? state)
{
- // 定时任务逻辑
- //读取信号
- OperateResult signalRes = _plc.ReadInt16(_plc.DeltaInstance1, "D800");
- //成功验证
- if (signalRes.IsSuccess)
+ try
{
- short signalValue = signalRes.Content;
- //如果有读取信号
- if (signalValue == 2001)
+ // 定时任务逻辑
+ //读取信号
+ OperateResult signalRes = _plc.ReadInt16(_plc.DeltaInstance1, "D800");
+ //成功验证
+ if (signalRes.IsSuccess)
{
- //读取托盘码
- OperateResult trayBytesResult = _plc.ReadBytes(_plc.DeltaInstance1, "D5000", 10);
- //成功验证
- if (trayBytesResult.IsSuccess)
+ short signalValue = signalRes.Content;
+ //如果有读取信号
+ if (signalValue == 2001)
{
- //转换托盘码
- string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
-
- //sql更新
-
- //待开发 记录数据
- //取出work唯一guid(tid)
- string stid = trayBindingService.TidGet(traycode);
- Guid.TryParse(stid, out Guid tid);
-
- bool res = false;
- if (!res)
+ //读取托盘码
+ OperateResult trayBytesResult = _plc.ReadBytes(_plc.DeltaInstance1, "D5000", 10);
+ //成功验证
+ if (trayBytesResult.IsSuccess)
{
- _log.Error("胶机1真空箱内数据库写入异常");
+ //转换托盘码
+ string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
+ _log.Info("RFID02" + traycode);
+
+ //sql更新
+
+ //待开发 记录数据
+ //取出work唯一guid(tid)
+ string stid = trayBindingService.TidGet(traycode);
+ Guid.TryParse(stid, out Guid tid);
+
+ bool res = false;
+ if (!res)
+ {
+ _log.Error("胶机1真空箱内数据库写入异常");
+ }
+
+ //写入完成信号
+ res = _plc.PlcWrite(_plc.DeltaInstance1, "D800", 2002, DataTypeEnum.UInt16).IsSuccess;
+ if (!res)
+ {
+ _log.Error("胶机1真空箱内写入完成信号异常");
+ }
+
+ //CFX
+ Task.Run(() =>
+ {
+ //预热炉工段完成事件
+ connect3.PublishEvent(new CFXEnvelope(workStageCompletedEvent.Handle(tid, "PreHeatOven", 1)));
+ _log.Info($"预热炉工段完成 ID:{tid}");
+ //真空箱1工段开启
+ connect1.PublishEvent(new CFXEnvelope(workStageStartedEvent.Handle(tid, "VacuumInjection1", 1)));
+ _log.Info($"真空箱1工段开始 ID:{tid}");
+
+
+ //预热炉数据采集
+ var data = unitsProcessPLCDataGetBusiness.PreHeatOvenPlcDataGet();
+ ovenPlcDataService.InsertData(stid, data);
+ _log.Info($"预热炉数据采集, {data}");
+ //真空箱1数据采集
+ var data2 = unitsProcessPLCDataGetBusiness.Vacuum1PlcDataGet();
+ vacuumInjectionPlcDataService.InsertData(stid, data2);
+ _log.Info($"真空箱1温度数据采集, " +
+ $"GlueAmountSetValue1:{data2.GlueAmountSetValue1} " +
+ $"GluePushSpeedSetValue1:{data2.GluePushSpeedSetValue1} " +
+ $"BarrelA1TempActValue1:{data2.BarrelA1TempActValue1} " +
+ $"BarrelA2TempActValue1:{data2.BarrelA2TempActValue1} " +
+ $"BarrelB1TempActValue1:{data2.BarrelB1TempActValue1} " +
+ $"BarrelB2TempActValue1:{data2.BarrelB2TempActValue1} " +
+ $"PumpAPressureActValue1:{data2.PumpAPressureActValue1} " +
+ $"PumpBPressureActValue1:{data2.PumpBPressureActValue1} " +
+ $"VacuumDegreeActValue1:{data2.VacuumDegreeActValue1} " +
+ $"PressureHoldTimeSetValue1:{data2.PressureHoldTimeSetValue1}");
+ });
+
+ //CFX
}
-
- //写入完成信号
- res = _plc.PlcWrite(_plc.DeltaInstance1, "D800", 2002, DataTypeEnum.UInt16).IsSuccess;
- if (!res)
- {
- _log.Error("胶机1真空箱内写入完成信号异常");
- }
-
- //CFX
- Task.Run(() =>
- {
- //预热炉工段完成事件
- connect3.PublishEvent(new CFXEnvelope(workStageCompletedEvent.Handle(tid, "PreHeatOven", 1)));
- _log.Info($"预热炉工段完成 ID:{tid}");
- //真空箱1工段开启
- connect1.PublishEvent(new CFXEnvelope(workStageStartedEvent.Handle(tid, "VacuumInjection1", 1)));
- _log.Info($"真空箱1工段开始 ID:{tid}");
-
-
- //预热炉数据采集
- var data = unitsProcessPLCDataGetBusiness.PreHeatOvenPlcDataGet();
- ovenPlcDataService.InsertData(stid, data);
- _log.Info($"预热炉数据采集, {data}");
- //真空箱1数据采集
- var data2 = unitsProcessPLCDataGetBusiness.Vacuum1PlcDataGet();
- vacuumInjectionPlcDataService.InsertData(stid, data2);
- _log.Info($"真空箱1温度数据采集, " +
- $"GlueAmountSetValue1:{data2.GlueAmountSetValue1} " +
- $"GluePushSpeedSetValue1:{data2.GluePushSpeedSetValue1} " +
- $"BarrelA1TempActValue1:{data2.BarrelA1TempActValue1} " +
- $"BarrelA2TempActValue1:{data2.BarrelA2TempActValue1} " +
- $"BarrelB1TempActValue1:{data2.BarrelB1TempActValue1} " +
- $"BarrelB2TempActValue1:{data2.BarrelB2TempActValue1} " +
- $"PumpAPressureActValue1:{data2.PumpAPressureActValue1} " +
- $"PumpBPressureActValue1:{data2.PumpBPressureActValue1} " +
- $"VacuumDegreeActValue1:{data2.VacuumDegreeActValue1} " +
- $"PressureHoldTimeSetValue1:{data2.PressureHoldTimeSetValue1}");
- });
-
- //CFX
+ //流程完成
}
- //流程完成
+ }
+ else
+ {
+ _log.Error("胶机1真空箱内PLC读取信号异常");
}
}
- else
+ catch (Exception ex)
{
- _log.Error("胶机1真空箱内PLC读取信号异常");
+ _log.Error("RFID02业务出现异常", ex);
}
+
}
}
}
diff --git a/Sln.Iot.Business/RFID03Business.cs b/Sln.Iot.Business/RFID03Business.cs
index 3365454..ec361e6 100644
--- a/Sln.Iot.Business/RFID03Business.cs
+++ b/Sln.Iot.Business/RFID03Business.cs
@@ -40,59 +40,67 @@ namespace Sln.Iot.Business
///
public void TimerCallback(object? state)
{
- // 定时任务逻辑
- //读取信号
- OperateResult signalRes = _plc.ReadInt16(_plc.DeltaInstance1, "D802");
- //成功验证
- if (signalRes.IsSuccess)
+ try
{
- short signalValue = signalRes.Content;
- //如果有读取信号
- if (signalValue == 3001)
+ // 定时任务逻辑
+ //读取信号
+ OperateResult signalRes = _plc.ReadInt16(_plc.DeltaInstance1, "D802");
+ //成功验证
+ if (signalRes.IsSuccess)
{
- //读取托盘码
- OperateResult trayBytesResult = _plc.ReadBytes(_plc.DeltaInstance1, "D5020", 10);
- //成功验证
- if (trayBytesResult.IsSuccess)
+ short signalValue = signalRes.Content;
+ //如果有读取信号
+ if (signalValue == 3001)
{
- //转换托盘码
- string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
-
- //sql更新
- //取出work唯一guid(tid)
- string stid = trayBindingService.TidGet(traycode);
- Guid.TryParse(stid, out Guid tid);
-
- bool res = trayBindingService.UpDateTime(DateTime.Now.ToString(), traycode, "1");
- if (!res)
+ //读取托盘码
+ OperateResult trayBytesResult = _plc.ReadBytes(_plc.DeltaInstance1, "D5020", 10);
+ //成功验证
+ if (trayBytesResult.IsSuccess)
{
- _log.Error("胶机1真空箱外数据库写入异常");
+ //转换托盘码
+ string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
+ _log.Info("RFID03" + traycode);
+
+ //sql更新
+ //取出work唯一guid(tid)
+ string stid = trayBindingService.TidGet(traycode);
+ Guid.TryParse(stid, out Guid tid);
+
+ bool res = trayBindingService.UpDateTime(DateTime.Now.ToString(), traycode, "1");
+ if (!res)
+ {
+ _log.Error("胶机1真空箱外数据库写入异常");
+ }
+
+ //写入完成信号
+ res = _plc.PlcWrite(_plc.DeltaInstance1, "D802", 3002, DataTypeEnum.UInt16).IsSuccess;
+ if (!res)
+ {
+ _log.Error("胶机1真空箱外写入完成信号异常");
+ }
+
+ //CFX
+ Task.Run(() =>
+ {
+ //真空箱1工段完成事件
+ connect1.PublishEvent(new CFXEnvelope(workStageCompletedEvent.Handle(tid, "VacuumInjection1", 1)));
+ _log.Info($"真空箱1工段完成, {tid}");
+ //预固炉工段开启
+ connect3.PublishEvent(new CFXEnvelope(workStageStartedEvent.Handle(tid, "PreCureOven", 2)));
+ _log.Info($"预固炉工段开启, {tid}");
+ });
}
-
- //写入完成信号
- res = _plc.PlcWrite(_plc.DeltaInstance1, "D802", 3002, DataTypeEnum.UInt16).IsSuccess;
- if (!res)
- {
- _log.Error("胶机1真空箱外写入完成信号异常");
- }
-
- //CFX
- Task.Run(() =>
- {
- //真空箱1工段完成事件
- connect1.PublishEvent(new CFXEnvelope(workStageCompletedEvent.Handle(tid, "VacuumInjection1", 1)));
- _log.Info($"真空箱1工段完成, {tid}");
- //预固炉工段开启
- connect3.PublishEvent(new CFXEnvelope(workStageStartedEvent.Handle(tid, "PreCureOven", 2)));
- _log.Info($"预固炉工段开启, {tid}");
- });
+ //流程完成
}
- //流程完成
+ }
+ else
+ {
+ _log.Error("胶机1真空箱外PLC读取信号异常");
}
}
- else
+ catch (Exception ex)
{
- _log.Error("胶机1真空箱外PLC读取信号异常");
+ _log.Error("RFID0业务出现异常", ex);
}
}
}
diff --git a/Sln.Iot.Business/RFID04Business.cs b/Sln.Iot.Business/RFID04Business.cs
index e0e5282..9082d5f 100644
--- a/Sln.Iot.Business/RFID04Business.cs
+++ b/Sln.Iot.Business/RFID04Business.cs
@@ -10,6 +10,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using TouchSocket.Core;
using static System.Runtime.CompilerServices.RuntimeHelpers;
namespace Sln.Iot.Business
@@ -44,106 +45,119 @@ namespace Sln.Iot.Business
///
public void TimerCallback(object? state)
{
- // 定时任务逻辑
- //读取信号
- OperateResult signalRes = _plc.ReadInt16(_plc.DeltaInstance2, "D800");
- //成功验证
- if (signalRes.IsSuccess)
+ try
{
- short signalValue = signalRes.Content;
- //如果有读取信号
- // 读电子标签
- if (signalValue == 4001)
+ // 定时任务逻辑
+ //读取信号
+ OperateResult signalRes = _plc.ReadInt16(_plc.DeltaInstance2, "D800");
+ //成功验证
+ if (signalRes.IsSuccess)
{
- //读取托盘码和产品码
- OperateResult trayBytesResult = _plc.ReadBytes(_plc.DeltaInstance2, "D5000", 10);
- //成功验证
- if (trayBytesResult.IsSuccess)
+ short signalValue = signalRes.Content;
+ // 如果有读取信号
+ // 读电子标签
+ if (signalValue == 4001)
{
- //转换托盘吗
- string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
-
- //sql更新
- //取出work唯一guid(tid)
- string stid = trayBindingService.TidGet(traycode);
- Guid.TryParse(stid, out Guid tid);
-
- bool res = trayBindingService.UpDateTime(DateTime.Now.ToString(), traycode, "2");
- if (!res)
+ //读取托盘码和产品码
+ OperateResult trayBytesResult = _plc.ReadBytes(_plc.DeltaInstance2, "D5000", 10);
+ //成功验证
+ if (trayBytesResult.IsSuccess)
{
- _log.Error("胶机2真空箱前开始时间数据库写入异常");
+ //转换托盘吗
+ string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
+ _log.Info("RFID04" + traycode);
+
+ //sql更新
+ //取出work唯一guid(tid)
+ string stid = trayBindingService.TidGet(traycode);
+ Guid.TryParse(stid, out Guid tid);
+
+ bool res = trayBindingService.UpDateTime(DateTime.Now.ToString(), traycode, "2");
+ if (!res)
+ {
+ _log.Error("胶机2真空箱前开始时间数据库写入异常");
+ }
+
+ //写入完成信号
+ res = _plc.PlcWrite(_plc.DeltaInstance2, "D800", 4002, DataTypeEnum.UInt16).IsSuccess;
+ if (!res)
+ {
+ _log.Error("胶机2真空箱前开始时间PLC写入完成信号异常");
+ }
+
+ //CFX
+ Task.Run(() =>
+ {
+ //预固炉工段完成事件
+ connect3.PublishEvent(new CFXEnvelope(workStageCompletedEvent.Handle(tid, "PreCureOven", 2)));
+ _log.Info($"预固炉工段完成, {tid}");
+ //真空箱2工段开启
+ connect1.PublishEvent(new CFXEnvelope(workStageStartedEvent.Handle(tid, "VacuumInjection2", 2)));
+ _log.Info($"真空箱2工段开启, {tid}");
+
+ //预固炉数据采集
+ var data = unitsProcessPLCDataGetBusiness.PreCureOvenPlcDataGet();
+ ovenPlcDataService.UpdateDataPreCure(stid, data);
+ _log.Info($"预固炉温度数据采集, " +
+ $"PreCureOven1TempActValue:{data.PreCureOven1TempActValue} " +
+ $"PreCureOven2TempActValue:{data.PreCureOven2TempActValue} " +
+ $"PreCureOven3TempActValue:{data.PreCureOven3TempActValue} " +
+ $"PreCureOven4TempActValue:{data.PreCureOven4TempActValue}");
+ });
}
-
- //写入完成信号
- res = _plc.PlcWrite(_plc.DeltaInstance2, "D800", 4002, DataTypeEnum.UInt16).IsSuccess;
- if (!res)
- {
- _log.Error("胶机2真空箱前开始时间PLC写入完成信号异常");
- }
-
- //CFX
- Task.Run(() =>
- {
- //预固炉工段完成事件
- connect3.PublishEvent(new CFXEnvelope(workStageCompletedEvent.Handle(tid, "PreCureOven", 2)));
- _log.Info($"预固炉工段完成, {tid}");
- //真空箱2工段开启
- connect1.PublishEvent(new CFXEnvelope(workStageStartedEvent.Handle(tid, "VacuumInjection2", 2)));
- _log.Info($"真空箱2工段开启, {tid}");
-
- //预固炉数据采集
- var data = unitsProcessPLCDataGetBusiness.PreCureOvenPlcDataGet();
- ovenPlcDataService.UpdateDataPreCure(stid, data);
- _log.Info($"预固炉温度数据采集, " +
- $"PreCureOven1TempActValue:{data.PreCureOven1TempActValue} " +
- $"PreCureOven2TempActValue:{data.PreCureOven2TempActValue} " +
- $"PreCureOven3TempActValue:{data.PreCureOven3TempActValue} " +
- $"PreCureOven4TempActValue:{data.PreCureOven4TempActValue}");
- });
+ //流程完成
+ }
+ // 计算时间差
+ if (signalValue == 4003)
+ {
+ //读取托盘码
+ OperateResult trayBytesResult = _plc.ReadBytes(_plc.DeltaInstance2, "D5000", 10);
+ //成功验证
+ if (trayBytesResult.IsSuccess)
+ {
+ //转换托盘吗
+ string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
+
+ //sql更新
+ string nowTime = DateTime.Now.ToString();
+ bool res = TrayBindingService.Instance.UpDateTime(nowTime, traycode, "3");
+ if (!res)
+ {
+ _log.Error("胶机2真空箱前时间计算数据库写入异常");
+ }
+ //取之前存的时间
+ string time2 = TrayBindingService.Instance.GetTime2ByTrayCode(traycode);
+ ushort spanSecond = 0;
+ if (!time2.IsNullOrEmpty())
+ {
+ //计算时间差
+ TimeSpan span = Convert.ToDateTime(time2) - Convert.ToDateTime(nowTime);
+ spanSecond = (ushort)span.TotalSeconds;
+ _log.Info($"预固炉时间差" + spanSecond);
+ }
+ res = _plc.PlcWrite(_plc.DeltaInstance2, "D810", spanSecond, DataTypeEnum.UInt16).IsSuccess;
+ if (!res)
+ {
+ _log.Error("胶机2真空箱前时间计算结果PLC写入异常");
+ }
+ //写入完成信号
+ res = _plc.PlcWrite(_plc.DeltaInstance2, "D800", 4004, DataTypeEnum.UInt16).IsSuccess;
+ if (!res)
+ {
+ _log.Error("胶机2真空箱前时间计算PLC写入完成信号异常");
+ }
+ }
+ //流程完成
}
- //流程完成
}
- // 计算时间差
- if(signalValue == 4003)
+ else
{
- //读取托盘码
- OperateResult trayBytesResult = _plc.ReadBytes(_plc.DeltaInstance2, "D5000", 10);
- //成功验证
- if (trayBytesResult.IsSuccess)
- {
- //转换托盘吗
- string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
-
- //sql更新
- string nowTime = DateTime.Now.ToString();
- bool res = TrayBindingService.Instance.UpDateTime(nowTime, traycode, "3");
- if (!res)
- {
- _log.Error("胶机2真空箱前时间计算数据库写入异常");
- }
- //取之前存的时间
- string time2 = TrayBindingService.Instance.GetTime2ByTrayCode(traycode);
- //计算时间差
- TimeSpan span = Convert.ToDateTime(time2) - Convert.ToDateTime(nowTime);
- ushort spanSecond = (ushort)span.TotalSeconds;
- res = _plc.PlcWrite(_plc.DeltaInstance2, "D810", spanSecond, DataTypeEnum.UInt16).IsSuccess;
- if (!res)
- {
- _log.Error("胶机2真空箱前时间计算结果PLC写入异常");
- }
- //写入完成信号
- res = _plc.PlcWrite(_plc.DeltaInstance2, "D800", 4004, DataTypeEnum.UInt16).IsSuccess;
- if (!res)
- {
- _log.Error("胶机2真空箱前时间计算PLC写入完成信号异常");
- }
- }
- //流程完成
+ _log.Error("胶机2真空箱前开始时间读PLC取信号异常");
}
}
- else
+ catch (Exception ex)
{
- _log.Error("胶机2真空箱前开始时间读PLC取信号异常");
+ _log.Error("RFID0业务出现异常", ex);
}
}
}
diff --git a/Sln.Iot.Business/RFID05Business.cs b/Sln.Iot.Business/RFID05Business.cs
index 368eed6..2bda91b 100644
--- a/Sln.Iot.Business/RFID05Business.cs
+++ b/Sln.Iot.Business/RFID05Business.cs
@@ -48,96 +48,105 @@ namespace Sln.Iot.Business
///
public void TimerCallback(object? state)
{
- // 定时任务逻辑
- //读取信号
- OperateResult signalRes = _plc.ReadInt16(_plc.DeltaInstance2, "D802");
- //成功验证
- if (signalRes.IsSuccess)
+ try
{
- short signalValue = signalRes.Content;
- //如果有读取信号
- if (signalValue == 5001)
+ // 定时任务逻辑
+ //读取信号
+ OperateResult signalRes = _plc.ReadInt16(_plc.DeltaInstance2, "D802");
+ //成功验证
+ if (signalRes.IsSuccess)
{
- //读取托盘码
- OperateResult trayBytesResult = _plc.ReadBytes(_plc.DeltaInstance2, "D5020", 10);
- //成功验证
- if (trayBytesResult.IsSuccess)
+ short signalValue = signalRes.Content;
+ //如果有读取信号
+ if (signalValue == 5001)
{
- //转换托盘吗
- string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
-
- //sql更新
- //取出work唯一guid(tid)
- string stid = trayBindingService.TidGet(traycode);
- Guid.TryParse(stid, out Guid tid);
-
- bool res = trayBindingService.UpDateTime(DateTime.Now.ToString(), traycode, "4");
- if (!res)
+ //读取托盘码
+ OperateResult trayBytesResult = _plc.ReadBytes(_plc.DeltaInstance2, "D5020", 10);
+ //成功验证
+ if (trayBytesResult.IsSuccess)
{
- _log.Error("胶机2真空箱后数据库写入异常");
+ //转换托盘吗
+ string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
+ _log.Info("RFID05" + traycode);
+
+ //sql更新
+ //取出work唯一guid(tid)
+ string stid = trayBindingService.TidGet(traycode);
+ Guid.TryParse(stid, out Guid tid);
+
+ bool res = trayBindingService.UpDateTime(DateTime.Now.ToString(), traycode, "4");
+ if (!res)
+ {
+ _log.Error("胶机2真空箱后数据库写入异常");
+ }
+
+ //写入完成信号
+ res = _plc.PlcWrite(_plc.DeltaInstance2, "D802", 5002, DataTypeEnum.UInt16).IsSuccess;
+ if (!res)
+ {
+ _log.Error("胶机2真空箱后PLC写入完成信号异常");
+ }
+
+ //CFX
+ Task.Run(() =>
+ {
+ //真空箱2工段完成事件
+ connect1.PublishEvent(new CFXEnvelope(workStageCompletedEvent.Handle(tid, "VacuumInjection2", 2)));
+ _log.Info($"真空箱2工段完成, {tid}");
+ //固化炉工段开启
+ connect3.PublishEvent(new CFXEnvelope(workStageStartedEvent.Handle(tid, "CureOven", 3)));
+ _log.Info($"固化炉工段开启, {tid}");
+
+ //真空箱获取并上传数据
+ var unitsData1 = vacuumInjectionPlcDataService.GetData(stid);
+ var unitsData2 = unitsProcessPLCDataGetBusiness.Vacuum2PlcDataGet();
+ unitsData1.GlueAmountSetValue2 = unitsData2.GlueAmountSetValue2;
+ unitsData1.GluePushSpeedSetValue2 = unitsData2.GluePushSpeedSetValue2;
+ unitsData1.BarrelA1TempActValue2 = unitsData2.BarrelA1TempActValue2;
+ unitsData1.BarrelA2TempActValue2 = unitsData2.BarrelA2TempActValue2;
+ unitsData1.BarrelB1TempActValue2 = unitsData2.BarrelB1TempActValue2;
+ unitsData1.BarrelB2TempActValue2 = unitsData2.BarrelB2TempActValue2;
+ unitsData1.PumpAPressureActValue2 = unitsData2.PumpAPressureActValue2;
+ unitsData1.PumpBPressureActValue2 = unitsData2.PumpBPressureActValue2;
+ unitsData1.VacuumDegreeActValue2 = unitsData2.VacuumDegreeActValue2;
+ unitsData1.PressureHoldTimeSetValue2 = unitsData2.PressureHoldTimeSetValue2;
+ connect1.PublishEvent(new CFXEnvelope(unitsProcessedEvent.Handle(tid, cFXUnitProcessedDataGet.ProcessDataGet1(unitsData1))));
+ _log.Info($"真空箱温度数据上传, " +
+ $"GlueAmountSetValue1:{unitsData1.GlueAmountSetValue1} " +
+ $"GluePushSpeedSetValue1:{unitsData1.GluePushSpeedSetValue1} " +
+ $"BarrelA1TempActValue1:{unitsData1.BarrelA1TempActValue1} " +
+ $"BarrelA2TempActValue1:{unitsData1.BarrelA2TempActValue1} " +
+ $"BarrelB1TempActValue1:{unitsData1.BarrelB1TempActValue1} " +
+ $"BarrelB2TempActValue1:{unitsData1.BarrelB2TempActValue1} " +
+ $"PumpAPressureActValue1:{unitsData1.PumpAPressureActValue1} " +
+ $"PumpBPressureActValue1:{unitsData1.PumpBPressureActValue1} " +
+ $"VacuumDegreeActValue1:{unitsData1.VacuumDegreeActValue1} " +
+ $"PressureHoldTimeSetValue1:{unitsData1.PressureHoldTimeSetValue1} " +
+ $"GlueAmountSetValue2:{unitsData1.GlueAmountSetValue2} " +
+ $"GluePushSpeedSetValue2:{unitsData1.GluePushSpeedSetValue2} " +
+ $"BarrelA1TempActValue2:{unitsData1.BarrelA1TempActValue2} " +
+ $"BarrelA2TempActValue2:{unitsData1.BarrelA2TempActValue2} " +
+ $"BarrelB1TempActValue2:{unitsData1.BarrelB1TempActValue2} " +
+ $"BarrelB2TempActValue2:{unitsData1.BarrelB2TempActValue2} " +
+ $"PumpAPressureActValue2:{unitsData1.PumpAPressureActValue2} " +
+ $"PumpBPressureActValue2:{unitsData1.PumpBPressureActValue2} " +
+ $"VacuumDegreeActValue2:{unitsData1.VacuumDegreeActValue2} " +
+ $"PressureHoldTimeSetValue2:{unitsData1.PressureHoldTimeSetValue2}");
+ });
}
-
- //写入完成信号
- res = _plc.PlcWrite(_plc.DeltaInstance2, "D802", 5002, DataTypeEnum.UInt16).IsSuccess;
- if (!res)
- {
- _log.Error("胶机2真空箱后PLC写入完成信号异常");
- }
-
- //CFX
- Task.Run(() =>
- {
- //真空箱2工段完成事件
- connect1.PublishEvent(new CFXEnvelope(workStageCompletedEvent.Handle(tid, "VacuumInjection2", 2)));
- _log.Info($"真空箱2工段完成, {tid}");
- //固化炉工段开启
- connect3.PublishEvent(new CFXEnvelope(workStageStartedEvent.Handle(tid, "CureOven", 3)));
- _log.Info($"固化炉工段开启, {tid}");
-
- //真空箱获取并上传数据
- var unitsData1 = vacuumInjectionPlcDataService.GetData(stid);
- var unitsData2 = unitsProcessPLCDataGetBusiness.Vacuum2PlcDataGet();
- unitsData1.GlueAmountSetValue2 = unitsData2.GlueAmountSetValue2;
- unitsData1.GluePushSpeedSetValue2 = unitsData2.GluePushSpeedSetValue2;
- unitsData1.BarrelA1TempActValue2 = unitsData2.BarrelA1TempActValue2;
- unitsData1.BarrelA2TempActValue2 = unitsData2.BarrelA2TempActValue2;
- unitsData1.BarrelB1TempActValue2 = unitsData2.BarrelB1TempActValue2;
- unitsData1.BarrelB2TempActValue2 = unitsData2.BarrelB2TempActValue2;
- unitsData1.PumpAPressureActValue2 = unitsData2.PumpAPressureActValue2;
- unitsData1.PumpBPressureActValue2 = unitsData2.PumpBPressureActValue2;
- unitsData1.VacuumDegreeActValue2 = unitsData2.VacuumDegreeActValue2;
- unitsData1.PressureHoldTimeSetValue2 = unitsData2.PressureHoldTimeSetValue2;
- connect1.PublishEvent(new CFXEnvelope(unitsProcessedEvent.Handle(tid, cFXUnitProcessedDataGet.ProcessDataGet1(unitsData1))));
- _log.Info($"真空箱温度数据上传, " +
- $"GlueAmountSetValue1:{unitsData1.GlueAmountSetValue1} " +
- $"GluePushSpeedSetValue1:{unitsData1.GluePushSpeedSetValue1} " +
- $"BarrelA1TempActValue1:{unitsData1.BarrelA1TempActValue1} " +
- $"BarrelA2TempActValue1:{unitsData1.BarrelA2TempActValue1} " +
- $"BarrelB1TempActValue1:{unitsData1.BarrelB1TempActValue1} " +
- $"BarrelB2TempActValue1:{unitsData1.BarrelB2TempActValue1} " +
- $"PumpAPressureActValue1:{unitsData1.PumpAPressureActValue1} " +
- $"PumpBPressureActValue1:{unitsData1.PumpBPressureActValue1} " +
- $"VacuumDegreeActValue1:{unitsData1.VacuumDegreeActValue1} " +
- $"PressureHoldTimeSetValue1:{unitsData1.PressureHoldTimeSetValue1} " +
- $"GlueAmountSetValue2:{unitsData1.GlueAmountSetValue2} " +
- $"GluePushSpeedSetValue2:{unitsData1.GluePushSpeedSetValue2} " +
- $"BarrelA1TempActValue2:{unitsData1.BarrelA1TempActValue2} " +
- $"BarrelA2TempActValue2:{unitsData1.BarrelA2TempActValue2} " +
- $"BarrelB1TempActValue2:{unitsData1.BarrelB1TempActValue2} " +
- $"BarrelB2TempActValue2:{unitsData1.BarrelB2TempActValue2} " +
- $"PumpAPressureActValue2:{unitsData1.PumpAPressureActValue2} " +
- $"PumpBPressureActValue2:{unitsData1.PumpBPressureActValue2} " +
- $"VacuumDegreeActValue2:{unitsData1.VacuumDegreeActValue2} " +
- $"PressureHoldTimeSetValue2:{unitsData1.PressureHoldTimeSetValue2}");
- });
+ //流程完成
}
- //流程完成
+ }
+ else
+ {
+ _log.Error("胶机2真空箱后PLC读取信号异常");
}
}
- else
+ catch (Exception ex)
{
- _log.Error("胶机2真空箱后PLC读取信号异常");
+ _log.Error("RFID0业务出现异常", ex);
}
+
}
}
}
diff --git a/Sln.Iot.Business/RFID06Business.cs b/Sln.Iot.Business/RFID06Business.cs
index f74278a..66df709 100644
--- a/Sln.Iot.Business/RFID06Business.cs
+++ b/Sln.Iot.Business/RFID06Business.cs
@@ -55,86 +55,95 @@ namespace Sln.Iot.Business
///
public void TimerCallback(object? state)
{
- // 定时任务逻辑
- //读取信号
- OperateResult signalRes = _plc.ReadInt16(_plc.DeltaInstance4, "D500");
- //成功验证
- if (signalRes.IsSuccess)
+ try
{
- short signalValue = signalRes.Content;
- //如果有读取信号
- if (signalValue == 6001)
+ // 定时任务逻辑
+ //读取信号
+ OperateResult signalRes = _plc.ReadInt16(_plc.DeltaInstance4, "D500");
+ //成功验证
+ if (signalRes.IsSuccess)
{
- //读取托盘码和产品码
- OperateResult trayBytesResult = _plc.ReadBytes(_plc.DeltaInstance4, "D5000", 10);
- //成功验证
- if (trayBytesResult.IsSuccess)
+ short signalValue = signalRes.Content;
+ //如果有读取信号
+ if (signalValue == 6001)
{
- //转换托盘吗
- string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
-
- //sql更新
- //取出work唯一guid(tid)
- string stid = trayBindingService.TidGet(traycode);
- Guid.TryParse(stid, out Guid tid);
-
- //待开发
- string[] prodcode = trayBindingService.ProdCodeGet(traycode);
-
- bool res = trayBindingService.TrayCodeDelete(traycode);
-
- if (!res)
+ //读取托盘码和产品码
+ OperateResult trayBytesResult = _plc.ReadBytes(_plc.DeltaInstance4, "D5000", 10);
+ //成功验证
+ if (trayBytesResult.IsSuccess)
{
- _log.Error("下料提升机绑定数据删除异常或删除条数为0");
+ //转换托盘吗
+ string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
+ _log.Info("RFID06" + traycode);
+
+ //sql更新
+ //取出work唯一guid(tid)
+ string stid = trayBindingService.TidGet(traycode);
+ Guid.TryParse(stid, out Guid tid);
+
+ //待开发
+ string[] prodcode = trayBindingService.ProdCodeGet(traycode);
+
+ bool res = trayBindingService.TrayCodeDelete(traycode);
+
+ if (!res)
+ {
+ _log.Error("下料提升机绑定数据删除异常或删除条数为0");
+ }
+
+ //写入完成信号
+ res = _plc.PlcWrite(_plc.DeltaInstance4, "D500", 6002, DataTypeEnum.UInt16).IsSuccess;
+ if (!res)
+ {
+ _log.Error("下料提升机PLC写入完成信号异常");
+ }
+
+ //CFX
+ Task.Run(() =>
+ {
+ //固化炉工段完成事件
+ connect3.PublishEvent(new CFXEnvelope(workStageCompletedEvent.Handle(tid, "CureOven", 3)));
+ _log.Info($"固化炉工段完成, {tid}");
+ //单元离站事件
+ connect2.PublishEvent(new CFXEnvelope(unitsDepartedEvent.Handle(traycode, prodcode)));
+ _log.Info($"{traycode} 单元离站 ");
+ //工单完成事件
+ connect2.PublishEvent(new CFXEnvelope(workCompletedEvent.Handle(tid, traycode, prodcode)));
+ _log.Info($"工单完成 ID:{tid}");
+
+ //固化炉数据采集
+ var unitsdata = unitsProcessPLCDataGetBusiness.CureOvenPlcDataGet();
+ //存数据库里整合
+ ovenPlcDataService.UpdateDataCure(stid, unitsdata);
+ //取出整合数据
+ unitsdata = ovenPlcDataService.GetData(stid);
+
+ connect3.PublishEvent(new CFXEnvelope(unitsProcessedEvent.Handle(tid, cFXUnitProcessedDataGet.ProcessDataGet3(unitsdata))));
+ _log.Info($"隧道烤箱温度数据上传, " +
+ $"PreheatOvenTempActValue:{unitsdata.PreheatOvenTempActValue} " +
+ $"PreCureOven1TempActValue:{unitsdata.PreCureOven1TempActValue} " +
+ $"PreCureOven2TempActValue:{unitsdata.PreCureOven2TempActValue} " +
+ $"PreCureOven3TempActValue:{unitsdata.PreCureOven3TempActValue} " +
+ $"PreCureOven4TempActValue:{unitsdata.PreCureOven4TempActValue} " +
+ $"CureOven1TempActValue:{unitsdata.CureOven1TempActValue} " +
+ $"CureOven2TempActValue:{unitsdata.CureOven2TempActValue} " +
+ $"CureOven3TempActValue:{unitsdata.CureOven3TempActValue} " +
+ $"CureOven4TempActValue:{unitsdata.CureOven4TempActValue} ");
+ });
}
-
- //写入完成信号
- res = _plc.PlcWrite(_plc.DeltaInstance4, "D500", 6002, DataTypeEnum.UInt16).IsSuccess;
- if (!res)
- {
- _log.Error("下料提升机PLC写入完成信号异常");
- }
-
- //CFX
- Task.Run(() =>
- {
- //固化炉工段完成事件
- connect3.PublishEvent(new CFXEnvelope(workStageCompletedEvent.Handle(tid, "CureOven", 3)));
- _log.Info($"固化炉工段完成, {tid}");
- //单元离站事件
- connect2.PublishEvent(new CFXEnvelope(unitsDepartedEvent.Handle(traycode, prodcode)));
- _log.Info($"{traycode} 单元离站 ");
- //工单完成事件
- connect2.PublishEvent(new CFXEnvelope(workCompletedEvent.Handle(tid, traycode, prodcode)));
- _log.Info($"工单完成 ID:{tid}");
-
- //固化炉数据采集
- var unitsdata = unitsProcessPLCDataGetBusiness.CureOvenPlcDataGet();
- //存数据库里整合
- ovenPlcDataService.UpdateDataCure(stid, unitsdata);
- //取出整合数据
- unitsdata = ovenPlcDataService.GetData(stid);
-
- connect3.PublishEvent(new CFXEnvelope(unitsProcessedEvent.Handle(tid, cFXUnitProcessedDataGet.ProcessDataGet3(unitsdata))));
- _log.Info($"隧道烤箱温度数据上传, " +
- $"PreheatOvenTempActValue:{unitsdata.PreheatOvenTempActValue} " +
- $"PreCureOven1TempActValue:{unitsdata.PreCureOven1TempActValue} " +
- $"PreCureOven2TempActValue:{unitsdata.PreCureOven2TempActValue} " +
- $"PreCureOven3TempActValue:{unitsdata.PreCureOven3TempActValue} " +
- $"PreCureOven4TempActValue:{unitsdata.PreCureOven4TempActValue} " +
- $"CureOven1TempActValue:{unitsdata.CureOven1TempActValue} " +
- $"CureOven2TempActValue:{unitsdata.CureOven2TempActValue} " +
- $"CureOven3TempActValue:{unitsdata.CureOven3TempActValue} " +
- $"CureOven4TempActValue:{unitsdata.CureOven4TempActValue} ");
- });
+ //流程完成
}
- //流程完成
+ }
+ else
+ {
+ _log.Error("下料提升机PLC读取信号异常");
}
}
- else
+ catch (Exception ex)
{
- _log.Error("下料提升机PLC读取信号异常");
+ _log.Error("RFID0业务出现异常", ex);
}
+
}
}
}
diff --git a/Sln.Iot.Business/RecipeBusiness.cs b/Sln.Iot.Business/RecipeBusiness.cs
index 14155e8..079123f 100644
--- a/Sln.Iot.Business/RecipeBusiness.cs
+++ b/Sln.Iot.Business/RecipeBusiness.cs
@@ -38,62 +38,74 @@ namespace Sln.Iot.Business
///
public void TimerCallback(object? state)
{
- string recipeName = "recipeName";
+ string recipeName1 = "recipeName";
+ string recipeName2 = "recipeName";
+ try
+ {
+ var Result1 = _plc.ReadInt16(_plc.DeltaInstance1, "D6");
+ var Result2 = _plc.ReadInt16(_plc.DeltaInstance2, "D6");
+
+ //_log.Info($"真空箱1配方标识{Result1.Content}");
+ //_log.Info($"真空箱2配方标识{Result2.Content}");
+ //_log.Info($"————————————————————");
+
+ if (Result1.Content != 0 || Result2.Content != 0)
+ {
+ //获取现在激活的配方
+ var res1 = _plc.ReadBytes(_plc.DeltaInstance1, "D600", 10);
+ var res2 = _plc.ReadBytes(_plc.DeltaInstance2, "D600", 10);
+ if (res1.IsSuccess)
+ {
+ recipeName1 = Encoding.ASCII.GetString(ToolBusiness.SwapAdjacentBytes(res1.Content));
+ }
+ if (res2.IsSuccess)
+ {
+ recipeName2 = Encoding.ASCII.GetString(ToolBusiness.SwapAdjacentBytes(res2.Content));
+ }
+ }
+
+ if (Result1.IsSuccess)
+ {
+ if (Result1.Content == 2)
+ {
+ //发布消息
+ connect1.PublishEvent(new CFXEnvelope(recipeModifiedEvent.Handle(recipeName1)));
+ _plc.PlcWrite(_plc.DeltaInstance1, "D6", 0, DataTypeEnum.Int16);
+ _log.Info($"真空箱1配方修改{recipeName1}");
+ }
+ else if (Result1.Content == 4)
+ {
+ //发布消息
+ connect1.PublishEvent(new CFXEnvelope(recipeActivatedEvent.Handle(recipeName1, "VacuumInjection1", 1)));
+ _plc.PlcWrite(_plc.DeltaInstance1, "D6", 0, DataTypeEnum.Int16);
+ _log.Info($"真空箱1配方激活{recipeName1}");
+ }
+ }
+
+ if (Result2.IsSuccess)
+ {
+ if (Result2.Content == 2)
+ {
+ //发布消息
+ connect1.PublishEvent(new CFXEnvelope(recipeModifiedEvent.Handle(recipeName2)));
+ _plc.PlcWrite(_plc.DeltaInstance2, "D6", 0, DataTypeEnum.Int16);
+ _log.Info($"真空箱2配方修改{recipeName2}");
+ }
+ else if (Result2.Content == 4)
+ {
+ //发布消息
+ connect1.PublishEvent(new CFXEnvelope(recipeActivatedEvent.Handle(recipeName2, "VacuumInjection2", 2)));
+ _plc.PlcWrite(_plc.DeltaInstance2, "D6", 0, DataTypeEnum.Int16);
+ _log.Info($"真空箱2配方激活{recipeName2}");
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ _log.Error($"RecipeBusiness定时任务异常:{ex.Message}");
+ }
+
- var changeResult1 = _plc.ReadBool(_plc.DeltaInstance1, "M281");
- var changeResult2 = _plc.ReadBool(_plc.DeltaInstance2, "M281");
- var activeResult1 = _plc.ReadBool(_plc.DeltaInstance1, "M280");
- var activeResult2 = _plc.ReadBool(_plc.DeltaInstance2, "M280");
-
- if(changeResult1.Content || changeResult2.Content || activeResult1.Content || activeResult2.Content)
- {
- //获取现在激活的配方
- var res = _plc.ReadBytes(_plc.DeltaInstance1, "D600", 10);
- if (res.IsSuccess)
- {
- recipeName = Encoding.ASCII.GetString(res.Content);
- }
- }
-
- if (changeResult1.IsSuccess)
- {
- if (changeResult1.Content)
- {
- //发布消息
- connect1.PublishEvent(new CFXEnvelope(recipeModifiedEvent.Handle(recipeName)));
- _log.Info($"真空箱1配方修改{recipeName}");
- }
- }
-
- if (changeResult2.IsSuccess)
- {
- if (changeResult2.Content)
- {
- //发布消息
- connect1.PublishEvent(new CFXEnvelope(recipeModifiedEvent.Handle(recipeName)));
- _log.Info($"真空箱2配方修改{recipeName}");
- }
- }
-
- if (activeResult1.IsSuccess)
- {
- if (activeResult1.Content)
- {
- //发布消息
- connect1.PublishEvent(new CFXEnvelope(recipeActivatedEvent.Handle(recipeName, "VacuumInjection1", 1)));
- _log.Info($"真空箱1配方激活{recipeName}");
- }
- }
-
- if (activeResult2.IsSuccess)
- {
- if (activeResult2.Content)
- {
- //发布消息
- connect1.PublishEvent(new CFXEnvelope(recipeActivatedEvent.Handle(recipeName, "VacuumInjection2", 2)));
- _log.Info($"真空箱2配方激活{recipeName}");
- }
- }
}
}
}
diff --git a/Sln.Iot.Business/TestBusiness.cs b/Sln.Iot.Business/TestBusiness.cs
index 91fed20..6dcfea8 100644
--- a/Sln.Iot.Business/TestBusiness.cs
+++ b/Sln.Iot.Business/TestBusiness.cs
@@ -1,12 +1,17 @@
-using HslCommunication;
+using CFX.Structures.PressInsertion;
+using CFX;
+using HslCommunication;
using HslCommunication.Core;
using Serilog;
+using Sln.Iot.CFX.CFXBusiness;
+using Sln.Iot.CFX.Event;
using Sln.Iot.PLC;
using Sln.Iot.Repository.service;
using Sln.Iot.Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
@@ -20,9 +25,14 @@ namespace Sln.Iot.Business
private readonly SerilogHelper _log = SerilogHelper.Instance;
+ private ErrorAnalyseBusiness _errorAnalyse;
+ private RecipeBusiness _recipeBusiness;
+
public TestBusiness()
{
- _timer = new Timer(TimerCallback, null, 0, 1000);
+ _errorAnalyse = new ErrorAnalyseBusiness();
+ _recipeBusiness = new RecipeBusiness();
+ //_timer = new Timer(TimerCallback, null, 0, 1000);
}
///
@@ -33,42 +43,93 @@ namespace Sln.Iot.Business
{
try
{
- //var res = _plc.ReadBytes(_plc.DeltaInstance0, "D200", 9);
- //var bytes = res.Content.Reverse().ToArray();
- //ushort[] shorts = new ushort[9];
- //if (bytes != null && bytes.Length != 0)
+ UnitsProcessPLCDataGetBusiness unitsProcessPLCDataGetBusiness = UnitsProcessPLCDataGetBusiness.Instance;
+
+ var data1 = unitsProcessPLCDataGetBusiness.Vacuum1PlcDataGet();
+ var data2 = unitsProcessPLCDataGetBusiness.Vacuum2PlcDataGet();
+ var data3 = unitsProcessPLCDataGetBusiness.PreHeatOvenPlcDataGet();
+ var data4 = unitsProcessPLCDataGetBusiness.PreCureOvenPlcDataGet();
+ var data5 = unitsProcessPLCDataGetBusiness.CureOvenPlcDataGet();
+
+ data1.GlueAmountSetValue2 = data2.GlueAmountSetValue2;
+ data1.GluePushSpeedSetValue2 = data2.GluePushSpeedSetValue2;
+ data1.BarrelA1TempActValue2 = data2.BarrelA1TempActValue2;
+ data1.BarrelA2TempActValue2 = data2.BarrelA2TempActValue2;
+ data1.BarrelB1TempActValue2 = data2.BarrelB1TempActValue2;
+ data1.BarrelB2TempActValue2 = data2.BarrelB2TempActValue2;
+ data1.PumpAPressureActValue2 = data2.PumpAPressureActValue2;
+ data1.PumpBPressureActValue2 = data2.PumpBPressureActValue2;
+ data1.VacuumDegreeActValue2 = data2.VacuumDegreeActValue2;
+ data1.PressureHoldTimeSetValue2 = data2.PressureHoldTimeSetValue2;
+ _log.Info($"真空箱温度数据上传,\n " +
+ $"GlueAmountSetValue1:{data1.GlueAmountSetValue1}\n " +
+ $"GluePushSpeedSetValue1:{data1.GluePushSpeedSetValue1}\n " +
+ $"BarrelA1TempActValue1:{data1.BarrelA1TempActValue1}\n " +
+ $"BarrelA2TempActValue1:{data1.BarrelA2TempActValue1}\n " +
+ $"BarrelB1TempActValue1:{data1.BarrelB1TempActValue1}\n " +
+ $"BarrelB2TempActValue1:{data1.BarrelB2TempActValue1}\n " +
+ $"PumpAPressureActValue1:{data1.PumpAPressureActValue1}\n " +
+ $"PumpBPressureActValue1:{data1.PumpBPressureActValue1}\n " +
+ $"VacuumDegreeActValue1:{data1.VacuumDegreeActValue1}\n " +
+ $"PressureHoldTimeSetValue1:{data1.PressureHoldTimeSetValue1}\n " +
+ $"GlueAmountSetValue2:{data1.GlueAmountSetValue2}\n " +
+ $"GluePushSpeedSetValue2:{data1.GluePushSpeedSetValue2}\n " +
+ $"BarrelA1TempActValue2:{data1.BarrelA1TempActValue2}\n " +
+ $"BarrelA2TempActValue2:{data1.BarrelA2TempActValue2}\n " +
+ $"BarrelB1TempActValue2:{data1.BarrelB1TempActValue2}\n " +
+ $"BarrelB2TempActValue2:{data1.BarrelB2TempActValue2}\n " +
+ $"PumpAPressureActValue2:{data1.PumpAPressureActValue2}\n " +
+ $"PumpBPressureActValue2:{data1.PumpBPressureActValue2}\n " +
+ $"VacuumDegreeActValue2:{data1.VacuumDegreeActValue2}\n " +
+ $"PressureHoldTimeSetValue2:{data1.PressureHoldTimeSetValue2}");
+
+ _log.Info($"隧道烤箱温度数据上传,\n " +
+ $"PreheatOvenTempActValue:{data3}\n " +
+ $"PreCureOven1TempActValue:{data4.PreCureOven1TempActValue}\n " +
+ $"PreCureOven2TempActValue:{data4.PreCureOven2TempActValue}\n " +
+ $"PreCureOven3TempActValue:{data4.PreCureOven3TempActValue}\n " +
+ $"PreCureOven4TempActValue:{data4.PreCureOven4TempActValue}\n " +
+ $"CureOven1TempActValue:{data5.CureOven1TempActValue}\n " +
+ $"CureOven2TempActValue:{data5.CureOven2TempActValue}\n " +
+ $"CureOven3TempActValue:{data5.CureOven3TempActValue}\n " +
+ $"CureOven4TempActValue:{data5.CureOven4TempActValue} ");
+
+ ////var res = _plc.ReadBytes(_plc.DeltaInstance0, "D200", 9);
+ ////var bytes = res.Content.Reverse().ToArray();
+ ////ushort[] shorts = new ushort[9];
+ ////if (bytes != null && bytes.Length != 0)
+ ////{
+ //// shorts[0] = BitConverter.ToUInt16(bytes, 0);
+ //// shorts[1] = BitConverter.ToUInt16(bytes, 2);
+ //// shorts[2] = BitConverter.ToUInt16(bytes, 4);
+ //// shorts[3] = BitConverter.ToUInt16(bytes, 6);
+ //// shorts[4] = BitConverter.ToUInt16(bytes, 8);
+ //// shorts[5] = BitConverter.ToUInt16(bytes, 10);
+ //// shorts[6] = BitConverter.ToUInt16(bytes, 12);
+ //// shorts[7] = BitConverter.ToUInt16(bytes, 14);
+ //// shorts[8] = BitConverter.ToUInt16(bytes, 16);
+ ////}
+
+ ////for (int i = 0; i < 9; i++)
+ ////{
+ //// _log.Info($"D20{i * 2}数值[{shorts[i].ToString()}]");
+ ////}
+
+ ////读取托盘码和产品码
+ //OperateResult trayBytesResult = _plc.ReadBytes(_plc.DeltaInstance3, "D5000", 10);
+ //OperateResult pordBytesResult = _plc.ReadBytes(_plc.DeltaInstance3, "D8000", 60);
+
+ ////转换托盘码
+ //string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
+ //_log.Info("RFID读数" + traycode);
+ //byte[] prodBytes = pordBytesResult.Content;
+ //string[] prodcode = new string[6];
+ ////分割转换产品码
+ //for (int i = 0; i < 6; i++)
//{
- // shorts[0] = BitConverter.ToUInt16(bytes, 0);
- // shorts[1] = BitConverter.ToUInt16(bytes, 2);
- // shorts[2] = BitConverter.ToUInt16(bytes, 4);
- // shorts[3] = BitConverter.ToUInt16(bytes, 6);
- // shorts[4] = BitConverter.ToUInt16(bytes, 8);
- // shorts[5] = BitConverter.ToUInt16(bytes, 10);
- // shorts[6] = BitConverter.ToUInt16(bytes, 12);
- // shorts[7] = BitConverter.ToUInt16(bytes, 14);
- // shorts[8] = BitConverter.ToUInt16(bytes, 16);
+ // prodcode[i] = Encoding.ASCII.GetString(AscIIReverseTostring(prodBytes[(i * 20)..(i * 20 + 20)]));
+ // _log.Info($"扫码枪读数{i + 1}是{prodcode[i]}");
//}
-
- //for (int i = 0; i < 9; i++)
- //{
- // _log.Info($"D20{i * 2}数值[{shorts[i].ToString()}]");
- //}
-
- //读取托盘码和产品码
- OperateResult trayBytesResult = _plc.ReadBytes(_plc.DeltaInstance3, "D5000", 10);
- OperateResult pordBytesResult = _plc.ReadBytes(_plc.DeltaInstance3, "D8000", 60);
-
- //转换托盘码
- string traycode = Encoding.ASCII.GetString(trayBytesResult.Content);
- _log.Info("RFID读数" + traycode);
- byte[] prodBytes = pordBytesResult.Content;
- string[] prodcode = new string[6];
- //分割转换产品码
- for (int i = 0; i < 6; i++)
- {
- prodcode[i] = Encoding.ASCII.GetString(AscIIReverseTostring(prodBytes[(i * 20)..(i * 20 + 20)]));
- _log.Info($"扫码枪读数{i + 1}是{prodcode[i]}");
- }
}
catch (Exception ex)
{
diff --git a/Sln.Iot.Business/ToolBusiness.cs b/Sln.Iot.Business/ToolBusiness.cs
new file mode 100644
index 0000000..5140906
--- /dev/null
+++ b/Sln.Iot.Business/ToolBusiness.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Sln.Iot.Business
+{
+ public class ToolBusiness
+ {
+ ///
+ /// 将偶数长度的byte数组中每对相邻元素(偶数下标和奇数下标)互换位置
+ ///
+ /// 输入的byte数组(必须非空且长度为偶数)
+ /// 处理后的新byte数组
+ /// 输入数组为空时抛出
+ /// 输入数组长度为奇数时抛出
+ public static byte[] SwapAdjacentBytes(byte[] inputBytes)
+ {
+ // 校验输入:数组不能为空
+ if (inputBytes == null)
+ {
+ throw new ArgumentNullException(nameof(inputBytes), "输入的byte数组不能为null");
+ }
+
+ // 校验输入:数组长度必须为偶数
+ if (inputBytes.Length % 2 != 0)
+ {
+ throw new ArgumentException("输入的byte数组长度必须为偶数", nameof(inputBytes));
+ }
+
+ // 创建原数组的副本,避免修改原数组
+ byte[] resultBytes = (byte[])inputBytes.Clone();
+
+ // 遍历数组,步长为2,交换每对相邻元素
+ for (int i = 0; i < resultBytes.Length; i += 2)
+ {
+ // 交换偶数下标(i)和奇数下标(i+1)的元素
+ byte temp = resultBytes[i];
+ resultBytes[i] = resultBytes[i + 1];
+ resultBytes[i + 1] = temp;
+ }
+
+ return resultBytes;
+ }
+ }
+}
diff --git a/Sln.Iot.Business/UnitsProcessPLCDataGetBusiness.cs b/Sln.Iot.Business/UnitsProcessPLCDataGetBusiness.cs
index cea8406..63e30e4 100644
--- a/Sln.Iot.Business/UnitsProcessPLCDataGetBusiness.cs
+++ b/Sln.Iot.Business/UnitsProcessPLCDataGetBusiness.cs
@@ -34,23 +34,25 @@ namespace Sln.Iot.Business
{
try
{
- var res11 = _plc.ReadBytes(_plc.DeltaInstance1, "D200", 8);
- var res12 = _plc.ReadBytes(_plc.DeltaInstance1, "D610", 6);
- var res13 = _plc.ReadBytes(_plc.DeltaInstance1, "D120", 4);
- var res14 = _plc.ReadFloat(_plc.DeltaInstance1, "D58");
+ // 读取PLC数据
+ var res = _plc.ReadBytes(_plc.DeltaInstance1, "D188", 21);
+
UnitsProcess1Entity entity = new UnitsProcess1Entity()
{
- GlueAmountSetValue1 = BitConverter.ToSingle(res12.Content, 4),
- GluePushSpeedSetValue1 = BitConverter.ToSingle(res12.Content, 0),
- BarrelA1TempActValue1 = BitConverter.ToInt16(res11.Content, 0),
- BarrelA2TempActValue1 = BitConverter.ToInt16(res11.Content, 4),
- BarrelB1TempActValue1 = BitConverter.ToInt16(res11.Content, 12),
- BarrelB2TempActValue1 = BitConverter.ToInt16(res11.Content, 16),
- PumpAPressureActValue1 = BitConverter.ToSingle(res13.Content, 0),
- PumpBPressureActValue1 = BitConverter.ToSingle(res13.Content, 4),
- VacuumDegreeActValue1 = res14.Content,
- PressureHoldTimeSetValue1 = BitConverter.ToInt16(res12.Content, 12),
+ // Float(单精度浮点数)占4字节,先截取4字节再反转
+ PumpAPressureActValue1 = BitConverter.ToSingle(SingleReverseBytesForValue(res.Content, (188 - 188) * 2, 4), 0),
+ PumpBPressureActValue1 = BitConverter.ToSingle(SingleReverseBytesForValue(res.Content, (190 - 188) * 2, 4), 0),
+ GluePushSpeedSetValue1 = BitConverter.ToSingle(SingleReverseBytesForValue(res.Content, (192 - 188) * 2, 4), 0),
+ GlueAmountSetValue1 = BitConverter.ToSingle(SingleReverseBytesForValue(res.Content, (194 - 188) * 2, 4), 0),
+ VacuumDegreeActValue1 = BitConverter.ToSingle(SingleReverseBytesForValue(res.Content, (196 - 188) * 2, 4), 0),
+
+ // Int16(短整型)占2字节,先截取2字节再反转
+ PressureHoldTimeSetValue1 = BitConverter.ToInt16(Int16ReverseBytesForValue(res.Content, (198 - 188) * 2, 2), 0),
+ BarrelA1TempActValue1 = BitConverter.ToInt16(Int16ReverseBytesForValue(res.Content, (200 - 188) * 2, 2), 0),
+ BarrelA2TempActValue1 = BitConverter.ToInt16(Int16ReverseBytesForValue(res.Content, (202 - 188) * 2, 2), 0),
+ BarrelB1TempActValue1 = BitConverter.ToInt16(Int16ReverseBytesForValue(res.Content, (206 - 188) * 2, 2), 0),
+ BarrelB2TempActValue1 = BitConverter.ToInt16(Int16ReverseBytesForValue(res.Content, (208 - 188) * 2, 2), 0),
};
return entity;
@@ -70,23 +72,23 @@ namespace Sln.Iot.Business
{
try
{
- var res21 = _plc.ReadBytes(_plc.DeltaInstance2, "D200", 8);
- var res22 = _plc.ReadBytes(_plc.DeltaInstance2, "D610", 6);
- var res23 = _plc.ReadBytes(_plc.DeltaInstance2, "D120", 4);
- var res24 = _plc.ReadFloat(_plc.DeltaInstance2, "D58");
-
+ var res = _plc.ReadBytes(_plc.DeltaInstance2, "D188", 21);
+ var result = res.Content.Reverse().ToArray();
UnitsProcess1Entity entity = new UnitsProcess1Entity()
{
- GlueAmountSetValue2 = BitConverter.ToSingle(res22.Content, 4),
- GluePushSpeedSetValue2 = BitConverter.ToSingle(res22.Content, 0),
- BarrelA1TempActValue2 = BitConverter.ToInt16(res21.Content, 0),
- BarrelA2TempActValue2 = BitConverter.ToInt16(res21.Content, 4),
- BarrelB1TempActValue2 = BitConverter.ToInt16(res21.Content, 12),
- BarrelB2TempActValue2 = BitConverter.ToInt16(res21.Content, 16),
- PumpAPressureActValue2 = BitConverter.ToSingle(res23.Content, 0),
- PumpBPressureActValue2 = BitConverter.ToSingle(res23.Content, 4),
- VacuumDegreeActValue2 = res24.Content,
- PressureHoldTimeSetValue2 = BitConverter.ToInt16(res22.Content, 12),
+ // Float(单精度浮点数)占4字节,先截取4字节再反转
+ PumpAPressureActValue2 = BitConverter.ToSingle(SingleReverseBytesForValue(res.Content, (188 - 188) * 2, 4), 0),
+ PumpBPressureActValue2 = BitConverter.ToSingle(SingleReverseBytesForValue(res.Content, (190 - 188) * 2, 4), 0),
+ GluePushSpeedSetValue2 = BitConverter.ToSingle(SingleReverseBytesForValue(res.Content, (192 - 188) * 2, 4), 0),
+ GlueAmountSetValue2 = BitConverter.ToSingle(SingleReverseBytesForValue(res.Content, (194 - 188) * 2, 4), 0),
+ VacuumDegreeActValue2 = BitConverter.ToSingle(SingleReverseBytesForValue(res.Content, (196 - 188) * 2, 4), 0),
+
+ // Int16(短整型)占2字节,先截取2字节再反转
+ PressureHoldTimeSetValue2 = BitConverter.ToInt16(Int16ReverseBytesForValue(res.Content, (198 - 188) * 2, 2), 0),
+ BarrelA1TempActValue2 = BitConverter.ToInt16(Int16ReverseBytesForValue(res.Content, (200 - 188) * 2, 2), 0),
+ BarrelA2TempActValue2 = BitConverter.ToInt16(Int16ReverseBytesForValue(res.Content, (202 - 188) * 2, 2), 0),
+ BarrelB1TempActValue2 = BitConverter.ToInt16(Int16ReverseBytesForValue(res.Content, (206 - 188) * 2, 2), 0),
+ BarrelB2TempActValue2 = BitConverter.ToInt16(Int16ReverseBytesForValue(res.Content, (208 - 188) * 2, 2), 0),
};
return entity;
@@ -98,6 +100,42 @@ namespace Sln.Iot.Business
}
}
+ ///
+ /// 定义字节序转换的辅助方法(核心)
+ ///
+ ///
+ ///
+ ///
+ ///
+ byte[] Int16ReverseBytesForValue(byte[] source, int startIndex, int length)
+ {
+ // 截取对应位置的字节片段(避免修改原数组)
+ byte[] temp = new byte[length];
+ Array.Copy(source, startIndex, temp, 0, length);
+ // 反转字节序(大端转小端)
+ Array.Reverse(temp);
+ return temp;
+ }
+
+ // 定义字节序转换的辅助方法(核心)
+ byte[] SingleReverseBytesForValue(byte[] source, int startIndex, int length)
+ {
+ // 截取对应位置的字节片段(避免修改原数组)
+ byte[] temp = new byte[length];
+ Array.Copy(source, startIndex, temp, 0, length);
+
+ var t = temp[0];
+ temp[0] = temp[2];
+ temp[2] = t;
+ t = temp[1];
+ temp[1] = temp[3];
+ temp[3] = t;
+
+ // 反转字节序(大端转小端)
+ Array.Reverse(temp);
+ return temp;
+ }
+
///
/// 预热炉数据获取
///
@@ -131,15 +169,14 @@ namespace Sln.Iot.Business
try
{
var res = _plc.ReadBytes(_plc.DeltaInstance0, "D201", 4);
-
+ var result = res.Content.Reverse().ToArray();
UnitsProcess3Entity unitsProcess3Entity = new UnitsProcess3Entity()
{
- PreCureOven1TempActValue = BitConverter.ToInt16(res.Content, 0),
- PreCureOven2TempActValue = BitConverter.ToInt16(res.Content, 2),
- PreCureOven3TempActValue = BitConverter.ToInt16(res.Content, 4),
- PreCureOven4TempActValue = BitConverter.ToInt16(res.Content, 6),
+ PreCureOven4TempActValue = BitConverter.ToInt16(result, 0),
+ PreCureOven3TempActValue = BitConverter.ToInt16(result, 2),
+ PreCureOven2TempActValue = BitConverter.ToInt16(result, 4),
+ PreCureOven1TempActValue = BitConverter.ToInt16(result, 6),
};
-
return unitsProcess3Entity;
}
catch (Exception ex)
@@ -158,13 +195,13 @@ namespace Sln.Iot.Business
try
{
var res = _plc.ReadBytes(_plc.DeltaInstance0, "D205", 4);
-
+ var result = res.Content.Reverse().ToArray();
UnitsProcess3Entity unitsProcess3Entity = new UnitsProcess3Entity()
{
- CureOven1TempActValue = BitConverter.ToInt16(res.Content, 0),
- CureOven2TempActValue = BitConverter.ToInt16(res.Content, 2),
- CureOven3TempActValue = BitConverter.ToInt16(res.Content, 4),
- CureOven4TempActValue = BitConverter.ToInt16(res.Content, 6),
+ CureOven4TempActValue = BitConverter.ToInt16(result, 0),
+ CureOven3TempActValue = BitConverter.ToInt16(result, 2),
+ CureOven2TempActValue = BitConverter.ToInt16(result, 4),
+ CureOven1TempActValue = BitConverter.ToInt16(result, 6),
};
return unitsProcess3Entity;
diff --git a/Sln.Iot.CFX/CFXBusiness/CFXUnitProcessedDataGet.cs b/Sln.Iot.CFX/CFXBusiness/CFXUnitProcessedDataGet.cs
index 9cc23d0..32285cf 100644
--- a/Sln.Iot.CFX/CFXBusiness/CFXUnitProcessedDataGet.cs
+++ b/Sln.Iot.CFX/CFXBusiness/CFXUnitProcessedDataGet.cs
@@ -23,29 +23,29 @@ namespace Sln.Iot.CFX.CFXBusiness
///
public CommonProcessData ProcessDataGet1(UnitsProcess1Entity entity)
{
- entity = new UnitsProcess1Entity()
- {
- GlueAmountSetValue1 = 123.4f,
- GluePushSpeedSetValue1 = 10.1f,
- BarrelA1TempActValue1 = 60,
- BarrelA2TempActValue1 = 60,
- BarrelB1TempActValue1 = 60,
- BarrelB2TempActValue1 = 60,
- PumpAPressureActValue1 = 3.5f,
- PumpBPressureActValue1 = 3.2f,
- VacuumDegreeActValue1 = 3000.4f,
- PressureHoldTimeSetValue1 = 100,
- GlueAmountSetValue2 = 123.4f,
- GluePushSpeedSetValue2 = 10.1f,
- BarrelA1TempActValue2 = 60,
- BarrelA2TempActValue2 = 60,
- BarrelB1TempActValue2 = 60,
- BarrelB2TempActValue2 = 60,
- PumpAPressureActValue2 = 3.5f,
- PumpBPressureActValue2 = 3.2f,
- VacuumDegreeActValue2 = 3000.4f,
- PressureHoldTimeSetValue2 = 100,
- };
+ //entity = new UnitsProcess1Entity()
+ //{
+ // GlueAmountSetValue1 = 123.4f,
+ // GluePushSpeedSetValue1 = 10.1f,
+ // BarrelA1TempActValue1 = 60,
+ // BarrelA2TempActValue1 = 60,
+ // BarrelB1TempActValue1 = 60,
+ // BarrelB2TempActValue1 = 60,
+ // PumpAPressureActValue1 = 3.5f,
+ // PumpBPressureActValue1 = 3.2f,
+ // VacuumDegreeActValue1 = 3000.4f,
+ // PressureHoldTimeSetValue1 = 100,
+ // GlueAmountSetValue2 = 123.4f,
+ // GluePushSpeedSetValue2 = 10.1f,
+ // BarrelA1TempActValue2 = 60,
+ // BarrelA2TempActValue2 = 60,
+ // BarrelB1TempActValue2 = 60,
+ // BarrelB2TempActValue2 = 60,
+ // PumpAPressureActValue2 = 3.5f,
+ // PumpBPressureActValue2 = 3.2f,
+ // VacuumDegreeActValue2 = 3000.4f,
+ // PressureHoldTimeSetValue2 = 100,
+ //};
CommonProcessData processData = new CommonProcessData()
{
@@ -230,18 +230,18 @@ namespace Sln.Iot.CFX.CFXBusiness
///
public CommonProcessData ProcessDataGet3(UnitsProcess3Entity entity)
{
- entity = new UnitsProcess3Entity()
- {
- PreheatOvenTempActValue = 800,
- PreCureOven1TempActValue = 800,
- PreCureOven2TempActValue = 800,
- PreCureOven3TempActValue = 800,
- PreCureOven4TempActValue = 800,
- CureOven1TempActValue = 800,
- CureOven2TempActValue = 800,
- CureOven3TempActValue = 800,
- CureOven4TempActValue = 800,
- };
+ //entity = new UnitsProcess3Entity()
+ //{
+ // PreheatOvenTempActValue = 800,
+ // PreCureOven1TempActValue = 800,
+ // PreCureOven2TempActValue = 800,
+ // PreCureOven3TempActValue = 800,
+ // PreCureOven4TempActValue = 800,
+ // CureOven1TempActValue = 800,
+ // CureOven2TempActValue = 800,
+ // CureOven3TempActValue = 800,
+ // CureOven4TempActValue = 800,
+ //};
CommonProcessData processData = new CommonProcessData()
{
diff --git a/Sln.Iot.CFX/CFXRequestes/GetActiveRecipeRequestReceived1.cs b/Sln.Iot.CFX/CFXRequestes/GetActiveRecipeRequestReceived1.cs
index 50f6c99..5588d7e 100644
--- a/Sln.Iot.CFX/CFXRequestes/GetActiveRecipeRequestReceived1.cs
+++ b/Sln.Iot.CFX/CFXRequestes/GetActiveRecipeRequestReceived1.cs
@@ -54,18 +54,18 @@ public class GetActiveRecipeRequestReceived1 : BaseGetActiveRecipeRequestReceive
string restr1 = string.Empty;
string restr2 = string.Empty;
- ////获取现在激活的配方
- //var res1 = _plc.ReadBytes(_plc.DeltaInstance1, "D600", 10);
- //var res2 = _plc.ReadBytes(_plc.DeltaInstance2, "D600", 10);
+ //获取现在激活的配方
+ var res1 = _plc.ReadBytes(_plc.DeltaInstance1, "D600", 10);
+ var res2 = _plc.ReadBytes(_plc.DeltaInstance2, "D600", 10);
- //if (res1.IsSuccess)
- //{
- // restr1 = Encoding.ASCII.GetString(res1.Content);
- //}
- //if (res2.IsSuccess)
- //{
- // restr2 = Encoding.ASCII.GetString(res2.Content);
- //}
+ if (res1.IsSuccess)
+ {
+ restr1 = Encoding.ASCII.GetString(res1.Content);
+ }
+ if (res2.IsSuccess)
+ {
+ restr2 = Encoding.ASCII.GetString(res2.Content);
+ }
CFXMessage response = new GetActiveRecipeResponse()
{
diff --git a/Sln.Iot.CFX/Event/RecipeActivatedEvent.cs b/Sln.Iot.CFX/Event/RecipeActivatedEvent.cs
index cc6cc36..c7d5c69 100644
--- a/Sln.Iot.CFX/Event/RecipeActivatedEvent.cs
+++ b/Sln.Iot.CFX/Event/RecipeActivatedEvent.cs
@@ -23,6 +23,7 @@ namespace Sln.Iot.CFX.Event
{
RecipeName = recipeName,
Lane = 1,
+ Revision = "2.0",
RecipeStagesInformation = new List()
{
new RecipeStageInformation()
diff --git a/Sln.Iot.CFX/Event/RecipeModifiedEvent.cs b/Sln.Iot.CFX/Event/RecipeModifiedEvent.cs
index a452fc6..b86b93a 100644
--- a/Sln.Iot.CFX/Event/RecipeModifiedEvent.cs
+++ b/Sln.Iot.CFX/Event/RecipeModifiedEvent.cs
@@ -22,6 +22,7 @@ namespace Sln.Iot.CFX.Event
eve = new RecipeModified()
{
RecipeName = recipeName,
+ Revision = "2.0",
ModifiedBy = new Operator()
{
ActorType = ActorType.Human,
diff --git a/Sln.Iot.Repository/SqliteHelper.cs b/Sln.Iot.Repository/SqliteHelper.cs
index fc5cbba..3e3e890 100644
--- a/Sln.Iot.Repository/SqliteHelper.cs
+++ b/Sln.Iot.Repository/SqliteHelper.cs
@@ -15,15 +15,15 @@ namespace Sln.Iot.Repository
///
public class SQLiteHelper where T : new()
{
- private static readonly Lazy> lazy = new Lazy>(() => new SQLiteHelper());
+ //private static readonly Lazy> lazy = new Lazy>(() => new SQLiteHelper());
- public static SQLiteHelper Instance
- {
- get
- {
- return lazy.Value;
- }
- }
+ //public static SQLiteHelper Instance
+ //{
+ // get
+ // {
+ // return lazy.Value;
+ // }
+ //}
private readonly string _databasePath = Path.Combine(Environment.CurrentDirectory, "DeltaDatabase.db");
private readonly SQLiteConnection _connection; // SQLite连接对象
diff --git a/Sln.Iot.Repository/service/ErrorService.cs b/Sln.Iot.Repository/service/ErrorService.cs
index 893cf05..f60a1ae 100644
--- a/Sln.Iot.Repository/service/ErrorService.cs
+++ b/Sln.Iot.Repository/service/ErrorService.cs
@@ -21,10 +21,10 @@ namespace Sln.Iot.Repository.service
}
}
- private SQLiteHelper _helperV1 = SQLiteHelper.Instance;
- private SQLiteHelper _helperV2 = SQLiteHelper.Instance;
- private SQLiteHelper _helperL = SQLiteHelper.Instance;
- private SQLiteHelper _helperO = SQLiteHelper.Instance;
+ private SQLiteHelper _helperV1 = new SQLiteHelper();
+ private SQLiteHelper _helperV2 = new SQLiteHelper();
+ private SQLiteHelper _helperL = new SQLiteHelper();
+ private SQLiteHelper _helperO = new SQLiteHelper();
private SerilogHelper _log = SerilogHelper.Instance;
@@ -132,7 +132,7 @@ namespace Sln.Iot.Repository.service
try
{
var restr = _helperV2.QuerySingle(x => x.ErrorName == Message).ErrorGuid;
- var res = _helperV2.SqlExcute($"DELETE FROM Vacuum1Error WHERE ErrorName = '{Message}'");
+ var res = _helperV2.SqlExcute($"DELETE FROM Vacuum2Error WHERE ErrorName = '{Message}'");
if (res == 0)
{
throw new Exception("删除数据不成功,可能没有指定ErrorMessage的错误");
@@ -201,7 +201,7 @@ namespace Sln.Iot.Repository.service
try
{
var restr = _helperL.QuerySingle(x => x.ErrorName == Message).ErrorGuid;
- var res = _helperL.SqlExcute($"DELETE FROM Vacuum1Error WHERE ErrorName = '{Message}'");
+ var res = _helperL.SqlExcute($"DELETE FROM LiftError WHERE ErrorName = '{Message}'");
if (res == 0)
{
throw new Exception("删除数据不成功,可能没有指定ErrorMessage的错误");
@@ -270,7 +270,7 @@ namespace Sln.Iot.Repository.service
try
{
var restr = _helperO.QuerySingle(x => x.ErrorName == Message).ErrorGuid;
- var res = _helperO.SqlExcute($"DELETE FROM Vacuum1Error WHERE ErrorName = '{Message}'");
+ var res = _helperO.SqlExcute($"DELETE FROM OvenError WHERE ErrorName = '{Message}'");
if (res == 0)
{
throw new Exception("删除数据不成功,可能没有指定ErrorMessage的错误");
diff --git a/Sln.Iot.Repository/service/OvenPlcDataService.cs b/Sln.Iot.Repository/service/OvenPlcDataService.cs
index 9172a0d..2abc005 100644
--- a/Sln.Iot.Repository/service/OvenPlcDataService.cs
+++ b/Sln.Iot.Repository/service/OvenPlcDataService.cs
@@ -21,7 +21,7 @@ namespace Sln.Iot.Repository.service
}
}
- private SQLiteHelper _helper = SQLiteHelper.Instance;
+ private SQLiteHelper _helper = new SQLiteHelper();
private SerilogHelper _log = SerilogHelper.Instance;
diff --git a/Sln.Iot.Repository/service/TrayBindingService.cs b/Sln.Iot.Repository/service/TrayBindingService.cs
index b3cf39b..3a2b71f 100644
--- a/Sln.Iot.Repository/service/TrayBindingService.cs
+++ b/Sln.Iot.Repository/service/TrayBindingService.cs
@@ -24,7 +24,7 @@ namespace Sln.Iot.Repository.service
}
}
- private SQLiteHelper _helper = SQLiteHelper.Instance;
+ private SQLiteHelper _helper = new SQLiteHelper();
private SerilogHelper _log = SerilogHelper.Instance;
@@ -140,6 +140,10 @@ namespace Sln.Iot.Repository.service
};
entities.Add(entity);
}
+ if(entities.Count == 0 || entities == null)
+ {
+ return false;
+ }
_helper.InsertRange(entities);
return true;
}
@@ -161,7 +165,7 @@ namespace Sln.Iot.Repository.service
{
try
{
- int res = _helper.SqlExcute($"update TrayRfidBinding set time{timeCount} = '{timeString}' where TrayCode = '{trayCode}'");
+ int res = _helper.SqlExcute($@"update TrayRfidBinding set time{timeCount} = '{timeString}' where TrayCode = '{trayCode}' ");
if (res <= 0 || res > 6)
{
return false;
diff --git a/Sln.Iot.Repository/service/VacuumInjectionPlcDataService.cs b/Sln.Iot.Repository/service/VacuumInjectionPlcDataService.cs
index 921365c..ef7da15 100644
--- a/Sln.Iot.Repository/service/VacuumInjectionPlcDataService.cs
+++ b/Sln.Iot.Repository/service/VacuumInjectionPlcDataService.cs
@@ -22,7 +22,7 @@ namespace Sln.Iot.Repository.service
}
}
- private SQLiteHelper _helper = SQLiteHelper.Instance;
+ private SQLiteHelper _helper = new SQLiteHelper();
private SerilogHelper _log = SerilogHelper.Instance;
diff --git a/Sln.Iot.Test/UnitTest1.cs b/Sln.Iot.Test/UnitTest1.cs
index 0e98b95..6adf980 100644
--- a/Sln.Iot.Test/UnitTest1.cs
+++ b/Sln.Iot.Test/UnitTest1.cs
@@ -3,6 +3,8 @@ global using Sln.Iot.Repository.dao;
using Sln.Iot.Repository;
using Sln.Iot.Repository.service;
using System.Collections;
+using Sln.Iot.Business;
+using Sln.Iot.PLC;
namespace Sln.Iot.Test
{
@@ -11,12 +13,15 @@ namespace Sln.Iot.Test
[Fact]
public void Test1()
{
- byte[] bytes = new byte[] { 0, 1, 2, 4, 8, 16, 32, 64, 128, 255 };
+ //PLCӳʼ
+ PLCConnect.Instance.InitConnect();
+ UnitsProcessPLCDataGetBusiness unitsProcessPLCDataGetBusiness = UnitsProcessPLCDataGetBusiness.Instance;
- BitArray bits = new BitArray(bytes);
-
- bool[] bools = new bool[bits.Count];
- bits.CopyTo(bools, 0);
+ var data1 = unitsProcessPLCDataGetBusiness.Vacuum1PlcDataGet();
+ var data2 = unitsProcessPLCDataGetBusiness.Vacuum2PlcDataGet();
+ var data3 = unitsProcessPLCDataGetBusiness.PreHeatOvenPlcDataGet();
+ var data4 = unitsProcessPLCDataGetBusiness.PreCureOvenPlcDataGet();
+ var data5 = unitsProcessPLCDataGetBusiness.CureOvenPlcDataGet();
}
@@ -64,7 +69,7 @@ namespace Sln.Iot.Test
},
};
- var ress = SQLiteHelper.Instance.InsertRange(testDatas);
+ //var ress = SQLiteHelper.Instance.InsertRange(testDatas);
//var res = SQLiteHelper.Instance.DeleteRange("Tray002");
//Assert.Equal(5, res);
diff --git a/Sln.Iot/Program.cs b/Sln.Iot/Program.cs
index 9409a1a..cf9931f 100644
--- a/Sln.Iot/Program.cs
+++ b/Sln.Iot/Program.cs
@@ -61,34 +61,49 @@ namespace Sln.Iot
//配置文件加载
var appConfig = AppConfigSetting.Load();
//PLC连接初始化
- //PLCConnect.Instance.InitConnect();
- //业务类启动
- //BusinessStart business = new BusinessStart();
+ PLCConnect.Instance.InitConnect();
//CFX接口启动
//真空注胶机
- CFXConnect1.Instance.Init("CFX.A00.SDSH000001",
- new Uri("amqp://127.0.0.1:1235"),
- new Uri("amqp://127.0.0.1:8888"));
- ////升降回流
- //CFXConnect2.Instance.Init("CFX.A00.SDSH000002",
+ CFXConnect1.Instance.Init("CFX.A00.SDSH000001",
+ new Uri("amqp://127.0.0.1:1235"),
+ new Uri("amqp://127.0.0.1:30031"));
+ //升降回流
+ CFXConnect2.Instance.Init("CFX.A00.SDSH000002",
+ new Uri("amqp://127.0.0.1:1236"),
+ new Uri("amqp://127.0.0.1:30031"));
+ //隧道烤箱
+ CFXConnect3.Instance.Init("CFX.A00.SDSH000003",
+ new Uri("amqp://127.0.0.1:1237"),
+ new Uri("amqp://127.0.0.1:30031"));
+
+
+ ////CFX接口启动
+ ////真空注胶机
+ //CFXConnect1.Instance.Init("CFX.A00.SDSH000001",
// new Uri("amqp://127.0.0.1:1235"),
// new Uri("amqp://127.0.0.1:8888"));
+ ////升降回流
+ //CFXConnect2.Instance.Init("CFX.A00.SDSH000002",
+ // new Uri("amqp://127.0.0.1:1235"),
+ // new Uri("amqp://127.0.0.1:8888"));
////隧道烤箱
- //CFXConnect3.Instance.Init("CFX.A00.SDSH000003",
- // new Uri("amqp://127.0.0.1:1235"),
+ //CFXConnect3.Instance.Init("CFX.A00.SDSH000003",
+ // new Uri("amqp://127.0.0.1:1235"),
// new Uri("amqp://127.0.0.1:8888"));
+
+ //业务类启动
+ BusinessStart business = new BusinessStart();
+
log.Info($"系统启动成功,日志存放位置:{appConfig.logPath}");
- CFXTest cFXTest = new CFXTest();
- cFXTest.Test1();
+ //CFXTest cFXTest = new CFXTest();
+ //cFXTest.Test1();
- //test();
+ //TestBusiness test = new TestBusiness();
await Task.Delay(-1);
-
-
}
///
@@ -100,11 +115,5 @@ namespace Sln.Iot
CFXConnect2.Instance.PublishEvent(new CFXEnvelope(new EndpointShuttingDownEvent().Handle(CFXConnect2.Instance.CFXHandle)));
CFXConnect3.Instance.PublishEvent(new CFXEnvelope(new EndpointShuttingDownEvent().Handle(CFXConnect3.Instance.CFXHandle)));
}
-
- private static void test()
- {
- TestBusiness test = new TestBusiness();
-
- }
}
}
\ No newline at end of file