/authorized returns level, added device to spectrum measurement
This commit is contained in:
@ -30,8 +30,8 @@ const docs = [
|
||||
const errors = [];
|
||||
const nmDocs = 'C:\\Users\\vle2fe\\Documents\\Data\\All_200717\\nmDocs'; // NormMaster Documents
|
||||
const dptFiles = 'C:\\Users\\vle2fe\\Documents\\Data\\All_200717\\DPT'; // Spectrum files
|
||||
const host = 'http://localhost:3000';
|
||||
// const host = 'https://definma-api.apps.de1.bosch-iot-cloud.com';
|
||||
// const host = 'http://localhost:3000';
|
||||
const host = 'https://definma-api.apps.de1.bosch-iot-cloud.com';
|
||||
const requiredProperties = ['samplenumber','materialnumber','materialname','supplier','reinforcementmaterial','material','granulate/part','color','charge/batch','comments'];
|
||||
dict = { // dictionary
|
||||
'Granulat': 'granulate',
|
||||
@ -194,7 +194,8 @@ async function allDpts() {
|
||||
password: 'Abc123!#'
|
||||
}
|
||||
});
|
||||
const measurement_template = res.data.find(e => e.name === 'spectrum')._id;
|
||||
const measurement_templates = res.data.filter(e => e.name === 'spectrum');
|
||||
const measurement_template = measurement_templates[measurement_templates.length - 1]._id;
|
||||
res = await axios({
|
||||
method: 'get',
|
||||
url: host + '/samples?status=all',
|
||||
@ -207,7 +208,7 @@ async function allDpts() {
|
||||
res.data.forEach(sample => {
|
||||
sampleIds[sample.number] = sample._id;
|
||||
});
|
||||
const dptRegex = /(.*?)_(.*?)_(\d+|\d+_\d+).DPT/;
|
||||
const dptRegex = /(.*?)_(.*?)_(\d+|\w+_\d+).DPT/;
|
||||
const dpts = fs.readdirSync(dptFiles);
|
||||
for (let i in dpts) {
|
||||
const regexRes = dptRegex.exec(dpts[i])
|
||||
@ -314,7 +315,7 @@ async function allKfVz() {
|
||||
errors.push(`KF/VZ upload for ${JSON.stringify(sample)} failed: ${JSON.stringify(err.response.data)}`);
|
||||
});
|
||||
}
|
||||
if (sample['VZ (ml/g)']) {
|
||||
if (sample['vz(ml/g)']) {
|
||||
await axios({
|
||||
method: 'post',
|
||||
url: host + '/measurement/new',
|
||||
|
Reference in New Issue
Block a user