diff --git a/Common/Const/EquipmentType.cs b/Common/Const/EquipmentType.cs
index 7f6f2f4..f14e24b 100644
--- a/Common/Const/EquipmentType.cs
+++ b/Common/Const/EquipmentType.cs
@@ -5,5 +5,6 @@ public enum EquipmentType
Charger,
Ammeter,
WaterCool,
- Plc
+ Plc,
+ BMS
}
diff --git a/Common/Util/HttpUtil.cs b/Common/Util/HttpUtil.cs
index 0d9e8a6..db474ba 100644
--- a/Common/Util/HttpUtil.cs
+++ b/Common/Util/HttpUtil.cs
@@ -3,6 +3,9 @@ using Newtonsoft.Json;
namespace Common.Util;
+///
+/// http工具类
+///
public static class HttpUtil
{
private static readonly HttpClient httpClient = new HttpClient();
diff --git a/Common/lib/HybirdFrameworkCore.dll b/Common/lib/HybirdFrameworkCore.dll
index 608abef..c0fb98b 100644
Binary files a/Common/lib/HybirdFrameworkCore.dll and b/Common/lib/HybirdFrameworkCore.dll differ
diff --git a/Common/lib/HybirdFrameworkDriver.dll b/Common/lib/HybirdFrameworkDriver.dll
index 9c92151..3ffe052 100644
Binary files a/Common/lib/HybirdFrameworkDriver.dll and b/Common/lib/HybirdFrameworkDriver.dll differ
diff --git a/Entity/DbModel/Station/ChargeOrder.cs b/Entity/DbModel/Station/ChargeOrder.cs
index 94ad8e4..0b0dd3d 100644
--- a/Entity/DbModel/Station/ChargeOrder.cs
+++ b/Entity/DbModel/Station/ChargeOrder.cs
@@ -16,7 +16,7 @@ namespace Entity.DbModel.Station
/// Desc:id
/// Default:
/// Nullable:False
- ///
+ ///
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "id")]
public int Id { get; set; }
@@ -37,7 +37,7 @@ namespace Entity.DbModel.Station
public string BatteryNo { get; set; }
///
- /// Desc:启动报文状态;0-初始化;1-启动成功
+ /// Desc:启动报文状态;0-初始化;1-启动成功;2-启动失败
/// Default:0
/// Nullable:True
///
@@ -51,7 +51,7 @@ namespace Entity.DbModel.Station
///
[SugarColumn(ColumnName = "charger_no")]
public string ChargerNo { get; set; }
-
+
///
/// Desc:充电枪编号
/// Default:
@@ -59,7 +59,7 @@ namespace Entity.DbModel.Station
///
[SugarColumn(ColumnName = "charger_gun_no")]
public string ChargerGunNo { get; set; }
-
+
///
/// Desc:站外充电枪编号,1枪或2枪
/// Default:
@@ -266,9 +266,9 @@ namespace Entity.DbModel.Station
/// Nullable:True
///
[SugarColumn(ColumnName = "cloud_report_status")]
- public int? CloudReportStatus { get; set; }
+ public int CloudReportStatus { get; set; }
+
-
///
/// Desc:云平台订单编号
/// Default:
@@ -283,6 +283,19 @@ namespace Entity.DbModel.Station
/// Nullable:True
///
[SugarColumn(ColumnName = "can_upload")]
- public int? CanUpload { get; set; }
+ public int CanUpload { get; set; }
+
+ ///
+ /// 启动方式:0-站控自动启动,1-站控手动启动,2-充电机启动
+ ///
+ [SugarColumn(ColumnName = "start_type")]
+ public int StartType { get; set; }
+
+
+ ///
+ /// 上报次数
+ ///
+ [SugarColumn(ColumnName = "reporting_times")]
+ public int ReportingTimes { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/Entity/DbModel/Station/EquipAlarmDefine.cs b/Entity/DbModel/Station/EquipAlarmDefine.cs
index 08b8aa7..95b84d4 100644
--- a/Entity/DbModel/Station/EquipAlarmDefine.cs
+++ b/Entity/DbModel/Station/EquipAlarmDefine.cs
@@ -67,4 +67,6 @@ public partial class EquipAlarmDefine : BaseModel
///
[SugarColumn(ColumnName = "process_method")]
public string ProcessMethod { get; set; }
+
+
}
\ No newline at end of file
diff --git a/Entity/DbModel/Station/EquipAlarmProcessRecord.cs b/Entity/DbModel/Station/EquipAlarmProcessRecord.cs
index b214b5f..9e00eb0 100644
--- a/Entity/DbModel/Station/EquipAlarmProcessRecord.cs
+++ b/Entity/DbModel/Station/EquipAlarmProcessRecord.cs
@@ -3,84 +3,84 @@
namespace Entity.DbModel.Station;
///
-///设备报警处理记录
-///
-[SugarTable("equip_alarm_process_record")]
-public partial class EquipAlarmProcessRecord : BaseModel
-{
- public EquipAlarmProcessRecord()
+ ///设备报警处理记录
+ ///
+ [SugarTable("equip_alarm_process_record")]
+ public partial class EquipAlarmProcessRecord : BaseModel
{
- }
+ public EquipAlarmProcessRecord()
+ {
+ }
- ///
- /// Desc:id
- /// Default:
- /// Nullable:False
- ///
- [SugarColumn(ColumnName = "id")]
- public int Id { get; set; }
+ ///
+ /// Desc:id
+ /// Default:
+ /// Nullable:False
+ ///
+ [SugarColumn(ColumnName = "id")]
+ public int Id { get; set; }
- ///
- /// Desc:设备类型编码
- /// Default:
- /// Nullable:True
- ///
- [SugarColumn(ColumnName = "equip_type_code")]
- public int EquipTypeCode { get; set; }
+ ///
+ /// Desc:设备类型编码
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName = "equip_type_code")]
+ public int EquipTypeCode { get; set; }
- ///
- /// Desc:设备编码
- /// Default:
- /// Nullable:True
- ///
- [SugarColumn(ColumnName = "equip_code")]
- public string EquipCode { get; set; }
+ ///
+ /// Desc:设备编码
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName = "equip_code")]
+ public string EquipCode { get; set; }
- ///
- /// Desc:报警编码
- /// Default:
- /// Nullable:True
- ///
- [SugarColumn(ColumnName = "error_code")]
- public string ErrorCode { get; set; }
+ ///
+ /// Desc:报警编码
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName = "error_code")]
+ public string ErrorCode { get; set; }
- ///
- /// Desc:报警等级
- /// Default:
- /// Nullable:True
- ///
- [SugarColumn(ColumnName = "error_level")]
- public string ErrorLevel { get; set; }
+ ///
+ /// Desc:报警等级
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName = "error_level")]
+ public string ErrorLevel { get; set; }
- ///
- /// Desc:报警描述
- /// Default:
- /// Nullable:True
- ///
- [SugarColumn(ColumnName = "error_msg")]
- public string ErrorMsg { get; set; }
+ ///
+ /// Desc:报警描述
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName = "error_msg")]
+ public string ErrorMsg { get; set; }
- ///
- /// Desc:处理方法
- /// Default:
- /// Nullable:True
- ///
- [SugarColumn(ColumnName = "process_method")]
- public string ProcessMethod { get; set; }
+ ///
+ /// Desc:处理方法
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName = "process_method")]
+ public string ProcessMethod { get; set; }
+ ///
+ /// Desc:开始时间
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName = "start_time")]
+ public DateTime? StartTime { get; set; }
+ ///
+ /// Desc:处理时间
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName = "process_time")]
+ public DateTime? ProcessTime { get; set; }
- ///
- /// Desc:开始时间
- /// Default:
- /// Nullable:True
- ///
- [SugarColumn(ColumnName = "start_time")]
- public DateTime? StartTime { get; set; }
-
- ///
- /// Desc:处理时间
- /// Default:
- /// Nullable:True
- ///
- [SugarColumn(ColumnName = "process_time")]
- public DateTime? ProcessTime { get; set; }
-}
\ No newline at end of file
+
+ }
\ No newline at end of file
diff --git a/Entity/DbModel/Station/EquipAlarmRecord.cs b/Entity/DbModel/Station/EquipAlarmRecord.cs
index 1862bfb..75e8fa8 100644
--- a/Entity/DbModel/Station/EquipAlarmRecord.cs
+++ b/Entity/DbModel/Station/EquipAlarmRecord.cs
@@ -75,4 +75,6 @@ public partial class EquipAlarmRecord : BaseModel
///
[SugarColumn(ColumnName = "start_time")]
public DateTime? StartTime { get; set; }
+
+
}
\ No newline at end of file
diff --git a/Entity/Dto/Resp/ChargerPileResp.cs b/Entity/Dto/Resp/ChargerPileResp.cs
new file mode 100644
index 0000000..d64a533
--- /dev/null
+++ b/Entity/Dto/Resp/ChargerPileResp.cs
@@ -0,0 +1,38 @@
+namespace Entity.Dto.Resp;
+
+///
+/// 充电桩信息
+///
+public class ChargerPileResp
+{
+ public ChargerPileResp()
+ {
+ }
+
+ public string Sn { get; set; }
+ ///
+ /// 站外1枪是否充电
+ ///
+ public bool GunChargedOne { get; set; }
+ ///
+ /// 站外2枪是否充电
+ ///
+ public bool GunChargedTwo { get; set; }
+ ///
+ /// 站外1枪是否连接
+ ///
+ public bool ChargedPileOne { get; set; }
+ ///
+ /// 站外2枪是否连接
+ ///
+ public bool ChargedPileTwo { get; set; }
+ ///
+ /// 站外1枪充电功率
+ ///
+ public float? ChargePilePowerOne { get; set; }
+ ///
+ /// 站外2枪充电功率
+ ///
+ public float? ChargePilePowerTwo { get; set; }
+
+}
\ No newline at end of file
diff --git a/Repository/Station/EquipAlarmDefineRepository.cs b/Repository/Station/EquipAlarmDefineRepository.cs
index c8b5e19..1163b51 100644
--- a/Repository/Station/EquipAlarmDefineRepository.cs
+++ b/Repository/Station/EquipAlarmDefineRepository.cs
@@ -10,7 +10,7 @@ public class EquipAlarmDefineRepository : BaseRepository
public EquipAlarmDefineRepository(ISqlSugarClient sqlSugar) : base(sqlSugar)
{
}
-
+
///
///
///
diff --git a/Repository/Station/EquipAlarmRecordRepository.cs b/Repository/Station/EquipAlarmRecordRepository.cs
index 7fbbab5..40a71f6 100644
--- a/Repository/Station/EquipAlarmRecordRepository.cs
+++ b/Repository/Station/EquipAlarmRecordRepository.cs
@@ -10,10 +10,4 @@ public class EquipAlarmRecordRepository : BaseRepository
public EquipAlarmRecordRepository(ISqlSugarClient sqlSugar) : base(sqlSugar)
{
}
-
- public EquipAlarmRecord? SelectByEquipCodeAndErrorCode(int equipTypeCode, string equipCode, string errorCode)
- {
- return this.QueryByClause(it => it.EquipTypeCode == equipTypeCode &&
- it.EquipCode == equipCode && it.ErrorCode == errorCode);
- }
}
\ No newline at end of file
diff --git a/Repository/Station/EquipInfoRepository.cs b/Repository/Station/EquipInfoRepository.cs
index 4e7f73d..a4e679e 100644
--- a/Repository/Station/EquipInfoRepository.cs
+++ b/Repository/Station/EquipInfoRepository.cs
@@ -27,7 +27,7 @@ public class EquipInfoRepository: BaseRepository
.WhereIF(isWhere1, expression1)
.WhereIF(isWhere2, expression2)
.WhereIF(isWhere3, expression3)
- .OrderBuilder(input)
+ .OrderBuilder(input, "", "Id", false)
.WithNoLockOrNot(blUseNoLock)
.ToPageListAsync(pageNumber, pageSize, totalNumber);
diff --git a/Service/Charger/ChargerService.cs b/Service/Charger/ChargerService.cs
index 6512f24..256f4f6 100644
--- a/Service/Charger/ChargerService.cs
+++ b/Service/Charger/ChargerService.cs
@@ -48,9 +48,9 @@ public class ChargerService
byte chargeSoc = StaticStationInfo.ChargeSoc;
- float? chargePower = EquipInfoRepository.QueryPowerByCode(binNo);
+ float? chargePower = EquipInfoRepository.QueryPowerByCode(binInfo.ChargerNo);
float? power = chargePower == null ? StaticStationInfo.ChargePower : chargePower;
- return chargerClient.StartCharge(chargeSoc,(float)power);
+ return chargerClient.StartCharge(chargeSoc,(float)power, 1);
}
///
@@ -114,30 +114,30 @@ public class ChargerService
SetPeakValleyTime setPeakValleyTime = new SetPeakValleyTime()
{
NumberTime = Convert.ToByte(elecPriceModelVersionDetails.Count),
- StartHH1 = Convert.ToByte(elecPriceModelVersionDetails[0].StartHour),
- StartHH2 = Convert.ToByte(elecPriceModelVersionDetails[1].StartHour),
- StartHH3 = Convert.ToByte(elecPriceModelVersionDetails[2].StartHour),
- StartHH4 = Convert.ToByte(elecPriceModelVersionDetails[3].StartHour),
- StartHH5 = Convert.ToByte(elecPriceModelVersionDetails[4].StartHour),
- StartHH6 = Convert.ToByte(elecPriceModelVersionDetails[5].StartHour),
- StartHH7 = Convert.ToByte(elecPriceModelVersionDetails[6].StartHour),
- StartHH8 = Convert.ToByte(elecPriceModelVersionDetails[7].StartHour),
- StartMM1 = Convert.ToByte(elecPriceModelVersionDetails[0].StartMinute),
- StartMM2 = Convert.ToByte(elecPriceModelVersionDetails[1].StartMinute),
- StartMM3 = Convert.ToByte(elecPriceModelVersionDetails[2].StartMinute),
- StartMM4 = Convert.ToByte(elecPriceModelVersionDetails[3].StartMinute),
- StartMM5 = Convert.ToByte(elecPriceModelVersionDetails[4].StartMinute),
- StartMM6 = Convert.ToByte(elecPriceModelVersionDetails[5].StartMinute),
- StartMM7 = Convert.ToByte(elecPriceModelVersionDetails[6].StartMinute),
- StartMM8 = Convert.ToByte(elecPriceModelVersionDetails[7].StartMinute),
- TimePeak1 = Convert.ToByte(elecPriceModelVersionDetails[0].Type),
- TimePeak2 = Convert.ToByte(elecPriceModelVersionDetails[1].Type),
- TimePeak3 = Convert.ToByte(elecPriceModelVersionDetails[2].Type),
- TimePeak4 = Convert.ToByte(elecPriceModelVersionDetails[3].Type),
- TimePeak5 = Convert.ToByte(elecPriceModelVersionDetails[4].Type),
- TimePeak6 = Convert.ToByte(elecPriceModelVersionDetails[5].Type),
- TimePeak7 = Convert.ToByte(elecPriceModelVersionDetails[6].Type),
- TimePeak8 = Convert.ToByte(elecPriceModelVersionDetails[7].Type)
+ StartHH1 = (byte)(elecPriceModelVersionDetails.Count > 0?Convert.ToByte(elecPriceModelVersionDetails[0].StartHour) :0),
+ StartHH2 = (byte)(elecPriceModelVersionDetails.Count > 1?Convert.ToByte(elecPriceModelVersionDetails[1].StartHour) : 0),
+ StartHH3 = (byte)(elecPriceModelVersionDetails.Count > 2?Convert.ToByte(elecPriceModelVersionDetails[2].StartHour):0),
+ StartHH4 = (byte)(elecPriceModelVersionDetails.Count > 3?Convert.ToByte(elecPriceModelVersionDetails[3].StartHour):0),
+ StartHH5 = (byte)(elecPriceModelVersionDetails.Count > 4?Convert.ToByte(elecPriceModelVersionDetails[4].StartHour):0),
+ StartHH6 = (byte)(elecPriceModelVersionDetails.Count > 5?Convert.ToByte(elecPriceModelVersionDetails[5].StartHour):0),
+ StartHH7 = (byte)(elecPriceModelVersionDetails.Count > 6?Convert.ToByte(elecPriceModelVersionDetails[6].StartHour):0),
+ StartHH8 = (byte)(elecPriceModelVersionDetails.Count > 7?Convert.ToByte(elecPriceModelVersionDetails[7].StartHour) : 0),
+ StartMM1 = (byte)(elecPriceModelVersionDetails.Count > 0?Convert.ToByte(elecPriceModelVersionDetails[0].StartMinute):0),
+ StartMM2 = (byte)(elecPriceModelVersionDetails.Count > 1?Convert.ToByte(elecPriceModelVersionDetails[1].StartMinute):0),
+ StartMM3 = (byte)(elecPriceModelVersionDetails.Count > 2?Convert.ToByte(elecPriceModelVersionDetails[2].StartMinute):0),
+ StartMM4 = (byte)(elecPriceModelVersionDetails.Count > 3?Convert.ToByte(elecPriceModelVersionDetails[3].StartMinute):0),
+ StartMM5 = (byte)(elecPriceModelVersionDetails.Count > 4?Convert.ToByte(elecPriceModelVersionDetails[4].StartMinute):0),
+ StartMM6 = (byte)(elecPriceModelVersionDetails.Count > 5?Convert.ToByte(elecPriceModelVersionDetails[5].StartMinute):0),
+ StartMM7 = (byte)(elecPriceModelVersionDetails.Count > 6?Convert.ToByte(elecPriceModelVersionDetails[6].StartMinute) : 0),
+ StartMM8 = (byte)(elecPriceModelVersionDetails.Count > 7 ? Convert.ToByte(elecPriceModelVersionDetails[7].StartMinute) : 0),
+ TimePeak1 = (byte)(elecPriceModelVersionDetails.Count > 0 ? Convert.ToByte(elecPriceModelVersionDetails[0].Type):0),
+ TimePeak2 = (byte)(elecPriceModelVersionDetails.Count > 1?Convert.ToByte(elecPriceModelVersionDetails[1].Type):0),
+ TimePeak3 = (byte)(elecPriceModelVersionDetails.Count > 2?Convert.ToByte(elecPriceModelVersionDetails[2].Type):0),
+ TimePeak4 = (byte)(elecPriceModelVersionDetails.Count > 3?Convert.ToByte(elecPriceModelVersionDetails[3].Type):0),
+ TimePeak5 = (byte)(elecPriceModelVersionDetails.Count > 4?Convert.ToByte(elecPriceModelVersionDetails[4].Type):0),
+ TimePeak6 = (byte)(elecPriceModelVersionDetails.Count > 5?Convert.ToByte(elecPriceModelVersionDetails[5].Type):0),
+ TimePeak7 = (byte)(elecPriceModelVersionDetails.Count > 6?Convert.ToByte(elecPriceModelVersionDetails[6].Type):0),
+ TimePeak8 = (byte)(elecPriceModelVersionDetails.Count > 7?Convert.ToByte(elecPriceModelVersionDetails[7].Type):0)
};
return setPeakValleyTime;
}
@@ -153,7 +153,7 @@ public class ChargerService
if (binInfos.Count > 0)
batteryStatusInfoResp.btyTotalCount = binInfos.Count();
List canSwapCounts = BinInfoRepository.QueryListByClause(i =>
- i.Exists == 1 && i.Status == 1 && i.Soc > Convert.ToDecimal(StaticStationInfo.SwapSoc));
+ i.Exists == 1 && i.Status == 1 && i.Soc >= Convert.ToDecimal(StaticStationInfo.SwapSoc) && i.ChargeStatus!=1);
if (canSwapCounts.Count > 0)
batteryStatusInfoResp.canSwapCount = canSwapCounts.Count();
List chargingCounts =
@@ -162,4 +162,4 @@ public class ChargerService
batteryStatusInfoResp.chargingCount = chargingCounts.Count();
return Result.Success(batteryStatusInfoResp);
}
-}
\ No newline at end of file
+}
diff --git a/Service/Charger/Client/ChargerClient.cs b/Service/Charger/Client/ChargerClient.cs
index 4b0d09c..b8cc721 100644
--- a/Service/Charger/Client/ChargerClient.cs
+++ b/Service/Charger/Client/ChargerClient.cs
@@ -1,4 +1,5 @@
using System.Collections.Concurrent;
+using System.Reflection;
using Autofac;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac;
@@ -18,9 +19,9 @@ using Service.Charger.Msg;
using Service.Charger.Msg.Charger.OutCharger.Req;
using Service.Charger.Msg.Charger.Req;
using Service.Charger.Msg.Charger.Resp;
-using Service.Charger.Msg.Host.OutCharger.Req;
using Service.Charger.Msg.Host.Req;
using Service.Charger.Msg.Host.Req.Bms;
+using Service.Charger.Msg.Host.Req.OutCharger.Req;
namespace Service.Charger.Client;
@@ -30,7 +31,6 @@ namespace Service.Charger.Client;
[Scope("InstancePerDependency")]
public class ChargerClient : TcpClient
{
-
#region 属性
///
@@ -50,9 +50,8 @@ public class ChargerClient : TcpClient
/// 是否已经开始充电
///
public bool IsCharged { get; set; } = false;
-
-
-
+
+
///
/// 站外两枪时是否在充电
///
@@ -61,6 +60,7 @@ public class ChargerClient : TcpClient
[1] = false,
[2] = false
};
+
///
/// 充电桩连接状态
///
@@ -69,7 +69,7 @@ public class ChargerClient : TcpClient
[1] = false,
[2] = false
};
-
+
public bool IsStopped { get; set; } = false;
public bool IsCanSendStopCmd { get; set; } = true;
@@ -151,30 +151,37 @@ public class ChargerClient : TcpClient
/// 充电机遥测数据
///
public UploadTelemetryData UploadTelemetryData = new UploadTelemetryData();
-
+
///
/// 充放电机上传单体动力蓄电池电压极值统计
///
public VoltageExtremumStatistics? VoltageExtremumStatistics = new VoltageExtremumStatistics();
-
+
///
/// 充电桩的遥测
///
public ConcurrentDictionary PileUploadTelemetry = new();
+
///
/// 充电桩的遥信
///
public ConcurrentDictionary PileUploadRemoteSignal = new();
-
+
///
/// 充电桩状态信息
///
public ConcurrentDictionary ChargerPile = new();
+
+ ///
+ /// 充电桩功率
+ ///
+ public ConcurrentDictionary ChargePilePower = new();
+
///
///充电机实时充电功率
///
public float RealTimeChargePower { get; set; } = 0;
-
+
///
/// 心跳-桩状态
///
@@ -455,9 +462,20 @@ public class ChargerClient : TcpClient
return Result.Fail($"charger-{BinNo} disconnect");
}
+
+
+
+ setPeakValleyTime= GetMsgContents(setPeakValleyTime);
+
+
+
CurrentCmd = JsonConvert.SerializeObject(setPeakValleyTime, Formatting.Indented) + "\r\n" +
BitUtls.BytesToHexStr(setPeakValleyTime.ToBytes());
+
this.Channel.WriteAndFlushAsync(setPeakValleyTime);
+
+ Log().Info($"SendSetPeakValleyTime{CurrentCmd} to chargeOrderNo={BinNo}");
+
return Result.Success();
}
@@ -494,6 +512,7 @@ public class ChargerClient : TcpClient
this.Channel.WriteAndFlushAsync(req);
return Result.Success();
}
+
///
/// 3.7.1 监控平台远程启动充电桩充电
///
@@ -503,7 +522,8 @@ public class ChargerClient : TcpClient
/// 功率调节参数
///
/// 充电流水号
- public Result SendStartOutCharger(byte pn, byte socValue, short changePower=360,byte changePowerCmdType=1 ,
+ public Result SendStartOutCharger(byte pn, byte socValue, short changePower = 360,
+ byte changePowerCmdType = 1,
string? chargeOrderNo = null)
{
if (!Connected)
@@ -519,12 +539,14 @@ public class ChargerClient : TcpClient
Log().Info(
$"SendStartOutCharger pn={pn}, socValue={socValue}, changePower={changePower}, changePowerCmdType={changePowerCmdType}, chargeOrderNo={chargeOrderNo}");
- PileStartCharge pileStartCharge = new PileStartCharge(pn, socValue, changePowerCmdType, changePower,chargeOrderNo);
-
+ PileStartCharge pileStartCharge =
+ new PileStartCharge(pn, socValue, changePowerCmdType, changePower, chargeOrderNo);
+
this.Channel.WriteAndFlushAsync(pileStartCharge);
return Result.Success(chargeOrderNo);
}
+
///
/// 3.7.3 监控平台远程停止充电桩充电
///
@@ -537,14 +559,33 @@ public class ChargerClient : TcpClient
{
return Result.Fail($"充电机{BinNo}未连接");
}
-
+
Log().Info(
$"SendStartOutCharger pn={pn}, stopReason={stopReason}");
- PileStopCharge pileStopCharge=new PileStopCharge(pn,stopReason);
+ PileStopCharge pileStopCharge = new PileStopCharge(pn, stopReason);
this.Channel.WriteAndFlushAsync(pileStopCharge);
return Result.Success();
}
+
+ ///
+ /// 3.7.9 监控平台发送充电桩功率调节指令
+ ///
+ ///
+ ///
+ ///
+ public Result SendPileAdjustPower(byte pn, float expectedOperatingPower)
+ {
+ if (!Connected)
+ {
+ return Result.Fail($"charger-{BinNo} disconnect");
+ }
+
+ PileAdjustPower powerRegulation = new PileAdjustPower(pn, expectedOperatingPower);
+ this.Channel.WriteAndFlushAsync(powerRegulation);
+ return Result.Success();
+ }
+
///
///
///
@@ -570,7 +611,7 @@ public class ChargerClient : TcpClient
///
///
///
- public Result StartCharge(byte chargeSoc, float chargePower)
+ public Result StartCharge(byte chargeSoc, float chargePower, int startType)
{
if (string.IsNullOrWhiteSpace(BinNo))
{
@@ -589,17 +630,17 @@ public class ChargerClient : TcpClient
}
BatteryNo = binInfo.BatteryNo;
- if (string.IsNullOrWhiteSpace(BatteryNo))
+ if (string.IsNullOrWhiteSpace(BatteryNo) || "-1" == BatteryNo)
{
return Result.Fail($"charger-{BinNo} battery not exist");
}
- if (binInfo.AmtLock == 1)
+ if (binInfo.AmtLock == 1)
{
return Result.Fail($"仓-{BinNo} 被锁定");
}
- if (binInfo.CanChargeFlag == 0)
+ if (binInfo.CanChargeFlag == 0)
{
return Result.Fail($"仓-{BinNo} 被禁用");
}
@@ -620,6 +661,9 @@ public class ChargerClient : TcpClient
return Result.Fail(chargeOrderNo.Msg);
}
+ SwapOrderBatteryRepository swapOrderBatteryRepository = AppInfo.Container.Resolve();
+ SwapOrderBattery? swapOrder = swapOrderBatteryRepository.QueryLatestOrderNoByBatterySn(BatteryNo);
+
ChargeOrderNo = chargeOrderNo.Data;
_chargeOrderRepository.Insert(new ChargeOrder()
{
@@ -628,7 +672,9 @@ public class ChargerClient : TcpClient
CmdStatus = 0,
ChargerNo = BinNo,
ChargeMode = 1,
- StartMode = 1
+ SwapOrderSn = swapOrder?.SwapOrderSn,
+ StartMode = 1,
+ StartType = startType
});
return Result.Success(true, "发送成功");
@@ -659,4 +705,33 @@ public class ChargerClient : TcpClient
ChannelUtils.AddAttr(Channel, ChargerConst.EqmCode, sn);
ChannelUtils.AddAttr(Channel, ChargerConst.DestAddr, destAddr);
}
+
+
+ ///
+ /// 获取尖峰平谷字节数组
+ ///
+ ///
+ /// 鉴权消息体字节数组
+ private SetPeakValleyTime GetMsgContents(SetPeakValleyTime timeRng)
+ {
+ for (int i = 0; i < timeRng.NumberTime; i++)
+ {
+
+ PropertyInfo propertyStartTimePeriod1 = timeRng.GetType().GetProperty("StartHH" + (i + 1));
+ propertyStartTimePeriod1.SetValue(timeRng, BitUtls.ByteToBCD(Convert.ToByte(timeRng.GetType().GetProperty("StartHH" + (i + 1)).GetValue(timeRng))));
+
+
+ PropertyInfo propertyStartTimePeriod2 = timeRng.GetType().GetProperty("StartMM" + (i + 1));
+ propertyStartTimePeriod2.SetValue(timeRng, BitUtls.ByteToBCD(Convert.ToByte(timeRng.GetType().GetProperty("StartMM" + (i + 1)).GetValue(timeRng))));
+
+ PropertyInfo propertyTimePeriodPeakIden = timeRng.GetType().GetProperty("TimePeak" + (i + 1));
+ propertyTimePeriodPeakIden.SetValue(timeRng, timeRng.GetType().GetProperty("TimePeak" + (i + 1)).GetValue(timeRng));
+
+
+
+ }
+
+ return timeRng;
+ }
+
}
diff --git a/Service/Charger/Client/ChargerPile.cs b/Service/Charger/Client/ChargerPile.cs
index 240b1a6..a5f3f07 100644
--- a/Service/Charger/Client/ChargerPile.cs
+++ b/Service/Charger/Client/ChargerPile.cs
@@ -46,5 +46,10 @@ public class ChargerPile
/// 充电枪的唯一标识码
///
public string? pn { get; set; }
+
+ ///
+ /// 工作状态
+ ///
+ public byte WorkStatus { get; set; }
}
\ No newline at end of file
diff --git a/Service/Charger/Codec/Decoder.cs b/Service/Charger/Codec/Decoder.cs
index 869098d..6826491 100644
--- a/Service/Charger/Codec/Decoder.cs
+++ b/Service/Charger/Codec/Decoder.cs
@@ -250,6 +250,7 @@ public class Decoder : ByteToMessageDecoder
12 => ModelConvert.Decode(bytes),
11 => ModelConvert.Decode(bytes),
14 => ModelConvert.Decode(bytes),
+ 10 => ModelConvert.Decode(bytes),
_ => throw new InvalidOperationException("This should never be reached"),
},
#endregion
diff --git a/Service/Charger/Common/ChargerConst.cs b/Service/Charger/Common/ChargerConst.cs
index ccc94df..b3996f9 100644
--- a/Service/Charger/Common/ChargerConst.cs
+++ b/Service/Charger/Common/ChargerConst.cs
@@ -4,13 +4,15 @@ namespace Service.Charger.Common;
public static class ChargerConst
{
-
+
public static readonly AttributeKey ChargerSn = AttributeKey.ValueOf("charger_sn");
- public static readonly AttributeKey WaterCoolSn = AttributeKey.ValueOf("water_cool_sn");
public static readonly AttributeKey EqmTypeNo = AttributeKey.ValueOf("eqm_type_no");
public static readonly AttributeKey EqmCode = AttributeKey.ValueOf("eqm_code");
public static readonly AttributeKey DestAddr = AttributeKey.ValueOf("dest_addr");
+
+
public static readonly string DateFormat = "yyMMddHHmmss";
+ public static readonly string yyyyMMddHHmmss = "yyyyMMddHHmmss";
public static readonly byte[] StartChar = { 0x68 /* ,0xEE*/ };
public static readonly string AuthCode = "szhckj01";
@@ -27,13 +29,13 @@ public enum ChargingStatus
{
UnKnown=0,
StartChargingSuccess=1,
-
+
StopChargingSuccess=4,
Authed=5,
AuthFailed=6,
-
+
StartChargingFailed=7,
// Charging,
StopChargingFailed=8
-}
\ No newline at end of file
+}
diff --git a/Service/Charger/Common/ChargerUtils.cs b/Service/Charger/Common/ChargerUtils.cs
index e0ca4b3..ab3e2aa 100644
--- a/Service/Charger/Common/ChargerUtils.cs
+++ b/Service/Charger/Common/ChargerUtils.cs
@@ -58,6 +58,12 @@ public static class ChargerUtils
return StaticStationInfo.StationNo + DateTime.Now.ToString(ChargerConst.DateFormat) +
GetRandomNumLimit99();
}
+
+ public static string GenChargeOrderNo(string chargerSn)
+ {
+ return StaticStationInfo.StationNo +chargerSn + DateTime.Now.ToString(ChargerConst.yyyyMMddHHmmss) +
+ GetRandomNumLimit99();
+ }
///
/// 根据云平台下发,计算本地充电机枪号
///
@@ -84,7 +90,7 @@ public static class ChargerUtils
throw new ArgumentException("转换失败");
}
}
-
+
public static string GetOutChargerCode(string number)
{
int parsedNumber;
@@ -99,10 +105,10 @@ public static class ChargerUtils
{
throw new ArgumentException("转换失败");
}
-
+
}
-
-
+
+
///
/// 根据本地充电枪编号,充电机code,计算云平台下发充电枪编号
///
@@ -185,4 +191,4 @@ public static class ChargerUtils
return results;
}
-}
\ No newline at end of file
+}
diff --git a/Service/Charger/Common/WaterCoolerConst.cs b/Service/Charger/Common/WaterCoolerConst.cs
new file mode 100644
index 0000000..906fe6d
--- /dev/null
+++ b/Service/Charger/Common/WaterCoolerConst.cs
@@ -0,0 +1,8 @@
+using DotNetty.Common.Utilities;
+
+namespace Service.Charger.Common;
+
+public class WaterCoolerConst
+{
+ public static readonly AttributeKey WaterCoolSn = AttributeKey.ValueOf("water_cool_sn");
+}
\ No newline at end of file
diff --git a/Service/Charger/Handler/FinishStartChargingHandler.cs b/Service/Charger/Handler/FinishStartChargingHandler.cs
index 9ea4c71..9b149fa 100644
--- a/Service/Charger/Handler/FinishStartChargingHandler.cs
+++ b/Service/Charger/Handler/FinishStartChargingHandler.cs
@@ -2,6 +2,7 @@
using DotNetty.Transport.Channels;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac.Attribute;
+using HybirdFrameworkCore.Utils;
using log4net;
using Repository.Station;
using Service.Charger.Client;
@@ -28,7 +29,7 @@ namespace HybirdFrameworkServices.Charger.Handler
public BinInfoRepository BinInfoRepository { get; set; }
public ChargeOrderRepository ChargeOrderRepository { get; set; }
public SwapOrderBatteryRepository SwapOrderBatteryRepository { get; set; }
-
+
private static readonly ILog Log = LogManager.GetLogger(typeof(FinishStartChargingHandler));
protected override void ChannelRead0(IChannelHandlerContext ctx, FinishStartCharging msg)
{
@@ -47,7 +48,7 @@ namespace HybirdFrameworkServices.Charger.Handler
{
ChargeOrderRepository.Update(it => it.SwapOrderSn == swapOrderBattery.SwapOrderSn,
it => it.Sn == client.ChargeOrderNo);
-
+
List orders = ChargeOrderRepository.QueryBySwapOrderAndBatterySn(swapOrderBattery.SwapOrderSn,
client.BatteryNo);
if (orders.Count > 0)
@@ -59,32 +60,39 @@ namespace HybirdFrameworkServices.Charger.Handler
{
cloudChargeOrder = order.CloudChargeOrder;
}
-
+
}
if (string.IsNullOrWhiteSpace(cloudChargeOrder))
{
- cloudChargeOrder = ChargerUtils.GenChargeOrderSn();
+ cloudChargeOrder = ChargerUtils.GenChargeOrderNo(sn);
}
HashSet hashSet = orders.Select(it => it.Id).ToHashSet();
ChargeOrderRepository.Update(it => it.CloudChargeOrder == cloudChargeOrder,
it => hashSet.Contains(it.Id));
}
-
-
+
+
}
else
{
Log.Error($"can not find swapOrderBattery by {client.BatteryNo}");
}
-
+
}
else if (msg.Result == 1)
{
client.IsCharged = false;
}
+ if (ObjUtils.IsNotNullOrWhiteSpace( client.ChargeOrderNo))
+ {
+ ChargeOrderRepository.Update(it => it.CmdStatus == (msg.Result == 0 ? 1 : 2),
+ it => it.Sn == client.ChargeOrderNo);
+ }
+
+
int update = BinInfoRepository.Update(t => t.ChargeStatus == chargeStatus, t => t.No == client.BinNo);
Log.Info($"update {update} start charge finish status {chargeStatus} for {client.BinNo}");
diff --git a/Service/Charger/Handler/FinishStopChargingHandler.cs b/Service/Charger/Handler/FinishStopChargingHandler.cs
index e578840..ffd697f 100644
--- a/Service/Charger/Handler/FinishStopChargingHandler.cs
+++ b/Service/Charger/Handler/FinishStopChargingHandler.cs
@@ -50,7 +50,10 @@ namespace Service.Charger.Handler
if (ObjUtils.IsNotEmpty(orders))
{
List list = orders.Select(it => it.Id).ToList();
- ChargeOrderRepository.Update(it => it.CanUpload == 1, it => list.Contains(it.Id));
+
+ ChargeOrderRepository.Update(it => new ChargeOrder()
+ {CanUpload = 1 ,ReportingTimes=0 },
+ it => list.Contains(it.Id));
}
}
}
diff --git a/Service/Charger/Handler/OutCharger/PileAdjustPowerHandler.cs b/Service/Charger/Handler/OutCharger/PileAdjustPowerHandler.cs
new file mode 100644
index 0000000..ca2a1c7
--- /dev/null
+++ b/Service/Charger/Handler/OutCharger/PileAdjustPowerHandler.cs
@@ -0,0 +1,22 @@
+using DotNetty.Transport.Channels;
+using log4net;
+using Service.Charger.Client;
+using Service.Charger.Msg.Charger.OutCharger.Resp;
+
+namespace Service.Charger.Handler.OutCharger;
+///
+/// 3.7.10 充电桩应答功率调节指令
+///
+public class PileAdjustPowerHandler : SimpleChannelInboundHandler, IBaseHandler
+{
+ private static readonly ILog Log = LogManager.GetLogger(typeof(PileAdjustPowerHandler));
+
+
+ protected override void ChannelRead0(IChannelHandlerContext ctx, PileAdjustPowerRes msg)
+ {
+ if (ClientMgr.TryGetClient(ctx.Channel, out var sn, out var client))
+ {
+ Log.Info($"receive {msg} from {sn}");
+ }
+ }
+}
\ No newline at end of file
diff --git a/Service/Charger/Handler/OutCharger/PileStartChargeResHandler.cs b/Service/Charger/Handler/OutCharger/PileStartChargeResHandler.cs
index b2913bd..33c92d2 100644
--- a/Service/Charger/Handler/OutCharger/PileStartChargeResHandler.cs
+++ b/Service/Charger/Handler/OutCharger/PileStartChargeResHandler.cs
@@ -11,6 +11,7 @@ using Service.Charger.Msg.Charger.OutCharger.Resp;
using Service.Charger.Msg.Http.Resp;
namespace Service.Charger.Handler.OutCharger;
+
///
/// 3.7.2 充电桩响应远程启动充电
///
@@ -20,7 +21,7 @@ public class PileStartChargeResHandler : SimpleChannelInboundHandler t.BatteryNo == client.BatteryNo, t => t.No == client.BinNo) > 0)
diff --git a/Service/Charger/Handler/RecordChargeHandler.cs b/Service/Charger/Handler/RecordChargeHandler.cs
index 6fc15e6..8252886 100644
--- a/Service/Charger/Handler/RecordChargeHandler.cs
+++ b/Service/Charger/Handler/RecordChargeHandler.cs
@@ -41,6 +41,8 @@ namespace Service.Charger.Handler
if(ClientMgr.TryGetClient(ctx.Channel, out var sn, out var client))
{
+
+
float[] powersPeriods = new float[4] { 0, 0, 0, 0 }; //元素索引顺序代表值;1:尖;2:峰;3:平;4:谷
if (msg.FlagOfTime1 >= 1 && msg.FlagOfTime1 <= 4){powersPeriods[msg.FlagOfTime1 - 1] += msg.ChargingPowerOfTime1;}
if (msg.FlagOfTime2 >= 1 && msg.FlagOfTime2 <= 4){powersPeriods[msg.FlagOfTime2 - 1] += msg.ChargingPowerOfTime2;}
@@ -70,6 +72,7 @@ namespace Service.Charger.Handler
if (db == null)
{
+ TimeSpan timeSpan = endTime - startTime;
ChargeOrder chargeOrder = new ChargeOrder()
{
Sn = client.ChargeOrderNo,
@@ -79,7 +82,7 @@ namespace Service.Charger.Handler
StartSoc = msg.SocBefore,
StopSoc = msg.SocAfter,
- ChargeTimeCount = (int)(endTime - startTime).TotalMinutes,
+ ChargeTimeCount = (int)Math.Round(timeSpan.TotalMinutes),
ElecCount = Convert.ToDecimal(msg.ChargingPower),
AcElecCount = Convert.ToDecimal(msg.AcMeterElecCount),
StartAcElec = Convert.ToDecimal(msg.AcMeterDataBefore),
@@ -87,15 +90,16 @@ namespace Service.Charger.Handler
StartDcElec = Convert.ToDecimal(msg.DcMeterDataBefore),
StopDcElec = Convert.ToDecimal(msg.DcMeterDataAfter),
SharpElecCount = Convert.ToDecimal(powersPeriods[0]),
- PeakElecCount = Convert.ToDecimal(powersPeriods[0]),
- FlatElecCount = Convert.ToDecimal(powersPeriods[0]),
- ValleyElecCount = Convert.ToDecimal(powersPeriods[0]),
+ PeakElecCount = Convert.ToDecimal(powersPeriods[1]),
+ FlatElecCount = Convert.ToDecimal(powersPeriods[2]),
+ ValleyElecCount = Convert.ToDecimal(powersPeriods[3]),
AcSharpElecCount = Convert.ToDecimal(acPowersPeriods[0]),
- AcPeakElecCount = Convert.ToDecimal(acPowersPeriods[0]),
- AcFlatElecCount = Convert.ToDecimal(acPowersPeriods[0]),
- AcValleyElecCount = Convert.ToDecimal(acPowersPeriods[0]),
+ AcPeakElecCount = Convert.ToDecimal(acPowersPeriods[1]),
+ AcFlatElecCount = Convert.ToDecimal(acPowersPeriods[2]),
+ AcValleyElecCount = Convert.ToDecimal(acPowersPeriods[3]),
ChargeMode = msg.ChargeMode,
- StartMode = msg.StartMode
+ StartMode = msg.StartMode,
+ StartType = 2
};
_chargeOrderRepository.Insert(chargeOrder);
@@ -107,7 +111,7 @@ namespace Service.Charger.Handler
db.StartSoc = msg.SocBefore;
db.StopSoc = msg.SocAfter;
TimeSpan? timeSpan = (db.EndTime - db.StartTime);
- db.ChargeTimeCount= timeSpan?.Minutes;
+ db.ChargeTimeCount= (int)Math.Round(Convert.ToDecimal(timeSpan?.TotalMinutes));
db.ElecCount = Convert.ToDecimal(msg.ChargingPower);
db.AcElecCount = Convert.ToDecimal(msg.AcMeterElecCount);
db.StartAcElec = Convert.ToDecimal(msg.AcMeterDataBefore);
@@ -115,19 +119,21 @@ namespace Service.Charger.Handler
db.StartDcElec = Convert.ToDecimal(msg.DcMeterDataBefore);
db.StopDcElec = Convert.ToDecimal(msg.DcMeterDataAfter);
db.SharpElecCount = Convert.ToDecimal(powersPeriods[0]);
- db.PeakElecCount = Convert.ToDecimal(powersPeriods[0]);
- db.FlatElecCount = Convert.ToDecimal(powersPeriods[0]);
- db.ValleyElecCount = Convert.ToDecimal(powersPeriods[0]);
+ db.PeakElecCount = Convert.ToDecimal(powersPeriods[1]);
+ db.FlatElecCount = Convert.ToDecimal(powersPeriods[2]);
+ db.ValleyElecCount = Convert.ToDecimal(powersPeriods[3]);
db.AcSharpElecCount = Convert.ToDecimal(acPowersPeriods[0]);
- db.AcPeakElecCount = Convert.ToDecimal(acPowersPeriods[0]);
- db.AcFlatElecCount = Convert.ToDecimal(acPowersPeriods[0]);
- db.AcValleyElecCount = Convert.ToDecimal(acPowersPeriods[0]);
+ db.AcPeakElecCount = Convert.ToDecimal(acPowersPeriods[1]);
+ db.AcFlatElecCount = Convert.ToDecimal(acPowersPeriods[2]);
+ db.AcValleyElecCount = Convert.ToDecimal(acPowersPeriods[3]);
db.ChargeMode = msg.ChargeMode;
db.StartMode = msg.StartMode;
_chargeOrderRepository.Update(db);
}
ctx.Channel.WriteAndFlushAsync(new RecordChargeRespData());
+
+ Log.Info($"receive {msg} from {sn}");
}
}
diff --git a/Service/Charger/Handler/RemoteStartChargingResHandler.cs b/Service/Charger/Handler/RemoteStartChargingResHandler.cs
index 35d60eb..21d3d49 100644
--- a/Service/Charger/Handler/RemoteStartChargingResHandler.cs
+++ b/Service/Charger/Handler/RemoteStartChargingResHandler.cs
@@ -45,8 +45,7 @@ namespace Service.Charger.Handler
ChargeOrderRepository.Update(
i => new ChargeOrder()
{
- CmdStatus = 1,
- StartTime = client.ChargingStartTime
+ CmdStatus = 1
},
it => it.Id == one.Id);
}
@@ -63,4 +62,4 @@ namespace Service.Charger.Handler
}
}
}
-}
\ No newline at end of file
+}
diff --git a/Service/Charger/Handler/ResponseSettingHandler.cs b/Service/Charger/Handler/ResponseSettingHandler.cs
new file mode 100644
index 0000000..a21abde
--- /dev/null
+++ b/Service/Charger/Handler/ResponseSettingHandler.cs
@@ -0,0 +1,34 @@
+using System.Text;
+using DotNetty.Transport.Channels;
+using HybirdFrameworkCore.Autofac.Attribute;
+using log4net;
+using Service.Charger.Client;
+using Service.Charger.Handler;
+using Service.Charger.Msg.Charger.Req;
+using Service.Charger.Msg.Charger.Resp;
+using Service.Charger.Msg.Host.Resp;
+
+namespace HybirdFrameworkServices.Charger.Handler
+{
+ ///
+ /// 3.4.10 监控网关响应尖峰平谷设置
+ ///
+ /// 1,保存日志到log
+ ///
+ ///
+ [Order(8)]
+ [Scope("InstancePerDependency")]
+ public class ResponseSettingHandler : SimpleChannelInboundHandler, IBaseHandler
+ {
+ private static readonly ILog Log = LogManager.GetLogger(typeof(ResponseSettingHandler));
+ protected override void ChannelRead0(IChannelHandlerContext ctx, ResponseSetting msg)
+ {
+ if (ClientMgr.TryGetClient(ctx.Channel, out var sn, out var client))
+ {
+ Log.Info($"receive {msg} from {sn}");
+
+ }
+
+ }
+ }
+}
diff --git a/Service/Charger/Handler/UpAlarmHandler.cs b/Service/Charger/Handler/UpAlarmHandler.cs
index ac67b01..b210823 100644
--- a/Service/Charger/Handler/UpAlarmHandler.cs
+++ b/Service/Charger/Handler/UpAlarmHandler.cs
@@ -8,9 +8,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using Common.Const;
-using Entity.DbModel.Station;
-using Repository.Station;
namespace Service.Charger.Handler
{
@@ -20,125 +17,12 @@ namespace Service.Charger.Handler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(UpAlarmHandler));
- public EquipAlarmRecordRepository EquipAlarmRecordRepository { get; set; }
-
- public EquipAlarmDefineRepository EquipAlarmDefineRepository { get; set; }
-
- public EquipAlarmProcessRecordRepository EquipAlarmProcessRecordRepository { get; set; }
-
-
protected override void ChannelRead0(IChannelHandlerContext ctx, UpAlarm msg)
{
if (ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client))
{
Log.Info($"receive {msg} from {sn}");
-
- if (msg != null && msg.BatteryFaultCode > 4000)
- {
- SaveAlarmInfo(new List { msg.BatteryFaultCode.ToString() }, sn);
- }
- }
- }
-
- private void SaveAlarmInfo(List lstAlarm, string sn)
- {
- string charger = "charger";
-
- if (lstAlarm.Count > 0)
- {
- #region 有报警比较两边差异,新出现的报警就添加,消失的报警就处理并记录
-
- var lstEquipAlarmRecord =
- EquipAlarmRecordRepository.QueryListByClause(e => e.EquipTypeCode == 0).ToList();
- var sqllstAlarm = lstEquipAlarmRecord.Select(obj => obj.ErrorCode).ToList();
-
- // 找出实时报警中存在但数据库中不存在的元素
- List uniqueToList1 = lstAlarm.Except(sqllstAlarm).ToList();
-
- // 找出数据库中存在但实时报警中不存在的元素
- List uniqueToList2 = sqllstAlarm.Except(lstAlarm).ToList();
-
- if (uniqueToList1.Count > 0)
- {
- //这里要添加新的报警数据
- foreach (var errorCode in uniqueToList1)
- {
- EquipAlarmDefine? alarmDefine =
- EquipAlarmDefineRepository.SelectByEquipCodeAndErrorCode(0, charger,
- errorCode);
- if (alarmDefine != null)
- {
- EquipAlarmRecord record = new EquipAlarmRecord()
- {
- EquipTypeCode = alarmDefine.EquipTypeCode,
- EquipCode = sn,
- ErrorCode = alarmDefine.ErrorCode,
- ErrorLevel = alarmDefine.ErrorLevel,
- ErrorMsg = alarmDefine.ErrorMsg,
- ProcessMethod = alarmDefine.ProcessMethod,
- StartTime = DateTime.Now
- };
- EquipAlarmRecordRepository.Insert(record);
- }
- }
- }
-
- if (uniqueToList2.Count > 0)
- {
- //这些是要清除实时报警,并且处理记录的。
- // 使用LINQ找出ErrorCode在uniqueToList2中的EquipAlarmRecord对象
- List filteredObjectList = lstEquipAlarmRecord
- .Where(obj => uniqueToList2.Contains(obj.ErrorCode))
- .ToList();
- foreach (var VARIABLE in filteredObjectList)
- {
- EquipAlarmProcessRecord EquipAlarmProcessRecord = new EquipAlarmProcessRecord();
- EquipAlarmProcessRecord.EquipTypeCode = VARIABLE.EquipTypeCode;
- EquipAlarmProcessRecord.EquipCode = VARIABLE.EquipCode;
- EquipAlarmProcessRecord.ErrorCode = VARIABLE.ErrorCode;
- EquipAlarmProcessRecord.ErrorLevel = VARIABLE.ErrorLevel;
- EquipAlarmProcessRecord.ErrorMsg = VARIABLE.ErrorMsg;
- EquipAlarmProcessRecord.ProcessMethod = VARIABLE.ProcessMethod;
- EquipAlarmProcessRecord.StartTime = VARIABLE.StartTime;
- EquipAlarmProcessRecord.ProcessTime = DateTime.Now;
-
- EquipAlarmProcessRecordRepository.Insert(EquipAlarmProcessRecord);
- }
-
- EquipAlarmRecordRepository.Delete(filteredObjectList);
- }
-
- #endregion
- }
- else
- {
- #region 没报警把已处理记录更新并删除实时报警
-
- var lstEquipAlarmRecord =
- EquipAlarmRecordRepository.QueryListByClause(e => e.EquipTypeCode == 0).ToList();
-
- if (lstEquipAlarmRecord.Count > 0)
- {
- foreach (var VARIABLE in lstEquipAlarmRecord)
- {
- EquipAlarmProcessRecord EquipAlarmProcessRecord = new EquipAlarmProcessRecord();
- EquipAlarmProcessRecord.EquipTypeCode = VARIABLE.EquipTypeCode;
- EquipAlarmProcessRecord.EquipCode = VARIABLE.EquipCode;
- EquipAlarmProcessRecord.ErrorCode = VARIABLE.ErrorCode;
- EquipAlarmProcessRecord.ErrorLevel = VARIABLE.ErrorLevel;
- EquipAlarmProcessRecord.ErrorMsg = VARIABLE.ErrorMsg;
- EquipAlarmProcessRecord.ProcessMethod = VARIABLE.ProcessMethod;
- EquipAlarmProcessRecord.StartTime = VARIABLE.StartTime;
- EquipAlarmProcessRecord.ProcessTime = DateTime.Now;
-
- EquipAlarmProcessRecordRepository.Insert(EquipAlarmProcessRecord);
- }
-
- EquipAlarmRecordRepository.Delete(e => e.EquipTypeCode == 0);
- }
-
- #endregion
}
}
}
-}
\ No newline at end of file
+}
diff --git a/Service/Charger/Handler/UploadRemoteSignalDataHandler.cs b/Service/Charger/Handler/UploadRemoteSignalDataHandler.cs
index 1e839cb..1a387e3 100644
--- a/Service/Charger/Handler/UploadRemoteSignalDataHandler.cs
+++ b/Service/Charger/Handler/UploadRemoteSignalDataHandler.cs
@@ -10,6 +10,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Common.Const;
+using Entity.DbModel.Station;
+using Repository;
using Repository.Station;
namespace Service.Charger.Handler
@@ -24,10 +27,18 @@ namespace Service.Charger.Handler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(UploadRemoteSignalDataHandler));
private BinInfoRepository BinInfoRepository { get; set; }
-
- public UploadRemoteSignalDataHandler(BinInfoRepository _binInfoRepository)
+ private EquipAlarmRecordRepository EquipAlarmRecordRepository { get; set; }
+ private EquipAlarmProcessRecordRepository EquipAlarmProcessRecordRepository { get; set; }
+ private EquipAlarmDefineRepository EquipAlarmDefineRepository { get; set; }
+ public UploadRemoteSignalDataHandler(BinInfoRepository _binInfoRepository,
+ EquipAlarmRecordRepository _EquipAlarmRecordRepository,
+ EquipAlarmProcessRecordRepository _EquipAlarmProcessRecordRepository,
+ EquipAlarmDefineRepository _EquipAlarmDefineRepository)
{
BinInfoRepository = _binInfoRepository;
+ EquipAlarmRecordRepository = _EquipAlarmRecordRepository;
+ EquipAlarmProcessRecordRepository = _EquipAlarmProcessRecordRepository;
+ EquipAlarmDefineRepository = _EquipAlarmDefineRepository;
}
protected override void ChannelRead0(IChannelHandlerContext ctx, UploadRemoteSignalData msg)
@@ -45,11 +56,145 @@ namespace Service.Charger.Handler
//Desc:充电状态;0-未知;1-正在充电;2-无电池;3-禁用;4-充电完成
if (msg.WorkStatus == 1)
- BinInfoRepository.Update(i => i.ChargeStatus == msg.WorkStatus, i => i.No == sn);
+ BinInfoRepository.Update(i => i.ChargeStatus == msg.WorkStatus, i => i.ChargerNo == sn);
else if (msg.WorkStatus == 2 || msg.WorkStatus == 0)
{
- BinInfoRepository.Update(i => i.ChargeStatus == 4, i => i.No == sn);
+ BinInfoRepository.Update(i => i.ChargeStatus == 4, i => i.ChargerNo == sn);
}
+
+ #region 充电机故障显示
+//不准确,注释
+//if(sn=="C2008")
+ //if (msg.TotalWarning||msg.TotalError)
+ {
+ var lstEquipAlarmDefine = EquipAlarmDefineRepository.QueryListByClause(i => i.EquipCode == "充电机");
+
+ List lstAlarm = new List();
+
+ if (msg.EmergencyStop)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="1").ToList()[0].ErrorCode);
+ if (msg.SmokeFault)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="2").ToList()[0].ErrorCode);
+ if (msg.ChargeACInputCircuitBreakerFault)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="3").ToList()[0].ErrorCode);
+ if (msg.DcBusPositElecContactorRefuFault)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="4").ToList()[0].ErrorCode);
+ if (msg.DcBusNegatElecContactorRefuFault)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="5").ToList()[0].ErrorCode);
+ if (msg.DcBusPositElecFusesFault)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="6").ToList()[0].ErrorCode);
+ if (msg.DDcBusNegatElecFusesFault)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="7").ToList()[0].ErrorCode);
+ if (msg.ChargingInterfaceLockError)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="8").ToList()[0].ErrorCode);
+ if (msg.ChargerFanError)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="9").ToList()[0].ErrorCode);
+ if (msg.ArresterError)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="10").ToList()[0].ErrorCode);
+ if (msg.InsulationDetectionAlarm)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="11").ToList()[0].ErrorCode);
+ if (msg.InsulationDetectionError)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="12").ToList()[0].ErrorCode);
+ if (msg.BatteryPolarityReverseError)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="13").ToList()[0].ErrorCode);
+ if (msg.VeConGuidanceFailure)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="14").ToList()[0].ErrorCode);
+ if (msg.ChargingOverTempError)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="15").ToList()[0].ErrorCode);
+ if (msg.InterfaceOverFaulty)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="16").ToList()[0].ErrorCode);
+ if (msg.ChargingGunNotHomingError)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="17").ToList()[0].ErrorCode);
+ if (msg.BmsConnError)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="18").ToList()[0].ErrorCode);
+ if (msg.ChargerInputOverVoltageError)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="19").ToList()[0].ErrorCode);
+ if (msg.ChargerInputUnderVoltageError)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="20").ToList()[0].ErrorCode);
+ if (msg.DcBusOutputOverVoltageError)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="21").ToList()[0].ErrorCode);
+ if (msg.DcBusOutputUnderVoltageError)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="22").ToList()[0].ErrorCode);
+ if (msg.DcBusOutputOverCurrentError)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="23").ToList()[0].ErrorCode);
+ if (!msg.VehicleConnStatus)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="24").ToList()[0].ErrorCode);
+ if (!msg.ChargeStationGunHolderStatus)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="25").ToList()[0].ErrorCode);
+ if (!msg.ChargingInterfaceLockStatus)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="26").ToList()[0].ErrorCode);
+ if (msg.PositiveDcTransmissionContactorStatus)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="27").ToList()[0].ErrorCode);
+ if (msg.NegativeDcTransmissionContactorStatus)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="28").ToList()[0].ErrorCode);
+ if (msg.EntranceGuardError)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="29").ToList()[0].ErrorCode);
+ if (msg.PConA3dhesionFailure)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="30").ToList()[0].ErrorCode);
+ if (msg.NConadhesionFailure)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="31").ToList()[0].ErrorCode);
+ if (msg.ReliefCircuitError)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="32").ToList()[0].ErrorCode);
+ if (msg.ConActivated)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="33").ToList()[0].ErrorCode);
+ if (msg.ConAdhesionFailure)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="34").ToList()[0].ErrorCode);
+ if (msg.AuxiliaryPowerError)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="35").ToList()[0].ErrorCode);
+ if (msg.ModuleOutputReverseError)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="36").ToList()[0].ErrorCode);
+ if (msg.AcContactorStatus)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="37").ToList()[0].ErrorCode);
+ if (msg.ChargingGunOverTempWarning)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="38").ToList()[0].ErrorCode);
+ if (msg.ChargerOverTempWarning)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="39").ToList()[0].ErrorCode);
+ if (msg.MeterConnError)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="40").ToList()[0].ErrorCode);
+ if (msg.MeterDataError)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="41").ToList()[0].ErrorCode);
+ if (msg.WaterloggingWarning)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="42").ToList()[0].ErrorCode);
+ if (msg.ReversePowerWarning)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="43").ToList()[0].ErrorCode);
+ if (msg.BatteryPackAuxiliaryPowerStatus)lstAlarm.Add(sn+lstEquipAlarmDefine.Where(i=>i.ErrorCode=="44").ToList()[0].ErrorCode);
+
+
+ //查询当前充电机的实时报警信息
+ var lstNowEquipAlarmRecord = EquipAlarmRecordRepository.QueryListByClause(i => i.EquipCode == sn);
+ var sqllstAlarm=lstNowEquipAlarmRecord.Select(obj => obj.ErrorCode).ToList();//当前报警列表
+
+ // 找出实时报警中存在但数据库中不存在的元素
+ List uniqueToList1 = lstAlarm.Except(sqllstAlarm).ToList();
+
+ // 找出数据库中存在但实时报警中不存在的元素
+ List uniqueToList2 = sqllstAlarm.Except(lstAlarm).ToList();
+ if (uniqueToList1.Count > 0)
+ {//这里要添加新的报警数据
+ foreach (var errorCode in uniqueToList1)
+ {
+ EquipAlarmDefine? alarmDefine = EquipAlarmDefineRepository.QueryByClause(i=>i.ErrorCode==errorCode.Replace(sn,""));
+ if (alarmDefine != null)
+ {
+ EquipAlarmRecord record = new EquipAlarmRecord()
+ {
+ EquipTypeCode = alarmDefine.EquipTypeCode,
+ EquipCode = sn,
+ ErrorCode = errorCode,
+ ErrorLevel = alarmDefine.ErrorLevel,
+ ErrorMsg = alarmDefine.ErrorMsg,
+ ProcessMethod = alarmDefine.ProcessMethod,
+ StartTime= DateTime.Now
+ };
+ EquipAlarmRecordRepository.Insert(record);
+ }
+ }
+ }
+ else if (uniqueToList2.Count > 0)
+ {
+ //这些是要清除实时报警,并且处理记录的。
+ // 使用LINQ找出ErrorCode在uniqueToList2中的EquipAlarmRecord对象
+ List filteredObjectList = lstNowEquipAlarmRecord
+ .Where(obj => uniqueToList2.Contains(obj.ErrorCode))
+ .ToList();
+ foreach (var VARIABLE in filteredObjectList)
+ {
+ EquipAlarmProcessRecord EquipAlarmProcessRecord = new EquipAlarmProcessRecord();
+ EquipAlarmProcessRecord.EquipTypeCode = VARIABLE.EquipTypeCode;
+ EquipAlarmProcessRecord.EquipCode = VARIABLE.EquipCode;
+ EquipAlarmProcessRecord.ErrorCode = VARIABLE.ErrorCode;
+ EquipAlarmProcessRecord.ErrorLevel = VARIABLE.ErrorLevel;
+ EquipAlarmProcessRecord.ErrorMsg = VARIABLE.ErrorMsg;
+ EquipAlarmProcessRecord.ProcessMethod = VARIABLE.ProcessMethod;
+ EquipAlarmProcessRecord.StartTime = VARIABLE.StartTime;
+ EquipAlarmProcessRecord.ProcessTime=DateTime.Now;
+
+ EquipAlarmProcessRecordRepository.Insert(EquipAlarmProcessRecord);
+ }
+ EquipAlarmRecordRepository.Delete(filteredObjectList);
+ }
+ }
+ //else
+ //{
+ /*var lstNowEquipAlarmRecord = EquipAlarmRecordRepository.QueryListByClause(i => i.EquipCode == sn);
+ if (lstNowEquipAlarmRecord.Count > 0)
+ {
+ foreach (var VARIABLE in lstNowEquipAlarmRecord)
+ {
+ EquipAlarmProcessRecord EquipAlarmProcessRecord = new EquipAlarmProcessRecord();
+ EquipAlarmProcessRecord.EquipTypeCode = VARIABLE.EquipTypeCode;
+ EquipAlarmProcessRecord.EquipCode = VARIABLE.EquipCode;
+ EquipAlarmProcessRecord.ErrorCode = VARIABLE.ErrorCode;
+ EquipAlarmProcessRecord.ErrorLevel = VARIABLE.ErrorLevel;
+ EquipAlarmProcessRecord.ErrorMsg = VARIABLE.ErrorMsg;
+ EquipAlarmProcessRecord.ProcessMethod = VARIABLE.ProcessMethod;
+ EquipAlarmProcessRecord.StartTime = VARIABLE.StartTime;
+ EquipAlarmProcessRecord.ProcessTime=DateTime.Now;
+
+ EquipAlarmProcessRecordRepository.Insert(EquipAlarmProcessRecord);
+ }
+ }
+ EquipAlarmRecordRepository.Delete(i=>i.Id>0);*/
+ //}
+
+ #endregion
}
}
}
diff --git a/Service/Charger/Handler/UploadTelemetryDataHandler.cs b/Service/Charger/Handler/UploadTelemetryDataHandler.cs
index 69b7456..39f0f60 100644
--- a/Service/Charger/Handler/UploadTelemetryDataHandler.cs
+++ b/Service/Charger/Handler/UploadTelemetryDataHandler.cs
@@ -1,5 +1,6 @@
using DotNetty.Transport.Channels;
using HybirdFrameworkCore.Autofac.Attribute;
+using HybirdFrameworkCore.Configuration;
using HybirdFrameworkCore.Redis;
using log4net;
using Newtonsoft.Json;
@@ -17,7 +18,7 @@ namespace Service.Charger.Handler
public class UploadTelemetryDataHandler : SimpleChannelInboundHandler, IBaseHandler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(UploadTelemetryDataHandler));
-
+
public RedisHelper RedisHelper { get; set; }
protected override void ChannelRead0(IChannelHandlerContext ctx, UploadTelemetryData msg)
{
@@ -26,8 +27,11 @@ namespace Service.Charger.Handler
msg.ChargerNo = sn;
Log.Info($"receive {msg} from {sn}");
- RedisHelper.PublishAsync("UploadTelemetryData", JsonConvert.SerializeObject(msg));
-
+ if (!AppSettingsConstVars.DisabledTask.Contains("UploadTelemetryData"))
+ {
+ RedisHelper.PublishAsync("UploadTelemetryData", JsonConvert.SerializeObject(msg));
+ }
+
client.UploadTelemetryData = msg;
//充电机实时充电功率
client.RealTimeChargePower = msg.HighVoltageAcquisitionCurrent * msg.HighVoltageAcquisitionVoltage;
diff --git a/Service/Charger/Msg/Charger/OutCharger/Resp/PileAdjustPowerRes.cs b/Service/Charger/Msg/Charger/OutCharger/Resp/PileAdjustPowerRes.cs
new file mode 100644
index 0000000..7c4c1b3
--- /dev/null
+++ b/Service/Charger/Msg/Charger/OutCharger/Resp/PileAdjustPowerRes.cs
@@ -0,0 +1,35 @@
+using HybirdFrameworkCore.Autofac.Attribute;
+
+namespace Service.Charger.Msg.Charger.OutCharger.Resp;
+///
+/// 3.7.10 充电桩应答功率调节指令
+///
+public class PileAdjustPowerRes: ASDU
+{
+ ///
+ /// 记录类型
+ ///
+ [Property(0, 8)]
+ public byte RecordType { get; set; }
+
+ ///
+ /// 充电枪ID
+ /// 0x01:充电枪1;0x02:充电枪2;0x03:双枪充电;(0x00&0xFF无效)
+ ///
+ [Property(8, 8)]
+ public byte Pn { get; set; }
+
+ ///
+ /// 启动结果
+ /// 0 成功 1 失败
+ ///
+ [Property(16, 8)]
+ public byte Result { get; set; }
+
+ ///
+ /// 失败原因
+ /// 默认 0
+ ///
+ [Property(24, 8)]
+ public byte FailReason { get; set; }
+}
\ No newline at end of file
diff --git a/Service/Charger/Msg/Charger/Resp/UpBms.cs b/Service/Charger/Msg/Charger/Resp/UpBms.cs
index b42593d..a48e0a5 100644
--- a/Service/Charger/Msg/Charger/Resp/UpBms.cs
+++ b/Service/Charger/Msg/Charger/Resp/UpBms.cs
@@ -7,16 +7,72 @@ namespace Service.Charger.Msg.Charger.Resp
///
public class UpBms : ASDU
{
+ ///
+ /// 记录类型
+ ///
+ [Property(0, 8)]
+ public byte RecordType { get; set; }
+
///
///PGN码
///
- [Property(0, 3, PropertyReadConstant.Byte)]
+ [Property(8, 24)]
public string Pgn { get; set; }
///
- /// CAN 帧数据
+ /// 报警级别
+ /// 0:正常
+ /// 1:1 级报警 3:3 级报警 5:5 级报警 其余保留
+ ///
+ [Property(32, 8)]
+ public short AlarmLevel { get; set; }
+
+ ///
+ /// 电池箱所在位置编号 分辨率:1/位,偏移量:0,数值范围:1~250
+ ///
+ [Property(40, 8)]
+ public short BatteryBoxLocationNumber { get; set; }
+
+ ///
+ /// 电池箱能输出的最大电流值 分辨率:0.05A/位,偏移量:-1600A,数值范围:-1600A ~ 1612.75A
+ ///
+ [Property(48, 16, scale: 0.05, offset: -1600)]
+ public short BatteryBoxMaximumCurrentOutput { get; set; }
+
+ ///
+ /// 电池箱能承受最大反馈电流值 分辨率:0.05A/位,偏移量:-1600A,数值范围:-1600A~1612.75A
+ ///
+ [Property(64, 16, scale: 0.05, offset: -1600)]
+ public short BatteryMaximumFeedback { get; set; }
+
+ ///
+ /// 电池箱风扇状态 0:关闭1:开启 2:不可用 3:不可用
+ ///
+ [Property(80, 2)]
+ public byte BatteryBoxFanStatus { get; set; }
+
+ ///
+ /// 加热装置状态 0:关闭1:开启 2:不可用 3:不可用
+ ///
+ [Property(82, 2)]
+ public byte HeaterCondition { get; set; }
+
+ ///
+ /// 均衡状态 0:关闭1:开启 2:不可用 3:不可用
+ ///
+ [Property(84, 2)]
+ public byte EquilibriumState { get; set; }
+
+ ///
+ /// 高压互锁状态 0 断开 1 连接
+ ///
+ [Property(86, 2)]
+ public byte HighVoltageInterlockState { get; set; }
+
+ ///
+ /// 保留
///
- [Property(0, 8, PropertyReadConstant.Byte)]
- public string CanData { get; set; }
+ [Property(88, 8)]
+ public short Reserve { get; set; }
}
}
\ No newline at end of file
diff --git a/Service/Charger/Msg/Host/Req/OutCharger/Req/PileAdjustPower.cs b/Service/Charger/Msg/Host/Req/OutCharger/Req/PileAdjustPower.cs
new file mode 100644
index 0000000..eb31fc0
--- /dev/null
+++ b/Service/Charger/Msg/Host/Req/OutCharger/Req/PileAdjustPower.cs
@@ -0,0 +1,42 @@
+using HybirdFrameworkCore.Autofac.Attribute;
+
+namespace Service.Charger.Msg.Host.Req.OutCharger.Req;
+///
+/// 3.7.9 监控平台发送充电桩功率调节指令
+///
+public class PileAdjustPower: ASDU
+{
+
+ ///
+ /// 记录类型
+ ///
+ [Property(0, 8)]
+ public byte RecordType { get; set; }
+
+ ///
+ /// 充电枪ID号
+ /// 0x01:充电枪1;0x02:充电枪2;0x03:双枪充电;(0x00&0xFF无效)
+ ///
+ [Property(8, 8)]
+ public byte Pn { get; set; }
+
+ ///
+ ///期望运行 功率
+ ///
+ [Property(8, 16, PropertyReadConstant.Bit, 0.1, 1)]
+ public float ExpectPower { get; set; }
+
+
+ public PileAdjustPower(byte pn,float expectPower)
+ {
+ RecordType = 9;
+ FrameTypeNo = 51;
+ MsgBodyCount = 1;
+ TransReason = 3;
+ PublicAddr = 0;
+ MsgBodyAddr = new byte[] { 0, 0, 0 };
+
+ Pn = pn;
+ ExpectPower = expectPower;
+ }
+}
\ No newline at end of file
diff --git a/Service/Charger/Msg/Host/Req/OutCharger/Req/PileStartCharge.cs b/Service/Charger/Msg/Host/Req/OutCharger/Req/PileStartCharge.cs
index 4bd0419..a0c74a4 100644
--- a/Service/Charger/Msg/Host/Req/OutCharger/Req/PileStartCharge.cs
+++ b/Service/Charger/Msg/Host/Req/OutCharger/Req/PileStartCharge.cs
@@ -1,6 +1,6 @@
using HybirdFrameworkCore.Autofac.Attribute;
-namespace Service.Charger.Msg.Host.OutCharger.Req;
+namespace Service.Charger.Msg.Host.Req.OutCharger.Req;
///
/// 3.7.1 监控平台远程启动充电桩充电
diff --git a/Service/Charger/Msg/Host/Req/OutCharger/Req/PileStopCharge.cs b/Service/Charger/Msg/Host/Req/OutCharger/Req/PileStopCharge.cs
index ee47f01..e011708 100644
--- a/Service/Charger/Msg/Host/Req/OutCharger/Req/PileStopCharge.cs
+++ b/Service/Charger/Msg/Host/Req/OutCharger/Req/PileStopCharge.cs
@@ -1,6 +1,6 @@
using HybirdFrameworkCore.Autofac.Attribute;
-namespace Service.Charger.Msg.Host.OutCharger.Req;
+namespace Service.Charger.Msg.Host.Req.OutCharger.Req;
///
/// 3.7.3 监控平台远程停止充电桩充电
diff --git a/Service/Charger/Msg/Http/Req/PileRealtimeReq.cs b/Service/Charger/Msg/Http/Req/PileRealtimeReq.cs
new file mode 100644
index 0000000..1128c8e
--- /dev/null
+++ b/Service/Charger/Msg/Http/Req/PileRealtimeReq.cs
@@ -0,0 +1,45 @@
+namespace Service.Charger.Msg.Http.Req;
+///
+/// 9.2.1.5 站控上报充电枪实时数据上报
+///
+public class PileRealtimeReq
+{
+ ///
+ /// 换电站编码
+ ///
+ public string sn { get; set; }
+
+
+ ///
+ /// Desc:充电枪编号
+ /// Default:
+ /// Nullable:True
+ ///
+ public string? pn { get; set; }
+
+ ///
+ /// 充电枪状态
+ ///
+ public int ps { get; set; }
+
+ ///
+ /// 插枪状态
+ ///
+ public int con { get; set; }
+
+
+ ///
+ /// 单枪输出电压
+ ///
+ public float pov { get; set; }
+
+ ///
+ /// 单枪输出电流
+ ///
+ public float poe { get; set; }
+
+ ///
+ /// 单枪故障代码
+ ///
+ public int ec { get; set; }
+}
\ No newline at end of file
diff --git a/Service/Charger/MyTask/AutoChargeTask.cs b/Service/Charger/MyTask/AutoChargeTask.cs
index 9bf4e17..1afc403 100644
--- a/Service/Charger/MyTask/AutoChargeTask.cs
+++ b/Service/Charger/MyTask/AutoChargeTask.cs
@@ -5,6 +5,7 @@ using HybirdFrameworkCore.AutoTask;
using HybirdFrameworkCore.Entity;
using HybirdFrameworkCore.Utils;
using log4net;
+using Newtonsoft.Json;
using Repository.Station;
using Service.Charger.Client;
using Service.Init;
@@ -41,8 +42,8 @@ public class AutoChargeTask : ITask
DateTime now = DateTime.Now;
- List binInfos = binInfoRepository.Query();
- if (binInfos.Count < 0)
+ List allBinInfos = binInfoRepository.Query();
+ if (allBinInfos.Count < 0)
{
Log.Info("lack of binInfos");
return;
@@ -54,7 +55,7 @@ public class AutoChargeTask : ITask
chargerList.Where(it => it.AutoCharge == 1).Select(it => it.Code).ToHashSet();
- binInfos = binInfos.Where(it => autoChargeSet.Contains(it.ChargerNo)).ToList();
+ var binInfos = allBinInfos.Where(it => autoChargeSet.Contains(it.ChargerNo)).ToList();
if (ObjUtils.IsEmpty(binInfos))
{
@@ -76,10 +77,24 @@ public class AutoChargeTask : ITask
List elecPriceModelVersionDetails =
elecPriceModelVersionDetailRepository.QueryListByClause(it =>
it.Version == elecPriceModelVersion.Version);
- ElecPriceModelVersionDetail? elecPriceModelVersionDetail = elecPriceModelVersionDetails.Where(i =>
+ /*ElecPriceModelVersionDetail? elecPriceModelVersionDetail = elecPriceModelVersionDetails.Where(i =>
i.StartHour <= now.Hour && i.StartMinute <= now.Minute
&& i.EndHour > now.Hour &&
- i.EndMinute > now.Minute).FirstOrDefault();
+ i.EndMinute > now.Minute).FirstOrDefault();*/
+ ElecPriceModelVersionDetail? elecPriceModelVersionDetail = null;
+
+ foreach (var VARIABLE in elecPriceModelVersionDetails)
+ {
+ // 构造开始和结束的DateTime对象,使用当前日期的年月日
+ DateTime startTime = new DateTime(now.Year, now.Month, now.Day, VARIABLE.StartHour,
+ VARIABLE.StartMinute, 0);
+ DateTime endTime = new DateTime(now.Year, now.Month, now.Day, VARIABLE.EndHour, VARIABLE.EndMinute, 0);
+ if (DateTime.Now >= startTime && DateTime.Now <= endTime)
+ {
+ elecPriceModelVersionDetail = VARIABLE;
+ }
+ }
+
if (elecPriceModelVersionDetail == null)
{
Log.Info("lack of effective elecPriceModelVersionDetail");
@@ -110,12 +125,12 @@ public class AutoChargeTask : ITask
now.Second >= start[2] && now.Second < end[2];
}).ToList();*/
- foreach (var VARIABLE in batteryOpModelDetails)
+ foreach (var t in batteryOpModelDetails)
{
- if (DateTime.Now >= DateTime.Parse(VARIABLE.StartTime) &&
- DateTime.Now <= DateTime.Parse(VARIABLE.EndTime))
+ if (DateTime.Now >= DateTime.Parse(t.StartTime) &&
+ DateTime.Now <= DateTime.Parse(t.EndTime))
{
- opModelDetails.Add(VARIABLE);
+ opModelDetails.Add(t);
}
}
@@ -126,63 +141,70 @@ public class AutoChargeTask : ITask
}
int needBatteryCount = opModelDetails[0].BatteryCount ?? 8;
- List canSwapList = binInfos.Where(it =>
+ List canSwapList = allBinInfos.Where(it =>
it.Soc != null && Convert.ToSingle(it.Soc) >= StaticStationInfo.SwapSoc && it.CanSwapFlag == 1)
.ToList();
- if (canSwapList.Count == needBatteryCount)
+ /*if (canSwapList.Count == needBatteryCount)
{
Log.Info($"lack of needBatteryCount {needBatteryCount}");
return;
- }
-
- if (canSwapList.Count > needBatteryCount)
- {
- List chargingList = binInfos.Where(it => it.ChargeStatus == 1).ToList();
+ }*/
- int needStopCount = chargingList.Count - (canSwapList.Count - needBatteryCount);
- if (needStopCount > 0)
- {
- //停电量低的
- chargingList.Sort((a, b) => (a.Soc ?? 0).CompareTo(b.Soc ?? 0));
- for (int i = 0; i < needStopCount; i++)
- {
- Log.Info($"auto stop charge {chargingList[i].No}");
- ClientMgr.GetBySn(chargingList[i].No)?.SendRemoteStopCharging();
- }
- }
- }
- else
+ List chargingList = binInfos.Where(it => it.ChargeStatus == 1).ToList();
+ Log.Info(
+ $"chargingList={JsonConvert.SerializeObject(chargingList.Select(info => info.Code + "," + info.ChargerNo).ToList())}");
+ if (canSwapList.Count <= needBatteryCount)
{
List canChargeList = binInfos.Where(it =>
- it.Soc != null && Convert.ToSingle(it.Soc) < StaticStationInfo.ChargeSoc &&
- it.CanChargeFlag == 1)
+ it.Soc != null && Convert.ToSingle(it.Soc) < StaticStationInfo.SwapSoc &&
+ it.CanChargeFlag == 1 && it.Exists == 1)
.ToList();
//启动电量高的
canChargeList.Sort((a, b) => (b.Soc ?? 0).CompareTo(a.Soc ?? 0));
+
byte chargeSoc = StaticStationInfo.ChargeSoc;
int count = needBatteryCount - canSwapList.Count;
+ Log.Info(
+ $"need start count={count}, canChargeList={JsonConvert.SerializeObject(canChargeList.Select(info => info.Code + "," + info.ChargerNo).ToList())}");
int number = 0;
foreach (var binInfo in canChargeList)
{
- float? chargePower = EquipInfoRepository.QueryPowerByCode(binInfo.Code);
+ float? chargePower = EquipInfoRepository.QueryPowerByCode(binInfo.ChargerNo);
float? power = chargePower == null ? StaticStationInfo.ChargePower : chargePower;
- Result? result = ClientMgr.GetBySn(binInfo.ChargerNo)
- ?.StartCharge(chargeSoc, (float)power);
- if (result is { IsSuccess: true })
- {
- Log.Info($"auto start charge {binInfo.ChargerNo}");
- number++;
- }
-
- if (count == number)
+ if (binInfo.ChargeStatus != 1)
{
- Log.Info($"auto start charge count {count}");
- break;
+ //没有充电时候在充电
+ Result? result = ClientMgr.GetBySn(binInfo.ChargerNo)
+ ?.StartCharge(chargeSoc, (float)power, 0);
+ if (result is { IsSuccess: true })
+ {
+ Log.Info($"auto start charge {binInfo.ChargerNo}");
+ number++;
+ }
+
+ if (count == number)
+ {
+ Log.Info($"auto start charge count {count}");
+ break;
+ }
}
}
}
+ #region 达到充电SOC自动停
+
+ List stopList = chargingList.Where(it => it.Soc > StaticStationInfo.ChargeSoc).ToList();
+ Log.Info(
+ $"need stop count={stopList.Count}, stopList={JsonConvert.SerializeObject(stopList.Select(info => info.Code + "," + info.ChargerNo).ToList())}");
+ foreach (var binInfo in stopList)
+ {
+ Log.Info($"auto stop charge {binInfo.No} soc:{binInfo.Soc}");
+ ClientMgr.GetBySn(binInfo.ChargerNo)?.SendRemoteStopCharging();
+ }
+
+ #endregion
+
#endregion
}
catch (Exception e)
@@ -205,4 +227,4 @@ public class AutoChargeTask : ITask
{
_stop = false;
}
-}
\ No newline at end of file
+}
diff --git a/Service/Charger/MyTask/EmeterEnergyRecordTask.cs b/Service/Charger/MyTask/EmeterEnergyRecordTask.cs
index 408aedb..9b59963 100644
--- a/Service/Charger/MyTask/EmeterEnergyRecordTask.cs
+++ b/Service/Charger/MyTask/EmeterEnergyRecordTask.cs
@@ -36,6 +36,11 @@ public class EmeterEnergyRecordTask : ITask
{
List list = new List();
List listEmeterEnergyChanges = new List();
+
+ DateTime time = DateTime.Now.AddDays(-7);
+ EmeterEnergyRepository.Delete(i=>i.UploadTime
+[Scope]
+public class PileChargeRealtimeTask : ITask
+{
+ private static readonly ILog Log = LogManager.GetLogger(typeof(PileChargeRealtimeTask));
+ private volatile bool _stop;
+
+
+ public string Name()
+ {
+ return "PileChargeRealtimeTask";
+ }
+
+ public int Interval()
+ {
+ return 1000 * 30;
+ }
+
+ public void Handle()
+ {
+
+ ConcurrentDictionary chargerClients = ClientMgr.Dictionary;
+
+ if (chargerClients.Values.Count <= 0)
+ {
+ return;
+ }
+
+ foreach (var clientPair in chargerClients)
+ {
+ ChargerClient client = clientPair.Value;
+
+ ProcessClient(client, 1);
+ ProcessClient(client, 2);
+ }
+ }
+
+ private void ProcessClient(ChargerClient client, byte gunNumber)
+ {
+ if (client.GunCharged[gunNumber])
+ {
+ ChargerPile chargerPile = client.ChargerPile[gunNumber];
+ PileUploadTelemetry telemetry = client.PileUploadTelemetry[gunNumber];
+ PileUploadRemoteSignal pileUploadRemoteSignal = client.PileUploadRemoteSignal[gunNumber];
+
+ PileChargeRealtimeReq req = new PileChargeRealtimeReq
+ {
+ sn = StaticStationInfo.StationNo,
+ con = chargerPile.con,
+ cosn = chargerPile.cosn,
+ pn = chargerPile.pn,
+ rv = telemetry.BmsNeedVoltage,
+ re = telemetry.BmsNeedCurrent,
+ cm = telemetry.ChargeMode,
+ cdv = telemetry.BmsChargingVoltage,
+ cde = telemetry.BmsChargingCurrent,
+ soc = telemetry.CurrentSoc,
+ tr = telemetry.EstimatedRemainingTime,
+ pov = telemetry.DcMeterVoltage,
+ poe = telemetry.DcMeterCurrent,
+ tct = telemetry.ChargingTime,
+ lbtn = telemetry.MinTempDetectionPointNo,
+ lbt = telemetry.MinBatteryTemp,
+ hbtn = telemetry.MaxTempDetectionPointNo,
+ hbt = telemetry.MaxBatteryTemp,
+ hlbva = pileUploadRemoteSignal.ChargerInputOverVoltageError ? 1 :
+ pileUploadRemoteSignal.ChargerInputUnderVoltageError ? 2 : 0,
+ bia = pileUploadRemoteSignal.InsulationDetectionAlarm ? 1 : 0
+ };
+
+ HttpUtil.SendPostRequest(req, "http://127.0.0.1:5034/api/OutCharger/SendPileChargeRealtime");
+ }
+ }
+
+ public bool Stoped()
+ {
+ return _stop;
+ }
+
+ public void Stop()
+ {
+ _stop = true;
+ }
+
+ public void ResetStop()
+ {
+ _stop = false;
+ }
+}
\ No newline at end of file
diff --git a/Service/Charger/MyTask/PileRealtimeTask.cs b/Service/Charger/MyTask/PileRealtimeTask.cs
new file mode 100644
index 0000000..3b6bf4c
--- /dev/null
+++ b/Service/Charger/MyTask/PileRealtimeTask.cs
@@ -0,0 +1,100 @@
+using System.Collections.Concurrent;
+using Common.Util;
+using HybirdFrameworkCore.Autofac.Attribute;
+using HybirdFrameworkCore.AutoTask;
+using log4net;
+using Service.Charger.Client;
+using Service.Charger.Msg.Charger.OutCharger.Req;
+using Service.Charger.Msg.Http.Req;
+using Service.Init;
+
+namespace Service.Charger.MyTask;
+///
+/// 9.2.1.5 站控上报充电枪实时数据上报
+///
+[Scope]
+public class PileRealtimeTask : ITask
+{
+ private static readonly ILog Log = LogManager.GetLogger(typeof(PileRealtimeTask));
+ private volatile bool _stop;
+
+ public string Name()
+ {
+ return "PileRealtimeTask";
+ }
+
+ public int Interval()
+ {
+ return 1000 * 5;
+ }
+
+ public void Handle()
+ {
+ ConcurrentDictionary chargerClients = ClientMgr.Dictionary;
+
+ if (chargerClients.Values.Count <= 0)
+ {
+ return;
+ }
+
+ foreach (var kvp in chargerClients)
+ {
+ ChargerClient client = kvp.Value;
+
+ HandleChargerPile(client, 1);
+ HandleChargerPile(client, 2);
+ }
+ }
+
+
+
+ public bool Stoped()
+ {
+ return _stop;
+ }
+
+ public void Stop()
+ {
+ _stop = true;
+ }
+
+ public void ResetStop()
+ {
+ _stop = false;
+ }
+
+ private void HandleChargerPile(ChargerClient client, byte pileIndex)
+ {
+ if (client.ChargedPile[pileIndex])
+ {
+ ChargerPile chargerPile = client.ChargerPile[pileIndex];
+ PileUploadTelemetry pileUploadTelemetry = client.PileUploadTelemetry[pileIndex];
+
+ PileRealtimeReq req = new PileRealtimeReq
+ {
+ sn = StaticStationInfo.StationNo,
+ pn = chargerPile.pn,
+ ps = GetPileStatus(chargerPile.WorkStatus),
+ pov = pileUploadTelemetry.BmsChargingVoltage,
+ poe = pileUploadTelemetry.BmsChargingCurrent,
+ ec = 0
+ };
+
+ HttpUtil.SendPostRequest(req, "http://127.0.0.1:5034/api/OutCharger/SendPileRealtime");
+ }
+ }
+
+ private int GetPileStatus(int workStatus)
+ {
+ return workStatus switch
+ {
+ 0 => 1,
+ 1 => 3,
+ 2 => 4,
+ 3 => 5,
+ _ => 1
+ };
+ }
+
+
+}
\ No newline at end of file
diff --git a/Service/Job/TestJob.cs b/Service/Job/TestJob.cs
new file mode 100644
index 0000000..46f577c
--- /dev/null
+++ b/Service/Job/TestJob.cs
@@ -0,0 +1,32 @@
+using Autofac;
+using HybirdFrameworkCore.Autofac;
+using HybirdFrameworkCore.Autofac.Attribute;
+using HybirdFrameworkCore.Job;
+using log4net;
+using Repository.System;
+
+namespace Service.Job;
+
+[Scope]
+public class TestJob : AbstractCronJob
+{
+ private static readonly ILog Log = LogManager.GetLogger(typeof(TestJob));
+
+ private SysConfigRepository SysConfigRepository = AppInfo.Container.Resolve();
+
+ protected override Task Handle()
+ {
+ Log.Info("work");
+ return Task.CompletedTask;
+ }
+
+ protected override string Key()
+ {
+ return "test-job";
+ }
+
+ protected override string Cron()
+ {
+ return "0/2 * * * * ?";
+ }
+}
diff --git a/Service/MyTask/BatteryInfoUploadTask.cs b/Service/MyTask/BatteryInfoUploadTask.cs
new file mode 100644
index 0000000..21f350d
--- /dev/null
+++ b/Service/MyTask/BatteryInfoUploadTask.cs
@@ -0,0 +1,93 @@
+using Autofac;
+using Entity.DbModel.Station;
+using HybirdFrameworkCore.Autofac;
+using HybirdFrameworkCore.Autofac.Attribute;
+using HybirdFrameworkCore.AutoTask;
+using HybirdFrameworkCore.Redis;
+using log4net;
+using Newtonsoft.Json;
+using Repository.Station;
+using Service.Charger.Client;
+using Service.Init;
+using Service.Swap.Dto;
+
+namespace Service.MyTask;
+[Scope]
+public class BatteryInfoUploadTask : ITask
+{
+ private static readonly ILog Log = LogManager.GetLogger(typeof(BatteryInfoUploadTask));
+ private RedisHelper RedisHelper { get; set; } = AppInfo.Container.Resolve();
+ private BinInfoRepository BinInfoRepository = AppInfo.Container.Resolve();
+
+ private static bool _stop;
+
+ public string Name()
+ {
+ return nameof(BatteryInfoUploadTask);
+ }
+
+ public int Interval()
+ {
+ return 1000 * 1;
+ }
+
+ public void Handle()
+ {
+ Log.Info("begin start BatteryInfoUploadTask uoload");
+ DateTime now = DateTime.Now;
+ List binInfos = BinInfoRepository.Query();
+ List batInfos = binInfos.Where(it => it.Exists == 1).Select(it =>
+ {
+ Log.Info("start BatteryInfoUploadTask uoload bininfo select");
+ ChargerClient? client = ClientMgr.GetBySn(it.ChargerNo);
+ SingleBatInfo batInfo = new SingleBatInfo()
+ {
+ bn = it.BatteryNo,
+ bt = now,
+ sd = it.ChargerNo,
+ cno = Convert.ToInt32(it.ChargerNo.Substring(1)),
+ el = 0,
+ hc = Convert.ToInt32(it.ChargeStatus),
+ hst=Convert.ToSingle(client?.BatteryPackDataVoltage?.CellTemperatureMax),
+ hsv = Convert.ToSingle(client?.BatteryPackDataVoltage?.CellVoltageMax),
+ lst = Convert.ToSingle(client?.BatteryPackDataVoltage?.CellTemperatureMin),
+ lsv = Convert.ToSingle(client?.BatteryPackDataVoltage?.CellVoltageMin),
+ soc = Convert.ToSingle(it.Soc),
+ soe = Convert.ToSingle(it.Soe),
+ soh = Convert.ToSingle(it.Soh)
+ };
+ return batInfo;
+ }).ToList();
+ BatDataInfo batDataInfo = new BatDataInfo
+ {
+ batn = batInfos.Count,
+ sn = StaticStationInfo.StationNo,
+ datainfo = batInfos
+ };
+
+ try
+ {
+ Log.Info("start BatteryInfoUploadTask send redis");
+ RedisHelper.PublishAsync("BatteryInfoUploadTask", JsonConvert.SerializeObject(batDataInfo));
+ }
+ catch (Exception e)
+ {
+ Log.Info($"BatteryInfoUploadTask send redis error{e}");
+ }
+ }
+
+ public bool Stoped()
+ {
+ return _stop;
+ }
+
+ public void Stop()
+ {
+ _stop = true;
+ }
+
+ public void ResetStop()
+ {
+ _stop = false;
+ }
+}
diff --git a/Service/MyTask/ZipLogTask.cs b/Service/MyTask/ZipLogTask.cs
new file mode 100644
index 0000000..84a7cbb
--- /dev/null
+++ b/Service/MyTask/ZipLogTask.cs
@@ -0,0 +1,9 @@
+using HybirdFrameworkCore.Autofac.Attribute;
+using HybirdFrameworkCore.AutoTask;
+
+namespace Service.MyTask;
+
+[Scope]
+public class ZipLogTask : LogZipTask
+{
+}
diff --git a/Service/RealTime/RealtimeClient.cs b/Service/RealTime/RealtimeClient.cs
new file mode 100644
index 0000000..5f20bc2
--- /dev/null
+++ b/Service/RealTime/RealtimeClient.cs
@@ -0,0 +1,90 @@
+using log4net;
+using Microsoft.AspNetCore.SignalR.Client;
+using Newtonsoft.Json;
+
+namespace Service.RealTime;
+
+public class RealtimeClient
+{
+ ///
+ /// 循环时用的随机数值
+ ///
+ private static UInt16 _cysSeqNum = 0;
+
+
+ ///
+ /// 计算循环用UInt16随机数值
+ ///
+ ///
+ public static UInt16 GetUInt16SeqNum()
+ {
+ if (_cysSeqNum < 65535)
+ {
+ _cysSeqNum += 1;
+ }
+ else
+ {
+ _cysSeqNum = 1;
+ }
+
+ return _cysSeqNum;
+ }
+
+ private static readonly ILog Log = LogManager.GetLogger(typeof(RealtimeClient));
+
+ private static readonly JsonSerializerSettings settings = new JsonSerializerSettings()
+ {
+ ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
+ DateFormatString = "yyyy-MM-dd HH:mm:ss",
+ NullValueHandling = NullValueHandling.Ignore
+ };
+
+ private static HubConnection? hubConnection;
+
+ public static void Init()
+ {
+ hubConnection = new HubConnectionBuilder().WithUrl("http://127.0.0.1:5034/realtime").WithAutomaticReconnect()
+ .Build();
+ hubConnection.ServerTimeout = TimeSpan.FromMinutes(1);
+ hubConnection.KeepAliveInterval = TimeSpan.FromMinutes(1);
+ hubConnection.StartAsync();
+ hubConnection.Reconnected += (s) =>
+ {
+ Log.Info($"{s} connected");
+ return Task.CompletedTask;
+ };
+ hubConnection.On("ReceiveMsg", (string msg) => { Log.Info($"receive {msg}"); });
+ }
+
+ public static void SendMsg(string msg)
+ {
+ hubConnection?.SendAsync("SendMsg", "host", msg);
+ }
+
+ public static void SendWithoutResult(string msg)
+ {
+ hubConnection?.SendAsync("InvokeWithoutResult", JsonConvert.SerializeObject(new RtMsg()
+ {
+ Id = GetUInt16SeqNum(),
+ Cmd = "cmd",
+ Datetime = DateTime.Now,
+ FromUser = "charger",
+ Msg = msg
+ }));
+ }
+
+ public static string? SendWithResult(string msg)
+ {
+ var result = hubConnection?.InvokeAsync("Invoke", new RtMsg()
+ {
+ Id = GetUInt16SeqNum(),
+ Cmd = "cmd",
+ Datetime = DateTime.Now,
+ FromUser = "charger",
+ Msg = msg
+ }).Result;
+
+ Log.Info($"result={result}");
+ return result.FromUser;
+ }
+}
diff --git a/Service/RealTime/RtMsg.cs b/Service/RealTime/RtMsg.cs
new file mode 100644
index 0000000..5aac8b7
--- /dev/null
+++ b/Service/RealTime/RtMsg.cs
@@ -0,0 +1,11 @@
+namespace Service.RealTime;
+
+public class RtMsg
+{
+ public int Id { get; set; }
+ public string FromUser { get; set; }
+ public string ToUser { get; set; }
+ public DateTime Datetime { get; set; }
+ public string Cmd { get; set; }
+ public string Msg { get; set; }
+}
diff --git a/Service/Service.csproj b/Service/Service.csproj
index 8964429..9b3820c 100644
--- a/Service/Service.csproj
+++ b/Service/Service.csproj
@@ -27,8 +27,11 @@
+
+
+
@@ -47,4 +50,8 @@
+
+
+
+
diff --git a/Service/Station/BinInfoService.cs b/Service/Station/BinInfoService.cs
index fef3032..d8b93e9 100644
--- a/Service/Station/BinInfoService.cs
+++ b/Service/Station/BinInfoService.cs
@@ -16,6 +16,7 @@ public class BinInfoService : BaseServices
public BinInfoService(BinInfoRepository binInfoRepository)
{
_binInfoRepository = binInfoRepository;
+ this.BaseDal = binInfoRepository;
}
///
/// 获取仓位数据
diff --git a/Service/Swap/Dto/BatDataInfo.cs b/Service/Swap/Dto/BatDataInfo.cs
new file mode 100644
index 0000000..23346a6
--- /dev/null
+++ b/Service/Swap/Dto/BatDataInfo.cs
@@ -0,0 +1,23 @@
+namespace Service.Swap.Dto
+{
+ ///
+ /// 4.2.11.1 换电站电池包数据信息
+ ///
+ public class BatDataInfo
+ {
+ ///
+ /// 场站编码 换电站唯一码
+ ///
+ public string sn { get; set; }
+
+ ///
+ /// 换电站电池包总 数量
+ ///
+ public int batn { get; set; }
+
+ ///
+ /// 电池信息
+ ///
+ public List datainfo { get; set; }
+ }
+}
diff --git a/Service/Swap/Dto/SingleBatInfo.cs b/Service/Swap/Dto/SingleBatInfo.cs
new file mode 100644
index 0000000..e906248
--- /dev/null
+++ b/Service/Swap/Dto/SingleBatInfo.cs
@@ -0,0 +1,84 @@
+namespace Service.Swap.Dto;
+
+public class SingleBatInfo
+{
+ ///
+ /// 电池序列号
+ ///
+ public string bn { get; set; }
+
+ ///
+ /// 充电架 ID 按电池架的编号 A1,A2…
+ ///
+ public string sd { get; set; }
+
+ ///
+ /// 所在充电机序号 从 1 开始递增
+ ///
+ public int cno { get; set; }
+
+ ///
+ /// 是否在充电 0:未知 1:正在充电 2:未电池
+ ///
+ public int hc { get; set; }
+
+ ///
+ /// 电接头连接状态 0:未知 1:已经连接 2:未连接
+ ///
+ public int el { get; set; }
+
+ ///
+ /// 剩余能量 单位 0.1 kwh
+ ///
+ public float soe { get; set; }
+
+ ///
+ /// 当前 SOC 0-100 单位 0.1 ,没有充电填 0
+ ///
+ public float soc { get; set; }
+
+ ///
+ /// 当前 SOH 0-100 单位 0.1 ,没有充电填 0
+ ///
+ public float soh { get; set; }
+
+ ///
+ /// 最低单体电压 单位 0.01V
+ ///
+ public float lsv { get; set; }
+
+ ///
+ /// 最高单体电压 单位 0.01V
+ ///
+ public float hsv { get; set; }
+
+ ///
+ /// 最低单体温度 单位 0.1℃
+ ///
+ public float lst { get; set; }
+
+ ///
+ /// 最高单体温度 单位 0.1℃
+ ///
+ public float hst { get; set; }
+
+ ///
+ /// 单体电池号 从 1 开始递增
+ ///
+ public int sl { get; set; }
+
+ ///
+ /// 单体电压 每一节电芯的单体电压 单位 0.1V ,如果没有该节电芯的数据,填65535.0 无效值
+ ///
+ public float sv { get; set; }
+
+ ///
+ /// 单体温度 每一节电芯的单体温度 单位 0.1℃ ,如果没有该节电芯的数据,填65535.0 无效值
+ ///
+ public float st { get; set; }
+
+ ///
+ /// 更新时间 格式 ”yyyy-MM-dd HH:mm:ss ”
+ ///
+ public DateTime bt { get; set; }
+}
diff --git a/Service/WaterCool/Client/WaterCoolClient.cs b/Service/WaterCool/Client/WaterCoolClient.cs
index 7208337..6fb6347 100644
--- a/Service/WaterCool/Client/WaterCoolClient.cs
+++ b/Service/WaterCool/Client/WaterCoolClient.cs
@@ -46,7 +46,7 @@ public class WaterCoolClient : TcpClient
///
public void SessionAttr(string sn, string destAddr)
{
- ChannelUtils.AddAttr(Channel, ChargerConst.WaterCoolSn, sn);
+ ChannelUtils.AddAttr(Channel, WaterCoolerConst.WaterCoolSn, sn);
ChannelUtils.AddAttr(Channel, ChargerConst.EqmTypeNo, sn);
ChannelUtils.AddAttr(Channel, ChargerConst.EqmCode, sn);
ChannelUtils.AddAttr(Channel, ChargerConst.DestAddr, destAddr);
diff --git a/Service/WaterCool/Client/WaterCoolClientMgr.cs b/Service/WaterCool/Client/WaterCoolClientMgr.cs
index 98a5689..9d16b6d 100644
--- a/Service/WaterCool/Client/WaterCoolClientMgr.cs
+++ b/Service/WaterCool/Client/WaterCoolClientMgr.cs
@@ -43,7 +43,7 @@ public class WaterCoolClientMgr
///
public static bool TryGetClient(IChannel channel, out string sn, out WaterCoolClient? client)
{
- string? snt = ChannelUtils.GetAttr(channel, ChargerConst.WaterCoolSn);
+ string? snt = ChannelUtils.GetAttr(channel, WaterCoolerConst.WaterCoolSn);
if (!string.IsNullOrWhiteSpace(snt))
{
diff --git a/WebStarter/Controllers/ChargeController.cs b/WebStarter/Controllers/ChargeController.cs
index f8f63fc..3ca32ea 100644
--- a/WebStarter/Controllers/ChargeController.cs
+++ b/WebStarter/Controllers/ChargeController.cs
@@ -77,13 +77,14 @@ public class ChargeController : ControllerBase
return Result.Fail("功率值范围1到360");
}
- ChargerClient? chargerClient = ClientMgr.GetBySn(code);
+ string _code = _binInfoService.QueryByClause(i => i.Code == code).ChargerNo;
+ ChargerClient? chargerClient = ClientMgr.GetBySn(_code);
if (chargerClient != null)
{
chargerClient.SendPowerRegulation(power);
- _equipInfoRepository.Update(i => i.ChargePower == power, it => it.Code == code);
+ _equipInfoRepository.Update(i => i.ChargePower == power, it => it.Code == _code);
return Result.Success(true);
}
diff --git a/WebStarter/Controllers/OutChargerController.cs b/WebStarter/Controllers/OutChargerController.cs
index 0cca89a..e00413e 100644
--- a/WebStarter/Controllers/OutChargerController.cs
+++ b/WebStarter/Controllers/OutChargerController.cs
@@ -1,4 +1,5 @@
-using HybirdFrameworkCore.Entity;
+using Entity.Dto.Resp;
+using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
using Repository.Station;
using Service.Charger.Client;
@@ -32,6 +33,7 @@ public class OutChargerController
[Route("SendStartOutCharger")]
public Result SendStartOutCharger([FromBody] PileStartChargeHttpReq httpReq)
{
+
string chargerCode = ChargerUtils.GetOutChargerCode(httpReq.pn);
byte chargerGunCode = ChargerUtils.GetTheGun(httpReq.pn);
@@ -92,4 +94,64 @@ public class OutChargerController
return Result.Success(true);
}
+
+ ///
+ /// 给充电枪发送功率调节指令
+ ///
+ /// 充电机code
+ /// 1枪 or 2枪
+ /// 功率
+ ///
+ [HttpGet]
+ [Route("SendPowerRegulation/{code}/{pn}/{power}")]
+ public Result SendPowerRegulation(string code,byte pn, float power)
+ {
+ if (power <=0 || power > 280)
+ {
+ return Result.Fail("功率值范围1到360");
+ }
+
+ if (pn != 1 && pn != 2)
+ {
+ return Result.Fail("请选择1枪或者2枪");
+ }
+
+ ChargerClient? chargerClient = ClientMgr.GetBySn(code);
+
+ if (chargerClient != null)
+ {
+ chargerClient.SendPileAdjustPower(pn,power);
+ return Result.Success(true);
+ }
+
+ return Result.Fail("充电机未连接");
+ }
+
+ ///
+ /// 获取充电桩信息
+ ///
+ ///
+ [HttpGet]
+ [Route("GetChargerPile")]
+ public Result> GetChargerPile()
+ {
+ var chargerClients = ClientMgr.Dictionary;
+ if (chargerClients.IsEmpty)
+ {
+ return Result>.Fail("没有充电机连接");
+ }
+
+ var list = chargerClients.Values.Select(client => new ChargerPileResp
+ {
+ Sn = client.Sn,
+ GunChargedOne = client.GunCharged[1],
+ GunChargedTwo = client.GunCharged[2],
+ ChargedPileOne = client.ChargedPile[1],
+ ChargedPileTwo = client.ChargedPile[2],
+ ChargePilePowerOne = client.ChargePilePower[1],
+ ChargePilePowerTwo = client.ChargePilePower[2]
+ }).ToList();
+
+ return Result>.Success(list);
+ }
}
\ No newline at end of file
diff --git a/WebStarter/Controllers/Test/GenController.cs b/WebStarter/Controllers/Test/GenController.cs
index 843ff1b..95e0100 100644
--- a/WebStarter/Controllers/Test/GenController.cs
+++ b/WebStarter/Controllers/Test/GenController.cs
@@ -1,5 +1,5 @@
using Microsoft.AspNetCore.Mvc;
-using Repository.Station;
+using Service.RealTime;
using SqlSugar;
namespace WebStarter.Controllers.Test;
@@ -13,7 +13,7 @@ public class GenController : ControllerBase
public GenController(ISqlSugarClient sqlSugarClient)
{
_sqlSugarClient = sqlSugarClient;
-
+
}
///
@@ -35,8 +35,28 @@ public class GenController : ControllerBase
Console.WriteLine("生成完毕");
}
-
-
+
+ ///
+ /// 测试发送
+ ///
+ ///
+ ///
+ [HttpGet("send/{msg}")]
+ public string? Send(string msg)
+ {
+ return RealtimeClient.SendWithResult(msg);
+ }
+
+ ///
+ /// 测试发送
+ ///
+ ///
+ ///
+ [HttpGet("send3/{msg}")]
+ public void Send3(string msg)
+ {
+ RealtimeClient.SendMsg(msg);
+ }
static string ToPascalCase(string input)
@@ -54,4 +74,6 @@ public class GenController : ControllerBase
return res;
}
-}
\ No newline at end of file
+
+
+}
diff --git a/WebStarter/Program.cs b/WebStarter/Program.cs
index 09528cf..8eeb5fe 100644
--- a/WebStarter/Program.cs
+++ b/WebStarter/Program.cs
@@ -4,9 +4,11 @@ using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.AutoTask;
using HybirdFrameworkCore.Configuration;
using HybirdFrameworkCore.Entity;
+using HybirdFrameworkCore.Job;
using HybirdFrameworkCore.Redis;
using log4net;
using Service.Charger.Client;
+using Service.RealTime;
using Service.WaterCool.Client;
using SqlSugar;
using SqlSugar.IOC;
@@ -22,10 +24,17 @@ builder.Host.ConfigureContainer(cb =>
var db = new SqlSugarScope(new ConnectionConfig
{
ConfigId = AppSettingsConstVars.ConfigId,
- ConnectionString = AppSettingsConstVars.DbSqlConnection, // �������ݿ������ַ���
+ ConnectionString = AppSettingsConstVars.DbSqlConnection,
DbType = AppSettingsConstVars.DbDbType == IocDbType.MySql.ToString() ? DbType.MySql : DbType.SqlServer,
IsAutoCloseConnection = true,
- InitKeyType = InitKeyType.Attribute // ���ʹ��ʵ��������Խ���������ʶ��������Ϊ InitKeyType.Attribute
+ InitKeyType = InitKeyType.Attribute
+ }, c =>
+ {
+ c.Aop.OnLogExecuting = (sql, pars) =>
+ {
+ string nativeSql = UtilMethods.GetNativeSql(sql, pars);
+ log.Info(nativeSql);
+ };
});
return db;
}).As().InstancePerLifetimeScope();
@@ -75,7 +84,6 @@ builder.Services.AddControllers().AddJsonOptions(configure =>
});
var app = builder.Build();
-
// Configure the HTTP request pipeline.
app.UseSwagger();
app.UseSwaggerUI();
@@ -97,6 +105,16 @@ AppInfo.Container = app.Services.GetAutofacRoot();
ClientMgr.InitClient();
TaskInit.Init();
+QuartzSchedulerFactory.Init();
+app.Lifetime.ApplicationStopping.Register(QuartzSchedulerFactory.Shutdown);
+
+bool.TryParse(AppSettingsHelper.GetContent("SignalR", "Enabled"), out var signalrEnabled);
+if (signalrEnabled)
+{
+ RealtimeClient.Init();
+}
+
+
// 水冷连接
WaterCoolClientMgr.InitClient();
diff --git a/WebStarter/WebStarter.csproj b/WebStarter/WebStarter.csproj
index 852c130..9827bea 100644
--- a/WebStarter/WebStarter.csproj
+++ b/WebStarter/WebStarter.csproj
@@ -15,6 +15,7 @@
+
diff --git a/WebStarter/appsettings.dev.json b/WebStarter/appsettings.dev.json
index 1165b91..5bcf292 100644
--- a/WebStarter/appsettings.dev.json
+++ b/WebStarter/appsettings.dev.json
@@ -10,7 +10,7 @@
"Url": "http://121.4.95.243:8090/Updates/AutoUpdaterStarter.xml"
},
"Redis": {
- "Connection": "192.168.2.2:6379,password=123456",
+ "Connection": "192.168.2.2:6379,password=dev",
"InstanceName": "local",
"DefaultDB": "8"
},
@@ -27,5 +27,13 @@
}
}
},
+ "Log": {
+ "Src": "D:\\RiderProjects\\hn_back_charger\\WebStarter\\bin\\Debug\\net6.0\\logs",
+ "Dest": "D:\\zip",
+ "Days": 7
+ },
+ "Job": {
+ "Enabled": false
+ },
"AllowedHosts": "*"
}
diff --git a/WebStarter/appsettings.prod.json b/WebStarter/appsettings.prod.json
index 82082d3..3ac71ca 100644
--- a/WebStarter/appsettings.prod.json
+++ b/WebStarter/appsettings.prod.json
@@ -27,5 +27,16 @@
}
}
},
+ "Log": {
+ "Src": "D:\\RiderProjects\\hn_back_charger\\WebStarter\\bin\\Debug\\net6.0\\logs",
+ "Dest": "D:\\zip",
+ "Days": 7
+ },
+ "Job": {
+ "Enabled": false
+ },
+ "Task": {
+ "Disabled": "UploadTelemetryData"
+ },
"AllowedHosts": "*"
}
diff --git a/WebStarter/db/qrtz.sql b/WebStarter/db/qrtz.sql
new file mode 100644
index 0000000..ee17aaf
--- /dev/null
+++ b/WebStarter/db/qrtz.sql
@@ -0,0 +1,214 @@
+/*
+ Navicat Premium Data Transfer
+
+ Source Server : rszn
+ Source Server Type : MySQL
+ Source Server Version : 80034 (8.0.34-0ubuntu0.22.04.1)
+ Source Host : 180.76.133.253:16306
+ Source Schema : huanneng_dev
+
+ Target Server Type : MySQL
+ Target Server Version : 80034 (8.0.34-0ubuntu0.22.04.1)
+ File Encoding : 65001
+
+ Date: 27/06/2024 17:23:00
+*/
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for qrtz_blob_triggers
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_blob_triggers`;
+CREATE TABLE `qrtz_blob_triggers` (
+ `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `TRIGGER_NAME` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `BLOB_DATA` blob NULL,
+ PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE,
+ INDEX `SCHED_NAME`(`SCHED_NAME` ASC, `TRIGGER_NAME` ASC, `TRIGGER_GROUP` ASC) USING BTREE,
+ CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Table structure for qrtz_calendars
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_calendars`;
+CREATE TABLE `qrtz_calendars` (
+ `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `CALENDAR_NAME` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `CALENDAR` blob NOT NULL,
+ PRIMARY KEY (`SCHED_NAME`, `CALENDAR_NAME`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Table structure for qrtz_cron_triggers
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_cron_triggers`;
+CREATE TABLE `qrtz_cron_triggers` (
+ `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `TRIGGER_NAME` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `CRON_EXPRESSION` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `TIME_ZONE_ID` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE,
+ CONSTRAINT `qrtz_cron_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Table structure for qrtz_fired_triggers
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_fired_triggers`;
+CREATE TABLE `qrtz_fired_triggers` (
+ `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `ENTRY_ID` varchar(140) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `TRIGGER_NAME` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `INSTANCE_NAME` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `FIRED_TIME` bigint NOT NULL,
+ `SCHED_TIME` bigint NOT NULL,
+ `PRIORITY` int NOT NULL,
+ `STATE` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `JOB_NAME` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `JOB_GROUP` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `IS_NONCONCURRENT` tinyint(1) NULL DEFAULT NULL,
+ `REQUESTS_RECOVERY` tinyint(1) NULL DEFAULT NULL,
+ PRIMARY KEY (`SCHED_NAME`, `ENTRY_ID`) USING BTREE,
+ INDEX `IDX_QRTZ_FT_TRIG_INST_NAME`(`SCHED_NAME` ASC, `INSTANCE_NAME` ASC) USING BTREE,
+ INDEX `IDX_QRTZ_FT_INST_JOB_REQ_RCVRY`(`SCHED_NAME` ASC, `INSTANCE_NAME` ASC, `REQUESTS_RECOVERY` ASC) USING BTREE,
+ INDEX `IDX_QRTZ_FT_J_G`(`SCHED_NAME` ASC, `JOB_NAME` ASC, `JOB_GROUP` ASC) USING BTREE,
+ INDEX `IDX_QRTZ_FT_JG`(`SCHED_NAME` ASC, `JOB_GROUP` ASC) USING BTREE,
+ INDEX `IDX_QRTZ_FT_T_G`(`SCHED_NAME` ASC, `TRIGGER_NAME` ASC, `TRIGGER_GROUP` ASC) USING BTREE,
+ INDEX `IDX_QRTZ_FT_TG`(`SCHED_NAME` ASC, `TRIGGER_GROUP` ASC) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Table structure for qrtz_job_details
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_job_details`;
+CREATE TABLE `qrtz_job_details` (
+ `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `JOB_NAME` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `JOB_GROUP` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `DESCRIPTION` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `JOB_CLASS_NAME` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `IS_DURABLE` tinyint(1) NOT NULL,
+ `IS_NONCONCURRENT` tinyint(1) NOT NULL,
+ `IS_UPDATE_DATA` tinyint(1) NOT NULL,
+ `REQUESTS_RECOVERY` tinyint(1) NOT NULL,
+ `JOB_DATA` blob NULL,
+ PRIMARY KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) USING BTREE,
+ INDEX `IDX_QRTZ_J_REQ_RECOVERY`(`SCHED_NAME` ASC, `REQUESTS_RECOVERY` ASC) USING BTREE,
+ INDEX `IDX_QRTZ_J_GRP`(`SCHED_NAME` ASC, `JOB_GROUP` ASC) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Table structure for qrtz_locks
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_locks`;
+CREATE TABLE `qrtz_locks` (
+ `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `LOCK_NAME` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ PRIMARY KEY (`SCHED_NAME`, `LOCK_NAME`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Table structure for qrtz_paused_trigger_grps
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_paused_trigger_grps`;
+CREATE TABLE `qrtz_paused_trigger_grps` (
+ `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ PRIMARY KEY (`SCHED_NAME`, `TRIGGER_GROUP`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Table structure for qrtz_scheduler_state
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_scheduler_state`;
+CREATE TABLE `qrtz_scheduler_state` (
+ `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `INSTANCE_NAME` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `LAST_CHECKIN_TIME` bigint NOT NULL,
+ `CHECKIN_INTERVAL` bigint NOT NULL,
+ PRIMARY KEY (`SCHED_NAME`, `INSTANCE_NAME`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Table structure for qrtz_simple_triggers
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_simple_triggers`;
+CREATE TABLE `qrtz_simple_triggers` (
+ `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `TRIGGER_NAME` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `REPEAT_COUNT` bigint NOT NULL,
+ `REPEAT_INTERVAL` bigint NOT NULL,
+ `TIMES_TRIGGERED` bigint NOT NULL,
+ PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE,
+ CONSTRAINT `qrtz_simple_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Table structure for qrtz_simprop_triggers
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_simprop_triggers`;
+CREATE TABLE `qrtz_simprop_triggers` (
+ `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `TRIGGER_NAME` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `STR_PROP_1` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `STR_PROP_2` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `STR_PROP_3` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `INT_PROP_1` int NULL DEFAULT NULL,
+ `INT_PROP_2` int NULL DEFAULT NULL,
+ `LONG_PROP_1` bigint NULL DEFAULT NULL,
+ `LONG_PROP_2` bigint NULL DEFAULT NULL,
+ `DEC_PROP_1` decimal(13, 4) NULL DEFAULT NULL,
+ `DEC_PROP_2` decimal(13, 4) NULL DEFAULT NULL,
+ `BOOL_PROP_1` tinyint(1) NULL DEFAULT NULL,
+ `BOOL_PROP_2` tinyint(1) NULL DEFAULT NULL,
+ `TIME_ZONE_ID` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE,
+ CONSTRAINT `qrtz_simprop_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Table structure for qrtz_triggers
+-- ----------------------------
+DROP TABLE IF EXISTS `qrtz_triggers`;
+CREATE TABLE `qrtz_triggers` (
+ `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `TRIGGER_NAME` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `JOB_NAME` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `JOB_GROUP` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `DESCRIPTION` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `NEXT_FIRE_TIME` bigint NULL DEFAULT NULL,
+ `PREV_FIRE_TIME` bigint NULL DEFAULT NULL,
+ `PRIORITY` int NULL DEFAULT NULL,
+ `TRIGGER_STATE` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `TRIGGER_TYPE` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
+ `START_TIME` bigint NOT NULL,
+ `END_TIME` bigint NULL DEFAULT NULL,
+ `CALENDAR_NAME` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+ `MISFIRE_INSTR` smallint NULL DEFAULT NULL,
+ `JOB_DATA` blob NULL,
+ PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE,
+ INDEX `IDX_QRTZ_T_J`(`SCHED_NAME` ASC, `JOB_NAME` ASC, `JOB_GROUP` ASC) USING BTREE,
+ INDEX `IDX_QRTZ_T_JG`(`SCHED_NAME` ASC, `JOB_GROUP` ASC) USING BTREE,
+ INDEX `IDX_QRTZ_T_C`(`SCHED_NAME` ASC, `CALENDAR_NAME` ASC) USING BTREE,
+ INDEX `IDX_QRTZ_T_G`(`SCHED_NAME` ASC, `TRIGGER_GROUP` ASC) USING BTREE,
+ INDEX `IDX_QRTZ_T_STATE`(`SCHED_NAME` ASC, `TRIGGER_STATE` ASC) USING BTREE,
+ INDEX `IDX_QRTZ_T_N_STATE`(`SCHED_NAME` ASC, `TRIGGER_NAME` ASC, `TRIGGER_GROUP` ASC, `TRIGGER_STATE` ASC) USING BTREE,
+ INDEX `IDX_QRTZ_T_N_G_STATE`(`SCHED_NAME` ASC, `TRIGGER_GROUP` ASC, `TRIGGER_STATE` ASC) USING BTREE,
+ INDEX `IDX_QRTZ_T_NEXT_FIRE_TIME`(`SCHED_NAME` ASC, `NEXT_FIRE_TIME` ASC) USING BTREE,
+ INDEX `IDX_QRTZ_T_NFT_ST`(`SCHED_NAME` ASC, `TRIGGER_STATE` ASC, `NEXT_FIRE_TIME` ASC) USING BTREE,
+ INDEX `IDX_QRTZ_T_NFT_MISFIRE`(`SCHED_NAME` ASC, `MISFIRE_INSTR` ASC, `NEXT_FIRE_TIME` ASC) USING BTREE,
+ INDEX `IDX_QRTZ_T_NFT_ST_MISFIRE`(`SCHED_NAME` ASC, `MISFIRE_INSTR` ASC, `NEXT_FIRE_TIME` ASC, `TRIGGER_STATE` ASC) USING BTREE,
+ INDEX `IDX_QRTZ_T_NFT_ST_MISFIRE_GRP`(`SCHED_NAME` ASC, `MISFIRE_INSTR` ASC, `NEXT_FIRE_TIME` ASC, `TRIGGER_GROUP` ASC, `TRIGGER_STATE` ASC) USING BTREE,
+ CONSTRAINT `qrtz_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) REFERENCES `qrtz_job_details` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
+
+SET FOREIGN_KEY_CHECKS = 1;
diff --git a/WebStarter/log4net.config b/WebStarter/log4net.config
index c2449e8..0afbc89 100644
--- a/WebStarter/log4net.config
+++ b/WebStarter/log4net.config
@@ -18,7 +18,7 @@
-
+
@@ -26,144 +26,144 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -172,7 +172,7 @@
-
+
diff --git a/WebStarter/obj/WebStarter.csproj.nuget.g.targets b/WebStarter/obj/WebStarter.csproj.nuget.g.targets
index 5b31449..4ef9a86 100644
--- a/WebStarter/obj/WebStarter.csproj.nuget.g.targets
+++ b/WebStarter/obj/WebStarter.csproj.nuget.g.targets
@@ -3,6 +3,7 @@
+
diff --git a/WinFormStarter/obj/WinFormStarter.csproj.nuget.g.targets b/WinFormStarter/obj/WinFormStarter.csproj.nuget.g.targets
index 6a3c0bd..d495d0d 100644
--- a/WinFormStarter/obj/WinFormStarter.csproj.nuget.g.targets
+++ b/WinFormStarter/obj/WinFormStarter.csproj.nuget.g.targets
@@ -2,6 +2,7 @@
+
-
\ No newline at end of file
+