Fix installation date

This commit is contained in:
Lucio Maranta
2020-01-22 15:08:44 +01:00
parent 0c390a1ae5
commit 95e87f2ceb
6 changed files with 27 additions and 9 deletions
Binary file not shown.
+2 -6
View File
@@ -351,11 +351,7 @@ namespace Step.Config
XDocument xmlConfigFile = GetXmlHandlerWithValidator(MAINTENANCES_CONFIG_SCHEMA_PATH, MAINTENANCES_CONFIG_PATH);
ReadAssistanceConfig();
var ci = new CultureInfo("en-US");
var formats = new[] { "M-d-yyyy HH:mm", "dd-MM-yyyy HH:mm", "MM-dd-yyyy HH:mm", "M/d/yyyy HH:mm", "dd/MM/yyyy HH:mm", "MM/dd/yyyy HH:mm" }
.ToArray();
MaintenancesConfig = xmlConfigFile
.Descendants("maintenances")
.Elements("maintenance")
@@ -367,7 +363,7 @@ namespace Step.Config
y => y.Attribute("langKey").Value, y => y.Value
),
Intervall = TimeSpan.FromMinutes(Convert.ToDouble(x.Element("interval").Value)),
Deadline = DateTime.ParseExact(x.Element("deadline").Value, formats, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal),
Deadline = DateTime.ParseExact(x.Element("deadline").Value, DATE_TIME_FORMATS, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal),
Type = x.Element("type").Value,
CouterId = Convert.ToInt32(x.Element("counterId").Value),
LocalizedDescription = x.Element("localizedDescription").Elements().ToDictionary( // Read localization of description
+18
View File
@@ -301,5 +301,23 @@ namespace Step.Model
public const string JOB_MAIN_FILENAME = "main.cnc";
public const string JOB_METADATA_FILENAME = "metadata.json";
public static string[] JOB_EXTENSIONS = { ".job", ".zip" };
public static string[] DATE_TIME_FORMATS = new[] {
"M-d-yyyy HH:mm",
"dd-MM-yyyy HH:mm",
"MM-dd-yyyy HH:mm",
"M/d/yyyy HH:mm",
"dd/MM/yyyy HH:mm",
"MM/dd/yyyy HH:mm"
};
public static string[] DATE_FORMATS = new[] {
"M-d-yyyy",
"dd-MM-yyyy",
"MM-dd-yyyy",
"M/d/yyyy",
"dd/MM/yyyy",
"MM/dd/yyyy"
};
}
}
+3 -2
View File
@@ -68,6 +68,7 @@ namespace Step.NC
case NC_VENDOR.OSAI:
return new Nc_Osai(NcConfig.NcIpAddress, NcConfig.NcPort, 2000);
}
return null;
}
@@ -230,8 +231,8 @@ namespace Step.NC
// Max process number
genericData.ProcessNumber = procNum;
// Get Installation Date
genericData.InstallationDate = DateTime.Parse(NcConfig.InstallationDate);
// Get PLC version
genericData.InstallationDate = DateTime.ParseExact(NcConfig.InstallationDate, DATE_FORMATS, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal);
// Get PLC version
genericData.PlcVersion = "1.0.0";
// Get PLC version
cmsError = numericalControl.NC_RUnitOfMeasure(ref tmpInfo);
@@ -35,6 +35,9 @@ export default class MachineInfoDialog extends Vue {
get ncReady() {
return this.$store.state.machineStatus.ncReady;
}
getFormattedDate(date){
return moment(date).format("L")
}
get getDateFormat() {
return (moment() as any)._locale._longDateFormat.L;
}
@@ -11,7 +11,7 @@
</div>
<div v-if="ncReady" class="details">
<label>{{'machine_serial_number' | localize('Matricola Nr.:')}} <strong>{{machineInfo.machineSerialNumber}}</strong></label>
<label>{{'machine_installation_date' | localize('Data di installazione:')}} <strong>{{machineInfo.installationDate | date('DD-MM-YYYY')}}</strong></label>
<label>{{'machine_installation_date' | localize('Data di installazione:')}} <strong>{{getFormattedDate(machineInfo.installationDate)}}</strong></label>
<hr/>
<label>{{'machineinfo_model_nc' | localize('Modello Cn:')}} <strong>{{machineInfo.ncModel}}</strong></label>
<label>{{'machineinfo_serial_nc' | localize('Num. Seriale Cn:')}} <strong>{{machineInfo.ncSerialNumber}}</strong></label>