Compare commits
No commits in common. "7a5c5845bf050ce162676c50bf9b111840630838" and "78ae53f7633efb55ce0a606f7187af32b0865609" have entirely different histories.
7a5c5845bf
...
78ae53f763
|
@ -195,8 +195,6 @@ public static class Controller
|
||||||
var mustDoCalibrationCharge = calibrationChargeForced == CalibrationChargeType.ChargePermanently ||
|
var mustDoCalibrationCharge = calibrationChargeForced == CalibrationChargeType.ChargePermanently ||
|
||||||
(calibrationChargeForced == CalibrationChargeType.AdditionallyOnce && additionalCalibrationRequired) ||
|
(calibrationChargeForced == CalibrationChargeType.AdditionallyOnce && additionalCalibrationRequired) ||
|
||||||
(calibrationChargeForced == CalibrationChargeType.RepetitivelyEvery && repetitiveCalibrationRequired);
|
(calibrationChargeForced == CalibrationChargeType.RepetitivelyEvery && repetitiveCalibrationRequired);
|
||||||
Console.WriteLine("Next Repetitive calibration charge date is "+statusRecord.Config.DayAndTimeForRepetitiveCalibration);
|
|
||||||
Console.WriteLine("Next Additional calibration charge date is "+statusRecord.Config.DayAndTimeForAdditionalCalibration);
|
|
||||||
|
|
||||||
if (statusRecord.Battery is not null)
|
if (statusRecord.Battery is not null)
|
||||||
{
|
{
|
||||||
|
@ -206,7 +204,7 @@ public static class Controller
|
||||||
_hasAdditionalCalibrationChargeChecked = false;
|
_hasAdditionalCalibrationChargeChecked = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (calibrationChargeForced == CalibrationChargeType.RepetitivelyEvery && statusRecord.Battery.Eoc )
|
else if (calibrationChargeForced == CalibrationChargeType.RepetitivelyEvery && statusRecord.Battery.Eoc)
|
||||||
{
|
{
|
||||||
statusRecord.Config.DayAndTimeForRepetitiveCalibration = statusRecord.Config.DayAndTimeForRepetitiveCalibration.AddDays(7);
|
statusRecord.Config.DayAndTimeForRepetitiveCalibration = statusRecord.Config.DayAndTimeForRepetitiveCalibration.AddDays(7);
|
||||||
_hasRepetitiveCalibrationChargeChecked = false;
|
_hasRepetitiveCalibrationChargeChecked = false;
|
||||||
|
|
|
@ -18,6 +18,7 @@ import {
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import Button from '@mui/material/Button';
|
import Button from '@mui/material/Button';
|
||||||
|
import axiosConfig from '../../../Resources/axiosConfig';
|
||||||
import { Close as CloseIcon } from '@mui/icons-material';
|
import { Close as CloseIcon } from '@mui/icons-material';
|
||||||
import MenuItem from '@mui/material/MenuItem';
|
import MenuItem from '@mui/material/MenuItem';
|
||||||
import {
|
import {
|
||||||
|
@ -27,8 +28,6 @@ import {
|
||||||
} from '@mui/x-date-pickers';
|
} from '@mui/x-date-pickers';
|
||||||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import axiosConfig from '../../../Resources/axiosConfig';
|
|
||||||
import utc from 'dayjs/plugin/utc';
|
|
||||||
|
|
||||||
interface ConfigurationProps {
|
interface ConfigurationProps {
|
||||||
values: TopologyValues;
|
values: TopologyValues;
|
||||||
|
@ -62,9 +61,6 @@ function Configuration(props: ConfigurationProps) {
|
||||||
'Saturday'
|
'Saturday'
|
||||||
];
|
];
|
||||||
|
|
||||||
dayjs.extend(utc);
|
|
||||||
const localOffset = dayjs().utcOffset();
|
|
||||||
|
|
||||||
const [errors, setErrors] = useState({
|
const [errors, setErrors] = useState({
|
||||||
minimumSoC: false,
|
minimumSoC: false,
|
||||||
gridSetPoint: false
|
gridSetPoint: false
|
||||||
|
@ -93,43 +89,35 @@ function Configuration(props: ConfigurationProps) {
|
||||||
CalibrationChargeOptionsController.indexOf(
|
CalibrationChargeOptionsController.indexOf(
|
||||||
props.values.calibrationChargeState[0].value.toString()
|
props.values.calibrationChargeState[0].value.toString()
|
||||||
) == 0
|
) == 0
|
||||||
? dayjs
|
? dayjs(props.values.repetitiveCalibrationChargeDate[0].value).toDate()
|
||||||
.utc(props.values.repetitiveCalibrationChargeDate[0].value)
|
: dayjs(props.values.additionalCalibrationChargeDate[0].value).toDate()
|
||||||
.add(localOffset, 'minute')
|
|
||||||
.toDate()
|
|
||||||
: dayjs
|
|
||||||
.utc(props.values.additionalCalibrationChargeDate[0].value)
|
|
||||||
.add(localOffset, 'minute')
|
|
||||||
.toDate()
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleSubmit = async (e) => {
|
const handleSubmit = async (e) => {
|
||||||
if (
|
if (
|
||||||
CalibrationChargeOptionsController.indexOf(
|
props.values.mode[0].value === 'CalibrationCharge' &&
|
||||||
props.values.calibrationChargeState[0].value.toString()
|
formValues.CalibrationChargeState == 0
|
||||||
) != 2 &&
|
|
||||||
props.values.mode[0].value === 'CalibrationCharge'
|
|
||||||
) {
|
) {
|
||||||
setDateSelectionError(
|
setDateSelectionError(
|
||||||
'You cannot change the date while the installation is in Calibration Charge Mode'
|
'You cannot change the date while the installation is in Calibration Charge Mode'
|
||||||
);
|
);
|
||||||
setErrorDateModalOpen(true);
|
setErrorDateModalOpen(true);
|
||||||
return;
|
return;
|
||||||
} else if (
|
} else if (dayjs(formValues.calibrationChargeDate).isBefore(dayjs())) {
|
||||||
formValues.CalibrationChargeState != 2 &&
|
console.log(dayjs());
|
||||||
dayjs(formValues.calibrationChargeDate).isBefore(dayjs())
|
console.log('asked for', dayjs(formValues.calibrationChargeDate));
|
||||||
) {
|
|
||||||
//console.log('asked for', dayjs(formValues.calibrationChargeDate));
|
|
||||||
setDateSelectionError('You must specify a future date');
|
setDateSelectionError('You must specify a future date');
|
||||||
setErrorDateModalOpen(true);
|
setErrorDateModalOpen(true);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
//console.log('asked for', dayjs(formValues.calibrationChargeDate));
|
console.log('asked for', dayjs(formValues.calibrationChargeDate));
|
||||||
const configurationToSend: ConfigurationValues = {
|
const configurationToSend: ConfigurationValues = {
|
||||||
minimumSoC: formValues.minimumSoC,
|
minimumSoC: formValues.minimumSoC,
|
||||||
gridSetPoint: formValues.gridSetPoint,
|
gridSetPoint: formValues.gridSetPoint,
|
||||||
CalibrationChargeState: formValues.CalibrationChargeState,
|
CalibrationChargeState: formValues.CalibrationChargeState,
|
||||||
calibrationChargeDate: dayjs(formValues.calibrationChargeDate).toDate()
|
calibrationChargeDate: dayjs(formValues.calibrationChargeDate)
|
||||||
|
.add(2, 'hours')
|
||||||
|
.toDate()
|
||||||
};
|
};
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
@ -159,7 +147,7 @@ function Configuration(props: ConfigurationProps) {
|
||||||
const handleConfirm = (newDate) => {
|
const handleConfirm = (newDate) => {
|
||||||
setFormValues({
|
setFormValues({
|
||||||
...formValues,
|
...formValues,
|
||||||
['calibrationChargeDate']: dayjs.utc(newDate).toDate()
|
['calibrationChargeDate']: dayjs(newDate).toDate()
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -171,6 +159,7 @@ function Configuration(props: ConfigurationProps) {
|
||||||
difference += 7;
|
difference += 7;
|
||||||
}
|
}
|
||||||
const adjustedDate = currentDate.add(difference, 'day');
|
const adjustedDate = currentDate.add(difference, 'day');
|
||||||
|
|
||||||
setFormValues({
|
setFormValues({
|
||||||
...formValues,
|
...formValues,
|
||||||
['calibrationChargeDate']: adjustedDate.toDate()
|
['calibrationChargeDate']: adjustedDate.toDate()
|
||||||
|
@ -185,14 +174,12 @@ function Configuration(props: ConfigurationProps) {
|
||||||
),
|
),
|
||||||
['calibrationChargeDate']:
|
['calibrationChargeDate']:
|
||||||
CalibrationChargeOptions.indexOf(event.target.value) == 0
|
CalibrationChargeOptions.indexOf(event.target.value) == 0
|
||||||
? dayjs
|
? dayjs(
|
||||||
.utc(props.values.repetitiveCalibrationChargeDate[0].value)
|
props.values.repetitiveCalibrationChargeDate[0].value
|
||||||
.add(localOffset, 'minute')
|
).toDate()
|
||||||
.toDate()
|
: dayjs(
|
||||||
: dayjs
|
props.values.additionalCalibrationChargeDate[0].value
|
||||||
.utc(props.values.additionalCalibrationChargeDate[0].value)
|
).toDate()
|
||||||
.add(localOffset, 'minute')
|
|
||||||
.toDate()
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -333,6 +320,9 @@ function Configuration(props: ConfigurationProps) {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
onChange={handleSelectedCalibrationChargeChange}
|
onChange={handleSelectedCalibrationChargeChange}
|
||||||
|
//open={openForcedCalibrationCharge}
|
||||||
|
//onClose={handleCloseForcedCalibrationCharge}
|
||||||
|
//onOpen={handleOpenForcedCalibrationCharge}
|
||||||
>
|
>
|
||||||
{CalibrationChargeOptions.map((option) => (
|
{CalibrationChargeOptions.map((option) => (
|
||||||
<MenuItem key={option} value={option}>
|
<MenuItem key={option} value={option}>
|
||||||
|
@ -346,10 +336,8 @@ function Configuration(props: ConfigurationProps) {
|
||||||
<div>
|
<div>
|
||||||
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
||||||
<DateTimePicker
|
<DateTimePicker
|
||||||
format="DD/MM/YYYY HH:mm"
|
|
||||||
ampm={false}
|
|
||||||
label="Select Next Calibration Charge Date"
|
label="Select Next Calibration Charge Date"
|
||||||
value={dayjs.utc(formValues.calibrationChargeDate)}
|
value={dayjs(formValues.calibrationChargeDate)}
|
||||||
onChange={handleConfirm}
|
onChange={handleConfirm}
|
||||||
sx={{
|
sx={{
|
||||||
marginTop: 2
|
marginTop: 2
|
||||||
|
@ -382,6 +370,9 @@ function Configuration(props: ConfigurationProps) {
|
||||||
daysInWeek[formValues.calibrationChargeDate.getDay()]
|
daysInWeek[formValues.calibrationChargeDate.getDay()]
|
||||||
}
|
}
|
||||||
onChange={handleSelectedCalibrationChargeDay}
|
onChange={handleSelectedCalibrationChargeDay}
|
||||||
|
// open={openForcedCalibrationCharge}
|
||||||
|
// onClose={handleCloseForcedCalibrationCharge}
|
||||||
|
// onOpen={handleOpenForcedCalibrationCharge}
|
||||||
>
|
>
|
||||||
{daysInWeek.map((day) => (
|
{daysInWeek.map((day) => (
|
||||||
<MenuItem key={day} value={day}>
|
<MenuItem key={day} value={day}>
|
||||||
|
@ -395,9 +386,8 @@ function Configuration(props: ConfigurationProps) {
|
||||||
<div style={{ marginBottom: '5px', marginTop: '10px' }}>
|
<div style={{ marginBottom: '5px', marginTop: '10px' }}>
|
||||||
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
||||||
<TimePicker
|
<TimePicker
|
||||||
ampm={false}
|
|
||||||
label="Calibration Charge Hour"
|
label="Calibration Charge Hour"
|
||||||
value={dayjs.utc(formValues.calibrationChargeDate)}
|
value={dayjs(formValues.calibrationChargeDate)}
|
||||||
onChange={handleConfirm}
|
onChange={handleConfirm}
|
||||||
/>
|
/>
|
||||||
</LocalizationProvider>
|
</LocalizationProvider>
|
||||||
|
|
|
@ -282,25 +282,25 @@ function Information(props: InformationProps) {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/*<div>*/}
|
<div>
|
||||||
{/* <TextField*/}
|
<TextField
|
||||||
{/* label="S3 Write Key"*/}
|
label="S3 Write Key"
|
||||||
{/* name="s3writekey"*/}
|
name="s3writekey"
|
||||||
{/* value={formValues.s3WriteKey}*/}
|
value={formValues.s3WriteKey}
|
||||||
{/* variant="outlined"*/}
|
variant="outlined"
|
||||||
{/* fullWidth*/}
|
fullWidth
|
||||||
{/* />*/}
|
/>
|
||||||
{/*</div>*/}
|
</div>
|
||||||
|
|
||||||
{/*<div>*/}
|
<div>
|
||||||
{/* <TextField*/}
|
<TextField
|
||||||
{/* label="S3 Write Secret Key"*/}
|
label="S3 Write Secret Key"
|
||||||
{/* name="s3writesecretkey"*/}
|
name="s3writesecretkey"
|
||||||
{/* value={formValues.s3WriteSecret}*/}
|
value={formValues.s3WriteSecret}
|
||||||
{/* variant="outlined"*/}
|
variant="outlined"
|
||||||
{/* fullWidth*/}
|
fullWidth
|
||||||
{/* />*/}
|
/>
|
||||||
{/*</div>*/}
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<TextField
|
<TextField
|
||||||
|
|
|
@ -143,9 +143,7 @@ export const transformInputToBatteryViewData = async (
|
||||||
startUnixTime = UnixTime.fromTicks(startUnixTime.ticks + 1);
|
startUnixTime = UnixTime.fromTicks(startUnixTime.ticks + 1);
|
||||||
}
|
}
|
||||||
const adjustedTimestamp = new Date(startUnixTime.ticks * 1000);
|
const adjustedTimestamp = new Date(startUnixTime.ticks * 1000);
|
||||||
adjustedTimestamp.setHours(
|
adjustedTimestamp.setHours(adjustedTimestamp.getHours() + 1);
|
||||||
adjustedTimestamp.getHours() - adjustedTimestamp.getTimezoneOffset() / 60
|
|
||||||
);
|
|
||||||
adjustedTimestampArray.push(adjustedTimestamp);
|
adjustedTimestampArray.push(adjustedTimestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,11 +326,7 @@ export const transformInputToDailyData = async (
|
||||||
startUnixTime = UnixTime.fromTicks(startUnixTime.ticks + 1);
|
startUnixTime = UnixTime.fromTicks(startUnixTime.ticks + 1);
|
||||||
}
|
}
|
||||||
const adjustedTimestamp = new Date(startUnixTime.ticks * 1000);
|
const adjustedTimestamp = new Date(startUnixTime.ticks * 1000);
|
||||||
//Timezone offset is negative, so we convert the timestamp to the current zone by subtracting the corresponding offset
|
adjustedTimestamp.setHours(adjustedTimestamp.getHours() + 1);
|
||||||
adjustedTimestamp.setHours(
|
|
||||||
adjustedTimestamp.getHours() - adjustedTimestamp.getTimezoneOffset() / 60
|
|
||||||
);
|
|
||||||
|
|
||||||
adjustedTimestampArray.push(adjustedTimestamp);
|
adjustedTimestampArray.push(adjustedTimestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue