diff --git a/Libs/CMS_CORE_Library.dll b/Libs/CMS_CORE_Library.dll index 0ecc73ec..658bcdc2 100644 Binary files a/Libs/CMS_CORE_Library.dll and b/Libs/CMS_CORE_Library.dll differ diff --git a/Step/Controllers/WebApi/ConfigurationController.cs b/Step/Controllers/WebApi/ConfigurationController.cs index 1a3d518c..432e2b6f 100644 --- a/Step/Controllers/WebApi/ConfigurationController.cs +++ b/Step/Controllers/WebApi/ConfigurationController.cs @@ -1,7 +1,9 @@ using Step.Model.DTOModels; +using Step.NC; using System.Collections.Generic; using System.Linq; using System.Web.Http; +using static CMS_CORE_Library.DataStructures; using static Step.Config.ServerConfig; using static Step.Model.Constants; @@ -121,5 +123,19 @@ namespace Step.Controllers.WebApi return Ok(alarmsConfig); } + + [Route("tool_manager"), HttpGet] + public IHttpActionResult GetToolTableConfiguration() + { + using (NcHandler ncHandler = new NcHandler()) + { + ncHandler.Connect(); + CmsError libraryError = ncHandler.GetToolTableConfiguration(out ToolTableConfiguration toolTableConfiguration); + if (libraryError.IsError()) + return BadRequest(libraryError.message); + + return Ok(toolTableConfiguration); + } + } } } \ No newline at end of file diff --git a/Step/Controllers/WebApi/ToolTableController.cs b/Step/Controllers/WebApi/ToolTableController.cs index 40d7571c..30222b02 100644 --- a/Step/Controllers/WebApi/ToolTableController.cs +++ b/Step/Controllers/WebApi/ToolTableController.cs @@ -10,38 +10,19 @@ using static CMS_CORE_Library.DataStructures; namespace Step.Controllers.WebApi { - [RoutePrefix("api/tool_table")] + [RoutePrefix("api/tool_manager")] public class ToolTableController : ApiController { - [Route("configuration"), HttpGet] - public IHttpActionResult GetToolTableConfiguration() - { - using (NcHandler ncHandler = new NcHandler()) - { - ncHandler.Connect(); - CmsError libraryError = ncHandler.GetToolTableConfiguration(out ToolTableConfiguration toolTableConfiguration); - if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) - return BadRequest(libraryError.message); - - return Ok(toolTableConfiguration); - } - } - [Route("tools"), HttpGet] public IHttpActionResult GetToolTable() { using (NcHandler ncHandler = new NcHandler()) { - ncHandler.Connect(); - Stopwatch sw = new Stopwatch(); - sw.Start(); CmsError libraryError = ncHandler.GetToolTableData(out List tools); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); - Console.WriteLine(sw.ElapsedMilliseconds); + return Ok(tools); } } @@ -60,7 +41,6 @@ namespace Step.Controllers.WebApi ncHandler.Connect(); CmsError libraryError = ncHandler.AddTool(ref siemensModel); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(siemensModel); @@ -83,7 +63,6 @@ namespace Step.Controllers.WebApi CmsError libraryError = ncHandler.UpdateTool(ref siemensModel); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(siemensModel); @@ -99,7 +78,6 @@ namespace Step.Controllers.WebApi // Call delete library function CmsError libraryError = ncHandler.DeleteTool(id); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(); @@ -114,7 +92,6 @@ namespace Step.Controllers.WebApi ncHandler.Connect(); CmsError libraryError = ncHandler.GetFamiliesData(out List families); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(families); @@ -132,7 +109,6 @@ namespace Step.Controllers.WebApi ncHandler.Connect(); CmsError libraryError = ncHandler.AddFamily(family.Name, out FamilyModel newFamily); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(newFamily); @@ -151,7 +127,6 @@ namespace Step.Controllers.WebApi CmsError libraryError = ncHandler.UpdateFamilyName(oldName, family.Name); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(family); @@ -167,7 +142,6 @@ namespace Step.Controllers.WebApi // Call delete library function CmsError libraryError = ncHandler.DeleteFamily(name); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(); @@ -182,7 +156,6 @@ namespace Step.Controllers.WebApi ncHandler.Connect(); CmsError libraryError = ncHandler.GetMagazinesPositionsData(out List magazines); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(magazines); @@ -210,7 +183,6 @@ namespace Step.Controllers.WebApi // Update CmsError libraryError = ncHandler.UpdateMagazinePosition(pos); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(); @@ -225,7 +197,6 @@ namespace Step.Controllers.WebApi ncHandler.Connect(); CmsError libraryError = ncHandler.GetShanksData(out List shanks); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(shanks); @@ -245,7 +216,6 @@ namespace Step.Controllers.WebApi ncHandler.Connect(); CmsError libraryError = ncHandler.AddShank(ref shank); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(shank); @@ -266,7 +236,6 @@ namespace Step.Controllers.WebApi ncHandler.Connect(); CmsError libraryError = ncHandler.UpdateShank(ref shank); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(shank); @@ -282,7 +251,6 @@ namespace Step.Controllers.WebApi // Call delete library function CmsError libraryError = ncHandler.DeleteShank(id); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(); @@ -304,7 +272,6 @@ namespace Step.Controllers.WebApi // Call library add methods CmsError libraryError = ncHandler.AddEdge(toolId, ref edge); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(edge); @@ -327,7 +294,6 @@ namespace Step.Controllers.WebApi // Call library add methods CmsError libraryError = ncHandler.UpdateEdge(toolId, ref edge); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(edge); @@ -343,7 +309,6 @@ namespace Step.Controllers.WebApi // Call delete library function CmsError libraryError = ncHandler.DeleteEdge(toolId, edgeId); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(); @@ -359,7 +324,6 @@ namespace Step.Controllers.WebApi // Call delete library function CmsError libraryError = ncHandler.GetMagazinePositionsAndTools(magazineId, out List magazinePos); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(magazinePos); @@ -375,7 +339,6 @@ namespace Step.Controllers.WebApi // Call delete library function CmsError libraryError = ncHandler.GetNotInMagazinesTools(out List multiTools, out List tools); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(new @@ -400,7 +363,6 @@ namespace Step.Controllers.WebApi // Call delete library function CmsError libraryError = ncHandler.LoadToolInMagazine(magazineId, libraryMag); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(newMag); @@ -420,7 +382,6 @@ namespace Step.Controllers.WebApi // Call delete library function CmsError libraryError = ncHandler.UnloadToolInMagazine(magazineId, positionId); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(); @@ -439,7 +400,6 @@ namespace Step.Controllers.WebApi CmsError libraryError = ncHandler.LoadTooolFromShank(shankId, positionId, toolId); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(); @@ -458,7 +418,6 @@ namespace Step.Controllers.WebApi CmsError libraryError = ncHandler.UnloadTooolFromShank(shankId, positionId, toolId); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(); diff --git a/Step/wwwroot/src/App.vue b/Step/wwwroot/src/App.vue index 8b0c1f3f..96e687fe 100644 --- a/Step/wwwroot/src/App.vue +++ b/Step/wwwroot/src/App.vue @@ -7,6 +7,7 @@
+
diff --git a/Step/wwwroot/src/app.modules.js b/Step/wwwroot/src/app.modules.js index 602fbcb0..48b3cf50 100644 --- a/Step/wwwroot/src/app.modules.js +++ b/Step/wwwroot/src/app.modules.js @@ -68,15 +68,10 @@ export const MaintenanceCard = () => export const MaintenanceWizard = () => import ("./modules/base-components/cards/card-maintenance-wizard.vue"); -export const ModalConfirmDelete = () => - import ("./modules/modal-confirm-delete.vue"); - export const CreateMaintenance = () => import ("./modules/create-maintenance.vue"); - - // export const Utilities = () => // import ("./components/utilities.vue"); diff --git a/Step/wwwroot/src/app.routes.js b/Step/wwwroot/src/app.routes.js index f4d681ac..8dcdae44 100644 --- a/Step/wwwroot/src/app.routes.js +++ b/Step/wwwroot/src/app.routes.js @@ -22,9 +22,7 @@ import { CardToolDepot, MaintenanceWizard, - ModalConfirmDelete, CreateMaintenance - } from "./app.modules"; export let routes = [ @@ -50,9 +48,7 @@ export let routes = [ { path: "/maintenance-progress", component: MaintenanceProgress, meta: { title: "Step - Maintenance-Progress", area: "maintenance-progress" } }, { path: "/maintenance-card", component: MaintenanceCard, meta: { title: "Step - Maintenance-Card", area: "maintenance-card" } }, { path: "/card-maintenance-wizard", component: MaintenanceWizard, meta: { title: "Step - Maintenance-Wizard", area: "card-maintenance-wizard" } }, - { path: "/modal-confirm-delete", component: ModalConfirmDelete, meta: { title: "Step - Modal-Confirm-Delete", area: "modal-confirm-delete" } }, - { path: "/create-maintenance", component: CreateMaintenance, meta: { title: "Step - Create-Maintenance", area: "create-maintenance" } }, - + { path: "/create-maintenance", component: CreateMaintenance, meta: { title: "Step - Create-Maintenance", area: "create-maintenance" } }, { path: "/report", meta: { title: "Step - Reports", area: "report" } }, { path: "/alarms", meta: { title: "Step - Alarms", area: "alarms" } }, { path: "/maintenance", component: Maintenance, meta: { title: "Step - Maintenance", area: "maintenance" } }, diff --git a/Step/wwwroot/src/components/depot.vue b/Step/wwwroot/src/components/depot.vue index 7406efa3..a9243d70 100644 --- a/Step/wwwroot/src/components/depot.vue +++ b/Step/wwwroot/src/components/depot.vue @@ -9,7 +9,7 @@ {{'depot_title' | localize("Magazzino")}} {{depotId}} - Lineare
- +
diff --git a/Step/wwwroot/src/components/tooling-equipment.ts b/Step/wwwroot/src/components/tooling-equipment.ts index 4f8bc9f9..a8bf7285 100644 --- a/Step/wwwroot/src/components/tooling-equipment.ts +++ b/Step/wwwroot/src/components/tooling-equipment.ts @@ -4,6 +4,7 @@ import { equipment, inputBox } from "src/modules/base-components/cards"; import { ToolingService } from "../services/toolingService"; import { store, AppModel } from "src/store"; import { toolingActions } from "../store/tooling.store"; +import { ModalHelper } from "../modules/base-components"; declare let $: any; @@ -13,10 +14,10 @@ export default class toolingEquipment extends Vue { public get tools(): server.Tool[] { return (this.$store.state as AppModel).tooling.tools; } public searchText: string = ""; - public currentFilter : string = ""; + public currentFilter: string = ""; - public applyFilter(){ - this.currentFilter = this.searchText; + public applyFilter() { + this.currentFilter = this.searchText.toLowerCase(); } public toolsConfiguration: server.ToolsConfiguration[] = null; @@ -27,7 +28,7 @@ export default class toolingEquipment extends Vue { public selectedEquipment: any = null; public get categories(): string[] { - let cat: Set= new Set(); + let cat: Set = new Set(); for (const key in this.toolsConfiguration) { let t = this.toolsConfiguration[key]; cat.add(t.category); @@ -36,7 +37,7 @@ export default class toolingEquipment extends Vue { } public get categoriesEdge(): string[] { - let cat: Set= new Set(); + let cat: Set = new Set(); for (const key in this.edgeConfiguration) { let t = this.edgeConfiguration[key]; cat.add(t.category); @@ -64,7 +65,7 @@ export default class toolingEquipment extends Vue { }); } - public selectTool(item){ + public selectTool(item) { this.toolsConfiguration = (this.$store.state as AppModel).tooling.toolsConfiguration; this.edgeConfiguration = (this.$store.state as AppModel).tooling.edgesConfiguration; this.selectedTool = item; @@ -74,60 +75,60 @@ export default class toolingEquipment extends Vue { this.enableModify = false; } - public modify(){ + public modify() { this.enableModify = true; this.disableList = true; } - public fieldTool(){ + public fieldTool() { this.toolsConfiguration = []; - for(let f in (this.$store.state as AppModel).tooling.toolsConfiguration){ + for (let f in (this.$store.state as AppModel).tooling.toolsConfiguration) { let element = (this.$store.state as AppModel).tooling.toolsConfiguration[f]; - if(!element.readOnly){ + if (!element.readOnly) { this.toolsConfiguration.push(element); } } } - public addEquipment(){ + public addEquipment() { this.selectedTool = {}; this.enableModify = true; this.disableList = true; this.fieldTool(); } - public getDynamicFields(tooltype : string): Array{ + public getDynamicFields(tooltype: string): Array { var typeid = parseInt(tooltype); return (this.$store.state as AppModel).tooling.edgesAdditionalParamsConfiguration[typeid]; } - public fieldEdge(obj){ + public fieldEdge(obj) { this.edgeConfiguration = []; for (const key in (this.$store.state as AppModel).tooling.edgesConfiguration) { - const element = (this.$store.state as AppModel).tooling.edgesConfiguration[key]; - if (!element.readOnly) { - this.edgeConfiguration.push(element); - } - obj[element.name] = 0; + const element = (this.$store.state as AppModel).tooling.edgesConfiguration[key]; + if (!element.readOnly) { + this.edgeConfiguration.push(element); + } + obj[element.name] = 0; } let fields = this.getDynamicFields(this.selectedTool.toolType); for (const key in fields) { - const element = fields[key]; - obj.edgeAdditionalParams[element] = 0; + const element = fields[key]; + obj.edgeAdditionalParams[element] = 0; } } - public selectTab(elem){ - if(elem == 'Parameters'){ + public selectTab(elem) { + if (elem == 'Parameters') { this.enableParameters = true; this.enableEquipment = false; this.selectedEquipment = null; this.enableModify = false; } - else if (elem.id <= 0){ + else if (elem.id <= 0) { this.fieldEdge(elem); this.selectedEquipment = elem; console.log(this.selectedEquipment); @@ -135,15 +136,15 @@ export default class toolingEquipment extends Vue { this.enableParameters = false; this.enableModify = true; } - else if(elem.id > 0){ - this.toolsConfiguration = (this.$store.state as AppModel).tooling.toolsConfiguration; + else if (elem.id > 0) { + this.toolsConfiguration = (this.$store.state as AppModel).tooling.toolsConfiguration; this.edgeConfiguration = (this.$store.state as AppModel).tooling.edgesConfiguration; this.selectedEquipment = elem; this.enableEquipment = true; this.enableParameters = false; this.enableModify = false; } - else{ + else { this.selectedEquipment = null; this.enableParameters = true; this.enableEquipment = false; @@ -158,22 +159,22 @@ export default class toolingEquipment extends Vue { } public getToolIcon = function (id) { - if(id == 9999) + if (id == 9999) return "../assets/images/list-undefined.PNG" - else if(id == 151 || id == 700 ) - return "../assets/images/list-blade.PNG" + else if (id == 151 || id == 700) + return "../assets/images/list-blade.PNG" else return "../assets/images/list-tool.PNG" } private internalCounter = -1; - public addEdge(){ + public addEdge() { this.disableList = true; this.enableModify = true; - var obj = { edgeAdditionalParams:{}}; + var obj = { edgeAdditionalParams: {} }; this.fieldEdge(obj); - obj["id"] = -1; + obj["id"] = -1; this.selectedTool.edgesData.push(obj); this.selectTab(obj); console.log(this.selectedTool.edgesData); @@ -199,10 +200,10 @@ export default class toolingEquipment extends Vue { }); } - async saveEdge(tool, model){ + async saveEdge(tool, model) { delete model.id; - new ToolingService().SetEdgeData(tool,model).then(response => { + new ToolingService().SetEdgeData(tool, model).then(response => { this.toolsConfiguration = (this.$store.state as AppModel).tooling.toolsConfiguration; this.edgeConfiguration = (this.$store.state as AppModel).tooling.edgesConfiguration; this.selectTab(response); @@ -210,44 +211,51 @@ export default class toolingEquipment extends Vue { }); } - async modifyEdge(tool, model){ + async modifyEdge(tool, model) { - new ToolingService().UpdateEdgeData(tool,model).then(response => { + new ToolingService().UpdateEdgeData(tool, model).then(response => { this.toolsConfiguration = (this.$store.state as AppModel).tooling.toolsConfiguration; this.edgeConfiguration = (this.$store.state as AppModel).tooling.edgesConfiguration; this.disableList = false; }); } - async buttonSave(tool: any, edge: any){ + async buttonSave(tool: any, edge: any) { - if(tool.id){ - if(edge && edge.id > 0){ + if (tool.id) { + if (edge && edge.id > 0) { this.modifyEdge(tool, edge); } - else if ( edge && edge.id <= 0){ + else if (edge && edge.id <= 0) { this.saveEdge(tool, edge); } - else{ + else { this.modifyTool(tool); } } - else{ + else { this.save(tool); } } async deleteTool(model) { - new ToolingService().DeleteTool(model).then(response => { - this.selectedTool = null; - }); + ModalHelper.AskConfirm(this.$options.filters.localize("modal_confirm_delete", "Richiesta di conferma"), + this.$options.filters.localize("modal_confirm_delete_tool", "Confermi la cancellazione del tool?"), + () => { + new ToolingService().DeleteTool(model).then(response => { + this.selectedTool = null; + }); + }, null); } - async deleteEdgeData(tool, model){ - - new ToolingService().DeleteEdgeData(tool, model).then(response => { - this.selectedTool = null; - }); + async deleteEdgeData(tool, model) { + ModalHelper.AskConfirm(this.$options.filters.localize("modal_confirm_delete", "Richiesta di conferma"), + this.$options.filters.localize("modal_confirm_delete_edge", "Confermi la cancellazione del tagliente?"), + () => { + new ToolingService().DeleteEdgeData(tool, model).then(response => { + this.selectedTool = null; + }); + }, null); } // async save(item){ diff --git a/Step/wwwroot/src/components/tooling-equipment.vue b/Step/wwwroot/src/components/tooling-equipment.vue index 5a068750..86278a50 100644 --- a/Step/wwwroot/src/components/tooling-equipment.vue +++ b/Step/wwwroot/src/components/tooling-equipment.vue @@ -20,7 +20,7 @@
- diff --git a/Step/wwwroot/src/components/tooling-families.ts b/Step/wwwroot/src/components/tooling-families.ts index cf661392..f5a1410f 100644 --- a/Step/wwwroot/src/components/tooling-families.ts +++ b/Step/wwwroot/src/components/tooling-families.ts @@ -17,7 +17,7 @@ export default class toolingFamilies extends Vue { public currentFilter : string = ""; public applyFilter(){ - this.currentFilter = this.searchText; + this.currentFilter = this.searchText.toLowerCase(); } public get categories(): string[] { diff --git a/Step/wwwroot/src/components/tooling-families.vue b/Step/wwwroot/src/components/tooling-families.vue index 0d97f918..4d97702d 100644 --- a/Step/wwwroot/src/components/tooling-families.vue +++ b/Step/wwwroot/src/components/tooling-families.vue @@ -20,7 +20,7 @@
- diff --git a/Step/wwwroot/src/components/tooling-magpos.ts b/Step/wwwroot/src/components/tooling-magpos.ts index 66c1c6b0..a0a4701f 100644 --- a/Step/wwwroot/src/components/tooling-magpos.ts +++ b/Step/wwwroot/src/components/tooling-magpos.ts @@ -16,7 +16,7 @@ export default class toolingMagPos extends Vue { public applyFilter(){ - this.currentFilter = this.searchText; + this.currentFilter = this.searchText.toLowerCase(); } public selectedTool: any = null; diff --git a/Step/wwwroot/src/components/tooling-magpos.vue b/Step/wwwroot/src/components/tooling-magpos.vue index 174c4811..34b2004d 100644 --- a/Step/wwwroot/src/components/tooling-magpos.vue +++ b/Step/wwwroot/src/components/tooling-magpos.vue @@ -20,7 +20,7 @@
- diff --git a/Step/wwwroot/src/components/tooling-shanks.ts b/Step/wwwroot/src/components/tooling-shanks.ts index fe7dbbea..0713d0dc 100644 --- a/Step/wwwroot/src/components/tooling-shanks.ts +++ b/Step/wwwroot/src/components/tooling-shanks.ts @@ -5,6 +5,7 @@ import { ToolingService } from "../services/toolingService"; import { store, AppModel } from "src/store"; import { toolingActions } from "../store/tooling.store"; import { DepotService } from "../services/depotService"; +import { ModalHelper } from "src/modules/base-components"; declare let $: any; @@ -17,17 +18,17 @@ export default class toolingShanks extends Vue { public childToolsShank: server.ToolsConfiguration[] = null; public searchText: string = ""; - public currentFilter : string = ""; + public currentFilter: string = ""; - public applyFilter(){ - this.currentFilter = this.searchText; + public applyFilter() { + this.currentFilter = this.searchText.toLowerCase(); } public get availableTools(): server.Tools[] { return (this.$store.state as AppModel).depot.availableTool; } public get categories(): string[] { - let cat: Set= new Set(); + let cat: Set = new Set(); for (const key in this.shankConfiguration) { let t = this.shankConfiguration[key]; cat.add(t.category); @@ -66,27 +67,27 @@ export default class toolingShanks extends Vue { }); } - public modify(){ + public modify() { this.enableModify = true; this.disableList = true; } - public addShank(){ + public addShank() { this.selectedTool = {}; this.shankConfiguration = []; this.enableModify = true; - for(let f in (this.$store.state as AppModel).tooling.shankConfiguration){ + for (let f in (this.$store.state as AppModel).tooling.shankConfiguration) { let element = (this.$store.state as AppModel).tooling.shankConfiguration[f]; - if(!element.readOnly){ + if (!element.readOnly) { this.shankConfiguration.push(element); } } this.disableList = true; } - public selectTool(item){ + public selectTool(item) { this.selectedTool = item; this.enableParameters = true; this.enableEquipment = false; @@ -98,16 +99,16 @@ export default class toolingShanks extends Vue { } - public selectTab(elem){ + public selectTab(elem) { - if(elem == 'Parameters'){ + if (elem == 'Parameters') { this.enableParameters = true; this.enableEquipment = false; this.enableAddToolToShank = false; this.enableModify = false; this.selectedEquipment = null; } - else if(elem.id <= 0){ + else if (elem.id <= 0) { this.childToolsShank = (this.$store.state as AppModel).tooling.childToolsShank; this.enableParameters = false; this.enableEquipment = false; @@ -115,7 +116,7 @@ export default class toolingShanks extends Vue { this.selectedEquipment = elem; this.enableModify = true; } - else if (elem.id > 0){ + else if (elem.id > 0) { this.shankConfiguration = (this.$store.state as AppModel).tooling.shankConfiguration; this.childToolsShank = (this.$store.state as AppModel).tooling.childToolsShank; this.selectedEquipment = elem; @@ -124,7 +125,7 @@ export default class toolingShanks extends Vue { this.enableModify = false; this.enableAddToolToShank = false; } - else{ + else { this.enableParameters = true; this.enableEquipment = false; this.enableModify = false; @@ -133,12 +134,12 @@ export default class toolingShanks extends Vue { } } - public addToolToShank(){ + public addToolToShank() { new DepotService().GetToolAvailable().then(response => { this.disableList = true; var obj = {}; - obj["id"] = -1; + obj["id"] = -1; this.selectedTool.childsTools.push(obj); // this.enableEquipment = false; // this.enableParameters = false; @@ -156,9 +157,9 @@ export default class toolingShanks extends Vue { } public cancel = function () { - for(let l in this.selectedTool.childsTools){ - if(this.selectedTool.childsTools[l].id <= 0){ - this.selectedTool.childsTools.splice(l,1); + for (let l in this.selectedTool.childsTools) { + if (this.selectedTool.childsTools[l].id <= 0) { + this.selectedTool.childsTools.splice(l, 1); } } this.enableModify = false; @@ -167,12 +168,12 @@ export default class toolingShanks extends Vue { } - async buttonSave(tool: any){ + async buttonSave(tool: any) { - if(tool.id){ + if (tool.id) { this.modifyShank(tool); } - else{ + else { this.save(tool); } } @@ -196,22 +197,22 @@ export default class toolingShanks extends Vue { }); } - public addToolsToShank(shank){ + public addToolsToShank(shank) { let model = this.toolSelected; - for(let l in this.selectedTool.childsTools){ - if(this.selectedTool.childsTools[l].multitoolId){ + for (let l in this.selectedTool.childsTools) { + if (this.selectedTool.childsTools[l].multitoolId) { model.multitoolId = this.selectedTool.childsTools[l].multitoolId + 1; } - if(this.selectedTool.childsTools.length == 0){ + if (this.selectedTool.childsTools.length == 0) { model.multitoolId = 1; } } new ToolingService().addToolToShank(shank, model).then(response => { this.selectTab(response); - for(let l in this.selectedTool.childsTools){ - if(this.selectedTool.childsTools[l].id <= 0){ - this.selectedTool.childsTools.splice(l,1); + for (let l in this.selectedTool.childsTools) { + if (this.selectedTool.childsTools[l].id <= 0) { + this.selectedTool.childsTools.splice(l, 1); } } this.disableList = false; @@ -223,13 +224,16 @@ export default class toolingShanks extends Vue { // this.disableList = false; // }); } - public removeToolsToShank(shank){ - - let model = this.selectedEquipment; - new ToolingService().removeToolToShank(shank, model).then(response => { - this.disableList = false; - this.selectedTool = null; - }) + public removeToolsToShank(shank) { + ModalHelper.AskConfirm(this.$options.filters.localize("modal_confirm_delete", "Richiesta di conferma"), + this.$options.filters.localize("modal_confirm_delete_tool", "Confermi la cancellazione del tool?"), + () => { + let model = this.selectedEquipment; + new ToolingService().removeToolToShank(shank, model).then(response => { + this.disableList = false; + this.selectedTool = null; + }) + }, null); // new ToolingService().SetEdgeData(tool,model).then(response => { // this.toolsConfiguration = (this.$store.state as AppModel).tooling.toolsConfiguration; // this.edgeConfiguration = (this.$store.state as AppModel).tooling.edgesConfiguration; @@ -239,8 +243,12 @@ export default class toolingShanks extends Vue { } async deleteShank(model) { - new ToolingService().DeleteShank(model).then(response => { - this.selectedTool = null; - }); + ModalHelper.AskConfirm(this.$options.filters.localize("modal_confirm_delete", "Richiesta di conferma"), + this.$options.filters.localize("modal_confirm_delete_shank", "Confermi la cancellazione del codolo?"), + () => { + new ToolingService().DeleteShank(model).then(response => { + this.selectedTool = null; + }); + }, null); } } diff --git a/Step/wwwroot/src/components/tooling-shanks.vue b/Step/wwwroot/src/components/tooling-shanks.vue index 82bd2000..bd089c70 100644 --- a/Step/wwwroot/src/components/tooling-shanks.vue +++ b/Step/wwwroot/src/components/tooling-shanks.vue @@ -20,7 +20,7 @@
- @@ -100,7 +100,7 @@ v-if="c.name != ''" v-model="ct[c.name]" :read-only="c.readOnly" - :title="'tooling_equipment_param_' + c.name | localize(c.name)" + :title="'tooling_equipment_param_' + c.name | localize(c.name)" :type="c.type"> diff --git a/Step/wwwroot/src/modules/base-components/ModalHelper.ts b/Step/wwwroot/src/modules/base-components/ModalHelper.ts index 9f5830f1..77228dbb 100644 --- a/Step/wwwroot/src/modules/base-components/ModalHelper.ts +++ b/Step/wwwroot/src/modules/base-components/ModalHelper.ts @@ -1,11 +1,39 @@ +import Vue from "vue"; import { Factory, MessageService } from "src/_base"; +import { ConfirmModal } from "./"; export class ModalHelper { - public static ShowModal(view) { - Factory.Get(MessageService).publishToChannel("show-modal", view); - } - public static HideModal(view?) { - Factory.Get(MessageService).publishToChannel("hide-modal"); - } + + public static ShowModal(view, modalname: string = "modal") { + + Factory.Get(MessageService).publishToChannel("show-" + modalname, view); } + + public static HideModal(modalname: string = "modal") { + + Factory.Get(MessageService).publishToChannel("hide-" + modalname); + } + + public static AskConfirm(title: string, body: string, onConfirm: Function, onCancel: Function, modalcontainer: string = "modal2") { + + ConfirmModal.data = function () { + return { + title: title, + content: body, + onConfirm: onConfirm, + onCancel: onCancel, + containername: modalcontainer + } + }; + + var cm = Vue.component("confirmModal", ConfirmModal); + + // cm.$data.title = title; + // Vue.set(cm, "content", body); + // Vue.set(cm, "onCancel", onCancel); + // Vue.set(cm, "onConfirm", onConfirm); + + this.ShowModal(cm, modalcontainer); + } +} diff --git a/Step/wwwroot/src/modules/base-components/index.js b/Step/wwwroot/src/modules/base-components/index.js index 774fd187..a858edec 100644 --- a/Step/wwwroot/src/modules/base-components/index.js +++ b/Step/wwwroot/src/modules/base-components/index.js @@ -10,5 +10,6 @@ import AccordionMaintenance from "./accordion-maintenance.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"; -export { Loader, Modal, AppRibbon, UserInfo, ModalContainer, ModalHelper, ProcessInfo, Accordion, Keypad, cardutilities, card, AccordionMaintenance }; \ No newline at end of file +export { Loader, Modal, AppRibbon, UserInfo, ModalContainer, ModalHelper, ProcessInfo, Accordion, Keypad, cardutilities, card, AccordionMaintenance, ConfirmModal }; \ No newline at end of file diff --git a/Step/wwwroot/src/modules/base-components/modal-confirm.vue b/Step/wwwroot/src/modules/base-components/modal-confirm.vue new file mode 100644 index 00000000..64a073e5 --- /dev/null +++ b/Step/wwwroot/src/modules/base-components/modal-confirm.vue @@ -0,0 +1,42 @@ + + + diff --git a/Step/wwwroot/src/modules/base-components/modal-container.ts b/Step/wwwroot/src/modules/base-components/modal-container.ts index 31e99e92..2d453e42 100644 --- a/Step/wwwroot/src/modules/base-components/modal-container.ts +++ b/Step/wwwroot/src/modules/base-components/modal-container.ts @@ -1,23 +1,31 @@ import { Factory, MessageService } from "src/_base"; export default { computed: { - isVisible: function() { + isVisible: function () { return this.currentView != null; } }, - data: function() { + props: { + containerName: { default: "modal" }, + informHmi: { default: true } + }, + data: function () { return { currentView: null }; }, created() { - Factory.Get(MessageService).subscribeToChannel("show-modal", args => { - Factory.Get(MessageService).publishToChannel("HMI-show-modal"); + Factory.Get(MessageService).subscribeToChannel("show-" + this.containerName, args => { + debugger + if (this.informHmi) + Factory.Get(MessageService).publishToChannel("HMI-show-modal"); this.currentView = args[0]; }); - Factory.Get(MessageService).subscribeToChannel("hide-modal", args => { - Factory.Get(MessageService).publishToChannel("HMI-hide-modal",300); + Factory.Get(MessageService).subscribeToChannel("hide-" + this.containerName, args => { + debugger + if (this.informHmi) + Factory.Get(MessageService).publishToChannel("HMI-hide-modal", 300); this.currentView = null; }); } diff --git a/Step/wwwroot/src/modules/modal-confirm-delete.vue b/Step/wwwroot/src/modules/modal-confirm-delete.vue deleted file mode 100644 index 584d6dc9..00000000 --- a/Step/wwwroot/src/modules/modal-confirm-delete.vue +++ /dev/null @@ -1,25 +0,0 @@ - - - diff --git a/Step/wwwroot/src/services/depotService.ts b/Step/wwwroot/src/services/depotService.ts index ea7d68de..a2212534 100644 --- a/Step/wwwroot/src/services/depotService.ts +++ b/Step/wwwroot/src/services/depotService.ts @@ -3,15 +3,15 @@ import { depotActions } from "../store/depot.store"; import { store, AppModel } from "../store"; export class DepotService extends baseRestService { - + BASE_URL = "api/tool_manager/"; async GetMagazine(magazineId: any){ - let result = await this.Get("/api/tool_table/magazine/" + magazineId); + let result = await this.Get(this.BASE_URL + "magazine/" + magazineId); depotActions.updateDepot(store, result); return result; } async GetToolAvailable(){ - let result = await this.Get("/api/tool_table/magazine/available_tools"); + let result = await this.Get(this.BASE_URL + "magazine/available_tools"); depotActions.updateAvailableMultiTool(store, result.multiTools); depotActions.updateAvailableTool(store, result.tools); return result; diff --git a/Step/wwwroot/src/services/toolingService.ts b/Step/wwwroot/src/services/toolingService.ts index 0103c381..7abcc83f 100644 --- a/Step/wwwroot/src/services/toolingService.ts +++ b/Step/wwwroot/src/services/toolingService.ts @@ -3,36 +3,38 @@ import { toolingActions } from "../store/tooling.store"; import { store, AppModel } from "../store"; export class ToolingService extends baseRestService { + BASE_URL = "api/tool_manager/"; + async GetToolTableConfiguration() { let result = await this.Get( - "api/tool_table/configuration" + "api/configuration/tool_manager" ); toolingActions.updateMagazine(store, result.magazines); } async GetTools() { - let result = await this.Get("api/tool_table/tools"); + let result = await this.Get(this.BASE_URL + "tools"); toolingActions.updateTools(store, result); } async GetFamilies() { - let result = await this.Get("api/tool_table/families"); + let result = await this.Get(this.BASE_URL + "families"); toolingActions.clearFamilies(store); toolingActions.updateFamilies(store, result); } async GetShanks() { - let result = await this.Get("api/tool_table/shanks"); + let result = await this.Get(this.BASE_URL + "shanks"); toolingActions.updateShanks(store, result); } async GetMagazinesPositions() { let result = await this.Get( - "api/tool_table/magazines_positions" + this.BASE_URL + "magazines_positions" ); toolingActions.updateMagazinesPositions(store, result); } async GetToolsConfiguration() { let result = await this.Get( - "api/tool_table/configuration" + "api/configuration/tool_manager" ); toolingActions.updateToolsConfigurations(store, result.toolsConfiguration); toolingActions.updateMagazinePosConfigurations( @@ -66,89 +68,89 @@ export class ToolingService extends baseRestService { } async SetFamily(model: any) { - var response = await this.Post("/api/tool_table/family", model); + var response = await this.Post(this.BASE_URL + "family", model); toolingActions.updateFamily(store, response); return response; } async UpdateFamily(model: server.Families){ - var response = await this.Put("/api/tool_table/family/" + (model as any).oldName , model); - // debo salvare il modello perchè le families non hanno ID e quindi devo utilizzare il vecchio ID che mi genero lato client. + var response = await this.Put(this.BASE_URL + "family/" + (model as any).oldName , model); + // debo salvare il modello perch� le families non hanno ID e quindi devo utilizzare il vecchio ID che mi genero lato client. model.name = response.name; toolingActions.updateFamily(store, model); return response; } async SetShank(model: any) { - var response = await this.Post("/api/tool_table/shank", model); + var response = await this.Post(this.BASE_URL + "shank", model); toolingActions.updateShank(store, response); return response; } async SetSiemensTool(model: any) { - var response = await this.Post("/api/tool_table/siemens/tool", model); + var response = await this.Post(this.BASE_URL + "siemens/tool", model); toolingActions.updateTool(store, response); return response; } async UpdateSiemensTool(model: any){ - var response = await this.Put("/api/tool_table/siemens/tool/" + model.id, model); - // debo salvare il modello perchè le families non hanno ID e quindi devo utilizzare il vecchio ID che mi genero lato client. + var response = await this.Put(this.BASE_URL + "siemens/tool/" + model.id, model); + // debo salvare il modello perch� le families non hanno ID e quindi devo utilizzare il vecchio ID che mi genero lato client. toolingActions.updateTool(store, model); return response; } async DeleteTool(model: any) { - var result = await this.Delete("/api/tool_table/tool/" + model.id); + var result = await this.Delete(this.BASE_URL + "tool/" + model.id); toolingActions.deleteTool(store, model); return result; } async SetEdgeData(tool: any,model: any){ - var result = await this.Post("/api/tool_table/tool/" + tool.id + "/edge", model); + var result = await this.Post(this.BASE_URL + "tool/" + tool.id + "/edge", model); toolingActions.setEdgeData(store, {tool,result}); return result; } async UpdateEdgeData(tool: any, model: any){ - var result = await this.Put("/api/tool_table/tool/"+ tool.id + "/edge/" + model.id, model); + var result = await this.Put(this.BASE_URL + "tool/"+ tool.id + "/edge/" + model.id, model); toolingActions.updateEdgeData(store, model); return result; } async DeleteEdgeData(tool: any, model: any){ - var result = await this.Delete("/api/tool_table/tool/" + tool.id + "/edge/" + model.id); + var result = await this.Delete(this.BASE_URL + "tool/" + tool.id + "/edge/" + model.id); toolingActions.deleteEdgeData(store, {tool,model}); return result; } async DeleteFamily(model: any) { - var result = await this.Delete("/api/tool_table/family/" + model.oldName); + var result = await this.Delete(this.BASE_URL + "family/" + model.oldName); toolingActions.deleteFamily(store, model); return result; } async DeleteShank(model: any) { - var result = await this.Delete("/api/tool_table/shank/" + model.id); + var result = await this.Delete(this.BASE_URL + "shank/" + model.id); toolingActions.deleteShank(store, model); return result; } async UpdateShank(model: server.Shanks){ - var response = await this.Put("/api/tool_table/shank/" + model.id, model); + var response = await this.Put(this.BASE_URL + "shank/" + model.id, model); toolingActions.updateShank(store, model); return response; } async UpdateMagPos(model: server.MagazinesPositions){ - var response = await this.Put("/api/tool_table/magazine/" + model.magazineId + "/position/" + model.positionId, model); + var response = await this.Put(this.BASE_URL + "magazine/" + model.magazineId + "/position/" + model.positionId, model); toolingActions.updateMagazinePosition(store, model); return response; } async addToolToShank(shank: any, model: any){ - var response = await this.Put("/api/tool_table/shank/"+ shank.id + "/load/" + model.multitoolId + "/tool/" + model.id, model); + var response = await this.Put(this.BASE_URL + "shank/"+ shank.id + "/load/" + model.multitoolId + "/tool/" + model.id, model); toolingActions.addToolToShank(store,{shank, model}); return response; } async removeToolToShank(shank: any, model: any){ - var response = await this.Put("/api/tool_table/shank/"+ shank.id + "/unload/" + model.multitoolId + "/" + model.id, model); + var response = await this.Put(this.BASE_URL + "shank/"+ shank.id + "/unload/" + model.multitoolId + "/" + model.id, model); toolingActions.removeToolToShank(store,{shank, model}); return response; }