|
@@ -76,6 +76,31 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
await db.SaveChangesAsync();
|
|
|
}
|
|
|
|
|
|
+ }
|
|
|
+ result.Message = confirm;
|
|
|
+ result.Success = true;
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ case Actions.SignedFirmwareStatusNotification:
|
|
|
+ {
|
|
|
+ SignedFirmwareStatusNotificationRequest _request = request as SignedFirmwareStatusNotificationRequest;
|
|
|
+ SignedFirmwareStatusNotificationConfirmation confirm = new();
|
|
|
+
|
|
|
+ if (_request.status != Packet.Messages.SubTypes.FirmwareStatusEnumType.Idle)
|
|
|
+ {
|
|
|
+ using (var db = await maindbContextFactory.CreateDbContextAsync())
|
|
|
+ {
|
|
|
+ var item = await db.MachineOperateRecord.Where(x => x.ChargeBoxId == session.ChargeBoxId && x.Action == "SignedUpdateFirmware" && x.RequestType == 1)
|
|
|
+ .OrderByDescending(x => x.CreatedOn).FirstOrDefaultAsync();
|
|
|
+ if (item != null)
|
|
|
+ {
|
|
|
+ item.EVSE_Status = (int)_request.status;
|
|
|
+ item.FinishedOn = DateTime.UtcNow;
|
|
|
+ }
|
|
|
+
|
|
|
+ await db.SaveChangesAsync();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
result.Message = confirm;
|
|
|
result.Success = true;
|
|
@@ -235,6 +260,24 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
+ case Actions.SignedUpdateFirmware:
|
|
|
+ {
|
|
|
+ SignedUpdateFirmwareConfirmation _confirm = confirm as SignedUpdateFirmwareConfirmation;
|
|
|
+ using (var db = await maindbContextFactory.CreateDbContextAsync())
|
|
|
+ {
|
|
|
+ var operation = await db.MachineOperateRecord.Where(x => x.SerialNo == requestId &&
|
|
|
+ x.ChargeBoxId == session.ChargeBoxId && x.Status == 0).FirstOrDefaultAsync();
|
|
|
+ if (operation != null)
|
|
|
+ {
|
|
|
+ operation.FinishedOn = DateTime.UtcNow;
|
|
|
+ operation.Status = 1;
|
|
|
+ operation.EVSE_Status = (int)_confirm.status;
|
|
|
+ operation.EVSE_Value = _confirm.status.ToString();
|
|
|
+ await db.SaveChangesAsync();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
default:
|
|
|
{
|
|
|
logger.LogWarning(string.Format("Not Implement {0} Logic", confirm.GetType().ToString().Replace("OCPPPackage.Messages.RemoteTrigger.", "")));
|