部分判断提交

zw
CZ 5 months ago
parent bb83d2086d
commit a949cdb432

@ -290,5 +290,12 @@ namespace Entity.DbModel.Station
/// </summary>
[SugarColumn(ColumnName = "start_type")]
public int StartType { get; set; }
/// <summary>
/// 上报次数
/// </summary>
[SugarColumn(ColumnName = "reporting_times")]
public int ReportingTimes { get; set; }
}
}

@ -50,7 +50,8 @@ namespace Service.Charger.Handler
if (ObjUtils.IsNotEmpty(orders))
{
List<int> list = orders.Select(it => it.Id).ToList();
ChargeOrderRepository.Update(it => it.CanUpload == 1, it => list.Contains(it.Id));
ChargeOrderRepository.Update(it => it.CanUpload == 1 && it.ReportingTimes==0,
it => list.Contains(it.Id));
}
}
}

@ -37,7 +37,10 @@ namespace Service.Charger.Handler
sb.Append(Convert.ToChar(msg.BatterSnBytes[i]));
}
client.BatteryNo = sb.ToString();
if (!sb.ToString().Contains("ÿ"))
{
client.BatteryNo = sb.ToString();
}
client.BatteryFactory = msg.BatterFactory;
if (_binInfoRepository.Update(t => t.BatteryNo == client.BatteryNo, t => t.No == client.BinNo) > 0)

@ -1,8 +1,10 @@
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;
@ -10,9 +12,10 @@ 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<RedisHelper>();
private BinInfoRepository BinInfoRepository = AppInfo.Container.Resolve<BinInfoRepository>();
@ -25,16 +28,17 @@ public class BatteryInfoUploadTask : ITask
public int Interval()
{
return 1000 * 30;
return 1000 * 1;
}
public void Handle()
{
Log.Info("begin start BatteryInfoUploadTask uoload");
DateTime now = DateTime.Now;
List<BinInfo> binInfos = BinInfoRepository.Query();
List<SingleBatInfo> 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()
{
@ -61,8 +65,15 @@ public class BatteryInfoUploadTask : ITask
datainfo = batInfos
};
RedisHelper.PublishAsync("BatteryInfoUploadTask", JsonConvert.SerializeObject(batDataInfo));
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()

@ -50,4 +50,8 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Remove="Charger\MyTask\UpBatDataInfoTask.cs" />
</ItemGroup>
</Project>

Loading…
Cancel
Save