diff --git a/benchtop-fe/package.json b/benchtop-fe/package.json index 61cde6a..68daf67 100644 --- a/benchtop-fe/package.json +++ b/benchtop-fe/package.json @@ -11,8 +11,10 @@ "dependencies": { "@mdi/font": "^7.2.96", "@vuepic/vue-datepicker": "^7.0.0", + "concat-stream": "^2.0.0", "date-fns": "^2.30.0", "html2pdf.js": "^0.10.1", + "toml": "^3.0.0", "vls": "^0.8.5", "volar-service-vetur": "^0.0.13", "vue": "^3.3.4", diff --git a/benchtop-fe/src/SETTINGS.toml b/benchtop-fe/src/SETTINGS.toml new file mode 100644 index 0000000..f4900b4 --- /dev/null +++ b/benchtop-fe/src/SETTINGS.toml @@ -0,0 +1,30 @@ +[Settings] +tolerance = 0.05 + +[[CalibrationDevices]] +name = "Menzer1" +model = "CPC 4000" +serial = "12345" +certid = "1234, 3454, 5555" +caldate = "5/8/24" + +[[CalibrationDevices]] +name = "Blackbelt" +model = "CPC 4000" +serial = "12345" +certid = "1234, 3454, 5555" +caldate = "5/8/24" + +[[CalibrationDevices]] +name = "Alicat" +model = "CPC 4000" +serial = "12345" +certid = "1234, 3454, 5555" +caldate = "5/8/24" + +[[CalibrationDevices]] +name = "Alicat2" +model = "CPC 4000" +serial = "12345" +certid = "1234, 3454, 5555" +caldate = "5/8/24" diff --git a/benchtop-fe/src/components/CalibrationDevice/NewCalibrationDeviceForm.vue b/benchtop-fe/src/components/CalibrationDevice/NewCalibrationDeviceForm.vue index f5b2f0f..99e4c13 100644 --- a/benchtop-fe/src/components/CalibrationDevice/NewCalibrationDeviceForm.vue +++ b/benchtop-fe/src/components/CalibrationDevice/NewCalibrationDeviceForm.vue @@ -5,8 +5,7 @@

Primary Device

Calibration Date

@@ -17,8 +16,7 @@

Calibration Date

@@ -29,13 +27,27 @@
diff --git a/benchtop-fe/src/components/Customer/CustomerForm.vue b/benchtop-fe/src/components/Customer/CustomerForm.vue index 18e2f72..5c174a3 100644 --- a/benchtop-fe/src/components/Customer/CustomerForm.vue +++ b/benchtop-fe/src/components/Customer/CustomerForm.vue @@ -35,6 +35,12 @@ + + Issuer + + + + @@ -48,7 +54,8 @@ const customer_name = ref(""), onsite_cal = ref(false), control_doc = ref(""), - technician = ref("") + technician = ref(""), + issuer = ref("") const emit = defineEmits(); watchEffect(() => { @@ -57,6 +64,7 @@ watchEffect(() => { onsite_cal, control_doc, technician, + issuer, }); }); \ No newline at end of file diff --git a/benchtop-fe/src/components/Environment/EnvironmentForm.vue b/benchtop-fe/src/components/Environment/EnvironmentForm.vue index 2b6b284..ce41cea 100644 --- a/benchtop-fe/src/components/Environment/EnvironmentForm.vue +++ b/benchtop-fe/src/components/Environment/EnvironmentForm.vue @@ -5,9 +5,9 @@ - + @@ -40,7 +40,7 @@ import { ref, defineEmits, watchEffect } from 'vue' const - accuracy = ref(0.05), + tolerance = ref(0.05), pressure = ref(14.7), temperature = ref(50.0), humidity = ref(50.0) @@ -48,7 +48,7 @@ const const emit = defineEmits(); watchEffect(() => { emit("environment-form", { - accuracy, + tolerance, pressure, temperature, humidity, diff --git a/benchtop-fe/src/components/PDF/PDF.vue b/benchtop-fe/src/components/PDF/PDF.vue index 3e4066c..f5d377a 100644 --- a/benchtop-fe/src/components/PDF/PDF.vue +++ b/benchtop-fe/src/components/PDF/PDF.vue @@ -8,7 +8,7 @@
-
+
@@ -16,8 +16,9 @@
Customer: {{ props.customer?.customer_name }}
-
Onsite cal (yes/no): {{ onsite() }}
+
Onsite cal (yes/no): {{ onsite }}
Control Doc#: {{ props.customer?.control_doc }}
+
Issuer: {{ props.customer?.issuer }}
Technician: {{ props.customer?.technician }}
@@ -62,9 +63,9 @@ Serial# :{{ props.calibration?.serial }}
-
Cal Date :{{ c_date() }}
+
Cal Date :{{ calibrationDate }}
- Cal Due Date :{{ c_due_date() }} + Cal Due Date :{{ calibrationDueDate }}
Cert ID :
-
Cal Date :{{ i_date() }}
+
Issue Date :{{ issueDate }}
+
Cal Date :{{ instrumentDate }}
- Cal Due Date :{{ i_due_date() }} + Cal Due Date :{{ instrumentDueDate }}
Environmental Data
@@ -95,18 +97,19 @@
- +
- + -
+
+

Secondary Cal Device (For Environmental Data): EXTECH S/N A23050006 Cert # 1535483 07/24/23 (Cal Date) (Precision Psychrometer)

- Uncertainty Statement: The accuracy of measurement is determined by + Uncertainty Statement: The tolerance of measurement is determined by the standards uncertainty, with a coverage factor of k=2 (confidence of roughly 95%).

@@ -138,11 +141,11 @@ const props = defineProps({ calibration: Object, }); -const onsite = () => { +const onsite = computed(() => { return props.customer?.onsite_cal ? "Yes" : "No"; -}; +}); -const i_date = () => { +const instrumentDate = computed(() => { if (!props.instrument?.date) { return } @@ -151,10 +154,18 @@ const i_date = () => { const month = (d.getMonth() + 1).toString().padStart(2, "0"); // Month is zero-based, so we add 1 const day = d.getDate().toString().padStart(2, "0"); return `${year}-${month}-${day}`; -}; +}); + +const issueDate = computed(() => { + const d = new Date(); + const year = d.getFullYear(); + const month = (d.getMonth() + 1).toString().padStart(2, "0"); // Month is zero-based, so we add 1 + const day = d.getDate().toString().padStart(2, "0"); + return `${year}-${month}-${day}`; +}); -const i_due_date = () => { +const instrumentDueDate = computed(() => { if (!props.instrument?.due_date) { return; } @@ -163,9 +174,9 @@ const i_due_date = () => { const month = (d.getMonth() + 1).toString().padStart(2, "0"); // Month is zero-based, so we add 1 const day = d.getDate().toString().padStart(2, "0"); return `${year}-${month}-${day}`; -}; +}); -const c_date = () => { +const calibrationDate = computed(() => { if (!props.calibration?.date) { return; } @@ -174,8 +185,9 @@ const c_date = () => { const month = (d.getMonth() + 1).toString().padStart(2, "0"); // Month is zero-based, so we add 1 const day = d.getDate().toString().padStart(2, "0"); return `${year}-${month}-${day}`; -}; -const c_due_date = () => { +}); + +const calibrationDueDate = computed(() => { if (!props.calibration?.due_date) { return; } @@ -184,7 +196,49 @@ const c_due_date = () => { const month = (d.getMonth() + 1).toString().padStart(2, "0"); // Month is zero-based, so we add 1 const day = d.getDate().toString().padStart(2, "0"); return `${year}-${month}-${day}`; -}; +}); + +const pages = computed(() => { + let pages = [] + const actions = { + "Transducer Verify": ParseTransducer, + "Hardware Calibration": ParseHardwareCalibration, + } + // debugger + + if (props.upload?.files?.length > 0) { + const acc = props.environment.tolerance + const parse = actions[props.upload.report_type] + for (const idx in props.upload.files) { + const page = { + asFound: [], + asLeft: [] + } + const file = props.upload.files[idx] + const content = parse(file["value"], acc) + console.log("content", content) + + // if first file is both, put as found as left + // if first file is as found + // next file is as left + + + if (file.kind === "found") { + page.asFound = [...page.asFound, ...content] + } else if (file.kind === "left") { + page.asLeft = [...page.asLeft, ...content] + } else if (file.kind === "both") { + page.asFound = [...page.asFound, ...content] + page.asLeft = [...page.asLeft, ...content] + } + pages.push(page) + console.log(pages) + } + } + + return pages; +}); + const exportToPDF = () => { if (props.upload.files.length > 0) { @@ -192,36 +246,16 @@ const exportToPDF = () => { var opt = { margin: 0.4, - filename: `${props.instrument.model}_${i_date()}.pdf`, + filename: `${props.instrument.model}_${instrumentDate}.pdf`, image: {type: "jpeg", quality: 0.98}, html2canvas: {scale: 2}, + pagebreak: { after: ['hr']}, jsPDF: {unit: "in", format: "letter", orientation: "portrait"}, }; html2pdf().from(element).set(opt).save(); } }; -const tables = computed(() => { - let content = "" - let tables = [] - - if (props.upload?.files?.length > 0) { - const acc = props.environment.accuracy - if (props.upload.report_type === "Transducer Verify") { - for (const idx in props.upload.files) { - content = ParseTransducer(props.upload.files[idx]["value"], acc) - tables = [...tables, ...content] - } - } else if (props.upload.report_type === "Hardware Calibration") { - for (const idx in props.upload.files) { - content = ParseHardwareCalibration(props.upload.files[idx]["value"], acc) - tables = [...tables, ...[content]] - } - } - } - - return tables; -}) diff --git a/benchtop-fe/src/components/PDF/ReadingTable.vue b/benchtop-fe/src/components/PDF/ReadingTable.vue index b21eb53..37b3a92 100644 --- a/benchtop-fe/src/components/PDF/ReadingTable.vue +++ b/benchtop-fe/src/components/PDF/ReadingTable.vue @@ -5,93 +5,22 @@
- + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + +
AccuracyTolerance - +
Gauge ReadingAccuracy (+/- FS)Tolerance (+/- FS) Low Limit High LimitAs Found (units){{as_header}} OOT
HI?TBDTBDTBDTBDTBD
TBDTBDTBDTBDTBDTBD
TBDTBDTBDTBDTBDTBD
TBDTBDTBDTBDTBDTBD
      
      
      
      
      
      
{{row["Value"]}}{{row["Tolerance"]}}{{row["Low Limit"]}}{{row["High Limit"]}}{{row["As"]}}{{row["Out of Tolerance"]}}
@@ -102,9 +31,20 @@ import {defineProps, ref} from "vue"; const props = defineProps({ - as_found: Object, - as_left: Object, + table: Array, + asFound: Boolean, + asLeft: Boolean }); + +const as_header = computed(()=> { + if (asFound) { + return "As Found (units)" + } + if (asLeft) { + return "As Left (units)" + } +}) +