diff --git a/Step.Config/Config/serverConfig.xml b/Step.Config/Config/serverConfig.xml index 66484c93..562bbb4b 100644 --- a/Step.Config/Config/serverConfig.xml +++ b/Step.Config/Config/serverConfig.xml @@ -1,7 +1,7 @@ - SIEMENS + DEMO true localhost 8080 @@ -15,6 +15,6 @@ en true localhost - true + false \ No newline at end of file diff --git a/Step/wwwroot/src/App.ts b/Step/wwwroot/src/App.ts new file mode 100644 index 00000000..f3815baa --- /dev/null +++ b/Step/wwwroot/src/App.ts @@ -0,0 +1,209 @@ +import Vue from "vue"; +import { Hub } from "./services/hub"; +import { Header, Footer } from "./app.modules"; +import { Login } from "src/app_modules/machine"; +import { alarmList } from "src/app_modules/alarms"; +import { LoginService } from "src/services/loginService"; +import { DataService } from "src/services/dataService"; +import { Factory, MessageService } from "./_base"; +import { ModalContainer } from "./modules/base-components"; +import { ModalHelper } from "src/components/modals" +import { appModelActions } from "src/store"; +import { underTheHood } from "src/app_modules/under-the-hood"; + +import * as iziToast from "izitoast"; +import moment from "moment"; +import Component from "vue-class-component"; +import { Watch } from "vue-property-decorator"; + +declare var cmsClient; + +@Component({ + name: "app", + components: { + appHeader: Header, + appFooter: Footer, + modalContainer: ModalContainer, + alarmList, + underTheHood + } +}) +export default class app extends Vue { + + $route: any; + + state = this.$store.state; + applyBlur = false; + showHeaderOnBlur = false; + applyBlurInternal = false; + showHMIinProduction = false; + loadingOperations = 0; + HMIsrc = null; + hub: Hub = null; + + beforeMount() { + moment.locale((window.navigator as any).userLanguage || window.navigator.language); + } + mounted() { + let ms = Factory.Get(MessageService); + + // if cms is connected + if (typeof cmsClient != "undefined") + this.HMIsrc = cmsClient.getScreenBase64(); + + ms.subscribeToChannel("show-modal", args => { + this.applyBlur = true; + this.showHeaderOnBlur = false; + if (args[3]) this.showHeaderOnBlur = args[3]; + }); + + ms.subscribeToChannel("hide-modal", args => { + this.applyBlur = false; + }); + + ms.subscribeToChannel("show-modal2", args => { + this.applyBlurInternal = true; + }); + + ms.subscribeToChannel("hide-modal2", args => { + this.applyBlurInternal = false; + }); + + ms.subscribeToChannel("show-loading", args => { + this.loadingOperations++; + }); + ms.subscribeToChannel("hide-loading", args => { + this.loadingOperations--; + }); + ms.subscribeToChannel("force-ui-update", args => { + this.$forceUpdate(); + }); + ms.subscribeToChannel("HMI-production-show-state", args => { + this.showHMIinProduction = true; + }); + ms.subscribeToChannel("HMI-production-hide-state", args => { + this.showHMIinProduction = false; + }); + + let $this = this; + Factory.Get(LoginService) + .getUserInfo() + .then(() => { + if (!$this.isAuthenticated) + $this.$nextTick(() => ModalHelper.ShowModal(Login)); + }); + + this.$store.watch( + s => s.currentUser, + (n, o) => { + if (!n) { + this.$nextTick(() => ModalHelper.ShowModal(Login)); + } else + new DataService().SetCurrentNcLanguage( + this.$store.state.currentUser.language + ); + } + ); + + this.hub = new Hub(); + + window.addEventListener("keyup", function (event) { + // If down arrow was pressed... + if (event.keyCode == 27) { + Factory.Get(MessageService).publishToChannel("esc_pressed"); + } + }); + } + get isAuthenticated() { + return this.$store.state.currentUser != null; + } + get debugStore() { + return this.$store.state; + } + get isMainViewLiftedUp() { + return this.$store.state.isMainViewLiftedUp; + } + + @Watch("isMainViewLiftedUp") + isMainViewLiftedUpChanged() { + if (this.state.isMainViewLiftedUp) { + //Setup the Position of the View + this.applyViewPosition(-window.innerHeight + 84); + + //Hide the HMI if is showed (in production) + Factory.Get(MessageService).publishToChannel("HMI-production-hide"); + //Show the HMI with delay (For the animation) + Factory.Get(MessageService).publishToChannel("HMI-show", 500); + } else { + //Setup the Position of the View + this.applyViewPosition(0); + + //Hide the HMI + Factory.Get(MessageService).publishToChannel("HMI-hide"); + //Launche the show in delay if we are in production + if (this.showHMIinProduction && this.$route.path.includes("production")) + Factory.Get(MessageService).publishToChannel( + "HMI-production-show", + 700 + ); + } + } + @Watch("loadingOperations") + loadingOperationsChanged(n, o) { + if (o == 0 && n > 0) { + (iziToast as any).show({ + id: "loader", + class: "t-loading", + theme: "dark", + icon: "fa fa-refresh fa-spin fa-2x fa-fw", + position: "bottomLeft", + animateInside: false, + timeout: false, + transitionIn: "fadeIn", + transitionOut: "fadeOut", + toastOnce: true + }); + } + + if (n == 0 || n < 0) { + this.loadingOperations = 0; + let element = document.querySelector(".t-loading"); + if (element) (iziToast as any).hide(element, { transitionOut: "fadeOut" }); + } + } + + callHub() { + this.hub.Hello(); + } + onstartdrag() { + Factory.Get(MessageService).publishToChannel("HMI-start-drag"); + } + onstopdrag() { + Factory.Get(MessageService).publishToChannel("HMI-stop-drag", 600); + } + toggleMainView(direction) { + if (!direction || direction == "down" || direction == "none") + appModelActions.MainViewToggle(this.$store); + else { + this.applyViewPosition(-window.innerHeight + 84); + } + } + sendMessage(name) { + Factory.Get(MessageService).publishToChannel(name); + } + movepanel(e) { + if (e && e.touches && e.touches[0]) { + this.applyViewPosition( + -window.innerHeight + 84 + e.touches[0].screenY, + true + ); + } + } + applyViewPosition(position, removetransition?) { + (this.$refs["main-view"] as any).style = (this.$refs["main-view-handler"] as any).style = + "transform:translateY(" + + position + + "px);" + + (removetransition ? "transition:unset;" : ""); + } +}; diff --git a/Step/wwwroot/src/App.vue b/Step/wwwroot/src/App.vue index 9c6b5ef0..f97ea1e8 100644 --- a/Step/wwwroot/src/App.vue +++ b/Step/wwwroot/src/App.vue @@ -27,209 +27,6 @@ - - + diff --git a/Step/wwwroot/src/app.modules.js b/Step/wwwroot/src/app.modules.js deleted file mode 100644 index 439dd470..00000000 --- a/Step/wwwroot/src/app.modules.js +++ /dev/null @@ -1,107 +0,0 @@ -// GLobal services -import { LoginService } from "./services/loginService"; -import { LocalizationService } from "./services/localizationService"; - -// Page and modules -import Header from "./modules/app-header.vue"; -import Footer from "./modules/app-footer.vue"; - - -import Utilities from "./components/utilities.vue"; - - -export { - LoginService, - LocalizationService, - Header, - Footer, - Utilities, - Tooling -} - -export const Home = () => - import("./components/Home.vue"); - - -export const ModalIframe = () => - import("./modules/base-components/modal-iframe.vue"); - -export const ModalImage = () => - import("./modules/base-components/modal-image.vue"); - - - - - - - - - - - - -export const CreateQueue = () => - import("./components/create-queue.vue"); - -export const SoftKeysPrefered = () => - import("./modules/base-components/cards/softkeys-prefered.vue"); - -/* Da cancellare dopo sviluppo */ -export const MaintenanceProgress = () => - import("./modules/base-components/maintenance-progress.vue"); - - - -export const CreateMaintenance = () => - import("./modules/create-maintenance.vue"); - -export const LoadDepot = () => - import("./modules/base-components/load-depot.vue"); - - - - - - - -// export const Utilities = () => -// import ("./components/utilities.vue"); - -export const MissingTool = () => - import("./modules/base-components/cards/missing-tool.vue"); - -export const CardUtilities = () => - import("./modules/base-components/cards/card-utilities.vue"); -export const CardToolDepot = () => - import("./modules/base-components/cards/card-tool-depot.vue"); - -export const CardAssistedTooling = () => - import("./modules/base-components/cards/card-assisted-tooling.vue"); - - - - - -export const CardFolderPath = () => - import("./modules/base-components/cards/card-folder-path.vue"); - - - - -export const ModalLoadProgram = () => - import("./modules/base-components/modal-load-program.vue"); - -export const ModalJobAddParameter = () => - import("./modules/base-components/modal-job-add-parameter.vue"); - -export const ModalEditJob = () => - import("./modules/base-components/modal-edit-job.vue"); - -export const ModalAddOffsetTool = () => - import("./modules/base-components/modal-add-offset-tool.vue"); - -export const ModalMissingTools = () => - import("./modules/base-components/modal-missing-tools.vue"); - -export const ProgramManagement = () => - import("./modules/program-management.vue"); diff --git a/Step/wwwroot/src/app.modules.ts b/Step/wwwroot/src/app.modules.ts new file mode 100644 index 00000000..5b5fd0f8 --- /dev/null +++ b/Step/wwwroot/src/app.modules.ts @@ -0,0 +1,84 @@ +// GLobal services +import { LoginService } from "./services/loginService"; +import { LocalizationService } from "./services/localizationService"; + +// Page and modules +import Header from "./modules/app-header.vue"; +import Footer from "./modules/app-footer.vue"; + +import Utilities from "./components/utilities.vue"; +import Home from "./components/Home.vue"; +import ModalIframe from "./modules/base-components/modal-iframe.vue"; +import ModalImage from "./modules/base-components/modal-image.vue"; + +import CreateQueue from "./components/create-queue.vue"; + +import SoftKeysPrefered from "./modules/base-components/cards/softkeys-prefered.vue"; + +/* Da cancellare dopo sviluppo */ +import MaintenanceProgress from "./modules/base-components/maintenance-progress.vue"; +import CreateMaintenance from "./modules/create-maintenance.vue"; + +import MissingTool from "./modules/base-components/cards/missing-tool.vue"; +import CardUtilities from "./modules/base-components/cards/card-utilities.vue"; +import CardToolDepot from "./modules/base-components/cards/card-tool-depot.vue"; +import CardAssistedTooling from "./modules/base-components/cards/card-assisted-tooling.vue"; +import CardFolderPath from "./modules/base-components/cards/card-folder-path.vue"; +import ModalLoadProgram from "./modules/base-components/modal-load-program.vue"; +import ModalJobAddParameter from "./modules/base-components/modal-job-add-parameter.vue"; +import ModalEditJob from "./modules/base-components/modal-edit-job.vue"; +import ModalAddOffsetTool from "./modules/base-components/modal-add-offset-tool.vue"; +import ModalMissingTools from "./modules/base-components/modal-missing-tools.vue"; +import ProgramManagement from "./modules/program-management.vue"; + + + +export { + LoginService, + LocalizationService, + Header, + Footer, + Utilities, + Home, + ModalIframe, + ModalImage, + ProgramManagement, + ModalMissingTools, + ModalAddOffsetTool, + ModalEditJob, + ModalJobAddParameter, + ModalLoadProgram, + CardFolderPath, + CardAssistedTooling, + CardToolDepot, + CardUtilities, + MissingTool, + + CreateMaintenance, + MaintenanceProgress, + SoftKeysPrefered, + CreateQueue +} + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Step/wwwroot/src/app_modules/depot/components/load-depot.ts b/Step/wwwroot/src/app_modules/depot/components/load-depot.ts new file mode 100644 index 00000000..7ba3509e --- /dev/null +++ b/Step/wwwroot/src/app_modules/depot/components/load-depot.ts @@ -0,0 +1,77 @@ + +import { ModalHelper, Modal } from "src/components/modals" +import { DepotService } from 'src/services/depotService'; +import { Factory, MessageService } from 'src/_base'; +import { inputBox } from "src/modules/base-components/cards"; + + +export default { + name: "loaddepot", + components: { modal: Modal, inputBox }, + data: function () { + return { + toolSelected: {}, + positionId: null, + magazineId: null + } + }, + computed: { + availableMultiTools: function () { + return this.$store.state.depot.availableMultiTool; + }, + availableTools: function () { + if (this.isSiemens()) + return this.$store.state.depot.availableTool; + else + return this.$store.state.depot.ncAvailableShank; + } + }, + mounted: function () { + this.$nextTick(function () { + if (this.isSiemens()) + new DepotService().GetToolAvailable(); + else + new DepotService().GetNcToolAvailable(); + + }) + }, + methods: { + close() { + Factory.Get(MessageService).deleteChannel("esc_pressed"); + ModalHelper.HideModal(); + }, + isSiemens: function () { + return this.$store.state.machineInfo.isSiemens; + }, + isPositionCompatible(tool) { + return (this.$store.getters).positionCompatible(tool.id, ModalHelper.loadDepotModal.positionType); + }, + save() { + this.magazineId = ModalHelper.loadDepotModal.magazineId; + this.positionId = ModalHelper.loadDepotModal.positionId; + new DepotService().AddToolToDepot(this.magazineId, this.positionId, { toolId: this.toolSelected.id }).then(response => { + Factory.Get(MessageService).deleteChannel("esc_pressed"); + ModalHelper.HideModal(); + }); + console.log(this.toolSelected); + }, + calcItemName(shank) { + if (shank.childsTools && shank.childsTools.length > 1) + return this.$options.filters.localize("tooling_shank_abbreviation", 'S%d', shank.id); + else + return this.$options.filters.localize("tooling_tool_abbreviation", 'T%d', shank.childsTools[0].id) + " - " + this.calcFamilyName(shank.childsTools[0].id); + }, + familyNameFromId(id) { + var found = this.$store.state.tooling.ncFamilies.find(k => k.id == id); + if (found) + return found.name; + return ''; + }, + calcFamilyName(id) { + if (this.$store.state.tooling.familyOptionActive) + return this.$options.filters.localize("tooling_family_abbreviation", 'F%d', id) + ' - ' + this.familyNameFromId(id); + else + return this.familyNameFromId(id); + } + } +}; diff --git a/Step/wwwroot/src/app_modules/depot/components/load-depot.vue b/Step/wwwroot/src/app_modules/depot/components/load-depot.vue new file mode 100644 index 00000000..8e94c145 --- /dev/null +++ b/Step/wwwroot/src/app_modules/depot/components/load-depot.vue @@ -0,0 +1,29 @@ + + + + + {{'load_depot_lbl_select' | localize("Seleziona l'utensile da aggiungere")}} + + + {{s.name}} - {{'tooling_shank_abbreviation' | localize('S%d',s.id)}} + + {{s.familyName}} - {{'tooling_tool_abbreviation' | localize('T%d',s.id)}} + + + + {{calcItemName(s)}} + + + + + + + + + diff --git a/Step/wwwroot/src/app_modules/depot/index.ts b/Step/wwwroot/src/app_modules/depot/index.ts new file mode 100644 index 00000000..608006b9 --- /dev/null +++ b/Step/wwwroot/src/app_modules/depot/index.ts @@ -0,0 +1,4 @@ +import LoadDepot from "./components/load-depot.vue"; +export { + LoadDepot +} diff --git a/Step/wwwroot/src/app_modules/tooling/components/tooling-depot.ts b/Step/wwwroot/src/app_modules/tooling/components/tooling-depot.ts index 9eee3e25..7eef4f60 100644 --- a/Step/wwwroot/src/app_modules/tooling/components/tooling-depot.ts +++ b/Step/wwwroot/src/app_modules/tooling/components/tooling-depot.ts @@ -9,7 +9,7 @@ import { mapGetters } from 'vuex' import { depotBL } from "src/business-logic/depot-bl"; import { ToolingService } from "src/services/toolingService"; import { ToolingGetters } from "src/store/tooling.store"; -import { LoadDepot } from "src/modules/base-components"; +import { LoadDepot } from "src/app_modules/depot" import { MessageService, Factory, awaiter } from "src/_base"; import { Container, Draggable } from "vue-smooth-dnd"; diff --git a/Step/wwwroot/src/app_modules/under-the-hood/components/plc-softkeys.ts b/Step/wwwroot/src/app_modules/under-the-hood/components/plc-softkeys.ts index dc5d4662..15dddcc5 100644 --- a/Step/wwwroot/src/app_modules/under-the-hood/components/plc-softkeys.ts +++ b/Step/wwwroot/src/app_modules/under-the-hood/components/plc-softkeys.ts @@ -6,9 +6,9 @@ import { Hub } from "src/services/hub"; import { Factory, MessageService, awaiter } from "src/_base"; import { DataService } from "src/services/dataService"; -import onOffSoftKey from "./components/soft-key2.vue"; -import procedureSoftKey from "./components/soft-key3.vue"; -import groupSoftKey from "./components/soft-key1.vue"; +import onOffSoftKey from "./soft-key2.vue"; +import procedureSoftKey from "./soft-key3.vue"; +import groupSoftKey from "./soft-key1.vue"; @Componet({ diff --git a/Step/wwwroot/src/components/loader.ts b/Step/wwwroot/src/components/loader.ts index 743aaf4d..6928790d 100644 --- a/Step/wwwroot/src/components/loader.ts +++ b/Step/wwwroot/src/components/loader.ts @@ -1,13 +1,13 @@ import Vue from "vue"; import Component from "vue-class-component"; -import { Modal } from "src/modules/base-components/components.js"; +import { Modal } from "src/components/modals" @Component({ name: "loader", - components: { Modal }, + components: { Modal }, props: ["title", "message", "percent", "isVisible"], computed: { - isCompleted: function() { + isCompleted: function () { return this.percent == 100; } } @@ -18,61 +18,61 @@ export default class Loader extends Vue { public percent: number; public followAxesNumber: boolean = true; - mounted() {} + mounted() { } - get nameAxes(){ - return this.$store.state.process.axes; + get nameAxes() { + return this.$store.state.process.axes; } - get axesInterpoleted(){ - return this.$store.state.process.valueAxisSelected.interpolated; + get axesInterpoleted() { + return this.$store.state.process.valueAxisSelected.interpolated; } - get axesMachine(){ - return this.$store.state.process.valueAxisSelected.machine; + get axesMachine() { + return this.$store.state.process.valueAxisSelected.machine; } - get axesProgrammePos(){ - return this.$store.state.process.valueAxisSelected.programmePos; + get axesProgrammePos() { + return this.$store.state.process.valueAxisSelected.programmePos; } - get axesToGo(){ - return this.$store.state.process.valueAxisSelected.toGo; + get axesToGo() { + return this.$store.state.process.valueAxisSelected.toGo; } - get numAxes(){ + get numAxes() { if (!this.followAxesNumber) - return null; - - var n = this.$store.state.process.axes.length; - if(n == 7) - return '_7'; - else if(n == 8) - return '_8'; - else if(n == 9) - return '_9'; - else if(n > 9) - return '_9 more9'; return null; + + var n = this.$store.state.process.axes.length; + if (n == 7) + return '_7'; + else if (n == 8) + return '_8'; + else if (n == 9) + return '_9'; + else if (n > 9) + return '_9 more9'; + return null; } - axes(name,value) { - var nameAxes; - var valueAxes; - var newAxis = []; - nameAxes = name; - valueAxes = value; - var keys = Object.keys(valueAxes); - nameAxes.forEach(element => { - for(var key in valueAxes){ - if(element.id == key){ - var axesElement = { - name: element.name, - value: valueAxes[key] - }; - newAxis.push(axesElement); - } - } + axes(name, value) { + var nameAxes; + var valueAxes; + var newAxis = []; + nameAxes = name; + valueAxes = value; + var keys = Object.keys(valueAxes); + nameAxes.forEach(element => { + for (var key in valueAxes) { + if (element.id == key) { + var axesElement = { + name: element.name, + value: valueAxes[key] + }; + newAxis.push(axesElement); + } + } - }); - return newAxis; + }); + return newAxis; } } diff --git a/Step/wwwroot/src/modules/app-header.ts b/Step/wwwroot/src/modules/app-header.ts index 01703a9a..8c9363c4 100644 --- a/Step/wwwroot/src/modules/app-header.ts +++ b/Step/wwwroot/src/modules/app-header.ts @@ -1,14 +1,16 @@ import Vue from "vue"; import Component from "vue-class-component"; -import { AppRibbon, UserInfo, ProcessInfo } from "./base-components"; +import { ProcessInfo } from "./base-components"; import { AppModel, buttonStatus } from "src/store"; import { Factory, MessageService } from "src/_base"; import { Hub } from "src/services/hub"; import { Watch } from "vue-property-decorator"; +import AppRibbon from "src/components/app-ribbon.vue"; +import { UserInfoDialog } from "src/app_modules/machine" declare let $: any; -@Component({ name: "app-header", components: { appRibbon: AppRibbon, userInfo: UserInfo, processInfo: ProcessInfo }, props: {modalOpened: Boolean, showHeaderOnBlur:Boolean} }) +@Component({ name: "app-header", components: { appRibbon: AppRibbon, userInfo: UserInfoDialog, processInfo: ProcessInfo }, props: { modalOpened: Boolean, showHeaderOnBlur: Boolean } }) export default class AppHeader extends Vue { $store: any; diff --git a/Step/wwwroot/src/modules/base-components/components.js b/Step/wwwroot/src/modules/base-components/components.js deleted file mode 100644 index 56bbfb91..00000000 --- a/Step/wwwroot/src/modules/base-components/components.js +++ /dev/null @@ -1,4 +0,0 @@ -import Modal from "./modal.vue"; -import Loader from "./loader.vue"; - -export { Loader, Modal }; \ No newline at end of file diff --git a/Step/wwwroot/src/modules/base-components/index.ts b/Step/wwwroot/src/modules/base-components/index.ts index 786e23a7..23780279 100644 --- a/Step/wwwroot/src/modules/base-components/index.ts +++ b/Step/wwwroot/src/modules/base-components/index.ts @@ -1,7 +1,5 @@ import Popup from "./popup.vue"; -import AppRibbon from "./ribbons/app-ribbon.vue"; -import UserInfo from "./user-info.vue"; import ModalContainer from "./modal-container.vue"; import ProcessInfo from "./process-info.vue"; @@ -10,9 +8,8 @@ import Accordion from "./accordion.vue"; import Keypad from "./keypad.vue"; import cardutilities from "./cards/card-utilities.vue"; import card from "./cards/card.vue"; -import ConfirmModal from "./modal-confirm.vue"; import MaintenanceProgress from "./maintenance-progress.vue"; -import LoadDepot from "./load-depot.vue"; + import CreateMaintenance from "../create-maintenance.vue"; import ModalIframe from "./modal-iframe.vue"; import ModalImage from "./modal-image.vue"; @@ -24,8 +21,6 @@ import ModalJobAddParameter from "./modal-job-add-parameter.vue"; export { Popup, - AppRibbon, - UserInfo, ModalContainer, ProcessInfo, @@ -34,9 +29,8 @@ export { cardutilities, card, - ConfirmModal, MaintenanceProgress, - LoadDepot, + CreateMaintenance, ModalIframe, ModalImage, diff --git a/Step/wwwroot/src/modules/base-components/load-depot.vue b/Step/wwwroot/src/modules/base-components/load-depot.vue deleted file mode 100644 index fe4cf099..00000000 --- a/Step/wwwroot/src/modules/base-components/load-depot.vue +++ /dev/null @@ -1,108 +0,0 @@ - - - - - {{'load_depot_lbl_select' | localize("Seleziona l'utensile da aggiungere")}} - - - {{s.name}} - {{'tooling_shank_abbreviation' | localize('S%d',s.id)}} - - {{s.familyName}} - {{'tooling_tool_abbreviation' | localize('T%d',s.id)}} - - - - {{calcItemName(s)}} - - - - - - - - - diff --git a/Step/wwwroot/src/modules/base-components/modal-iframe.vue b/Step/wwwroot/src/modules/base-components/modal-iframe.vue index 1df73162..607c389e 100644 --- a/Step/wwwroot/src/modules/base-components/modal-iframe.vue +++ b/Step/wwwroot/src/modules/base-components/modal-iframe.vue @@ -4,32 +4,31 @@ - + - - \ No newline at end of file + diff --git a/Step/wwwroot/src/modules/base-components/modal-image.vue b/Step/wwwroot/src/modules/base-components/modal-image.vue index b9b5b7e6..1ff7bc18 100644 --- a/Step/wwwroot/src/modules/base-components/modal-image.vue +++ b/Step/wwwroot/src/modules/base-components/modal-image.vue @@ -3,32 +3,31 @@ - + - - \ No newline at end of file +