From 69521e9e80c423d05e87a04110899982c249474a Mon Sep 17 00:00:00 2001
From: xjl <2595686544@qq.com>
Date: Fri, 26 Jul 2024 16:05:09 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BA=91=E5=B9=B3=E5=8F=B0=E5=B8=A7=E5=86=85?=
=?UTF-8?q?=E5=AE=B9=E8=A1=A5=E5=85=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Entity/Constant/StationParamConst.cs | 17 +-
Entity/DbModel/BaseModel.cs | 2 +-
.../Station/EquipAlarmProcessRecord.cs | 7 +-
Entity/DbModel/Station/EquipAlarmRecord.cs | 6 +-
Entity/DbModel/Station/EquipInfo.cs | 7 +
Service/Cloud/Client/CloudClient.cs | 10 +-
Service/Cloud/Client/CloudClientMgr.cs | 253 +++++++++++++++++-
.../Handler/DeliverBasicInformationHandler.cs | 18 +-
.../Cloud/Handler/FaultReportResHandler.cs | 53 ++++
.../Cloud/Handler/ServiceableStateHandler.cs | 3 +-
Service/Cloud/Handler/SignInRespHandler.cs | 12 +-
Service/Cloud/Msg/Host/Req/FaultReport.cs | 2 +-
Service/Execute/Api/CloudApi.cs | 89 ++++--
Service/Init/StaticStationInfo.cs | 90 ++++++-
WebStarter/db/xjl0725.sql | 5 +
15 files changed, 527 insertions(+), 47 deletions(-)
create mode 100644 Service/Cloud/Handler/FaultReportResHandler.cs
create mode 100644 WebStarter/db/xjl0725.sql
diff --git a/Entity/Constant/StationParamConst.cs b/Entity/Constant/StationParamConst.cs
index a3d6fb9..b7df553 100644
--- a/Entity/Constant/StationParamConst.cs
+++ b/Entity/Constant/StationParamConst.cs
@@ -15,7 +15,7 @@ public class StationParamConst
public static readonly string StationName = "Station.StationName";
///
- /// 站类型
+ /// 站类型 01:单仓左 02:单仓右 03:双仓
///
public static readonly string StationType = "Station.StationType";
@@ -68,7 +68,7 @@ public class StationParamConst
///
/// 投放时间
///
- public static readonly string? LaunchTime = "Station.LaunchTime";
+ public static readonly string LaunchTime = "Station.LaunchTime";
///
/// 联系方式
@@ -143,7 +143,7 @@ public class StationParamConst
///
/// 修改时间
///
- public static readonly string? ModifyTime = "Station.ModifyTime";
+ public static readonly string ModifyTime = "Station.ModifyTime";
///
/// 配电容量(kVA)
@@ -153,7 +153,7 @@ public class StationParamConst
///
/// 总功率(kW)
///
- public static readonly string? TotalPower = "Station.TotalPower";
+ public static readonly string TotalPower = "Station.TotalPower";
///
/// 省份
@@ -196,9 +196,10 @@ public class StationParamConst
public static readonly string ChargePower = "Station.ChargePower";
public static readonly string AutoChargeEnabled = "Station.AutoChargeEnabled";
+ //换电收费模型
public static readonly string Eid = "Station.Eid";
- //运营模型
+ //电池运营模型
public static readonly string Oid = "Station.Oid";
//电价模型
@@ -208,7 +209,13 @@ public class StationParamConst
/// 运营状态
///
public static readonly string StationStatus = "Station.StationStatus";
+ ///
+ /// 自动换电 手动换电
+ ///
public static readonly string StationWay = "Station.StationWay";
+ ///
+ /// 本地换电 远程换电
+ ///
public static readonly string StationModel = "Station.StationModel";
#region Tbox
diff --git a/Entity/DbModel/BaseModel.cs b/Entity/DbModel/BaseModel.cs
index 1665beb..c48e880 100644
--- a/Entity/DbModel/BaseModel.cs
+++ b/Entity/DbModel/BaseModel.cs
@@ -38,6 +38,6 @@ public class BaseModel
/// Nullable:True
///
[SugarColumn(ColumnName = "updated_time", UpdateServerTime = true)]
- public DateTime? UpdatedTime { get; set; } = DateTime.Now;
+ public DateTime UpdatedTime { get; set; } = DateTime.Now;
}
\ No newline at end of file
diff --git a/Entity/DbModel/Station/EquipAlarmProcessRecord.cs b/Entity/DbModel/Station/EquipAlarmProcessRecord.cs
index 4b82126..5529b45 100644
--- a/Entity/DbModel/Station/EquipAlarmProcessRecord.cs
+++ b/Entity/DbModel/Station/EquipAlarmProcessRecord.cs
@@ -82,6 +82,11 @@ namespace Entity.DbModel.Station
[SugarColumn(ColumnName = "process_time")]
public DateTime? ProcessTime { get; set; }
-
+ ///
+ /// 上传状态 0:未上传 1:已上传
+ ///
+ [SugarColumn(ColumnName = "upload_status")]
+ public int UploadStatus { get; set; }
+
}
}
diff --git a/Entity/DbModel/Station/EquipAlarmRecord.cs b/Entity/DbModel/Station/EquipAlarmRecord.cs
index d348638..e760ad3 100644
--- a/Entity/DbModel/Station/EquipAlarmRecord.cs
+++ b/Entity/DbModel/Station/EquipAlarmRecord.cs
@@ -76,6 +76,10 @@ namespace Entity.DbModel.Station
[SugarColumn(ColumnName = "start_time")]
public DateTime? StartTime { get; set; }
-
+ ///
+ /// 上传状态 0:未上传 1:已上传
+ ///
+ [SugarColumn(ColumnName = "upload_status")]
+ public int UploadStatus { get; set; }
}
}
diff --git a/Entity/DbModel/Station/EquipInfo.cs b/Entity/DbModel/Station/EquipInfo.cs
index 4483f4a..a84ee1c 100644
--- a/Entity/DbModel/Station/EquipInfo.cs
+++ b/Entity/DbModel/Station/EquipInfo.cs
@@ -68,5 +68,12 @@ namespace Entity.DbModel.Station
///
[SugarColumn(ColumnName="charge_power")]
public float? ChargePower { get; set; }
+ ///
+ /// 安装位置编号
+ ///
+ [SugarColumn(ColumnName = "addr")]
+ public int? Addr { get; set; }
+
+
}
}
diff --git a/Service/Cloud/Client/CloudClient.cs b/Service/Cloud/Client/CloudClient.cs
index f5da323..7141b3b 100644
--- a/Service/Cloud/Client/CloudClient.cs
+++ b/Service/Cloud/Client/CloudClient.cs
@@ -65,8 +65,16 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR
public int Encrypt { get; set; }
public string? AesKey { get; set; }
-
+ ///
+ /// 签到结果
+ ///
public bool Authed { get; set; }
+ ///
+ /// 设备是否上传
+ ///
+ public int EquipmentUpload { get; set; }
+
+
#endregion
diff --git a/Service/Cloud/Client/CloudClientMgr.cs b/Service/Cloud/Client/CloudClientMgr.cs
index ae2961a..07c74b0 100644
--- a/Service/Cloud/Client/CloudClientMgr.cs
+++ b/Service/Cloud/Client/CloudClientMgr.cs
@@ -33,6 +33,7 @@ public class CloudClientMgr
static EmeterDayEnergyService emeterDayEnergyService = AppInfo.Container.Resolve();
static EmeterHourEnergyService emeterHourEnergyService = AppInfo.Container.Resolve();
+ static BinInfoRepository binInfoRepository = AppInfo.Container.Resolve();
private static DateTime _dateTime = DateTime.Now.AddSeconds(-30);
@@ -47,6 +48,9 @@ public class CloudClientMgr
private static DateTime _dateTime9 = DateTime.Today.AddHours(DateTime.Now.Hour - 1);//小时
private static DateTime _dateTime10 = DateTime.Now.AddDays(-1).Date;//天
private static DateTime _dateTime11 = DateTime.Now.AddDays(-1).Date;//天
+ private static DateTime _dateTime12 = DateTime.Now.AddSeconds(-30);
+ private static DateTime _dateTime13 = DateTime.Now.AddSeconds(-30);
+ private static DateTime _dateTime14 = DateTime.Now.AddSeconds(-30);
@@ -78,6 +82,8 @@ public class CloudClientMgr
RedisHelper? redisHelper = AppInfo.Container.Resolve();
BinInfoRepository binInfoRepository = AppInfo.Container.Resolve();
+ CloudApi.SendSignIn();
+
#region 遥测合并上报
req.datainfo = new List();
redisHelper?.GetSubscriber().Subscribe("UploadTelemetryData", (channel, value) =>
@@ -165,8 +171,7 @@ public class CloudClientMgr
});
#endregion
- var sv = StaticStationInfo.StationSftVer.ToString();
-
+
redisHelper?.GetSubscriber().Subscribe("BatteryInfoUploadTask", (channel, value) =>
{
try
@@ -200,7 +205,6 @@ public class CloudClientMgr
-
private static async Task StartAsyncLoop()
{
await Task.Run(() =>
@@ -211,7 +215,12 @@ public class CloudClientMgr
{
if (CloudClient.Connected)
{
- CloudApi.SendStateLog(0);
+ if (StationConstant.StationModel.Remote == BaseEnumExtensions.GetEnumByCode(
+ StaticStationInfo.StationModel))
+ {
+ CloudApi.SendStateLog();
+ }
+
TaskHostStatusReported();
@@ -233,7 +242,16 @@ public class CloudClientMgr
TaskStaDayOpeEnergyVal();
- TaskStaHourAmountVal();
+ //TaskStaHourAmountVal();
+
+
+ SendRealTimeFaultInfo();
+
+ SendStartLogMessage();
+
+ SendBatteryTotal();
+
+ SendChargingTotalDis();
}
Thread.Sleep(1000);
}
@@ -313,7 +331,7 @@ public class CloudClientMgr
///
private static void TaskTemperatureHumidityData()
{
- if ((DateTime.Now - _dateTime4).TotalSeconds <= 10)
+ if ((DateTime.Now - _dateTime4).TotalSeconds <= 30)
{
return;
}
@@ -337,7 +355,7 @@ public class CloudClientMgr
///
/// 电能表累计值信息 15m
///
- private static void TaskPowerTotal()//Desc记得改回来
+ private static void TaskPowerTotal()
{
if ((DateTime.Now - _dateTime5).TotalMinutes <= 15)
{
@@ -736,4 +754,225 @@ public class CloudClientMgr
CloudApi.SendStaHourAmountVal(staHourAmountVal);
}
+
+
+ ///
+ /// 换电站上报设备列表
+ ///
+ public static void SendDevList(int ot)
+ {
+ EquipInfoRepository equipInfoRepository = AppInfo.Container.Resolve();
+ var equipList = equipInfoRepository.Query();
+
+ DevList devList = new()
+ {
+ ot = ot,
+ sn = StaticStationInfo.StationNo,
+ vs = "1.0",
+ };
+ devList.d_info = new List();
+
+ for (int i = 0; i < equipList.Count; i++)
+ {
+ D_INFO d_INFO = new D_INFO();
+ d_INFO.dn = (equipList[i].TypeCode==0?"充电机":"电表")+ equipList[i].Code;
+ d_INFO.dt = equipList[i].TypeCode == 0 ? "充电机" : "电表";
+ d_INFO.dc = equipList[i].TypeCode.ToString();
+ d_INFO.tc = equipList[i].Status.ToString();
+ d_INFO.ds = equipList[i].Id.ToString();
+ d_INFO.sn = equipList[i].Code;
+ d_INFO.en = "";
+ d_INFO.hv = "";
+ d_INFO.sv = "";
+ d_INFO.mn = "";
+ d_INFO.ns = equipList[i].Addr.ToString();
+ d_INFO.ti = equipList[i].CreatedTime.ToString();
+
+ devList.d_info.Add(d_INFO);
+ }
+
+ CloudApi.SendDevList(devList);
+
+ }
+
+ ///
+ /// 实时故障信息上传
+ ///
+ public static void SendRealTimeFaultInfo()
+ {
+
+ EquipAlarmRecordRepository equipAlarmRecordRepository = AppInfo.Container.Resolve();
+ var AlarmList = equipAlarmRecordRepository.QueryListByClause(u => u.UploadStatus == 0);
+
+ EquipAlarmProcessRecordRepository equipAlarmProcessRecordRepository = AppInfo.Container.Resolve();
+ var AlarmProcessList = equipAlarmProcessRecordRepository.QueryListByClause(u => u.UploadStatus == 0);
+
+ //产生上传
+ for (int i = 0; i < AlarmList.Count; i++)
+ {
+ FaultReport faultReport = new()
+ {
+ sn = StaticStationInfo.StationNo,
+ en= AlarmList[i].EquipCode,
+ fc= AlarmList[i].ErrorCode,
+ ft= AlarmList[i].ErrorMsg,
+ fl= Convert.ToInt32( AlarmList[i].ErrorLevel),
+ fg= 1,
+ bt= AlarmList[i].StartTime.ToString(),
+ cm=1,
+ };
+ CloudApi.SendRealTimeFaultInfo(faultReport);
+
+
+
+ Thread.Sleep(500);
+ }
+
+ //消失上传
+ for (int i = 0; i < AlarmProcessList.Count; i++)
+ {
+ FaultReport faultReport = new()
+ {
+ sn = StaticStationInfo.StationNo,
+ en = AlarmProcessList[i].EquipCode,
+ fc = AlarmProcessList[i].ErrorCode,
+ ft = AlarmProcessList[i].ErrorMsg,
+ fl = Convert.ToInt32(AlarmProcessList[i].ErrorLevel),
+ fg = 2,
+ bt = AlarmProcessList[i].ProcessTime.ToString(),
+ cm = 1,
+ };
+ CloudApi.SendRealTimeFaultInfo(faultReport);
+
+ Thread.Sleep(500);
+ }
+
+ }
+
+
+ static List equipInfos;
+ ///
+ /// 换电站设备状态开始和结束日志信息
+ ///
+ public static void SendStartLogMessage()
+ {
+ if ((DateTime.Now - _dateTime12).TotalSeconds <= 30)
+ {
+ return;
+ }
+ _dateTime12 = DateTime.Now;
+
+ EquipInfoRepository equipInfoRepository = AppInfo.Container.Resolve();
+ var equipList = equipInfoRepository.Query();
+ if (equipInfos == null) { equipInfos = equipList; }
+ bool variation = false;
+
+ if (variation)
+ {
+ for (int i = 0; i < equipList.Count; i++)
+ {
+ if (equipInfos[i].UpdatedTime != equipList[i].UpdatedTime)
+ {
+ EqmStateEndLogInfo req = new()
+ {
+ en = StaticStationInfo.StationNo + equipInfos[i].Code,
+ sv = Convert.ToByte(equipInfos[i].Status),
+ sm = equipInfos[i].Status == 1 ? "启用" : "停用",
+ st = equipInfos[i].UpdatedTime,
+ et = equipList[i].UpdatedTime,
+ ke= (int)(equipList[i].UpdatedTime- equipInfos[i].UpdatedTime).TotalSeconds,
+ cm = 1,
+ };
+ }
+ }
+ }
+
+
+ for (int i = 0; i < equipList.Count; i++)
+ {
+ if (equipInfos[i].UpdatedTime != equipList[i].UpdatedTime)
+ {
+ EqmStateStartLogInfo req = new()
+ {
+ en = StaticStationInfo.StationNo + equipInfos[i].Code,
+ SV = Convert.ToByte(equipInfos[i].Status),
+ sm = equipInfos[i].Status == 1 ? "启用": "停用" ,
+ st = equipList[i].UpdatedTime,
+ cm = 1,
+ };
+
+ CloudApi.SendStartLogMessage(req);
+ variation= true;
+ }
+
+ }
+
+ equipInfos = equipList;
+
+ }
+
+
+
+ ///
+ /// 换电站上报电池状态分布统计信息 2分钟
+ ///
+ public static void SendBatteryTotal()
+ {
+ if ((DateTime.Now - _dateTime13).TotalMinutes <= 2)
+ {
+ return;
+ }
+ _dateTime13 = DateTime.Now;
+
+ var binList = binInfoRepository.Query();
+ int bt = binList.Select(u => u.Exists == 1).Count();
+ int ct = binList.Select(u => u.Soc >= StaticStationInfo.SwapSoc).Count();
+ int cc = binList.Select(u => u.ChargeStatus ==1).Count();
+ int ca = binList.Select(u => u.Soc < StaticStationInfo.SwapSoc).Count();
+ BatteryTotal devList = new()
+ {
+ sn= StaticStationInfo.StationNo,
+ btc=1,
+ sm="99999999",
+ bn="默认型号",
+ bc= bt,
+ ct= ct,
+ cc=cc,
+ ca=ca,
+ ut=DateTime.Now,
+ };
+
+ CloudApi.SendBatteryTotal(devList);
+
+ }
+
+ ///
+ /// 换电站充电电池电量分布统计信息 2分钟
+ ///
+ public static void SendChargingTotalDis()
+ {
+ if ((DateTime.Now - _dateTime14).TotalMinutes <= 2)
+ {
+ return;
+ }
+ _dateTime14 = DateTime.Now;
+
+ var binList = binInfoRepository.Query();
+ int hc = binList.Select(u => u.Soc >= 90).Count();
+ int mc = binList.Select(u => u.Soc >= 80&& u.Soc<90).Count();
+ int lc = binList.Select(u => u.Soc >= 0&& u.Soc<80).Count();
+
+ ChargingTotalDis req = new()
+ {
+ sn = StaticStationInfo.StationNo,
+ bs = "99999999",
+ bn = "默认型号",
+ hc = hc,
+ mc = mc,
+ lc = lc,
+ };
+
+ CloudApi.SendChargingTotalDis(req);
+
+ }
}
diff --git a/Service/Cloud/Handler/DeliverBasicInformationHandler.cs b/Service/Cloud/Handler/DeliverBasicInformationHandler.cs
index 1526891..dad9ae7 100644
--- a/Service/Cloud/Handler/DeliverBasicInformationHandler.cs
+++ b/Service/Cloud/Handler/DeliverBasicInformationHandler.cs
@@ -24,8 +24,24 @@ public class DeliverBasicInformationHandler : IBaseHandler
StaticStationInfo.StationNo = deliverBasicInformation.sn;
StaticStationInfo.StationName = deliverBasicInformation.Sm;
StaticStationInfo.StationSn = deliverBasicInformation.SS;
- //TODO 补全StaticStationInfo后赋值
+ StaticStationInfo.StationLocation = deliverBasicInformation.sl;
+ StaticStationInfo.StationType = deliverBasicInformation.st;
+ StaticStationInfo.Longitude = deliverBasicInformation.ld;
+ StaticStationInfo.Latitude = deliverBasicInformation.lt;
+ StaticStationInfo.AreaCode = deliverBasicInformation.ac;
+ StaticStationInfo.AreaName = deliverBasicInformation.am;
+ StaticStationInfo.OperationStartTime = deliverBasicInformation.ot.ToString();
+ StaticStationInfo.LaunchTime = deliverBasicInformation.lm.ToString();
+ StaticStationInfo.ContactWay = deliverBasicInformation.cw;
+ StaticStationInfo.Principal = deliverBasicInformation.pp;
+ StaticStationInfo.StationCompany = deliverBasicInformation.sc;
+ StaticStationInfo.SocialCreditCode = deliverBasicInformation.cc;
+ StaticStationInfo.StationSftVer = deliverBasicInformation.sv;
+ StaticStationInfo.SupplierCode = deliverBasicInformation.sp;
+ StaticStationInfo.Cover = deliverBasicInformation.cb.ToString();
+ StaticStationInfo.StationVersion = deliverBasicInformation.bs;
+
SetStBaseInfoRes resp = new SetStBaseInfoRes();
CloudClientMgr.CloudClient?.Publish(resp);
}
diff --git a/Service/Cloud/Handler/FaultReportResHandler.cs b/Service/Cloud/Handler/FaultReportResHandler.cs
new file mode 100644
index 0000000..412cece
--- /dev/null
+++ b/Service/Cloud/Handler/FaultReportResHandler.cs
@@ -0,0 +1,53 @@
+using HybirdFrameworkCore.Autofac.Attribute;
+using log4net;
+using Newtonsoft.Json;
+using Repository.Station;
+using Service.Cloud.Client;
+using Service.Cloud.Common;
+using Service.Cloud.Msg.Cloud.Resp;
+using System.Drawing;
+
+namespace Service.Cloud.Handler;
+
+[Scope("InstancePerDependency")]
+public class FaultReportResHandler : IBaseHandler
+{
+ private static readonly ILog Log = LogManager.GetLogger(typeof(FaultReportResHandler));
+
+ public EquipAlarmRecordRepository equipAlarmRecordRepository { get; set; }
+ EquipAlarmProcessRecordRepository equipAlarmProcessRecordRepository { get; set; }
+ public void Handle(string t)
+ {
+ FaultReportRes? resp = JsonConvert.DeserializeObject(t);
+ if (resp != null)
+ {
+ if (CloudClientMgr.CloudClient != null)
+ {
+ CloudClientMgr.CloudClient.RealTimeFault.SetResp(resp);
+ string? reqFc = CloudClientMgr.CloudClient.RealTimeFault.Req?.fc;
+ int? reqFg = CloudClientMgr.CloudClient.RealTimeFault.Req?.fg;
+
+ Log.Info($"receive FaultReportRes fc={reqFc} {JsonConvert.SerializeObject(resp)}");
+
+ if (!string.IsNullOrWhiteSpace(reqFc) && resp.re == 0)
+ {
+ if (reqFg == 1)
+ {
+ equipAlarmRecordRepository.Update(it => it.UploadStatus == 1, it => it.ErrorCode == reqFc);
+ }
+ else
+ {
+ equipAlarmProcessRecordRepository.Update(it => it.UploadStatus == 1, it => it.ErrorCode == reqFc);
+ }
+
+ }
+
+ }
+ }
+ }
+
+ public bool CanHandle(string cmd)
+ {
+ return CloudConst.faultReportRes == cmd;
+ }
+}
\ No newline at end of file
diff --git a/Service/Cloud/Handler/ServiceableStateHandler.cs b/Service/Cloud/Handler/ServiceableStateHandler.cs
index c824c13..2b9add2 100644
--- a/Service/Cloud/Handler/ServiceableStateHandler.cs
+++ b/Service/Cloud/Handler/ServiceableStateHandler.cs
@@ -22,7 +22,8 @@ public class ServiceableStateHandler:IBaseHandler
SetService? req = JsonConvert.DeserializeObject(t);
if (req != null)
{
- StaticStationInfo.StationStatus = req.st;
+
+ StaticStationInfo.Sevstatus = req.st;
SetServiceRes resp = new SetServiceRes();
CloudClientMgr.CloudClient?.Publish(resp);
}
diff --git a/Service/Cloud/Handler/SignInRespHandler.cs b/Service/Cloud/Handler/SignInRespHandler.cs
index faf37af..2290e29 100644
--- a/Service/Cloud/Handler/SignInRespHandler.cs
+++ b/Service/Cloud/Handler/SignInRespHandler.cs
@@ -1,4 +1,7 @@
-using HybirdFrameworkCore.Autofac.Attribute;
+using Autofac;
+using Entity.DbModel.Station;
+using HybirdFrameworkCore.Autofac;
+using HybirdFrameworkCore.Autofac.Attribute;
using Newtonsoft.Json;
using Service.Cloud.Client;
using Service.Cloud.Common;
@@ -16,6 +19,13 @@ public class SignInRespHandler : IBaseHandler
if (signInResp != null)
{
CloudClientMgr.CloudClient.Authed = signInResp.re == 0;
+ CloudClientMgr.CloudClient.EquipmentUpload = signInResp.dl_up;
+ if (CloudClientMgr.CloudClient.EquipmentUpload != 0)
+ {
+ //上传设备列表
+ CloudClientMgr.SendDevList(1);
+
+ }
}
}
diff --git a/Service/Cloud/Msg/Host/Req/FaultReport.cs b/Service/Cloud/Msg/Host/Req/FaultReport.cs
index 8de5750..7c98165 100644
--- a/Service/Cloud/Msg/Host/Req/FaultReport.cs
+++ b/Service/Cloud/Msg/Host/Req/FaultReport.cs
@@ -42,7 +42,7 @@ namespace Service.Cloud.Msg.Host.Req
/// 发生时间
/// 格式”yyyy-MM-dd HH:mm:ss”
///
- public DateTime bt { get; set; }
+ public string bt { get; set; }
///
/// 采集模式
/// 1:自动;2:人工录入
diff --git a/Service/Execute/Api/CloudApi.cs b/Service/Execute/Api/CloudApi.cs
index 46f6d4c..a3e30a4 100644
--- a/Service/Execute/Api/CloudApi.cs
+++ b/Service/Execute/Api/CloudApi.cs
@@ -1,7 +1,9 @@
using Entity.Constant;
using Entity.DbModel.Station;
+using HybirdFrameworkCore.Autofac;
using log4net;
using Newtonsoft.Json;
+using Repository.Station;
using Service.Cloud.Client;
using Service.Cloud.Msg.Cloud.Req;
using Service.Cloud.Msg.Cloud.Resp;
@@ -10,6 +12,7 @@ using Service.Cloud.Msg.Host.Req.OutCharger;
using Service.Execute.Model;
using Service.Execute.Model.Tbox;
using Service.Init;
+using System.Security.Cryptography;
namespace Service.Execute.Api;
@@ -113,15 +116,15 @@ public abstract class CloudApi
///
/// 上报换电步序到云端
///
- ///
- /// 是否空闲
- public static void SendStateLog( int state)
+ public static void SendStateLog( )
{
if (BusinessSwappingForCloudState!= StationSoftMgr.SwappingStateMachine.BusinessSwappingForCloudState)
{
StationChnRunStatus stationChnRunStatus = null;
+
- if (state == 1)
+ if (StationSoftMgr.SwappingStateMachine.BusinessSwappingForCloudState != InfoEnum.BusinessSwappingForCloudState.Idle||
+ StationSoftMgr.SwappingStateMachine.BusinessSwappingForCloudState != InfoEnum.BusinessSwappingForCloudState.UnKnown)
{
stationChnRunStatus = new()
{
@@ -130,12 +133,12 @@ public abstract class CloudApi
cs = (int)StationSoftMgr.SwappingStateMachine.BusinessSwappingForCloudState,
iv = StationSoftMgr.SwappingStateMachine.RadarInFlag == true ? 1 : 2,
ls = StationSoftMgr.SwappingStateMachine.VelUnlockFlag == true ? 2 : 1,
- fl = 0,
+ fl = Convert.ToInt32(StaticStationInfo.Faultlevel),
ut = DateTime.Now,
};
}
- else
+ else//空闲
{
stationChnRunStatus = new()
@@ -145,7 +148,7 @@ public abstract class CloudApi
cs = 1,
iv = 2,
ls = 0,
- fl = 0,
+ fl = Convert.ToInt32(StaticStationInfo.Faultlevel),
ut = DateTime.Now,
};
@@ -376,7 +379,7 @@ public abstract class CloudApi
/// 换电站进行签到认证
///
///
- public static void SendSignIn(SignIn req)
+ public static void SendSignIn()
{
SignIn signIn = new()
{
@@ -384,33 +387,73 @@ public abstract class CloudApi
ky = StaticStationInfo.StationSn,
st = "02",
dv = "",
- sv = StaticStationInfo.StationSftVer.ToString(),
+ sv = StaticStationInfo.StationSftVer,
ss = StaticStationInfo.Sevstatus,
ca = Convert.ToSingle(StaticStationInfo.DistributionCapacity),
- VS = "",
- cp = 0,
- bs="",
- lo="",
- la="",
+ VS = "1.0",
+ cp = Convert.ToInt32(StaticStationInfo.TotalPower),
+ bs= StaticStationInfo.StationVersion,
+ lo= StaticStationInfo.Longitude,
+ la= StaticStationInfo.Latitude,
en=1,
- cn=1,
- eid=1,
- oid=1,
+ cn=7,
+ eid= Convert.ToInt32(StaticStationInfo.Ceid),
+ oid = Convert.ToInt32(StaticStationInfo.Oid),
};
- CloudClientMgr.CloudClient?.SendSignIn(req,
+ CloudClientMgr.CloudClient?.SendSignIn(signIn,
global::System.TimeSpan.FromSeconds(TimeSpan));
}
- public static void SendReportingDeviceList(DevList req)
+ ///
+ /// 换电站上报设备列表
+ ///
+ ///
+ public static void SendDevList(DevList req)
{
- DevList devList = new()
- {
-
- };
CloudClientMgr.CloudClient?.SendReportingDeviceList(req,
global::System.TimeSpan.FromSeconds(TimeSpan));
}
+ ///
+ /// 实时故障上报
+ ///
+ ///
+ public static void SendRealTimeFaultInfo(FaultReport req)
+ {
+ CloudClientMgr.CloudClient?.SendRealTimeFaultInfo(req,
+ global::System.TimeSpan.FromSeconds(TimeSpan));
+ }
+
+ ///
+ /// 换电站设备状态开始日志信息
+ ///
+ ///
+ public static void SendStartLogMessage(EqmStateStartLogInfo req)
+ {
+ CloudClientMgr.CloudClient?.SendStartLogMessage(req,
+ global::System.TimeSpan.FromSeconds(TimeSpan));
+ }
+ ///
+ /// 换电站设备状态结束日志信息
+ ///
+ ///
+ public static void SendEndLogMessage(EqmStateEndLogInfo req)
+ {
+ CloudClientMgr.CloudClient?.SendEndLogMessage(req,
+ global::System.TimeSpan.FromSeconds(TimeSpan));
+ }
+
+ public static void SendBatteryTotal(BatteryTotal req)
+ {
+ CloudClientMgr.CloudClient?.SendBatteryTotal(req,
+ global::System.TimeSpan.FromSeconds(TimeSpan));
+ }
+
+ public static void SendChargingTotalDis(ChargingTotalDis req)
+ {
+ CloudClientMgr.CloudClient?.SendChargingTotalDis(req,
+ global::System.TimeSpan.FromSeconds(TimeSpan));
+ }
}
\ No newline at end of file
diff --git a/Service/Init/StaticStationInfo.cs b/Service/Init/StaticStationInfo.cs
index 283cbf4..ed70d17 100644
--- a/Service/Init/StaticStationInfo.cs
+++ b/Service/Init/StaticStationInfo.cs
@@ -32,7 +32,12 @@ public class StaticStationInfo
get => Resolve(StationParamConst.OperationEndTime);
set => Set(StationParamConst.OperationEndTime, value);
}
-
+ public static string LaunchTime
+ {
+ get => Resolve(StationParamConst.LaunchTime);
+ set => Set(StationParamConst.LaunchTime, value);
+ }
+
public static int StationWay
{
get => int.Parse(Resolve(StationParamConst.StationWay));
@@ -64,7 +69,17 @@ public class StaticStationInfo
get => Resolve(StationParamConst.StationSn);
set => Set(StationParamConst.StationSn, value);
}
-
+ public static string StationLocation
+ {
+ get => Resolve(StationParamConst.StationLocation);
+ set => Set(StationParamConst.StationLocation, value);
+ }
+ public static string StationType
+ {
+ get => Resolve(StationParamConst.StationType);
+ set => Set(StationParamConst.StationType, value);
+ }
+
public static int SwapFinishChargeTime
{
get => int.Parse(Resolve(StationParamConst.SwapFinishChargeTime));
@@ -77,9 +92,9 @@ public class StaticStationInfo
set => Set(StationParamConst.SwapSoc, value);
}
- public static int StationSftVer
+ public static string StationSftVer
{
- get => int.Parse(Resolve(StationParamConst.StationSftVer));
+ get => Resolve(StationParamConst.StationSftVer);
set => Set(StationParamConst.StationSftVer, value);
}
public static string Faultlevel
@@ -93,6 +108,73 @@ public class StaticStationInfo
get => Resolve(StationParamConst.DistributionCapacity);
set => Set(StationParamConst.DistributionCapacity, value);
}
+ public static string TotalPower
+ {
+ get => Resolve(StationParamConst.TotalPower);
+ set => Set(StationParamConst.TotalPower, value);
+ }
+ public static string ModifyTime
+ {
+ get => Resolve(StationParamConst.ModifyTime);
+ set => Set(StationParamConst.ModifyTime, value);
+ }
+ public static string StationVersion
+ {
+ get => Resolve(StationParamConst.StationVersion);
+ set => Set(StationParamConst.StationVersion, value);
+ }
+ public static string Longitude
+ {
+ get => Resolve(StationParamConst.Longitude);
+ set => Set(StationParamConst.Longitude, value);
+ }
+ public static string Latitude
+ {
+ get => Resolve(StationParamConst.Latitude);
+ set => Set(StationParamConst.Latitude, value);
+ }
+ public static string AreaCode
+ {
+ get => Resolve(StationParamConst.AreaCode);
+ set => Set(StationParamConst.AreaCode, value);
+ }
+ public static string AreaName
+ {
+ get => Resolve(StationParamConst.AreaName);
+ set => Set(StationParamConst.AreaName, value);
+ }
+
+ public static string ContactWay
+ {
+ get => Resolve(StationParamConst.ContactWay);
+ set => Set(StationParamConst.ContactWay, value);
+ }
+ public static string Principal
+ {
+ get => Resolve(StationParamConst.Principal);
+ set => Set(StationParamConst.Principal, value);
+ }
+ public static string StationCompany
+ {
+ get => Resolve(StationParamConst.StationCompany);
+ set => Set(StationParamConst.StationCompany, value);
+ }
+ public static string SocialCreditCode
+ {
+ get => Resolve(StationParamConst.SocialCreditCode);
+ set => Set(StationParamConst.SocialCreditCode, value);
+ }
+ public static string SupplierCode
+ {
+ get => Resolve(StationParamConst.SupplierCode);
+ set => Set(StationParamConst.SupplierCode, value);
+ }
+ public static string Cover
+ {
+ get => Resolve(StationParamConst.Cover);
+ set => Set(StationParamConst.Cover, value);
+ }
+
#region Tbox
public static bool TboxStateConnect
diff --git a/WebStarter/db/xjl0725.sql b/WebStarter/db/xjl0725.sql
new file mode 100644
index 0000000..46cab2b
--- /dev/null
+++ b/WebStarter/db/xjl0725.sql
@@ -0,0 +1,5 @@
+ALTER TABLE equip_alarm_record
+ADD COLUMN upload_status INT DEFAULT 0 COMMENT '上报状态 0:未上传 1:已上传';
+
+ALTER TABLE equip_alarm_process_record
+ADD COLUMN upload_status INT DEFAULT 0 COMMENT '上报状态 0:未上传 1:已上传';
\ No newline at end of file