First commit not working

This commit is contained in:
Thermo_SIM
2021-03-26 09:12:35 +01:00
parent 13cc5f66a3
commit bcd65da7cd
20 changed files with 254 additions and 10 deletions
@@ -426,6 +426,10 @@
&.fa-check-circle.undone-step {
color: #1791ff;
}
&.edit{
left: 80px;
color: #1791ff;
}
}
span,
@@ -534,6 +538,10 @@
&.fa-check-circle.undone-step {
color: #1791ff;
}
&.edit{
left: 133px;
color: #1791ff;
}
}
position: relative;
@@ -382,6 +382,10 @@
.setup .modal-footer-navigator .setup-button i.fa-check-circle.undone-step {
color: #1791ff;
}
.setup .modal-footer-navigator .setup-button i.edit {
left: 80px;
color: #1791ff;
}
.setup .modal-footer-navigator .setup-button span,
.setup .modal-footer-navigator .setup-button label {
grid-row-start: 1;
@@ -473,6 +477,10 @@
.setup-button i.fa-check-circle.undone-step {
color: #1791ff;
}
.setup-button i.edit {
left: 133px;
color: #1791ff;
}
.setup-button .background-top,
.setup-button .background-bottom {
position: absolute;
@@ -97,6 +97,19 @@ export default class ShowCicloInfo extends Vue {
}
@Watch('payload', { deep: true })
async payloadChanged(n, o) {
for (var key in n) {
if (Object.prototype.hasOwnProperty.call(n, key)) {
if(n[key].setpointHMI != n[key].setpointPLC){
messageService.publishToChannel("changed-recipe",2,true);
return;
}
}
}
messageService.publishToChannel("changed-recipe",2,false);
};
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
this.debouncedRecipeSave()
@@ -17,6 +17,7 @@ import ShowImbutituraInfo from "@/app_modules_thermo/setup/imbutitura/show-imbut
import ShowOpzioniInfo from "@/app_modules_thermo/setup/opzioni/show-opzioni-info.vue";
// import AvvioProduzione from "@/app_modules_thermo/setup/avvio-produzione/avvio-produzione.vue";
import { store } from '@/store';
import { RecipeGetters } from '@/store/recipe.store';
@Component({
@@ -27,6 +28,7 @@ import { store } from '@/store';
})
export default class Setup extends Vue {
hasChangedRecipe: Array<boolean> = [false,false,false,false,false,false,false,false,false,false,false];
async showModalAtStep(step: number) {
try {
@@ -41,6 +43,12 @@ export default class Setup extends Vue {
return store.state.recipe.overview;
}
getIntChanges(val) {
console.log("arrivato",(this.$store.getters as RecipeGetters).getIntStates(val));
return (this.$store.getters as RecipeGetters).getIntStates(val);
}
showModalStep(step: number): Promise<number> {
switch (step) {
case 0: return ModalHelper.ShowModalAsync(ShowFormatoInfo, null);
@@ -60,8 +68,15 @@ export default class Setup extends Vue {
return null;
}
setRecipeChanged(args){
this.hasChangedRecipe[args[0]] = args[1];
this.$forceUpdate();
}
mounted() {
messageService.subscribeToChannel('show-setup-modal', (m) => this.showModalAtStep(m));
messageService.subscribeToChannel("changed-recipe", (args) => this.setRecipeChanged(args));
}
@@ -7,6 +7,7 @@
:phase="1"
:title="'lbl_recipe_overview_general' | localize('Formato')"
:status="overview.general"
:haschanges="getIntChanges(0)"
></setup-button>
<setup-button
@@ -14,6 +15,7 @@
:phase="2"
:title="'lbl_recipe_overview_positions' | localize('Quota e velocità')"
:status="overview.positions"
:haschanges="getIntChanges(1)"
></setup-button>
<setup-button
@@ -21,6 +23,7 @@
:phase="3"
:title="'lbl_recipe_overview_cycle' | localize('Ciclo')"
:status="overview.cycle"
:haschanges="hasChangedRecipe[2]"
></setup-button>
<setup-button
@@ -28,6 +31,7 @@
:phase="4"
:title="'lbl_recipe_overview_heats' | localize('Riscaldi')"
:status="overview.heats"
:haschanges="hasChangedRecipe[3]"
></setup-button>
<setup-button
@@ -35,6 +39,7 @@
:phase="5"
:title="'lbl_recipe_overview_pyrometer' | localize('Pirometro')"
:status="overview.pyrometer"
:haschanges="hasChangedRecipe[4]"
></setup-button>
<setup-button
@@ -42,6 +47,7 @@
:phase="6"
:title="'lbl_recipe_overview_drawing' | localize('Imbutitura')"
:status="overview.drawing"
:haschanges="hasChangedRecipe[5]"
></setup-button>
<setup-button
@@ -49,6 +55,7 @@
:phase="7"
:title="'lbl_recipe_overview_upperPlate' | localize('Controstampo')"
:status="overview.upperPlate"
:haschanges="hasChangedRecipe[6]"
></setup-button>
<setup-button
@@ -56,6 +63,7 @@
:phase="8"
:title="'lbl_recipe_overview_cooling' | localize('Raffreddamento')"
:status="overview.cooling"
:haschanges="hasChangedRecipe[7]"
></setup-button>
<setup-button
@@ -63,6 +71,7 @@
:phase="9"
:title="'lbl_recipe_overview_vacuum' | localize('Vuoto')"
:status="overview.vacuum"
:haschanges="hasChangedRecipe[8]"
></setup-button>
<setup-button
@@ -70,6 +79,7 @@
:phase="10"
:title="'lbl_recipe_overview_extraction' | localize('Estrazione')"
:status="overview.extraction"
:haschanges="hasChangedRecipe[9]"
></setup-button>
<setup-button
@@ -77,6 +87,7 @@
:phase="11"
:title="'lbl_recipe_overview_options' | localize('Opzioni di lavorazione')"
:status="overview.options"
:haschanges="hasChangedRecipe[10]"
></setup-button>
<!-- <div class="setup-play" @click="showModalAtStep(11);">
@@ -17,4 +17,9 @@ export default class setupButton extends Vue {
@Prop()
status: string;
@Prop()
haschanges: boolean;
}
@@ -7,6 +7,7 @@
<i v-if="status == 'Unchanged'" class="fa fa-check-circle undone-step"></i>
<i v-if="status == 'ChangedOk'" class="fa fa-check-circle"></i>
<i v-if="status == 'HasError'" class="fa fa-exclamation-triangle warning"></i>
<i v-if="haschanges" class="fa fa-pencil-square undone-step edit"></i>
</div>
</template>
<script src="./setupButton.ts" lang="ts"></script>
@@ -8,6 +8,8 @@ import { store } from '@/store';
@Component({ name: 'stepfooter', components: { setupButton } })
export default class StepFooter extends Vue {
hasChangedRecipe: Array<boolean> = [false,false,false,false,false,false,false,false,false,false,false];
@Prop()
current: number;
@@ -15,8 +17,23 @@ export default class StepFooter extends Vue {
this.$emit('click', step - this.current)
}
get intChanges() {
console.log(store.state.recipe.intChanges)
return store.state.recipe.intChanges[0];
}
get overview() {
return store.state.recipe.overview;
}
setRecipeChanged(args){
this.hasChangedRecipe[args[0]] = args[1];
this.$forceUpdate();
}
mounted() {
messageService.subscribeToChannel('show-setup-modal', (m) => this.showModalAtStep(m));
messageService.subscribeToChannel("changed-recipe", (args) => this.setRecipeChanged(args));
}
}
@@ -6,6 +6,7 @@
:phase="1"
:title="'lbl_recipe_overview_general' | localize('Formato')"
:status="overview.general"
:haschanges="intChanges[0]"
></setup-button>
<setup-button
@@ -14,6 +15,7 @@
:phase="2"
:title="'lbl_recipe_overview_positions' | localize('Quota e velocità')"
:status="overview.positions"
:haschanges="intChanges[1]"
></setup-button>
<setup-button
@@ -22,6 +24,7 @@
:phase="3"
:title="'lbl_recipe_overview_cycle' | localize('Ciclo')"
:status="overview.cycle"
:haschanges="intChanges[2]"
></setup-button>
<setup-button
@@ -30,6 +33,7 @@
:phase="4"
:title="'lbl_recipe_overview_heats' | localize('Riscaldi')"
:status="overview.heats"
:haschanges="hasChangedRecipe[3]"
></setup-button>
<setup-button
@@ -38,22 +42,25 @@
:phase="5"
:title="'lbl_recipe_overview_pyrometer' | localize('Pirometro')"
:status="overview.pyrometer"
:haschanges="hasChangedRecipe[4]"
></setup-button>
<setup-button
@click="showModalAtStep(5)"
:class="{'current': current== 5}"
:phase="6"
:title="'lbl_recipe_overview_drawing' | localize('Imbutitura')"
:status="overview.drawing"
:title="'lbl_recipe_overview_drawing' | localize('Imbutitura')"
:status="overview.drawing"
:haschanges="hasChangedRecipe[5]"
></setup-button>
<setup-button
@click="showModalAtStep(6)"
:class="{'current': current== 6}"
:phase="7"
:title="'lbl_recipe_overview_upperPlate' | localize('Controstampo')"
:status="overview.upperPlate"
:title="'lbl_recipe_overview_upperPlate' | localize('Controstampo')"
:status="overview.upperPlate"
:haschanges="hasChangedRecipe[6]"
></setup-button>
<setup-button
@@ -62,6 +69,7 @@
:phase="8"
:title="'lbl_recipe_overview_cooling' | localize('Raffreddamento')"
:status="overview.cooling"
:haschanges="hasChangedRecipe[7]"
></setup-button>
<setup-button
@@ -70,6 +78,7 @@
:phase="9"
:title="'lbl_recipe_overview_vacuum' | localize('Vuoto')"
:status="overview.vacuum"
:haschanges="hasChangedRecipe[8]"
></setup-button>
<setup-button
@@ -78,6 +87,7 @@
:phase="10"
:title="'lbl_recipe_overview_extraction' | localize('Estrazione')"
:status="overview.extraction"
:haschanges="hasChangedRecipe[9]"
></setup-button>
<setup-button
@@ -86,6 +96,7 @@
:phase="11"
:title="'lbl_recipe_overview_options' | localize('Opzioni di lavorazione')"
:status="overview.options"
:haschanges="hasChangedRecipe[10]"
></setup-button>
</div>
</template>
@@ -49,6 +49,20 @@ export default class ShowControstampoInfo extends Vue {
// this.deferred.resolve(-1);
};
@Watch('payload', { deep: true })
async payloadChanged(n, o) {
for (var key in n) {
if (Object.prototype.hasOwnProperty.call(n, key)) {
if(n[key].setpointHMI != n[key].setpointPLC){
messageService.publishToChannel("changed-recipe",6,true);
return;
}
}
}
messageService.publishToChannel("changed-recipe",6,false);
};
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
this.debouncedRecipeSave()
@@ -38,6 +38,20 @@ export default class ShowEstrazioneInfo extends Vue {
// this.deferred.resolve(-1);
};
@Watch('payload', { deep: true })
async payloadChanged(n, o) {
for (var key in n) {
if (Object.prototype.hasOwnProperty.call(n, key)) {
if(n[key].setpointHMI != n[key].setpointPLC){
messageService.publishToChannel("changed-recipe",9,true);
return;
}
}
}
messageService.publishToChannel("changed-recipe",9,false);
};
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
this.debouncedRecipeSave()
@@ -60,6 +60,20 @@ export default class ShowFormatoInfo extends Vue {
// this.deferred.resolve(-1);
};
@Watch('payload', { deep: true })
async payloadChanged(n, o) {
for (var key in n) {
if (Object.prototype.hasOwnProperty.call(n, key)) {
if(n[key].setpointHMI != n[key].setpointPLC){
recipeActions.setIntState(store, {id: 0,value: true});
return;
}
}
}
recipeActions.setIntState(store, {id: 0,value: false});
};
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
this.debouncedRecipeSave()
@@ -49,6 +49,19 @@ export default class ShowImbutituraInfo extends Vue {
// this.deferred.resolve(-1);
};
@Watch('payload', { deep: true })
async payloadChanged(n, o) {
for (var key in n) {
if (Object.prototype.hasOwnProperty.call(n, key)) {
if(n[key].setpointHMI != n[key].setpointPLC){
messageService.publishToChannel("changed-recipe",5,true);
return;
}
}
}
messageService.publishToChannel("changed-recipe",5,false);
};
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
this.debouncedRecipeSave()
@@ -41,6 +41,19 @@ export default class ShowOpzioniInfo extends Vue {
};
@Watch('payload', { deep: true })
async payloadChanged(n, o) {
for (var key in n) {
if (Object.prototype.hasOwnProperty.call(n, key)) {
if(n[key].setpointHMI != n[key].setpointPLC){
messageService.publishToChannel("changed-recipe",10,true);
return;
}
}
}
messageService.publishToChannel("changed-recipe",10,false);
};
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
this.debouncedRecipeSave()
@@ -39,6 +39,20 @@ export default class ShowPirometroInfo extends Vue {
// ModalHelper.HideModal();
// this.deferred.resolve(-1);
};
@Watch('payload', { deep: true })
async payloadChanged(n, o) {
for (var key in n) {
if (Object.prototype.hasOwnProperty.call(n, key)) {
if(n[key].setpointHMI != n[key].setpointPLC){
messageService.publishToChannel("changed-recipe",4,true);
return;
}
}
}
messageService.publishToChannel("changed-recipe",4,false);
};
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
@@ -82,6 +82,20 @@ export default class ShowQuoteVelocitaInfo extends Vue {
// this.deferred.resolve(-1);
};
@Watch('payload', { deep: true })
async payloadChanged(n, o) {
for (var key in n) {
if (Object.prototype.hasOwnProperty.call(n, key)) {
if(n[key].setpointHMI != n[key].setpointPLC){
messageService.publishToChannel("changed-recipe",1,true);
return;
}
}
}
messageService.publishToChannel("changed-recipe",1,false);
};
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
this.debouncedRecipeSave()
@@ -53,6 +53,20 @@ export default class Raffreddamento extends Vue {
// this.deferred.resolve(-1);
};
@Watch('payload', { deep: true })
async payloadChanged(n, o) {
for (var key in n) {
if (Object.prototype.hasOwnProperty.call(n, key)) {
if(n[key].setpointHMI != n[key].setpointPLC){
messageService.publishToChannel("changed-recipe",7,true);
return;
}
}
}
messageService.publishToChannel("changed-recipe",7,false);
};
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
this.debouncedRecipeSave()
@@ -52,11 +52,25 @@ export default class ShowRiscaldamentoSuperioreInfo extends Vue {
// this.deferred.resolve(-1);
};
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
this.debouncedRecipeSave()
};
@Watch('payload', { deep: true })
async payloadChanged(n, o) {
for (var key in n) {
if (Object.prototype.hasOwnProperty.call(n, key)) {
if(n[key].setpointHMI != n[key].setpointPLC){
messageService.publishToChannel("changed-recipe",3,true);
return;
}
}
}
messageService.publishToChannel("changed-recipe",3,false);
};
async warmersChanged() {
this.warmersEdited = true;
};
@@ -135,11 +149,6 @@ export default class ShowRiscaldamentoSuperioreInfo extends Vue {
if (el.status.visible && el.status.enabled)
if (el.setpointHMI != el.setpointPLC) result = true;
}
/*
for (const key in store.state.warmers.channels) {
const el = store.state.warmers.channels[key];
if (el.setpointHMI != el.setpointPLC) result = true;
}*/
return result;
}
@@ -45,6 +45,19 @@ export default class ShowVuotoInfo extends Vue {
};
@Watch('payload', { deep: true })
async payloadChanged(n, o) {
for (var key in n) {
if (Object.prototype.hasOwnProperty.call(n, key)) {
if(n[key].setpointHMI != n[key].setpointPLC){
messageService.publishToChannel("changed-recipe",8,true);
return;
}
}
}
messageService.publishToChannel("changed-recipe",8,false);
};
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
this.debouncedRecipeSave()
@@ -5,6 +5,7 @@ export interface RecipeStoreModel {
current: Recipe.IRecipe;
overview: Overview.IOverview;
changed: boolean;
intChanges: Map<number,boolean>;
}
@@ -14,12 +15,14 @@ export interface RecipeActions {
setCurrent(context, model: Recipe.IRecipe, avoidSetpointHMI: boolean);
setOverview(context, model: Overview.IOverview);
resetCheckPoint(context);
setIntState(context,model: { id: number, value: boolean });
}
export interface RecipeGetters {
getCurrent: () => Recipe.IRecipe;
getOverview: () => Overview.IOverview;
getRecipeItem: (id: number) => Recipe.IValue;
getIntStates: (id: number) => boolean;
}
export const recipeStore = {
@@ -39,6 +42,7 @@ export const recipeStore = {
upperPlate: "",
vacuum: ""
},
intChanges: new Map<number, boolean>(),
changed: false,
canUpdateRecipe: true,
_map: new Map<number, Recipe.IValue>()
@@ -47,7 +51,14 @@ export const recipeStore = {
getters: {
getCurrent: (state) => (): Recipe.IRecipe => (state as RecipeStoreModel).current,
getOverview: (state) => (): Overview.IOverview => (state as RecipeStoreModel).overview,
getRecipeItem: (state) => (id): Recipe.IValue => (state._map as Map<number, Recipe.IValue>).get(id)
getRecipeItem: (state) => (id): Recipe.IValue => (state._map as Map<number, Recipe.IValue>).get(id),
getIntStates: state => (id): boolean => {
if((state.intChanges as Map<number, boolean>).hasOwnProperty(id))
return (state.intChanges as Map<number, boolean>).get(id);
else
return false;
}
},
mutations: {
@@ -91,6 +102,15 @@ export const recipeStore = {
m.checkpointHMI = m.setpointHMI;
}
},
SetIntState(state,model: { id: number, value: boolean }) {
if ((state.intChanges as Map<number, boolean>).hasOwnProperty(model.id)) {
state.intChanges[model.id] = model.value;
}else {
(state.intChanges as Map<number, boolean>).set(model.id, model.value)
}
console.log(state.intChanges);
},
SetOverview(state, model: Overview.IOverview) {
for (const key in model) {
if (model.hasOwnProperty(key)) {
@@ -118,6 +138,9 @@ export const recipeStore = {
resetCheckPoint(context) {
context.commit("ResetCheckpoint");
},
setIntState(context,model: { id: number, value: boolean }) {
context.commit("SetIntState",model);
},
async setCurrent(context, model: Recipe.IRecipe, avoidSetpointHMI: boolean = false) {
context.commit("SetCurrent", { avoidSetpoint: avoidSetpointHMI, recipe: model });