commit merge

This commit is contained in:
Alessandro Francia
2018-05-24 08:44:48 +02:00
22 changed files with 254 additions and 215 deletions
Binary file not shown.
@@ -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);
}
}
}
}
+2 -43
View File
@@ -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<SiemensToolModel> 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<FamilyModel> 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<PositionModel> 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<ShankModel> 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<PositionModel> 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<MountedMultiToolModel> multiTools, out List<MountedToolModel> 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();
+1
View File
@@ -7,6 +7,7 @@
<under-the-hood></under-the-hood>
<div id="main-view" ref="main-view" :class="{liftedUp : isMainViewLiftedUp}">
<router-view/>
<modal-container name="modal" container-name="modal2" :inform-hmi="false" ></modal-container>
</div>
<div id="main-view-handler" ref="main-view-handler" @click="toggleMainView()" :class="{liftedUp : isMainViewLiftedUp}">
-5
View File
@@ -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");
+1 -5
View File
@@ -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" } },
+1 -1
View File
@@ -9,7 +9,7 @@
{{'depot_title' | localize("Magazzino")}} {{depotId}} - Lineare
</div>
<div class="depot-header-right">
<button class="btn" v-if="true" @click="StartToolingWizard()" >{{'depot_button_assistedtooling' | localize("Attrezzaggio automatico")}}</button>
<button class="btn" v-if="false" @click="StartToolingWizard()" >{{'depot_button_assistedtooling' | localize("Attrezzaggio automatico")}}</button>
</div>
</div>
<div class="depot-boxbody">
@@ -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<string>= new Set<string>();
let cat: Set<string> = new Set<string>();
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<string>= new Set<string>();
let cat: Set<string> = new Set<string>();
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<string>{
public getDynamicFields(tooltype: string): Array<string> {
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){
@@ -20,7 +20,7 @@
</div>
</div>
<div class="list-vertical scrollable" ref="toolList" :class="{'avoid-clicks': disableList}">
<equipment v-for="t in tools.filter(t => t.familyName.indexOf(currentFilter) >=0)" :key="t.id" :code="t.id" :title="t.familyName"
<equipment v-for="t in tools.filter(t => t.familyName.toLowerCase().indexOf(currentFilter) >=0)" :key="t.id" :code="t.id" :title="t.familyName"
:img-source="getToolIcon(t.toolType)"
:class="{selected: selectedTool == t}"
@click="selectTool(t)"></equipment>
@@ -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[] {
@@ -20,7 +20,7 @@
</div>
</div>
<div class="list-vertical scrollable" ref="familyList" :class="{'avoid-clicks': disableList}">
<equipment v-for="f in families.filter(f => f.name.indexOf(currentFilter) >=0)" :key="f.uid" :title="f.name || f.oldName"
<equipment v-for="f in families.filter(f => f.name.toLowerCase().indexOf(currentFilter) >=0)" :key="f.uid" :title="f.name || f.oldName"
:class="{selected: selectedTool && selectedTool.uid == f.uid}"
:img-source="'../assets/images/list-families.PNG'"
@click="selectTool(f)"></equipment>
@@ -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;
@@ -20,7 +20,7 @@
</div>
</div>
<div class="list-vertical scrollable" :class="{'avoid-clicks': disableList}">
<equipment v-for="(m,k) in magpos.filter(m =>(($options.filters.localize('tooling_magpos','Manina')) + ' ' + m.positionId).toString().indexOf(currentFilter) >=0)" :key="k" :code="'Magazzino' + ' ' + m.magazineId" :title="$options.filters.localize('tooling_magpos','Manina') + ' ' + m.positionId"
<equipment v-for="(m,k) in magpos.filter(m =>(($options.filters.localize('tooling_magpos','Manina')) + ' ' + m.positionId).toString().toLowerCase().indexOf(currentFilter) >=0)" :key="k" :code="'Magazzino' + ' ' + m.magazineId" :title="$options.filters.localize('tooling_magpos','Manina') + ' ' + m.positionId"
:class="{selected: selectedTool && selectedTool.positionId == m.positionId && selectedTool.magazineId == m.magazineId }"
:img-source="'../assets/images/list-mag-pos.PNG'"
@click="selectTool(m)"></equipment>
+47 -39
View File
@@ -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<string>= new Set<string>();
let cat: Set<string> = new Set<string>();
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);
}
}
@@ -20,7 +20,7 @@
</div>
</div>
<div class="list-vertical scrollable" ref="shankList" :class="{'avoid-clicks': disableList}">
<equipment v-for="s in shanks.filter(i => ($options.filters.localize('tooling_shanks_name','Codolo %d',i.id)).indexOf(currentFilter) >=0)" :key="s.id" :title="'tooling_shanks_name' | localize('Codolo %d', s.id)"
<equipment v-for="s in shanks.filter(i => ($options.filters.localize('tooling_shanks_name','Codolo %d',i.id)).toLowerCase().indexOf(currentFilter) >=0)" :key="s.id" :title="'tooling_shanks_name' | localize('Codolo %d', s.id)"
v-if="s.id != null"
:img-source="'../assets/images/list-shank.PNG'"
:class="{selected: selectedTool && selectedTool.id == s.id}"
@@ -58,7 +58,7 @@
v-if="s.name != '' && s.category == c"
v-model="selectedTool[s.name]"
:read-only="s.readOnly"
:title="'tooling_equipment_param_' + s.name | localize(s.name)"
:title="'tooling_equipment_param_' + s.name | localize(s.name)"
:type="s.type">
<option v-for="v in s.selectValues" :key="v" :value="v">{{v}}</option>
</input-box>
@@ -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">
<option v-for="(s, k) in c.selectValues" :key="k" :selected="ct.toolType" :value="k">{{k}} - {{'tooling_equipment_list_select_' + s | localize(s)}}</option>
</input-box>
@@ -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);
}
}
@@ -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 };
export { Loader, Modal, AppRibbon, UserInfo, ModalContainer, ModalHelper, ProcessInfo, Accordion, Keypad, cardutilities, card, AccordionMaintenance, ConfirmModal };
@@ -0,0 +1,42 @@
<template>
<modal type="modal-confirm-delete" :title="title">
<section class="modal-confirm-delete-body">
<span>{{content}}</span>
</section>
<footer class="modal-confirm-delete-footer">
<div class="pull-right">
<button class="btn" @click="Cancel()">{{'modal_ok_button' | localize("No")}}</button>
<button class="btn" @click="Ok()">{{'modal_cancel_button' | localize("Conferma")}}</button>
</div>
</footer>
</modal>
</template>
<script>
import Modal from "./modal.vue";
import {ModalHelper} from "./ModalHelper.ts";
export default {
name: "modalconfirm",
components: { modal: Modal },
data: function() {
return {
title: "",
content: "",
onConfirm: null,
onCancel: null,
containername: "modal"
}
},
methods: {
Ok() {
if (this.onConfirm) this.onConfirm();
ModalHelper.HideModal(this.containername);
},
Cancel() {
if (this.onCancel) this.onCancel();
ModalHelper.HideModal(this.containername);
}
}
};
</script>
@@ -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;
});
}
@@ -1,25 +0,0 @@
<template>
<modal type="modal-confirm-delete" :title="'modal_confirm_delete' | localize('Cancella')">
<section class="modal-confirm-delete-body">
<span>{{title}}</span>
</section>
<footer class="modal-confirm-delete-footer">
<div class="pull-right">
<button class="btn">{{'modal_confirm_delete_btn_no' | localize("No")}}</button>
<button class="btn">{{'modal_confirm_delete_btn_conferma' | localize("Conferma")}}</button>
</div>
</footer>
</modal>
</template>
<script>
import { Modal, ModalHelper } from "./base-components";
export default {
components: { modal: Modal },
props:{
title: {default:"Confermi l'eliminazione?"},
},
};
</script>
+3 -3
View File
@@ -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<server.DepotModel[]>("/api/tool_table/magazine/" + magazineId);
let result = await this.Get<server.DepotModel[]>(this.BASE_URL + "magazine/" + magazineId);
depotActions.updateDepot(store, result);
return result;
}
async GetToolAvailable(){
let result = await this.Get<any>("/api/tool_table/magazine/available_tools");
let result = await this.Get<any>(this.BASE_URL + "magazine/available_tools");
depotActions.updateAvailableMultiTool(store, result.multiTools);
depotActions.updateAvailableTool(store, result.tools);
return result;
+25 -23
View File
@@ -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<server.ToolTableInfoModel>(
"api/tool_table/configuration"
"api/configuration/tool_manager"
);
toolingActions.updateMagazine(store, result.magazines);
}
async GetTools() {
let result = await this.Get<server.Tool[]>("api/tool_table/tools");
let result = await this.Get<server.Tool[]>(this.BASE_URL + "tools");
toolingActions.updateTools(store, result);
}
async GetFamilies() {
let result = await this.Get<server.Families[]>("api/tool_table/families");
let result = await this.Get<server.Families[]>(this.BASE_URL + "families");
toolingActions.clearFamilies(store);
toolingActions.updateFamilies(store, result);
}
async GetShanks() {
let result = await this.Get<server.Shanks[]>("api/tool_table/shanks");
let result = await this.Get<server.Shanks[]>(this.BASE_URL + "shanks");
toolingActions.updateShanks(store, result);
}
async GetMagazinesPositions() {
let result = await this.Get<server.MagazinesPositions[]>(
"api/tool_table/magazines_positions"
this.BASE_URL + "magazines_positions"
);
toolingActions.updateMagazinesPositions(store, result);
}
async GetToolsConfiguration() {
let result = await this.Get<server.ToolTableInfoModel>(
"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<any>("/api/tool_table/family", model);
var response = await this.Post<any>(this.BASE_URL + "family", model);
toolingActions.updateFamily(store, response);
return response;
}
async UpdateFamily(model: server.Families){
var response = await this.Put<any>("/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<any>(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<any>("/api/tool_table/shank", model);
var response = await this.Post<any>(this.BASE_URL + "shank", model);
toolingActions.updateShank(store, response);
return response;
}
async SetSiemensTool(model: any) {
var response = await this.Post<any>("/api/tool_table/siemens/tool", model);
var response = await this.Post<any>(this.BASE_URL + "siemens/tool", model);
toolingActions.updateTool(store, response);
return response;
}
async UpdateSiemensTool(model: any){
var response = await this.Put<any>("/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<any>(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<any>("/api/tool_table/tool/" + model.id);
var result = await this.Delete<any>(this.BASE_URL + "tool/" + model.id);
toolingActions.deleteTool(store, model);
return result;
}
async SetEdgeData(tool: any,model: any){
var result = await this.Post<any>("/api/tool_table/tool/" + tool.id + "/edge", model);
var result = await this.Post<any>(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<any>("/api/tool_table/tool/"+ tool.id + "/edge/" + model.id, model);
var result = await this.Put<any>(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<any>("/api/tool_table/tool/" + tool.id + "/edge/" + model.id);
var result = await this.Delete<any>(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<any>("/api/tool_table/family/" + model.oldName);
var result = await this.Delete<any>(this.BASE_URL + "family/" + model.oldName);
toolingActions.deleteFamily(store, model);
return result;
}
async DeleteShank(model: any) {
var result = await this.Delete<any>("/api/tool_table/shank/" + model.id);
var result = await this.Delete<any>(this.BASE_URL + "shank/" + model.id);
toolingActions.deleteShank(store, model);
return result;
}
async UpdateShank(model: server.Shanks){
var response = await this.Put<server.Shanks>("/api/tool_table/shank/" + model.id, model);
var response = await this.Put<server.Shanks>(this.BASE_URL + "shank/" + model.id, model);
toolingActions.updateShank(store, model);
return response;
}
async UpdateMagPos(model: server.MagazinesPositions){
var response = await this.Put<server.MagazinesPositions>("/api/tool_table/magazine/" + model.magazineId + "/position/" + model.positionId, model);
var response = await this.Put<server.MagazinesPositions>(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<any>("/api/tool_table/shank/"+ shank.id + "/load/" + model.multitoolId + "/tool/" + model.id, model);
var response = await this.Put<any>(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<any>("/api/tool_table/shank/"+ shank.id + "/unload/" + model.multitoolId + "/" + model.id, model);
var response = await this.Put<any>(this.BASE_URL + "shank/"+ shank.id + "/unload/" + model.multitoolId + "/" + model.id, model);
toolingActions.removeToolToShank(store,{shank, model});
return response;
}