Fix tooltable & maintenances

This commit is contained in:
Lucio Maranta
2019-02-18 12:03:40 +01:00
parent e192c3ab93
commit 0ac7982c93
11 changed files with 85 additions and 35 deletions
Binary file not shown.
+1 -1
View File
@@ -14,7 +14,7 @@
<lang langKey="it">Sostituire tenute aria/liquido giunto assi rotanti</lang>
</localizedDescription>
<unitOfMeasure>mm</unitOfMeasure>
<counterId>1</counterId>
<counterId>0</counterId>
</maintenance>
<maintenance>
+6 -3
View File
@@ -985,12 +985,15 @@ namespace Step.NC
// Get matching counter for the current maintenance
counter = counters.Find(x => x.Id == currMaintenance.CounterId);
// Convert from seconds to minuts
var counterVal = counter.Value / 60;
int perfVal = 0;
if (performed != null)
perfVal = performed.CounterValue;
// Calc percentage = PLC - PERFORMED VALUE * 100 / interval
percentage = ((counter.Value - perfVal) * 100) / SupportFunctions.ConvertInMinutes(currMaintenance.Interval.Value, currMaintenance.UnitOfMeasure.Value);
missingDays = TimeSpan.FromMinutes(-1 * (counter.Value - perfVal - SupportFunctions.ConvertInMinutes(currMaintenance.Interval.Value, currMaintenance.UnitOfMeasure.Value)));
percentage = ((counterVal - perfVal) * 100) / SupportFunctions.ConvertInMinutes(currMaintenance.Interval.Value, currMaintenance.UnitOfMeasure.Value);
missingDays = TimeSpan.FromMinutes(-1 * ((counterVal / 60) - perfVal - SupportFunctions.ConvertInMinutes(currMaintenance.Interval.Value, currMaintenance.UnitOfMeasure.Value)));
}
break;
@@ -1109,7 +1112,7 @@ namespace Step.NC
perfVal = performed.CounterValue;
// MAINTENANCE_INTERVAL <= PLC - LASTPERFORMED
if (SupportFunctions.ConvertInMinutes(currMaintenance.Interval.Value, currMaintenance.UnitOfMeasure.Value) <= counter.Value - perfVal)
if (SupportFunctions.ConvertInMinutes(currMaintenance.Interval.Value, currMaintenance.UnitOfMeasure.Value) <= (counter.Value / 60) - perfVal)
{
// Update last expiration date if null
if (currMaintenance.LastExpirationDate == null)
@@ -62,7 +62,7 @@ namespace Step.Controllers.WebApi
if (!ModelState.IsValid)
return BadRequest(ModelState);
short id = 0;
short familyId = 0;
using (NcToolManagerController toolsManager = new NcToolManagerController())
{
// Check if option is active
@@ -71,7 +71,7 @@ namespace Step.Controllers.WebApi
if (dtoToolWithFamily.FamilyId == 0)
{
// If param equal to 0 create a new family
DTONewNcFamilyModel newFamily = new DTONewNcFamilyModel() { Name = "NewFamily" };
DTONewNcFamilyModel newFamily = new DTONewNcFamilyModel() { Name = "NewFamily", LeftSize = 1, RightSize = 1 };
// Add new family & update family id
DbNcFamilyModel newFam = toolsManager.AddFamily(newFamily);
dtoToolWithFamily.FamilyId = newFam.FamilyId;
@@ -104,7 +104,7 @@ namespace Step.Controllers.WebApi
dtoToolWithFamily.FamilyId = dbFam.FamilyId;
// Set common id
id = dbFam.FamilyId;
familyId = dbFam.FamilyId;
}
// Check if option is active
@@ -118,7 +118,7 @@ namespace Step.Controllers.WebApi
};
// Create a new shank
DbNcShankModel ncShank = toolsManager.AddShank(newShank, id);
DbNcShankModel ncShank = toolsManager.AddShank(newShank, familyId);
// Connect tool to new shank
dtoToolWithFamily.ShankId = ncShank.ShankId;
}
@@ -131,7 +131,7 @@ namespace Step.Controllers.WebApi
ncHandler.Connect();
// Add tool
CmsError cmsError = ncHandler.AddTool(dtoToolWithFamily, out DTONcToolModel newTool, id);
CmsError cmsError = ncHandler.AddTool(dtoToolWithFamily, out DTONcToolModel newTool, familyId);
if (cmsError.IsError())
return BadRequest(cmsError.localizationKey);
@@ -53,7 +53,7 @@ export default {
return this.$store.state.machineInfo.isSiemens;
},
isPositionCompatible(tool) {
return (this.$store.getters).positionCompatible(tool.id, ModalHelper.loadDepotModal.positionType);
return (this.$store.getters).positionCompatible(tool.id, ModalHelper.loadDepotModal.positionType);
},
save() {
this.magazineId = ModalHelper.loadDepotModal.magazineId;
@@ -66,7 +66,6 @@ export default {
});
}
else{
console.log(this.magazineId, this.positionId, { shankId: this.toolSelected.id }) ;
new DepotService().AddToolToDepotNc(this.magazineId, this.positionId, { shankId: this.toolSelected.id }).then(response => {
Factory.Get(MessageService).deleteChannel("esc_pressed");
toolingActions.updateBusyStatusPositions(store,this.magInfo.type,(this.$store.state as AppModel).depot.depotNc);
@@ -102,7 +101,7 @@ export default {
this.fitInPosition = (this.$store.state as AppModel).tooling.magPosDepot[this.positionId -1].canLoadTool;
}
else{
toolingActions.setCanLoadTool(store, this.toolSelected.maxRight,this.toolSelected.maxLeft,this.magInfo.type,(this.$store.state as AppModel).depot.depot);
toolingActions.setCanLoadTool(store, this.toolSelected.maxRight,this.toolSelected.maxLeft, this.magInfo.type, (this.$store.state as AppModel).depot.depotNc);
this.fitInPosition = (this.$store.state as AppModel).tooling.magPosNcDepot[this.positionId -1].canLoadTool;
}
}
@@ -584,9 +584,10 @@ export default class depot extends Vue {
ModalHelper.ShowModal(LoadDepot);
}
// SIEMENS
public doAddToDepotPosition(position, event) {
if (this.draggingTool && this.draggingPosition == position.positionId) {
if (this.toolAtPosition(position.positionId) || position.disabled || !this.checkMagPosType(position.type))
if (this.toolAtPosition(position.positionId) || !position.canLoadTool)
return
this.draggingIn = false;
@@ -598,9 +599,10 @@ export default class depot extends Vue {
}
}
// OSAI-FANUC
public doAddToNcDepotPosition(position, event) {
if (this.draggingTool && this.draggingPosition == position.positionId) {
if (this.ncToolAtPosition(position.positionId) || position.disabled || !this.checkMagPosType(position.type))
if (this.ncToolAtPosition(position.positionId) || !position.canLoadTool)
return
this.draggingIn = false;
this.draggingTool = null;
@@ -708,12 +710,12 @@ export default class depot extends Vue {
}
public calculateAvailablePositions() {
public calculateAvailablePositions() {
if(this.draggingTool){
if(this.isSiemens)
toolingActions.setCanLoadTool(store, this.draggingTool.rightSize,this.draggingTool.leftSize,this.magazineType,this.depot);
else
toolingActions.setCanLoadTool(store, this.draggingTool.maxRight,this.draggingTool.maxLeft,this.magazineType,this.depotNc);
toolingActions.setCanLoadTool(store, this.draggingTool.maxRight, this.draggingTool.maxLeft, this.magazineType, this.depotNc);
}
}
}
@@ -170,7 +170,7 @@
</div>
<div class="loading" v-if="onLoading"><i class="fa fa-circle-o-notch fa-spin"></i></div>
<div class="sd-section scrollable" ref="positionslist" >
<detail-card v-for="(pos, idx) in ncPositions" :key="pos.positionId" :label="'tooling_magpos_abbreviation' | localize('P%d',pos.positionId)" :number="pos.positionId" class="depot-position" @click="openModalLoadDepot(pos.positionId,pos.type)" :class="{'drop':draggingIn,'selected': currentPosition == idx, 'disabled':pos.disabled}" :magpos-occupied="ncToolAtPosition(pos.positionId)" :editable="editable" :disabled="pos.disabled">
<detail-card v-for="(pos, idx) in ncPositions" :key="pos.positionId" :label="'tooling_magpos_abbreviation' | localize('P%d',pos.positionId)" :number="pos.positionId" class="depot-position" @click="openModalLoadDepot(pos.positionId,pos.type)" :class="{'drop':draggingIn,'selected': currentPosition == idx, 'disabled':pos.disabled}" :magpos-occupied="ncToolAtPosition(pos.positionId) || pos.busyStatus != 4" :editable="editable" :disabled="pos.disabled">
<Container class="target" group-name="tools"
:shoud-animate-drop="disableDropAnimation"
@drag-enter="onDragEnter(pos.positionId)" @drag-leave="onDragLeave()"
@@ -28,7 +28,7 @@ export default class toolingFamilies extends Vue {
public searchText: string = "";
public currentFilter : string = "";
public typeNc: string = "Osai";
public familyIsInSpindle: boolean = false
@Watch("searchText")
public applyFilter(n) {
@@ -237,4 +237,36 @@ export default class toolingFamilies extends Vue {
}
}
@Watch("selectedTool")
public checkIfToolIsMountedInSpindle() {
if(this.selectedTool){
const heads = this.$store.state.machineInfo.heads
for (let i = 0; i < heads.length; i++) {
const head = this.getHeadsProperty(heads[i].id)
if(this.selectedTool.childTools){
// Check if one of the child tool is mounted in spindle
for(let j = 0; j < this.selectedTool.childTools.length; j++){
if(this.selectedTool.childTools[j].id === head.mountedTool){
this.familyIsInSpindle = true
return
}
});
}
}
this.familyIsInSpindle = false
return
}
}
getHeadsProperty(id) {
var r = this.$store.getters.getHeadsProperty(id);
return r || {};
}
}
@@ -127,7 +127,7 @@
</div>
</div>
<div class="box-right-body" v-if="enableParameters">
<button class="btn deleteElement" v-if="(!(isSiemens) || !isSiemens) && selectedTool.id" @click="deleteFamily(selectedTool)"><i class="fa fa-trash"></i></button>
<button class="btn deleteElement" v-if="!isSiemens && selectedTool.id" :disabled="familyIsInSpindle" @click="deleteFamily(selectedTool)"><i class="fa fa-trash"></i></button>
<div class="box-right-label-header" v-if="selectedTool.name">{{'tooling_families_boxright_editlabel' | localize("Modifica della famiglia %s", selectedTool.name)}}</div>
<div class="box-right-label-header" v-if="!selectedTool.name">{{'tooling_families_boxright_newlabel' | localize("Aggiunta nuova famiglia")}}</div>
<div class="list-skill-families scrollable">
@@ -146,8 +146,8 @@
</div>
<div class="tooling-equipment-footer" v-if="!isSiemens">
<button class="btn" v-if="!enableModify" @click="modify()">{{'tooling_equipment_button_modify' | localize("Modifica")}}</button>
<!-- <button class="btn" v-if="enableModify && selectedTool && !selectedTool.id" @click="cancelNewFamily()">{{'tooling_equipment_button_cancelNewFamily' | localize("Annulla")}}</button> -->
<div v-if="!enableModify && familyIsInSpindle" class="lock-icon"><i class="fa fa-lock"></i></div>
<button class="btn" v-if="!enableModify" :disabled="familyIsInSpindle" @click="modify()">{{'tooling_equipment_button_modify' | localize("Modifica")}}</button>
<button class="btn" v-if="enableModify" @click="cancel()">{{'tooling_equipment_button_cancel' | localize("Annulla")}}</button>
<button class="btn blue-reverse" v-if="enableModify" @click="buttonSave(selectedTool)">{{'tooling_equipment_button_save' | localize("Salva")}}</button>
</div>
@@ -174,7 +174,8 @@
</div>
<div class="tooling-equipment-footer">
<button class="btn" v-if="!enableModify" @click="modify()">{{'tooling_equipment_button_modify' | localize("Modifica")}}</button>
<div v-if="!enableModify" class="lock-icon"><i class="fa fa-lock"></i></div>
<button class="btn" v-if="!enableModify" @click="modify()">{{'tooling_equipment_button_modify' | localize("Modifica")}}</button>
<button class="btn" v-if="enableModify" @click="cancel()">{{'tooling_equipment_button_cancel' | localize("Annulla")}}</button>
<button class="btn blue-reverse" v-if="enableModify" @click="buttonSave(selectedTool)">{{'tooling_equipment_button_save' | localize("Salva")}}</button>
</div>
@@ -25,7 +25,6 @@ export default {
label:{default:""},
physicalType:{default:1},
magposOccupied:{ default: false },
magposOccupied:{ default: false },
editable:{ default: false },
disabled:{ default: false }
},
+26 -12
View File
@@ -191,7 +191,8 @@ export const toolingStore = {
if(!posType || posType==0)
return true;
let tool = state.tools.find(t => t.id === id);
let tool = state.tools.find(t => t.id === id);
if(tool){
if(tool.magazinePositionType == posType)
@@ -566,7 +567,7 @@ export const toolingStore = {
});
},
SetCanLoadTool(store, {sizeRight, sizeLeft,magazineType,tools}){
SetCanLoadTool(store, {sizeRight, sizeLeft, magazineType, tools}){
var magposDisabled = new Array();
var dimleftMount = sizeLeft/2.0;
@@ -578,9 +579,10 @@ export const toolingStore = {
positionMagazines = store.magPosDepot;
else
positionMagazines = store.magPosNcDepot;
var maxPos = positionMagazines.length;
//Check if is enabled
// Check if is enabled
positionMagazines.forEach(element => {
element.canLoadTool = !element.disabled;
if(element.disabled){
@@ -588,14 +590,14 @@ export const toolingStore = {
}
});
//Check disabled positions
// Check disabled positions
magposDisabled.forEach(element => {
var dimleft = 0.5;
var dimright = 0.5;
for (let index = 1; index < (dimrightMount + dimleft); index++) {
position = element.positionId -1 - index;
//Base on magazineType
// Base on magazineType
if(magazineType != 1 && magazineType != 2){
if(position>=0 && position < maxPos)
positionMagazines[position].canLoadTool = false
@@ -610,7 +612,7 @@ export const toolingStore = {
for (let index = 1; index < (dimleftMount + dimright); index++) {
position = element.positionId -1 + index;
//Base on magazineType
// Base on magazineType
if(magazineType != 1 && magazineType != 2){
if(position>=0 && position < maxPos)
positionMagazines[position].canLoadTool = false
@@ -624,25 +626,37 @@ export const toolingStore = {
}
});
//Check mounted tools dimension
// Check mounted tools dimension
var dimleft;
var dimright;
tools.forEach(element => {
if(element.childTool || element.childShank){
if(element.childTool || element.childShank || element.childsTools){
//Get Right Size
// Get Right Size
if(element.childShank){
dimleft = element.childShank.leftSize/2.0;
dimright = element.childShank.rightSize/2.0;
}else
} else if(element.childTool)
{
dimleft = element.childTool.leftSize/2.0;
dimright = element.childTool.rightSize/2.0;
}
else{
dimleft = element.maxLeft/2.0;
dimright = element.maxRight/2.0;
}
//Check dimensions
if(dimleft<0.5)
dimleft = 0.5;
if(dimright<0.5)
dimright = 0.5;
for (let index = 1; index < (dimrightMount + dimleft); index++) {
position = element.positionId -1 - index;
//Base on magazineType
// Base on magazineType
if(magazineType != 1 && magazineType != 2){
if(position>=0 && position < maxPos)
positionMagazines[position].canLoadTool = false
@@ -658,7 +672,7 @@ export const toolingStore = {
for (let index = 1; index < (dimleftMount + dimright); index++) {
position = element.positionId -1 + index;
//Base on magazineType
// Base on magazineType
if(magazineType != 1 && magazineType != 2){
if(position>=0 && position < maxPos)
positionMagazines[position].canLoadTool = false