master
xjl 4 weeks ago
parent dac1d93438
commit b592cfa4df

@ -56,7 +56,7 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR
public string PubTopic { get; set; }
public static readonly string SubTopic1 = "truck_topic_command_sub_find";//就绪
public static readonly string SubTopic2 = "truck_topic_command_push_1";//启动换电
public static readonly string SubTopic2 = "truck_topic_command_push_2";//启动换电
public static readonly string SubTopic3 = "truck_topic_command_sub_find";//换电完成
public static readonly string SubTopic4 = "truck_topic_battery_status";//电池实时状态
public static readonly string SubTopic5 = "truck_topic_battery_charging";//充电机状态

@ -3,7 +3,10 @@ using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.Redis;
using log4net;
using Newtonsoft.Json;
using Repository.Station;
using Service.Cloud.Common;
using Service.Cloud.Msg.Host.Req;
using Service.Init;
namespace Service.Cloud.Client;
@ -24,9 +27,6 @@ public class CloudClientMgr
CloudClient.ClientId = StaticStationInfo.CloudClientId;
CloudClient.Username = StaticStationInfo.CloudUsername;
CloudClient.Password = StaticStationInfo.CloudPassword;
// CloudClient.ServerIp = "127.0.0.1";
// CloudClient.Username = "admin";
// CloudClient.Password = "123456";
CloudClient.SubTopic = StaticStationInfo.CloudSubTopic;
CloudClient.PubTopic = StaticStationInfo.CloudPubTopic;
CloudClient.StationNo = StaticStationInfo.StationNo;
@ -40,6 +40,81 @@ public class CloudClientMgr
RedisHelper? redisHelper = AppInfo.Container.Resolve<RedisHelper>();
BinInfoRepository binInfoRepository = AppInfo.Container.Resolve<BinInfoRepository>();
SwapOrderBatteryRepository swapOrderBatteryRepository = AppInfo.Container.Resolve<SwapOrderBatteryRepository>();
redisHelper?.GetSubscriber().Subscribe("BatteryStatus", (channel, value) =>
{
try
{
Log.Info($"receive BatteryStatus={value}");
if (value.HasValue)
{
BatteryStatus? data = JsonConvert.DeserializeObject<BatteryStatus>(value.ToString());
if (data != null)
{
//BinInfo? binInfo = binInfoRepository.QueryByClause(it => it.ChargerNo == data.sn);
var swapOrderBattery = swapOrderBatteryRepository.QueryListByClause(u => u.DownBatteryNo == data.sn || u.UpBatteryNo == data.sn);
BatteryStatus batteryStatus = new BatteryStatus()
{
sn = data.sn,
soc = data.soc,
soh = data.soh,
energy = data.energy,
temperature = data.temperature,
voltage_min = data.voltage_max,
voltage_max = data.voltage_max,
network_status = data.network_status,
alarmCode = data.alarmCode,
status = data.status,
isVehicle = "2",
longitude = StaticStationInfo.Longitude,
latitude = StaticStationInfo.Latitude,
battery_no = swapOrderBattery.Count.ToString(),
};
//if ((DateTime.Now - _dateTime).TotalSeconds <= 30)
//{
// return;
//}
//_dateTime = DateTime.Now;
string jsonString = JsonConvert.SerializeObject(batteryStatus, Formatting.Indented);
CloudClientMgr.Send(CloudConst.batteryInfo, jsonString);
}
}
}
catch (Exception e)
{
Log.Info("error", e);
}
});
redisHelper?.GetSubscriber().Subscribe("ChargeData", (channel, value) =>
{
try
{
Log.Info($"receive ChargeData={value}");
if (value.HasValue)
{
BatteryStatus? data = JsonConvert.DeserializeObject<BatteryStatus>(value.ToString());
if (data != null)
{
string jsonString = JsonConvert.SerializeObject(data, Formatting.Indented);
CloudClientMgr.Send(CloudConst.charging, jsonString);
}
}
}
catch (Exception e)
{
Log.Info("error", e);
}
});
}
/// <summary>

@ -20,29 +20,29 @@ public class CloudConst
/// <summary>
/// 换电完成指令主题
/// </summary>
public static readonly string CommandSubOver = "truck_topic_command_sub_over";
public static readonly string CommandSubOver = "truck_topic_command_sub_find_2";
/// <summary>
/// 电池实时状态主题
/// </summary>
public static readonly string batteryInfo = "truck_topic_battery_info";
public static readonly string batteryInfo = "truck_topic_battery_status_2";
/// <summary>
/// 充电协议主题 (暂时没有用到)
/// 充电协议主题
/// </summary>
public static readonly string charging = "truck_topic_charging";
public static readonly string charging = "truck_topic_battery_charging_2";
/// <summary>
/// 告警通信主题
/// </summary>
public static readonly string stationAlarm = "truck_topic_station_alarm";
public static readonly string stationAlarm = "truck_topic_station_alarm_2";
/// <summary>
/// 车辆数据同步主题
/// </summary>
public static readonly string carInfo = "truck_topic_car_info";
public static readonly string carInfo = "truck_topic_t-box_info_2";
/// <summary>
/// 换电机器人状态主题
/// </summary>
public static readonly string robotInfo = "truck_topic_robot_info";
public static readonly string robotInfo = "truck_topic_robot_info_2";
#endregion
}

@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HybirdFrameworkCore.Autofac.Attribute;
using log4net;
using Newtonsoft.Json;
using Service.Cloud.Client;
using Service.Cloud.Msg.Cloud.Req;
@ -15,6 +16,7 @@ namespace Service.Cloud.Handler
[Scope("InstancePerDependency")]
public class SwapStartHandler : IBaseHandler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(SwapStartHandler));
public bool CanHandle(string cmd)
{
return CloudClient.SubTopic2 == cmd;
@ -24,6 +26,8 @@ namespace Service.Cloud.Handler
{
SwapStart? resp = JsonConvert.DeserializeObject<SwapStart>(t);
StationSoftMgr.SwappingStateMachine.swapStart = resp;
Log.Info($"cloud receive {t}");
// CloudClientMgr.CloudClient.CarAuth.SetResp(resp);
//if (resp.command == "start")
//{

@ -49,7 +49,13 @@ namespace Service.Cloud.Msg.Host.Req
/// 电池状态1车载2站内
/// </summary>
public string isVehicle { get; set; }
/// <summary>
/// 经度
/// </summary>
public string longitude { get; set; }
/// <summary>
/// 纬度
/// </summary>
public string latitude { get; set; }
/// <summary>
/// 累计换电次数
@ -57,9 +63,9 @@ namespace Service.Cloud.Msg.Host.Req
public string battery_no { get; set; }
/// <summary>
/// 车牌
/// </summary>
public string carNumber { get; set; }
///// <summary>
///// 车牌
///// </summary>
//public string carNumber { get; set; }
}
}

@ -15,6 +15,9 @@ public class ReadyTopic
/// </summary>
public string carNumber { get; set; }
/// <summary>
/// 换电就绪状态 1 就绪2 未就绪 3 告警(带告警码)
/// </summary>
public string status { get; set; } = "1";
/// <summary>
/// 报警编码

@ -9,7 +9,7 @@ namespace Service.Cloud.Msg.Host.Req
/// <summary>
/// 机器人状态
/// </summary>
public class Robot_info
public class RobotInfo
{
public string stationSn { get; set; }
public string type { get; set; }

@ -5,31 +5,35 @@
/// </summary>
public class SwapFinish
{
public string stationSn { get; set; }
public string type { get; set; } = "2";
public string? stationSn { get; set; }
public string? type { get; set; } = "2";
/// <summary>
/// 车牌
/// </summary>
public string carNumber { get; set; }
public string? carNumber { get; set; }
public string status { get; set; } = "2";
/// <summary>
/// 报警编码
/// </summary>
public string alarmCode { get; set; }
public string? alarmCode { get; set; }
/// <summary>
/// 设备编号
/// 换电前电池编码
/// </summary>
public string sn { get; set; }
public string orderID { get; set; }
public string? sn { get; set; }
/// <summary>
/// 换电后电池编码
/// </summary>
public string? after_sn { get; set; }
public string? orderID { get; set; }
public string stationStatus { get; set; }
public string? stationStatus { get; set; }
/// <summary>
/// 换电前电量
/// </summary>
public string before_soc { get; set; }
public string? before_soc { get; set; }
/// <summary>
/// 换电后电量
/// </summary>
public string after_soc { get; set; }
public string? after_soc { get; set; }
}

@ -16,10 +16,7 @@ namespace Service.Cloud.Msg.Host.Req
/// type=1 业务类型是充电type=2 业务类型是换电type=3 业务类型是远程操作type=4 业务类型是告警type=5 业务类型是车辆数据
/// </summary>
public string type { get; set; }
///// <summary>
///// mileage:累计里程单位km
///// </summary>
//public string mileage { get; set; }
/// <summary>
/// 车牌
/// </summary>

@ -24,6 +24,7 @@ public abstract class CloudApi
/// <returns></returns>
public static bool UploadCloudReady(string carNumber)
{
if (carNumber == null) { carNumber = ""; }
ReadyTopic readyTopic = new ReadyTopic()
{
stationSn = StaticStationInfo.StationSn,
@ -54,7 +55,7 @@ public abstract class CloudApi
};
string jsonString = JsonSerializer.Serialize(swapFinish);
return CloudClientMgr.Send("truck_topic_command_sub_find", jsonString);
return CloudClientMgr.Send(CloudConst.CommandSubOver, jsonString);
}

@ -0,0 +1,23 @@

namespace Service.Execute.Model;
public class HeartExpandBeatMsg
{
/// <summary>
/// 锁止IO状态1
/// </summary>
public byte LockIOStatus01 { get; set; }
/// <summary>
/// 锁止IO状态2
/// </summary>
public byte LockIOStatus02 { get; set; }
/// <summary>
/// 充电连接器状态1 0 断开1 连接
/// </summary>
public byte ChargingConnectorStatus01 { get; set; }
/// <summary>
/// 充电连接器状态1 0 断开1 连接
/// </summary>
public byte ChargingConnectorStatus02 { get; set; }
}

@ -33,4 +33,10 @@ public class TboxCarInfoModel
/// 车辆心跳数据
/// </summary>
public HeartBeatMsg? HeartBeatMsg { get; set; }
/// <summary>
/// 状态拓展数据
/// </summary>
public HeartExpandBeatMsg? HeartExpandBeatMsg { get; set; }
}

@ -69,7 +69,16 @@ public class StaticStationInfo
get => Resolve(StationParamConst.StationSn);
set => Set(StationParamConst.StationSn, 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 int SwapFinishChargeTime
{
get => int.Parse(Resolve(StationParamConst.SwapFinishChargeTime));

@ -35,38 +35,37 @@ public class FanChangeTask : ITask
}
/// 1000打开右侧关闭左侧
/// 1001打开左侧关闭右侧
/// 1002全部打开
/// 1003全部关闭
/// 1000全部打开
/// 1010全部关闭
public void Handle()
{
try
{
int countL = _binInfoRepository.GetCount(i =>
i.ChargeStatus == 1 && Convert.ToInt32(i.No) >= 1 && Convert.ToInt32(i.No) <= 8);
int countR = _binInfoRepository.GetCount(i =>
i.ChargeStatus == 1 && Convert.ToInt32(i.No) >= 11 && Convert.ToInt32(i.No) <= 18);
//int countR = _binInfoRepository.GetCount(i =>
// i.ChargeStatus == 1 && Convert.ToInt32(i.No) >= 11 && Convert.ToInt32(i.No) <= 18);
if (countL > 0 && countR <= 0)
if (countL > 0)
{
if (PlcMgr.ExhaustFanStatusRadar() != 1000)
PlcMgr.AirBlowerControl(1000);
}
else if (countL <= 0 && countR > 0)
{
if (PlcMgr.ExhaustFanStatusRadar() != 1001)
PlcMgr.AirBlowerControl(1001);
}
else if (countL > 0 && countR > 0)
{
if (PlcMgr.ExhaustFanStatusRadar() != 1002)
PlcMgr.AirBlowerControl(1002);
}
//else if (countL <= 0 && countR > 0)
//{
// if (PlcMgr.ExhaustFanStatusRadar() != 1001)
// PlcMgr.AirBlowerControl(1001);
//}
//else if (countL > 0 && countR > 0)
//{
// if (PlcMgr.ExhaustFanStatusRadar() != 1002)
// PlcMgr.AirBlowerControl(1002);
//}
else
{
if (PlcMgr.ExhaustFanStatusRadar() != 1003)
PlcMgr.AirBlowerControl(1003);
if (PlcMgr.ExhaustFanStatusRadar() != 1010)
PlcMgr.AirBlowerControl(1010);
}
}
catch (Exception e)

@ -58,19 +58,7 @@ public class PlcHeartTask : ITask
(ushort)(lstBinInfo[6].ChargeStatus == 1 ? 1010 : 1000),
(ushort)(lstBinInfo[7].ChargeStatus == 1 ? 1010 : 1000),
};
ushort[] lstUsort2 = new[]
{
(ushort)(lstBinInfo[10].ChargeStatus == 1 ? 1010 : 1000),
(ushort)(lstBinInfo[11].ChargeStatus == 1 ? 1010 : 1000),
(ushort)(lstBinInfo[12].ChargeStatus == 1 ? 1010 : 1000),
(ushort)(lstBinInfo[13].ChargeStatus == 1 ? 1010 : 1000),
(ushort)(lstBinInfo[14].ChargeStatus == 1 ? 1010 : 1000),
(ushort)(lstBinInfo[15].ChargeStatus == 1 ? 1010 : 1000),
(ushort)(lstBinInfo[16].ChargeStatus == 1 ? 1010 : 1000),
(ushort)(lstBinInfo[17].ChargeStatus == 1 ? 1010 : 1000),
};
PlcMgr.PlcClient.Write("x=3;21",lstUsort1);
PlcMgr.PlcClient.Write("x=3;41",lstUsort2);
{
//这里根据换电任务状态写车辆停车状态

@ -45,7 +45,7 @@ public class PlcClient : ModbusTcpMaster
public PlcClient()
{
ReadAction = BatchRead;
Ip = "172.0.20.40";
Ip = "172.0.20.48";
Port = 502;
Duration = 1000;
AutoReConnect = true;
@ -76,26 +76,17 @@ public class PlcClient : ModbusTcpMaster
ModbusDecoder.Decode<PlcToHost>(bytes02, PlcMgr.PlcToHostData, EndingConst.ByteSeq.AB,
EndingConst.WordSeq.DC);
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec01.Value, "1");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec02.Value, "2");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec03.Value, "3");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec04.Value, "4");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec05.Value, "5");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec06.Value, "6");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec07.Value, "7");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec08.Value, "8");
UpdateBinInfoCache(PlcMgr.PlcToHostData.MaterialDetec09.Value, "9");
UpdateBinInfoCache(PlcMgr.PlcToHostData.MaterialDetec10.Value, "10");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec21.Value, "11");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec22.Value, "12");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec23.Value, "13");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec24.Value, "14");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec25.Value, "15");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec26.Value, "16");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec27.Value, "17");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec28.Value, "18");
UpdateBinInfoCache(PlcMgr.PlcToHostData.MaterialDetec29.Value, "19");
UpdateBinInfoCache(PlcMgr.PlcToHostData.MaterialDetec30.Value, "20");
UpdateBinInfoCache(PlcMgr.PlcToHostData.MaterialDetec21.Value, "1");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec22.Value, "2");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec23.Value, "3");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec24.Value, "4");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec25.Value, "5");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec26.Value, "6");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec27.Value, "7");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec28.Value, "8");
}
var bytes03 = master.BatchReadHolderRegister(701, 32);

@ -47,14 +47,14 @@ public class PlcMgr
/// <returns></returns>
public static bool WriteEntranceLamp(ushort value)
{
/*if (PlcClient != null)
if (PlcClient != null)
{
HostToPlcData.LightIn.Value = value;
return PlcClient.WriteValue(HostToPlcData.LightIn);
}
return false;*/
return true;
return false;
}
@ -149,15 +149,14 @@ public class PlcMgr
/// <returns></returns>
public static bool WriteExistLamp(int data)
{
/*if (PlcClient != null)
if (PlcClient != null)
{
HostToPlc writeHostToPlc = new HostToPlc();
writeHostToPlc.LightOut.Value = (ushort)data;
return PlcClient.WriteValue(writeHostToPlc.LightOut);
}
return false;*/
return true;
return false;
}
/// <summary>

@ -355,7 +355,7 @@ namespace Service.Plc.Msg
/// </summary>
public ModbusProperty<ushort> VehicleParkingStatus { get; set; } = new(40102);
/// <summary>
/// 三色灯控制整站状态(入口)
/// 三色灯控制整站状态(入口) (删除)
/// <para>0无效值</para>
/// <para>1000绿灯</para>
/// <para>1010绿灯闪烁</para>
@ -367,7 +367,7 @@ namespace Service.Plc.Msg
/// </summary>
public ModbusProperty<ushort> LightIn2 { get; set; } = new(40103);
/// <summary>
/// 三色灯控制整站状态(出口)
/// 三色灯控制整站状态(出口)(删除)
/// <para>0无效值</para>
/// <para>1000绿灯</para>
/// <para>1010绿灯闪烁</para>

@ -95,7 +95,7 @@ namespace Service.Plc.Msg
#endregion 舱位状态
#region 仓电池在位状态 舱位状态 bit0:有料检测 Bit1有料检测开关故障
#region 仓电池在位状态 舱位状态 bit0:有料检测 Bit1有料检测开关故障
public ModbusProperty<byte> MaterialDetec21 { get; set; } = new(40261);
@ -264,7 +264,7 @@ namespace Service.Plc.Msg
/// </summary>
public ModbusProperty<ushort> TaskType { get; set; } = new(40407);
/// <summary>
/// 堆垛机任务状态
/// 行车任务状态
/// <para>0无效值</para>
/// <para>1000准备中Not Ready</para>
/// <para>1001待机中Ready</para>

@ -70,6 +70,8 @@ namespace WebStarter.Controllers.BasicConfig
{
StaticStationInfo.SwapSoc = input.SwapSoc;
StaticStationInfo.StationStatus = input.StationStatus;
StaticStationInfo.StationWay = input.StationWay;
StaticStationInfo.SwapFinishChargeTime = input.SwapFinishChargeTime;
StaticStationInfo.AutoChargeEnabled = input.AutoChargeEnabled;

@ -171,11 +171,12 @@ public class SwapMonitorController : ControllerBase
/// 1040黄灯
/// 1050黄灯闪烁
/// 1100所有灯亮
/// 1200所有灯灭
/// </summary>
/// <param name="lampCmd"></param>
/// <returns></returns>
[HttpPost("OperateOutstationLamp")]
public async Task<Result<bool>> OperateOutstationLamp(byte lampCmd)
public async Task<Result<bool>> OperateOutstationLamp(UInt16 lampCmd)
{
return PlcMgr.WriteEntranceLamp(lampCmd) ? Result<bool>.Success(true) : Result<bool>.Fail();
}

@ -4,6 +4,11 @@ using HybirdFrameworkCore.AutoTask;
using Microsoft.AspNetCore.Mvc;
using Service.Cloud.Client;
using Service.Cloud.Msg.Host.Req;
using Newtonsoft.Json;
using Service.Init;
using Service.Cloud.Common;
using Org.BouncyCastle.Asn1.X509;
using Org.BouncyCastle.Crypto.Tls;
namespace WebStarter.Controllers.System;
@ -35,7 +40,7 @@ public class TestController1
[HttpGet("/Cloud/UploadCloudReady")]
public Result<bool> UploadCloudReady(ReadyTopic readyTopic)
{
string jsonString = JsonSerializer.Serialize(readyTopic);
string jsonString = JsonConvert.SerializeObject(readyTopic, Formatting.Indented);
CloudClientMgr.Send("truck_topic_command_sub_find", jsonString);
return Result<bool>.Success();
}
@ -45,10 +50,115 @@ public class TestController1
/// </summary>
/// <returns></returns>
[HttpGet("/Cloud/UploadCloudSwapFinish")]
public Result<bool> UploadCloudSwapFinish(SwapFinish swapFinish)
public Result<bool> UploadCloudSwapFinish()
{
string jsonString = JsonSerializer.Serialize(swapFinish);
CloudClientMgr.Send("truck_topic_command_sub_find", jsonString);
SwapFinish swapFinish = new SwapFinish()
{
stationSn = StaticStationInfo.StationSn,
type = "2",
carNumber = "沪AD84996",
status = "2",
alarmCode = "",
sn = "",
after_sn = "",
orderID = "123132123123",
stationStatus = "1",
before_soc = "45",
after_soc = "96",
};
string jsonString = JsonConvert.SerializeObject(swapFinish, Formatting.Indented);
CloudClientMgr.Send("truck_topic_command_sub_find_2", jsonString);
return Result<bool>.Success();
}
/// <summary>
/// 上传云端机器人状态
/// </summary>
/// <returns></returns>
[HttpGet("/Cloud/UploadCloudRobotInfo")]
public Result<bool> UploadCloudRobotInfo()
{
RobotInfo swapFinish = new RobotInfo()
{
stationSn = StaticStationInfo.StationSn,
type = "2",
sn="001",
status ="1",
network_status = "1",
startTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
alarm_code = "",
soc = "100",
spare = "",
};
string jsonString = JsonConvert.SerializeObject(swapFinish, Formatting.Indented);
CloudClientMgr.Send(CloudConst.robotInfo, jsonString);
return Result<bool>.Success();
}
/// <summary>
/// 上传云端告警信息
/// </summary>
/// <returns></returns>
[HttpGet("/Cloud/UploadCloudAlarm")]
public Result<bool> UploadCloudAlarm()
{
Alarm swapFinish = new Alarm()
{
stationSn = StaticStationInfo.StationSn,
type = "4",
carNumber = "",
status = "1",
alarmCode="18",
title= "充电机告警",
sn = "C2001",
alarmLevel="3",
alarmSuggestions="",
startTime=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
endTime="",
deviceType="4",
content= "BMS通信故障",
deviceName="充电机01",
stationName= "城南换电站",
};
string jsonString = JsonConvert.SerializeObject(swapFinish, Formatting.Indented);
CloudClientMgr.Send(CloudConst.stationAlarm, jsonString);
return Result<bool>.Success();
}
/// <summary>
/// 上传云端告警信息
/// </summary>
/// <returns></returns>
[HttpGet("/Cloud/UploadCloudBatteryStatus")]
public Result<bool> UploadCloudBatteryStatus()
{
BatteryStatus batteryStatus = new BatteryStatus()
{
sn = "001",
soc = "23",
soh="",
energy = "56",
temperature = "23",
voltage_min = "20",
voltage_max = "220",
network_status = "1",
alarmCode = "",
status = "1",
isVehicle = "2",
longitude = "121.231321",
latitude = "29.2334",
battery_no = "1242203B1964",
};
string jsonString = JsonConvert.SerializeObject(batteryStatus, Formatting.Indented);
CloudClientMgr.Send(CloudConst.stationAlarm, jsonString);
return Result<bool>.Success();
}
}

@ -12,6 +12,7 @@ using log4net;
using Mapster;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens;
using Service.Cloud.Client;
using Service.Execute;
using Service.FireControl.Client;
using Service.Plc.Client;
@ -157,11 +158,11 @@ foreach (var s in list.Split(";"))
AppInfo.Container = app.Services.GetAutofacRoot();
////云平台
//if (AppSettingsHelper.GetBool("cloud", "enable"))
//{
// CloudClientMgr.Init();
//}
//云平台
if (AppSettingsHelper.GetBool("cloud", "enable"))
{
//CloudClientMgr.Init();
}
//PLC
if (AppSettingsHelper.GetBool("plc", "enable"))
@ -172,14 +173,14 @@ if (AppSettingsHelper.GetBool("plc", "enable"))
//启动换电流程
if (AppSettingsHelper.GetBool("swap", "enable"))
{
StationSoftMgr.SwappingStateMachineStart();
//StationSoftMgr.SwappingStateMachineStart();
}
//消防
if (AppSettingsHelper.GetBool("fire", "enable"))
{
FireControlMgr.Init();
// FireControlMgr.Init();
}
TaskInit.Init();

@ -2,7 +2,7 @@
"ConnectionStrings": {
"ConfigId": "master",
"DbType": "MySql",
"SqlConnection": "server=127.0.0.1;Port=3306;Database=nhet_dev;Uid=root;Pwd=123456;Charset=utf8;"
"SqlConnection": "server=127.0.0.1;Port=3306;Database=nhet_cn_dev;Uid=root;Pwd=123456;Charset=utf8;"
},
"Update": {
"AutoUpdate": "false",
@ -80,7 +80,7 @@
"enable": false
},
"plc": {
"enable": false
"enable": true
},
"swap": {
"enable": false

@ -2,7 +2,7 @@
"ConnectionStrings": {
"ConfigId": "master",
"DbType": "MySql",
"SqlConnection": "server=127.0.0.1;Port=3306;Database=nhet_dev;Uid=root;Pwd=anyixing2023!@#;Charset=utf8;"
"SqlConnection": "server=127.0.0.1;Port=3306;Database=nhet_cn_dev;Uid=root;Pwd=123456;Charset=utf8;"
},
"Update": {
"AutoUpdate": "false",
@ -10,7 +10,7 @@
"Url": "http://121.4.95.243:8090/Updates/AutoUpdaterStarter.xml"
},
"Redis": {
"Connection": "127.0.0.1:6379,password=123456",
"Connection": "127.0.0.1:6379,password=lbblscy9",
"InstanceName": "local",
"DefaultDB": "8"
},

@ -7,6 +7,7 @@ namespace WinFormStarter
public FrmPlc()
{
InitializeComponent();
}
ModbusTcpNet ModbusTcpNet;

@ -1,4 +1,64 @@
<root>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">

@ -16,9 +16,10 @@
}
],
"additionalProbingPaths": [
"C:\\Users\\CZ\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\CZ\\.nuget\\packages",
"D:\\vs2019\\共享组件\\NuGetPackages"
"C:\\Users\\dell\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\dell\\.nuget\\packages",
"D:\\vs 2019\\Shared\\NuGetPackages",
"C:\\Program Files (x86)\\Microsoft\\Xamarin\\NuGet"
],
"configProperties": {
"Microsoft.NETCore.DotNetHostPolicy.SetAppPaths": true

Loading…
Cancel
Save