充电测测试

zw
lxw 6 months ago
parent 2346edcd4c
commit 2a0d2b0917

@ -67,15 +67,15 @@ namespace Service.Charger.Handler
client.ChargeOrderNo = msg.ChargerOrderNo; client.ChargeOrderNo = msg.ChargerOrderNo;
int count = _chargeOrderRepository.GetCount(it => it.Sn == client.ChargeOrderNo); ChargeOrder db = _chargeOrderRepository.QueryByClause(it => it.Sn == msg.ChargerOrderNo);
if (count < 1) if (db == null)
{ {
ChargeOrder chargeOrder = new ChargeOrder() ChargeOrder chargeOrder = new ChargeOrder()
{ {
Sn = client.ChargeOrderNo, Sn = client.ChargeOrderNo,
BatteryNo = client.BatteryNo, BatteryNo = client.BatteryNo,
StartTime = new DateTime((msg.StartYear+1900) , msg.StartMonth ,msg.StartDay ,msg.StartHour, msg.StartMinute, msg.StartSecond), StartTime = new DateTime((msg.StartYear+2000) , msg.StartMonth ,msg.StartDay ,msg.StartHour, msg.StartMinute, msg.StartSecond),
EndTime = new DateTime(msg.EndYear + 1900, msg.EndMonth, msg.EndDay, msg.EndHour, msg.EndMinute, msg.EndSecond), EndTime = new DateTime(msg.EndYear + 2000, msg.EndMonth, msg.EndDay, msg.EndHour, msg.EndMinute, msg.EndSecond),
StartSoc = msg.SocBefore, StartSoc = msg.SocBefore,
StopSoc = msg.SocAfter, StopSoc = msg.SocAfter,
ChargeTimeCount= msg.ChargingTimeCount, ChargeTimeCount= msg.ChargingTimeCount,
@ -99,6 +99,31 @@ namespace Service.Charger.Handler
_chargeOrderRepository.Insert(chargeOrder); _chargeOrderRepository.Insert(chargeOrder);
} }
else
{
db.StartTime = new DateTime((msg.StartYear+2000) , msg.StartMonth ,msg.StartDay ,msg.StartHour, msg.StartMinute, msg.StartSecond);
db.EndTime = new DateTime(msg.EndYear + 2000, msg.EndMonth, msg.EndDay, msg.EndHour, msg.EndMinute, msg.EndSecond);
db.StartSoc = msg.SocBefore;
db.StopSoc = msg.SocAfter;
db.ChargeTimeCount= msg.ChargingTimeCount;
db.ElecCount = Convert.ToDecimal(msg.ChargingPower);
db.AcElecCount = Convert.ToDecimal(msg.AcMeterElecCount);
db.StartAcElec = Convert.ToDecimal(msg.AcMeterDataBefore);
db.StopAcElec = Convert.ToDecimal(msg.AcMeterDataAfter);
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.AcSharpElecCount = Convert.ToDecimal(acPowersPeriods[0]);
db.AcPeakElecCount = Convert.ToDecimal(acPowersPeriods[0]);
db.AcFlatElecCount = Convert.ToDecimal(acPowersPeriods[0]);
db.AcValleyElecCount = Convert.ToDecimal(acPowersPeriods[0]);
db.ChargeMode = msg.ChargeMode;
db.StartMode = msg.StartMode;
_chargeOrderRepository.Update(db);
}
ctx.Channel.WriteAndFlushAsync(new RecordChargeRespData()); ctx.Channel.WriteAndFlushAsync(new RecordChargeRespData());
} }

@ -15,7 +15,7 @@ builder.Host.ConfigureContainer<ContainerBuilder>(cb =>
{ {
cb.Register(c => cb.Register(c =>
{ {
var db = new SqlSugarClient(new ConnectionConfig var db = new SqlSugarScope(new ConnectionConfig
{ {
ConfigId = AppSettingsConstVars.ConfigId, ConfigId = AppSettingsConstVars.ConfigId,
ConnectionString = AppSettingsConstVars.DbSqlConnection, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD> ConnectionString = AppSettingsConstVars.DbSqlConnection, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>

Loading…
Cancel
Save