Merge remote-tracking branch 'origin/develop' into feature/prodMgmt

This commit is contained in:
Samuele Locatelli
2020-09-07 13:53:07 +02:00
9 changed files with 115 additions and 39 deletions
+6
View File
@@ -64,6 +64,12 @@ export default class app extends Vue {
mounted() {
let ms = messageService;
window.oncontextmenu = function (event) {
event.preventDefault();
event.stopPropagation();
return false;
};
// if cms is connected
if (typeof cmsClient != "undefined")
this.HMIsrc = cmsClient.getScreenBase64();
@@ -4,6 +4,7 @@ import { Prop } from 'vue-property-decorator';
import { Hub } from "@/services";
import Numeric from "./numeric";
import { unitOfTime } from "moment";
@Component({ name: "slider" })
export default class Slider extends Vue {
@@ -33,19 +34,24 @@ export default class Slider extends Vue {
this.value.setpointHMI = v;
}
get step() {
// var s = ((this.value.range.max - this.value.range.min) / (this.lines + 1));
// var m = Math.pow(10, this.decimal);
// return Math.round(s * m) / m
return 1;
};
@Prop({ default: .7 })
incrementingStep: number;
step: number = 1;
// get step() {
// var s = ((this.value.range.max - this.value.range.min) / (this.lines + 1));
// var m = Math.pow(10, this.decimal);
// return Math.round(s * m) / m
// return 1;
// };
startIncrement() {
if (!this.value.status.enabled) return;
this.incrementing = setInterval(() => {
var v = this.value.setpointHMI;
if (v < this.value.range.max) {
v += this.step;
v += Math.floor(this.step);
this.step += this.incrementingStep;
}
if (v > this.value.range.max) {
v = this.value.range.max;
@@ -59,7 +65,8 @@ export default class Slider extends Vue {
this.incrementing = setInterval(() => {
var v = this.value.setpointHMI;
if (v > this.value.range.min) {
v -= this.step;
v -= Math.floor(this.step);
this.step += this.incrementingStep;
}
if (v < this.value.range.min) {
v = this.value.range.min;
@@ -74,7 +81,7 @@ export default class Slider extends Vue {
clearInterval(this.incrementing);
this.incrementing = 0;
this.step = 1;
};
@@ -1,7 +1,13 @@
<template>
<div class="slider-container">
<div class="slider">
<button @mousedown="startDecrement()" @mouseup="confirm()" @mouseout="confirm()">
<button
@mousedown="startDecrement()"
v-on:touchstart="startDecrement()"
v-on:touchend="confirm()"
@mouseup="confirm()"
@mouseout="confirm()"
>
<img src="assets/icons/png/min.png" />
</button>
<div class="control">
@@ -21,7 +27,13 @@
<small>{{`${this.value.range.max} ${this.value.unitMeasure}`}}</small>
</div>
</div>
<button @mousedown="startIncrement()" @mouseup="confirm()" @mouseout="confirm()">
<button
@mousedown="startIncrement()"
v-on:touchstart="startIncrement()"
v-on:touchend="confirm()"
@mouseup="confirm()"
@mouseout="confirm()"
>
<img src="assets/icons/png/max.png" />
</button>
</div>
@@ -40,5 +52,13 @@
justify-items: center;
width: 100%;
}
input[type="range"] {
pointer-events: none;
}
input[type="range"]::-webkit-slider-thumb {
pointer-events: auto;
}
</style>
<script lang="ts" src="./slider.ts"></script>
@@ -4,6 +4,19 @@ import { Prop, InjectReactive } from 'vue-property-decorator';
import { IGanttOptions } from './gantt';
import { store } from '@/store';
import { RecipeGetters } from '@/store/recipe.store';
import { ModalHelper } from '@/components/modals';
import ShowRiscaldamentoInfo from "@/app_modules_thermo/setup/riscaldi/components/show-riscaldi-info.vue";
import ShowFormatoInfo from "@/app_modules_thermo/setup/formato/components/show-formato-info.vue";
import ShowPirometroInfo from "@/app_modules_thermo/setup/pirometro/components/show-pirometro-info.vue";
import ShowCicloInfo from "@/app_modules_thermo/setup/ciclo/components/show-ciclo-info.vue";
import ShowRaffreddamentoInfo from "@/app_modules_thermo/setup/raffreddamento/components/show-raffreddamento-info.vue";
import ShowControstampoInfo from "@/app_modules_thermo/setup/controstampo_setup/components/show-controstampo-info.vue";
import ShowQuoteVelocitaInfo from "@/app_modules_thermo/setup/quote-velocita/components/show-quote-velocita-info.vue";
import ShowEstrazioneInfo from "@/app_modules_thermo/setup/estrazione/components/show-estrazione-info.vue";
import ShowVuotoInfo from "@/app_modules_thermo/setup/vuoto/show-vuoto-info.vue";
import ShowImbutituraInfo from "@/app_modules_thermo/setup/imbutitura/show-imbutitura-info.vue";
import ShowOpzioniInfo from "@/app_modules_thermo/setup/opzioni/show-opzioni-info.vue";
@Component({})
export default class GanttComponent extends Vue {
@@ -71,6 +84,47 @@ export default class GanttComponent extends Vue {
return this.showStatus ? this.ganttOptions.block_status_minDuration : 0;
}
openModal() {
switch (this.blockType) {
case "movement": this.showModalAtStep(2); break;
case "heating": this.showModalAtStep(3); break;
case "drawing": this.showModalAtStep(5); break;
case "vacuum": this.showModalAtStep(8); break;
case "cooling": this.showModalAtStep(7); break;
case "extraction": this.showModalAtStep(9); break;
}
}
async showModalAtStep(step: number) {
try {
let next = await this.showModalStep(step);
if (next == null) return;
this.showModalAtStep(step + next);
} catch {
}
}
showModalStep(step: number): Promise<number> {
switch (step) {
case 0: return ModalHelper.ShowModalAsync(ShowFormatoInfo);
case 1: return ModalHelper.ShowModalAsync(ShowQuoteVelocitaInfo);
case 2: return ModalHelper.ShowModalAsync(ShowCicloInfo);
case 3: return ModalHelper.ShowModalAsync(ShowRiscaldamentoInfo);
case 4: return ModalHelper.ShowModalAsync(ShowPirometroInfo);
case 5: return ModalHelper.ShowModalAsync(ShowImbutituraInfo);
case 6: return ModalHelper.ShowModalAsync(ShowControstampoInfo);
case 7: return ModalHelper.ShowModalAsync(ShowRaffreddamentoInfo);
case 8: return ModalHelper.ShowModalAsync(ShowVuotoInfo);
case 9: return ModalHelper.ShowModalAsync(ShowEstrazioneInfo);
case 10: return ModalHelper.ShowModalAsync(ShowOpzioniInfo);
// case 11: return ModalHelper.ShowModalAsync(AvvioProduzione);
}
return null;
}
// mounted() {
// this.value.showDelay = true;
// }
@@ -12,24 +12,12 @@
<!-- gestione del delay -->
<g v-if="value.showDelay">
<foreignObject
:width="delayDuration * ganttOptions.secondSize"
height="44"
x="0"
y="0"
v-if="!ganttOptions.printing"
>
<foreignObject :width="delayDuration * ganttOptions.secondSize" height="44" x="0" y="0">
<div class="delay-header">
<i class="fa fa-hourglass-half" aria-hidden="true" />
</div>
</foreignObject>
<foreignObject
:width="delayDuration * ganttOptions.secondSize"
height="26"
x="0"
y="44"
v-if="!ganttOptions.printing"
>
<foreignObject :width="delayDuration * ganttOptions.secondSize" height="26" x="0" y="44">
<div class="delay-footer">{{value.estimatedDelay | round(1)}}s</div>
</foreignObject>
<line
@@ -47,16 +35,14 @@
height="44"
x="0"
y="0"
v-if="!ganttOptions.printing"
>
<div class="body-header">{{value.label | localize(value.label)}}</div>
<div class="body-header" @click="openModal()">{{value.label | localize(value.label)}}</div>
</foreignObject>
<foreignObject
:width="(duration - (showStatus && recipeValue?statusDuration:0)) * ganttOptions.secondSize"
height="26"
x="0"
y="44"
v-if="!ganttOptions.printing"
>
<div class="body-footer">{{value.estimatedDuration | round(1)}}s</div>
</foreignObject>
@@ -159,7 +145,6 @@
<foreignObject :width="statusDuration * ganttOptions.secondSize" height="26" x="0" y="44">
<div
class="status-footer"
v-if="!ganttOptions.printing"
>{{recipeValue.setpointPLC | round(recipeValue.numDec)}} {{recipeValue.unitMeasure}}</div>
</foreignObject>
</g>
@@ -171,7 +156,6 @@
y="-5"
height="10"
:x="Math.max(actualDelay * ganttOptions.secondSize -30,0)"
v-if="!ganttOptions.printing"
>
<div class="progress-indicator">{{value.actualDelay | round(1)}}</div>
</foreignObject>
@@ -190,7 +174,6 @@
y="-5"
height="10"
:x="Math.max(actualDuration * ganttOptions.secondSize -30,0)"
v-if="!ganttOptions.printing"
>
<div class="progress-indicator">{{value.actualDuration | round(1)}}</div>
</foreignObject>
@@ -20,7 +20,7 @@
</template>
</g>
</g>
<g v-if="!ganttOptions.printing">
<g>
<rect x="0" y="0" width="25" :height="rowHeight " fill="#cfcfcf"></rect>
<foreignObject x="0" y="0" width="25" :height="rowHeight ">
<div class="rowHeader">
@@ -5,7 +5,7 @@ import ganttHeader from "./gantt-header.vue";
import ganttRow from "./gantt-row.vue"
import timeLine from "./timeline.vue";
var ContainerElements = ["svg", "g"];
var ContainerElements = ["svg", "g", "foreignobject"];
var RelevantStyles = {
"rect": ["fill", "stroke", "stroke-width"],
"path": ["fill", "stroke", "stroke-width"],
@@ -13,7 +13,12 @@ var RelevantStyles = {
"line": ["stroke", "stroke-width"],
"text": ["fill", "font-size", "text-anchor"],
"polygon": ["stroke", "fill"],
"div": ["align-items", "justify-content", "flex-flow", "font-size", "height", "padding", "color", "display", "width"]
"foreignobject": [],
"div": [
"align-items", "justify-content", "font-family", "flex-flow", "font-size",
"height", "padding", "color", "display", "width", "border-radius",
"background-color", "transform"],
"span": ["letter-spacing", "text-transform", "background-color"]
};
@Component({
@@ -60,7 +65,8 @@ export default class Gantt extends Vue {
for (var cd = 0; cd < Children.length; cd++) {
var Child = Children[cd];
var TagName = Child.tagName;
var TagName = (Child.tagName as string)?.toLowerCase();
if (ContainerElements.indexOf(TagName) != -1) {
this.exportSVGWithStyle(Child, OrigChildDat[cd])
} else if (TagName in RelevantStyles) {
@@ -44,8 +44,8 @@ export default class AvvioProduzione extends Vue {
showDashboard() {
prodService.Start(this.pieces.setpointHMI);
prodService.Auto();
prodService.Start(this.pieces.setpointHMI, this.newjob, this.warmuppieces.setpointHMI);
ModalHelper.HideModal();
appModelActions.ShowDashboard(this.$store);
@@ -33,8 +33,8 @@ export class ProdService extends baseRestService {
await this.Put<any>((await this.BASE_URL()) + "mode/auto", null);
}
async Start(qty: number, newWorkOrder: boolean = true) {
await this.Put<any>((await this.BASE_URL()) + `start?requestQty=${qty}&newWorkOrder=${newWorkOrder}`, null);
async Start(qty: number, newWorkOrder: boolean, riscqty: number) {
await this.Put<any>((await this.BASE_URL()) + `start?requestQty=${qty}&newWorkOrder=${newWorkOrder}&numCicliRisc=${riscqty}`, null);
}
}
export const prodService = new ProdService();