diff --git a/Step/wwwroot/src/components/production.ts b/Step/wwwroot/src/components/production.ts new file mode 100644 index 00000000..77a8840d --- /dev/null +++ b/Step/wwwroot/src/components/production.ts @@ -0,0 +1,181 @@ +import Vue from "vue"; +import softkeysPrefered from "../modules/base-components/cards/softkeys-prefered.vue" +import headProduction from "../modules/heads/head-production.vue" +import cardAxesProduction from "../modules/base-components/cards/card-axes-production.vue" +import processSelectionMaintenance from "../modules/base-components/cards/process-selection-maintenance.vue"; +import cardProductionCms from "../modules/base-components/cards/card-production-cms.vue"; +import { Hub } from "src/services/hub"; +import { Factory, MessageService, awaiter } from "src/_base"; +import { appModelActions, alarmsModelActions, store } from "src/store"; +import { ModalHelper } from "src/modules/base-components"; +import { DataService } from '../services/dataService'; +import Component from "vue-class-component"; +import { Watch } from "vue-property-decorator"; + +@Component({ + components: { + softkeysPrefered, headProduction, cardAxesProduction, processSelectionMaintenance, cardProductionCms + } +}) +export default class Production extends Vue { + + isCnReady: Function; + + activeCms = true; + activeCnc = false; + headsR = []; + selectedHead = null; + selectedPositionTop = 0; + userSubkeysMenuOpened = false; + waitingForSftkConfirm = false; + confirmationDelegate = null; + + async created() { + await awaiter(new DataService().GetUserSoftkeyFavorite()); + } + async mounted() { + this.confirmationDelegate = null; + ModalHelper.HideModal("modal2"); + } + + get machineInfo() { + return this.$store.state.machineInfo; + } + get heads() { + return this.$store.state.machineInfo.heads; + } + softkeyFavorite() { + function compare(a, b) { + if (a.id < b.id) { + return -1; + } + if (a.id > b.id) { + return 1; + } + return 0; + } + + var array = this.$store.state.machineInfo.softkeysFavorites; + return array.sort(compare); + } + + @Watch("activeCnc") + activeCncChanged() { + if (this.activeCnc) { + Factory.Get(MessageService).publishToChannel("HMI-production-show"); + Factory.Get(MessageService).publishToChannel("HMI-production-show-state"); + } + else { + Factory.Get(MessageService).publishToChannel("HMI-production-hide"); + Factory.Get(MessageService).publishToChannel("HMI-production-hide-state"); + } + } + + beforeDestroy() { + Factory.Get(MessageService).publishToChannel("HMI-production-hide"); + Factory.Get(MessageService).publishToChannel("HMI-production-hide-state"); + } + + closeAlarmsRibbon() { + alarmsModelActions.toggleOpened(this.$store, false); + alarmsModelActions.toggleServiceOpened(this.$store, false); + } + selectHead(h) { + this.selectedHead = h; + } + getHeadsProperty(id) { + var r = this.$store.getters.getHeadsProperty(id); + return r || {}; + } + clickCms() { + this.activeCms = true; + this.activeCnc = false; + } + clickCnc() { + this.activeCnc = true; + this.activeCms = false; + } + ncClick(id) { + Hub.Current.ncSoftKeyClick(id); + } + isReadOnly(id) { + let r = this.$store.getters.getNcSoftKeyInfo(id); + if (r) return r.isReadOnly; + return false; + } + isKeyActive(id) { + let r = this.$store.getters.getNcSoftKeyStatus(id); + if (r) return r.active; + return false; + } + name(id) { + let r = this.$store.getters.getNcSoftKeyInfo(id); + if (r) return r.visualizedName; + return null; + } + isKeySelected(id) { + let r = this.$store.getters.getNcSoftKeyStatus(id); + if (r) return r.value; + return false; + } + overrideMinus(id) { + Hub.Current.headOverrideMinus(id); + } + overridePlus(id) { + Hub.Current.headOverridePlus(id); + } + positionBox(arg1, arg2) { + this.selectedPositionTop = (arg1.offsetTop - (this.$refs.scrollable as any).scrollTop - (this.$refs.scrollable as any).offsetHeight + 155); + this.userSubkeysMenuOpened = arg2; + } + toggleMainView() { + Factory.Get(MessageService).publishToChannel("enable-selected-softkeys-prefered", true); + appModelActions.MainViewToggle(this.$store); + } + getSubKeysActive(keys) { + let result = {}; + for (const key in keys) { + result[key] = this.getSoftKeyActive(key); + } + return result; + } + getSoftKeyActive(id) { + if (!this.isCnReady()) return false; + var sk = this.$store.getters.getSoftKeyStatus(id); + if (sk) + return sk.active; + return false; + } + softKeyChanged(id, confirm) { + if (!confirm) + Hub.Current.sendUserSoftKey(id); + else { + this.confirmationDelegate = () => { + Hub.Current.sendUserSoftKey(id); + }; + this.waitingForSftkConfirm = true; + } + } + sendKeyCancel() { + this.confirmationDelegate = null; + } + sendKeyConfirm() { + if (this.confirmationDelegate) + this.confirmationDelegate(); + this.confirmationDelegate = null; + } + getSubKeysStatus(keys) { + let result = {}; + for (const key in keys) { + result[key] = this.getSoftKeyStatus(key); + } + return result; + } + getSoftKeyStatus(id) { + if (!this.isCnReady()) return false; + var sk = this.$store.getters.getSoftKeyStatus(id); + if (sk) + return sk.value; + return false; + } +}; diff --git a/Step/wwwroot/src/components/production.vue b/Step/wwwroot/src/components/production.vue index 1b98818b..e773f056 100644 --- a/Step/wwwroot/src/components/production.vue +++ b/Step/wwwroot/src/components/production.vue @@ -11,7 +11,7 @@ -
+
@@ -32,7 +32,7 @@ - + @@ -99,185 +99,6 @@
- \ No newline at end of file + diff --git a/Step/wwwroot/src/modules/base-components/cards/card-queue-production.vue b/Step/wwwroot/src/modules/base-components/cards/card-queue-production.vue index 8ba8442e..c9e896c2 100644 --- a/Step/wwwroot/src/modules/base-components/cards/card-queue-production.vue +++ b/Step/wwwroot/src/modules/base-components/cards/card-queue-production.vue @@ -120,7 +120,7 @@ export default { this.draggingIn = false; this.draggingItem = null; var itemsPositions = {objectId: event.payload.id, newPosition: event.addedIndex, oldPosition: event.removedIndex}; - await new FileService().moveItemsQueue(this.selectedProcess,itemsPositions,this.partPrograms); + await new FileService().moveItemsQueue(this.selectedProcess,itemsPositions,event.payload); } else{ diff --git a/Step/wwwroot/src/services/fileService.ts b/Step/wwwroot/src/services/fileService.ts index 72512217..5d609377 100644 --- a/Step/wwwroot/src/services/fileService.ts +++ b/Step/wwwroot/src/services/fileService.ts @@ -12,7 +12,7 @@ export class FileService extends baseRestService { } async getFileInfo(path: string) { - var result = await this.Get(this.BASE_URL + "file/info", true, { + var result = await this.Get(this.BASE_URL + "file/info", true, { filePath: path }); @@ -29,37 +29,37 @@ export class FileService extends baseRestService { return await this.Put(this.BASE_URL + "file/deactivate", null); } - async deleteQueue(processId){ + async deleteQueue(processId) { var result = await this.Delete(this.BASE_URL + "queue/" + processId + "/empty", true); productionActions.deletePartPrograms(store); return result; } - async deleteItemQueue(processId, model){ + async deleteItemQueue(processId, model) { var result = await this.Delete(this.BASE_URL + "queue/" + processId + "/remove/" + model.id, true); - productionActions.deletePartProgram(store,model); + productionActions.deletePartProgram(store, model); return result; } - async moveItemsQueue(processId, position, model){ + async moveItemsQueue(processId, position, model) { + productionActions.movePartProgram(store, { model, position }); var result = await this.Put(this.BASE_URL + "queue/" + processId + "/move", position, true); - model = result; - productionActions.movePartProgram(store,{model,position}); + // productionActions.movePartProgram(store, { model: result, position }); return result; } - async startQueue(processId){ + async startQueue(processId) { var result = await this.Post(this.BASE_URL + "queue/start?processId=" + processId, null); return result; } - async stopQueue(processId){ + async stopQueue(processId) { var result = await this.Post(this.BASE_URL + "queue/stop?processId=" + processId, null); return result; } - async changeReps(processId,model){ - var result = await this.Put(this.BASE_URL + "queue/" + processId + "/edit/" + model.id, {reps: model.reps}); + async changeReps(processId, model) { + var result = await this.Put(this.BASE_URL + "queue/" + processId + "/edit/" + model.id, { reps: model.reps }); productionActions.updatePartProgram(store, result); return result; }